@seniorsistemas/angular-components 17.8.6 → 17.8.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.
Files changed (31) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +54 -28
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/profile-picture-picker/models/profile-picture-picker-data.d.ts +1 -1
  6. package/components/profile-picture-picker/profile-picture-picker.component.d.ts +5 -4
  7. package/components/table/table-column/table-columns.component.d.ts +3 -1
  8. package/components/utils/index.d.ts +2 -1
  9. package/components/utils/locale-utils.d.ts +1 -0
  10. package/esm2015/components/dynamic-form/components/fields/profile-picture/profile-picture-field.component.js +2 -2
  11. package/esm2015/components/password-strength/password-strength.directive.js +1 -4
  12. package/esm2015/components/profile-picture-picker/index.js +1 -1
  13. package/esm2015/components/profile-picture-picker/models/profile-picture-picker-data.js +1 -1
  14. package/esm2015/components/profile-picture-picker/profile-picture-picker.component.js +25 -15
  15. package/esm2015/components/table/table-column/table-columns.component.js +16 -11
  16. package/esm2015/components/utils/index.js +3 -2
  17. package/esm2015/components/utils/locale-utils.js +15 -0
  18. package/esm5/components/dynamic-form/components/fields/profile-picture/profile-picture-field.component.js +2 -2
  19. package/esm5/components/password-strength/password-strength.directive.js +1 -4
  20. package/esm5/components/profile-picture-picker/index.js +1 -1
  21. package/esm5/components/profile-picture-picker/models/profile-picture-picker-data.js +1 -1
  22. package/esm5/components/profile-picture-picker/profile-picture-picker.component.js +25 -15
  23. package/esm5/components/table/table-column/table-columns.component.js +16 -11
  24. package/esm5/components/utils/index.js +3 -2
  25. package/esm5/components/utils/locale-utils.js +15 -0
  26. package/fesm2015/seniorsistemas-angular-components.js +54 -29
  27. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  28. package/fesm5/seniorsistemas-angular-components.js +54 -29
  29. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  30. package/package.json +1 -1
  31. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -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";
@@ -7774,9 +7789,6 @@
7774
7789
  };
7775
7790
  PasswordStrengthDirective.prototype.validateProperties = function () {
7776
7791
  this.validation = this.validation || this.defaultValidator;
7777
- if (!this.description) {
7778
- throw new Error("Description is required");
7779
- }
7780
7792
  };
