linear-react-components-ui 0.4.76-beta.14 → 0.4.76-beta.15

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.
@@ -6,6 +6,8 @@
6
6
  height: 100%;
7
7
  margin-bottom: 20px;
8
8
  border: solid 1px $component-border-color;
9
+ display: flex;
10
+ flex-direction: column;
9
11
  &.panel-shadow {
10
12
  box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
11
13
  }
@@ -47,7 +49,8 @@
47
49
  }
48
50
  }
49
51
  > .panel-content {
50
- height: auto;
52
+ flex: 1;
53
+ overflow: auto;
51
54
  padding: 15px;
52
55
  }
53
56
  }
@@ -7,6 +7,8 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
10
12
  var _BaseMask = _interopRequireDefault(require("./BaseMask"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -14,10 +16,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
14
16
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
17
 
16
18
  var PhoneField = function PhoneField(props) {
19
+ var cellNumber = props.cellNumber;
17
20
  return /*#__PURE__*/_react["default"].createElement(_BaseMask["default"], _extends({}, props, {
18
- mask: "(00) 0000-0000"
21
+ mask: cellNumber ? '(00) 00000-0000' : '(00) 0000-0000'
19
22
  }));
20
23
  };
21
24
 
25
+ PhoneField.propTypes = {
26
+ cellNumber: _propTypes["default"].bool
27
+ };
28
+ PhoneField.defaultProps = {
29
+ cellNumber: false
30
+ };
22
31
  var _default = PhoneField;
23
32
  exports["default"] = _default;
@@ -85,7 +85,8 @@ var Dropdown = function Dropdown(_ref) {
85
85
  imgSrcKey = _ref.imgSrcKey,
86
86
  gridWrapperStyle = _ref.gridWrapperStyle,
87
87
  selectFieldRef = _ref.selectFieldRef,
88
- dropdownMaxHeight = _ref.dropdownMaxHeight;
88
+ dropdownMaxHeight = _ref.dropdownMaxHeight,
89
+ inputValue = _ref.inputValue;
89
90
 
90
91
  var _useState = (0, _react.useState)(returnDropdownDynamicStyles(selectFieldRef, dropdownMaxHeight)),
91
92
  _useState2 = _slicedToArray(_useState, 1),
@@ -102,6 +103,7 @@ var Dropdown = function Dropdown(_ref) {
102
103
  }, /*#__PURE__*/_react["default"].createElement("input", {
103
104
  className: "filterinput",
104
105
  type: "text",
106
+ value: inputValue,
105
107
  onFocus: function onFocus() {
106
108
  handleOnFocus();
107
109
  },
@@ -174,7 +176,8 @@ Dropdown.propTypes = {
174
176
  striped: _propTypes["default"].bool,
175
177
  gridWrapperStyle: _propTypes["default"].object,
176
178
  selectFieldRef: _propTypes["default"].object,
177
- dropdownMaxHeight: _propTypes["default"].number
179
+ dropdownMaxHeight: _propTypes["default"].number,
180
+ inputValue: _propTypes["default"].string.isRequired
178
181
  };
179
182
  Dropdown.defaultProps = {
180
183
  selected: null,
@@ -397,7 +397,7 @@ Object.defineProperty(MultipleSelect, "getDerivedStateFromProps", {
397
397
  var dataCombo = remoteSearch ? dataSource : (0, _helper.getFilteredMultipleDataCombo)(_extends({}, props, state));
398
398
  return {
399
399
  dataCombo: dataCombo,
400
- selected: dataSource.length > 0 && remoteSearch ? dataSource[0] : null
400
+ selected: dataCombo.length > 0 ? dataCombo[0] : null
401
401
  };
402
402
  }
403
403
 
@@ -112,12 +112,12 @@ var withTooltip = function withTooltip(WrappedComponent) {
112
112
  };
113
113
  }, []);
114
114
  (0, _react.useEffect)(function () {
115
- if (targetElement.current) {
115
+ if (targetElement.current && tooltipElement.current) {
116
116
  var width = tooltipDimensions.width,
117
117
  height = tooltipDimensions.height;
118
118
  var targetDimensions = targetElement.current.getBoundingClientRect();
119
119
  var targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
120
- var tooltipClientWidth = tooltipElement.current && tooltipElement.current.clientWidth;
120
+ var tooltipClientWidth = tooltipElement.current.clientWidth;
121
121
  var style = "width: ".concat(typeof width === 'string' ? width : "".concat(width, "px"));
122
122
  var left = targetDimensions.left + targetDimensions.width / 2 - tooltipClientWidth / 2;
123
123
  left = Math.min(left, document.body.clientWidth - tooltipClientWidth - space);
@@ -100,20 +100,26 @@ var TreeView = /*#__PURE__*/function (_Component) {
100
100
  enumerable: true,
101
101
  writable: true,
102
102
  value: function value(selectedIds) {
103
- var requiredIds = [];
104
- var newSelectedIds = [];
105
- selectedIds.forEach(function (id) {
106
- var _this$checkAllAncestr = _this.checkAllAncestry(id, [], true, false),
107
- requiredParentsIds = _this$checkAllAncestr.requiredParentsIds,
108
- updatedIdsWithAncestryIds = _this$checkAllAncestr.updatedIdsWithAncestryIds;
109
-
110
- newSelectedIds = [].concat(_toConsumableArray(newSelectedIds), _toConsumableArray(updatedIdsWithAncestryIds));
111
- requiredIds = [].concat(_toConsumableArray(requiredIds), _toConsumableArray(requiredParentsIds));
112
- });
113
-
114
103
  _this.setState({
115
- requiredParentsIds: _lodash["default"].uniq(requiredIds),
116
- selectedIds: _lodash["default"].uniq(newSelectedIds)
104
+ requiredParentsIds: []
105
+ }, function () {
106
+ var requiredIds = [];
107
+ var newSelectedIds = [];
108
+ var selectedIdsUpdatedOnMount = _this.state.selectedIdsUpdatedOnMount;
109
+ selectedIds.forEach(function (id) {
110
+ var _this$checkAllAncestr = _this.checkAllAncestry(id, [], true, false),
111
+ requiredParentsIds = _this$checkAllAncestr.requiredParentsIds,
112
+ updatedIdsWithAncestryIds = _this$checkAllAncestr.updatedIdsWithAncestryIds;
113
+
114
+ newSelectedIds = [].concat(_toConsumableArray(newSelectedIds), _toConsumableArray(updatedIdsWithAncestryIds));
115
+ requiredIds = [].concat(_toConsumableArray(requiredIds), _toConsumableArray(requiredParentsIds));
116
+ });
117
+
118
+ _this.setState({
119
+ requiredParentsIds: _lodash["default"].uniq(requiredIds),
120
+ selectedIds: _lodash["default"].uniq(newSelectedIds),
121
+ selectedIdsUpdatedOnMount: selectedIdsUpdatedOnMount || true
122
+ });
117
123
  });
118
124
  }
119
125
  });
@@ -504,7 +510,8 @@ var TreeView = /*#__PURE__*/function (_Component) {
504
510
  selectedIds: _this.props.selectedIds,
505
511
  isHandlingSelectedIds: false,
506
512
  requiredParentsIds: [],
507
- alreadyOpenedIds: []
513
+ alreadyOpenedIds: [],
514
+ selectedIdsUpdatedOnMount: false
508
515
  };
509
516
  return _this;
510
517
  }
@@ -519,12 +526,15 @@ var TreeView = /*#__PURE__*/function (_Component) {
519
526
  value: function componentDidUpdate(prevProps, prevState) {
520
527
  var _this$state3 = this.state,
521
528
  selectedIds = _this$state3.selectedIds,
522
- propSelectedIds = _this$state3.propSelectedIds;
529
+ propSelectedIds = _this$state3.propSelectedIds,
530
+ selectedIdsUpdatedOnMount = _this$state3.selectedIdsUpdatedOnMount;
523
531
  var allowCheckAllAncestry = this.props.allowCheckAllAncestry;
524
532
 
525
533
  var isSameSelectedIds = _lodash["default"].isEqual(propSelectedIds.sort(), prevState.propSelectedIds.sort());
526
534
 
527
- if (allowCheckAllAncestry && !isSameSelectedIds) this.handleNewSelectedIds(selectedIds);
535
+ if (allowCheckAllAncestry && (!selectedIdsUpdatedOnMount || !isSameSelectedIds)) {
536
+ this.handleNewSelectedIds(selectedIds);
537
+ }
528
538
  }
529
539
  }, {
530
540
  key: "render",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "0.4.76-beta.14",
3
+ "version": "0.4.76-beta.15",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var getCalendarDropdownStyle = function getCalendarDropdownStyle(_ref) {
9
- var topPosition = _ref.topPosition,
10
- leftPosition = _ref.leftPosition,
11
- width = _ref.width;
12
- return "top: ".concat(topPosition, "px;\n left: ").concat(leftPosition, "px;\n width:").concat(width, "px");
13
- };
14
-
15
- var _default = getCalendarDropdownStyle;
16
- exports["default"] = _default;