@sumaris-net/ngx-components 2.4.29 → 2.4.31
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/doc/changelog.md +10 -0
- package/esm2020/src/app/shared/dates.mjs +1 -1
- package/esm2020/src/app/shared/file/json.utils.mjs +19 -1
- package/esm2020/src/app/shared/pipes/duration.pipe.mjs +1 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +14 -0
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +14 -0
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/dates.d.ts +1 -1
- package/src/app/shared/file/json.utils.d.ts +5 -0
- package/src/app/shared/pipes/duration.pipe.d.ts +2 -1
|
@@ -21084,6 +21084,20 @@ class JsonUtils {
|
|
|
21084
21084
|
blob['name'] = opts.filename;
|
|
21085
21085
|
return blob;
|
|
21086
21086
|
}
|
|
21087
|
+
static parseFile(file, opts) {
|
|
21088
|
+
return FilesUtils.readAsText(file, opts?.encoding)
|
|
21089
|
+
.pipe(map(e => {
|
|
21090
|
+
if (e.type === HttpEventType.UploadProgress) {
|
|
21091
|
+
const loaded = Math.round(e.loaded * 0.8);
|
|
21092
|
+
return { ...e, loaded };
|
|
21093
|
+
}
|
|
21094
|
+
else if (e instanceof FileResponse) {
|
|
21095
|
+
const body = e.body;
|
|
21096
|
+
const data = JSON.parse(body);
|
|
21097
|
+
return new FileResponse({ body: data });
|
|
21098
|
+
}
|
|
21099
|
+
}), filter(isNotNil));
|
|
21100
|
+
}
|
|
21087
21101
|
}
|
|
21088
21102
|
|
|
21089
21103
|
/**
|