@@ -85805,6 +85805,7 @@ var CONTROLS_KEYS = exports.CONTROLS_KEYS = {
8580585805 SOURCE_EXPAND_ALL: 'sourceExpandAll',
8580685806 DEPENDENCIES: 'dependencies',
8580785807 DEPENDENCIES_SHOW_ALL: 'dependenciesShowAll',
85808+ DEPENDENCIES_SHOW_ONE_MODULE: 'dependenciesShowOneModule',
8580885809 CODE_CRUMBS: 'codeCrumbs',
8580985810 CODE_CRUMBS_MINIMIZE: 'codeCrumbsMinimize',
8581085811 CODE_CRUMBS_DETAILS: 'codeCrumbsDetails'
@@ -85861,6 +85862,10 @@ var DefaultState = {
8586185862 title: 'Show All dependencies',
8586285863 key: _constants.CONTROLS_KEYS.DEPENDENCIES_SHOW_ALL,
8586385864 type: _constants.VIEW_TYPES.BUTTON
85865+ }, {
85866+ name: 'M',
85867+ title: 'Show One module dependencies',
85868+ key: _constants.CONTROLS_KEYS.DEPENDENCIES_SHOW_ONE_MODULE
8586485869 }]
8586585870 }, {
8586685871 name: 'CodeCrumbs',
@@ -86182,6 +86187,7 @@ exports.default = function () {
8618286187 switch (action.type) {
8618386188 case _constants2.ACTIONS.SET_INITIAL_SOURCE_DATA:
8618486189 return _extends({}, state, action.payload, {
86190+ dependenciesRootEntryPoint: action.payload.dependenciesList[0],
8618586191 firstLevelFolders: (0, _get2.default)(action.payload, 'filesTree.children', []).filter(function (item) {
8618686192 return item.type === _constants.DIR_NODE_TYPE;
8618786193 }).reduce(function (res, item) {
@@ -86512,6 +86518,7 @@ var mapStateToProps = function mapStateToProps(state) {
8651286518 return {
8651386519 sourceDiagramOn: checkedState.source,
8651486520 dependenciesDiagramOn: checkedState.dependencies,
86521+ dependenciesShowOneModule: checkedState.dependenciesShowOneModule,
8651586522 codeCrumbsDiagramOn: checkedState.codeCrumbs,
8651686523 codeCrumbsMinimize: checkedState.codeCrumbsMinimize,
8651786524 codeCrumbsDetails: checkedState.codeCrumbsDetails,
@@ -86935,29 +86942,66 @@ var DependenciesTree = function (_React$Component) {
8693586942 //move to utils
8693686943
8693786944 }, {
86938- key: 'drawTree',
86939- value: function drawTree() {
86940- var _this2 = this;
86941-
86945+ key: 'getFilteredDependenciesList',
86946+ value: function getFilteredDependenciesList() {
8694286947 var _props = this.props,
86943- primaryDraw = _props.primaryDraw,
86944- filesTreeLayoutNodes = _props.filesTreeLayoutNodes,
8694586948 dependenciesList = _props.dependenciesList,
8694686949 dependenciesEntryPoint = _props.dependenciesEntryPoint,
86947- shiftToCenterPoint = _props.shiftToCenterPoint,
86948- sourceDiagramOn = _props.sourceDiagramOn;
86950+ dependenciesShowOneModule = _props.dependenciesShowOneModule;
8694986951
8695086952
86951- var moduleFilesList = (0, _treeLayout.getFilesList)(filesTreeLayoutNodes);
86952- var filteredList = !dependenciesEntryPoint ? dependenciesList : dependenciesList.filter(function (d) {
86953- return d.moduleName === dependenciesEntryPoint.path;
86953+ var entryPoint = dependenciesEntryPoint || {
86954+ path: dependenciesList[0].moduleName
86955+ };
86956+
86957+ if (dependenciesShowOneModule) {
86958+ var entryModule = dependenciesList.find(function (d) {
86959+ return d.moduleName === entryPoint.path;
86960+ });
86961+ return [entryModule];
86962+ }
86963+
86964+ var dependenciesStore = [];
86965+ this.collectDependencies(entryPoint.path, dependenciesList, dependenciesStore);
86966+ return dependenciesStore;
86967+ }
86968+ }, {
86969+ key: 'collectDependencies',
86970+ value: function collectDependencies(entryModuleName, dependenciesList) {
86971+ var _this2 = this;
86972+
86973+ var store = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
86974+
86975+ var entryModule = dependenciesList.find(function (d) {
86976+ return d.moduleName === entryModuleName;
86977+ });
86978+
86979+ store.push(entryModule);
86980+
86981+ entryModule.importedModuleNames.forEach(function (name) {
86982+ return _this2.collectDependencies(name, dependenciesList, store);
8695486983 });
86984+ }
86985+ }, {
86986+ key: 'drawTree',
86987+ value: function drawTree() {
86988+ var _this3 = this;
86989+
86990+ var _props2 = this.props,
86991+ primaryDraw = _props2.primaryDraw,
86992+ filesTreeLayoutNodes = _props2.filesTreeLayoutNodes,
86993+ shiftToCenterPoint = _props2.shiftToCenterPoint,
86994+ sourceDiagramOn = _props2.sourceDiagramOn;
86995+
86996+
86997+ var moduleFilesList = (0, _treeLayout.getFilesList)(filesTreeLayoutNodes);
86998+ var filteredDependenciesList = this.getFilteredDependenciesList();
8695586999
86956- filteredList .forEach(function (_ref2) {
87000+ filteredDependenciesList .forEach(function (_ref2) {
8695787001 var moduleName = _ref2.moduleName,
8695887002 importedModuleNames = _ref2.importedModuleNames;
8695987003
86960- var moduleNode = _this2 .findNodeByPathName(moduleFilesList, moduleName);
87004+ var moduleNode = _this3 .findNodeByPathName(moduleFilesList, moduleName);
8696187005
8696287006 if (!moduleNode) return;
8696387007
@@ -86972,11 +87016,14 @@ var DependenciesTree = function (_React$Component) {
8697287016 y: mY,
8697387017 name: moduleNode.data.name
8697487018 });
86975- (0, _drawHelpers2.drawFileIcon)(primaryDraw, shiftToCenterPoint, { x: mX, y: mY });
87019+ (0, _drawHelpers2.drawFileIcon)(primaryDraw, shiftToCenterPoint, {
87020+ x: mX,
87021+ y: mY
87022+ });
8697687023 }
8697787024
8697887025 importedModuleNames.reduce(function (prevSource, name) {
86979- var importedNode = _this2 .findNodeByPathName(moduleFilesList, name);
87026+ var importedNode = _this3 .findNodeByPathName(moduleFilesList, name);
8698087027
8698187028 if (!importedNode) return;
8698287029
@@ -87602,6 +87649,7 @@ var TreeDiagram = function (_React$Component) {
8760287649 dependenciesEntryPoint = _props.dependenciesEntryPoint,
8760387650 sourceDiagramOn = _props.sourceDiagramOn,
8760487651 dependenciesDiagramOn = _props.dependenciesDiagramOn,
87652+ dependenciesShowOneModule = _props.dependenciesShowOneModule,
8760587653 codeCrumbsDiagramOn = _props.codeCrumbsDiagramOn,
8760687654 codeCrumbsMinimize = _props.codeCrumbsMinimize,
8760787655 codeCrumbsDetails = _props.codeCrumbsDetails,
@@ -87635,6 +87683,7 @@ var TreeDiagram = function (_React$Component) {
8763587683 dependenciesList: dependenciesList,
8763687684 filesTreeLayoutNodes: filesTreeLayoutNodes,
8763787685 dependenciesEntryPoint: dependenciesEntryPoint,
87686+ dependenciesShowOneModule: dependenciesShowOneModule,
8763887687 primaryLayer: this.dependenciesEdgesLayer
8763987688 }, sharedProps)),
8764087689 filesTreeLayoutNodes && codeCrumbsDiagramOn && _react2.default.createElement(_CodeCrumbsTree2.default, _extends({
@@ -88068,7 +88117,7 @@ function reactOnButtonAction(action) {
8806888117 }
8806988118
8807088119 _context2.next = 12;
88071- return (0, _effects.put)((0, _actions.setDependenciesEntryPoint)(null));
88120+ return (0, _effects.all)([(0, _effects. put)((0, _actions2.toggleSwitch)(_constants2.CONTROLS_KEYS.DEPENDENCIES_SHOW_ONE_MODULE)), (0, _effects.put)((0, _actions.setDependenciesEntryPoint)(null))] );
8807288121
8807388122 case 12:
8807488123 return _context2.abrupt('return', _context2.sent);
@@ -88115,14 +88164,42 @@ function reactOnToggledFolder(action) {
8811588164}
8811688165
8811788166function reactDependenciesEntryPointChange(action) {
88167+ var dependenciesRootEntryPoint, dependenciesShowOneModule, isRootPoint;
8811888168 return regeneratorRuntime.wrap(function reactDependenciesEntryPointChange$(_context4) {
8811988169 while (1) {
8812088170 switch (_context4.prev = _context4.next) {
8812188171 case 0:
88122- _context4.next = 2;
88123- return (0, _effects.put)((0, _actions2.setHiddenControl)(_constants2.CONTROLS_KEYS.DEPENDENCIES_SHOW_ALL, !action.payload));
88172+ if (action.payload) {
88173+ _context4.next = 4;
88174+ break;
88175+ }
8812488176
88125- case 2:
88177+ _context4.next = 3;
88178+ return (0, _effects.put)((0, _actions2.setHiddenControl)(_constants2.CONTROLS_KEYS.DEPENDENCIES_SHOW_ALL, true));
88179+
88180+ case 3:
88181+ return _context4.abrupt('return', _context4.sent);
88182+
88183+ case 4:
88184+ _context4.next = 6;
88185+ return (0, _effects.select)(function (state) {
88186+ return state.dataBus.dependenciesRootEntryPoint;
88187+ });
88188+
88189+ case 6:
88190+ dependenciesRootEntryPoint = _context4.sent;
88191+ _context4.next = 9;
88192+ return (0, _effects.select)(function (state) {
88193+ return state.viewSwitches.checkedState.dependenciesShowOneModule;
88194+ });
88195+
88196+ case 9:
88197+ dependenciesShowOneModule = _context4.sent;
88198+ isRootPoint = action.payload.path === dependenciesRootEntryPoint.moduleName;
88199+ _context4.next = 13;
88200+ return (0, _effects.put)((0, _actions2.setHiddenControl)(_constants2.CONTROLS_KEYS.DEPENDENCIES_SHOW_ALL, isRootPoint && !dependenciesShowOneModule));
88201+
88202+ case 13:
8812688203 case 'end':
8812788204 return _context4.stop();
8812888205 }
0 commit comments