pollination-react-io 1.78.0 → 1.79.0

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.
@@ -14,6 +14,7 @@ export interface FileCardProps {
14
14
  file?: Blob | File | string | undefined;
15
15
  onClicked?: (card: FileCardProps) => any;
16
16
  isCloud?: boolean;
17
+ name?: string;
17
18
  }
18
19
  export declare const FileCard: React.FC<FileCardProps>;
19
20
  export default FileCard;
@@ -56012,14 +56012,16 @@ var FileCard = function (_a) {
56012
56012
  var _m = useState(), currFile = _m[0], setCurrFile = _m[1];
56013
56013
  // HTML integration
56014
56014
  var _o = useState(false), hasHtml = _o[0], setHasHtml = _o[1];
56015
+ // ZIP integration
56016
+ var _p = useState(), innerName = _p[0], setInnerName = _p[1];
56015
56017
  /**
56016
56018
  * Get file name to use
56017
56019
  */
56018
56020
  var filename = useMemo(function () {
56019
56021
  if (!path)
56020
56022
  return;
56021
- return path.split('/').reverse()[0];
56022
- }, [path]);
56023
+ return innerName !== null && innerName !== void 0 ? innerName : path.split('/').reverse()[0];
56024
+ }, [path, innerName]);
56023
56025
  /**
56024
56026
  * Get file from a ZIP file.
56025
56027
  * 1 zip = 1 file for now
@@ -56044,6 +56046,7 @@ var FileCard = function (_a) {
56044
56046
  var name = _a[0], f = _a[1];
56045
56047
  // 1 zip = 1 file
56046
56048
  // I assume text/plain
56049
+ setInnerName(name);
56047
56050
  var blob = f.slice(0, f.size, 'text/plain');
56048
56051
  setCurrFile(blob);
56049
56052
  if (name.endsWith('vsf')) {
@@ -56106,23 +56109,31 @@ var FileCard = function (_a) {
56106
56109
  setCADintegration(undefined);
56107
56110
  setIsLoading(false);
56108
56111
  setHasHtml(false);
56112
+ setInnerName(undefined);
56109
56113
  return;
56110
56114
  }
56111
56115
  res.blob()
56112
56116
  .then(function (blob) {
56113
- setCurrFile(blob);
56114
- // All zip files
56117
+ // File is a ZIP
56115
56118
  if (blob.type === 'application/zip') {
56116
56119
  getFileFromZip(blob);
56117
56120
  }
56118
- if (path === null || path === void 0 ? void 0 : path.endsWith('vsf')) {
56119
- setHasHtml(true);
56120
- fetchHTML(blob);
56121
- }
56122
56121
  else {
56123
- setHasHtml(false);
56122
+ setCurrFile(blob);
56123
+ setInnerName(undefined);
56124
+ if (path === null || path === void 0 ? void 0 : path.endsWith('vsf')) {
56125
+ setHasHtml(true);
56126
+ fetchHTML(blob); // HTML button
56127
+ setCADintegration(blob);
56128
+ }
56129
+ else if (path === null || path === void 0 ? void 0 : path.endsWith('hbjson')) {
56130
+ setHasHtml(false);
56131
+ setCADintegration(blob);
56132
+ }
56133
+ else {
56134
+ setHasHtml(false);
56135
+ }
56124
56136
  }
56125
- setCADintegration(blob);
56126
56137
  setIsLoading(false);
56127
56138
  setIsInactive(false);
56128
56139
  });
@@ -56171,7 +56182,7 @@ var FileCard = function (_a) {
56171
56182
  // Generate Blob on click
56172
56183
  run && downloadArtifact(path, run.status.job_id)
56173
56184
  .then(function (url) { return fetchAndSet(url); })
56174
- .catch(function () { return onClicked({ label: label, path: path, file: undefined, description: description }); });
56185
+ .catch(function () { return onClicked({ label: label, path: path, file: undefined, description: description, name: filename }); });
56175
56186
  }
56176
56187
  else {
56177
56188
  // Some inputs has path == null
@@ -56192,7 +56203,7 @@ var FileCard = function (_a) {
56192
56203
  event.stopPropagation();
56193
56204
  if (isInactive)
56194
56205
  return;
56195
- onClicked({ label: label, path: path, file: currFile, description: description });
56206
+ onClicked({ label: label, path: path, file: currFile, description: description, name: filename });
56196
56207
  } },
56197
56208
  React__default.createElement("div", { className: 'title-param' },
56198
56209
  React__default.createElement("div", { style: { float: 'left', margin: '0 8px 0 0' } }, !isLoading ? React__default.createElement("div", { title: !isInactive