Skip to content

Commit 7c2e35c

Browse files
author
hikki
committed
选择标识
1 parent 8cec423 commit 7c2e35c

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

resources/assets/component.js

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class ComponentCascadeDot {
401401
let data = this.dimensional_data[stack][k];
402402
let currentStackDocuments = this.STACKS[stack].childNodes;
403403
let parentNode = data.parentNodes[data.parentNodes.length - 1];
404-
if (data.checked === true){
404+
if (data.checked === true) {
405405
data.checked = false;
406406
this.tagCal(id, this.MODE.delete);
407407
element.querySelector('i.right') !== null && element.removeChild(element.querySelector('i.right'));
@@ -411,17 +411,15 @@ class ComponentCascadeDot {
411411
break;
412412
}
413413
}
414-
}else {
415-
this.dimensional_data[stack].forEach((D, index) => {
416-
if (D.parentNodes.indexOf(parentNode) !== -1) {
414+
} else {
415+
this.dimensional_data[stack].forEach((data, index) => {
416+
if (data.parentNodes.indexOf(parentNode) !== -1) {
417417
currentStackDocuments[index].classList.remove('dlp-label-silence');
418418
} else {
419419
currentStackDocuments[index].classList.add('dlp-label-silence');
420420
}
421-
if (D.expand === true) {
422-
data.expand = false;
423-
this.expand(currentStackDocuments[index],data.expand);
424-
}
421+
data.expand = false;
422+
this.expand(currentStackDocuments[index], data.expand);
425423
});
426424
if (data.checked === false) {
427425
data.checked = true;
@@ -434,7 +432,7 @@ class ComponentCascadeDot {
434432
} else {
435433
element.classList.remove('dlp-label-silence');
436434
data.expand = true;
437-
this.expand(element,data.expand);
435+
this.expand(element, data.expand);
438436
this.selectToChildren(stack + 1, data.nodes);
439437
}
440438
}
@@ -470,20 +468,20 @@ class ComponentCascadeDot {
470468
if (parents.length > 0 && (parents[stack - 1] !== parentNode)) {
471469
D.classList.add('dlp-label-silence');
472470
data.expand = false;
473-
this.expand(D,data.expand);
471+
this.expand(D, data.expand);
474472
} else if (parents.length === 0 && parseInt(D.getAttribute('data-id')) !== node) {
475473
D.classList.add('dlp-label-silence');
476474
data.expand = false;
477-
this.expand(D,data.expand);
475+
this.expand(D, data.expand);
478476
} else {
479477
D.classList.remove('dlp-label-silence');
480478
if (parseInt(D.getAttribute('data-id')) === node) {
481479
if (to_first_index === null) to_first_index = index;
482480
data.expand = true;
483-
this.expand(D,data.expand);
481+
this.expand(D, data.expand);
484482
} else if (data.expand === true) {
485483
data.expand = false;
486-
this.expand(D,data.expand);
484+
this.expand(D, data.expand);
487485
}
488486
}
489487
}
@@ -532,20 +530,24 @@ class ComponentCascadeDot {
532530
});
533531
}
534532
if (to_first_index === null) to_first_index = index;
533+
if (data.expand !== true) {
534+
data.expand = true;
535+
this.expand(D, data.expand);
536+
}
535537
} else {
536538
D.classList.add('dlp-label-silence');
537539
if (data.expand === true) {
538540
data.expand = false;
539-
this.expand(D,data.expand);
541+
this.expand(D, data.expand);
540542
}
541543
}
542544
});
543545
if (to_first_index !== null) this.STACKS[stack].scrollTop = to_first_index * 27;
544546
this.selectToChildren(stack + 1, children);
545547
}
546548

547-
expand(dom,open=true){
548-
if(open) {
549+
expand(dom, open = true) {
550+
if (open) {
549551
let left_mark = dom.querySelector('i.left');
550552
if (left_mark) left_mark.innerHTML = _component.caret_right_circle;
551553
return;
@@ -1180,11 +1182,12 @@ class ComponentCascadeLine {
11801182
let currentStackDocuments = this.STACKS[stack].childNodes;
11811183
let parentNode = data.parentNodes[data.parentNodes.length - 1];
11821184

1183-
currentStackDocuments.forEach((D, index) => {
1184-
if (this.dimensional_data[stack][index].parentNodes.indexOf(parentNode) !== -1) {
1185-
currentStackDocuments[index].classList.remove('dlp-label-silence');
1185+
this.dimensional_data[stack].forEach((data, index) => {
1186+
let D = currentStackDocuments[index];
1187+
if (data.parentNodes.indexOf(parentNode) !== -1) {
1188+
D.classList.remove('dlp-label-silence');
11861189
} else {
1187-
currentStackDocuments[index].classList.add('dlp-label-silence');
1190+
D.classList.add('dlp-label-silence');
11881191
}
11891192
});
11901193
if (data.checked === false) {
@@ -1207,8 +1210,8 @@ class ComponentCascadeLine {
12071210
let parentNode = nodes[stack - 1];
12081211
let currentStackDocuments = this.STACKS[stack].childNodes;
12091212
let to_first_index = null;
1210-
currentStackDocuments.forEach((D, index) => {
1211-
let data = this.dimensional_data[stack][index];
1213+
this.dimensional_data[stack].forEach((data, index) => {
1214+
let D = currentStackDocuments[index];
12121215
let parents = data.parentNodes;
12131216
if (parents.length > 0 && (parents[stack - 1] !== parentNode)) {
12141217
D.classList.add('dlp-label-silence');
@@ -1230,7 +1233,8 @@ class ComponentCascadeLine {
12301233
let currentStackDocuments = this.STACKS[stack].childNodes;
12311234
let children = [];
12321235
let to_first_index = null;
1233-
currentStackDocuments.forEach((D, index) => {
1236+
this.dimensional_data[stack].forEach((data, index) => {
1237+
let D = currentStackDocuments[index];
12341238
if (nodes === null) {
12351239
D.classList.add('dlp-label-silence');
12361240
return;
@@ -1246,9 +1250,23 @@ class ComponentCascadeLine {
12461250
if (to_first_index === null) to_first_index = index;
12471251
} else {
12481252
D.classList.add('dlp-label-silence');
1253+
if (data.expand === true) {
1254+
data.expand = false;
1255+
this.expand(D, data.expand);
1256+
}
12491257
}
12501258
});
12511259
if (to_first_index !== null) this.STACKS[stack].scrollTop = to_first_index * 27;
12521260
this.selectToChildren(stack + 1, children);
12531261
}
1262+
1263+
expand(dom, open = true) {
1264+
if (open) {
1265+
let left_mark = dom.querySelector('i.left');
1266+
if (left_mark) left_mark.innerHTML = _component.caret_right_circle;
1267+
return;
1268+
}
1269+
let left_mark = dom.querySelector('i.left');
1270+
if (left_mark) left_mark.innerHTML = _component.caret_right;
1271+
}
12541272
}

0 commit comments

Comments
 (0)