@sumaris-net/ngx-components 1.20.5 → 1.20.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.
- package/bundles/sumaris-net.ngx-components.umd.js +34 -25
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +3 -0
- package/esm2015/src/app/core/icon/icon.component.js +1 -1
- package/esm2015/src/app/core/services/model/referential.model.js +2 -1
- package/esm2015/src/app/shared/file/csv.utils.js +5 -25
- package/esm2015/src/app/shared/file/file.utils.js +30 -1
- package/esm2015/src/app/shared/graph/colors.utils.js +1 -1
- package/esm2015/src/app/shared/pipes/property.pipes.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +34 -25
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/icon/icon.component.d.ts +3 -2
- package/src/app/core/services/model/referential.model.d.ts +1 -0
- package/src/app/shared/file/csv.utils.d.ts +1 -0
- package/src/app/shared/file/file.utils.d.ts +5 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/shared/colors.utils.js +0 -2
- package/src/app/shared/colors.utils.d.ts +0 -3
|
@@ -4919,7 +4919,7 @@
|
|
|
4919
4919
|
if ((_a = definition.autocomplete) === null || _a === void 0 ? void 0 : _a.displayWith) {
|
|
4920
4920
|
return definition.autocomplete.displayWith(value);
|
|
4921
4921
|
}
|
|
4922
|
-
return joinPropertiesPath(
|
|
4922
|
+
return joinPropertiesPath(value, ((_b = definition.autocomplete) === null || _b === void 0 ? void 0 : _b.attributes) || ['label', 'name']) || undefined;
|
|
4923
4923
|
}
|
|
4924
4924
|
case 'boolean':
|
|
4925
4925
|
return (obj === 1 || obj === true || obj === 'true') ? this.i18nYes : this.i18nNo;
|
|
@@ -14879,6 +14879,7 @@
|
|
|
14879
14879
|
this.entityName = source.entityName || this.entityName;
|
|
14880
14880
|
this.label = source.label;
|
|
14881
14881
|
this.name = source.name;
|
|
14882
|
+
this.description = source.description;
|
|
14882
14883
|
this.statusId = source.statusId;
|
|
14883
14884
|
this.levelId = source.levelId;
|
|
14884
14885
|
};
|
|
@@ -18353,6 +18354,34 @@
|
|
|
18353
18354
|
reader.readAsText(file, encoding);
|
|
18354
18355
|
return $progress.asObservable();
|
|
18355
18356
|
};
|
|
18357
|
+
FilesUtils.writeTextToFile = function (content, opts) {
|
|
18358
|
+
if (isNilOrBlank(content))
|
|
18359
|
+
return; // Skip if empty
|
|
18360
|
+
var filename = (opts === null || opts === void 0 ? void 0 : opts.filename) || 'export.txt';
|
|
18361
|
+
var charset = ((opts === null || opts === void 0 ? void 0 : opts.encoding) || 'utf-8').toLowerCase();
|
|
18362
|
+
var type = (opts === null || opts === void 0 ? void 0 : opts.type) || 'text/plain';
|
|
18363
|
+
var blob = new Blob((charset === 'utf-8')
|
|
18364
|
+
// Add UTF-8 BOM character
|
|
18365
|
+
? [FilesUtils.UTF8_BOM_CHAR, content]
|
|
18366
|
+
// Non UTF-8 charset
|
|
18367
|
+
: [content], { type: type + ";charset=" + charset + ";" });
|
|
18368
|
+
if (navigator.msSaveBlob) { // IE 10+
|
|
18369
|
+
navigator.msSaveBlob(blob, filename);
|
|
18370
|
+
}
|
|
18371
|
+
else {
|
|
18372
|
+
var link = document.createElement('a');
|
|
18373
|
+
if (link.download !== undefined) {
|
|
18374
|
+
// Browsers that support HTML5 download attribute
|
|
18375
|
+
var url = URL.createObjectURL(blob);
|
|
18376
|
+
link.setAttribute('href', url);
|
|
18377
|
+
link.setAttribute('download', filename);
|
|
18378
|
+
link.style.visibility = 'hidden';
|
|
18379
|
+
document.body.appendChild(link);
|
|
18380
|
+
link.click();
|
|
18381
|
+
document.body.removeChild(link);
|
|
18382
|
+
}
|
|
18383
|
+
}
|
|
18384
|
+
};
|
|
18356
18385
|
return FilesUtils;
|
|
18357
18386
|
}());
|
|
18358
18387
|
FilesUtils.UTF8_BOM_CHAR = new Uint8Array([0xEF, 0xBB, 0xBF]); // UTF-8 BOM
|
|
@@ -20878,13 +20907,12 @@
|
|
|
20878
20907
|
CsvUtils.exportToFile = function (rows, opts) {
|
|
20879
20908
|
if (!rows || !rows.length)
|
|
20880
20909
|
return; // Skip if empty
|
|
20881
|
-
|
|
20882
|
-
var charset = ((opts === null || opts === void 0 ? void 0 : opts.encoding) || 'utf-8').toLowerCase();
|
|
20910
|
+
// Create text content
|
|
20883
20911
|
var separator = (opts === null || opts === void 0 ? void 0 : opts.separator) || ',';
|
|
20884
20912
|
var protectCellRegexp = new RegExp("/(\"|" + separator + "|\n)/g");
|
|
20885
20913
|
var keys = Object.keys(rows[0]);
|
|
20886
20914
|
var headers = (opts === null || opts === void 0 ? void 0 : opts.headers) || keys;
|
|
20887
|
-
var
|
|
20915
|
+
var textContent =
|
|
20888
20916
|
// Header row
|
|
20889
20917
|
headers.join(separator) + '\n' +
|
|
20890
20918
|
// Data rows
|
|
@@ -20900,27 +20928,8 @@
|
|
|
20900
20928
|
return cellStr;
|
|
20901
20929
|
}).join(separator);
|
|
20902
20930
|
}).join('\n');
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
? [FilesUtils.UTF8_BOM_CHAR, csvContent]
|
|
20906
|
-
// Non UTF-8 charset
|
|
20907
|
-
: [csvContent], { type: "text/csv;charset=" + charset + ";" });
|
|
20908
|
-
if (navigator.msSaveBlob) { // IE 10+
|
|
20909
|
-
navigator.msSaveBlob(blob, filename);
|
|
20910
|
-
}
|
|
20911
|
-
else {
|
|
20912
|
-
var link = document.createElement('a');
|
|
20913
|
-
if (link.download !== undefined) {
|
|
20914
|
-
// Browsers that support HTML5 download attribute
|
|
20915
|
-
var url = URL.createObjectURL(blob);
|
|
20916
|
-
link.setAttribute('href', url);
|
|
20917
|
-
link.setAttribute('download', filename);
|
|
20918
|
-
link.style.visibility = 'hidden';
|
|
20919
|
-
document.body.appendChild(link);
|
|
20920
|
-
link.click();
|
|
20921
|
-
document.body.removeChild(link);
|
|
20922
|
-
}
|
|
20923
|
-
}
|
|
20931
|
+
// Write to file
|
|
20932
|
+
FilesUtils.writeTextToFile(textContent, Object.assign({ type: 'text/csv', filename: 'export.csv' }, opts));
|
|
20924
20933
|
};
|
|
20925
20934
|
CsvUtils.parseFile = function (file, opts) {
|
|
20926
20935
|
return FilesUtils.readAsText(file, opts === null || opts === void 0 ? void 0 : opts.encoding)
|