synapse-react-client 4.0.20 → 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.
Files changed (176) hide show
  1. package/dist/SWC.index.d.ts +1 -0
  2. package/dist/SWC.index.d.ts.map +1 -1
  3. package/dist/SWC.index.js +2 -1
  4. package/dist/SWC.index.js.map +1 -1
  5. package/dist/components/CardContainer/CardConfiguration.d.ts +2 -0
  6. package/dist/components/CardContainer/CardConfiguration.d.ts.map +1 -1
  7. package/dist/components/CardContainer/CardContainer.d.ts.map +1 -1
  8. package/dist/components/CardContainer/CardContainer.js +44 -50
  9. package/dist/components/CardContainer/CardContainer.js.map +1 -1
  10. package/dist/components/CardContainerLogic/CardContainerLogic.d.ts +14 -0
  11. package/dist/components/CardContainerLogic/CardContainerLogic.d.ts.map +1 -1
  12. package/dist/components/CardContainerLogic/CardContainerLogic.js +64 -40
  13. package/dist/components/CardContainerLogic/CardContainerLogic.js.map +1 -1
  14. package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js +1 -1
  15. package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js.map +1 -1
  16. package/dist/components/DataExplorer/DataExplorer.css +1 -1
  17. package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
  18. package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
  19. package/dist/components/DataExplorer/DataExplorer.module.scss +26 -7
  20. package/dist/components/DataGrid/DataGrid.d.ts +1 -0
  21. package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
  22. package/dist/components/DataGrid/DataGrid.js +72 -72
  23. package/dist/components/DataGrid/DataGrid.js.map +1 -1
  24. package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
  25. package/dist/components/DataGrid/SynapseGrid.js +209 -206
  26. package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
  27. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts +6 -3
  28. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts.map +1 -1
  29. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js +54 -46
  30. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js.map +1 -1
  31. package/dist/components/DataGrid/hooks/useColumnResizeHandles.d.ts.map +1 -1
  32. package/dist/components/DataGrid/hooks/useColumnResizeHandles.js +1 -1
  33. package/dist/components/DataGrid/hooks/useColumnResizeHandles.js.map +1 -1
  34. package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
  35. package/dist/components/DataGrid/useDataGridWebsocket.js +68 -67
  36. package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
  37. package/dist/components/DataGrid/utils/columnFactory.d.ts +1 -0
  38. package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
  39. package/dist/components/DataGrid/utils/columnFactory.js +5 -3
  40. package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
  41. package/dist/components/DataGrid/utils/modelColsToGrid.d.ts +1 -1
  42. package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
  43. package/dist/components/DataGrid/utils/modelColsToGrid.js +15 -14
  44. package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
  45. package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts +7 -0
  46. package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts.map +1 -0
  47. package/dist/components/DataGrid/utils/normalizeWebsocketError.js +8 -0
  48. package/dist/components/DataGrid/utils/normalizeWebsocketError.js.map +1 -0
  49. package/dist/components/GenericCard/GenericCard.d.ts +2 -0
  50. package/dist/components/GenericCard/GenericCard.d.ts.map +1 -1
  51. package/dist/components/GenericCard/GenericCard.js +76 -64
  52. package/dist/components/GenericCard/GenericCard.js.map +1 -1
  53. package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
  54. package/dist/components/GenericCard/TableRowGenericCard.js +33 -25
  55. package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
  56. package/dist/components/Goals/Goals.d.ts +8 -0
  57. package/dist/components/Goals/Goals.d.ts.map +1 -1
  58. package/dist/components/Goals/Goals.js +54 -40
  59. package/dist/components/Goals/Goals.js.map +1 -1
  60. package/dist/components/Plot/SynapseSankeyPlot.css +1 -0
  61. package/dist/components/Plot/SynapseSankeyPlot.d.ts +44 -2
  62. package/dist/components/Plot/SynapseSankeyPlot.d.ts.map +1 -1
  63. package/dist/components/Plot/SynapseSankeyPlot.js +343 -38
  64. package/dist/components/Plot/SynapseSankeyPlot.js.map +1 -1
  65. package/dist/components/Plot/SynapseSankeyPlot.module.js +15 -0
  66. package/dist/components/Plot/SynapseSankeyPlot.module.js.map +1 -0
  67. package/dist/components/Plot/SynapseSankeyPlot.module.scss +63 -0
  68. package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts +9 -0
  69. package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts.map +1 -0
  70. package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js +69 -0
  71. package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js.map +1 -0
  72. package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts +13 -0
  73. package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts.map +1 -0
  74. package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js +11 -0
  75. package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js.map +1 -0
  76. package/dist/components/ProjectVisibilityChip/index.d.ts +5 -0
  77. package/dist/components/ProjectVisibilityChip/index.d.ts.map +1 -0
  78. package/dist/components/ProjectVisibilityChip/index.js +7 -0
  79. package/dist/components/ProjectVisibilityChip/index.js.map +1 -0
  80. package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
  81. package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +1 -1
  82. package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
  83. package/dist/components/QueryWrapperPlotNav/RowSetView.d.ts.map +1 -1
  84. package/dist/components/QueryWrapperPlotNav/RowSetView.js +9 -12
  85. package/dist/components/QueryWrapperPlotNav/RowSetView.js.map +1 -1
  86. package/dist/components/RssFeedCards/RssFeedCards.d.ts +7 -15
  87. package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
  88. package/dist/components/RssFeedCards/RssFeedCards.js +114 -123
  89. package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
  90. package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts +13 -12
  91. package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts.map +1 -1
  92. package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js +88 -77
  93. package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js.map +1 -1
  94. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
  95. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +63 -74
  96. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
  97. package/dist/components/TableColumnSchemaEditor/ColumnModelForm.d.ts.map +1 -1
  98. package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js +72 -68
  99. package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js.map +1 -1
  100. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts +27 -1
  101. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts.map +1 -1
  102. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js +47 -36
  103. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js.map +1 -1
  104. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js +1 -1
  105. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js.map +1 -1
  106. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.d.ts +12 -12
  107. package/dist/components/TableColumnSchemaEditor/Validators/BooleanSchema.d.ts +4 -1
  108. package/dist/components/TableColumnSchemaEditor/Validators/BooleanSchema.d.ts.map +1 -1
  109. package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.d.ts +167 -517
  110. package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.d.ts.map +1 -1
  111. package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.js +65 -65
  112. package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.js.map +1 -1
  113. package/dist/components/TableColumnSchemaEditor/Validators/DatetimeSchema.d.ts +1 -1
  114. package/dist/components/TableColumnSchemaEditor/Validators/DatetimeSchema.d.ts.map +1 -1
  115. package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.d.ts +1 -1
  116. package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.d.ts.map +1 -1
  117. package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.js +6 -13
  118. package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.js.map +1 -1
  119. package/dist/components/TableColumnSchemaEditor/Validators/EntityIdSchema.d.ts +1 -1
  120. package/dist/components/TableColumnSchemaEditor/Validators/EntityIdSchema.d.ts.map +1 -1
  121. package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.d.ts +1 -1
  122. package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.d.ts.map +1 -1
  123. package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.js +2 -2
  124. package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.js.map +1 -1
  125. package/dist/components/TableColumnSchemaEditor/Validators/OptionalStringSchema.d.ts +1 -1
  126. package/dist/components/TableColumnSchemaEditor/Validators/OptionalStringSchema.d.ts.map +1 -1
  127. package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.d.ts +2 -2
  128. package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.d.ts.map +1 -1
  129. package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.js +15 -16
  130. package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.js.map +1 -1
  131. package/dist/components/UserCardList/UserCardList.d.ts +2 -20
  132. package/dist/components/UserCardList/UserCardList.d.ts.map +1 -1
  133. package/dist/components/UserCardList/UserCardList.js +49 -72
  134. package/dist/components/UserCardList/UserCardList.js.map +1 -1
  135. package/dist/components/UserCardList/UserCardListRotate.d.ts +13 -0
  136. package/dist/components/UserCardList/UserCardListRotate.d.ts.map +1 -1
  137. package/dist/components/UserCardList/UserCardListRotate.js +82 -57
  138. package/dist/components/UserCardList/UserCardListRotate.js.map +1 -1
  139. package/dist/mocks/mockSearchQueryData.js +2 -2
  140. package/dist/mocks/mockSearchQueryData.js.map +1 -1
  141. package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts +1 -1
  142. package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -1
  143. package/dist/mocks/msw/handlers/searchQueryHandlers.js +6 -3
  144. package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -1
  145. package/dist/mocks/query/mockUserCardTableQueryResultBundle.d.ts +13 -0
  146. package/dist/mocks/query/mockUserCardTableQueryResultBundle.d.ts.map +1 -1
  147. package/dist/mocks/query/mockUserCardTableQueryResultBundle.js +27 -0
  148. package/dist/mocks/query/mockUserCardTableQueryResultBundle.js.map +1 -1
  149. package/dist/style/abstracts/_cssVariables.scss +1 -0
  150. package/dist/style/components/_cards.scss +10 -0
  151. package/dist/style/components/_data-grid-extra.css +1 -1
  152. package/dist/style/components/_data-grid-extra.scss +7 -1
  153. package/dist/style/main.css +1 -1
  154. package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
  155. package/dist/synapse-client/SynapseClient.js +497 -495
  156. package/dist/synapse-client/SynapseClient.js.map +1 -1
  157. package/dist/synapse-queries/KeyFactory.d.ts +1 -0
  158. package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
  159. package/dist/synapse-queries/KeyFactory.js +3 -0
  160. package/dist/synapse-queries/KeyFactory.js.map +1 -1
  161. package/dist/synapse-queries/index.js +46 -44
  162. package/dist/synapse-queries/user/index.js +3 -3
  163. package/dist/synapse-queries/user/useUserBundle.d.ts +12 -0
  164. package/dist/synapse-queries/user/useUserBundle.d.ts.map +1 -1
  165. package/dist/synapse-queries/user/useUserBundle.js +50 -36
  166. package/dist/synapse-queries/user/useUserBundle.js.map +1 -1
  167. package/dist/tsconfig.build.tsbuildinfo +1 -1
  168. package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts +10 -5
  169. package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts.map +1 -1
  170. package/dist/utils/AppUtils/session/SessionInitializedGuard.js +13 -9
  171. package/dist/utils/AppUtils/session/SessionInitializedGuard.js.map +1 -1
  172. package/dist/utils/functions/SqlFunctions.d.ts +1 -1
  173. package/dist/utils/functions/SqlFunctions.d.ts.map +1 -1
  174. package/dist/utils/functions/SqlFunctions.js +1 -1
  175. package/dist/utils/functions/SqlFunctions.js.map +1 -1
  176. package/package.json +7 -5
@@ -10,12 +10,16 @@ import { Box as s, Stack as c } from "@mui/material";
10
10
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
11
11
  //#region src/components/GenericCard/GenericCard.tsx
