linear-react-components-ui 0.4.75-beta.2 → 0.4.75-beta.6

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.
@@ -59,7 +59,7 @@ var actionsOnPermissionDenied = function actionsOnPermissionDenied(permissionAtt
59
59
 
60
60
  var result = {};
61
61
  options.forEach(function (option) {
62
- result[option] = hasPermission ? false : option === permissionAttr[0].onDenied;
62
+ result[option] = hasPermission ? false : option === permissionsAttr[0].onDenied;
63
63
  });
64
64
  return result;
65
65
  };
@@ -234,7 +234,7 @@ var TreeNode = /*#__PURE__*/function (_Component) {
234
234
  var validator = validation.validator,
235
235
  applyBehavior = validation.applyBehavior;
236
236
 
237
- if (_lodash["default"].isEmpty({}) && validator && validator(node)) {
237
+ if (_lodash["default"].isEmpty(elementBehavior) && validator && validator(node)) {
238
238
  elementBehavior = options[applyBehavior] || options.unvisible;
239
239
  }
240
240
  });
@@ -149,14 +149,14 @@ var TreeView = /*#__PURE__*/function (_Component) {
149
149
  } : nodeChildrenIds;
150
150
  }
151
151
  });
152
- Object.defineProperty(_assertThisInitialized(_this), "returnAncestryIdsAllowedToUncheck", {
152
+ Object.defineProperty(_assertThisInitialized(_this), "returnRequiredAncestryIds", {
153
153
  configurable: true,
154
154
  enumerable: true,
155
155
  writable: true,
156
156
  value: function value(nodeId) {
157
- var parentsIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
157
+ var requiredAncestryIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
158
158
  var previousParentId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
159
- var selectedSiblingsIds;
159
+ var selectedSiblingsIds = [];
160
160
  var selectedIds = _this.state.selectedIds;
161
161
 
162
162
  var parentId = _this.returnParentId(nodeId);
@@ -166,20 +166,22 @@ var TreeView = /*#__PURE__*/function (_Component) {
166
166
  return childId !== nodeId;
167
167
  });
168
168
 
169
+ var isPreviousParentSelected = selectedIds.includes(previousParentId);
170
+
169
171
  if (nodeSiblingsIds && nodeSiblingsIds.length > 0) {
170
172
  selectedSiblingsIds = selectedIds.filter(function (id) {
171
173
  return nodeSiblingsIds.includes(id);
172
174
  });
173
175
  }
174
176
 
175
- var result = selectedSiblingsIds && selectedSiblingsIds.length > 0 ? _toConsumableArray(parentsIds) : [].concat(_toConsumableArray(parentsIds), [parentId]);
177
+ var requiredIds = isPreviousParentSelected || selectedSiblingsIds.length > 0 ? _toConsumableArray(requiredAncestryIds) : [].concat(_toConsumableArray(requiredAncestryIds), [parentId]);
176
178
 
177
- if (!selectedSiblingsIds || selectedSiblingsIds && selectedSiblingsIds.length === 0 && !selectedIds.includes(previousParentId)) {
178
- return _this.returnAncestryIdsAllowedToUncheck(parentId, result, parentId);
179
+ if (selectedSiblingsIds.length === 0 && !isPreviousParentSelected) {
180
+ return _this.returnRequiredAncestryIds(parentId, requiredIds, parentId);
179
181
  }
180
182
  }
181
183
 
182
- return parentsIds;
184
+ return requiredAncestryIds;
183
185
  }
184
186
  });
185
187
  Object.defineProperty(_assertThisInitialized(_this), "toggleCheckChildren", {
@@ -233,7 +235,7 @@ var TreeView = /*#__PURE__*/function (_Component) {
233
235
  value: function value(nodeId, codigos, requiredParentsIds) {
234
236
  var selectedIds = _this.state.selectedIds;
235
237
 
236
- var ancestryIds = _this.returnAncestryIdsAllowedToUncheck(nodeId);
238
+ var ancestryIds = _this.returnRequiredAncestryIds(nodeId);
237
239
 
238
240
  var remainRequiredParentsIds = requiredParentsIds.filter(function (id) {
239
241
  return !ancestryIds.includes(id);
@@ -483,6 +485,15 @@ var TreeView = /*#__PURE__*/function (_Component) {
483
485
  className: "treeviewcontainer ".concat(bordered && '-bordered')
484
486
  }, this.buildTree(data))));
485
487
  }
488
+ }], [{
489
+ key: "getDerivedStateFromProps",
490
+ value: function getDerivedStateFromProps(props, state) {
491
+ var data = props.data;
492
+ if (data !== state.data) return {
493
+ data: data
494
+ };
495
+ return null;
496
+ }
486
497
  }]);
487
498
 
488
499
  return TreeView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "0.4.75-beta.2",
3
+ "version": "0.4.75-beta.6",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {