ui-kit-ck-consultant 0.5.133 → 0.5.137

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.
@@ -1,4 +1,4 @@
1
- import React, { createRef, Component, Fragment as Fragment$1 } from 'react';
1
+ import React, { Fragment as Fragment$1, createRef, Component } from 'react';
2
2
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
3
  import { faCheck, faTimes, faCaretUp, faCaretDown, faArrowLeft, faEllipsisV, faArrowRight, faChevronLeft, faChevronRight, faPlus, faBan, faCaretRight, faCaretLeft, faUser, faTimesCircle } from '@fortawesome/free-solid-svg-icons';
4
4
  import classNames$1 from 'classnames';
@@ -264,7 +264,8 @@ var FormInput = /*#__PURE__*/function (_React$Component) {
264
264
  _proto.render = function render() {
265
265
  if (this.props.children) {
266
266
  return /*#__PURE__*/React.createElement("div", {
267
- className: classNames$1(style$2.form_input_container, this.props.className)
267
+ className: classNames$1(style$2.form_input_container, this.props.className),
268
+ style: this.props.style
268
269
  }, this.props.title ? /*#__PURE__*/React.createElement("span", {
269
270
  className: this.props.classNameTitle
270
271
  }, this.props.title, ' ', this.props.required ? /*#__PURE__*/React.createElement("span", {
@@ -288,7 +289,8 @@ var FormInput = /*#__PURE__*/function (_React$Component) {
288
289
  }, this.props.error) : '');
289
290
  } else {
290
291
  return /*#__PURE__*/React.createElement("div", {
291
- className: classNames$1(style$2.form_input_container, this.props.className)
292
+ className: classNames$1(style$2.form_input_container, this.props.className),
293
+ style: this.props.style
292
294
  }, this.props.title ? /*#__PURE__*/React.createElement("span", {
293
295
  className: this.props.classNameTitle
294
296
  }, this.props.title, ' ', this.props.required ? /*#__PURE__*/React.createElement("span", {
@@ -426,19 +428,31 @@ var FormRange = /*#__PURE__*/function (_React$Component) {
426
428
 
427
429
  _this = _React$Component.call(this, props) || this;
428
430
 
431
+ _this.handleClickOutside = function (event) {
432
+ if (_this.refComponent && _this.refComponent.current && !_this.refComponent.current.contains(event.target)) {
433
+ _this.setState({
434
+ isOpen: false
435
+ });
436
+ }
437
+ };
438
+
429
439
  _this.findText = function (options, value) {
430
- var result = options.filter(function (item) {
431
- return item.value.toString() === value.toString();
432
- });
433
- return result.length ? result[0].text : '';
440
+ if (_this.props.input) {
441
+ return value;
442
+ } else {
443
+ var result = options.filter(function (item) {
444
+ return item.value.toString() === value.toString();
445
+ });
446
+ return result.length ? result[0].text : '';
447
+ }
434
448
  };
435
449
 
436
450
  _this.getLabel = function (value1, value2, options1, options2) {
437
451
  if (_this.findText(options1, value1) === _this.findText(options2, value2)) {
438
452
  return "" + _this.findText(options1, value1);
439
- } else if (value1 !== 'DEFAULT' && value2 === 'DEFAULT') {
453
+ } else if (value1 !== 'DEFAULT' && value1 !== '' && (value2 === 'DEFAULT' || value2 === '')) {
440
454
  return ">= " + _this.findText(options1, value1);
441
- } else if (value1 === 'DEFAULT' && value2 !== 'DEFAULT') {
455
+ } else if ((value1 === 'DEFAULT' || value1 === '') && value2 !== 'DEFAULT' && value2 !== '') {
442
456
  return "<= " + _this.findText(options2, value2);
443
457
  } else {
444
458
  return _this.findText(options1, value1) + " - " + _this.findText(options2, value2);
@@ -448,11 +462,20 @@ var FormRange = /*#__PURE__*/function (_React$Component) {
448
462
  _this.state = {
449
463
  isOpen: false
450
464
  };
465
+ _this.refComponent = React.createRef();
451
466
  return _this;
452
467
  }
453
468
 
454
469
  var _proto = FormRange.prototype;
455
470
 
471
+ _proto.componentDidMount = function componentDidMount() {
472
+ document.addEventListener('mousedown', this.handleClickOutside);
473
+ };
474
+
475
+ _proto.componentWillUnmount = function componentWillUnmount() {
476
+ document.removeEventListener('mousedown', this.handleClickOutside);
477
+ };
478
+
456
479
  _proto.render = function render() {
457
480
  var _this2 = this;
458
481
 
@@ -472,8 +495,22 @@ var FormRange = /*#__PURE__*/function (_React$Component) {
472
495
  }, /*#__PURE__*/React.createElement("span", null, this.getLabel(this.props.value1, this.props.value2, this.props.options1, this.props.options2)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
473
496
  icon: this.state.isOpen ? faCaretUp : faCaretDown
474
497
  }))), this.state.isOpen ? /*#__PURE__*/React.createElement("div", {
498
+ ref: this.refComponent,
475
499
  className: style$4.form_range_modal
476
- }, /*#__PURE__*/React.createElement(FormSelect, {
500
+ }, this.props.input ? /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(FormInput, {
501
+ type: this.props.type,
502
+ name: this.props.name1,
503
+ value: this.props.value1,
504
+ onChange: this.props.onChange1,
505
+ className: "mr-10 w-100"
506
+ }), /*#__PURE__*/React.createElement(FormInput, {
507
+ type: this.props.type,
508
+ name: this.props.name2,
509
+ value: this.props.value2,
510
+ onChange: this.props.onChange2,
511
+ className: "w-100"
512
+ })) : /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(FormSelect, {
513
+ type: this.props.type,
477
514
  name: this.props.name1,
478
515
  options: this.props.options1,
479
516
  value: this.props.value1,
@@ -483,6 +520,7 @@ var FormRange = /*#__PURE__*/function (_React$Component) {
483
520
  disabled: false,
484
521
  init: this.props.init1
485
522
  }), /*#__PURE__*/React.createElement(FormSelect, {
523
+ type: this.props.type,
486
524
  name: this.props.name2,
487
525
  options: this.props.options2,
488
526
  value: this.props.value2,
@@ -491,7 +529,7 @@ var FormRange = /*#__PURE__*/function (_React$Component) {
491
529
  ignore: true,
492
530
  disabled: false,
493
531
  init: this.props.init2
494
- })) : null);
532
+ }))) : null);
495
533
  };
496
534
 
497
535
  return FormRange;
@@ -853,7 +891,7 @@ var Card = /*#__PURE__*/function (_React$Component) {
853
891
  _proto.render = function render() {
854
892
  return /*#__PURE__*/React.createElement("div", {
855
893
  className: classNames$1(style$b.card, this.props.className)
856
- }, this.props.isLoader ? /*#__PURE__*/React.createElement("div", {
894
+ }, this.props.isLoad ? /*#__PURE__*/React.createElement("div", {
857
895
  className: style$b.card_loader_container
858
896
  }, /*#__PURE__*/React.createElement("div", {
859
897
  className: classNames$1(style$b.loader_element, this.props.classNameChildren)
@@ -2420,7 +2458,7 @@ var Loader = /*#__PURE__*/function (_React$Component) {
2420
2458
  className: classNames$1(style$k.loader_element, this.props.classNameChildren)
2421
2459
  }, /*#__PURE__*/React.createElement("div", {
2422
2460
  className: style$k.loader
2423
- }, /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null))));
2461
+ }, /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", null)), this.props.message ? /*#__PURE__*/React.createElement("p", null, this.props.message) : null));
2424
2462
  };
2425
2463
 
2426
2464
  return Loader;