synapse-react-client 4.0.43 → 4.0.44
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.js +1 -1
- package/dist/components/DataGrid/DataGridWebSocket.d.ts +29 -1
- package/dist/components/DataGrid/DataGridWebSocket.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGridWebSocket.js +48 -16
- package/dist/components/DataGrid/DataGridWebSocket.js.map +1 -1
- package/dist/components/DataGrid/components/GridLoadingState.d.ts +2 -2
- package/dist/components/DataGrid/components/GridLoadingState.d.ts.map +1 -1
- package/dist/components/DataGrid/components/GridLoadingState.js +2 -2
- package/dist/components/DataGrid/components/GridLoadingState.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +2 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.d.ts.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js +11 -10
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js.map +1 -1
- package/dist/components/SetManagedAccessRequirementFields/DataUseCertificateFields.d.ts +10 -0
- package/dist/components/SetManagedAccessRequirementFields/DataUseCertificateFields.d.ts.map +1 -0
- package/dist/components/SetManagedAccessRequirementFields/DataUseCertificateFields.js +81 -0
- package/dist/components/SetManagedAccessRequirementFields/DataUseCertificateFields.js.map +1 -0
- package/dist/components/SetManagedAccessRequirementFields/ExpirationPeriodField.d.ts +9 -0
- package/dist/components/SetManagedAccessRequirementFields/ExpirationPeriodField.d.ts.map +1 -0
- package/dist/components/SetManagedAccessRequirementFields/ExpirationPeriodField.js +32 -0
- package/dist/components/SetManagedAccessRequirementFields/ExpirationPeriodField.js.map +1 -0
- package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.d.ts +0 -2
- package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.d.ts.map +1 -1
- package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js +74 -151
- package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js.map +1 -1
- package/dist/components/TanStackTable/TanStackTableUtils.d.ts.map +1 -1
- package/dist/components/TanStackTable/TanStackTableUtils.js +8 -5
- package/dist/components/TanStackTable/TanStackTableUtils.js.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.d.ts +5 -0
- package/dist/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.d.ts.map +1 -0
- package/dist/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.js +20 -0
- package/dist/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.js.map +1 -0
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.d.ts.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js +183 -188
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionSchemaAnswers.d.ts +25 -0
- package/dist/components/dataaccess/SubmissionPage/SubmissionSchemaAnswers.d.ts.map +1 -0
- package/dist/components/dataaccess/SubmissionPage/SubmissionSchemaAnswers.js +125 -0
- package/dist/components/dataaccess/SubmissionPage/SubmissionSchemaAnswers.js.map +1 -0
- package/dist/mocks/dataaccess/MockSubmission.d.ts +76 -0
- package/dist/mocks/dataaccess/MockSubmission.d.ts.map +1 -1
- package/dist/mocks/dataaccess/MockSubmission.js +108 -63
- package/dist/mocks/dataaccess/MockSubmission.js.map +1 -1
- package/dist/style/components/_submission-page.scss +0 -4
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/dataaccess/useGeneratedSubmissionForm.d.ts +37 -0
- package/dist/synapse-queries/dataaccess/useGeneratedSubmissionForm.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useGeneratedSubmissionForm.js +35 -0
- package/dist/synapse-queries/dataaccess/useGeneratedSubmissionForm.js.map +1 -0
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.d.ts +2 -0
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.d.ts.map +1 -1
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.js.map +1 -1
- package/dist/synapse-queries/termsOfService/useTermsOfService.d.ts.map +1 -1
- package/dist/synapse-queries/termsOfService/useTermsOfService.js +21 -19
- package/dist/synapse-queries/termsOfService/useTermsOfService.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/functions/EntityTypeUtils.d.ts +2 -2
- package/dist/utils/functions/EntityTypeUtils.d.ts.map +1 -1
- package/dist/utils/functions/EntityTypeUtils.js +135 -135
- package/dist/utils/functions/EntityTypeUtils.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ManagedACTAccessRequirement } from '@sage-bionetworks/synapse-types';
|
|
2
|
+
export declare const DUC_TEMPLATE_UPLOAD_ERROR = "There was an error uploading the DUC template. ";
|
|
3
|
+
export type DataUseCertificateSettings = Pick<ManagedACTAccessRequirement, 'id' | 'isDUCRequired' | 'ducTemplateFileHandleId' | 'eDucTemplateId'>;
|
|
4
|
+
export type DataUseCertificateFieldsProps = {
|
|
5
|
+
accessRequirement: DataUseCertificateSettings;
|
|
6
|
+
onChange: (changes: Partial<DataUseCertificateSettings>) => void;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function DataUseCertificateFields(props: DataUseCertificateFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=DataUseCertificateFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataUseCertificateFields.d.ts","sourceRoot":"","sources":["../../../src/components/SetManagedAccessRequirementFields/DataUseCertificateFields.tsx"],"names":[],"mappings":"AAYA,OAAO,EAIL,2BAA2B,EAE5B,MAAM,iCAAiC,CAAA;AAKxC,eAAO,MAAM,yBAAyB,oDACa,CAAA;AAEnD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,2BAA2B,EAC3B,IAAI,GAAG,eAAe,GAAG,yBAAyB,GAAG,gBAAgB,CACtE,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iBAAiB,EAAE,0BAA0B,CAAA;IAE7C,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,KAAK,IAAI,CAAA;IAChE,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,2CA8H5E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { SynapseErrorBoundary as e } from "../error/ErrorBanner.js";
|
|
2
|
+
import { useListEDucTemplates as t } from "../../synapse-queries/dataaccess/useEDuc.js";
|
|
3
|
+
import "../../synapse-queries/index.js";
|
|
4
|
+
import { UploadDocumentField as n } from "../AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField.js";
|
|
5
|
+
import { useEffect as r, useMemo as i, useState as a } from "react";
|
|
6
|
+
import { Alert as o, Autocomplete as s, Box as c, Checkbox as l, FormControlLabel as u, TextField as d, Typography as f } from "@mui/material";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
import { FileHandleAssociateType as g } from "@sage-bionetworks/synapse-types";
|
|
9
|
+
//#region src/components/SetManagedAccessRequirementFields/DataUseCertificateFields.tsx
|
|
10
|
+
var _ = "There was an error uploading the DUC template. ";
|
|
11
|
+
function v(v) {
|
|
12
|
+
let { accessRequirement: y, onChange: b, isLoading: x } = v, [S, C] = a(null), w = i(() => {
|
|
13
|
+
if (y.ducTemplateFileHandleId) return {
|
|
14
|
+
fileHandleId: y.ducTemplateFileHandleId,
|
|
15
|
+
associateObjectType: g.AccessRequirementAttachment,
|
|
16
|
+
associateObjectId: y.id.toString()
|
|
17
|
+
};
|
|
18
|
+
}, [y.ducTemplateFileHandleId, y.id]), { data: T, isLoading: E, hasNextPage: D, fetchNextPage: O } = t();
|
|
19
|
+
r(() => {
|
|
20
|
+
D && O();
|
|
21
|
+
}, [D, O]);
|
|
22
|
+
let k = i(() => T?.pages.flatMap((e) => e.results ?? []) ?? [], [T]), A = i(() => k.find((e) => e.templateId === y.eDucTemplateId) ?? null, [k, y.eDucTemplateId]), j = (e) => {
|
|
23
|
+
if (e.resp && e.success) {
|
|
24
|
+
C(null);
|
|
25
|
+
let t = e.resp;
|
|
26
|
+
b({
|
|
27
|
+
ducTemplateFileHandleId: t.fileHandleId,
|
|
28
|
+
eDucTemplateId: void 0
|
|
29
|
+
});
|
|
30
|
+
} else !e.success && e.error && C(`${_} ${e.error.reason}`);
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
33
|
+
/* @__PURE__ */ m(f, {
|
|
34
|
+
variant: "body1",
|
|
35
|
+
sx: { fontWeight: 700 },
|
|
36
|
+
children: "DUC"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ m(u, {
|
|
39
|
+
control: /* @__PURE__ */ m(l, {}),
|
|
40
|
+
label: "DUC is required.",
|
|
41
|
+
checked: y.isDUCRequired,
|
|
42
|
+
onChange: (e, t) => b({ isDUCRequired: t })
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ h(e, { children: [/* @__PURE__ */ m(n, {
|
|
45
|
+
id: "duc",
|
|
46
|
+
isLoading: x,
|
|
47
|
+
disabled: !y.isDUCRequired,
|
|
48
|
+
uploadCallback: (e) => j(e),
|
|
49
|
+
documentName: "Template DUC",
|
|
50
|
+
fileHandleAssociations: w ? [w] : void 0,
|
|
51
|
+
isMultiFileUpload: !1,
|
|
52
|
+
uploadBtnVariant: "contained"
|
|
53
|
+
}), S && /* @__PURE__ */ m(o, {
|
|
54
|
+
severity: "error",
|
|
55
|
+
sx: { marginTop: 2 },
|
|
56
|
+
children: S
|
|
57
|
+
})] }),
|
|
58
|
+
/* @__PURE__ */ m(c, {
|
|
59
|
+
sx: { mt: 2 },
|
|
60
|
+
children: /* @__PURE__ */ m(s, {
|
|
61
|
+
id: "eDucTemplate",
|
|
62
|
+
options: k,
|
|
63
|
+
loading: E,
|
|
64
|
+
disabled: !y.isDUCRequired,
|
|
65
|
+
value: A,
|
|
66
|
+
onChange: (e, t) => b({ eDucTemplateId: t?.templateId }),
|
|
67
|
+
getOptionLabel: (e) => e.name ?? "",
|
|
68
|
+
isOptionEqualToValue: (e, t) => e.templateId === t.templateId,
|
|
69
|
+
renderInput: (e) => /* @__PURE__ */ m(d, {
|
|
70
|
+
...e,
|
|
71
|
+
label: "eDUC template (electronic signing)",
|
|
72
|
+
helperText: "Optional. Select a DocuSign template to enable the eDUC signing flow for this Access Requirement."
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { _ as DUC_TEMPLATE_UPLOAD_ERROR, v as DataUseCertificateFields };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=DataUseCertificateFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataUseCertificateFields.js","names":[],"sources":["../../../src/components/SetManagedAccessRequirementFields/DataUseCertificateFields.tsx"],"sourcesContent":["import { useListEDucTemplates } from '@/synapse-queries'\nimport {\n Alert,\n Autocomplete,\n Box,\n Checkbox,\n FormControlLabel,\n TextField,\n Typography,\n} from '@mui/material'\nimport { EDucTemplate } from '@sage-bionetworks/synapse-client'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport {\n FileHandleAssociateType,\n FileHandleAssociation,\n FileUploadComplete,\n ManagedACTAccessRequirement,\n UploadCallbackResp,\n} from '@sage-bionetworks/synapse-types'\nimport { useEffect, useMemo, useState } from 'react'\nimport { UploadDocumentField } from '../AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField'\nimport { SynapseErrorBoundary } from '../error/ErrorBanner'\n\nexport const DUC_TEMPLATE_UPLOAD_ERROR =\n 'There was an error uploading the DUC template. '\n\nexport type DataUseCertificateSettings = Pick<\n ManagedACTAccessRequirement,\n 'id' | 'isDUCRequired' | 'ducTemplateFileHandleId' | 'eDucTemplateId'\n>\n\nexport type DataUseCertificateFieldsProps = {\n accessRequirement: DataUseCertificateSettings\n /* Called with the settings that changed; the caller merges them into its copy of the AR. */\n onChange: (changes: Partial<DataUseCertificateSettings>) => void\n isLoading: boolean\n}\n\nexport function DataUseCertificateFields(props: DataUseCertificateFieldsProps) {\n const { accessRequirement, onChange, isLoading } = props\n\n const [uploadDucTemplateError, setUploadDucTemplateError] = useState<\n string | null\n >(null)\n\n const ducTemplateFileHandleAssociation = useMemo(() => {\n if (accessRequirement.ducTemplateFileHandleId) {\n const ducTemplateFileHandleAssociation: FileHandleAssociation = {\n fileHandleId: accessRequirement.ducTemplateFileHandleId,\n associateObjectType:\n FileHandleAssociateType.AccessRequirementAttachment,\n associateObjectId: accessRequirement.id.toString(),\n }\n return ducTemplateFileHandleAssociation\n }\n return undefined\n }, [accessRequirement.ducTemplateFileHandleId, accessRequirement.id])\n\n const {\n data: eDucTemplateData,\n isLoading: isLoadingEDucTemplates,\n hasNextPage: hasNextEDucTemplatePage,\n fetchNextPage: fetchNextEDucTemplatePage,\n } = useListEDucTemplates()\n // Auto-fetch all pages so the dropdown always shows the complete template list.\n useEffect(() => {\n if (hasNextEDucTemplatePage) {\n void fetchNextEDucTemplatePage()\n }\n }, [hasNextEDucTemplatePage, fetchNextEDucTemplatePage])\n const eDucTemplates = useMemo(\n () => eDucTemplateData?.pages.flatMap(page => page.results ?? []) ?? [],\n [eDucTemplateData],\n )\n const selectedEDucTemplate = useMemo(\n () =>\n eDucTemplates.find(\n template => template.templateId === accessRequirement.eDucTemplateId,\n ) ?? null,\n [eDucTemplates, accessRequirement.eDucTemplateId],\n )\n\n const uploadDucTemplateCallback = (data: UploadCallbackResp) => {\n if (data.resp && data.success) {\n setUploadDucTemplateError(null)\n // Files are uploaded and synced with the server immediately\n const uploadResponse: FileUploadComplete = data.resp\n onChange({\n ducTemplateFileHandleId: uploadResponse.fileHandleId,\n eDucTemplateId: undefined, // mutually exclusive with file upload\n })\n } else if (!data.success && data.error) {\n setUploadDucTemplateError(\n `${DUC_TEMPLATE_UPLOAD_ERROR} ${\n (data.error as SynapseClientError).reason\n }`,\n )\n }\n }\n\n return (\n <>\n <Typography\n variant=\"body1\"\n sx={{\n fontWeight: 700,\n }}\n >\n DUC\n </Typography>\n <FormControlLabel\n control={<Checkbox />}\n label=\"DUC is required.\"\n checked={accessRequirement.isDUCRequired}\n onChange={(_event, checked: boolean) =>\n onChange({ isDUCRequired: checked })\n }\n />\n <SynapseErrorBoundary>\n <UploadDocumentField\n id=\"duc\"\n isLoading={isLoading}\n disabled={!accessRequirement.isDUCRequired}\n uploadCallback={resp => uploadDucTemplateCallback(resp)}\n documentName=\"Template DUC\"\n fileHandleAssociations={\n ducTemplateFileHandleAssociation\n ? [ducTemplateFileHandleAssociation]\n : undefined\n }\n isMultiFileUpload={false}\n uploadBtnVariant=\"contained\"\n />\n {uploadDucTemplateError && (\n <Alert severity=\"error\" sx={{ marginTop: 2 }}>\n {uploadDucTemplateError}\n </Alert>\n )}\n </SynapseErrorBoundary>\n <Box sx={{ mt: 2 }}>\n <Autocomplete<EDucTemplate>\n id=\"eDucTemplate\"\n options={eDucTemplates}\n loading={isLoadingEDucTemplates}\n disabled={!accessRequirement.isDUCRequired}\n value={selectedEDucTemplate}\n onChange={(_event, template) =>\n onChange({ eDucTemplateId: template?.templateId })\n }\n getOptionLabel={template => template.name ?? ''}\n isOptionEqualToValue={(option, value) =>\n option.templateId === value.templateId\n }\n renderInput={params => (\n <TextField\n {...params}\n label=\"eDUC template (electronic signing)\"\n helperText=\"Optional. Select a DocuSign template to enable the eDUC signing flow for this Access Requirement.\"\n />\n )}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,CAAC;EAEtC,CAAA;EACD,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;GACE,IAAG;GACQ;GACX,UAAU,CAAC,EAAkB;GAC7B,iBAAgB,MAAQ,EAA0B,CAAI;GACtD,cAAa;GACb,wBACE,IACI,CAAC,CAAgC,IACjC,KAAA;GAEN,mBAAmB;GACnB,kBAAiB;EAClB,CAAA,GACA,KACC,kBAAC,GAAD;GAAO,UAAS;GAAQ,IAAI,EAAE,WAAW,EAAE;aACxC;EACI,CAAA,CAEW,EAAA,CAAA;EACtB,kBAAC,GAAD;GAAK,IAAI,EAAE,IAAI,EAAE;aACf,kBAAC,GAAD;IACE,IAAG;IACH,SAAS;IACT,SAAS;IACT,UAAU,CAAC,EAAkB;IAC7B,OAAO;IACP,WAAW,GAAQ,MACjB,EAAS,EAAE,gBAAgB,GAAU,WAAW,CAAC;IAEnD,iBAAgB,MAAY,EAAS,QAAQ;IAC7C,uBAAuB,GAAQ,MAC7B,EAAO,eAAe,EAAM;IAE9B,cAAa,MACX,kBAAC,GAAD;KACE,GAAI;KACJ,OAAM;KACN,YAAW;IACZ,CAAA;GAEJ,CAAA;EACE,CAAA;CACL,EAAA,CAAA;AAEN"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const getValidExpirationPeriodOrErrorMessage: (expirationPeriodDays: string) => string | number;
|
|
2
|
+
export type ExpirationPeriodFieldProps = {
|
|
3
|
+
days: string;
|
|
4
|
+
error: string | null;
|
|
5
|
+
onChange: (days: string) => void;
|
|
6
|
+
onBlur: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function ExpirationPeriodField(props: ExpirationPeriodFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ExpirationPeriodField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpirationPeriodField.d.ts","sourceRoot":"","sources":["../../../src/components/SetManagedAccessRequirementFields/ExpirationPeriodField.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,sCAAsC,GACjD,sBAAsB,MAAM,oBAa7B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IAEvC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAgBtE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DAY_IN_MS as e } from "../../utils/SynapseConstants.js";
|
|
2
|
+
import { TextField as t } from "@mui/material";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/SetManagedAccessRequirementFields/ExpirationPeriodField.tsx
|
|
5
|
+
var r = (t) => {
|
|
6
|
+
if (t === "") return 0;
|
|
7
|
+
let n = "Please enter a valid expiration period (in days): ";
|
|
8
|
+
if (/^[-]?\d+$/.test(t)) {
|
|
9
|
+
let r = Number(t);
|
|
10
|
+
return r < 0 ? `${n}If expiration period is set, then it must be greater than 0.` : r * e;
|
|
11
|
+
}
|
|
12
|
+
return `${n}For input string: "${t}"`;
|
|
13
|
+
};
|
|
14
|
+
function i(e) {
|
|
15
|
+
let { days: r, error: i, onChange: a, onBlur: o } = e;
|
|
16
|
+
return /* @__PURE__ */ n(t, {
|
|
17
|
+
id: "expirationPeriod",
|
|
18
|
+
name: "expirationPeriod",
|
|
19
|
+
label: "Expiration period (days)",
|
|
20
|
+
value: r,
|
|
21
|
+
error: !!i,
|
|
22
|
+
helperText: i,
|
|
23
|
+
sx: { mt: 1 },
|
|
24
|
+
fullWidth: !0,
|
|
25
|
+
onChange: (e) => a(e.target.value),
|
|
26
|
+
onBlur: o
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as ExpirationPeriodField, r as getValidExpirationPeriodOrErrorMessage };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=ExpirationPeriodField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpirationPeriodField.js","names":[],"sources":["../../../src/components/SetManagedAccessRequirementFields/ExpirationPeriodField.tsx"],"sourcesContent":["import { DAY_IN_MS } from '@/utils/SynapseConstants'\nimport { TextField } from '@mui/material'\n\nexport const getValidExpirationPeriodOrErrorMessage = (\n expirationPeriodDays: string,\n) => {\n if (expirationPeriodDays === '') return 0\n\n const msgPrefix = 'Please enter a valid expiration period (in days): '\n if (/^[-]?\\d+$/.test(expirationPeriodDays)) {\n const num = Number(expirationPeriodDays)\n if (num < 0) {\n return `${msgPrefix}If expiration period is set, then it must be greater than 0.`\n }\n return num * DAY_IN_MS\n }\n return `${msgPrefix}For input string: \"${expirationPeriodDays}\"`\n}\n\nexport type ExpirationPeriodFieldProps = {\n /* The expiration period in days, as typed by the user */\n days: string\n error: string | null\n onChange: (days: string) => void\n onBlur: () => void\n}\n\nexport function ExpirationPeriodField(props: ExpirationPeriodFieldProps) {\n const { days, error, onChange, onBlur } = props\n return (\n <TextField\n id=\"expirationPeriod\"\n name=\"expirationPeriod\"\n label=\"Expiration period (days)\"\n value={days}\n error={Boolean(error)}\n helperText={error}\n sx={{ mt: 1 }}\n fullWidth\n onChange={event => onChange(event.target.value)}\n onBlur={onBlur}\n />\n )\n}\n"],"mappings":";;;;AAGA,IAAa,KACX,MACG;CACH,IAAI,MAAyB,IAAI,OAAO;CAExC,IAAM,IAAY;CAClB,IAAI,YAAY,KAAK,CAAoB,GAAG;EAC1C,IAAM,IAAM,OAAO,CAAoB;EAIvC,OAHI,IAAM,IACD,GAAG,EAAU,gEAEf,IAAM;CACf;CACA,OAAO,GAAG,EAAU,qBAAqB,EAAqB;AAChE;AAUA,SAAgB,EAAsB,GAAmC;CACvE,IAAM,EAAE,SAAM,UAAO,aAAU,cAAW;CAC1C,OACE,kBAAC,GAAD;EACE,IAAG;EACH,MAAK;EACL,OAAM;EACN,OAAO;EACP,OAAO,EAAQ;EACf,YAAY;EACZ,IAAI,EAAE,IAAI,EAAE;EACZ,WAAA;EACA,WAAU,MAAS,EAAS,EAAM,OAAO,KAAK;EACtC;CACT,CAAA;AAEL"}
|
package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export declare const DUC_TEMPLATE_UPLOAD_ERROR = "There was an error uploading the DUC template. ";
|
|
2
|
-
export declare const getValidExpirationPeriodOrErrorMessage: (expirationPeriodDays: string) => string | number;
|
|
3
1
|
export type SetManagedAccessRequirementFieldsHandle = {
|
|
4
2
|
save: () => void;
|
|
5
3
|
};
|
package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetManagedAccessRequirementFields.d.ts","sourceRoot":"","sources":["../../../src/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SetManagedAccessRequirementFields.d.ts","sourceRoot":"","sources":["../../../src/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,uCAAuC,GAAG;IAEpD,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,sCAAsC,GAAG;IACnD,mBAAmB,EAAE,MAAM,CAAA;IAE3B,MAAM,EAAE,MAAM,IAAI,CAAA;IAElB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,iCAAiC,4JA6L7C,CAAA"}
|
package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js
CHANGED
|
@@ -1,71 +1,41 @@
|
|
|
1
1
|
import { DAY_IN_MS as e } from "../../utils/SynapseConstants.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useGetAccessRequirements as r, useUpdateAccessRequirement as i } from "../../synapse-queries/dataaccess/useAccessRequirements.js";
|
|
5
|
-
import { useListEDucTemplates as a } from "../../synapse-queries/dataaccess/useEDuc.js";
|
|
2
|
+
import { SynapseSpinner as t } from "../LoadingScreen/LoadingScreen.js";
|
|
3
|
+
import { useGetAccessRequirements as n, useUpdateAccessRequirement as r } from "../../synapse-queries/dataaccess/useAccessRequirements.js";
|
|
6
4
|
import "../../synapse-queries/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { AccessorRequirements as c } from "../SetBasicAccessRequirementFields/AccessorRequirements.js";
|
|
5
|
+
import { AccessRequirementWikiInstructions as i } from "../SetBasicAccessRequirementFields/AccessRequirementWikiInstructions.js";
|
|
6
|
+
import { AccessorRequirements as a } from "../SetBasicAccessRequirementFields/AccessorRequirements.js";
|
|
10
7
|
import "../SetBasicAccessRequirementFields/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
8
|
+
import { DataUseCertificateFields as o } from "./DataUseCertificateFields.js";
|
|
9
|
+
import { ExpirationPeriodField as s, getValidExpirationPeriodOrErrorMessage as c } from "./ExpirationPeriodField.js";
|
|
10
|
+
import { forwardRef as l, useEffect as u, useImperativeHandle as d, useState as f } from "react";
|
|
11
|
+
import { Alert as p, Box as m, Checkbox as h, FormControlLabel as g, Typography as _ } from "@mui/material";
|
|
12
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
15
13
|
//#region src/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.tsx
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
let n = "Please enter a valid expiration period (in days): ";
|
|
19
|
-
if (/^[-]?\d+$/.test(t)) {
|
|
20
|
-
let r = Number(t);
|
|
21
|
-
return r < 0 ? `${n}If expiration period is set, then it must be greater than 0.` : r * e;
|
|
22
|
-
}
|
|
23
|
-
return `${n}For input string: "${t}"`;
|
|
24
|
-
}, D = l(function(l, D) {
|
|
25
|
-
let { accessRequirementId: O, onSave: k, onError: A } = l, { data: j, error: M } = r(O, { staleTime: Infinity });
|
|
14
|
+
var x = l(function(l, x) {
|
|
15
|
+
let { accessRequirementId: S, onSave: C, onError: w } = l, { data: T, error: E } = n(S, { staleTime: Infinity });
|
|
26
16
|
u(() => {
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
let [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
associateObjectType: w.AccessRequirementAttachment,
|
|
33
|
-
associateObjectId: L.id.toString()
|
|
34
|
-
};
|
|
35
|
-
}, [L?.ducTemplateFileHandleId, L?.id]), { data: H, isLoading: U, hasNextPage: W, fetchNextPage: G } = a();
|
|
36
|
-
u(() => {
|
|
37
|
-
W && G();
|
|
38
|
-
}, [W, G]);
|
|
39
|
-
let K = f(() => H?.pages.flatMap((e) => e.results ?? []) ?? [], [H]), q = f(() => K.find((e) => e.templateId === L?.eDucTemplateId) ?? null, [K, L?.eDucTemplateId]), J = (e) => {
|
|
40
|
-
if (e.resp && e.success && L) {
|
|
41
|
-
P(null);
|
|
42
|
-
let t = e.resp;
|
|
43
|
-
R({
|
|
44
|
-
...L,
|
|
45
|
-
ducTemplateFileHandleId: t.fileHandleId,
|
|
46
|
-
eDucTemplateId: void 0
|
|
47
|
-
});
|
|
48
|
-
} else !e.success && e.error && P(`${T} ${e.error.reason}`);
|
|
49
|
-
}, { mutate: Y, isPending: X, error: Z } = i({
|
|
50
|
-
onSuccess: () => k(),
|
|
51
|
-
onError: () => A()
|
|
17
|
+
T && (A(T), M((T.expirationPeriod / e).toString()));
|
|
18
|
+
}, [T]);
|
|
19
|
+
let [D, O] = f(null), [k, A] = f(null), [j, M] = f(""), { mutate: N, isPending: P, error: F } = r({
|
|
20
|
+
onSuccess: () => C(),
|
|
21
|
+
onError: () => w()
|
|
52
22
|
});
|
|
53
|
-
return d(
|
|
54
|
-
if (
|
|
55
|
-
let e =
|
|
56
|
-
typeof e == "string" ? (
|
|
57
|
-
...
|
|
23
|
+
return d(x, () => ({ save() {
|
|
24
|
+
if (k) {
|
|
25
|
+
let e = c(j);
|
|
26
|
+
typeof e == "string" ? (O(e), w()) : N({
|
|
27
|
+
...k,
|
|
58
28
|
expirationPeriod: e
|
|
59
29
|
});
|
|
60
30
|
}
|
|
61
31
|
} }), [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
]),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
32
|
+
j,
|
|
33
|
+
k,
|
|
34
|
+
N,
|
|
35
|
+
w
|
|
36
|
+
]), k ? /* @__PURE__ */ b(v, { children: [
|
|
37
|
+
/* @__PURE__ */ y(i, { accessRequirement: k }),
|
|
38
|
+
/* @__PURE__ */ b(m, { children: [/* @__PURE__ */ y(_, {
|
|
69
39
|
sx: {
|
|
70
40
|
bgcolor: "#f5f5f5",
|
|
71
41
|
borderBottom: "1px solid #ddd",
|
|
@@ -74,125 +44,78 @@ var T = "There was an error uploading the DUC template. ", E = (t) => {
|
|
|
74
44
|
py: 1
|
|
75
45
|
},
|
|
76
46
|
children: "Data Access Request Parameters"
|
|
77
|
-
}), /* @__PURE__ */
|
|
47
|
+
}), /* @__PURE__ */ b(m, {
|
|
78
48
|
sx: {
|
|
79
49
|
mt: 2,
|
|
80
50
|
mb: 4
|
|
81
51
|
},
|
|
82
|
-
children: [/* @__PURE__ */
|
|
83
|
-
accessRequirement:
|
|
84
|
-
onChange: (e) =>
|
|
85
|
-
}), /* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ y(a, {
|
|
53
|
+
accessRequirement: k,
|
|
54
|
+
onChange: (e) => A(e)
|
|
55
|
+
}), /* @__PURE__ */ b(m, {
|
|
86
56
|
sx: { mb: 2 },
|
|
87
57
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
control: /* @__PURE__ */ S(_, {}),
|
|
95
|
-
label: "DUC is required.",
|
|
96
|
-
checked: L.isDUCRequired,
|
|
97
|
-
onChange: (e, t) => R({
|
|
98
|
-
...L,
|
|
99
|
-
isDUCRequired: t
|
|
58
|
+
/* @__PURE__ */ y(o, {
|
|
59
|
+
accessRequirement: k,
|
|
60
|
+
isLoading: P,
|
|
61
|
+
onChange: (e) => A({
|
|
62
|
+
...k,
|
|
63
|
+
...e
|
|
100
64
|
})
|
|
101
65
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
id: "duc",
|
|
104
|
-
isLoading: X,
|
|
105
|
-
disabled: !L.isDUCRequired,
|
|
106
|
-
uploadCallback: (e) => J(e),
|
|
107
|
-
documentName: "Template DUC",
|
|
108
|
-
fileHandleAssociations: V ? [V] : void 0,
|
|
109
|
-
isMultiFileUpload: !1,
|
|
110
|
-
uploadBtnVariant: "contained"
|
|
111
|
-
}), N && /* @__PURE__ */ S(m, {
|
|
112
|
-
severity: "error",
|
|
113
|
-
sx: { marginTop: 2 },
|
|
114
|
-
children: N
|
|
115
|
-
})] }),
|
|
116
|
-
/* @__PURE__ */ S(g, {
|
|
117
|
-
sx: { mt: 2 },
|
|
118
|
-
children: /* @__PURE__ */ S(h, {
|
|
119
|
-
id: "eDucTemplate",
|
|
120
|
-
options: K,
|
|
121
|
-
loading: U,
|
|
122
|
-
disabled: !L.isDUCRequired,
|
|
123
|
-
value: q,
|
|
124
|
-
onChange: (e, t) => R({
|
|
125
|
-
...L,
|
|
126
|
-
eDucTemplateId: t?.templateId
|
|
127
|
-
}),
|
|
128
|
-
getOptionLabel: (e) => e.name ?? "",
|
|
129
|
-
isOptionEqualToValue: (e, t) => e.templateId === t.templateId,
|
|
130
|
-
renderInput: (e) => /* @__PURE__ */ S(y, {
|
|
131
|
-
...e,
|
|
132
|
-
label: "eDUC template (electronic signing)",
|
|
133
|
-
helperText: "Optional. Select a DocuSign template to enable the eDUC signing flow for this Access Requirement."
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
}),
|
|
137
|
-
/* @__PURE__ */ S(v, {
|
|
66
|
+
/* @__PURE__ */ y(g, {
|
|
138
67
|
label: "IRB approval is required.",
|
|
139
|
-
checked:
|
|
140
|
-
control: /* @__PURE__ */
|
|
141
|
-
onChange: (e, t) =>
|
|
142
|
-
...
|
|
68
|
+
checked: k.isIRBApprovalRequired,
|
|
69
|
+
control: /* @__PURE__ */ y(h, {}),
|
|
70
|
+
onChange: (e, t) => A({
|
|
71
|
+
...k,
|
|
143
72
|
isIRBApprovalRequired: t
|
|
144
73
|
}),
|
|
145
74
|
sx: { ml: 0 }
|
|
146
75
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
control: /* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ y(g, {
|
|
77
|
+
control: /* @__PURE__ */ y(h, {}),
|
|
149
78
|
label: "Other documents are required.",
|
|
150
|
-
checked:
|
|
151
|
-
onChange: (e, t) =>
|
|
152
|
-
...
|
|
79
|
+
checked: k.areOtherAttachmentsRequired,
|
|
80
|
+
onChange: (e, t) => A({
|
|
81
|
+
...k,
|
|
153
82
|
areOtherAttachmentsRequired: t
|
|
154
83
|
})
|
|
155
84
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
label: "Expiration period (days)",
|
|
160
|
-
value: z,
|
|
161
|
-
error: !!F,
|
|
162
|
-
helperText: F,
|
|
163
|
-
sx: { mt: 1 },
|
|
164
|
-
fullWidth: !0,
|
|
85
|
+
/* @__PURE__ */ y(s, {
|
|
86
|
+
days: j,
|
|
87
|
+
error: D,
|
|
165
88
|
onChange: (e) => {
|
|
166
|
-
|
|
89
|
+
O(null), M(e);
|
|
167
90
|
},
|
|
168
91
|
onBlur: () => {
|
|
169
|
-
let e =
|
|
170
|
-
typeof e == "string" &&
|
|
92
|
+
let e = c(j);
|
|
93
|
+
typeof e == "string" && O(e);
|
|
171
94
|
}
|
|
172
95
|
}),
|
|
173
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ b(m, {
|
|
174
97
|
sx: { mt: 1 },
|
|
175
|
-
children: [/* @__PURE__ */
|
|
176
|
-
control: /* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ y(g, {
|
|
99
|
+
control: /* @__PURE__ */ y(h, {}),
|
|
177
100
|
label: "Intended Data Use statement is required.",
|
|
178
|
-
checked:
|
|
101
|
+
checked: k.isIDURequired,
|
|
179
102
|
onChange: (e, t) => {
|
|
180
|
-
|
|
181
|
-
...
|
|
103
|
+
A(t ? {
|
|
104
|
+
...k,
|
|
182
105
|
isIDURequired: !0
|
|
183
106
|
} : {
|
|
184
|
-
...
|
|
107
|
+
...k,
|
|
185
108
|
isIDURequired: !1,
|
|
186
109
|
isIDUPublic: !1
|
|
187
110
|
});
|
|
188
111
|
}
|
|
189
|
-
}), /* @__PURE__ */
|
|
190
|
-
control: /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ y(g, {
|
|
113
|
+
control: /* @__PURE__ */ y(h, {}),
|
|
191
114
|
label: "Intended Data Use statements will be publicly available.",
|
|
192
|
-
checked:
|
|
193
|
-
disabled: !
|
|
194
|
-
onChange: (e, t) =>
|
|
195
|
-
...
|
|
115
|
+
checked: k.isIDUPublic,
|
|
116
|
+
disabled: !k.isIDURequired,
|
|
117
|
+
onChange: (e, t) => A({
|
|
118
|
+
...k,
|
|
196
119
|
isIDUPublic: t
|
|
197
120
|
})
|
|
198
121
|
})]
|
|
@@ -200,17 +123,17 @@ var T = "There was an error uploading the DUC template. ", E = (t) => {
|
|
|
200
123
|
]
|
|
201
124
|
})]
|
|
202
125
|
})] }),
|
|
203
|
-
|
|
126
|
+
F && /* @__PURE__ */ y(p, {
|
|
204
127
|
severity: "error",
|
|
205
128
|
sx: { marginTop: 2 },
|
|
206
|
-
children:
|
|
129
|
+
children: F.reason
|
|
207
130
|
})
|
|
208
|
-
] }) :
|
|
131
|
+
] }) : E ? /* @__PURE__ */ y(p, {
|
|
209
132
|
severity: "error",
|
|
210
|
-
children:
|
|
211
|
-
}) : /* @__PURE__ */
|
|
133
|
+
children: E.reason
|
|
134
|
+
}) : /* @__PURE__ */ y(t, {});
|
|
212
135
|
});
|
|
213
136
|
//#endregion
|
|
214
|
-
export {
|
|
137
|
+
export { x as SetManagedAccessRequirementFields };
|
|
215
138
|
|
|
216
139
|
//# sourceMappingURL=SetManagedAccessRequirementFields.js.map
|
package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetManagedAccessRequirementFields.js","names":[],"sources":["../../../src/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.tsx"],"sourcesContent":["import {\n useGetAccessRequirements,\n useListEDucTemplates,\n useUpdateAccessRequirement,\n} from '@/synapse-queries'\nimport { DAY_IN_MS } from '@/utils/SynapseConstants'\nimport {\n Alert,\n Autocomplete,\n Box,\n Checkbox,\n FormControlLabel,\n TextField,\n Typography,\n} from '@mui/material'\nimport { EDucTemplate } from '@sage-bionetworks/synapse-client'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport {\n FileHandleAssociateType,\n FileHandleAssociation,\n FileUploadComplete,\n ManagedACTAccessRequirement,\n UploadCallbackResp,\n} from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\nimport { UploadDocumentField } from '../AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField'\nimport { SynapseErrorBoundary } from '../error/ErrorBanner'\nimport { SynapseSpinner } from '../LoadingScreen/LoadingScreen'\nimport {\n AccessorRequirements,\n AccessRequirementWikiInstructions,\n} from '../SetBasicAccessRequirementFields'\n\nexport const DUC_TEMPLATE_UPLOAD_ERROR =\n 'There was an error uploading the DUC template. '\n\nexport const getValidExpirationPeriodOrErrorMessage = (\n expirationPeriodDays: string,\n) => {\n if (expirationPeriodDays === '') return 0\n\n const msgPrefix = 'Please enter a valid expiration period (in days): '\n if (/^[-]?\\d+$/.test(expirationPeriodDays)) {\n const num = Number(expirationPeriodDays)\n if (num < 0) {\n return `${msgPrefix}If expiration period is set, then it must be greater than 0.`\n }\n return num * DAY_IN_MS\n }\n return `${msgPrefix}For input string: \"${expirationPeriodDays}\"`\n}\n\nexport type SetManagedAccessRequirementFieldsHandle = {\n /* Allow the parent component to trigger saving the AR, so this may be embedded in an arbitrary modal. */\n save: () => void\n}\n\nexport type SetManagedAccessRequirementFieldsProps = {\n accessRequirementId: string\n /* Called when AR has been saved successfully */\n onSave: () => void\n /* Called when error saving AR */\n onError: () => void\n}\n\nexport const SetManagedAccessRequirementFields = forwardRef(\n function SetManagedAccessRequirementFields(\n props: SetManagedAccessRequirementFieldsProps,\n ref: ForwardedRef<SetManagedAccessRequirementFieldsHandle>,\n ) {\n const { accessRequirementId, onSave, onError } = props\n\n const { data: accessRequirement, error: getArError } =\n useGetAccessRequirements<ManagedACTAccessRequirement>(\n accessRequirementId,\n { staleTime: Infinity },\n )\n useEffect(() => {\n if (accessRequirement) {\n setUpdatedAr(accessRequirement)\n setExpirationPeriodDays(\n (accessRequirement.expirationPeriod / DAY_IN_MS).toString(),\n )\n }\n }, [accessRequirement])\n\n const [uploadDucTemplateError, setUploadDucTemplateError] = useState<\n string | null\n >(null)\n const [expirationPeriodError, setExpirationPeriodError] = useState<\n string | null\n >(null)\n\n const [updatedAr, setUpdatedAr] =\n useState<ManagedACTAccessRequirement | null>(null)\n const [expirationPeriodDays, setExpirationPeriodDays] = useState<string>('')\n\n const ducTemplateFileHandleAssociation = useMemo(() => {\n if (updatedAr?.ducTemplateFileHandleId) {\n const ducTemplateFileHandleAssociation: FileHandleAssociation = {\n fileHandleId: updatedAr.ducTemplateFileHandleId,\n associateObjectType:\n FileHandleAssociateType.AccessRequirementAttachment,\n associateObjectId: updatedAr.id.toString(),\n }\n return ducTemplateFileHandleAssociation\n }\n return undefined\n }, [updatedAr?.ducTemplateFileHandleId, updatedAr?.id])\n\n const {\n data: eDucTemplateData,\n isLoading: isLoadingEDucTemplates,\n hasNextPage: hasNextEDucTemplatePage,\n fetchNextPage: fetchNextEDucTemplatePage,\n } = useListEDucTemplates()\n // Auto-fetch all pages so the dropdown always shows the complete template list.\n useEffect(() => {\n if (hasNextEDucTemplatePage) {\n void fetchNextEDucTemplatePage()\n }\n }, [hasNextEDucTemplatePage, fetchNextEDucTemplatePage])\n const eDucTemplates = useMemo(\n () => eDucTemplateData?.pages.flatMap(page => page.results ?? []) ?? [],\n [eDucTemplateData],\n )\n const selectedEDucTemplate = useMemo(\n () =>\n eDucTemplates.find(\n template => template.templateId === updatedAr?.eDucTemplateId,\n ) ?? null,\n [eDucTemplates, updatedAr?.eDucTemplateId],\n )\n\n const uploadDucTemplateCallback = (data: UploadCallbackResp) => {\n if (data.resp && data.success && updatedAr) {\n setUploadDucTemplateError(null)\n // Files are uploaded and synced with the server immediately\n const uploadResponse: FileUploadComplete = data.resp\n setUpdatedAr({\n ...updatedAr,\n ducTemplateFileHandleId: uploadResponse.fileHandleId,\n eDucTemplateId: undefined, // mutually exclusive with file upload\n })\n } else if (!data.success && data.error) {\n setUploadDucTemplateError(\n `${DUC_TEMPLATE_UPLOAD_ERROR} ${\n (data.error as SynapseClientError).reason\n }`,\n )\n }\n }\n\n const {\n mutate: updateAccessRequirement,\n isPending: isUpdatingAccessRequirement,\n error: updateArError,\n } = useUpdateAccessRequirement<ManagedACTAccessRequirement>({\n onSuccess: () => onSave(),\n onError: () => onError(),\n })\n\n useImperativeHandle(ref, () => {\n return {\n save() {\n if (updatedAr) {\n const expirationPeriodOrErrorMessage =\n getValidExpirationPeriodOrErrorMessage(expirationPeriodDays)\n if (typeof expirationPeriodOrErrorMessage === 'string') {\n setExpirationPeriodError(expirationPeriodOrErrorMessage)\n onError()\n } else {\n updateAccessRequirement({\n ...updatedAr,\n expirationPeriod: expirationPeriodOrErrorMessage,\n })\n }\n }\n },\n }\n }, [expirationPeriodDays, updatedAr, updateAccessRequirement, onError])\n\n if (!updatedAr) {\n if (getArError) {\n return <Alert severity=\"error\">{getArError.reason}</Alert>\n } else {\n return <SynapseSpinner />\n }\n }\n\n return (\n <>\n <AccessRequirementWikiInstructions accessRequirement={updatedAr} />\n <Box>\n <Typography\n sx={{\n bgcolor: '#f5f5f5',\n borderBottom: '1px solid #ddd',\n color: '#333',\n px: 2,\n py: 1,\n }}\n >\n Data Access Request Parameters\n </Typography>\n <Box\n sx={{\n mt: 2,\n mb: 4,\n }}\n >\n <AccessorRequirements\n accessRequirement={updatedAr}\n onChange={updatedAr =>\n setUpdatedAr(updatedAr as ManagedACTAccessRequirement)\n }\n />\n <Box\n sx={{\n mb: 2,\n }}\n >\n <Typography\n variant=\"body1\"\n sx={{\n fontWeight: 700,\n }}\n >\n DUC\n </Typography>\n <FormControlLabel\n control={<Checkbox />}\n label=\"DUC is required.\"\n checked={updatedAr.isDUCRequired}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n isDUCRequired: checked,\n })\n }\n />\n <SynapseErrorBoundary>\n <UploadDocumentField\n id=\"duc\"\n isLoading={isUpdatingAccessRequirement}\n disabled={!updatedAr.isDUCRequired}\n uploadCallback={resp => uploadDucTemplateCallback(resp)}\n documentName=\"Template DUC\"\n fileHandleAssociations={\n ducTemplateFileHandleAssociation\n ? [ducTemplateFileHandleAssociation]\n : undefined\n }\n isMultiFileUpload={false}\n uploadBtnVariant=\"contained\"\n />\n {uploadDucTemplateError && (\n <Alert severity=\"error\" sx={{ marginTop: 2 }}>\n {uploadDucTemplateError}\n </Alert>\n )}\n </SynapseErrorBoundary>\n <Box sx={{ mt: 2 }}>\n <Autocomplete<EDucTemplate>\n id=\"eDucTemplate\"\n options={eDucTemplates}\n loading={isLoadingEDucTemplates}\n disabled={!updatedAr.isDUCRequired}\n value={selectedEDucTemplate}\n onChange={(_event, template) =>\n setUpdatedAr({\n ...updatedAr,\n eDucTemplateId: template?.templateId,\n })\n }\n getOptionLabel={template => template.name ?? ''}\n isOptionEqualToValue={(option, value) =>\n option.templateId === value.templateId\n }\n renderInput={params => (\n <TextField\n {...params}\n label=\"eDUC template (electronic signing)\"\n helperText=\"Optional. Select a DocuSign template to enable the eDUC signing flow for this Access Requirement.\"\n />\n )}\n />\n </Box>\n <FormControlLabel\n label=\"IRB approval is required.\"\n checked={updatedAr.isIRBApprovalRequired}\n control={<Checkbox />}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n isIRBApprovalRequired: checked,\n })\n }\n sx={{ ml: 0 }}\n />\n <FormControlLabel\n control={<Checkbox />}\n label=\"Other documents are required.\"\n checked={updatedAr.areOtherAttachmentsRequired}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n areOtherAttachmentsRequired: checked,\n })\n }\n />\n <TextField\n id=\"expirationPeriod\"\n name=\"expirationPeriod\"\n label=\"Expiration period (days)\"\n value={expirationPeriodDays}\n error={Boolean(expirationPeriodError)}\n helperText={expirationPeriodError}\n sx={{ mt: 1 }}\n fullWidth\n onChange={event => {\n setExpirationPeriodError(null)\n setExpirationPeriodDays(event.target.value)\n }}\n onBlur={() => {\n const expirationPeriodOrErrorMessage =\n getValidExpirationPeriodOrErrorMessage(expirationPeriodDays)\n if (typeof expirationPeriodOrErrorMessage === 'string') {\n setExpirationPeriodError(expirationPeriodOrErrorMessage)\n }\n }}\n />\n <Box\n sx={{\n mt: 1,\n }}\n >\n <FormControlLabel\n control={<Checkbox />}\n label=\"Intended Data Use statement is required.\"\n checked={updatedAr.isIDURequired}\n onChange={(_event, checked: boolean) => {\n if (checked) {\n setUpdatedAr({\n ...updatedAr,\n isIDURequired: true,\n })\n } else {\n setUpdatedAr({\n ...updatedAr,\n isIDURequired: false,\n isIDUPublic: false,\n })\n }\n }}\n />\n <FormControlLabel\n control={<Checkbox />}\n label=\"Intended Data Use statements will be publicly available.\"\n checked={updatedAr.isIDUPublic}\n disabled={!updatedAr.isIDURequired}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n isIDUPublic: checked,\n })\n }\n />\n </Box>\n </Box>\n </Box>\n </Box>\n {updateArError && (\n <Alert severity=\"error\" sx={{ marginTop: 2 }}>\n {updateArError.reason}\n </Alert>\n )}\n </>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,IAAa,IACX,mDAEW,KACX,MACG;CACH,IAAI,MAAyB,IAAI,OAAO;CAExC,IAAM,IAAY;CAClB,IAAI,YAAY,KAAK,CAAoB,GAAG;EAC1C,IAAM,IAAM,OAAO,CAAoB;EAIvC,OAHI,IAAM,IACD,GAAG,EAAU,gEAEf,IAAM;CACf;CACA,OAAO,GAAG,EAAU,qBAAqB,EAAqB;AAChE,GAea,IAAoC,EAC/C,SACE,GACA,GACA;CACA,IAAM,EAAE,wBAAqB,WAAQ,eAAY,GAE3C,EAAE,MAAM,GAAmB,OAAO,MACtC,EACE,GACA,EAAE,WAAW,SAAS,CACxB;CACF,QAAgB;EACd,AAAI,MACF,EAAa,CAAiB,GAC9B,GACG,EAAkB,mBAAmB,GAAW,SAAS,CAC5D;CAEJ,GAAG,CAAC,CAAiB,CAAC;CAEtB,IAAM,CAAC,GAAwB,KAA6B,EAE1D,IAAI,GACA,CAAC,GAAuB,KAA4B,EAExD,IAAI,GAEA,CAAC,GAAW,KAChB,EAA6C,IAAI,GAC7C,CAAC,GAAsB,KAA2B,EAAiB,EAAE,GAErE,IAAmC,QAAc;EACrD,IAAI,GAAW,yBAOb,OAAO;GALL,cAAc,EAAU;GACxB,qBACE,EAAwB;GAC1B,mBAAmB,EAAU,GAAG,SAAS;EAEpC;CAGX,GAAG,CAAC,GAAW,yBAAyB,GAAW,EAAE,CAAC,GAEhD,EACJ,MAAM,GACN,WAAW,GACX,aAAa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AAA;AAiM9B,CACF"}
|
|
1
|
+
{"version":3,"file":"SetManagedAccessRequirementFields.js","names":[],"sources":["../../../src/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.tsx"],"sourcesContent":["import {\n useGetAccessRequirements,\n useUpdateAccessRequirement,\n} from '@/synapse-queries'\nimport { DAY_IN_MS } from '@/utils/SynapseConstants'\nimport {\n Alert,\n Box,\n Checkbox,\n FormControlLabel,\n Typography,\n} from '@mui/material'\nimport { ManagedACTAccessRequirement } from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react'\nimport { SynapseSpinner } from '../LoadingScreen/LoadingScreen'\nimport {\n AccessorRequirements,\n AccessRequirementWikiInstructions,\n} from '../SetBasicAccessRequirementFields'\nimport { DataUseCertificateFields } from './DataUseCertificateFields'\nimport {\n ExpirationPeriodField,\n getValidExpirationPeriodOrErrorMessage,\n} from './ExpirationPeriodField'\n\nexport type SetManagedAccessRequirementFieldsHandle = {\n /* Allow the parent component to trigger saving the AR, so this may be embedded in an arbitrary modal. */\n save: () => void\n}\n\nexport type SetManagedAccessRequirementFieldsProps = {\n accessRequirementId: string\n /* Called when AR has been saved successfully */\n onSave: () => void\n /* Called when error saving AR */\n onError: () => void\n}\n\nexport const SetManagedAccessRequirementFields = forwardRef(\n function SetManagedAccessRequirementFields(\n props: SetManagedAccessRequirementFieldsProps,\n ref: ForwardedRef<SetManagedAccessRequirementFieldsHandle>,\n ) {\n const { accessRequirementId, onSave, onError } = props\n\n const { data: accessRequirement, error: getArError } =\n useGetAccessRequirements<ManagedACTAccessRequirement>(\n accessRequirementId,\n { staleTime: Infinity },\n )\n useEffect(() => {\n if (accessRequirement) {\n setUpdatedAr(accessRequirement)\n setExpirationPeriodDays(\n (accessRequirement.expirationPeriod / DAY_IN_MS).toString(),\n )\n }\n }, [accessRequirement])\n\n const [expirationPeriodError, setExpirationPeriodError] = useState<\n string | null\n >(null)\n\n const [updatedAr, setUpdatedAr] =\n useState<ManagedACTAccessRequirement | null>(null)\n const [expirationPeriodDays, setExpirationPeriodDays] = useState<string>('')\n\n const {\n mutate: updateAccessRequirement,\n isPending: isUpdatingAccessRequirement,\n error: updateArError,\n } = useUpdateAccessRequirement<ManagedACTAccessRequirement>({\n onSuccess: () => onSave(),\n onError: () => onError(),\n })\n\n useImperativeHandle(ref, () => {\n return {\n save() {\n if (updatedAr) {\n const expirationPeriodOrErrorMessage =\n getValidExpirationPeriodOrErrorMessage(expirationPeriodDays)\n if (typeof expirationPeriodOrErrorMessage === 'string') {\n setExpirationPeriodError(expirationPeriodOrErrorMessage)\n onError()\n } else {\n updateAccessRequirement({\n ...updatedAr,\n expirationPeriod: expirationPeriodOrErrorMessage,\n })\n }\n }\n },\n }\n }, [expirationPeriodDays, updatedAr, updateAccessRequirement, onError])\n\n if (!updatedAr) {\n if (getArError) {\n return <Alert severity=\"error\">{getArError.reason}</Alert>\n } else {\n return <SynapseSpinner />\n }\n }\n\n return (\n <>\n <AccessRequirementWikiInstructions accessRequirement={updatedAr} />\n <Box>\n <Typography\n sx={{\n bgcolor: '#f5f5f5',\n borderBottom: '1px solid #ddd',\n color: '#333',\n px: 2,\n py: 1,\n }}\n >\n Data Access Request Parameters\n </Typography>\n <Box\n sx={{\n mt: 2,\n mb: 4,\n }}\n >\n <AccessorRequirements\n accessRequirement={updatedAr}\n onChange={updatedAr =>\n setUpdatedAr(updatedAr as ManagedACTAccessRequirement)\n }\n />\n <Box\n sx={{\n mb: 2,\n }}\n >\n <DataUseCertificateFields\n accessRequirement={updatedAr}\n isLoading={isUpdatingAccessRequirement}\n onChange={changes => setUpdatedAr({ ...updatedAr, ...changes })}\n />\n <FormControlLabel\n label=\"IRB approval is required.\"\n checked={updatedAr.isIRBApprovalRequired}\n control={<Checkbox />}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n isIRBApprovalRequired: checked,\n })\n }\n sx={{ ml: 0 }}\n />\n <FormControlLabel\n control={<Checkbox />}\n label=\"Other documents are required.\"\n checked={updatedAr.areOtherAttachmentsRequired}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n areOtherAttachmentsRequired: checked,\n })\n }\n />\n <ExpirationPeriodField\n days={expirationPeriodDays}\n error={expirationPeriodError}\n onChange={days => {\n setExpirationPeriodError(null)\n setExpirationPeriodDays(days)\n }}\n onBlur={() => {\n const expirationPeriodOrErrorMessage =\n getValidExpirationPeriodOrErrorMessage(expirationPeriodDays)\n if (typeof expirationPeriodOrErrorMessage === 'string') {\n setExpirationPeriodError(expirationPeriodOrErrorMessage)\n }\n }}\n />\n <Box\n sx={{\n mt: 1,\n }}\n >\n <FormControlLabel\n control={<Checkbox />}\n label=\"Intended Data Use statement is required.\"\n checked={updatedAr.isIDURequired}\n onChange={(_event, checked: boolean) => {\n if (checked) {\n setUpdatedAr({\n ...updatedAr,\n isIDURequired: true,\n })\n } else {\n setUpdatedAr({\n ...updatedAr,\n isIDURequired: false,\n isIDUPublic: false,\n })\n }\n }}\n />\n <FormControlLabel\n control={<Checkbox />}\n label=\"Intended Data Use statements will be publicly available.\"\n checked={updatedAr.isIDUPublic}\n disabled={!updatedAr.isIDURequired}\n onChange={(_event, checked: boolean) =>\n setUpdatedAr({\n ...updatedAr,\n isIDUPublic: checked,\n })\n }\n />\n </Box>\n </Box>\n </Box>\n </Box>\n {updateArError && (\n <Alert severity=\"error\" sx={{ marginTop: 2 }}>\n {updateArError.reason}\n </Alert>\n )}\n </>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;AA4CA,IAAa,IAAoC,EAC/C,SACE,GACA,GACA;CACA,IAAM,EAAE,wBAAqB,WAAQ,eAAY,GAE3C,EAAE,MAAM,GAAmB,OAAO,MACtC,EACE,GACA,EAAE,WAAW,SAAS,CACxB;CACF,QAAgB;EACd,AAAI,MACF,EAAa,CAAiB,GAC9B,GACG,EAAkB,mBAAmB,GAAW,SAAS,CAC5D;CAEJ,GAAG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C,GAAD;MACE,SAAS,kBAAC,GAAD,CAAW,CAAA;MACpB,OAAM;MACN,SAAS,EAAU;MACnB,WAAW,GAAQ,MACjB,EAAa;OACX,GAAG;OACH,6BAA6B;MAC/B,CAAC;KAEJ,CAAA;KACD,kBAAC,GAAD;MACE,MAAM;MACN,OAAO;MACP,WAAU,MAAQ;OAEhB,AADA,EAAyB,IAAI,GAC7B,EAAwB,CAAI;MAC9B;MACA,cAAc;OACZ,IAAM,IACJ,EAAuC,CAAoB;OAC7D,AAAI,OAAO,KAAmC,YAC5C,EAAyB,CAA8B;MAE3D;KACD,CAAA;KACD,kBAAC,GAAD;MACE,IAAI,EACF,IAAI,EACN;gBAHF,CAKE,kBAAC,GAAD;OACE,SAAS,kBAAC,GAAD,CAAW,CAAA;OACpB,OAAM;OACN,SAAS,EAAU;OACnB,WAAW,GAAQ,MAAqB;QACtC,AACE,EADE,IACW;SACX,GAAG;SACH,eAAe;QACjB,IAEa;SACX,GAAG;SACH,eAAe;SACf,aAAa;QACf,CAAC;OAEL;MACD,CAAA,GACD,kBAAC,GAAD;OACE,SAAS,kBAAC,GAAD,CAAW,CAAA;OACpB,OAAM;OACN,SAAS,EAAU;OACnB,UAAU,CAAC,EAAU;OACrB,WAAW,GAAQ,MACjB,EAAa;QACX,GAAG;QACH,aAAa;OACf,CAAC;MAEJ,CAAA,CACE;;IACF;KACF;IACF,EAAA,CAAA;EACJ,KACC,kBAAC,GAAD;GAAO,UAAS;GAAQ,IAAI,EAAE,WAAW,EAAE;aACxC,EAAc;EACV,CAAA;CAET,EAAA,CAAA,IA/HE,IACK,kBAAC,GAAD;EAAO,UAAS;YAAS,EAAW;CAAc,CAAA,IAElD,kBAAC,GAAD,CAAiB,CAAA;AA8H9B,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TanStackTableUtils.d.ts","sourceRoot":"","sources":["../../../src/components/TanStackTable/TanStackTableUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"TanStackTableUtils.d.ts","sourceRoot":"","sources":["../../../src/components/TanStackTable/TanStackTableUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAcrC,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,UAExD;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,UAExD;AAID,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAsBzE"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
//#region src/components/TanStackTable/TanStackTableUtils.ts
|
|
2
2
|
function e(e) {
|
|
3
|
-
return
|
|
3
|
+
return e.replace(/[^A-Za-z0-9-]/g, (e) => `_${e.charCodeAt(0).toString(16)}_`);
|
|
4
4
|
}
|
|
5
|
-
function t(
|
|
6
|
-
return `--
|
|
5
|
+
function t(t) {
|
|
6
|
+
return `--col-${e(t)}-size`;
|
|
7
7
|
}
|
|
8
|
-
function n(
|
|
8
|
+
function n(t) {
|
|
9
|
+
return `--header-${e(t)}-size`;
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
9
12
|
let t = e.getIsPinned(), n = t === "left" && e.getIsLastColumn("left"), r = t === "right" && e.getIsFirstColumn("right");
|
|
10
13
|
return t ? {
|
|
11
14
|
background: "inherit",
|
|
@@ -19,6 +22,6 @@ function n(e) {
|
|
|
19
22
|
} : {};
|
|
20
23
|
}
|
|
21
24
|
//#endregion
|
|
22
|
-
export {
|
|
25
|
+
export { t as getColumnSizeCssVariable, r as getCommonPinningStyles, n as getHeaderSizeCssVariable };
|
|
23
26
|
|
|
24
27
|
//# sourceMappingURL=TanStackTableUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TanStackTableUtils.js","names":[],"sources":["../../../src/components/TanStackTable/TanStackTableUtils.ts"],"sourcesContent":["import { Column } from '@tanstack/react-table'\nimport { CSSProperties } from 'react'\n\nexport function getColumnSizeCssVariable(columnId: string) {\n return `--col-${columnId}-size`\n}\n\nexport function getHeaderSizeCssVariable(headerId: string) {\n return `--header-${headerId}-size`\n}\n\n// Styles for column pinning, retrieved from TanStack docs examples with very minor modifications\n// See https://tanstack.com/table/v8/docs/framework/react/examples/column-pinning-sticky\nexport function getCommonPinningStyles(column: Column<any>): CSSProperties {\n const isPinned = column.getIsPinned()\n const isLastLeftPinnedColumn =\n isPinned === 'left' && column.getIsLastColumn('left')\n const isFirstRightPinnedColumn =\n isPinned === 'right' && column.getIsFirstColumn('right')\n\n if (!isPinned) return {}\n return {\n background: 'inherit',\n boxShadow: isLastLeftPinnedColumn\n ? '-4px 0 4px -4px gray inset'\n : isFirstRightPinnedColumn\n ? '4px 0 4px -4px gray inset'\n : undefined,\n left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,\n right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,\n opacity: 0.95,\n position: 'sticky',\n width: column.getSize(),\n zIndex: 1,\n }\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"TanStackTableUtils.js","names":[],"sources":["../../../src/components/TanStackTable/TanStackTableUtils.ts"],"sourcesContent":["import { Column } from '@tanstack/react-table'\nimport { CSSProperties } from 'react'\n\n/**\n * Column IDs are arbitrary strings (e.g. Synapse column names may contain spaces or periods), but a custom property\n * name referenced in `var()` must be a valid CSS identifier. Characters outside [A-Za-z0-9-] are hex-encoded between\n * underscores, so the encoding is valid and distinct IDs never map to the same name.\n */\nfunction toCssIdentifierSafeString(id: string) {\n return id.replace(\n /[^A-Za-z0-9-]/g,\n char => `_${char.charCodeAt(0).toString(16)}_`,\n )\n}\n\nexport function getColumnSizeCssVariable(columnId: string) {\n return `--col-${toCssIdentifierSafeString(columnId)}-size`\n}\n\nexport function getHeaderSizeCssVariable(headerId: string) {\n return `--header-${toCssIdentifierSafeString(headerId)}-size`\n}\n\n// Styles for column pinning, retrieved from TanStack docs examples with very minor modifications\n// See https://tanstack.com/table/v8/docs/framework/react/examples/column-pinning-sticky\nexport function getCommonPinningStyles(column: Column<any>): CSSProperties {\n const isPinned = column.getIsPinned()\n const isLastLeftPinnedColumn =\n isPinned === 'left' && column.getIsLastColumn('left')\n const isFirstRightPinnedColumn =\n isPinned === 'right' && column.getIsFirstColumn('right')\n\n if (!isPinned) return {}\n return {\n background: 'inherit',\n boxShadow: isLastLeftPinnedColumn\n ? '-4px 0 4px -4px gray inset'\n : isFirstRightPinnedColumn\n ? '4px 0 4px -4px gray inset'\n : undefined,\n left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,\n right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,\n opacity: 0.95,\n position: 'sticky',\n width: column.getSize(),\n zIndex: 1,\n }\n}\n"],"mappings":";AAQA,SAAS,EAA0B,GAAY;CAC7C,OAAO,EAAG,QACR,mBACA,MAAQ,IAAI,EAAK,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,EAC9C;AACF;AAEA,SAAgB,EAAyB,GAAkB;CACzD,OAAO,SAAS,EAA0B,CAAQ,EAAE;AACtD;AAEA,SAAgB,EAAyB,GAAkB;CACzD,OAAO,YAAY,EAA0B,CAAQ,EAAE;AACzD;AAIA,SAAgB,EAAuB,GAAoC;CACzE,IAAM,IAAW,EAAO,YAAY,GAC9B,IACJ,MAAa,UAAU,EAAO,gBAAgB,MAAM,GAChD,IACJ,MAAa,WAAW,EAAO,iBAAiB,OAAO;CAGzD,OADK,IACE;EACL,YAAY;EACZ,WAAW,IACP,+BACA,IACE,8BACA,KAAA;EACN,MAAM,MAAa,SAAS,GAAG,EAAO,SAAS,MAAM,EAAE,MAAM,KAAA;EAC7D,OAAO,MAAa,UAAU,GAAG,EAAO,SAAS,OAAO,EAAE,MAAM,KAAA;EAChE,SAAS;EACT,UAAU;EACV,OAAO,EAAO,QAAQ;EACtB,QAAQ;CACV,IAdsB,CAAC;AAezB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataAccessSubmissionFileHandleLink.d.ts","sourceRoot":"","sources":["../../../../src/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.tsx"],"names":[],"mappings":"AAIA,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB,2CAkBA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FileHandleLink as e } from "../../widgets/FileHandleLink.js";
|
|
2
|
+
import { useMemo as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { FileHandleAssociateType as r } from "@sage-bionetworks/synapse-types";
|
|
5
|
+
//#region src/components/dataaccess/SubmissionPage/DataAccessSubmissionFileHandleLink.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { submissionId: a, fileHandleId: o } = i;
|
|
8
|
+
return /* @__PURE__ */ n(e, {
|
|
9
|
+
showDownloadIcon: !0,
|
|
10
|
+
fileHandleAssociation: t(() => ({
|
|
11
|
+
fileHandleId: o,
|
|
12
|
+
associateObjectId: a,
|
|
13
|
+
associateObjectType: r.DataAccessSubmissionAttachment
|
|
14
|
+
}), [o, a])
|
|
15
|
+
}, o);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { i as DataAccessSubmissionFileHandleLink };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=DataAccessSubmissionFileHandleLink.js.map
|