@sumaris-net/ngx-components 1.20.6 → 1.20.9

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.
@@ -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
@@ -18982,33 +19011,34 @@
18982
19011
  // TODO: for DEV only
18983
19012
  //this.debug = !environment.production;
18984
19013
  }
19014
+ AppHelpModal.prototype.ngOnInit = function () {
19015
+ // Fix docUrl
19016
+ if (this.docUrl && !this.docUrl.endsWith('.md')) {
19017
+ console.warn('[help-modal] Missing extension \'.md\' will be add to the url: ' + this.docUrl);
19018
+ this.docUrl += '.md';
19019
+ }
19020
+ };
18985
19021
  AppHelpModal.prototype.close = function (event) {
18986
- return __awaiter(this, void 0, void 0, function () {
18987
- return __generator(this, function (_a) {
18988
- switch (_a.label) {
18989
- case 0: return [4 /*yield*/, this.viewCtrl.dismiss()];
18990
- case 1:
18991
- _a.sent();
18992
- return [2 /*return*/];
18993
- }
18994
- });
18995
- });
19022
+ return this.viewCtrl.dismiss();
18996
19023
  };
18997
19024
  AppHelpModal.prototype.markAsLoaded = function () {
18998
19025
  this.loading = false;
18999
19026
  this.error = null;
19027
+ this.cd.markForCheck();
19000
19028
  };
19001
19029
  AppHelpModal.prototype.onLoadError = function (error) {
19002
19030
  console.error(error);
19003
19031
  this.error = error;
19004
19032
  this.loading = false;
19033
+ this.cd.markForCheck();
19005
19034
  };
19006
19035
  return AppHelpModal;
19007
19036
  }());
19008
19037
  AppHelpModal.decorators = [
19009
19038
  { type: i0.Component, args: [{
19010
19039
  selector: 'app-help-modal',
19011
- template: "<app-modal-toolbar color=\"light\"\n [title]=\"title\"\n (cancel)=\"close($event)\"\n [showSpinner]=\"loading\">\n</app-modal-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <!-- error -->\n <ion-item *ngIf=\"error && showError\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"error|translate\"></ion-label>\n </ion-item>\n\n <markdown *ngIf=\"markdownContent\"\n [data]=\"markdownContent\"\n (ready)=\"markAsLoaded()\"\n emoji>\n </markdown>\n\n <markdown *ngIf=\"docUrl\"\n [src]=\"docUrl + '.md'\"\n (load)=\"markAsLoaded()\"\n (error)=\"onLoadError($event)\"\n emoji></markdown>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col></ion-col>\n <ion-col size=\"auto\">\n <ion-button fill=\"solid\" color=\"tertiary\" (click)=\"close()\">{{'COMMON.BTN_CLOSE'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n\n\n"
19040
+ template: "<app-modal-toolbar color=\"light\"\n [title]=\"title|translate\"\n (cancel)=\"close($event)\"\n [showSpinner]=\"loading\">\n</app-modal-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <!-- error -->\n <ion-item *ngIf=\"error && showError\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"error|translate\"></ion-label>\n </ion-item>\n\n <markdown *ngIf=\"markdownContent; else useDocUrl\"\n [data]=\"markdownContent\"\n (ready)=\"markAsLoaded()\"\n emoji>\n </markdown>\n\n <ng-template #useDocUrl>\n <markdown *ngIf=\"docUrl\"\n [src]=\"docUrl + '.md'\"\n (load)=\"markAsLoaded()\"\n (error)=\"onLoadError($event)\"\n emoji></markdown>\n </ng-template>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col></ion-col>\n <ion-col size=\"auto\">\n <ion-button fill=\"solid\" color=\"tertiary\" (click)=\"close()\">{{'COMMON.BTN_CLOSE'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n\n\n",
19041
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
19012
19042
  },] }
19013
19043
  ];
19014
19044
  AppHelpModal.ctorParameters = function () { return [
@@ -20878,13 +20908,12 @@
20878
20908
  CsvUtils.exportToFile = function (rows, opts) {
20879
20909
  if (!rows || !rows.length)
20880
20910
  return; // Skip if empty
20881
- var filename = (opts === null || opts === void 0 ? void 0 : opts.filename) || 'export.csv';
20882
- var charset = ((opts === null || opts === void 0 ? void 0 : opts.encoding) || 'utf-8').toLowerCase();
20911
+ // Create text content
20883
20912
  var separator = (opts === null || opts === void 0 ? void 0 : opts.separator) || ',';
20884
20913
  var protectCellRegexp = new RegExp("/(\"|" + separator + "|\n)/g");
20885
20914
  var keys = Object.keys(rows[0]);
20886
20915
  var headers = (opts === null || opts === void 0 ? void 0 : opts.headers) || keys;
20887
- var csvContent =
20916
+ var textContent =
20888
20917
  // Header row
20889
20918
  headers.join(separator) + '\n' +
20890
20919
  // Data rows
@@ -20900,27 +20929,8 @@
20900
20929
  return cellStr;
20901
20930
  }).join(separator);
20902
20931
  }).join('\n');
20903
- var blob = new Blob((charset === 'utf-8')
20904
- // Add UTF-8 BOM character
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
- }
20932
+ // Write to file
20933
+ FilesUtils.writeTextToFile(textContent, Object.assign({ type: 'text/csv', filename: 'export.csv' }, opts));
20924
20934
  };
20925
20935
  CsvUtils.parseFile = function (file, opts) {
20926
20936
  return FilesUtils.readAsText(file, opts === null || opts === void 0 ? void 0 : opts.encoding)