Skip to content

Devops for v2.3.2 #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jupyterlab/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9,160 changes: 4,592 additions & 4,568 deletions jupyterlab/yarn.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion visualpython/css/component/dataSelector.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
.vp-ds-df-option-box {
height: 100%;
}
.vp-ds-df-multiselector {
.vp-ds-df-multiselector,
.vp-ds-df-index-box {
height: calc(100% - 25px);
}
.vp-nd-row-box,
Expand Down
11 changes: 11 additions & 0 deletions visualpython/css/component/multiSelector.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,21 @@
background: #FFFFFF;
border: 0.25px solid #E4E4E4;
border-radius: 3px;
cursor: pointer;
}
.vp-cs-select-btn-box button:not(:nth-child(1)) {
margin-top: 5px;
}
.vp-cs-select-btn-box button:hover {
background: #F8F8F8;
}
.vp-cs-add-item-name {
padding-right: 25px;
}
.vp-cs-add-item-btn {
display: inline-block;
position: absolute;
right: 35px;
bottom: 63px;
cursor: pointer;
}
3 changes: 3 additions & 0 deletions visualpython/css/mainFrame.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ div#vp_wrapper.colab * {
height: 100% !important;
min-width: 273px !important;
}
#vp_wrapper.lab * {
box-sizing: border-box !important;
}

/* resizing handle */
#vp_wrapper > .ui-resizable-handle {
Expand Down
1 change: 0 additions & 1 deletion visualpython/html/component/dataSelector.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