12
12
  var d = [], f = o(function(o, f) {
13
- let { icon: p, type: m, title: h, titleLinkConfiguration: g, titleAsFileHandleLinkConfiguration: _, subtitle: v, description: y, descriptionSubTitle: b = "", descriptionConfig: x, cardTopContent: S, cardTopButtons: C, isHeader: w = !1, headerCardVariant: T, useStylesForDisplayedImage: E = !1, labels: D = d, secondaryLabelLimit: O, ctaLinkConfig: k, renderedIconList: A, sustainabilityScorecard: j, cardTypeAdornment: M, titleAreaRightContent: N, charCountCutoff: P } = o, F = D.length > 0;
14
- return w ? /* @__PURE__ */ l(a, {
13
+ let { icon: p, type: m, title: h, titleLinkConfiguration: g, titleAsFileHandleLinkConfiguration: _, subtitle: v, description: y, descriptionSubTitle: b = "", descriptionConfig: x, cardTopContent: S, cardTopButtons: C, isHeader: w = !1, headerCardVariant: T, useStylesForDisplayedImage: E = !1, labels: D = d, secondaryLabelLimit: O, ctaLinkConfig: k, ctaLinkPosition: A, renderedIconList: j, sustainabilityScorecard: M, cardTypeAdornment: N, titleAreaRightContent: P, charCountCutoff: F } = o, I = D.length > 0, L = {
14
+ marginTop: w ? "0px" : void 0,
15
+ marginBottom: w ? "0px" : void 0,
16
+ paddingBottom: I || E ? void 0 : "15px"
17
+ };
18
+ if (w) return /* @__PURE__ */ l(a, {
15
19
  ref: f,
16
20
  headerCardVariant: T,
17
21
  descriptionConfig: x,
18
- charCountCutoff: P,
22
+ charCountCutoff: F,
19
23
  title: h,
20
24
  subTitle: v,
21
25
  description: y,
@@ -29,24 +33,26 @@ var d = [], f = o(function(o, f) {
29
33
  secondaryLabelLimit: O,
30
34
  cardTopButtons: C,
31
35
  cardTopContent: S,
32
- sustainabilityScorecard: j,
33
- renderedIconList: A,
34
- cardTypeAdornment: M,
36
+ sustainabilityScorecard: M,
37
+ renderedIconList: j,
38
+ cardTypeAdornment: N,
35
39
  titleAsFileHandleLinkConfiguration: _,
36
- titleAreaRightContent: N,
40
+ titleAreaRightContent: P,
37
41
  descriptionSubTitle: b
38
- }) : /* @__PURE__ */ u("div", {
39
- style: {
40
- marginTop: w ? "0px" : void 0,
41
- marginBottom: w ? "0px" : void 0,
42
- paddingBottom: F || E ? void 0 : "15px"
43
- },
42
+ });
43
+ let R = k ? (Array.isArray(k) ? k : [k]).map((e, n) => e.text && e.href && /* @__PURE__ */ l(t, {
44
+ href: e.href,
45
+ target: e.target,
46
+ children: e.text
47
+ }, n)) : null;
48
+ return /* @__PURE__ */ u("div", {
49
+ style: L,
44
50
  ref: f,
45
51
  className: "SRC-portalCard",
46
52
  children: [/* @__PURE__ */ u("div", {
47
53
  className: "SRC-portalCardMain",
48
54
  children: [p, /* @__PURE__ */ u("div", {
49
- className: "SRC-cardContent",
55
+ className: `SRC-cardContent ${A === "right" ? "SRC-cardContent--ctaRight" : ""}`,
50
56
  children: [
51
57
  C && /* @__PURE__ */ l(s, {
52
58
  sx: {
@@ -68,61 +74,67 @@ var d = [], f = o(function(o, f) {
68
74
  children: [/* @__PURE__ */ l("div", {
69
75
  className: "SRC-type",
70
76
  children: m
71
- }), M]
77
+ }), N]
72
78
  }),
73
- A,
79
+ j,
74
80
  /* @__PURE__ */ u(s, {
75
- className: "SRC-cardTitleArea",
76
- children: [/* @__PURE__ */ u(s, {
77
- sx: {
78
- flex: 1,
79
- minWidth: 0
80
- },
81
- children: [
82
- /* @__PURE__ */ l("div", { children: /* @__PURE__ */ u("h3", {
83
- className: "SRC-boldText SRC-blackText",
84
- style: { margin: "none" },
85
- children: [!_ && /* @__PURE__ */ l(n, {
86
- title: h,
87
- href: g?.href,
88
- target: g?.target
89
- }), _ && /* @__PURE__ */ l(r, {
90
- fileHandleAssociation: _.fileHandleAssociation,
91
- showDownloadIcon: _.showDownloadIcon,
92
- displayValue: h
93
- })]
94
- }) }),
95
- v && /* @__PURE__ */ l("div", {
96
- className: "SRC-author",
97
- children: v
98
- }),
99
- /* @__PURE__ */ l(i, {
100
- description: y,
101
- descriptionSubTitle: b,
102
- descriptionConfig: x
103
- }),
104
- k && /* @__PURE__ */ l(s, {
105
- sx: {
106
- mt: "20px",
107
- display: "flex",
108
- gap: 2,
109
- flexWrap: "wrap"
110
- },
111
- children: (Array.isArray(k) ? k : [k]).map((e, n) => e.text && e.href && /* @__PURE__ */ l(t, {
112
- href: e.href,
113
- target: e.target,
114
- children: e.text
115
- }, n))
116
- })
117
- ]
118
- }), N && /* @__PURE__ */ l("div", {
119
- className: "SRC-cardTitleAreaDetails",
120
- children: N
121
- })]
81
+ className: `SRC-cardTitleArea ${A === "right" ? "SRC-cardTitleArea--ctaRight" : ""}`,
82
+ children: [
83
+ /* @__PURE__ */ u(s, {
84
+ sx: {
85
+ flex: 1,
86
+ minWidth: 0
87
+ },
88
+ children: [
89
+ /* @__PURE__ */ l("div", { children: /* @__PURE__ */ u("h3", {
90
+ className: "SRC-boldText SRC-blackText",
91
+ style: { margin: "none" },
92
+ children: [!_ && /* @__PURE__ */ l(n, {
93
+ title: h,
94
+ href: g?.href,
95
+ target: g?.target
96
+ }), _ && /* @__PURE__ */ l(r, {
97
+ fileHandleAssociation: _.fileHandleAssociation,
98
+ showDownloadIcon: _.showDownloadIcon,
99
+ displayValue: h
100
+ })]
101
+ }) }),
102
+ v && /* @__PURE__ */ l("div", {
103
+ className: "SRC-author",
104
+ children: v
105
+ }),
106
+ /* @__PURE__ */ l(i, {
107
+ description: y,
108
+ descriptionSubTitle: b,
109
+ descriptionConfig: x
110
+ }),
111
+ k && A !== "right" && /* @__PURE__ */ l(s, {
112
+ sx: {
113
+ mt: "20px",
114
+ display: "flex",
115
+ gap: 2,
116
+ flexWrap: "wrap"
117
+ },
118
+ children: R
119
+ })
120
+ ]
121
+ }),
122
+ P && /* @__PURE__ */ l("div", {
123
+ className: "SRC-cardTitleAreaDetails",
124
+ children: P
125
+ }),
126
+ A === "right" && k && /* @__PURE__ */ l(s, {
127
+ sx: {
128
+ flexShrink: 0,
129
+ marginLeft: "auto"
130
+ },
131
+ children: R
132
+ })
133
+ ]
122
134
  })
123
135
  ]
124
136
  })]
125
- }), F && /* @__PURE__ */ l(e, {
137
+ }), I && /* @__PURE__ */ l(e, {
126
138
  isHeader: !1,
127
139
  secondaryLabelLimit: O,
128
140
  values: D,
@@ -1 +1 @@
1
- {"version":3,"file":"GenericCard.js","names":[],"sources":["../../../src/components/GenericCard/GenericCard.tsx"],"sourcesContent":["import { GenericCardTitle } from '@/components/GenericCard/GenericCardTitle'\nimport { CardLabel } from '@/components/row_renderers/utils/CardFooter'\nimport { Box, Stack } from '@mui/material'\nimport { FileHandleAssociation } from '@sage-bionetworks/synapse-types'\nimport React, { CSSProperties, forwardRef } from 'react'\nimport { DescriptionConfig } from '../CardContainerLogic'\nimport HeaderCard, { HeaderCardVariant } from '../HeaderCard'\nimport { CardFooter } from '../row_renderers/utils'\nimport { SmartLink } from '../SmartLink/SmartLink'\nimport { SustainabilityScorecardProps } from '../SustainabilityScorecard/SustainabilityScorecard'\nimport { FileHandleLink } from '../widgets/FileHandleLink'\nimport { CollapsibleDescription } from './CollapsibleDescription'\n\n/** Resolved CTA link configuration with actual href values (as opposed to CTACardLink which uses column names) */\nexport type CTALinkConfig = {\n text: React.ReactNode\n href?: string\n target?: string\n}\n\nexport type GenericCardProps = {\n /** String representing the 'type' of object. This is displayed as a label on the card. */\n type: string\n /** The title displayed on the card. */\n title: string\n /** Optionally provide href/target if the title should be a link */\n titleLinkConfiguration?: {\n href: string\n target: string\n }\n /** Optionally provide configuration if the title should be a link to a Synapse FileHandle */\n titleAsFileHandleLinkConfiguration?: {\n /** The FileHandleAssociation used to get access to the file handle */\n fileHandleAssociation: FileHandleAssociation\n /** Whether a 'download' icon should be shown */\n showDownloadIcon: boolean\n }\n /** An optional subtitle to be displayed on the card */\n subtitle?: string\n /** An description to be displayed on the card */\n description: string\n /** An optional description subtitle to be displayed on the card */\n descriptionSubTitle?: string\n /** Configuration for altering the display of the description prop */\n descriptionConfig?: DescriptionConfig\n /** Optional slot for adding content to the top of the card */\n cardTopContent?: React.ReactNode\n /** Optional slot for adding action buttons to the top of the card */\n cardTopButtons?: React.ReactNode\n /** If true, a HeaderCard component will be rendered */\n isHeader?: boolean\n /** The variant of HeaderCard to render if `isHeader` is true */\n headerCardVariant?: HeaderCardVariant\n /** Set to true if the icon is an arbitrary image. The card styles will be updated to accommodate the image\n * @default false */\n useStylesForDisplayedImage?: boolean\n /**\n * The rendered icon on the card\n */\n icon: React.ReactNode\n /**\n * The card labels to be displayed in the footer of the card\n */\n labels?: CardLabel[]\n /**\n * The initial number of labels to display in the footer of the card\n */\n secondaryLabelLimit?: number\n /**\n * Optional configuration for displaying CTA button(s) on the card. Accepts a single config or an array.\n */\n ctaLinkConfig?: CTALinkConfig | CTALinkConfig[]\n /**\n * The rendered icon list on the card\n */\n renderedIconList?: React.ReactNode\n /**\n * Optional sustainability scorecard to be displayed on the header card\n */\n sustainabilityScorecard?: SustainabilityScorecardProps\n /**\n * Optional ReactNode to be rendered next to the card type\n */\n cardTypeAdornment?: React.ReactNode\n /**\n * Optional content to render to the right of the title/subtitle/description area.\n */\n titleAreaRightContent?: React.ReactNode\n /**\n * Character count threshold for truncating description\n * @default 400\n */\n charCountCutoff?: number\n}\n\nconst EMPTY_CARD_LABEL_ARRAY: CardLabel[] = []\n\n/**\n * Generic portal card UI component with a predefined layout\n */\nexport const GenericCard = forwardRef(function GenericCard(\n props: GenericCardProps,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n icon,\n type,\n title,\n titleLinkConfiguration,\n titleAsFileHandleLinkConfiguration,\n subtitle,\n description,\n descriptionSubTitle = '',\n descriptionConfig,\n cardTopContent,\n cardTopButtons,\n isHeader = false,\n headerCardVariant,\n useStylesForDisplayedImage = false,\n labels = EMPTY_CARD_LABEL_ARRAY,\n secondaryLabelLimit,\n ctaLinkConfig,\n renderedIconList,\n sustainabilityScorecard,\n cardTypeAdornment,\n titleAreaRightContent,\n charCountCutoff,\n } = props\n\n const showFooter = labels.length > 0\n\n const style: CSSProperties = {\n // undefined, take default value from class\n marginTop: isHeader ? '0px' : undefined,\n marginBottom: isHeader ? '0px' : undefined,\n paddingBottom:\n showFooter || useStylesForDisplayedImage ? undefined : '15px',\n }\n\n if (isHeader) {\n return (\n <HeaderCard\n ref={ref}\n headerCardVariant={headerCardVariant}\n descriptionConfig={descriptionConfig}\n charCountCutoff={charCountCutoff}\n title={title}\n subTitle={subtitle}\n description={description}\n type={type}\n icon={icon}\n values={labels}\n href={titleLinkConfiguration?.href}\n target={titleLinkConfiguration?.target}\n ctaLinkConfig={ctaLinkConfig}\n isAlignToLeftNav={true}\n secondaryLabelLimit={secondaryLabelLimit}\n cardTopButtons={cardTopButtons}\n cardTopContent={cardTopContent}\n sustainabilityScorecard={sustainabilityScorecard}\n renderedIconList={renderedIconList}\n cardTypeAdornment={cardTypeAdornment}\n titleAsFileHandleLinkConfiguration={titleAsFileHandleLinkConfiguration}\n titleAreaRightContent={titleAreaRightContent}\n descriptionSubTitle={descriptionSubTitle}\n />\n )\n }\n\n return (\n <div style={style} ref={ref} className={'SRC-portalCard'}>\n <div className={'SRC-portalCardMain'}>\n {icon}\n <div className=\"SRC-cardContent\">\n {cardTopButtons && (\n <Box\n sx={{\n position: 'absolute',\n right: '24px',\n display: 'flex',\n float: 'right',\n flexDirection: 'row',\n gap: '10px',\n }}\n >\n {cardTopButtons}\n </Box>\n )}\n <Stack\n sx={{\n flexDirection: 'row',\n alignItems: 'center',\n gap: '10px',\n }}\n >\n <div className=\"SRC-type\">{type}</div>\n {cardTypeAdornment}\n </Stack>\n {renderedIconList}\n <Box className=\"SRC-cardTitleArea\">\n <Box sx={{ flex: 1, minWidth: 0 }}>\n <div>\n <h3\n className=\"SRC-boldText SRC-blackText\"\n style={{ margin: 'none' }}\n >\n {!titleAsFileHandleLinkConfiguration && (\n <GenericCardTitle\n title={title}\n href={titleLinkConfiguration?.href}\n target={titleLinkConfiguration?.target}\n />\n )}\n {titleAsFileHandleLinkConfiguration && (\n <FileHandleLink\n fileHandleAssociation={\n titleAsFileHandleLinkConfiguration.fileHandleAssociation\n }\n showDownloadIcon={\n titleAsFileHandleLinkConfiguration.showDownloadIcon\n }\n displayValue={title}\n />\n )}\n </h3>\n </div>\n {subtitle && <div className=\"SRC-author\">{subtitle}</div>}\n <CollapsibleDescription\n description={description}\n descriptionSubTitle={descriptionSubTitle}\n descriptionConfig={descriptionConfig}\n />\n {ctaLinkConfig && (\n <Box\n sx={{ mt: '20px', display: 'flex', gap: 2, flexWrap: 'wrap' }}\n >\n {(Array.isArray(ctaLinkConfig)\n ? ctaLinkConfig\n : [ctaLinkConfig]\n ).map(\n (config, index) =>\n config.text &&\n config.href && (\n <SmartLink\n key={index}\n href={config.href}\n target={config.target}\n >\n {config.text}\n </SmartLink>\n ),\n )}\n </Box>\n )}\n </Box>\n {titleAreaRightContent && (\n <div className=\"SRC-cardTitleAreaDetails\">\n {titleAreaRightContent}\n </div>\n )}\n </Box>\n </div>\n </div>\n {showFooter && (\n <CardFooter\n isHeader={false}\n secondaryLabelLimit={secondaryLabelLimit}\n values={labels}\n className={useStylesForDisplayedImage ? undefined : 'hasIcon'}\n cardTopContent={cardTopContent}\n />\n )}\n </div>\n )\n})\n\nexport default GenericCard\n"],"mappings":";;;;;;;;;;;AA+FA,IAAM,IAAsC,CAAC,GAKhC,IAAc,EAAW,SACpC,GACA,GACA;CACA,IAAM,EACJ,SACA,SACA,UACA,2BACA,uCACA,aACA,gBACA,yBAAsB,IACtB,sBACA,mBACA,mBACA,cAAW,IACX,sBACA,gCAA6B,IAC7B,YAAS,GACT,wBACA,kBACA,qBACA,4BACA,sBACA,0BACA,uBACE,GAEE,IAAa,EAAO,SAAS;CAwCnC,OA9BI,IAEA,kBAAC,GAAD;EACO;EACc;EACA;EACF;EACV;EACP,UAAU;EACG;EACP;EACA;EACN,QAAQ;EACR,MAAM,GAAwB;EAC9B,QAAQ,GAAwB;EACjB;EACf,kBAAkB;EACG;EACL;EACA;EACS;EACP;EACC;EACiB;EACb;EACF;CACtB,CAAA,IAKH,kBAAC,OAAD;EAAY;GArCZ,WAAW,IAAW,QAAQ,KAAA;GAC9B,cAAc,IAAW,QAAQ,KAAA;GACjC,eACE,KAAc,IAA6B,KAAA,IAAY;EAkC7C;EAAY;EAAK,WAAW;YAAxC,CACE,kBAAC,OAAD;GAAK,WAAW;aAAhB,CACG,GACD,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,KACC,kBAAC,GAAD;MACE,IAAI;OACF,UAAU;OACV,OAAO;OACP,SAAS;OACT,OAAO;OACP,eAAe;OACf,KAAK;MACP;gBAEC;KACE,CAAA;KAEP,kBAAC,GAAD;MACE,IAAI;OACF,eAAe;OACf,YAAY;OACZ,KAAK;MACP;gBALF,CAOE,kBAAC,OAAD;OAAK,WAAU;iBAAY;MAAU,CAAA,GACpC,CACI;;KACN;KACD,kBAAC,GAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,GAAD;OAAK,IAAI;QAAE,MAAM;QAAG,UAAU;OAAE;iBAAhC;QACE,kBAAC,OAAD,EAAA,UACE,kBAAC,MAAD;SACE,WAAU;SACV,OAAO,EAAE,QAAQ,OAAO;mBAF1B,CAIG,CAAC,KACA,kBAAC,GAAD;UACS;UACP,MAAM,GAAwB;UAC9B,QAAQ,GAAwB;SACjC,CAAA,GAEF,KACC,kBAAC,GAAD;UACE,uBACE,EAAmC;UAErC,kBACE,EAAmC;UAErC,cAAc;SACf,CAAA,CAED;WACD,CAAA;QACJ,KAAY,kBAAC,OAAD;SAAK,WAAU;mBAAc;QAAc,CAAA;QACxD,kBAAC,GAAD;SACe;SACQ;SACF;QACpB,CAAA;QACA,KACC,kBAAC,GAAD;SACE,IAAI;UAAE,IAAI;UAAQ,SAAS;UAAQ,KAAK;UAAG,UAAU;SAAO;oBAE1D,MAAM,QAAQ,CAAa,IACzB,IACA,CAAC,CAAa,GAChB,KACC,GAAQ,MACP,EAAO,QACP,EAAO,QACL,kBAAC,GAAD;UAEE,MAAM,EAAO;UACb,QAAQ,EAAO;oBAEd,EAAO;SACC,GALJ,CAKI,CAEjB;QACG,CAAA;OAEJ;UACJ,KACC,kBAAC,OAAD;OAAK,WAAU;iBACZ;MACE,CAAA,CAEJ;;IACF;KACF;MACJ,KACC,kBAAC,GAAD;GACE,UAAU;GACW;GACrB,QAAQ;GACR,WAAW,IAA6B,KAAA,IAAY;GACpC;EACjB,CAAA,CAEA;;AAET,CAAC"}
1
+ {"version":3,"file":"GenericCard.js","names":[],"sources":["../../../src/components/GenericCard/GenericCard.tsx"],"sourcesContent":["import { GenericCardTitle } from '@/components/GenericCard/GenericCardTitle'\nimport { CardLabel } from '@/components/row_renderers/utils/CardFooter'\nimport { Box, Stack } from '@mui/material'\nimport { FileHandleAssociation } from '@sage-bionetworks/synapse-types'\nimport React, { CSSProperties, forwardRef } from 'react'\nimport { DescriptionConfig } from '../CardContainerLogic'\nimport HeaderCard, { HeaderCardVariant } from '../HeaderCard'\nimport { CardFooter } from '../row_renderers/utils'\nimport { SmartLink } from '../SmartLink/SmartLink'\nimport { SustainabilityScorecardProps } from '../SustainabilityScorecard/SustainabilityScorecard'\nimport { FileHandleLink } from '../widgets/FileHandleLink'\nimport { CollapsibleDescription } from './CollapsibleDescription'\n\n/** Resolved CTA link configuration with actual href values (as opposed to CTACardLink which uses column names) */\nexport type CTALinkConfig = {\n text: React.ReactNode\n href?: string\n target?: string\n}\n\nexport type GenericCardProps = {\n /** String representing the 'type' of object. This is displayed as a label on the card. */\n type: string\n /** The title displayed on the card. */\n title: string\n /** Optionally provide href/target if the title should be a link */\n titleLinkConfiguration?: {\n href: string\n target: string\n }\n /** Optionally provide configuration if the title should be a link to a Synapse FileHandle */\n titleAsFileHandleLinkConfiguration?: {\n /** The FileHandleAssociation used to get access to the file handle */\n fileHandleAssociation: FileHandleAssociation\n /** Whether a 'download' icon should be shown */\n showDownloadIcon: boolean\n }\n /** An optional subtitle to be displayed on the card */\n subtitle?: string\n /** An description to be displayed on the card */\n description: string\n /** An optional description subtitle to be displayed on the card */\n descriptionSubTitle?: string\n /** Configuration for altering the display of the description prop */\n descriptionConfig?: DescriptionConfig\n /** Optional slot for adding content to the top of the card */\n cardTopContent?: React.ReactNode\n /** Optional slot for adding action buttons to the top of the card */\n cardTopButtons?: React.ReactNode\n /** Optional position of CTA link(s) */\n ctaLinkPosition?: 'right'\n /** If true, a HeaderCard component will be rendered */\n isHeader?: boolean\n /** The variant of HeaderCard to render if `isHeader` is true */\n headerCardVariant?: HeaderCardVariant\n /** Set to true if the icon is an arbitrary image. The card styles will be updated to accommodate the image\n * @default false */\n useStylesForDisplayedImage?: boolean\n /**\n * The rendered icon on the card\n */\n icon: React.ReactNode\n /**\n * The card labels to be displayed in the footer of the card\n */\n labels?: CardLabel[]\n /**\n * The initial number of labels to display in the footer of the card\n */\n secondaryLabelLimit?: number\n /**\n * Optional configuration for displaying CTA button(s) on the card. Accepts a single config or an array.\n */\n ctaLinkConfig?: CTALinkConfig | CTALinkConfig[]\n /**\n * The rendered icon list on the card\n */\n renderedIconList?: React.ReactNode\n /**\n * Optional sustainability scorecard to be displayed on the header card\n */\n sustainabilityScorecard?: SustainabilityScorecardProps\n /**\n * Optional ReactNode to be rendered next to the card type\n */\n cardTypeAdornment?: React.ReactNode\n /**\n * Optional content to render to the right of the title/subtitle/description area.\n */\n titleAreaRightContent?: React.ReactNode\n /**\n * Character count threshold for truncating description\n * @default 400\n */\n charCountCutoff?: number\n}\n\nconst EMPTY_CARD_LABEL_ARRAY: CardLabel[] = []\n\n/**\n * Generic portal card UI component with a predefined layout\n */\nexport const GenericCard = forwardRef(function GenericCard(\n props: GenericCardProps,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n icon,\n type,\n title,\n titleLinkConfiguration,\n titleAsFileHandleLinkConfiguration,\n subtitle,\n description,\n descriptionSubTitle = '',\n descriptionConfig,\n cardTopContent,\n cardTopButtons,\n isHeader = false,\n headerCardVariant,\n useStylesForDisplayedImage = false,\n labels = EMPTY_CARD_LABEL_ARRAY,\n secondaryLabelLimit,\n ctaLinkConfig,\n ctaLinkPosition,\n renderedIconList,\n sustainabilityScorecard,\n cardTypeAdornment,\n titleAreaRightContent,\n charCountCutoff,\n } = props\n\n const showFooter = labels.length > 0\n\n const style: CSSProperties = {\n // undefined, take default value from class\n marginTop: isHeader ? '0px' : undefined,\n marginBottom: isHeader ? '0px' : undefined,\n paddingBottom:\n showFooter || useStylesForDisplayedImage ? undefined : '15px',\n }\n\n if (isHeader) {\n return (\n <HeaderCard\n ref={ref}\n headerCardVariant={headerCardVariant}\n descriptionConfig={descriptionConfig}\n charCountCutoff={charCountCutoff}\n title={title}\n subTitle={subtitle}\n description={description}\n type={type}\n icon={icon}\n values={labels}\n href={titleLinkConfiguration?.href}\n target={titleLinkConfiguration?.target}\n ctaLinkConfig={ctaLinkConfig}\n isAlignToLeftNav={true}\n secondaryLabelLimit={secondaryLabelLimit}\n cardTopButtons={cardTopButtons}\n cardTopContent={cardTopContent}\n sustainabilityScorecard={sustainabilityScorecard}\n renderedIconList={renderedIconList}\n cardTypeAdornment={cardTypeAdornment}\n titleAsFileHandleLinkConfiguration={titleAsFileHandleLinkConfiguration}\n titleAreaRightContent={titleAreaRightContent}\n descriptionSubTitle={descriptionSubTitle}\n />\n )\n }\n\n const ctaLinks = ctaLinkConfig\n ? (Array.isArray(ctaLinkConfig) ? ctaLinkConfig : [ctaLinkConfig]).map(\n (config, index) =>\n config.text &&\n config.href && (\n <SmartLink key={index} href={config.href} target={config.target}>\n {config.text}\n </SmartLink>\n ),\n )\n : null\n\n return (\n <div style={style} ref={ref} className={'SRC-portalCard'}>\n <div className={'SRC-portalCardMain'}>\n {icon}\n <div\n className={`SRC-cardContent ${ctaLinkPosition === 'right' ? 'SRC-cardContent--ctaRight' : ''}`}\n >\n {cardTopButtons && (\n <Box\n sx={{\n position: 'absolute',\n right: '24px',\n display: 'flex',\n float: 'right',\n flexDirection: 'row',\n gap: '10px',\n }}\n >\n {cardTopButtons}\n </Box>\n )}\n <Stack\n sx={{\n flexDirection: 'row',\n alignItems: 'center',\n gap: '10px',\n }}\n >\n <div className=\"SRC-type\">{type}</div>\n {cardTypeAdornment}\n </Stack>\n {renderedIconList}\n <Box\n className={`SRC-cardTitleArea ${ctaLinkPosition === 'right' ? 'SRC-cardTitleArea--ctaRight' : ''}`}\n >\n <Box sx={{ flex: 1, minWidth: 0 }}>\n <div>\n <h3\n className=\"SRC-boldText SRC-blackText\"\n style={{ margin: 'none' }}\n >\n {!titleAsFileHandleLinkConfiguration && (\n <GenericCardTitle\n title={title}\n href={titleLinkConfiguration?.href}\n target={titleLinkConfiguration?.target}\n />\n )}\n {titleAsFileHandleLinkConfiguration && (\n <FileHandleLink\n fileHandleAssociation={\n titleAsFileHandleLinkConfiguration.fileHandleAssociation\n }\n showDownloadIcon={\n titleAsFileHandleLinkConfiguration.showDownloadIcon\n }\n displayValue={title}\n />\n )}\n </h3>\n </div>\n {subtitle && <div className=\"SRC-author\">{subtitle}</div>}\n <CollapsibleDescription\n description={description}\n descriptionSubTitle={descriptionSubTitle}\n descriptionConfig={descriptionConfig}\n />\n {ctaLinkConfig && ctaLinkPosition !== 'right' && (\n <Box\n sx={{ mt: '20px', display: 'flex', gap: 2, flexWrap: 'wrap' }}\n >\n {ctaLinks}\n </Box>\n )}\n </Box>\n {titleAreaRightContent && (\n <div className=\"SRC-cardTitleAreaDetails\">\n {titleAreaRightContent}\n </div>\n )}\n {ctaLinkPosition === 'right' && ctaLinkConfig && (\n <Box sx={{ flexShrink: 0, marginLeft: 'auto' }}>{ctaLinks}</Box>\n )}\n </Box>\n </div>\n </div>\n {showFooter && (\n <CardFooter\n isHeader={false}\n secondaryLabelLimit={secondaryLabelLimit}\n values={labels}\n className={useStylesForDisplayedImage ? undefined : 'hasIcon'}\n cardTopContent={cardTopContent}\n />\n )}\n </div>\n )\n})\n\nexport default GenericCard\n"],"mappings":";;;;;;;;;;;AAiGA,IAAM,IAAsC,CAAC,GAKhC,IAAc,EAAW,SACpC,GACA,GACA;CACA,IAAM,EACJ,SACA,SACA,UACA,2BACA,uCACA,aACA,gBACA,yBAAsB,IACtB,sBACA,mBACA,mBACA,cAAW,IACX,sBACA,gCAA6B,IAC7B,YAAS,GACT,wBACA,kBACA,oBACA,qBACA,4BACA,sBACA,0BACA,uBACE,GAEE,IAAa,EAAO,SAAS,GAE7B,IAAuB;EAE3B,WAAW,IAAW,QAAQ,KAAA;EAC9B,cAAc,IAAW,QAAQ,KAAA;EACjC,eACE,KAAc,IAA6B,KAAA,IAAY;CAC3D;CAEA,IAAI,GACF,OACE,kBAAC,GAAD;EACO;EACc;EACA;EACF;EACV;EACP,UAAU;EACG;EACP;EACA;EACN,QAAQ;EACR,MAAM,GAAwB;EAC9B,QAAQ,GAAwB;EACjB;EACf,kBAAkB;EACG;EACL;EACA;EACS;EACP;EACC;EACiB;EACb;EAC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AAQ,SAAS;WAAQ,KAAK;WAAG,UAAU;UAAO;oBAE3D;SACE,CAAA;QAEJ;;OACJ,KACC,kBAAC,OAAD;QAAK,WAAU;kBACZ;OACE,CAAA;OAEN,MAAoB,WAAW,KAC9B,kBAAC,GAAD;QAAK,IAAI;SAAE,YAAY;SAAG,YAAY;QAAO;kBAAI;OAAc,CAAA;MAE9D;;IACF;KACF;MACJ,KACC,kBAAC,GAAD;GACE,UAAU;GACW;GACrB,QAAQ;GACR,WAAW,IAA6B,KAAA,IAAY;GACpC;EACjB,CAAA,CAEA;;AAET,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableRowGenericCard.d.ts","sourceRoot":"","sources":["../../../src/components/GenericCard/TableRowGenericCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAA;AA2B9E,OAAO,EACL,WAAW,EAGX,YAAY,EAEb,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAyC,MAAM,OAAO,CAAA;AAI7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIjD,OAAsB,EACpB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AAGjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAI3E,KAAK,sBAAsB,GAAG;IAC5B,4DAA4D;IAC5D,EAAE,EAAE;QACF,MAAM,EAAE,OAAO,CAAA;KAChB,CAAA;IACD,2FAA2F;IAC3F,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,kBAAkB,CAAA;KAC3B,CAAA;CACF,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,2DAA2D;IAC3D,EAAE,EAAE;QACF,MAAM,EAAE,QAAQ,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,gEAAgE;IAChE,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,QAAQ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AE,MAAM,EAAE,CAAA;KACf,CAAC,CAAA;CACH,GAAG,eAAe,CAAA;AAmBnB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CA4blE;AAED,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"TableRowGenericCard.d.ts","sourceRoot":"","sources":["../../../src/components/GenericCard/TableRowGenericCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAA;AA2B9E,OAAO,EACL,WAAW,EAGX,YAAY,EAEb,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAyC,MAAM,OAAO,CAAA;AAI7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIjD,OAAsB,EACpB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AAGjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAI3E,KAAK,sBAAsB,GAAG;IAC5B,4DAA4D;IAC5D,EAAE,EAAE;QACF,MAAM,EAAE,OAAO,CAAA;KAChB,CAAA;IACD,2FAA2F;IAC3F,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,kBAAkB,CAAA;KAC3B,CAAA;CACF,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,2DAA2D;IAC3D,EAAE,EAAE;QACF,MAAM,EAAE,QAAQ,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,gEAAgE;IAChE,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,QAAQ,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,mBAAmB,GAC3B,sBAAsB,GACtB,yBAAyB,CAAA;AAE7B;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,gE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t) {
49
- let [s, h] = d(!1), [Oe, ke] = d(!1), { entityId: Ae, versionNumber: je } = fe(), { getColumnDisplayName: g } = me(), { ref: Me, inView: Ne } = Ee(), { data: _ } = ee(Ae, je), { schema: v, data: y, rowId: b, versionNumber: Pe, genericCardSchema: x, secondaryLabelLimit: Fe, sharePageLinkButtonProps: Ie, selectColumns: S, columnModels: C, iconOptions: Le, useTypeColumnForIcon: w = !1, isHeader: T = !1, sustainabilityScorecard: Re, headerCardVariant: ze, titleLinkConfig: E, ctaLinkConfig: D, labelLinkConfig: Be, descriptionConfig: Ve, columnIconOptions: O, CardTypeAdornment: k, charCountCutoff: He } = t, { link: Ue = "", type: A, includeCitation: We, includeShareButton: Ge, defaultCitationFormat: Ke, citationBoilerplateText: qe, downloadCartSynId: j, portalDoiConfiguration: M } = x, N = y[v[x.title]], P = x.subTitle && y[v[x.subTitle]];
49
+ let [s, h] = d(!1), [Oe, ke] = d(!1), { entityId: Ae, versionNumber: je } = fe(), { getColumnDisplayName: g } = me(), { ref: Me, inView: Ne } = Ee(), { data: _ } = ee(Ae, je), { schema: v, data: y, rowId: b, versionNumber: Pe, genericCardSchema: x, secondaryLabelLimit: Fe, sharePageLinkButtonProps: Ie, selectColumns: S, columnModels: C, iconOptions: Le, useTypeColumnForIcon: w = !1, isHeader: T = !1, sustainabilityScorecard: Re, headerCardVariant: ze, titleLinkConfig: E, ctaLinkConfig: D, ctaLinkPosition: Be, labelLinkConfig: Ve, descriptionConfig: He, columnIconOptions: O, CardTypeAdornment: k, charCountCutoff: Ue } = t, { link: We = "", type: A, includeCitation: Ge, includeShareButton: Ke, defaultCitationFormat: qe, citationBoilerplateText: Je, downloadCartSynId: j, portalDoiConfiguration: M } = x, N = y[v[x.title]], P = x.subTitle && y[v[x.subTitle]];
50
50
  P = x.subTitle && ne({
51
51
  value: P,
52
52
  columnName: x.subTitle,
53
53
  selectColumns: S,
54
54
  columnModels: C
55
55
  }).str;
56
- let Je = y[v[x.description || ""]], F = y[v[x.icon || ""]], I = y[v[x.dataTypeIconNames || ""]], L = y[v[x.imageFileHandleColumnName || ""]], Ye = C?.find((e) => x.link === e.name)?.columnType, R = y[v[Ue]] || "", { href: Xe, target: Ze } = c(R, E, y, v, b), Qe = x.synapseEntityConfig, z = ve((e) => {
56
+ let Ye = y[v[x.description || ""]], F = y[v[x.icon || ""]], I = y[v[x.dataTypeIconNames || ""]], L = y[v[x.imageFileHandleColumnName || ""]], Xe = C?.find((e) => x.link === e.name)?.columnType, R = y[v[We]] || "", { href: Ze, target: Qe } = c(R, E, y, v, b), $e = x.synapseEntityConfig, z = ve((e) => {
57
57
  if (!e) return;
58
58
  let t = v[e];
59
59
  if (t !== void 0) return y[t];
60
- }, [v, y]), $e = u(() => {
60
+ }, [v, y]), et = u(() => {
61
61
  let { titleAreaDetails: e } = x;
62
62
  if (!e) return;
63
63
  let t = typeof e == "function" ? e(v, y) : e;
@@ -103,7 +103,7 @@ function h(t) {
103
103
  C,
104
104
  O
105
105
  ]), { entityId: B, entityVersionNumber: V } = _e({
106
- synapseEntityConfig: Qe,
106
+ synapseEntityConfig: $e,
107
107
  getColumnValue: z,
108
108
  rowId: b,
109
109
  rowVersionNumber: Pe
@@ -115,11 +115,11 @@ function h(t) {
115
115
  let W = se({
116
116
  data: u(() => le(y, v), [y, v]),
117
117
  portalDoiConfiguration: M
118
- }), et = ce({
118
+ }), tt = ce({
119
119
  portalId: M?.portalId,
120
120
  resourceId: W
121
121
  }), G = [], { secondaryLabels: K = [] } = x, q = x.customSecondaryLabelConfig;
122
- if (et && M && W && Ne && G.push({
122
+ if (tt && M && W && Ne && G.push({
123
123
  columnDisplayName: "DOI",
124
124
  value: /* @__PURE__ */ p(oe, {
125
125
  portalId: M.portalId,
@@ -138,19 +138,19 @@ function h(t) {
138
138
  value: t
139
139
  });
140
140
  }
141
- let tt = _ && !i(_);
141
+ let nt = _ && !i(_);
142
142
  for (let e = 0; e < K.length; e += 1) {
143
143
  let t = K[e], i = y[v[t]], a = i, o;
144
144
  if (a && i !== "[]" && i !== "[\"\"]") {
145
145
  if (r(_) && t === "datasetSizeInBytes") o = "Size", a = n(parseInt(i));
146
- else if (tt && t === "currentVersion") {
146
+ else if (nt && t === "currentVersion") {
147
147
  let e = y[v.id];
148
148
  a = /* @__PURE__ */ p(De, {
149
149
  synapseId: e,
150
150
  version: i
151
151
  }), o = "Version";
152
152
  } else {
153
- let e = Be?.find((e) => e.matchColumnName === t);
153
+ let e = Ve?.find((e) => e.matchColumnName === t);
154
154
  a = /* @__PURE__ */ p(l, {
155
155
  value: i,
156
156
  columnName: t,
@@ -169,12 +169,19 @@ function h(t) {
169
169
  });
170
170
  }
171
171
  }
172
- let J = te(_, L || R, y[v.id]), nt = g(x.description || ""), Y = o("doi", S, C), X = Y === void 0 ? void 0 : y[Y], Z = (D ? Array.isArray(D) ? D : [D] : []).map((e) => {
172
+ let J = te(_, L || R, y[v.id]), rt = g(x.description || ""), Y = o("doi", S, C), X = Y === void 0 ? void 0 : y[Y], Z = (D ? Array.isArray(D) ? D : [D] : []).map((e) => {
173
173
  let t = y[v[e.link]] || "";
174
174
  if (!t) return null;
175
175
  let { href: n, target: r } = c(t, void 0, y, v, b);
176
176
  return {
177
- text: e.text,
177
+ text: e.endIcon ? /* @__PURE__ */ m("div", {
178
+ style: {
179
+ display: "flex",
180
+ alignItems: "center",
181
+ gap: "10px"
182
+ },
183
+ children: [e.text, e.endIcon]
184
+ }) : e.text,
178
185
  href: n,
179
186
  target: r
180
187
  };
@@ -183,7 +190,7 @@ function h(t) {
183
190
  datasetId: B,
184
191
  datasetVersionNumber: V
185
192
  }));
186
- let rt = k ? /* @__PURE__ */ p(k, {
193
+ let it = k ? /* @__PURE__ */ p(k, {
187
194
  schema: v,
188
195
  data: y
189
196
  }) : null, $ = !0;
@@ -205,20 +212,21 @@ function h(t) {
205
212
  title: N,
206
213
  subtitle: P,
207
214
  titleLinkConfiguration: {
208
- target: Ze,
209
- href: Xe
215
+ target: Qe,
216
+ href: Ze
210
217
  },
211
- cardTypeAdornment: rt,
212
- titleAsFileHandleLinkConfiguration: !E && Ye === we.FILEHANDLEID && J ? {
218
+ cardTypeAdornment: it,
219
+ titleAsFileHandleLinkConfiguration: !E && Xe === we.FILEHANDLEID && J ? {
213
220
  fileHandleAssociation: J,
214
221
  showDownloadIcon: A !== e
215
222
  } : void 0,
216
223
  ctaLinkConfig: Z.length > 0 ? Z : void 0,
217
- titleAreaRightContent: $e,
218
- description: Je,
219
- descriptionSubTitle: nt,
220
- descriptionConfig: Ve,
221
- charCountCutoff: He,
224
+ ctaLinkPosition: Be,
225
+ titleAreaRightContent: et,
226
+ description: Ye,
227
+ descriptionSubTitle: rt,
228
+ descriptionConfig: He,
229
+ charCountCutoff: Ue,
222
230
  labels: G,
223
231
  secondaryLabelLimit: Fe,
224
232
  useStylesForDisplayedImage: !!L,
@@ -257,13 +265,13 @@ function h(t) {
257
265
  loading: Oe,
258
266
  children: "Download"
259
267
  }),
260
- We && X && /* @__PURE__ */ p(ue, {
268
+ Ge && X && /* @__PURE__ */ p(ue, {
261
269
  title: N,
262
270
  doi: X,
263
- boilerplateText: qe,
264
- defaultCitationFormat: Ke
271
+ boilerplateText: Je,
272
+ defaultCitationFormat: qe
265
273
  }),
266
- Ge && T && /* @__PURE__ */ p(he, { ...Ie })
274
+ Ke && T && /* @__PURE__ */ p(he, { ...Ie })
267
275
  ]
268
276
  })
269
277
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TableRowGenericCard.js","names":[],"sources":["../../../src/components/GenericCard/TableRowGenericCard.tsx"],"sourcesContent":["import { CommonCardProps } from '@/components/CardContainer/CardConfiguration'\nimport {\n getFileHandleAssociation,\n getLinkParams,\n getValueOrMultiValue,\n} from '@/components/GenericCard/CardUtils'\nimport CroissantButton from '@/components/GenericCard/CroissantButton/CroissantButton'\nimport { GenericCardIcon } from '@/components/GenericCard/GenericCardIcon'\nimport PortalDOI from '@/components/GenericCard/PortalDOI/PortalDOI'\nimport {\n getCandidateDoiId,\n useShowDoiCardLabel,\n} from '@/components/GenericCard/PortalDOI/PortalDOIUtils'\nimport { mapRowToRecord } from '@/components/SynapseTable/SynapseTableUtils'\nimport { useGetEntity } from '@/synapse-queries'\nimport { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport {\n isDatasetCollection,\n isTableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { PRODUCTION_ENDPOINT_CONFIG } from '@/utils/functions/getEndpoint'\nimport { parseSynId } from '@/utils/functions/RegularExpressions'\nimport { getColumnIndex } from '@/utils/functions/SqlFunctions'\nimport { TargetEnum } from '@/utils/html/TargetEnum'\nimport * as SynapseConstants from '@/utils/SynapseConstants'\nimport { GetAppTwoTone } from '@mui/icons-material'\nimport { Box, Collapse, Link, Stack, Typography } from '@mui/material'\nimport {\n ColumnModel,\n ColumnTypeEnum,\n Entity,\n SelectColumn,\n Table,\n} from '@sage-bionetworks/synapse-types'\nimport React, { useCallback, useMemo, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport CitationPopover from '../CitationPopover'\nimport { EntityDownloadConfirmation } from '../EntityDownloadConfirmation'\nimport { HeaderCardVariant } from '../HeaderCard'\nimport IconList from '../IconList'\nimport { useQueryContext } from '../QueryContext/QueryContext'\nimport { useQueryVisualizationContext } from '../QueryVisualizationWrapper'\nimport ShareThisPage, {\n ShareThisPageProps,\n} from '../ShareThisPage/ShareThisPage'\nimport { SustainabilityScorecardProps } from '../SustainabilityScorecard/SustainabilityScorecard'\nimport GenericCard from './GenericCard'\nimport GenericCardActionButton from './GenericCardActionButton'\nimport { PortalDOIConfiguration } from './PortalDOI/PortalDOIConfiguration'\nimport { SynapseCardLabel } from './SynapseCardLabel'\nimport { useResolvedSynapseEntity } from './useResolvedSynapseEntity'\n\ntype RowSynapseEntityConfig = {\n /** Use the table rowId to resolve the Synapse entity ID. */\n id: {\n source: 'rowId'\n }\n /** Use the table rowVersionNumber to resolve the Synapse entity version (if available). */\n version?: {\n source: 'rowVersionNumber'\n }\n}\n\ntype ColumnSynapseEntityConfig = {\n /** Use a column value to resolve the Synapse entity ID. */\n id: {\n source: 'column'\n columnName: string\n }\n /** Use a column value to resolve the Synapse entity version. */\n version?: {\n source: 'column'\n columnName: string\n }\n}\n\nexport type SynapseEntityConfig =\n | RowSynapseEntityConfig\n | ColumnSynapseEntityConfig\n\n/**\n * Maps a table query result to a GenericCard.\n */\nexport type TableToGenericCardMapping = {\n /** The 'type' of resource a card refers to. Renders a label on the card with this string value.\n * Can be hidden by setting it to '' (empty string)\n */\n type: string\n /** The column name whose data contains the title of the card */\n title: string\n /** The column name whose data contains the subtitle of the card */\n subTitle?: string\n /** The column name whose data contains the description of the card */\n description?: string\n /** If true, a 'Cite As' button will be displayed for those cards with a DOI in the 'doi' column */\n includeCitation?: boolean\n /** If true, a 'Share this page' button will be displayed */\n includeShareButton?: boolean\n /**\n * Configuration for displaying the SustainabilityScorecard component\n */\n sustainabilityScorecard?: SustainabilityScorecardProps\n /** The initial citation format to use in the 'Cite As' UI */\n defaultCitationFormat?: 'bibtex' | 'apa' | 'ieee' | 'nature' | 'science'\n /** Static text displayed in the 'Cite As' UI */\n citationBoilerplateText?: string\n /** The column name whose data contains the value used to map to the icon */\n icon?: string\n /** The column name whose data contains an image file handle to be displayed on the card */\n imageFileHandleColumnName?: string\n /** Static boolean value used if the image displayed using `imageFileHandleColumnName` requires extra padding */\n thumbnailRequiresPadding?: boolean\n /** Array of column names to be used for labels in the Card Footer */\n secondaryLabels?: string[]\n /** Can be used to add a custom secondary label */\n customSecondaryLabelConfig?: {\n /** The displayed label key */\n key: string\n /** The value to display */\n value: React.ReactNode\n /** Callback to determine visibility of the label\n * @param schema the mapping of columnName to data index\n * @param data the row data\n */\n isVisible: (schema: Record<string, number>, data: string[]) => boolean\n }\n /** Column name of the link value if the title should be linked */\n link?: string\n /** Column name of the STRING_LIST column that includes icon names that represent icons that should be displayed on the card */\n dataTypeIconNames?: string\n /**\n * Ordered list of column names to display to the right of the title area.\n * Each renders as \"Display Name: Value\" on its own line. Rows with empty values are skipped.\n * The display name is derived from getColumnDisplayName (respects column aliases and unCamelCase).\n *\n * Can also be a function that receives the schema and row data and returns the list of column\n * names to display, allowing the displayed details to vary based on the row's actual values.\n */\n titleAreaDetails?:\n | string[]\n | ((schema: Record<string, number>, data: string[]) => string[])\n /** Configuration for resolving the Synapse entity ID/version represented by each card row.\n * The ID and version sources must both reference either row-based values or column-based values.\n */\n synapseEntityConfig?: SynapseEntityConfig\n /** The column name whose data contains a synId that can be used to show a button to add the corresponding entity to the download cart. */\n downloadCartSynId?: string\n /** Configuration to display a DOI, as well as the ability to create one for users with such permission */\n portalDoiConfiguration?: PortalDOIConfiguration\n}\n\nexport type TableRowGenericCardProps = {\n /** The schema that maps a table result to the GenericCard UI */\n genericCardSchema: TableToGenericCardMapping\n /** The table's SelectColumns */\n selectColumns?: SelectColumn[]\n /** The table's ColumnModels */\n columnModels?: ColumnModel[]\n /** If true, the 'type' column will be used as the icon string to choose the icon */\n useTypeColumnForIcon?: boolean\n /** If true, render the card as a HeaderCard */\n isHeader?: boolean\n /** If isHeader is true, use this variant of HeaderCard */\n headerCardVariant?: HeaderCardVariant\n isAlignToLeftNav?: boolean\n /** Mapping of column name to row data index */\n schema: Record<string, number>\n /** The row data */\n data: string[]\n /** The ID of the table row */\n rowId?: number\n /** The versionNumber of the table row */\n versionNumber?: number\n /** Optional props for the ShareThisPage component */\n sharePageLinkButtonProps?: ShareThisPageProps\n /** Optional function that receives schema and data and returns a ReactNode to be rendered next to the card type */\n CardTypeAdornment?: React.ComponentType<{\n schema: Record<string, number>\n data: string[]\n }>\n} & CommonCardProps\n\n// SWC-6115: special rendering of the version column (for Views)\nfunction VersionLabel(props: { synapseId: string; version: string }) {\n const { synapseId, version } = props\n return (\n <span>\n {version}&nbsp;&nbsp;\n <a\n target={TargetEnum.NEW_WINDOW}\n rel=\"noopener noreferrer\"\n href={`${PRODUCTION_ENDPOINT_CONFIG.PORTAL}Synapse:${synapseId}.${version}`}\n >\n (Show Version History on Synapse)\n </a>\n </span>\n )\n}\n\n/**\n * Maps a table row to a GenericCard.\n */\nexport function TableRowGenericCard(props: TableRowGenericCardProps) {\n const [showDownloadConfirmation, setShowDownloadConfirmation] =\n useState(false)\n const [downloadButtonLoading, setDownloadButtonLoading] = useState(false)\n\n const { entityId, versionNumber } = useQueryContext()\n const { getColumnDisplayName } = useQueryVisualizationContext()\n\n const { ref, inView: cardIsInView } = useInView()\n\n const { data: table } = useGetEntity<Table>(entityId, versionNumber)\n\n const {\n schema,\n data,\n rowId,\n versionNumber: rowVersionNumber,\n genericCardSchema,\n secondaryLabelLimit,\n sharePageLinkButtonProps,\n selectColumns,\n columnModels,\n iconOptions,\n useTypeColumnForIcon = false,\n isHeader = false,\n sustainabilityScorecard,\n headerCardVariant,\n titleLinkConfig,\n ctaLinkConfig,\n labelLinkConfig,\n descriptionConfig,\n columnIconOptions,\n CardTypeAdornment,\n charCountCutoff,\n } = props\n\n const {\n link = '',\n type,\n includeCitation,\n includeShareButton,\n defaultCitationFormat,\n citationBoilerplateText,\n downloadCartSynId,\n portalDoiConfiguration,\n } = genericCardSchema\n const title = data[schema[genericCardSchema.title]]\n let subTitle =\n genericCardSchema.subTitle && data[schema[genericCardSchema.subTitle]]\n subTitle =\n genericCardSchema.subTitle &&\n getValueOrMultiValue({\n value: subTitle,\n columnName: genericCardSchema.subTitle,\n selectColumns,\n columnModels,\n }).str\n const description = data[schema[genericCardSchema.description || '']]\n const iconValue = data[schema[genericCardSchema.icon || '']]\n const dataTypeIconNames =\n data[schema[genericCardSchema.dataTypeIconNames || '']]\n const imageFileHandleIdValue =\n data[schema[genericCardSchema.imageFileHandleColumnName || '']]\n const titleColumnModel = columnModels?.find(\n el => genericCardSchema.link === el.name,\n )\n const titleColumnType = titleColumnModel?.columnType\n // wrap link in parens because undefined would throw an error\n const linkValue: string = data[schema[link]] || ''\n const { href, target } = getLinkParams(\n linkValue,\n titleLinkConfig,\n data,\n schema,\n rowId,\n )\n\n const synapseEntityConfig = genericCardSchema.synapseEntityConfig\n\n const getColumnValue = useCallback(\n (columnName?: string) => {\n if (!columnName) {\n return undefined\n }\n const columnIndex = schema[columnName]\n if (columnIndex === undefined) {\n return undefined\n }\n return data[columnIndex]\n },\n [schema, data],\n )\n\n const resolvedTitleAreaRightContent = useMemo(() => {\n const { titleAreaDetails } = genericCardSchema\n if (!titleAreaDetails) return undefined\n const columns =\n typeof titleAreaDetails === 'function'\n ? titleAreaDetails(schema, data)\n : titleAreaDetails\n if (columns.length === 0) return undefined\n const rows = columns\n .map(columnName => {\n const rawValue: string | undefined = data[schema[columnName]]\n if (!rawValue) return null\n return { name: getColumnDisplayName(columnName), rawValue, columnName }\n })\n .filter(Boolean) as {\n name: string\n rawValue: string\n columnName: string\n }[]\n if (rows.length === 0) return undefined\n return (\n <Stack direction=\"column\" gap=\"4px\">\n {rows.map(({ name, rawValue, columnName }) => (\n <Stack key={columnName} direction=\"row\" gap=\"4px\" alignItems=\"center\">\n <Typography component=\"span\" variant=\"body1\">\n {name}:\n </Typography>\n <SynapseCardLabel\n value={rawValue}\n columnName={columnName}\n labelLink={undefined}\n isHeader={isHeader}\n selectColumns={selectColumns}\n columnModels={columnModels}\n rowData={data}\n columnIconOptions={columnIconOptions}\n />\n </Stack>\n ))}\n </Stack>\n )\n }, [\n genericCardSchema,\n data,\n schema,\n getColumnDisplayName,\n isHeader,\n selectColumns,\n columnModels,\n columnIconOptions,\n ])\n\n const {\n entityId: resolvedSynapseEntityId,\n entityVersionNumber: resolvedSynapseEntityVersionNumber,\n } = useResolvedSynapseEntity({\n synapseEntityConfig,\n getColumnValue,\n rowId,\n rowVersionNumber,\n })\n\n let resolvedDownloadCartSynIdValue = resolvedSynapseEntityId\n let resolvedDownloadCartVersionNumber = resolvedSynapseEntityVersionNumber\n\n if (downloadCartSynId) {\n const reference = parseSynId(getColumnValue(downloadCartSynId) ?? '')\n resolvedDownloadCartSynIdValue = reference?.targetId\n resolvedDownloadCartVersionNumber = reference?.targetVersionNumber\n }\n\n // Transform the row to a record of (columnName, value) pairs for compatibility with getCandidateDoiId\n const dataAsRecord: Record<string, string | null> = useMemo(\n () => mapRowToRecord(data, schema),\n [data, schema],\n )\n\n const candidateDoiId = getCandidateDoiId({\n data: dataAsRecord,\n portalDoiConfiguration,\n })\n\n const showDoiCardLabel = useShowDoiCardLabel({\n portalId: portalDoiConfiguration?.portalId,\n resourceId: candidateDoiId,\n })\n\n const values: {\n columnDisplayName: string\n value: React.ReactNode\n columnName?: string\n }[] = []\n const { secondaryLabels = [] } = genericCardSchema\n const customLabelConfig = genericCardSchema.customSecondaryLabelConfig\n\n // PORTALS-3549 - if a DOI exists or can be created by the current user, show it\n if (\n showDoiCardLabel &&\n portalDoiConfiguration &&\n candidateDoiId &&\n cardIsInView\n ) {\n values.push({\n columnDisplayName: 'DOI',\n value: (\n <PortalDOI\n portalId={portalDoiConfiguration.portalId}\n resourceId={candidateDoiId}\n />\n ),\n })\n }\n\n // Overwrite the 'HOW TO DOWNLOAD' link if a synapse ID is available\n if (customLabelConfig?.isVisible(schema, data)) {\n const { key, value } = customLabelConfig\n if (resolvedDownloadCartSynIdValue) {\n values.push({\n columnDisplayName: 'HOW TO DOWNLOAD',\n value: (\n <Link onClick={() => setShowDownloadConfirmation(val => !val)}>\n Click here to add to Synapse download list\n </Link>\n ),\n })\n } else {\n values.push({ columnDisplayName: key, value })\n }\n }\n\n const isView = table && !isTableEntity(table)\n for (let i = 0; i < secondaryLabels.length; i += 1) {\n const columnName = secondaryLabels[i]\n const rawValue: string | undefined = data[schema[columnName]]\n let renderedValue: React.ReactNode = rawValue\n let columnDisplayName\n if (renderedValue && rawValue !== '[]' && rawValue !== '[\"\"]') {\n // PORTALS-2750: special rendering of the datasetSizeInBytes (for Dataset Collections)\n if (\n isDatasetCollection(table as Entity) &&\n columnName === 'datasetSizeInBytes'\n ) {\n columnDisplayName = 'Size'\n renderedValue = calculateFriendlyFileSize(parseInt(rawValue))\n } // SWC-6115: special rendering of the version column (for Views)\n else if (isView && columnName === 'currentVersion') {\n const synapseId = data[schema.id]\n renderedValue = (\n <VersionLabel synapseId={synapseId} version={rawValue} />\n )\n columnDisplayName = 'Version'\n } else {\n const labelLink = labelLinkConfig?.find(\n el => el.matchColumnName === columnName,\n )\n renderedValue = (\n <SynapseCardLabel\n value={rawValue}\n columnName={columnName}\n labelLink={labelLink}\n isHeader={isHeader}\n selectColumns={selectColumns}\n columnModels={columnModels}\n rowData={data}\n columnIconOptions={columnIconOptions}\n />\n )\n columnDisplayName = getColumnDisplayName(columnName)\n }\n values.push({ columnDisplayName, value: renderedValue, columnName })\n }\n }\n\n const fileHandleId = imageFileHandleIdValue || linkValue\n\n /**\n * To show a direct download link to a file, we need to determine the association that gives permission to download the file.\n */\n const fileHandleAssociation = getFileHandleAssociation(\n table,\n fileHandleId,\n data[schema.id],\n )\n\n const descriptionSubTitle = getColumnDisplayName(\n genericCardSchema.description || '',\n )\n\n const doiColumnIndex = getColumnIndex('doi', selectColumns, columnModels)\n const doiValue =\n doiColumnIndex !== undefined ? data[doiColumnIndex] : undefined\n\n // Normalize ctaLinkConfig to array and resolve each config\n const ctaLinkConfigs = ctaLinkConfig\n ? Array.isArray(ctaLinkConfig)\n ? ctaLinkConfig\n : [ctaLinkConfig]\n : []\n const resolvedCtaLinkConfigs = ctaLinkConfigs\n .map(config => {\n const ctaLinkValue: string = data[schema[config.link]] || ''\n if (!ctaLinkValue) return null\n const { href, target } = getLinkParams(\n ctaLinkValue,\n undefined, //card link config\n data,\n schema,\n rowId,\n )\n return {\n text: config.text,\n href,\n target,\n }\n })\n .filter(Boolean) as { text: string; href: string; target?: string }[]\n\n let croissantButton = <></>\n if (\n resolvedSynapseEntityId != null &&\n resolvedSynapseEntityVersionNumber != null\n ) {\n croissantButton = (\n <CroissantButton\n datasetId={resolvedSynapseEntityId}\n datasetVersionNumber={resolvedSynapseEntityVersionNumber}\n />\n )\n }\n\n const resolvedCardTypeAdornment = CardTypeAdornment ? (\n <CardTypeAdornment schema={schema} data={data} />\n ) : null\n\n let isRenderingIcon = true\n if (isHeader && !imageFileHandleIdValue && !iconValue) {\n // For header cards, if there is no image or explicit icon value, we don't show an icon at all\n isRenderingIcon = false\n }\n return (\n <GenericCard\n ref={ref}\n icon={\n isRenderingIcon ? (\n <GenericCardIcon\n type={\n useTypeColumnForIcon\n ? data[schema['type']]\n : genericCardSchema.type\n }\n useTypeForIcon={useTypeColumnForIcon}\n thumbnailRequiresPadding={\n genericCardSchema.thumbnailRequiresPadding\n }\n imageFileHandleId={imageFileHandleIdValue}\n fileHandleAssociation={fileHandleAssociation}\n iconOptions={iconOptions}\n iconValue={iconValue}\n />\n ) : undefined\n }\n isHeader={isHeader}\n sustainabilityScorecard={sustainabilityScorecard}\n headerCardVariant={headerCardVariant}\n type={type}\n title={title}\n subtitle={subTitle}\n titleLinkConfiguration={{ target, href }}\n cardTypeAdornment={resolvedCardTypeAdornment}\n titleAsFileHandleLinkConfiguration={\n !titleLinkConfig &&\n titleColumnType === ColumnTypeEnum.FILEHANDLEID &&\n fileHandleAssociation\n ? {\n fileHandleAssociation: fileHandleAssociation,\n showDownloadIcon: type !== SynapseConstants.EXPERIMENTAL,\n }\n : undefined\n }\n ctaLinkConfig={\n resolvedCtaLinkConfigs.length > 0 ? resolvedCtaLinkConfigs : undefined\n }\n titleAreaRightContent={resolvedTitleAreaRightContent}\n description={description}\n descriptionSubTitle={descriptionSubTitle}\n descriptionConfig={descriptionConfig}\n charCountCutoff={charCountCutoff}\n labels={values}\n secondaryLabelLimit={secondaryLabelLimit}\n useStylesForDisplayedImage={Boolean(imageFileHandleIdValue)}\n cardTopContent={\n resolvedDownloadCartSynIdValue && (\n <Collapse in={showDownloadConfirmation}>\n <EntityDownloadConfirmation\n entityId={resolvedDownloadCartSynIdValue}\n versionNumber={resolvedDownloadCartVersionNumber}\n handleClose={() => setShowDownloadConfirmation(false)}\n onIsLoadingChange={isLoading => {\n setDownloadButtonLoading(isLoading)\n }}\n />\n </Collapse>\n )\n }\n renderedIconList={\n // If the portal configs has columnIconOptions.columns.dataType option\n // and the column value is not null, display the card data type icons\n columnIconOptions?.columns?.dataType &&\n dataTypeIconNames?.length && (\n <div style={{ marginTop: '20px' }}>\n <IconList\n iconConfigs={columnIconOptions.columns.dataType}\n iconNames={JSON.parse(dataTypeIconNames) as string[]}\n commonIconProps={{\n sx: { fontSize: '40px' },\n }}\n useBackground={true}\n useTheme={true}\n />\n </div>\n )\n }\n cardTopButtons={\n <Box sx={{ display: 'flex', gap: 1 }}>\n {croissantButton}\n {/* PORTALS-3386 Use synapseLink in schema to add entity to download cart */}\n {resolvedDownloadCartSynIdValue && (\n <GenericCardActionButton\n onClick={() => setShowDownloadConfirmation(val => !val)}\n variant=\"outlined\"\n startIcon={<GetAppTwoTone sx={{ height: '12px' }} />}\n loading={downloadButtonLoading}\n >\n Download\n </GenericCardActionButton>\n )}\n {includeCitation && doiValue && (\n <CitationPopover\n title={title}\n doi={doiValue}\n boilerplateText={citationBoilerplateText}\n defaultCitationFormat={defaultCitationFormat}\n />\n )}\n {includeShareButton && isHeader && (\n <ShareThisPage {...sharePageLinkButtonProps} />\n )}\n </Box>\n }\n />\n )\n}\n\nexport default TableRowGenericCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuLA,SAAS,GAAa,GAA+C;CACnE,IAAM,EAAE,cAAW,eAAY;CAC/B,OACE,kBAAC,QAAD,EAAA,UAAA;EACG;EAAQ;EACT,kBAAC,KAAD;GACE,QAAQ,EAAW;GACnB,KAAI;GACJ,MAAM,GAAG,EAA2B,OAAO,UAAU,EAAU,GAAG;aACnE;EAEE,CAAA;CACC,EAAA,CAAA;AAEV;AAKA,SAAgB,EAAoB,GAAiC;CACnE,IAAM,CAAC,GAA0B,KAC/B,EAAS,EAAK,GACV,CAAC,IAAuB,MAA4B,EAAS,EAAK,GAElE,EAAE,cAAU,sBAAkB,GAAgB,GAC9C,EAAE,4BAAyB,GAA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;IACA,eAAe;IACf,UAAU;GACX,CAAA;EACE,CAAA;EAGT,gBACE,kBAAC,IAAD;GAAK,IAAI;IAAE,SAAS;IAAQ,KAAK;GAAE;aAAnC;IACG;IAEA,KACC,kBAAC,IAAD;KACE,eAAe,GAA4B,MAAO,CAAC,CAAG;KACtD,SAAQ;KACR,WAAW,kBAAC,IAAD,EAAe,IAAI,EAAE,QAAQ,OAAO,EAAI,CAAA;KACnD,SAAS;eACV;IAEwB,CAAA;IAE1B,MAAmB,KAClB,kBAAC,IAAD;KACS;KACP,KAAK;KACL,iBAAiB;KACM;IACxB,CAAA;IAEF,MAAsB,KACrB,kBAAC,IAAD,EAAe,GAAI,GAA2B,CAAA;GAE7C;;CAER,CAAA;AAEL"}
1
+ {"version":3,"file":"TableRowGenericCard.js","names":[],"sources":["../../../src/components/GenericCard/TableRowGenericCard.tsx"],"sourcesContent":["import { CommonCardProps } from '@/components/CardContainer/CardConfiguration'\nimport {\n getFileHandleAssociation,\n getLinkParams,\n getValueOrMultiValue,\n} from '@/components/GenericCard/CardUtils'\nimport CroissantButton from '@/components/GenericCard/CroissantButton/CroissantButton'\nimport { GenericCardIcon } from '@/components/GenericCard/GenericCardIcon'\nimport PortalDOI from '@/components/GenericCard/PortalDOI/PortalDOI'\nimport {\n getCandidateDoiId,\n useShowDoiCardLabel,\n} from '@/components/GenericCard/PortalDOI/PortalDOIUtils'\nimport { mapRowToRecord } from '@/components/SynapseTable/SynapseTableUtils'\nimport { useGetEntity } from '@/synapse-queries'\nimport { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport {\n isDatasetCollection,\n isTableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { PRODUCTION_ENDPOINT_CONFIG } from '@/utils/functions/getEndpoint'\nimport { parseSynId } from '@/utils/functions/RegularExpressions'\nimport { getColumnIndex } from '@/utils/functions/SqlFunctions'\nimport { TargetEnum } from '@/utils/html/TargetEnum'\nimport * as SynapseConstants from '@/utils/SynapseConstants'\nimport { GetAppTwoTone } from '@mui/icons-material'\nimport { Box, Collapse, Link, Stack, Typography } from '@mui/material'\nimport {\n ColumnModel,\n ColumnTypeEnum,\n Entity,\n SelectColumn,\n Table,\n} from '@sage-bionetworks/synapse-types'\nimport React, { useCallback, useMemo, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport CitationPopover from '../CitationPopover'\nimport { EntityDownloadConfirmation } from '../EntityDownloadConfirmation'\nimport { HeaderCardVariant } from '../HeaderCard'\nimport IconList from '../IconList'\nimport { useQueryContext } from '../QueryContext/QueryContext'\nimport { useQueryVisualizationContext } from '../QueryVisualizationWrapper'\nimport ShareThisPage, {\n ShareThisPageProps,\n} from '../ShareThisPage/ShareThisPage'\nimport { SustainabilityScorecardProps } from '../SustainabilityScorecard/SustainabilityScorecard'\nimport GenericCard from './GenericCard'\nimport GenericCardActionButton from './GenericCardActionButton'\nimport { PortalDOIConfiguration } from './PortalDOI/PortalDOIConfiguration'\nimport { SynapseCardLabel } from './SynapseCardLabel'\nimport { useResolvedSynapseEntity } from './useResolvedSynapseEntity'\n\ntype RowSynapseEntityConfig = {\n /** Use the table rowId to resolve the Synapse entity ID. */\n id: {\n source: 'rowId'\n }\n /** Use the table rowVersionNumber to resolve the Synapse entity version (if available). */\n version?: {\n source: 'rowVersionNumber'\n }\n}\n\ntype ColumnSynapseEntityConfig = {\n /** Use a column value to resolve the Synapse entity ID. */\n id: {\n source: 'column'\n columnName: string\n }\n /** Use a column value to resolve the Synapse entity version. */\n version?: {\n source: 'column'\n columnName: string\n }\n}\n\nexport type SynapseEntityConfig =\n | RowSynapseEntityConfig\n | ColumnSynapseEntityConfig\n\n/**\n * Maps a table query result to a GenericCard.\n */\nexport type TableToGenericCardMapping = {\n /** The 'type' of resource a card refers to. Renders a label on the card with this string value.\n * Can be hidden by setting it to '' (empty string)\n */\n type: string\n /** The column name whose data contains the title of the card */\n title: string\n /** The column name whose data contains the subtitle of the card */\n subTitle?: string\n /** The column name whose data contains the description of the card */\n description?: string\n /** If true, a 'Cite As' button will be displayed for those cards with a DOI in the 'doi' column */\n includeCitation?: boolean\n /** If true, a 'Share this page' button will be displayed */\n includeShareButton?: boolean\n /**\n * Configuration for displaying the SustainabilityScorecard component\n */\n sustainabilityScorecard?: SustainabilityScorecardProps\n /** The initial citation format to use in the 'Cite As' UI */\n defaultCitationFormat?: 'bibtex' | 'apa' | 'ieee' | 'nature' | 'science'\n /** Static text displayed in the 'Cite As' UI */\n citationBoilerplateText?: string\n /** The column name whose data contains the value used to map to the icon */\n icon?: string\n /** The column name whose data contains an image file handle to be displayed on the card */\n imageFileHandleColumnName?: string\n /** Static boolean value used if the image displayed using `imageFileHandleColumnName` requires extra padding */\n thumbnailRequiresPadding?: boolean\n /** Array of column names to be used for labels in the Card Footer */\n secondaryLabels?: string[]\n /** Can be used to add a custom secondary label */\n customSecondaryLabelConfig?: {\n /** The displayed label key */\n key: string\n /** The value to display */\n value: React.ReactNode\n /** Callback to determine visibility of the label\n * @param schema the mapping of columnName to data index\n * @param data the row data\n */\n isVisible: (schema: Record<string, number>, data: string[]) => boolean\n }\n /** Column name of the link value if the title should be linked */\n link?: string\n /** Column name of the STRING_LIST column that includes icon names that represent icons that should be displayed on the card */\n dataTypeIconNames?: string\n /**\n * Ordered list of column names to display to the right of the title area.\n * Each renders as \"Display Name: Value\" on its own line. Rows with empty values are skipped.\n * The display name is derived from getColumnDisplayName (respects column aliases and unCamelCase).\n *\n * Can also be a function that receives the schema and row data and returns the list of column\n * names to display, allowing the displayed details to vary based on the row's actual values.\n */\n titleAreaDetails?:\n | string[]\n | ((schema: Record<string, number>, data: string[]) => string[])\n /** Configuration for resolving the Synapse entity ID/version represented by each card row.\n * The ID and version sources must both reference either row-based values or column-based values.\n */\n synapseEntityConfig?: SynapseEntityConfig\n /** The column name whose data contains a synId that can be used to show a button to add the corresponding entity to the download cart. */\n downloadCartSynId?: string\n /** Configuration to display a DOI, as well as the ability to create one for users with such permission */\n portalDoiConfiguration?: PortalDOIConfiguration\n}\n\nexport type TableRowGenericCardProps = {\n /** The schema that maps a table result to the GenericCard UI */\n genericCardSchema: TableToGenericCardMapping\n /** The table's SelectColumns */\n selectColumns?: SelectColumn[]\n /** The table's ColumnModels */\n columnModels?: ColumnModel[]\n /** If true, the 'type' column will be used as the icon string to choose the icon */\n useTypeColumnForIcon?: boolean\n /** If true, render the card as a HeaderCard */\n isHeader?: boolean\n /** If isHeader is true, use this variant of HeaderCard */\n headerCardVariant?: HeaderCardVariant\n isAlignToLeftNav?: boolean\n /** Mapping of column name to row data index */\n schema: Record<string, number>\n /** The row data */\n data: string[]\n /** The ID of the table row */\n rowId?: number\n /** The versionNumber of the table row */\n versionNumber?: number\n /** Optional props for the ShareThisPage component */\n sharePageLinkButtonProps?: ShareThisPageProps\n /** Optional function that receives schema and data and returns a ReactNode to be rendered next to the card type */\n CardTypeAdornment?: React.ComponentType<{\n schema: Record<string, number>\n data: string[]\n }>\n} & CommonCardProps\n\n// SWC-6115: special rendering of the version column (for Views)\nfunction VersionLabel(props: { synapseId: string; version: string }) {\n const { synapseId, version } = props\n return (\n <span>\n {version}&nbsp;&nbsp;\n <a\n target={TargetEnum.NEW_WINDOW}\n rel=\"noopener noreferrer\"\n href={`${PRODUCTION_ENDPOINT_CONFIG.PORTAL}Synapse:${synapseId}.${version}`}\n >\n (Show Version History on Synapse)\n </a>\n </span>\n )\n}\n\n/**\n * Maps a table row to a GenericCard.\n */\nexport function TableRowGenericCard(props: TableRowGenericCardProps) {\n const [showDownloadConfirmation, setShowDownloadConfirmation] =\n useState(false)\n const [downloadButtonLoading, setDownloadButtonLoading] = useState(false)\n\n const { entityId, versionNumber } = useQueryContext()\n const { getColumnDisplayName } = useQueryVisualizationContext()\n\n const { ref, inView: cardIsInView } = useInView()\n\n const { data: table } = useGetEntity<Table>(entityId, versionNumber)\n\n const {\n schema,\n data,\n rowId,\n versionNumber: rowVersionNumber,\n genericCardSchema,\n secondaryLabelLimit,\n sharePageLinkButtonProps,\n selectColumns,\n columnModels,\n iconOptions,\n useTypeColumnForIcon = false,\n isHeader = false,\n sustainabilityScorecard,\n headerCardVariant,\n titleLinkConfig,\n ctaLinkConfig,\n ctaLinkPosition,\n labelLinkConfig,\n descriptionConfig,\n columnIconOptions,\n CardTypeAdornment,\n charCountCutoff,\n } = props\n\n const {\n link = '',\n type,\n includeCitation,\n includeShareButton,\n defaultCitationFormat,\n citationBoilerplateText,\n downloadCartSynId,\n portalDoiConfiguration,\n } = genericCardSchema\n const title = data[schema[genericCardSchema.title]]\n let subTitle =\n genericCardSchema.subTitle && data[schema[genericCardSchema.subTitle]]\n subTitle =\n genericCardSchema.subTitle &&\n getValueOrMultiValue({\n value: subTitle,\n columnName: genericCardSchema.subTitle,\n selectColumns,\n columnModels,\n }).str\n const description = data[schema[genericCardSchema.description || '']]\n const iconValue = data[schema[genericCardSchema.icon || '']]\n const dataTypeIconNames =\n data[schema[genericCardSchema.dataTypeIconNames || '']]\n const imageFileHandleIdValue =\n data[schema[genericCardSchema.imageFileHandleColumnName || '']]\n const titleColumnModel = columnModels?.find(\n el => genericCardSchema.link === el.name,\n )\n const titleColumnType = titleColumnModel?.columnType\n // wrap link in parens because undefined would throw an error\n const linkValue: string = data[schema[link]] || ''\n const { href, target } = getLinkParams(\n linkValue,\n titleLinkConfig,\n data,\n schema,\n rowId,\n )\n\n const synapseEntityConfig = genericCardSchema.synapseEntityConfig\n\n const getColumnValue = useCallback(\n (columnName?: string) => {\n if (!columnName) {\n return undefined\n }\n const columnIndex = schema[columnName]\n if (columnIndex === undefined) {\n return undefined\n }\n return data[columnIndex]\n },\n [schema, data],\n )\n\n const resolvedTitleAreaRightContent = useMemo(() => {\n const { titleAreaDetails } = genericCardSchema\n if (!titleAreaDetails) return undefined\n const columns =\n typeof titleAreaDetails === 'function'\n ? titleAreaDetails(schema, data)\n : titleAreaDetails\n if (columns.length === 0) return undefined\n const rows = columns\n .map(columnName => {\n const rawValue: string | undefined = data[schema[columnName]]\n if (!rawValue) return null\n return { name: getColumnDisplayName(columnName), rawValue, columnName }\n })\n .filter(Boolean) as {\n name: string\n rawValue: string\n columnName: string\n }[]\n if (rows.length === 0) return undefined\n return (\n <Stack direction=\"column\" gap=\"4px\">\n {rows.map(({ name, rawValue, columnName }) => (\n <Stack key={columnName} direction=\"row\" gap=\"4px\" alignItems=\"center\">\n <Typography component=\"span\" variant=\"body1\">\n {name}:\n </Typography>\n <SynapseCardLabel\n value={rawValue}\n columnName={columnName}\n labelLink={undefined}\n isHeader={isHeader}\n selectColumns={selectColumns}\n columnModels={columnModels}\n rowData={data}\n columnIconOptions={columnIconOptions}\n />\n </Stack>\n ))}\n </Stack>\n )\n }, [\n genericCardSchema,\n data,\n schema,\n getColumnDisplayName,\n isHeader,\n selectColumns,\n columnModels,\n columnIconOptions,\n ])\n\n const {\n entityId: resolvedSynapseEntityId,\n entityVersionNumber: resolvedSynapseEntityVersionNumber,\n } = useResolvedSynapseEntity({\n synapseEntityConfig,\n getColumnValue,\n rowId,\n rowVersionNumber,\n })\n\n let resolvedDownloadCartSynIdValue = resolvedSynapseEntityId\n let resolvedDownloadCartVersionNumber = resolvedSynapseEntityVersionNumber\n\n if (downloadCartSynId) {\n const reference = parseSynId(getColumnValue(downloadCartSynId) ?? '')\n resolvedDownloadCartSynIdValue = reference?.targetId\n resolvedDownloadCartVersionNumber = reference?.targetVersionNumber\n }\n\n // Transform the row to a record of (columnName, value) pairs for compatibility with getCandidateDoiId\n const dataAsRecord: Record<string, string | null> = useMemo(\n () => mapRowToRecord(data, schema),\n [data, schema],\n )\n\n const candidateDoiId = getCandidateDoiId({\n data: dataAsRecord,\n portalDoiConfiguration,\n })\n\n const showDoiCardLabel = useShowDoiCardLabel({\n portalId: portalDoiConfiguration?.portalId,\n resourceId: candidateDoiId,\n })\n\n const values: {\n columnDisplayName: string\n value: React.ReactNode\n columnName?: string\n }[] = []\n const { secondaryLabels = [] } = genericCardSchema\n const customLabelConfig = genericCardSchema.customSecondaryLabelConfig\n\n // PORTALS-3549 - if a DOI exists or can be created by the current user, show it\n if (\n showDoiCardLabel &&\n portalDoiConfiguration &&\n candidateDoiId &&\n cardIsInView\n ) {\n values.push({\n columnDisplayName: 'DOI',\n value: (\n <PortalDOI\n portalId={portalDoiConfiguration.portalId}\n resourceId={candidateDoiId}\n />\n ),\n })\n }\n\n // Overwrite the 'HOW TO DOWNLOAD' link if a synapse ID is available\n if (customLabelConfig?.isVisible(schema, data)) {\n const { key, value } = customLabelConfig\n if (resolvedDownloadCartSynIdValue) {\n values.push({\n columnDisplayName: 'HOW TO DOWNLOAD',\n value: (\n <Link onClick={() => setShowDownloadConfirmation(val => !val)}>\n Click here to add to Synapse download list\n </Link>\n ),\n })\n } else {\n values.push({ columnDisplayName: key, value })\n }\n }\n\n const isView = table && !isTableEntity(table)\n for (let i = 0; i < secondaryLabels.length; i += 1) {\n const columnName = secondaryLabels[i]\n const rawValue: string | undefined = data[schema[columnName]]\n let renderedValue: React.ReactNode = rawValue\n let columnDisplayName\n if (renderedValue && rawValue !== '[]' && rawValue !== '[\"\"]') {\n // PORTALS-2750: special rendering of the datasetSizeInBytes (for Dataset Collections)\n if (\n isDatasetCollection(table as Entity) &&\n columnName === 'datasetSizeInBytes'\n ) {\n columnDisplayName = 'Size'\n renderedValue = calculateFriendlyFileSize(parseInt(rawValue))\n } // SWC-6115: special rendering of the version column (for Views)\n else if (isView && columnName === 'currentVersion') {\n const synapseId = data[schema.id]\n renderedValue = (\n <VersionLabel synapseId={synapseId} version={rawValue} />\n )\n columnDisplayName = 'Version'\n } else {\n const labelLink = labelLinkConfig?.find(\n el => el.matchColumnName === columnName,\n )\n renderedValue = (\n <SynapseCardLabel\n value={rawValue}\n columnName={columnName}\n labelLink={labelLink}\n isHeader={isHeader}\n selectColumns={selectColumns}\n columnModels={columnModels}\n rowData={data}\n columnIconOptions={columnIconOptions}\n />\n )\n columnDisplayName = getColumnDisplayName(columnName)\n }\n values.push({ columnDisplayName, value: renderedValue, columnName })\n }\n }\n\n const fileHandleId = imageFileHandleIdValue || linkValue\n\n /**\n * To show a direct download link to a file, we need to determine the association that gives permission to download the file.\n */\n const fileHandleAssociation = getFileHandleAssociation(\n table,\n fileHandleId,\n data[schema.id],\n )\n\n const descriptionSubTitle = getColumnDisplayName(\n genericCardSchema.description || '',\n )\n\n const doiColumnIndex = getColumnIndex('doi', selectColumns, columnModels)\n const doiValue =\n doiColumnIndex !== undefined ? data[doiColumnIndex] : undefined\n\n // Normalize ctaLinkConfig to array and resolve each config\n const ctaLinkConfigs = ctaLinkConfig\n ? Array.isArray(ctaLinkConfig)\n ? ctaLinkConfig\n : [ctaLinkConfig]\n : []\n const resolvedCtaLinkConfigs = ctaLinkConfigs\n .map(config => {\n const ctaLinkValue: string = data[schema[config.link]] || ''\n if (!ctaLinkValue) return null\n const { href, target } = getLinkParams(\n ctaLinkValue,\n undefined, //card link config\n data,\n schema,\n rowId,\n )\n return {\n text: config.endIcon ? (\n <div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>\n {config.text}\n {config.endIcon}\n </div>\n ) : (\n config.text\n ),\n href,\n target,\n }\n })\n .filter(Boolean) as { text: string; href: string; target?: string }[]\n\n let croissantButton = <></>\n if (\n resolvedSynapseEntityId != null &&\n resolvedSynapseEntityVersionNumber != null\n ) {\n croissantButton = (\n <CroissantButton\n datasetId={resolvedSynapseEntityId}\n datasetVersionNumber={resolvedSynapseEntityVersionNumber}\n />\n )\n }\n\n const resolvedCardTypeAdornment = CardTypeAdornment ? (\n <CardTypeAdornment schema={schema} data={data} />\n ) : null\n\n let isRenderingIcon = true\n if (isHeader && !imageFileHandleIdValue && !iconValue) {\n // For header cards, if there is no image or explicit icon value, we don't show an icon at all\n isRenderingIcon = false\n }\n return (\n <GenericCard\n ref={ref}\n icon={\n isRenderingIcon ? (\n <GenericCardIcon\n type={\n useTypeColumnForIcon\n ? data[schema['type']]\n : genericCardSchema.type\n }\n useTypeForIcon={useTypeColumnForIcon}\n thumbnailRequiresPadding={\n genericCardSchema.thumbnailRequiresPadding\n }\n imageFileHandleId={imageFileHandleIdValue}\n fileHandleAssociation={fileHandleAssociation}\n iconOptions={iconOptions}\n iconValue={iconValue}\n />\n ) : undefined\n }\n isHeader={isHeader}\n sustainabilityScorecard={sustainabilityScorecard}\n headerCardVariant={headerCardVariant}\n type={type}\n title={title}\n subtitle={subTitle}\n titleLinkConfiguration={{ target, href }}\n cardTypeAdornment={resolvedCardTypeAdornment}\n titleAsFileHandleLinkConfiguration={\n !titleLinkConfig &&\n titleColumnType === ColumnTypeEnum.FILEHANDLEID &&\n fileHandleAssociation\n ? {\n fileHandleAssociation: fileHandleAssociation,\n showDownloadIcon: type !== SynapseConstants.EXPERIMENTAL,\n }\n : undefined\n }\n ctaLinkConfig={\n resolvedCtaLinkConfigs.length > 0 ? resolvedCtaLinkConfigs : undefined\n }\n ctaLinkPosition={ctaLinkPosition}\n titleAreaRightContent={resolvedTitleAreaRightContent}\n description={description}\n descriptionSubTitle={descriptionSubTitle}\n descriptionConfig={descriptionConfig}\n charCountCutoff={charCountCutoff}\n labels={values}\n secondaryLabelLimit={secondaryLabelLimit}\n useStylesForDisplayedImage={Boolean(imageFileHandleIdValue)}\n cardTopContent={\n resolvedDownloadCartSynIdValue && (\n <Collapse in={showDownloadConfirmation}>\n <EntityDownloadConfirmation\n entityId={resolvedDownloadCartSynIdValue}\n versionNumber={resolvedDownloadCartVersionNumber}\n handleClose={() => setShowDownloadConfirmation(false)}\n onIsLoadingChange={isLoading => {\n setDownloadButtonLoading(isLoading)\n }}\n />\n </Collapse>\n )\n }\n renderedIconList={\n // If the portal configs has columnIconOptions.columns.dataType option\n // and the column value is not null, display the card data type icons\n columnIconOptions?.columns?.dataType &&\n dataTypeIconNames?.length && (\n <div style={{ marginTop: '20px' }}>\n <IconList\n iconConfigs={columnIconOptions.columns.dataType}\n iconNames={JSON.parse(dataTypeIconNames) as string[]}\n commonIconProps={{\n sx: { fontSize: '40px' },\n }}\n useBackground={true}\n useTheme={true}\n />\n </div>\n )\n }\n cardTopButtons={\n <Box sx={{ display: 'flex', gap: 1 }}>\n {croissantButton}\n {/* PORTALS-3386 Use synapseLink in schema to add entity to download cart */}\n {resolvedDownloadCartSynIdValue && (\n <GenericCardActionButton\n onClick={() => setShowDownloadConfirmation(val => !val)}\n variant=\"outlined\"\n startIcon={<GetAppTwoTone sx={{ height: '12px' }} />}\n loading={downloadButtonLoading}\n >\n Download\n </GenericCardActionButton>\n )}\n {includeCitation && doiValue && (\n <CitationPopover\n title={title}\n doi={doiValue}\n boilerplateText={citationBoilerplateText}\n defaultCitationFormat={defaultCitationFormat}\n />\n )}\n {includeShareButton && isHeader && (\n <ShareThisPage {...sharePageLinkButtonProps} />\n )}\n </Box>\n }\n />\n )\n}\n\nexport default TableRowGenericCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuLA,SAAS,GAAa,GAA+C;CACnE,IAAM,EAAE,cAAW,eAAY;CAC/B,OACE,kBAAC,QAAD,EAAA,UAAA;EACG;EAAQ;EACT,kBAAC,KAAD;GACE,QAAQ,EAAW;GACnB,KAAI;GACJ,MAAM,GAAG,EAA2B,OAAO,UAAU,EAAU,GAAG;aACnE;EAEE,CAAA;CACC,EAAA,CAAA;AAEV;AAKA,SAAgB,EAAoB,GAAiC;CACnE,IAAM,CAAC,GAA0B,KAC/B,EAAS,EAAK,GACV,CAAC,IAAuB,MAA4B,EAAS,EAAK,GAElE,EAAE,cAAU,sBAAkB,GAAgB,GAC9C,EAAE,4BAAyB,GAA6B,GAExD,EAAE,SAAK,QAAQ,OAAiB,GAAU,GAE1C,EAAE,MAAM,MAAU,GAAoB,IAAU,EAAa,GAE7D,EACJ,WACA,SACA,UACA,eAAe,IACf,sBACA,yBACA,8BACA,kBACA,iBACA,iBACA,0BAAuB,IACvB,cAAW,IACX,6BACA,uBACA,oBACA,kBACA,qBACA,qBACA,uBACA,sBACA,sBACA,wBACE,GAEE,EACJ,WAAO,IACP,SACA,qBACA,wBACA,2BACA,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AA4B,MAAO,CAAC,CAAG;KACtD,SAAQ;KACR,WAAW,kBAAC,IAAD,EAAe,IAAI,EAAE,QAAQ,OAAO,EAAI,CAAA;KACnD,SAAS;eACV;IAEwB,CAAA;IAE1B,MAAmB,KAClB,kBAAC,IAAD;KACS;KACP,KAAK;KACL,iBAAiB;KACM;IACxB,CAAA;IAEF,MAAsB,KACrB,kBAAC,IAAD,EAAe,GAAI,GAA2B,CAAA;GAE7C;;CAER,CAAA;AAEL"}
@@ -1,3 +1,5 @@
1
+ import { QueryBundleRequest } from '@sage-bionetworks/synapse-types';
2
+ import { QueryClient } from '@tanstack/react-query';
1
3
  export type GoalsProps = {
2
4
  entityId: string;
3
5
  isAssetIcon?: boolean;
@@ -13,6 +15,12 @@ export type GoalsDataProps = {
13
15
  isAssetIcon: boolean;
14
16
  linkText?: string;
15
17
  };
18
+ export declare function buildGoalsQueryBundleRequest(entityId: string): QueryBundleRequest;
16
19
  export declare function Goals(props: GoalsProps): import("react/jsx-runtime").JSX.Element;
17
20
  export default Goals;
21
+ /**
22
+ * Prefetches the Goals table query into a QueryClient for use with HydrationBoundary.
23
+ * Uses anonymous access; warm-caches for unauthenticated users.
24
+ */
25
+ export declare function prefetchGoals(queryClient: QueryClient, entityId: string): Promise<void>;
18
26
  //# sourceMappingURL=Goals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Goals.d.ts","sourceRoot":"","sources":["../../../src/components/Goals/Goals.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,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