intelicoreact 0.2.90 → 0.2.91
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.
|
@@ -31,7 +31,9 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
|
31
31
|
onChange = _ref.onChange,
|
|
32
32
|
isUseParentsClassesAsDataset = _ref.isUseParentsClassesAsDataset,
|
|
33
33
|
isUseAccordionForGroup = _ref.isUseAccordionForGroup,
|
|
34
|
-
accordionIcons = _ref.accordionIcons
|
|
34
|
+
accordionIcons = _ref.accordionIcons,
|
|
35
|
+
_ref$isOnlyOne = _ref.isOnlyOne,
|
|
36
|
+
isOnlyOne = _ref$isOnlyOne === void 0 ? false : _ref$isOnlyOne;
|
|
35
37
|
var handle = {
|
|
36
38
|
changeParent: function changeParent(value, key, prop) {
|
|
37
39
|
var parent = items.find(function (item) {
|
|
@@ -56,15 +58,39 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
|
56
58
|
onChange((0, _toConsumableArray2.default)(items));
|
|
57
59
|
},
|
|
58
60
|
changeChild: function changeChild(value, key, parentKey) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
if (isOnlyOne) {
|
|
62
|
+
var parent = items.find(function (item) {
|
|
63
|
+
return item.key === parentKey;
|
|
64
|
+
});
|
|
65
|
+
parent.children.find(function (item) {
|
|
66
|
+
return item.key === key;
|
|
67
|
+
}).value = value;
|
|
68
|
+
parent.children.map(function (item) {
|
|
69
|
+
if (item.key !== key && value === true) {
|
|
70
|
+
item.disabled = true;
|
|
71
|
+
parent.disabled = true;
|
|
72
|
+
} else if (item.key !== key && value === false) {
|
|
73
|
+
item.disabled = false;
|
|
74
|
+
parent.disabled = false;
|
|
75
|
+
} else item.disabled = false;
|
|
76
|
+
|
|
77
|
+
return item;
|
|
78
|
+
});
|
|
79
|
+
parent.disabled = true;
|
|
80
|
+
console.log(parent);
|
|
81
|
+
} else {
|
|
82
|
+
var _parent = items.find(function (item) {
|
|
83
|
+
return item.key === parentKey;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
_parent.children.find(function (item) {
|
|
87
|
+
return item.key === key;
|
|
88
|
+
}).value = value;
|
|
89
|
+
if (_parent.children.every(function (item) {
|
|
90
|
+
return item.value;
|
|
91
|
+
})) _parent.value = true;else _parent.value = false;
|
|
92
|
+
}
|
|
93
|
+
|
|
68
94
|
onChange((0, _toConsumableArray2.default)(items));
|
|
69
95
|
},
|
|
70
96
|
isAllChecked: function isAllChecked(item) {
|
|
@@ -131,7 +157,7 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
|
131
157
|
disabled: parent.children.every(function (_ref4) {
|
|
132
158
|
var disabled = _ref4.disabled;
|
|
133
159
|
return disabled === true;
|
|
134
|
-
})
|
|
160
|
+
}) || parent.disabled
|
|
135
161
|
}), renderInner(parent));
|
|
136
162
|
}));
|
|
137
163
|
};
|
|
@@ -53,7 +53,7 @@ var AccordionWithCheckbox = function AccordionWithCheckbox(_ref) {
|
|
|
53
53
|
disabled: parent.children.every(function (_ref2) {
|
|
54
54
|
var disabled = _ref2.disabled;
|
|
55
55
|
return disabled === true;
|
|
56
|
-
})
|
|
56
|
+
}) || parent.disabled
|
|
57
57
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
58
58
|
className: "".concat(RC, "__description-checked")
|
|
59
59
|
}, parent !== null && parent !== void 0 && (_parent$children3 = parent.children) !== null && _parent$children3 !== void 0 && _parent$children3.length ? "Selected ".concat(parent.children.filter(function (child) {
|