7781
7793
  PasswordStrengthDirective.prototype.destroyPasswordStrength = function () {
7782
7794
  if (this.componentRef !== null) {
@@ -8305,10 +8317,15 @@
8305
8317
 
8306
8318
  var moment$4 = moment_;
8307
8319
  var TableColumnsComponent = /** @class */ (function () {
8308
- function TableColumnsComponent(viewContainerRef, translate, hostProjectConfigs) {
8320
+ function TableColumnsComponent(localeService, viewContainerRef, translate, hostProjectConfigs) {
8321
+ this.localeService = localeService;
8309
8322
  this.viewContainerRef = viewContainerRef;
8310
8323
  this.translate = translate;
8311
8324
  this.hostProjectConfigs = hostProjectConfigs;
8325
+ this.locale = {
8326
+ calendar: __assign(__assign({}, this.localeService.getLocaleOptions().calendar), { dateFormat: convertToMomentDateFormat(this.localeService.getLocaleOptions().calendar.dateFormat) }),
8327
+ number: __assign(__assign({}, this.localeService.getLocaleOptions().number), { scale: 0 })
8328
+ };
8312
8329
  this.formattedColumns = [];
8313
8330
  }
8314
8331
  TableColumnsComponent.prototype.ngOnChanges = function (changes) {
@@ -8337,16 +8354,13 @@
8337
8354
  return null;
8338
8355
  };
8339
8356
  TableColumnsComponent.prototype.validateComponentAttributes = function (changes) {
8340
- var _a, _b, _c;
8357
+ var _a, _b;
8341
8358
  if (!this.columns && !((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue)) {
8342
8359
  throw new Error("The 'columns' attribute must be informed!");
8343
8360
  }
8344
8361
  if (!this.rowValue && !((_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue)) {
8345
8362
  throw new Error("The 'rowValue' attribute must be informed!");
8346
8363
  }
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
8364
  };
8351
8365
  TableColumnsComponent.prototype.createColumnsTemplate = function (changes) {
8352
8366
  var _this = this;
@@ -8405,10 +8419,10 @@
8405
8419
  });
8406
8420
  return attributeValue;
8407
8421
  };
8408
- TableColumnsComponent.prototype.getNumberConfigs = function (column, locale) {
8409
- return __assign(__assign({}, locale.number), { scale: column.scale !== null && column.scale !== undefined
8422
+ TableColumnsComponent.prototype.getNumberConfigs = function (column) {
8423
+ return __assign(__assign({}, this.locale.number), { scale: column.scale !== null && column.scale !== undefined
8410
8424
  ? this.getColumnScale(column.scale)
8411
- : locale.number.scale, prefix: locale.number.currencySymbol + " " });
8425
+ : this.locale.number.scale, prefix: this.locale.number.currencySymbol + " " });
8412
8426
  };
8413
8427
  TableColumnsComponent.prototype.getDateFormat = function (column, locale) {
8414
8428
  return column.dateFormat ? column.dateFormat : locale.calendar.dateFormat;
@@ -8426,7 +8440,7 @@
8426
8440
  if (_this.isAttributeValueInvalid(attributeValue)) {
8427
8441
  return uninformed;
8428
8442
  }
8429
- var numberConfigs = _this.getNumberConfigs(column, locale);
8443
+ var numberConfigs = _this.getNumberConfigs(column);
8430
8444
  switch (column.type) {
8431
8445
  case exports.EnumColumnFieldType.ENUM:
8432
8446
  return _this.translate.instant(column.enumPrefix + attributeValue.toString().toLowerCase());
@@ -8524,6 +8538,7 @@
8524
8538
  return columns.sort(function (a, b) { return a.sequence - b.sequence; });
8525
8539
  };
8526
8540
  TableColumnsComponent.ctorParameters = function () { return [
8541
+ { type: LocaleService },
8527
8542
  { type: core.ViewContainerRef },
8528
8543
  { type: core$1.TranslateService },
8529
8544
  { type: undefined, decorators: [{ type: core.Inject, args: [HostProjectConfigsInjectionToken,] }] }
@@ -8546,7 +8561,7 @@
8546
8561
  selector: "s-table-columns",
8547
8562
  styles: [":host{display:none}"]
8548
8563
  }),
8549
- __param(2, core.Inject(HostProjectConfigsInjectionToken))
8564
+ __param(3, core.Inject(HostProjectConfigsInjectionToken))
8550
8565
  ], TableColumnsComponent);
8551
8566
  return TableColumnsComponent;
8552
8567
  }());
@@ -9998,7 +10013,7 @@
9998
10013
  ], ProfilePictureFieldComponent.prototype, "formControl", void 0);
9999
10014
  ProfilePictureFieldComponent = __decorate([
10000
10015
  core.Component({
10001
- template: "<s-profile-picture-picker\n [formControl]=\"formControl\"\n [simpleTitle]=\"field.simpleTitle\"\n [actionTitle]=\"field.actionTitle\"\n [subtitle]=\"field.subtitle\"\n [aspectRatio]=\"field.aspectRatio\"\n [cropperLabelsConfig]=\"field.cropperLabelsConfig\"\n [removeButtonLabel]=\"field.removeButtonLabel\"\n [changeButtonLabel]=\"field.changeButtonLabel\"\n [confirmationTexts]=\"field.confirmationTexts\"\n [maxFileSize]=\"field.maxFileSize\"\n [accept]=\"field\"\n [supportedExtensions]=\"field.supportedExtensions\"\n (changedImage)=\"field.onChangeImage ? field.onChangeImage($event) : null\"\n (removedImage)=\"field.onRemovedImage ? field.onRemovedImage() : null\"\n (invalidFile)=\"field.onInvalidFile ? field.onInvalidFile($event) : null\">\n</s-profile-picture-picker>"
10016
+ template: "<s-profile-picture-picker\n [formControl]=\"formControl\"\n [simpleTitle]=\"field.simpleTitle\"\n [actionTitle]=\"field.actionTitle\"\n [subtitle]=\"field.subtitle\"\n [aspectRatio]=\"field.aspectRatio\"\n [cropperLabelsConfig]=\"field.cropperLabelsConfig\"\n [removeButtonLabel]=\"field.removeButtonLabel\"\n [changeButtonLabel]=\"field.changeButtonLabel\"\n [confirmationTexts]=\"field.confirmationTexts\"\n [maxFileSize]=\"field.maxFileSize\"\n [accept]=\"field.accept\"\n [supportedExtensions]=\"field.supportedExtensions\"\n (changedImage)=\"field.onChangeImage ? field.onChangeImage($event) : null\"\n (removedImage)=\"field.onRemovedImage ? field.onRemovedImage() : null\"\n (invalidFile)=\"field.onInvalidFile ? field.onInvalidFile($event) : null\">\n</s-profile-picture-picker>"
10002
10017
  })
10003
10018
  ], ProfilePictureFieldComponent);
10004
10019
  return ProfilePictureFieldComponent;
@@ -10908,13 +10923,8 @@
10908
10923
  this.confirmationService = confirmationService;
10909
10924
  this.translateService = translateService;
10910
10925
  this.aspectRatio = 1;
10911
- this.confirmationTexts = {
10912
- removalHeader: this.translateService.instant("platform.angular_components.remove_image"),
10913
- removalMessage: this.translateService.instant("platform.angular_components.confirmation_remove_image"),
10914
- removalAcceptLabel: this.translateService.instant("platform.angular_components.remove"),
10915
- removalRejectLabel: this.translateService.instant("platform.angular_components.cancel"),
10916
- };
10917
10926
  this.supportedExtensions = [];
10927
+ this.imageChange = new core.EventEmitter();
10918
10928
  this.changedImage = new core.EventEmitter();
10919
10929
  this.removedImage = new core.EventEmitter();
10920
10930
  this.invalidFile = new core.EventEmitter();
@@ -10922,6 +10932,9 @@
10922
10932
  ProfilePicturePickerComponent_1 = ProfilePicturePickerComponent;
10923
10933
  ProfilePicturePickerComponent.prototype.writeValue = function (value) {
10924
10934
  this._value = value;
10935
+ if (value) {
10936
+ this.image = value.base64;
10937
+ }
10925
10938
  };
10926
10939
  ProfilePicturePickerComponent.prototype.registerOnChange = function (onChange) {
10927
10940
  this._onChange = onChange;
@@ -10941,8 +10954,10 @@
10941
10954
  event.stopPropagation();
10942
10955
  };
10943
10956
  ProfilePicturePickerComponent.prototype.onDrop = function (event) {
10957
+ var _a;
10944
10958
  event.preventDefault();
10945
10959
  event.stopPropagation();
10960
+ (_a = this._onTouched) === null || _a === void 0 ? void 0 : _a.call(this);
10946
10961
  var files = [];
10947
10962
  var dataTransferFiles = event.dataTransfer.files;
10948
10963
  for (var i = 0; i < dataTransferFiles.length; i++) {
@@ -10965,21 +10980,25 @@
10965
10980
  }
10966
10981
  };
10967
10982
  ProfilePicturePickerComponent.prototype.selectPhoto = function () {
10983
+ var _a;
10968
10984
  var fileInputElement = this.fileInput.nativeElement;
10969
10985
  fileInputElement.value = "";
10970
10986
  fileInputElement.click();
10987
+ (_a = this._onTouched) === null || _a === void 0 ? void 0 : _a.call(this);
10971
10988
  };
10972
10989
  ProfilePicturePickerComponent.prototype.removePhoto = function () {
10973
10990
  var _this = this;
10991
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10974
10992
  this.confirmationService.confirm({
10975
- message: this.confirmationTexts.removalMessage,
10976
- acceptLabel: this.confirmationTexts.removalAcceptLabel,
10977
- rejectLabel: this.confirmationTexts.removalRejectLabel,
10978
- header: this.confirmationTexts.removalHeader,
10993
+ message: (_b = (_a = this.confirmationTexts) === null || _a === void 0 ? void 0 : _a.removalMessage) !== null && _b !== void 0 ? _b : this.translateService.instant("platform.angular_components.confirmation_remove_image"),
10994
+ acceptLabel: (_d = (_c = this.confirmationTexts) === null || _c === void 0 ? void 0 : _c.removalAcceptLabel) !== null && _d !== void 0 ? _d : this.translateService.instant("platform.angular_components.remove"),
10995
+ rejectLabel: (_f = (_e = this.confirmationTexts) === null || _e === void 0 ? void 0 : _e.removalRejectLabel) !== null && _f !== void 0 ? _f : this.translateService.instant("platform.angular_components.cancel"),
10996
+ header: (_h = (_g = this.confirmationTexts) === null || _g === void 0 ? void 0 : _g.removalHeader) !== null && _h !== void 0 ? _h : this.translateService.instant("platform.angular_components.remove_image"),
10997
+ rejectButtonStyleClass: "ui-button-secondary",
10979
10998
  accept: function () {
10980
10999
  var fileInputElement = _this.fileInput.nativeElement;
10981
11000
  fileInputElement.value = "";
10982
- _this.image = "";
11001
+ _this.image = null;
10983
11002
  _this.removedImage.emit();
10984
11003
  },
10985
11004
  });
@@ -10997,10 +11016,13 @@
10997
11016
  fileReader.readAsDataURL(file);
10998
11017
  fileReader.onloadend = function (fileEvent) {
10999
11018
  _this.imageCropperService.show(__assign({ imageSource: fileEvent.target.result, croppedImage: function (image) {
11019
+ var _a;
11020
+ var data = { source: file, base64: image };
11000
11021
  _this.image = image;
11022
+ _this.imageChange.emit(data);
11001
11023
  _this.changedImage.emit(image);
11002
- _this._value = { sourceFile: file, base64: image };
11003
- _this._onChange(_this._value);
11024
+ _this._value = { source: file, base64: image };
11025
+ (_a = _this._onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this._value);
11004
11026
  }, changeImage: function () { return _this.selectPhoto(); }, allowSelectAnother: false, aspectRatio: _this.aspectRatio }, _this.cropperLabelsConfig));
11005
11027
  };
11006
11028
  };
@@ -11041,7 +11063,7 @@
11041
11063
  };
11042
11064
  ProfilePicturePickerComponent.prototype._validateFileSize = function (file) {
11043
11065
  if (this.maxFileSize) {
11044
- return file.size > this.maxFileSize;
11066
+ return file.size <= this.maxFileSize;
11045
11067
  }
11046
11068
  return true;
11047
11069
  };
@@ -11103,6 +11125,9 @@
11103
11125
  __decorate([
11104
11126
  core.ViewChild("fileInput", { read: core.ElementRef })
11105
11127
  ], ProfilePicturePickerComponent.prototype, "fileInput", void 0);
11128
+ __decorate([
11129
+ core.Output()
11130
+ ], ProfilePicturePickerComponent.prototype, "imageChange", void 0);
11106
11131
  __decorate([
11107
11132
  core.Output()
11108
11133
  ], ProfilePicturePickerComponent.prototype, "changedImage", void 0);
@@ -18246,6 +18271,7 @@
18246
18271
  exports.TooltipModule = TooltipModule;
18247
18272
  exports.WorkspaceSwitchComponent = WorkspaceSwitchComponent;
18248
18273
  exports.WorkspaceSwitchModule = WorkspaceSwitchModule;
18274
+ exports.convertToMomentDateFormat = convertToMomentDateFormat;
18249
18275
  exports.countries = countries;
18250
18276
  exports.fallback = fallback;
18251
18277
  exports.ɵa = TooltipComponent;