@firedesktop/react-base 1.90.0 → 1.91.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.
@@ -1,4 +1,5 @@
1
1
  declare function FileUtils(): {
2
2
  b64toBlob: (b64Data: string, contentType?: string, sliceSize?: number) => Blob | undefined;
3
+ fileReadAsync: (file: File) => Promise<string | ArrayBuffer>;
3
4
  };
4
5
  export default FileUtils;
@@ -1,4 +1,41 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
1
37
  function FileUtils() {
38
+ var _this = this;
2
39
  var b64toBlob = function (b64Data, contentType, sliceSize) {
3
40
  if (contentType === void 0) { contentType = ''; }
4
41
  if (sliceSize === void 0) { sliceSize = 512; }
@@ -18,8 +55,19 @@ function FileUtils() {
18
55
  var blob = new Blob(byteArrays, { type: contentType });
19
56
  return blob;
20
57
  };
58
+ var fileReadAsync = function (file) { return __awaiter(_this, void 0, void 0, function () {
59
+ return __generator(this, function (_a) {
60
+ return [2, new Promise(function (resolve, reject) {
61
+ var reader = new FileReader();
62
+ reader.onload = function () { return resolve(reader.result); };
63
+ reader.onerror = function () { return reject(reader.error); };
64
+ reader.readAsText(file);
65
+ })];
66
+ });
67
+ }); };
21
68
  return {
22
- b64toBlob: b64toBlob
69
+ b64toBlob: b64toBlob,
70
+ fileReadAsync: fileReadAsync
23
71
  };
24
72
  }
25
73
  export default FileUtils;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUtils.js","sourceRoot":"","sources":["../../src/lib/utils/FileUtils.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS;IACd,IAAM,SAAS,GAAG,UAAC,OAAe,EAAE,WAAwB,EAAE,SAAuB;QAAjD,4BAAA,EAAA,gBAAwB;QAAE,0BAAA,EAAA,eAAuB;QAC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AC,CAAC;gBAC5B,CAAC,CAAC,EAAC;;SACN,CAAC;IAEF,OAAO;QACH,SAAS,WAAA;QACT,aAAa,eAAA;KAChB,CAAC;AACN,CAAC;AAED,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@firedesktop/react-base",
3
- "version": "1.90.0",
3
+ "version": "1.91.0",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "description": "This is the FireDesktop base package used to support every React Project in this Company.",
7
7
  "author": "alessandro.gambaro",
8
8
  "repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
9
9
  "dependencies": {
10
- "@syncfusion/ej2-popups": "26.2.4",
11
- "@syncfusion/ej2-react-notifications": "26.2.4"
10
+ "@syncfusion/ej2-popups": "26.2.5",
11
+ "@syncfusion/ej2-react-notifications": "26.2.5"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@babel/cli": "7.24.8",
15
- "@babel/core": "7.24.9",
15
+ "@babel/core": "7.25.2",
16
16
  "@babel/plugin-proposal-class-properties": "7.18.6",
17
17
  "@babel/plugin-transform-arrow-functions": "7.24.7",
18
18
  "@babel/preset-typescript": "7.24.7",
@@ -20,7 +20,7 @@
20
20
  "@testing-library/react": "16.0.0",
21
21
  "@testing-library/user-event": "14.5.2",
22
22
  "@types/jest": "29.5.12",
23
- "@types/node": "20.14.12",
23
+ "@types/node": "22.0.0",
24
24
  "@types/react": "18.2.79",
25
25
  "@types/react-dom": "18.3.0",
26
26
  "@types/react-redux": "7.1.33",
@@ -22,8 +22,18 @@ function FileUtils() {
22
22
  return blob;
23
23
  };
24
24
 
25
+ const fileReadAsync = async (file: File) => {
26
+ return new Promise((resolve: (value: string | ArrayBuffer | null) => void, reject: (value: DOMException | null) => void) => {
27
+ const reader = new FileReader();
28
+ reader.onload = () => resolve(reader.result);
29
+ reader.onerror = () => reject(reader.error);
30
+ reader.readAsText(file);
31
+ });
32
+ };
33
+
25
34
  return {
26
- b64toBlob
35
+ b64toBlob,
36
+ fileReadAsync
27
37
  };
28
38
  }
29
39