linear-react-components-ui 0.4.75-beta.5 → 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.
- package/lib/treeview/index.js +10 -8
- package/package.json +1 -1
package/lib/treeview/index.js
CHANGED
|
@@ -149,14 +149,14 @@ var TreeView = /*#__PURE__*/function (_Component) {
|
|
|
149
149
|
} : nodeChildrenIds;
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
|
-
Object.defineProperty(_assertThisInitialized(_this), "
|
|
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
|
|
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
|
|
177
|
+
var requiredIds = isPreviousParentSelected || selectedSiblingsIds.length > 0 ? _toConsumableArray(requiredAncestryIds) : [].concat(_toConsumableArray(requiredAncestryIds), [parentId]);
|
|
176
178
|
|
|
177
|
-
if (
|
|
178
|
-
return _this.
|
|
179
|
+
if (selectedSiblingsIds.length === 0 && !isPreviousParentSelected) {
|
|
180
|
+
return _this.returnRequiredAncestryIds(parentId, requiredIds, parentId);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
return
|
|
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.
|
|
238
|
+
var ancestryIds = _this.returnRequiredAncestryIds(nodeId);
|
|
237
239
|
|
|
238
240
|
var remainRequiredParentsIds = requiredParentsIds.filter(function (id) {
|
|
239
241
|
return !ancestryIds.includes(id);
|