monkey-style-guide 2.0.201 → 2.0.203

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.
@@ -256,7 +256,7 @@ class MonkeyUtils {
256
256
  return `${formated}`;
257
257
  }
258
258
  static formatFileSize(size) {
259
- let units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
259
+ let units = ['b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb'];
260
260
  let l = 0;
261
261
  while (size >= 1024 && ++l) {
262
262
  size = size / 1024;
@@ -6784,7 +6784,8 @@ class MonkeyFileUploadComponent {
6784
6784
  this._id = `mecx-file-upload-${MonkeyUtils.getRandomString(10)}`;
6785
6785
  this._disabled = false;
6786
6786
  this._progress = null;
6787
- this._maxSizeErrorMessage = false;
6787
+ this._showMaxSizeErrorMessage = false;
6788
+ this._maxSizeErrorMessage = '';
6788
6789
  this._allowedExtensionErrorMessage = false;
6789
6790
  this._uploadErrorMessage = '';
6790
6791
  }
@@ -6804,7 +6805,9 @@ class MonkeyFileUploadComponent {
6804
6805
  }
6805
6806
  if (configFiles.maxSize) {
6806
6807
  if (size > configFiles.maxSize) {
6807
- this._maxSizeErrorMessage = true;
6808
+ this._showMaxSizeErrorMessage = true;
6809
+ const formated = MonkeyUtils.formatFileSize(configFiles.maxSize);
6810
+ this._maxSizeErrorMessage = `${this.maxSizeErrorMessage}${formated}`;
6808
6811
  return false;
6809
6812
  }
6810
6813
  }
@@ -6862,7 +6865,7 @@ class MonkeyFileUploadComponent {
6862
6865
  onChangeValue(event) {
6863
6866
  const { listenFiles } = this;
6864
6867
  this._allowedExtensionErrorMessage = false;
6865
- this._maxSizeErrorMessage = false;
6868
+ this._showMaxSizeErrorMessage = false;
6866
6869
  for (let index = 0; index < event.length; index++) {
6867
6870
  const file = event[index];
6868
6871
  if (this.validateFile(file)) {
@@ -6904,7 +6907,7 @@ MonkeyFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
6904
6907
  {{ helperMessage }}
6905
6908
  </helper>
6906
6909
  </mecx-form-field-header>
6907
- <mecx-form-field-body [class.error]="errorMessage?.trim() || _uploadErrorMessage?.trim() || _maxSizeErrorMessage">
6910
+ <mecx-form-field-body [class.error]="errorMessage?.trim() || _uploadErrorMessage?.trim() || _showMaxSizeErrorMessage">
6908
6911
  <input
6909
6912
  #fileInput
6910
6913
  hidden
@@ -6943,7 +6946,7 @@ MonkeyFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
6943
6946
  <error>
6944
6947
  {{ errorMessage }}
6945
6948
  {{ _uploadErrorMessage }}
6946
- {{ _maxSizeErrorMessage ? maxSizeErrorMessage : null }}
6949
+ {{ _showMaxSizeErrorMessage ? _maxSizeErrorMessage : null }}
6947
6950
  {{
6948
6951
  _allowedExtensionErrorMessage ? allowedExtensionErrorMessage : null
6949
6952
  }}
@@ -6965,7 +6968,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6965
6968
  {{ helperMessage }}
6966
6969
  </helper>
6967
6970
  </mecx-form-field-header>
6968
- <mecx-form-field-body [class.error]="errorMessage?.trim() || _uploadErrorMessage?.trim() || _maxSizeErrorMessage">
6971
+ <mecx-form-field-body [class.error]="errorMessage?.trim() || _uploadErrorMessage?.trim() || _showMaxSizeErrorMessage">
6969
6972
  <input
6970
6973
  #fileInput
6971
6974
  hidden
@@ -7004,7 +7007,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
7004
7007
  <error>
7005
7008
  {{ errorMessage }}
7006
7009
  {{ _uploadErrorMessage }}
7007
- {{ _maxSizeErrorMessage ? maxSizeErrorMessage : null }}
7010
+ {{ _showMaxSizeErrorMessage ? _maxSizeErrorMessage : null }}
7008
7011
  {{
7009
7012
  _allowedExtensionErrorMessage ? allowedExtensionErrorMessage : null
7010
7013
  }}