kui-utils 0.0.38 → 0.0.40

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/cjs/index.js CHANGED
@@ -2075,6 +2075,28 @@ var longPolling = function (callback, errorHandler, stopCondition, delay) { retu
2075
2075
  });
2076
2076
  }); };
2077
2077
 
2078
+ var downloadFile = function (fileUrl, fileName) { return __awaiter(void 0, void 0, void 0, function () {
2079
+ var resource, blob, url, link;
2080
+ return __generator(this, function (_a) {
2081
+ switch (_a.label) {
2082
+ case 0: return [4 /*yield*/, fetch(fileUrl)];
2083
+ case 1:
2084
+ resource = _a.sent();
2085
+ return [4 /*yield*/, resource.blob()];
2086
+ case 2:
2087
+ blob = _a.sent();
2088
+ url = URL.createObjectURL(blob);
2089
+ link = document.createElement("a");
2090
+ link.href = url;
2091
+ link.download = fileName;
2092
+ document.body.appendChild(link);
2093
+ link.click();
2094
+ document.body.removeChild(link);
2095
+ return [2 /*return*/];
2096
+ }
2097
+ });
2098
+ }); };
2099
+
2078
2100
  function cleanObjectForIndexDB(value) {
2079
2101
  if (typeof value === "undefined")
2080
2102
  return null;
@@ -2454,7 +2476,7 @@ var MultistepForm = /** @class */ (function () {
2454
2476
  _this.step += 1;
2455
2477
  };
2456
2478
  this.prevStep = function () {
2457
- if (_this.step !== 1) {
2479
+ if (_this.step !== 0) {
2458
2480
  _this.step -= 1;
2459
2481
  }
2460
2482
  else {
@@ -2555,6 +2577,7 @@ exports.cropText = cropText;
2555
2577
  exports.dateRegExp = dateRegExp;
2556
2578
  exports.declineByNumber = declineByNumber;
2557
2579
  exports.deleteCookie = deleteCookie;
2580
+ exports.downloadFile = downloadFile;
2558
2581
  exports.emailRegExp = emailRegExp;
2559
2582
  exports.formatError = formatError;
2560
2583
  exports.generateFormDataBody = generateFormDataBody;