ui-kit-ck-consultant 0.5.214 → 0.5.217

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.
@@ -856,7 +856,7 @@ var Header = /*#__PURE__*/function (_React$Component) {
856
856
  return Header;
857
857
  }(React.Component);
858
858
 
859
- var style$b = {"card":"_4T5PO","card_tabs":"_3qz0v","card_loader_container":"_1zFpZ","loader_element":"_2rKrR","loader":"_8eH6Y","grow":"_19crY","card_top_border":"_1ItWX","card_header":"_HBqZI","card_tabs_header":"_3iUeb","card_header_left":"_2KSuY","card_tabs_header_left":"_3euMf","card_tabs_header_active":"_3UmBd","card_header_right":"_2KPnI","card_header_action":"_dmCgN","card_header_action_disable":"_1XS9q","card_body":"_8DE3p","card_tabs_body":"_3UyXH","card_color":"_2D119","card_color_left":"_1OCk3","card_color_image_left":"_199hf","card_color_center":"_11M7t","card_color_right":"_ZiFPm","card_statistics":"_29tu3","card_statistics_body":"_1b4T4","card_statistics_icon":"_1dkwV"};
859
+ var style$b = {"card":"_4T5PO","card_tabs":"_3qz0v","card_loader_container":"_1zFpZ","loader_element":"_2rKrR","loader":"_8eH6Y","grow":"_19crY","card_disabled":"_3BnES","card_top_border":"_1ItWX","card_header":"_HBqZI","card_tabs_header":"_3iUeb","card_header_left":"_2KSuY","card_tabs_header_left":"_3euMf","card_tabs_header_active":"_3UmBd","card_header_right":"_2KPnI","card_header_action":"_dmCgN","card_header_action_disable":"_1XS9q","card_body":"_8DE3p","card_tabs_body":"_3UyXH","card_color":"_2D119","card_color_left":"_1OCk3","card_color_image_left":"_199hf","card_color_center":"_11M7t","card_color_right":"_ZiFPm","card_statistics":"_29tu3","card_statistics_body":"_1b4T4","card_statistics_icon":"_1dkwV"};
860
860
 
861
861
  var Card = /*#__PURE__*/function (_React$Component) {
862
862
  _inheritsLoose(Card, _React$Component);
@@ -902,7 +902,9 @@ var Card = /*#__PURE__*/function (_React$Component) {
902
902
  _proto.render = function render() {
903
903
  return /*#__PURE__*/React.createElement("div", {
904
904
  className: classNames$1(style$b.card, this.props.className)
905
- }, this.props.imgLeft ? /*#__PURE__*/React.createElement("div", {
905
+ }, this.props.disabled ? /*#__PURE__*/React.createElement("div", {
906
+ className: classNames$1(style$b.card_disabled)
907
+ }) : null, this.props.imgLeft ? /*#__PURE__*/React.createElement("div", {
906
908
  style: {
907
909
  overflow: 'hidden',
908
910
  width: this.props.customWidthImgLeft || '100%'
@@ -3023,6 +3025,56 @@ var DropzoneMultiple = /*#__PURE__*/function (_React$Component) {
3023
3025
 
3024
3026
  _this = _React$Component.call(this, props) || this;
3025
3027
 
3028
+ _this.resizeImage = function (base64, mime, callback) {
3029
+ if (callback === void 0) {
3030
+ callback = function callback() {};
3031
+ }
3032
+
3033
+ if (_this.props.maxImageSize && ['image/png', 'image/jpeg', 'image/jpg'].includes(mime)) {
3034
+ var image = new Image();
3035
+ image.src = base64;
3036
+
3037
+ image.onload = function () {
3038
+ var initialWidth = image.width;
3039
+ var initialHeight = image.height;
3040
+ var finalWidth = 0;
3041
+ var finalHeight = 0;
3042
+
3043
+ if (initialWidth > initialHeight) {
3044
+ if (initialWidth > _this.props.maxImageSize) {
3045
+ finalWidth = _this.props.maxImageSize;
3046
+ finalHeight = finalWidth * initialHeight / initialWidth;
3047
+ } else {
3048
+ finalWidth = initialWidth;
3049
+ finalHeight = initialHeight;
3050
+ }
3051
+ } else {
3052
+ if (initialHeight > _this.props.maxImageSize) {
3053
+ finalHeight = _this.props.maxImageSize;
3054
+ finalWidth = finalHeight * initialWidth / initialHeight;
3055
+ } else {
3056
+ finalWidth = initialWidth;
3057
+ finalHeight = initialHeight;
3058
+ }
3059
+ }
3060
+
3061
+ var canvas = document.createElement('canvas');
3062
+ var ctx = canvas.getContext('2d');
3063
+ canvas.width = finalWidth;
3064
+ canvas.height = finalHeight;
3065
+ ctx.drawImage(image, 0, 0, finalWidth, finalHeight);
3066
+ base64 = canvas.toDataURL(mime, 0.9);
3067
+ callback(base64);
3068
+ };
3069
+
3070
+ image.onerror = function () {
3071
+ callback(base64);
3072
+ };
3073
+ } else {
3074
+ callback(base64);
3075
+ }
3076
+ };
3077
+
3026
3078
  _this.handleDeleteFile = function (idx) {
3027
3079
  var files = _this.state.files;
3028
3080
  files.splice(idx, 1);
@@ -3068,22 +3120,23 @@ var DropzoneMultiple = /*#__PURE__*/function (_React$Component) {
3068
3120
  var reader = new window.FileReader();
3069
3121
 
3070
3122
  reader.onload = function () {
3071
- var base64 = reader.result;
3072
- var tmpFiles = _this.state.files;
3073
- tmpFiles.push({
3074
- base64: base64,
3075
- mime: file.type,
3076
- name: file.name,
3077
- extension: name[name.length - 1],
3078
- size: file.size
3079
- });
3080
-
3081
- _this.setState({
3082
- files: tmpFiles
3083
- }, function () {
3084
- _this.currentFile += 1;
3085
-
3086
- _this.nextFile(files);
3123
+ _this.resizeImage(reader.result, file.type, function (base64) {
3124
+ var tmpFiles = _this.state.files;
3125
+ tmpFiles.push({
3126
+ base64: base64,
3127
+ mime: file.type,
3128
+ name: file.name,
3129
+ extension: name[name.length - 1],
3130
+ size: file.size
3131
+ });
3132
+
3133
+ _this.setState({
3134
+ files: tmpFiles
3135
+ }, function () {
3136
+ _this.currentFile += 1;
3137
+
3138
+ _this.nextFile(files);
3139
+ });
3087
3140
  });
3088
3141
  };
3089
3142