hy-virtual-tree 1.1.52 → 1.1.54
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/CHANGELOG.md +14 -0
- package/dist/index.js +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1251,6 +1251,9 @@ function useCheck(props, tree) {
|
|
|
1251
1251
|
function getCheckedNodes(leafOnly = false) {
|
|
1252
1252
|
return getChecked(leafOnly).checkedNodes;
|
|
1253
1253
|
}
|
|
1254
|
+
function getCheckedBusinessNodes(leafOnly = false) {
|
|
1255
|
+
return getChecked(leafOnly).checkedBusinessNodes || [];
|
|
1256
|
+
}
|
|
1254
1257
|
function getHalfCheckedKeys() {
|
|
1255
1258
|
return getHalfChecked().halfCheckedKeys;
|
|
1256
1259
|
}
|
|
@@ -1559,6 +1562,7 @@ function useCheck(props, tree) {
|
|
|
1559
1562
|
afterNodeCheck,
|
|
1560
1563
|
getCheckedKeys,
|
|
1561
1564
|
getCheckedNodes,
|
|
1565
|
+
getCheckedBusinessNodes,
|
|
1562
1566
|
getHalfCheckedKeys,
|
|
1563
1567
|
getHalfCheckedNodes,
|
|
1564
1568
|
setChecked,
|
|
@@ -1851,16 +1855,20 @@ const useStatus = (config, data, node) => {
|
|
|
1851
1855
|
if (data.dataType !== 3)
|
|
1852
1856
|
return;
|
|
1853
1857
|
el.classList.add('hy-tree-node__status');
|
|
1854
|
-
|
|
1858
|
+
let { deviceStatus } = data;
|
|
1859
|
+
if (deviceStatus === DeviceStatus.ON_LINE && node.children?.some((item) => item.data.deviceStatus === DeviceStatus.BE_MONITOR)) {
|
|
1860
|
+
deviceStatus = DeviceStatus.BE_MONITOR;
|
|
1861
|
+
}
|
|
1862
|
+
if (deviceStatus === DeviceStatus.ON_LINE) {
|
|
1855
1863
|
el.classList.add('hy-text-success');
|
|
1856
1864
|
}
|
|
1857
|
-
else if (
|
|
1865
|
+
else if (deviceStatus === DeviceStatus.SOS) {
|
|
1858
1866
|
el.classList.add('hy-text-danger');
|
|
1859
1867
|
}
|
|
1860
|
-
else if (
|
|
1868
|
+
else if (deviceStatus !== DeviceStatus.OFF_LINE) {
|
|
1861
1869
|
el.classList.add('hy-text-gradient');
|
|
1862
1870
|
}
|
|
1863
|
-
el.innerHTML = deviceStatusMap[
|
|
1871
|
+
el.innerHTML = deviceStatusMap[deviceStatus];
|
|
1864
1872
|
return el;
|
|
1865
1873
|
}
|
|
1866
1874
|
};
|
|
@@ -8882,6 +8890,7 @@ class VirtualTree {
|
|
|
8882
8890
|
getChecked;
|
|
8883
8891
|
getCheckedKeys;
|
|
8884
8892
|
getCheckedNodes;
|
|
8893
|
+
getCheckedBusinessNodes;
|
|
8885
8894
|
setChecked;
|
|
8886
8895
|
setCheckedKeys;
|
|
8887
8896
|
setCheckedNodes;
|
|
@@ -9134,7 +9143,7 @@ class VirtualTree {
|
|
|
9134
9143
|
this._flattenTree = this._genereateFlattenTree();
|
|
9135
9144
|
const { checkedKeys, updateCheckedKeys, isIndeterminate, isChecked, toggleCheckbox, getChecked,
|
|
9136
9145
|
// afterNodeCheck,
|
|
9137
|
-
getCheckedKeys, getCheckedNodes,
|
|
9146
|
+
getCheckedKeys, getCheckedNodes, getCheckedBusinessNodes,
|
|
9138
9147
|
// getHalfCheckedKeys,
|
|
9139
9148
|
// getHalfCheckedNodes,
|
|
9140
9149
|
setChecked, setCheckedKeys, setCheckedNodes, getSwitchCheckedValue, } = useCheck(config, this._tree);
|
|
@@ -9142,6 +9151,7 @@ class VirtualTree {
|
|
|
9142
9151
|
this.getChecked = getChecked;
|
|
9143
9152
|
this.getCheckedKeys = getCheckedKeys;
|
|
9144
9153
|
this.getCheckedNodes = getCheckedNodes;
|
|
9154
|
+
this.getCheckedBusinessNodes = getCheckedBusinessNodes;
|
|
9145
9155
|
this.setChecked = (key, isChecked, isBusiness) => {
|
|
9146
9156
|
setChecked(key, isChecked, isBusiness);
|
|
9147
9157
|
this._refreshRender();
|
|
@@ -9226,7 +9236,7 @@ class VirtualTree {
|
|
|
9226
9236
|
statusSlot = this._customRender(config.renderStatus, item, {
|
|
9227
9237
|
inset: true,
|
|
9228
9238
|
className: 'hy-tree-node__status',
|
|
9229
|
-
defaultFn: (data, node) => useStatus(config, data)
|
|
9239
|
+
defaultFn: (data, node) => useStatus(config, data, node)
|
|
9230
9240
|
});
|
|
9231
9241
|
}
|
|
9232
9242
|
// 右侧内容
|