Skip to content

Commit ff99abe

Browse files
author
minjk-bl
committed
Edit menu search box to show its category and Popup to show its category on the title
1 parent 060dc44 commit ff99abe

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

visualpython/js/MainFrame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@ define([
478478
let parentBlock = null;
479479
let prevBlock = null;
480480
loadStateList.forEach(obj => {
481-
let { blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
481+
let { file, blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
482482
// get OptionComponent Object
483483
// LAB: relative path needed
484-
let OptionComponent = require('./' + menuConfig.file);
484+
let OptionComponent = require('./' + file);
485485
if (OptionComponent) {
486486
let taskState = menuState.taskState;
487487
let blockState = menuState.blockState;

visualpython/js/com/component/PopupComponent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ define([
9292
this.id = this.state.config.id;
9393
this.name = this.state.config.name;
9494
this.path = this.state.config.path;
95+
this.category = this.state.config.category;
9596

9697

9798
this.config = {
@@ -530,7 +531,8 @@ define([
530531
template() {
531532
this.$pageDom = $(popupComponentHtml.replaceAll('${vp_base}', com_Const.BASE_PATH));
532533
// set title
533-
this.$pageDom.find('.vp-popup-title').text(this.name);
534+
// this.$pageDom.find('.vp-popup-title').text(this.category + ' > ' + this.name);
535+
this.$pageDom.find('.vp-popup-title').html(`<span style="color: var(--gray-color);font-size: 12px;">${this.category} > </span><span>${this.name}</span>`);
534536
// set body
535537
let bodyTemplate = this.templateForBody();
536538
// CHROME: check url keyword and replace it

visualpython/js/menu/MenuFrame.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,19 @@ define([
199199
return {};
200200
}
201201

202-
getMenuLibrary(menuId, libraries=this.menuLibraries) {
202+
getMenuLibrary(menuId, libraries=this.menuLibrariesFlatten) {
203203
for (var i=0; i < libraries.length; i++) {
204204
var item = libraries[i];
205205
if (item) {
206206
if (item.id === menuId) {
207207
return item;
208208
}
209-
if (item.type === 'package') {
210-
var result = this.getMenuLibrary(menuId, item.item);
211-
if (result) {
212-
return result;
213-
}
214-
}
209+
// if (item.type === 'package') {
210+
// var result = this.getMenuLibrary(menuId, item.item);
211+
// if (result) {
212+
// return result;
213+
// }
214+
// }
215215
}
216216
}
217217
return null;
@@ -243,7 +243,12 @@ define([
243243
var that = this;
244244
var body = group.getBody();
245245
var item = group.getItem();
246+
var state = group.getState();
246247
item && item.forEach(child => {
248+
// remember parent to navigate its parent menu
249+
var category = state.category?(state.category + ' > ' + state.name):state.name;
250+
child['category'] = category;
251+
247252
if (child.type == 'package') {
248253
// packages : MenuGroup
249254
var menuGroup = new MenuGroup($(body), child);
@@ -289,7 +294,7 @@ define([
289294
});
290295

291296
let functionList = this.menuLibrariesFlatten.map(menu => {
292-
return { label: menu.name, value: menu.name, ...menu }
297+
return { label: menu.name, value: menu.name, dtype: menu.category, ...menu }
293298
});
294299
// render searchbox
295300
let searchBox = new SuggestInput();

0 commit comments

Comments
 (0)