@@ -72,8 +72,10 @@ define([
7272const VP_DS_DRAGGABLE = 'vp-ds-draggable' ;
7373
7474/** select btns */
75+ const VP_DS_SELECT_ADD_ALL_BTN = 'vp-ds-select-add-all-btn' ;
7576const VP_DS_SELECT_ADD_BTN = 'vp-ds-select-add-btn' ;
7677const VP_DS_SELECT_DEL_BTN = 'vp-ds-select-del-btn' ;
78+ const VP_DS_SELECT_DEL_ALL_BTN = 'vp-ds-select-del-all-btn' ;
7779
7880/** slicing box */
7981const VP_DS_SLICING_BOX = 'vp-ds-slicing-box' ;
@@ -509,8 +511,12 @@ define([
509511tag . appendLine ( '</div>' ) ; // VP_DS_SELECT_LEFT
510512// row select - buttons
511513tag . appendFormatLine ( '<div class="{0}">' , VP_DS_SELECT_BTN_BOX ) ;
514+ tag . appendFormatLine ( '<button type="button" class="{0} {1}" title="{2}">{3}</button>'
515+ , VP_DS_SELECT_ADD_ALL_BTN , 'select-row' , 'Add all items' , '<img src="/nbextensions/visualpython/resource/arrow_right_double.svg"/></i>' ) ;
512516tag . appendFormatLine ( '<button type="button" class="{0} {1}">{2}</button>' , VP_DS_SELECT_ADD_BTN , 'select-row' , '<img src="/nbextensions/visualpython/resource/arrow_right.svg"/>' ) ;
513517tag . appendFormatLine ( '<button type="button" class="{0} {1}">{2}</button>' , VP_DS_SELECT_DEL_BTN , 'select-row' , '<img src="/nbextensions/visualpython/resource/arrow_left.svg"/>' ) ;
518+ tag . appendFormatLine ( '<button type="button" class="{0} {1}" title="{2}">{3}</button>'
519+ , VP_DS_SELECT_DEL_ALL_BTN , 'select-row' , 'Remove all items' , '<img src="/nbextensions/visualpython/resource/arrow_left_double.svg"/>' ) ;
514520tag . appendLine ( '</div>' ) ; // VP_DS_SELECT_BTNS
515521// row select - right
516522tag . appendFormatLine ( '<div class="{0}">' , VP_DS_SELECT_RIGHT ) ;
@@ -612,8 +618,12 @@ define([
612618tag . appendLine ( '</div>' ) ; // VP_DS_SELECT_LEFT
613619// col select - buttons
614620tag . appendFormatLine ( '<div class="{0}">' , VP_DS_SELECT_BTN_BOX ) ;
621+ tag . appendFormatLine ( '<button type="button" class="{0} {1}" title="{2}">{3}</button>'
622+ , VP_DS_SELECT_ADD_ALL_BTN , 'select-col' , 'Add all items' , '<img src="/nbextensions/visualpython/resource/arrow_right_double.svg"/></i>' ) ;
615623tag . appendFormatLine ( '<button type="button" class="{0} {1}">{2}</button>' , VP_DS_SELECT_ADD_BTN , 'select-col' , '<img src="/nbextensions/visualpython/resource/arrow_right.svg"/></i>' ) ;
616624tag . appendFormatLine ( '<button type="button" class="{0} {1}">{2}</button>' , VP_DS_SELECT_DEL_BTN , 'select-col' , '<img src="/nbextensions/visualpython/resource/arrow_left.svg"/>' ) ;
625+ tag . appendFormatLine ( '<button type="button" class="{0} {1}" title="{2}">{3}</button>'
626+ , VP_DS_SELECT_DEL_ALL_BTN , 'select-col' , 'Remove all items' , '<img src="/nbextensions/visualpython/resource/arrow_left_double.svg"/>' ) ;
617627tag . appendLine ( '</div>' ) ; // VP_DS_SELECT_BTNS
618628// col select - right
619629tag . appendFormatLine ( '<div class="{0}">' , VP_DS_SELECT_RIGHT ) ;
@@ -1320,8 +1330,10 @@ define([
13201330$ ( document ) . off ( 'change' , this . wrapSelector ( '.select-row .' + VP_DS_SELECT_SEARCH ) ) ;
13211331$ ( document ) . off ( 'change' , this . wrapSelector ( '.select-col .' + VP_DS_SELECT_SEARCH ) ) ;
13221332$ ( document ) . off ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_ITEM ) ) ;
1333+ $ ( document ) . off ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_ADD_ALL_BTN ) ) ;
13231334$ ( document ) . off ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_ADD_BTN ) ) ;
13241335$ ( document ) . off ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_DEL_BTN ) ) ;
1336+ $ ( document ) . off ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_DEL_ALL_BTN ) ) ;
13251337$ ( document ) . off ( 'click' , this . wrapSelector ( '.vp-add-col' ) ) ;
13261338$ ( document ) . off ( 'click' , this . wrapSelector ( '.vp-del-col' ) ) ;
13271339$ ( document ) . off ( 'change' , this . wrapSelector ( '.vp-ds-slicing-box input[type="text"]' ) ) ;
@@ -1653,6 +1665,21 @@ define([
16531665}
16541666} ) ;
16551667
1668+ // item indexing - add all
1669+ $ ( document ) . on ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_ADD_ALL_BTN ) , function ( event ) {
1670+ var itemType = $ ( this ) . hasClass ( 'select-row' ) ?'row' :'col' ;
1671+ var selector = '.select-' + itemType ;
1672+
1673+ $ ( that . wrapSelector ( '.' + VP_DS_SELECT_BOX + '.left .' + VP_DS_SELECT_ITEM + selector ) ) . appendTo (
1674+ $ ( that . wrapSelector ( selector + ' .' + VP_DS_SELECT_BOX + '.right' ) )
1675+ ) ;
1676+ $ ( that . wrapSelector ( selector + ' .' + VP_DS_SELECT_BOX + ' .' + VP_DS_SELECT_ITEM ) ) . addClass ( 'added' ) ;
1677+ $ ( that . wrapSelector ( '.' + VP_DS_SELECT_ITEM + '.selected' ) ) . removeClass ( 'selected' ) ;
1678+ that . state [ itemType + 'Pointer' ] = { start :- 1 , end :- 1 } ;
1679+
1680+ that . generateCode ( ) ;
1681+ } ) ;
1682+
16561683// item indexing - add
16571684$ ( document ) . on ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_ADD_BTN ) , function ( event ) {
16581685var itemType = $ ( this ) . hasClass ( 'select-row' ) ?'row' :'col' ;
@@ -1691,6 +1718,28 @@ define([
16911718that . generateCode ( ) ;
16921719} ) ;
16931720
1721+ // item indexing - del all
1722+ $ ( document ) . on ( 'click' , this . wrapSelector ( '.' + VP_DS_SELECT_DEL_ALL_BTN ) , function ( event ) {
1723+ var itemType = $ ( this ) . hasClass ( 'select-row' ) ?'row' :'col' ;
1724+ var selector = '.select-' + itemType ;
1725+
1726+ var targetBoxQuery = that . wrapSelector ( selector + ' .' + VP_DS_SELECT_BOX + '.left' ) ;
1727+ $ ( that . wrapSelector ( selector + ' .' + VP_DS_SELECT_ITEM ) ) . appendTo (
1728+ $ ( targetBoxQuery )
1729+ ) ;
1730+ // sort
1731+ $ ( targetBoxQuery + ' .' + VP_DS_SELECT_ITEM ) . sort ( function ( a , b ) {
1732+ return ( $ ( b ) . data ( 'idx' ) ) < ( $ ( a ) . data ( 'idx' ) ) ?1 :- 1 ;
1733+ } ) . appendTo (
1734+ $ ( targetBoxQuery )
1735+ ) ;
1736+ $ ( that . wrapSelector ( selector + ' .' + VP_DS_SELECT_ITEM ) ) . removeClass ( 'added' ) ;
1737+ $ ( that . wrapSelector ( selector + ' .' + VP_DS_SELECT_ITEM ) ) . removeClass ( 'selected' ) ;
1738+ that . state [ itemType + 'Pointer' ] = { start :- 1 , end :- 1 } ;
1739+
1740+ that . generateCode ( ) ;
1741+ } ) ;
1742+
16941743// row-column condition add
16951744$ ( document ) . on ( 'click' , this . wrapSelector ( '.vp-add-col' ) , function ( event ) {
16961745that . handleColumnAdd ( ) ;
@@ -2122,7 +2171,7 @@ define([
21222171var rowList = [ ] ;
21232172for ( var i = 0 ; i < rowTags . length ; i ++ ) {
21242173var rowValue = $ ( rowTags [ i ] ) . data ( 'code' ) ;
2125- if ( rowValue ) {
2174+ if ( rowValue != undefined ) {
21262175rowList . push ( rowValue ) ;
21272176}
21282177}