synapse-react-client 2.1.4 → 2.1.8

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 (31) hide show
  1. package/dist/containers/CardContainerLogic.d.ts +1 -0
  2. package/dist/containers/CardContainerLogic.js.map +1 -1
  3. package/dist/containers/FullWidthAlert.d.ts +13 -5
  4. package/dist/containers/FullWidthAlert.js +28 -14
  5. package/dist/containers/FullWidthAlert.js.map +1 -1
  6. package/dist/containers/GenericCard.js +15 -2
  7. package/dist/containers/GenericCard.js.map +1 -1
  8. package/dist/containers/ToastMessage.d.ts +3 -4
  9. package/dist/containers/ToastMessage.js +20 -27
  10. package/dist/containers/ToastMessage.js.map +1 -1
  11. package/dist/containers/download_list/DownloadConfirmation.js +9 -5
  12. package/dist/containers/download_list/DownloadConfirmation.js.map +1 -1
  13. package/dist/containers/download_list_v2/DownloadCartPage.js +3 -2
  14. package/dist/containers/download_list_v2/DownloadCartPage.js.map +1 -1
  15. package/dist/containers/table/datasets/DatasetItemsEditor.js +38 -8
  16. package/dist/containers/table/datasets/DatasetItemsEditor.js.map +1 -1
  17. package/dist/index.d.ts +2 -4
  18. package/dist/style/abstracts/_mixins.scss +14 -11
  19. package/dist/style/bootstrap4_backports/_base-import.scss +19 -0
  20. package/dist/style/components/_cards.scss +1 -0
  21. package/dist/style/main.css +120 -31
  22. package/dist/umd/synapse-react-client.development.css +122 -31
  23. package/dist/umd/synapse-react-client.development.css.map +2 -2
  24. package/dist/umd/synapse-react-client.development.js +114 -73
  25. package/dist/umd/synapse-react-client.development.js.map +3 -3
  26. package/dist/umd/synapse-react-client.production.min.css +1 -1
  27. package/dist/umd/synapse-react-client.production.min.js +61 -61
  28. package/dist/umd.index.d.ts +5 -4
  29. package/dist/umd.index.js +2 -0
  30. package/dist/umd.index.js.map +1 -1
  31. package/package.json +1 -1