</div>
</div>
<hr style="margin: 0px;"/>
<div class="vp-ds-option-box">
<label class="vp-bold">Option Page</label>
<div class="vp-ds-option-inner-box">
Expand Down
10 changes: 5 additions & 5 deletions visualpython/js/com/component/DataSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ define([
<div class="vp-ds-df-multiselector" ${this.state.useIndex===true?'style="display:none;"':''}>
</div>
<div class="vp-ds-df-index-box" ${this.state.useIndex===false?'style="display:none;"':''}>
<div><label>Index selected.</label>
<div style="height:100%;"><label>Index selected.</label>
<div class="vp-cs-select-container no-selection">
<div class="vp-cs-select-left">
<input type="text" class="vp-input wp100" placeholder="Search" value="" readonly>
Expand All @@ -384,9 +384,9 @@ define([
-->
<!-- LAB: img to url -->
<button type="button" class="vp-cs-select-add-all-btn" title="Add all items"><div class="vp-icon-arrow-right-double"></div></button>
<button type="button" class="vp-cs-select-add-btn vp-icon-arrow-right" title="Add selected items"><div class="vp-icon-arrow-right"></div></button>
<button type="button" class="vp-cs-select-del-btn vp-icon-arrow-left" title="Remove selected items"><div class="vp-icon-arrow-left"></div></button>
<button type="button" class="vp-cs-select-del-all-btn vp-icon-arrow-left-double" title="Remove all items"><div class="vp-icon-arrow-left-double"></div></button>
<button type="button" class="vp-cs-select-add-btn" title="Add selected items"><div class="vp-icon-arrow-right"></div></button>
<button type="button" class="vp-cs-select-del-btn" title="Remove selected items"><div class="vp-icon-arrow-left"></div></button>
<button type="button" class="vp-cs-select-del-all-btn" title="Remove all items"><div class="vp-icon-arrow-left-double"></div></button>
</div>
<div class="vp-cs-select-right">
<div class="vp-cs-select-box right vp-cs-droppable no-selection vp-scrollbar ui-droppable">
Expand Down Expand Up @@ -548,7 +548,7 @@ define([
$(this.wrapSelector('.vp-ds-option-inner-box')).html(this.templateForMultiSelector());
// column selecting
this._columnSelector = new MultiSelector(this.wrapSelector('.vp-ds-df-multiselector'),
{ mode: 'columns', parent: [data], selectedList: this.state.indexing }
{ mode: 'columns', parent: [data], selectedList: this.state.indexing, allowAdd: true }
);

// bind event
Expand Down
81 changes: 78 additions & 3 deletions visualpython/js/com/component/MultiSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ define([
/**
*
* @param {string} frameSelector query for parent component
* @param {Object} config parent:[], selectedList=[], includeList=[]
* @param {Object} config parent:[], selectedList=[], includeList=[], excludeList=[], allowAdd=true/false
*/
constructor(frameSelector, config) {
super(frameSelector, config, {});
Expand All @@ -62,12 +62,13 @@ define([
// configuration
this.config = this.state;

var { mode, type, parent, dataList=[], selectedList=[], includeList=[], excludeList=[] } = this.config;
var { mode, type, parent, dataList=[], selectedList=[], includeList=[], excludeList=[], allowAdd=false } = this.config;
this.mode = mode; // variable / columns / index / ndarray0 / ndarray1 / methods / data(given data)
this.parent = parent;
this.selectedList = selectedList;
this.includeList = includeList;
this.excludeList = excludeList;
this.allowAdd = allowAdd;

this.dataList = dataList; // [ { value, code, type }, ... ]
this.pointer = { start: -1, end: -1 };
Expand Down Expand Up @@ -305,6 +306,11 @@ define([
tag.appendFormatLine('<div class="{0}">', APP_SELECT_RIGHT);
var selectedList = this.dataList.filter(data => that.selectedList.includes(data.code));
tag.appendLine(this.renderSelectedBox(selectedList));
if (this.allowAdd) {
// add item
tag.appendLine('<input type="text" class="vp-cs-add-item-name vp-input wp100" placeholder="New item to add" value="">');
tag.appendLine('<div class="vp-cs-add-item-btn vp-icon-plus"></div>');
}
tag.appendLine('</div>'); // APP_SELECT_RIGHT
tag.appendLine('</div>'); // APP_SELECT_CONTAINER
return tag.toString();
Expand Down Expand Up @@ -360,7 +366,7 @@ define([
var addedTags = $(that.wrapSelector('.' + APP_SELECT_RIGHT + ' .' + APP_SELECT_ITEM + '.added'));
var addedList = [];
for (var i = 0; i < addedTags.length; i++) {
var value = $(addedTags[i]).attr('data-colname');
var value = $(addedTags[i]).attr('data-name');
addedList.push(value);
}
var filteredList = that.dataList.filter(x => x.value.includes(searchValue) && !addedList.includes(x.value));
Expand Down Expand Up @@ -488,6 +494,75 @@ define([
$(that.wrapSelector('.' + APP_SELECT_ITEM + '.selected')).removeClass('selected');
that.pointer = { start: -1, end: -1 };
});

// add new item
$(this.wrapSelector('.vp-cs-add-item-btn')).on('click', function(event) {
let newItemName = $(that.wrapSelector('.vp-cs-add-item-name')).val();
that._addNewItem(newItemName);
});
// add new item (by pushing enter key)
$(this.wrapSelector('.vp-cs-add-item-name')).on('keyup', function(event) {
var keycode = event.keyCode
? event.keyCode
: event.which;
if (keycode == 13) { // enter
let newItemName = $(this).val();
that._addNewItem(newItemName);
}
});
}

_addNewItem(newItemName) {
if (newItemName && newItemName !== '') {
// check if it is already exist
// - if it is already added, just select that item
// get added items
var addedTags = $(this.wrapSelector('.' + APP_SELECT_RIGHT + ' .' + APP_SELECT_ITEM + '.added'));
var addedList = [];
for (var i = 0; i < addedTags.length; i++) {
var value = $(addedTags[i]).attr('data-name');
addedList.push(value);
}
if (addedList.includes(newItemName)) {
// just select that item and do nothing
var targetTag = $(this.wrapSelector(`.vp-cs-select-item.added[data-name="${newItemName}"]`));
this.pointer = { start: targetTag.index(), end: -1 };
// un-select others
$(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected');
targetTag.addClass('selected');
return;
}
var filteredList = this.dataList.filter(x => x.value === newItemName);
if (filteredList.length > 0) {
// already exist -> move it to selected-box
var targetTag = $(this.wrapSelector(`.vp-cs-select-item[data-name="${newItemName}"]`));
$(targetTag).appendTo(
$(this.wrapSelector('.' + APP_SELECT_BOX + '.right'))
);
this.pointer = { start: targetTag.index(), end: -1 };
// un-select others
$(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected');
targetTag.addClass('added');
targetTag.addClass('selected');
return;
}

// add item
let newItemIndex = this.dataList.length;
var targetTag = $(`<div class="${APP_SELECT_ITEM} ${APP_DRAGGABLE} added selected" data-idx="${newItemIndex}" data-name="${newItemName}" data-type="object" data-code="'${newItemName}'" title="${newItemName}: Added manually">
<span>${newItemName}</span>
</div>`);
$(targetTag).appendTo(
$(this.wrapSelector('.' + APP_SELECT_BOX + '.right'))
);
this.pointer = { start: targetTag.index(), end: -1 };
// un-select others
$(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected');
// clear item input
$(this.wrapSelector('.vp-cs-add-item-name')).val('');
// bind draggable
this.bindDraggable();
}
}

bindDraggable() {
Expand Down
2 changes: 1 addition & 1 deletion visualpython/js/m_apps/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ define([

// CHROME: TODO: 4: marked is not loaded, before fix it comment it
if (vpConfig.extensionType === 'notebook') {
var marked = require('components/marked/lib/marked');
var marked = window.require('components/marked/lib/marked');
var renderer = new marked.Renderer();

// get block
Expand Down
8 changes: 4 additions & 4 deletions visualpython/js/m_apps/Subset.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,13 +467,13 @@ define([
// tag.appendFormatLine('<button type="button" class="{0} {1}" title="{2}"><img src="{3}"/></button>',
// VP_DS_SELECT_DEL_ALL_BTN, 'select-col', 'Remove all items', com_Const.IMAGE_PATH + 'arrow_left_double.svg');
tag.appendFormatLine('<button type="button" class="{0} {1}" title="{2}"><div class="vp-icon-arrow-right-double"></div></button>',
VP_DS_SELECT_ADD_ALL_BTN, 'select-row', 'Add all items');
VP_DS_SELECT_ADD_ALL_BTN, 'select-col', 'Add all items');
tag.appendFormatLine('<button type="button" class="{0} {1}"><div class="vp-icon-arrow-right"></div></button>',
VP_DS_SELECT_ADD_BTN, 'select-row');
VP_DS_SELECT_ADD_BTN, 'select-col');
tag.appendFormatLine('<button type="button" class="{0} {1}"><div class="vp-icon-arrow-left"></div></button>',
VP_DS_SELECT_DEL_BTN, 'select-row');
VP_DS_SELECT_DEL_BTN, 'select-col');
tag.appendFormatLine('<button type="button" class="{0} {1}" title="{2}"><div class="vp-icon-arrow-left-double"></div></button>',
VP_DS_SELECT_DEL_ALL_BTN, 'select-row', 'Remove all items');
VP_DS_SELECT_DEL_ALL_BTN, 'select-col', 'Remove all items');
tag.appendLine('</div>'); // VP_DS_SELECT_BTNS

// col select - right
Expand Down