hy-virtual-tree 2.0.6 → 2.0.7
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 +7 -0
- package/dist/index.js +44 -50
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hy-virtual-tree v2.0.
|
|
1
|
+
/* hy-virtual-tree v2.0.7 */
|
|
2
2
|
import './svg_bundle.js';
|
|
3
3
|
const isString = (e) => typeof e === 'string';
|
|
4
4
|
const isNumber = (e) => typeof e === 'number';
|
|
@@ -7162,38 +7162,26 @@ class Tooltip {
|
|
|
7162
7162
|
break;
|
|
7163
7163
|
}
|
|
7164
7164
|
}
|
|
7165
|
-
hide(
|
|
7165
|
+
hide() {
|
|
7166
7166
|
this._openTimer && clearTimeout(this._openTimer);
|
|
7167
7167
|
this._closeTimer && clearTimeout(this._closeTimer);
|
|
7168
|
-
if (
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
return;
|
|
7175
|
-
this._el.parentElement.removeChild(this._el);
|
|
7176
|
-
}
|
|
7177
|
-
else {
|
|
7168
|
+
if (!this._el)
|
|
7169
|
+
return;
|
|
7170
|
+
const el = this._el;
|
|
7171
|
+
this._closeTimer = setTimeout(() => {
|
|
7172
|
+
el.classList.remove('hy-tooltip-show');
|
|
7173
|
+
this._closeTimer && clearTimeout(this._closeTimer);
|
|
7178
7174
|
this._closeTimer = setTimeout(() => {
|
|
7179
|
-
|
|
7175
|
+
el.style.setProperty('top', '-10000px');
|
|
7176
|
+
el.style.setProperty('left', '-10000px');
|
|
7177
|
+
if (!el.parentElement)
|
|
7180
7178
|
return;
|
|
7181
|
-
|
|
7182
|
-
this._closeTimer && clearTimeout(this._closeTimer);
|
|
7183
|
-
this._closeTimer = setTimeout(() => {
|
|
7184
|
-
if (!this._el)
|
|
7185
|
-
return;
|
|
7186
|
-
this._el.style.setProperty('top', '-10000px');
|
|
7187
|
-
this._el.style.setProperty('left', '-10000px');
|
|
7188
|
-
if (!this._el.parentElement)
|
|
7189
|
-
return;
|
|
7190
|
-
this._el.parentElement.removeChild(this._el);
|
|
7191
|
-
}, 200);
|
|
7179
|
+
el.parentElement.removeChild(el);
|
|
7192
7180
|
}, 200);
|
|
7193
|
-
}
|
|
7181
|
+
}, 200);
|
|
7194
7182
|
}
|
|
7195
7183
|
destroy() {
|
|
7196
|
-
this.hide(
|
|
7184
|
+
this.hide();
|
|
7197
7185
|
this._timer && clearTimeout(this._timer);
|
|
7198
7186
|
this._trigger && this._trigger.destroy();
|
|
7199
7187
|
this._el = undefined;
|
|
@@ -8243,7 +8231,7 @@ function useCheck(props, instance) {
|
|
|
8243
8231
|
};
|
|
8244
8232
|
const isChecked = (node) => checkedKeys.has(node.key);
|
|
8245
8233
|
const isIndeterminate = (node) => indeterminateKeys.has(node.key);
|
|
8246
|
-
const toggleCheckbox = (node, isChecked, nodeClick = true, immediateUpdate = true, checkOnDbclick = false) => {
|
|
8234
|
+
const toggleCheckbox = (node, isChecked, nodeClick = true, immediateUpdate = true, checkOnDbclick = false, isForce) => {
|
|
8247
8235
|
const { type, checkStrictly, cancelable } = props.rowSelection;
|
|
8248
8236
|
const checkedKeySet = checkedKeys;
|
|
8249
8237
|
// 单选
|
|
@@ -8261,9 +8249,13 @@ function useCheck(props, instance) {
|
|
|
8261
8249
|
}
|
|
8262
8250
|
// 多选
|
|
8263
8251
|
const toggle = (node, checked) => {
|
|
8264
|
-
//
|
|
8265
|
-
if (
|
|
8266
|
-
|
|
8252
|
+
// 是否强制选中
|
|
8253
|
+
if (!isForce) {
|
|
8254
|
+
// 对隐藏的节点不做处理
|
|
8255
|
+
if (instance._hiddenNodeKeySet.has(node.key) || (tree.hiddenNodeKeySet.has(node.key) && nodeClick))
|
|
8256
|
+
return;
|
|
8257
|
+
}
|
|
8258
|
+
console.log('???', checked);
|
|
8267
8259
|
checkedKeySet[checked ? 'add' : 'delete'](node.key);
|
|
8268
8260
|
const children = node.children;
|
|
8269
8261
|
if ((!checkStrictly || checkOnDbclick) && children) {
|
|
@@ -8347,7 +8339,9 @@ function useCheck(props, instance) {
|
|
|
8347
8339
|
checkedBusinessNodes.push(getNodeData(node));
|
|
8348
8340
|
}
|
|
8349
8341
|
// 通道类型业务选中
|
|
8350
|
-
else if (business &&
|
|
8342
|
+
else if (business &&
|
|
8343
|
+
[Business.CHANNEL, Business.PLAN_GROUP_DEVICE].includes(business) &&
|
|
8344
|
+
[DataType.DEVICE, DataType.CHANNEL].includes(data.dataType)) {
|
|
8351
8345
|
// 开启通道可选中
|
|
8352
8346
|
if (props.businessConfig?.isShowChannelSelect) {
|
|
8353
8347
|
// 通道类型 或 没有通道的设备
|
|
@@ -8403,7 +8397,7 @@ function useCheck(props, instance) {
|
|
|
8403
8397
|
halfCheckedKeys
|
|
8404
8398
|
};
|
|
8405
8399
|
}
|
|
8406
|
-
function setCheckedKeys(keys, isBusiness = false) {
|
|
8400
|
+
function setCheckedKeys(keys, isBusiness = false, isForce = false) {
|
|
8407
8401
|
if (!Array.isArray(keys)) {
|
|
8408
8402
|
console.warn('setCheckedKeys请传入数组');
|
|
8409
8403
|
return;
|
|
@@ -8414,16 +8408,16 @@ function useCheck(props, instance) {
|
|
|
8414
8408
|
if (type === 'radio' && keys.length > 1) {
|
|
8415
8409
|
keys = [keys[0]];
|
|
8416
8410
|
}
|
|
8417
|
-
_setCheckedKeys(keys, isBusiness);
|
|
8411
|
+
_setCheckedKeys(keys, isBusiness, isForce);
|
|
8418
8412
|
}
|
|
8419
|
-
function setChecked(key, isChecked, isBusiness = false) {
|
|
8413
|
+
function setChecked(key, isChecked, isBusiness = false, isForce = false) {
|
|
8420
8414
|
if (!tree || !isShowSelect(props))
|
|
8421
8415
|
return;
|
|
8422
8416
|
const { treeNodeMap, deviceMap, channelMap, teamMap, userMap, csMap } = tree;
|
|
8423
8417
|
if (!isBusiness || !props.business) {
|
|
8424
8418
|
const node = treeNodeMap.get(key);
|
|
8425
8419
|
if (node) {
|
|
8426
|
-
toggleCheckbox(node, isChecked, false);
|
|
8420
|
+
toggleCheckbox(node, isChecked, false, true, true, isForce);
|
|
8427
8421
|
}
|
|
8428
8422
|
return;
|
|
8429
8423
|
}
|
|
@@ -8454,10 +8448,10 @@ function useCheck(props, instance) {
|
|
|
8454
8448
|
for (const node of nodeList) {
|
|
8455
8449
|
if (!isShowSelect(props, node))
|
|
8456
8450
|
continue;
|
|
8457
|
-
toggleCheckbox(node, isChecked, false);
|
|
8451
|
+
toggleCheckbox(node, isChecked, false, true, false, isForce);
|
|
8458
8452
|
}
|
|
8459
8453
|
}
|
|
8460
|
-
function _setCheckedKeys(keys = [], isBusiness = false) {
|
|
8454
|
+
function _setCheckedKeys(keys = [], isBusiness = false, isForce = false) {
|
|
8461
8455
|
if (!tree)
|
|
8462
8456
|
return;
|
|
8463
8457
|
const { treeNodeMap, deviceMap, channelMap, teamMap, userMap, csMap } = tree;
|
|
@@ -8468,7 +8462,7 @@ function useCheck(props, instance) {
|
|
|
8468
8462
|
if (!isBusiness || !props.business) {
|
|
8469
8463
|
const node = treeNodeMap.get(key);
|
|
8470
8464
|
if (node && !isChecked(node) && isShowSelect(props, node)) {
|
|
8471
|
-
toggleCheckbox(node, true, false, false);
|
|
8465
|
+
toggleCheckbox(node, true, false, false, false, isForce);
|
|
8472
8466
|
}
|
|
8473
8467
|
continue;
|
|
8474
8468
|
}
|
|
@@ -8499,13 +8493,13 @@ function useCheck(props, instance) {
|
|
|
8499
8493
|
}
|
|
8500
8494
|
for (const node of nodeList) {
|
|
8501
8495
|
if (node && !isChecked(node) && isShowSelect(props, node)) {
|
|
8502
|
-
toggleCheckbox(node, true, false, false);
|
|
8496
|
+
toggleCheckbox(node, true, false, false, false, isForce);
|
|
8503
8497
|
}
|
|
8504
8498
|
}
|
|
8505
8499
|
}
|
|
8506
8500
|
updateCheckedKeys();
|
|
8507
8501
|
}
|
|
8508
|
-
function setCheckedNodes(data, isBusiness = false) {
|
|
8502
|
+
function setCheckedNodes(data, isBusiness = false, isForce = false) {
|
|
8509
8503
|
if (!Array.isArray(data)) {
|
|
8510
8504
|
console.warn('setCheckedNodes请传入数组');
|
|
8511
8505
|
return;
|
|
@@ -8516,9 +8510,9 @@ function useCheck(props, instance) {
|
|
|
8516
8510
|
if (type === 'radio' && data.length > 1) {
|
|
8517
8511
|
data = [data[0]];
|
|
8518
8512
|
}
|
|
8519
|
-
_setCheckedNodes(data, isBusiness);
|
|
8513
|
+
_setCheckedNodes(data, isBusiness, isForce);
|
|
8520
8514
|
}
|
|
8521
|
-
function _setCheckedNodes(data = [], isBusiness = false) {
|
|
8515
|
+
function _setCheckedNodes(data = [], isBusiness = false, isForce = false) {
|
|
8522
8516
|
if (tree) {
|
|
8523
8517
|
const { treeNodeMap, deviceMap, channelMap, teamMap, userMap, csMap } = tree;
|
|
8524
8518
|
if (!isShowSelect(props) || !treeNodeMap || !data.length)
|
|
@@ -8533,7 +8527,7 @@ function useCheck(props, instance) {
|
|
|
8533
8527
|
if (!isBusiness || !props.business) {
|
|
8534
8528
|
const node = treeNodeMap.get(key);
|
|
8535
8529
|
if (node && !isChecked(node) && isShowSelect(props, node)) {
|
|
8536
|
-
toggleCheckbox(node, true, false, false);
|
|
8530
|
+
toggleCheckbox(node, true, false, false, false, isForce);
|
|
8537
8531
|
}
|
|
8538
8532
|
continue;
|
|
8539
8533
|
}
|
|
@@ -8571,7 +8565,7 @@ function useCheck(props, instance) {
|
|
|
8571
8565
|
}
|
|
8572
8566
|
for (const node of nodeList) {
|
|
8573
8567
|
if (node && !isChecked(node) && isShowSelect(props, node)) {
|
|
8574
|
-
toggleCheckbox(node, true, false, false);
|
|
8568
|
+
toggleCheckbox(node, true, false, false, false, isForce);
|
|
8575
8569
|
}
|
|
8576
8570
|
}
|
|
8577
8571
|
}
|
|
@@ -9718,16 +9712,16 @@ class VirtualTree {
|
|
|
9718
9712
|
this.getCheckedKeys = getCheckedKeys;
|
|
9719
9713
|
this.getCheckedNodes = getCheckedNodes;
|
|
9720
9714
|
this.getCheckedBusinessNodes = getCheckedBusinessNodes;
|
|
9721
|
-
this.setChecked = (key, isChecked, isBusiness) => {
|
|
9722
|
-
setChecked(key, isChecked, isBusiness);
|
|
9715
|
+
this.setChecked = (key, isChecked, isBusiness, isForce) => {
|
|
9716
|
+
setChecked(key, isChecked, isBusiness, isForce);
|
|
9723
9717
|
this._refreshRender();
|
|
9724
9718
|
};
|
|
9725
|
-
this.setCheckedKeys = (keys, isBusiness) => {
|
|
9726
|
-
setCheckedKeys(keys, isBusiness);
|
|
9719
|
+
this.setCheckedKeys = (keys, isBusiness, isForce) => {
|
|
9720
|
+
setCheckedKeys(keys, isBusiness, isForce);
|
|
9727
9721
|
this._refreshRender();
|
|
9728
9722
|
};
|
|
9729
|
-
this.setCheckedNodes = (data, isBusiness) => {
|
|
9730
|
-
setCheckedNodes(data, isBusiness);
|
|
9723
|
+
this.setCheckedNodes = (data, isBusiness, isForce) => {
|
|
9724
|
+
setCheckedNodes(data, isBusiness, isForce);
|
|
9731
9725
|
this._refreshRender();
|
|
9732
9726
|
};
|
|
9733
9727
|
this.setRowSelection = (rowSelection) => {
|