@@ -40298,7 +40298,14 @@ var SRC = (() => {
40298
40298
  };
40299
40299
  var Typography_default2 = Typography3;
40300
40300
 
40301
+ // src/lib/utils/functions/TooltipUtils.ts
40302
+ var rebuildTooltip = debounce_default(() => index_es_default.rebuild(), 200, {
40303
+ leading: false,
40304
+ trailing: true
40305
+ });
40306
+
40301
40307
  // src/lib/containers/FullWidthAlert.tsx
40308
+ var FULL_WIDTH_ALERT_TOOLTIP_ID = "FullWidthAlertTooltip";
40302
40309
  function getIcon(variant) {
40303
40310
  switch (variant) {
40304
40311
  case "warning":
@@ -40325,14 +40332,36 @@ var SRC = (() => {
40325
40332
  return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null);
40326
40333
  }
40327
40334
  }
40335
+ function ButtonFromConfig(props) {
40336
+ const { config: config2, variant, className } = props;
40337
+ if (config2 && ("onClick" in config2 || "href" in config2)) {
40338
+ return /* @__PURE__ */ import_react12.default.createElement("span", {
40339
+ "data-tip": config2.tooltipText,
40340
+ "data-for": FULL_WIDTH_ALERT_TOOLTIP_ID,
40341
+ "data-tip-disable": false
40342
+ }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap.Button, {
40343
+ variant,
40344
+ className,
40345
+ disabled: config2.isDisabled,
40346
+ onClick: (e3) => {
40347
+ if ("onClick" in config2) {
40348
+ e3.preventDefault();
40349
+ config2.onClick(e3);
40350
+ } else if ("href" in config2) {
40351
+ e3.preventDefault();
40352
+ window.open(config2.href, "_blank", "noopener");
40353
+ }
40354
+ }
40355
+ }, config2.text));
40356
+ }
40357
+ return null;
40358
+ }
40328
40359
  function FullWidthAlert(props) {
40329
40360
  const {
40330
40361
  title,
40331
40362
  description,
40332
- secondaryButtonText,
40333
- onSecondaryButtonClickOrHref,
40334
- primaryButtonText,
40335
- onPrimaryButtonClick,
40363
+ primaryButtonConfig,
40364
+ secondaryButtonConfig,
40336
40365
  show,
40337
40366
  onClose,
40338
40367
  autoCloseAfterDelayInSeconds,
@@ -40341,7 +40370,10 @@ var SRC = (() => {
40341
40370
  isGlobal = true
40342
40371
  } = props;
40343
40372
  const iconContent = getIcon(variant);
40344
- const hasActions = primaryButtonText && onPrimaryButtonClick || secondaryButtonText && onSecondaryButtonClickOrHref;
40373
+ const hasActions = primaryButtonConfig || secondaryButtonConfig;
40374
+ (0, import_react12.useEffect)(() => {
40375
+ rebuildTooltip();
40376
+ }, [primaryButtonConfig, secondaryButtonConfig]);
40345
40377
  (0, import_react12.useEffect)(() => {
40346
40378
  let timer;
40347
40379
  if (onClose && autoCloseAfterDelayInSeconds) {
@@ -40360,7 +40392,11 @@ var SRC = (() => {
40360
40392
  dismissible: false,
40361
40393
  transition: transition2,
40362
40394
  className: `FullWidthAlert bootstrap-4-backport ${isGlobal ? "global" : ""} ${additionalAlertVariantClass}`
40363
- }, /* @__PURE__ */ import_react12.default.createElement("div", {
40395
+ }, /* @__PURE__ */ import_react12.default.createElement(index_es_default, {
40396
+ id: FULL_WIDTH_ALERT_TOOLTIP_ID,
40397
+ delayShow: 300,
40398
+ effect: "solid"
40399
+ }), /* @__PURE__ */ import_react12.default.createElement("div", {
40364
40400
  className: `gridContainer ${hasActions ? "" : "noActions"} ${onClose ? "hasCloseButton" : ""}`
40365
40401
  }, /* @__PURE__ */ import_react12.default.createElement("span", {
40366
40402
  className: "iconArea"
@@ -40370,20 +40406,15 @@ var SRC = (() => {
40370
40406
  variant: "headline3"
40371
40407
  }, title), /* @__PURE__ */ import_react12.default.createElement(Typography_default2, {
40372
40408
  variant: "body1"
40373
- }, description)), secondaryButtonText && onSecondaryButtonClickOrHref && /* @__PURE__ */ import_react12.default.createElement("a", {
40374
- className: "secondaryButton",
40375
- target: "_blank",
40376
- rel: "noopener noreferrer",
40377
- onClick: typeof onSecondaryButtonClickOrHref === "function" ? (e3) => {
40378
- e3.preventDefault();
40379
- onSecondaryButtonClickOrHref();
40380
- } : void 0,
40381
- href: typeof onSecondaryButtonClickOrHref === "string" ? onSecondaryButtonClickOrHref : "#"
40382
- }, " ", secondaryButtonText), primaryButtonText && onPrimaryButtonClick && /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap.Button, {
40383
- className: "primaryButton",
40409
+ }, description)), /* @__PURE__ */ import_react12.default.createElement(ButtonFromConfig, {
40410
+ config: secondaryButtonConfig,
40411
+ variant: "tertiary",
40412
+ className: "secondaryButton"
40413
+ }), /* @__PURE__ */ import_react12.default.createElement(ButtonFromConfig, {
40414
+ config: primaryButtonConfig,
40384
40415
  variant: "secondary",
40385
- onClick: onPrimaryButtonClick
40386
- }, primaryButtonText), onClose && /* @__PURE__ */ import_react12.default.createElement("button", {
40416
+ className: "primaryButton"
40417
+ }), onClose && /* @__PURE__ */ import_react12.default.createElement("button", {
40387
40418
  className: "closeAlert",
40388
40419
  onClick: onClose
40389
40420
  }, /* @__PURE__ */ import_react12.default.createElement(Clear_default, {
@@ -40423,32 +40454,24 @@ var SRC = (() => {
40423
40454
  };
40424
40455
  const {
40425
40456
  title = void 0,
40426
- primaryButtonText = void 0,
40427
- secondaryButtonText = void 0,
40457
+ primaryButtonConfig = void 0,
40458
+ secondaryButtonConfig = void 0,
40428
40459
  dismissOnPrimaryButtonClick = false,
40429
40460
  dismissOnSecondaryButtonClick = false
40430
40461
  } = toastMessageOptions;
40431
- let onPrimaryButtonClick;
40432
- if (toastMessageOptions.onPrimaryButtonClick) {
40433
- if (dismissOnPrimaryButtonClick) {
40434
- onPrimaryButtonClick = () => {
40435
- toastMessageOptions.onPrimaryButtonClick();
40436
- onClose();
40437
- };
40438
- } else {
40439
- onPrimaryButtonClick = toastMessageOptions.onPrimaryButtonClick;
40440
- }
40462
+ if (primaryButtonConfig && "onClick" in primaryButtonConfig && dismissOnPrimaryButtonClick) {
40463
+ const onClick = primaryButtonConfig.onClick;
40464
+ primaryButtonConfig.onClick = (e3) => {
40465
+ onClick(e3);
40466
+ onClose();
40467
+ };
40441
40468
  }
40442
- let onSecondaryButtonClickOrHref;
40443
- if (toastMessageOptions.onSecondaryButtonClickOrHref) {
40444
- if (dismissOnSecondaryButtonClick && typeof toastMessageOptions.onSecondaryButtonClickOrHref === "function") {
40445
- onSecondaryButtonClickOrHref = () => {
40446
- toastMessageOptions.onSecondaryButtonClickOrHref();
40447
- onClose();
40448
- };
40449
- } else {
40450
- onSecondaryButtonClickOrHref = toastMessageOptions.onSecondaryButtonClickOrHref;
40451
- }
40469
+ if (secondaryButtonConfig && "onClick" in secondaryButtonConfig && dismissOnSecondaryButtonClick) {
40470
+ const onClick = secondaryButtonConfig.onClick;
40471
+ secondaryButtonConfig.onClick = (e3) => {
40472
+ onClick(e3);
40473
+ onClose();
40474
+ };
40452
40475
  }
40453
40476
  let { autoCloseInMs = 15e3 } = toastMessageOptions;
40454
40477
  if (autoCloseInMs === 0) {
@@ -40461,10 +40484,8 @@ var SRC = (() => {
40461
40484
  show: true,
40462
40485
  title,
40463
40486
  description: message,
40464
- primaryButtonText,
40465
- onPrimaryButtonClick,
40466
- secondaryButtonText,
40467
- onSecondaryButtonClickOrHref
40487
+ primaryButtonConfig,
40488
+ secondaryButtonConfig
40468
40489
  }), {
40469
40490
  id: id2,
40470
40491
  className: "SynapseToastMessage",
@@ -58283,8 +58304,16 @@ filepath = ${entityId}.path`;
58283
58304
  className: "pageHeaderTitle"
58284
58305
  }, "Your Download Cart"), /* @__PURE__ */ React237.createElement("a", {
58285
58306
  className: "clearDownloadListLink",
58286
- onClick: clearDownloadList
58287
- }, /* @__PURE__ */ React237.createElement("span", null, /* @__PURE__ */ React237.createElement(IconSvg_default, {
58307
+ onClick: clearDownloadList,
58308
+ "data-tip": "Immediately removes all items from your download list",
58309
+ "data-for": "clearDownloadListTooltip"
58310
+ }, /* @__PURE__ */ React237.createElement(index_es_default, {
58311
+ delayShow: 300,
58312
+ place: "right",
58313
+ type: "dark",
58314
+ effect: "solid",
58315
+ id: "clearDownloadListTooltip"
58316
+ }), /* @__PURE__ */ React237.createElement("span", null, /* @__PURE__ */ React237.createElement(IconSvg_default, {
58288
58317
  options: {
58289
58318
  icon: "delete",
58290
58319
  padding: "right"
@@ -58365,7 +58394,7 @@ filepath = ${entityId}.path`;
58365
58394
  }, /* @__PURE__ */ React237.createElement(IconSvg_default, {
58366
58395
  options: { icon: "code" }
58367
58396
  }), " Programmatic Download"), /* @__PURE__ */ React237.createElement(HelpPopover, {
58368
- markdownText: "This will provide syntax which you can enter into your programmatic client. It is suitable for large files (>100 MB), for packages > 1GB, and for files which aren\u2019t stored on Synapse native storage (e.g. in a special AWS S3 or Google Cloud bucket. External links will require navigation to an external site, which may require a separate login process."
58397
+ markdownText: "This will provide syntax which you can enter into your programmatic client. It is suitable for large files (>100 MB), for packages > 1GB, and for files which aren\u2019t stored on Synapse native storage (e.g. in a special AWS S3 or Google Cloud bucket). External links will require navigation to an external site, which may require a separate login process."
58369
58398
  })), /* @__PURE__ */ React237.createElement(Typography_default2, {
58370
58399
  variant: "body1"
58371
58400
  }, /* @__PURE__ */ React237.createElement("ul", null, /* @__PURE__ */ React237.createElement("li", null, "Requires installation of a programmatic client (R, Python, CLI)"), /* @__PURE__ */ React237.createElement("li", null, "No limit to the file size or number of files that can be downloaded"), /* @__PURE__ */ React237.createElement("li", null, "Will include files which are hosted on and off Synapse native storage"), /* @__PURE__ */ React237.createElement("li", null, "Packages include a CSV Manifest containing Metadata for each file"))), /* @__PURE__ */ React237.createElement("span", null, /* @__PURE__ */ React237.createElement("a", {
@@ -80634,12 +80663,6 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
80634
80663
  var import_react208 = __toModule(require_react());
80635
80664
  var import_react_bootstrap52 = __toModule(require_react_bootstrap());
80636
80665
 
80637
- // src/lib/utils/functions/TooltipUtils.ts
80638
- var rebuildTooltip = debounce_default(() => index_es_default.rebuild(), 200, {
80639
- leading: false,
80640
- trailing: true
80641
- });
80642
-
80643
80666
  // src/lib/containers/EntityLink.tsx
80644
80667
  var import_react207 = __toModule(require_react());
80645
80668
  var EntityLink = (props) => {
@@ -82808,8 +82831,10 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82808
82831
  };
82809
82832
  yield SynapseClient_exports.addFilesToDownloadListV2(req, token2);
82810
82833
  displayToast("File(s) were successfully added to your Download List.", "success", {
82811
- primaryButtonText: "View Download List",
82812
- onPrimaryButtonClick: goToDownloadListFn
82834
+ primaryButtonConfig: {
82835
+ text: "View Download List",
82836
+ onClick: goToDownloadListFn
82837
+ }
82813
82838
  });
82814
82839
  closeConfirmationFn();
82815
82840
  return [0 /* LOADING_INFO */, ""];
@@ -82859,9 +82884,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82859
82884
  fileCount: 0,
82860
82885
  fileSize: 0
82861
82886
  });
82862
- const {
82863
- refetch
82864
- } = useGetDownloadListStatistics();
82887
+ const { refetch } = useGetDownloadListStatistics();
82865
82888
  const lastQueryRequest = getLastQueryRequest();
82866
82889
  const [showDownloadList, setShowDownloadList] = (0, import_react224.useState)(false);
82867
82890
  const updateStats = (0, import_react224.useCallback)((count2, bytes) => __async(void 0, null, function* () {
@@ -82879,10 +82902,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82879
82902
  });
82880
82903
  }
82881
82904
  }), [accessToken]);
82882
- const {
82883
- data: entityChildrenData,
82884
- isSuccess
82885
- } = useGetEntityChildren({
82905
+ const { data: entityChildrenData, isSuccess } = useGetEntityChildren({
82886
82906
  parentId: folderId,
82887
82907
  includeSumFileSizes: true,
82888
82908
  includeTotalChildCount: true,
@@ -82924,7 +82944,11 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
82924
82944
  setState(__spreadProps(__spreadValues({}, state), { errorMessage: result[1] }));
82925
82945
  }
82926
82946
  });
82927
- const getContent = ({ fileCount, fileSize, errorMessage }) => {
82947
+ const getContent = ({
82948
+ fileCount,
82949
+ fileSize,
82950
+ errorMessage
82951
+ }) => {
82928
82952
  switch (status) {
82929
82953
  case 0 /* LOADING_INFO */:
82930
82954
  case 1 /* PROCESSING */:
@@ -83439,6 +83463,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83439
83463
  // src/lib/containers/table/datasets/DatasetItemsEditor.tsx
83440
83464
  var ROW_HEIGHT2 = 42;
83441
83465
  var TABLE_HEIGHT = 350;
83466
+ var SAVE_THE_DATASET_TO_CONTINUE = "Save the Dataset to continue.";
83442
83467
  function DatasetItemsEditor(props) {
83443
83468
  const { entityId, onSave, onClose } = props;
83444
83469
  const [showEntityFinder, setShowEntityFinder] = (0, import_react234.useState)(false);
@@ -83468,17 +83493,17 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83468
83493
  });
83469
83494
  const mutation = useUpdateEntity({
83470
83495
  onSuccess: () => {
83471
- displayToast("Create a Version of this Dataset to freeze it in its current state", "success", { title: "Dataset Saved" });
83472
83496
  if (onSave) {
83473
83497
  onSave();
83498
+ } else {
83499
+ displayToast("Create a Version of this Dataset to freeze it in its current state", "success", { title: "Dataset Saved" });
83474
83500
  }
83475
83501
  },
83476
83502
  onError: (error) => {
83477
83503
  if (error.status === 412) {
83478
83504
  displayToast("Re-retrieve the dataset to get the latest changes. Your current changes will be lost.", "warning", {
83479
83505
  title: "Dataset Updated since Last Fetched",
83480
- primaryButtonText: "Retrieve Dataset",
83481
- onPrimaryButtonClick: refetch
83506
+ primaryButtonConfig: { text: "Retrieve Dataset", onClick: refetch }
83482
83507
  });
83483
83508
  } else {
83484
83509
  displayToast(error.reason, "danger", {
@@ -83495,15 +83520,27 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83495
83520
  }
83496
83521
  });
83497
83522
  });
83498
- function addItemsToDataset(newItems) {
83523
+ function addItemsToDataset(itemsToAdd) {
83499
83524
  setDatasetToUpdate((datasetToUpdate2) => {
83500
83525
  if (datasetToUpdate2) {
83501
- const existingItems = datasetToUpdate2.items.filter((item) => !newItems.find((newItem) => newItem.targetId === item.entityId));
83502
- if (existingItems.length < datasetToUpdate2.items.length) {
83503
- displayToast("Files were added that were already in the dataset. The versions of those files might have been updated.", "info");
83526
+ const unchangedItems = datasetToUpdate2.items.filter((item) => !itemsToAdd.find((newItem) => newItem.targetId === item.entityId));
83527
+ const updatedItems = itemsToAdd.filter((newItem) => datasetToUpdate2.items.find((existingItem) => existingItem.entityId === newItem.targetId));
83528
+ const newItems = itemsToAdd.filter((newItem) => !datasetToUpdate2.items.find((existingItem) => existingItem.entityId === newItem.targetId));
83529
+ let toastMessageTitle = `${newItems.length} Item${newItems.length === 1 ? "" : "s"} added`;
83530
+ if (updatedItems.length > 0) {
83531
+ toastMessageTitle += ` and ${updatedItems.length} Item${updatedItems.length === 1 ? "" : "s"} updated`;
83532
+ } else {
83533
+ toastMessageTitle += ` to Dataset`;
83504
83534
  }
83535
+ displayToast(SAVE_THE_DATASET_TO_CONTINUE, "info", {
83536
+ title: toastMessageTitle
83537
+ });
83505
83538
  const items = [
83506
- ...existingItems,
83539
+ ...unchangedItems,
83540
+ ...updatedItems.map((item) => ({
83541
+ entityId: item.targetId,
83542
+ versionNumber: item.targetVersionNumber
83543
+ })),
83507
83544
  ...newItems.map((item) => ({
83508
83545
  entityId: item.targetId,
83509
83546
  versionNumber: item.targetVersionNumber
@@ -83523,6 +83560,9 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83523
83560
  setDatasetToUpdate((dataset) => __spreadProps(__spreadValues({}, dataset), {
83524
83561
  items: dataset.items.filter((datasetItem) => !selectedIds.has(datasetItem.entityId))
83525
83562
  }));
83563
+ displayToast(SAVE_THE_DATASET_TO_CONTINUE, "info", {
83564
+ title: `${selectedIds.size} Item${selectedIds.size === 1 ? "" : "s"} removed from the Dataset`
83565
+ });
83526
83566
  clearSelectedIds();
83527
83567
  }
83528
83568
  function changeVersionOnItem(entityId2, newVersion) {
@@ -83805,7 +83845,8 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
83805
83845
  HelpPopover,
83806
83846
  ProgrammaticTableDownload: ProgrammaticTableDownload_default,
83807
83847
  DirectProgrammaticDownload: DirectProgrammaticDownload_default,
83808
- ProgrammaticInstructionsModal
83848
+ ProgrammaticInstructionsModal,
83849
+ SkeletonButton
83809
83850
  };
83810
83851
  return umd_index_exports;
83811
83852
  })();