|
1 | 1 | import { version, gStyle, httpRequest, create, createHttpRequest, loadScript, loadModules, decodeUrl,
|
2 | 2 | source_dir, settings, internals, browser, findFunction, toJSON,
|
3 |
| - isArrayProto, isRootCollection, isBatchMode, isNodeJs, isObject, isFunc, isStr, _ensureJSROOT, |
| 3 | + isArrayProto, isRootCollection, isBatchMode, isNodeJs, isObject, isFunc, isStr, getPromise, _ensureJSROOT, |
4 | 4 | clTList, clTMap, clTObjString, clTKey, clTFile, clTText, clTLatex, clTColor, clTStyle,
|
5 | 5 | getKindForType, getTypeForKind, kInspect, isPromise } from '../core.mjs';
|
6 | 6 | import { select as d3_select } from '../d3.mjs';
|
@@ -1367,7 +1367,8 @@ class HierarchyPainter extends BasePainter {
|
1367 | 1367 |
|
1368 | 1368 | if (this.with_icons) {
|
1369 | 1369 | // in normal hierarchy check precisely if item can be expand
|
1370 |
| - if (!hitem._more && !hitem._expand && !this.canExpandItem(hitem)) return false; |
| 1370 | + if (!hitem._more && !hitem._expand && !this.canExpandItem(hitem)) |
| 1371 | + return false; |
1371 | 1372 | }
|
1372 | 1373 |
|
1373 | 1374 | const pr = this.expandItem(this.itemFullName(hitem));
|
@@ -1694,10 +1695,13 @@ class HierarchyPainter extends BasePainter {
|
1694 | 1695 | }
|
1695 | 1696 | }
|
1696 | 1697 |
|
1697 |
| - if (hitem._childs) can_expand = false; |
| 1698 | + if (hitem._childs) |
| 1699 | + can_expand = false; |
1698 | 1700 |
|
1699 |
| - if (can_draw === undefined) can_draw = sett.draw; |
1700 |
| - if (can_expand === undefined) can_expand = sett.expand || sett.get_expand; |
| 1701 | + if (can_draw === undefined) |
| 1702 | + can_draw = sett.draw; |
| 1703 | + if (can_expand === undefined) |
| 1704 | + can_expand = sett.expand || sett.get_expand; |
1701 | 1705 |
|
1702 | 1706 | if (can_draw && can_expand && !drawopt) {
|
1703 | 1707 | // if default action specified as expand, disable drawing
|
@@ -2650,8 +2654,10 @@ class HierarchyPainter extends BasePainter {
|
2650 | 2654 | /** @summary Check if item can be (potentially) expand
|
2651 | 2655 | * @private */
|
2652 | 2656 | canExpandItem(item) {
|
2653 |
| - if (!item) return false; |
2654 |
| - if (item._expand) return true; |
| 2657 | + if (!item) |
| 2658 | + return false; |
| 2659 | + if (item._expand) |
| 2660 | + return true; |
2655 | 2661 | const handle = getDrawHandle(item._kind, '::expand');
|
2656 | 2662 | return handle && canExpandHandle(handle);
|
2657 | 2663 | }
|
@@ -2696,15 +2702,18 @@ class HierarchyPainter extends BasePainter {
|
2696 | 2702 |
|
2697 | 2703 | // try to use expand function
|
2698 | 2704 | if (_obj && isFunc(_item._expand)) {
|
2699 |
| - if (_item._expand(_item, _obj)) { |
2700 |
| - _item._isopen = true; |
2701 |
| - if (_item._parent && !_item._parent._isopen) { |
2702 |
| - _item._parent._isopen = true; // also show parent |
2703 |
| - if (!silent) |
2704 |
| - hpainter.updateTreeNode(_item._parent); |
2705 |
| - } else if (!silent) |
2706 |
| - hpainter.updateTreeNode(_item, d3cont); |
2707 |
| - return _item; |
| 2705 | + const res = _item._expand(_item, _obj); |
| 2706 | + if (res) { |
| 2707 | + return getPromise(res).then(() => { |
| 2708 | + _item._isopen = true; |
| 2709 | + if (_item._parent && !_item._parent._isopen) { |
| 2710 | + _item._parent._isopen = true; // also show parent |
| 2711 | + if (!silent) |
| 2712 | + hpainter.updateTreeNode(_item._parent); |
| 2713 | + } else if (!silent) |
| 2714 | + hpainter.updateTreeNode(_item, d3cont); |
| 2715 | + return _item; |
| 2716 | + }); |
2708 | 2717 | }
|
2709 | 2718 | }
|
2710 | 2719 |
|
|
0 commit comments