@seniorsistemas/angular-components 17.8.5 → 17.8.7

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.
@@ -6360,6 +6360,21 @@
6360
6360
  return ExportUtils;
6361
6361
  }());
6362
6362
 
6363
+ var convertToMomentDateFormat = function (format) {
6364
+ // A ordem dos replaces é importante.
6365
+ return format
6366
+ .replace(/\bd\b/, "D") // day of month (no leading zero)
6367
+ .replace(/\bdd\b/, "DD") // day of month
6368
+ .replace(/\bo\b/, "DDD") // day of the year (no leading zero)
6369
+ .replace(/\boo\b/, "DDDD") // day of the year
6370
+ .replace(/\bM\b/, "MMM") // month name short
6371
+ .replace(/\bMM\b/, "MMMM") // month name long
6372
+ .replace(/\bm\b/, "M") // month of year (no leading)
6373
+ .replace(/\bmm\b/, "MM") // month of year
6374
+ .replace(/\by\b/, "YY") // year (two digits)
6375
+ .replace(/\byy\b/, "YYYY"); // year (four digits)
6376
+ };
6377
+
6363
6378
 
6364
6379
  (function (ValidateErrors) {
6365
6380
  ValidateErrors["MAX_FILE_SIZE"] = "MAX_FILE_SIZE";
@@ -8305,10 +8320,15 @@
8305
8320
 
8306
8321
  var moment$4 = moment_;
8307
8322
  var TableColumnsComponent = /** @class */ (function () {
8308
- function TableColumnsComponent(viewContainerRef, translate, hostProjectConfigs) {
8323
+ function TableColumnsComponent(localeService, viewContainerRef, translate, hostProjectConfigs) {
8324
+ this.localeService = localeService;
8309
8325
  this.viewContainerRef = viewContainerRef;
8310
8326
  this.translate = translate;
8311
8327
  this.hostProjectConfigs = hostProjectConfigs;
8328
+ this.locale = {
8329
+ calendar: __assign(__assign({}, this.localeService.getLocaleOptions().calendar), { dateFormat: convertToMomentDateFormat(this.localeService.getLocaleOptions().calendar.dateFormat) }),
8330
+ number: __assign(__assign({}, this.localeService.getLocaleOptions().number), { scale: 0 })
8331
+ };
8312
8332
  this.formattedColumns = [];
8313
8333
  }
8314
8334
  TableColumnsComponent.prototype.ngOnChanges = function (changes) {
@@ -8337,16 +8357,13 @@
8337
8357
  return null;
8338
8358
  };
8339
8359
  TableColumnsComponent.prototype.validateComponentAttributes = function (changes) {
8340
- var _a, _b, _c;
8360
+ var _a, _b;
8341
8361
  if (!this.columns && !((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue)) {
8342
8362
  throw new Error("The 'columns' attribute must be informed!");
8343
8363
  }
8344
8364
  if (!this.rowValue && !((_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue)) {
8345
8365
  throw new Error("The 'rowValue' attribute must be informed!");
8346
8366
  }
8347
- if (!this.locale && !((_c = changes.locale) === null || _c === void 0 ? void 0 : _c.currentValue)) {
8348
- throw new Error("The 'locale' attribute must be informed!");
8349
- }
8350
8367
  };
8351
8368
  TableColumnsComponent.prototype.createColumnsTemplate = function (changes) {
8352
8369
  var _this = this;
@@ -8366,7 +8383,10 @@
8366
8383
  return column.prefix ? column.prefix : this.hostProjectConfigs.domain + "." + this.hostProjectConfigs.service + ".";
8367
8384
  };
8368
8385
  TableColumnsComponent.prototype.isAttributeValueInvalid = function (attributeValue) {
8369
- return !attributeValue || (this.isArray(attributeValue) && !attributeValue.length);
8386
+ return attributeValue === null ||
8387
+ attributeValue === undefined ||
8388
+ (this.isArray(attributeValue) && !attributeValue.length) ||
8389
+ (typeof attributeValue === 'string' && attributeValue.trim() === '');
8370
8390
  };
8371
8391
  TableColumnsComponent.prototype.getFormattedColumnValue = function (column, columnValue, unifiedColumnValues, uninformedText, uninformedNumber) {
8372
8392
  if (uninformedNumber === column.attributes.length) {
@@ -8402,10 +8422,10 @@
8402
8422
  });
8403
8423
  return attributeValue;
8404
8424
  };
8405
- TableColumnsComponent.prototype.getNumberConfigs = function (column, locale) {
8406
- return __assign(__assign({}, locale.number), { scale: column.scale !== null && column.scale !== undefined
8425
+ TableColumnsComponent.prototype.getNumberConfigs = function (column) {
8426
+ return __assign(__assign({}, this.locale.number), { scale: column.scale !== null && column.scale !== undefined
8407
8427
  ? this.getColumnScale(column.scale)
8408
- : locale.number.scale, prefix: locale.number.currencySymbol + " " });
8428
+ : this.locale.number.scale, prefix: this.locale.number.currencySymbol + " " });
8409
8429
  };
8410
8430
  TableColumnsComponent.prototype.getDateFormat = function (column, locale) {
8411
8431
  return column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
@@ -8423,7 +8443,7 @@
8423
8443
  if (_this.isAttributeValueInvalid(attributeValue)) {
8424
8444
  return uninformed;
8425
8445
  }
8426
- var numberConfigs = _this.getNumberConfigs(column, locale);
8446
+ var numberConfigs = _this.getNumberConfigs(column);
8427
8447
  switch (column.type) {
8428
8448
  case exports.EnumColumnFieldType.ENUM:
8429
8449
  return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
@@ -8521,6 +8541,7 @@
8521
8541
  return columns.sort(function (a, b) { return a.sequence - b.sequence; });
8522
8542
  };
8523
8543
  TableColumnsComponent.ctorParameters = function () { return [
8544
+ { type: LocaleService },
8524
8545
  { type: core.ViewContainerRef },
8525
8546
  { type: core$1.TranslateService },
8526
8547
  { type: undefined, decorators: [{ type: core.Inject, args: [HostProjectConfigsInjectionToken,] }] }
@@ -8543,7 +8564,7 @@
8543
8564
  selector: "s-table-columns",
8544
8565
  styles: [":host{display:none}"]
8545
8566
  }),
8546
- __param(2, core.Inject(HostProjectConfigsInjectionToken))
8567
+ __param(3, core.Inject(HostProjectConfigsInjectionToken))
8547
8568
  ], TableColumnsComponent);
8548
8569
  return TableColumnsComponent;
8549
8570
  }());
@@ -10938,8 +10959,10 @@
10938
10959
  event.stopPropagation();
10939
10960
  };
10940
10961
  ProfilePicturePickerComponent.prototype.onDrop = function (event) {
10962
+ var _a;
10941
10963
  event.preventDefault();
10942
10964
  event.stopPropagation();
10965
+ (_a = this._onTouched) === null || _a === void 0 ? void 0 : _a.call(this);
10943
10966
  var files = [];
10944
10967
  var dataTransferFiles = event.dataTransfer.files;
10945
10968
  for (var i = 0; i < dataTransferFiles.length; i++) {
@@ -10962,9 +10985,11 @@
10962
10985
  }
10963
10986
  };
10964
10987
  ProfilePicturePickerComponent.prototype.selectPhoto = function () {
10988
+ var _a;
10965
10989
  var fileInputElement = this.fileInput.nativeElement;
10966
10990
  fileInputElement.value = "";
10967
10991
  fileInputElement.click();
10992
+ (_a = this._onTouched) === null || _a === void 0 ? void 0 : _a.call(this);
10968
10993
  };
10969
10994
  ProfilePicturePickerComponent.prototype.removePhoto = function () {
10970
10995
  var _this = this;
@@ -10994,10 +11019,11 @@
10994
11019
  fileReader.readAsDataURL(file);
10995
11020
  fileReader.onloadend = function (fileEvent) {
10996
11021
  _this.imageCropperService.show(__assign({ imageSource: fileEvent.target.result, croppedImage: function (image) {
11022
+ var _a;
10997
11023
  _this.image = image;
10998
11024
  _this.changedImage.emit(image);
10999
11025
  _this._value = { sourceFile: file, base64: image };
11000
- _this._onChange(_this._value);
11026
+ (_a = _this._onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this._value);
11001
11027
  }, changeImage: function () { return _this.selectPhoto(); }, allowSelectAnother: false, aspectRatio: _this.aspectRatio }, _this.cropperLabelsConfig));
11002
11028
  };
11003
11029
  };
@@ -18243,6 +18269,7 @@
18243
18269
  exports.TooltipModule = TooltipModule;
18244
18270
  exports.WorkspaceSwitchComponent = WorkspaceSwitchComponent;
18245
18271
  exports.WorkspaceSwitchModule = WorkspaceSwitchModule;
18272
+ exports.convertToMomentDateFormat = convertToMomentDateFormat;
18246
18273
  exports.countries = countries;
18247
18274
  exports.fallback = fallback;
18248
18275
  exports.ɵa = TooltipComponent;