lexgui 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/codeeditor.js +49 -19
- package/build/components/timeline.js +14 -7
- package/build/lexgui.css +27 -5
- package/build/lexgui.js +232 -64
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +254 -86
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +44 -1
- package/demo.js +2 -2
- package/examples/all_widgets.html +5 -4
- package/examples/editor.html +18 -16
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// This is a generated file. Do not edit.
|
|
1
|
+
// This is a generated file. Do not edit.
|
|
2
2
|
// Lexgui.js @jxarco
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const LX = {
|
|
10
|
-
version: "0.6.
|
|
10
|
+
version: "0.6.9",
|
|
11
11
|
ready: false,
|
|
12
12
|
components: [], // Specific pre-build components
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -4113,8 +4113,8 @@ Element.prototype.ignore = function( eventName, callbackName ) {
|
|
|
4113
4113
|
callbackName = callbackName ?? ( "_on" + eventName );
|
|
4114
4114
|
const callback = this[ callbackName ];
|
|
4115
4115
|
this.removeEventListener( eventName, callback );
|
|
4116
|
-
};
|
|
4117
|
-
|
|
4116
|
+
};
|
|
4117
|
+
|
|
4118
4118
|
// icons.js @jxarco
|
|
4119
4119
|
|
|
4120
4120
|
const RAW_ICONS = {
|
|
@@ -4292,8 +4292,8 @@ LX.LucideIconAlias = {
|
|
|
4292
4292
|
"RotateRight": "RotateCw",
|
|
4293
4293
|
"RotateBack": "RotateCcw",
|
|
4294
4294
|
"RotateLeft": "RotateCcw",
|
|
4295
|
-
};
|
|
4296
|
-
|
|
4295
|
+
};
|
|
4296
|
+
|
|
4297
4297
|
// utils.js @jxarco
|
|
4298
4298
|
|
|
4299
4299
|
function clamp( num, min, max ) { return Math.min( Math.max( num, min ), max ); }
|
|
@@ -5070,7 +5070,7 @@ LX.makeCodeSnippet = makeCodeSnippet;
|
|
|
5070
5070
|
* @param {Array} keys
|
|
5071
5071
|
* @param {String} extraClass
|
|
5072
5072
|
*/
|
|
5073
|
-
function makeKbd( keys, extraClass = "" )
|
|
5073
|
+
function makeKbd( keys, useSpecialKeys = true, extraClass = "" )
|
|
5074
5074
|
{
|
|
5075
5075
|
const specialKeys = {
|
|
5076
5076
|
"Ctrl": '⌃',
|
|
@@ -5092,7 +5092,7 @@ function makeKbd( keys, extraClass = "" )
|
|
|
5092
5092
|
|
|
5093
5093
|
for( const k of keys )
|
|
5094
5094
|
{
|
|
5095
|
-
LX.makeContainer( ["auto", "auto"], "self-center text-xs fg-secondary select-none", specialKeys[ k ] ?? k, kbd );
|
|
5095
|
+
LX.makeContainer( ["auto", "auto"], "self-center text-xs fg-secondary select-none " + extraClass, useSpecialKeys ? specialKeys[ k ] ?? k : k, kbd );
|
|
5096
5096
|
}
|
|
5097
5097
|
|
|
5098
5098
|
return kbd;
|
|
@@ -6009,8 +6009,8 @@ function drawSpline( ctx, pts, t )
|
|
|
6009
6009
|
ctx.restore();
|
|
6010
6010
|
}
|
|
6011
6011
|
|
|
6012
|
-
LX.drawSpline = drawSpline;
|
|
6013
|
-
|
|
6012
|
+
LX.drawSpline = drawSpline;
|
|
6013
|
+
|
|
6014
6014
|
// area.js @jxarco
|
|
6015
6015
|
|
|
6016
6016
|
class Area {
|
|
@@ -6425,16 +6425,15 @@ class Area {
|
|
|
6425
6425
|
if( auto && type == "vertical" )
|
|
6426
6426
|
{
|
|
6427
6427
|
// Listen resize event on first area
|
|
6428
|
-
|
|
6428
|
+
this._autoVerticalResizeObserver = new ResizeObserver( entries => {
|
|
6429
6429
|
for ( const entry of entries )
|
|
6430
6430
|
{
|
|
6431
6431
|
const size = entry.target.getComputedSize();
|
|
6432
6432
|
area2.root.style.height = "calc(100% - " + ( size.height ) + "px )";
|
|
6433
6433
|
}
|
|
6434
|
-
resizeObserver.disconnect();
|
|
6435
6434
|
});
|
|
6436
6435
|
|
|
6437
|
-
|
|
6436
|
+
this._autoVerticalResizeObserver.observe( area1.root );
|
|
6438
6437
|
}
|
|
6439
6438
|
|
|
6440
6439
|
// Being minimizable means it's also resizeable!
|
|
@@ -6799,6 +6798,7 @@ class Area {
|
|
|
6799
6798
|
this.attach( container );
|
|
6800
6799
|
|
|
6801
6800
|
const float = options.float;
|
|
6801
|
+
let floatClass = "";
|
|
6802
6802
|
|
|
6803
6803
|
if( float )
|
|
6804
6804
|
{
|
|
@@ -6808,15 +6808,17 @@ class Area {
|
|
|
6808
6808
|
switch( t )
|
|
6809
6809
|
{
|
|
6810
6810
|
case 'h': break;
|
|
6811
|
-
case 'v':
|
|
6811
|
+
case 'v': floatClass += " vertical"; break;
|
|
6812
6812
|
case 't': break;
|
|
6813
|
-
case 'm':
|
|
6814
|
-
case 'b':
|
|
6813
|
+
case 'm': floatClass += " middle"; break;
|
|
6814
|
+
case 'b': floatClass += " bottom"; break;
|
|
6815
6815
|
case 'l': break;
|
|
6816
|
-
case 'c':
|
|
6817
|
-
case 'r':
|
|
6816
|
+
case 'c': floatClass += " center"; break;
|
|
6817
|
+
case 'r': floatClass += " right"; break;
|
|
6818
6818
|
}
|
|
6819
6819
|
}
|
|
6820
|
+
|
|
6821
|
+
container.className += ` ${ floatClass }`;
|
|
6820
6822
|
}
|
|
6821
6823
|
|
|
6822
6824
|
const _addButton = function( b, group, last ) {
|
|
@@ -6891,6 +6893,15 @@ class Area {
|
|
|
6891
6893
|
|
|
6892
6894
|
for( let b of buttons )
|
|
6893
6895
|
{
|
|
6896
|
+
if( b === null )
|
|
6897
|
+
{
|
|
6898
|
+
// Add a separator
|
|
6899
|
+
const separator = document.createElement("div");
|
|
6900
|
+
separator.className = "lexoverlayseparator" + floatClass;
|
|
6901
|
+
overlayPanel.root.appendChild( separator );
|
|
6902
|
+
continue;
|
|
6903
|
+
}
|
|
6904
|
+
|
|
6894
6905
|
if( b.constructor === Array )
|
|
6895
6906
|
{
|
|
6896
6907
|
for( let i = 0; i < b.length; ++i )
|
|
@@ -6956,6 +6967,12 @@ class Area {
|
|
|
6956
6967
|
return;
|
|
6957
6968
|
}
|
|
6958
6969
|
|
|
6970
|
+
// When manual resizing, we don't need the observer anymore
|
|
6971
|
+
if( this._autoVerticalResizeObserver )
|
|
6972
|
+
{
|
|
6973
|
+
this._autoVerticalResizeObserver.disconnect();
|
|
6974
|
+
}
|
|
6975
|
+
|
|
6959
6976
|
const a1 = this.sections[ 0 ];
|
|
6960
6977
|
var a1Root = a1.root;
|
|
6961
6978
|
|
|
@@ -7060,8 +7077,8 @@ class Area {
|
|
|
7060
7077
|
}
|
|
7061
7078
|
}
|
|
7062
7079
|
}
|
|
7063
|
-
LX.Area = Area;
|
|
7064
|
-
|
|
7080
|
+
LX.Area = Area;
|
|
7081
|
+
|
|
7065
7082
|
// widget.js @jxarco
|
|
7066
7083
|
|
|
7067
7084
|
/**
|
|
@@ -7376,7 +7393,7 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7376
7393
|
|
|
7377
7394
|
LX.Panel.prototype[ 'add' + customWidgetName ] = function( name, instance, callback ) {
|
|
7378
7395
|
|
|
7379
|
-
|
|
7396
|
+
const userParams = Array.from( arguments ).slice( 3 );
|
|
7380
7397
|
|
|
7381
7398
|
let widget = new Widget( Widget.CUSTOM, name, null, options );
|
|
7382
7399
|
this._attachWidget( widget );
|
|
@@ -7398,6 +7415,11 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7398
7415
|
}
|
|
7399
7416
|
};
|
|
7400
7417
|
|
|
7418
|
+
widget.onResize = ( rect ) => {
|
|
7419
|
+
const realNameWidth = ( widget.root.domName?.style.width ?? "0px" );
|
|
7420
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7421
|
+
};
|
|
7422
|
+
|
|
7401
7423
|
const element = widget.root;
|
|
7402
7424
|
|
|
7403
7425
|
let container, customWidgetsDom;
|
|
@@ -7411,8 +7433,7 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7411
7433
|
if( customWidgetsDom ) customWidgetsDom.remove();
|
|
7412
7434
|
|
|
7413
7435
|
container = document.createElement('div');
|
|
7414
|
-
container.className = "lexcustomcontainer";
|
|
7415
|
-
container.style.width = "100%";
|
|
7436
|
+
container.className = "lexcustomcontainer w-full";
|
|
7416
7437
|
element.appendChild( container );
|
|
7417
7438
|
element.dataset["opened"] = false;
|
|
7418
7439
|
|
|
@@ -7536,6 +7557,11 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7536
7557
|
}
|
|
7537
7558
|
}
|
|
7538
7559
|
|
|
7560
|
+
if( options.onCreate )
|
|
7561
|
+
{
|
|
7562
|
+
options.onCreate.call( this, this, ...userParams );
|
|
7563
|
+
}
|
|
7564
|
+
|
|
7539
7565
|
this.clearQueue();
|
|
7540
7566
|
}
|
|
7541
7567
|
};
|
|
@@ -7601,9 +7627,9 @@ class NodeTree {
|
|
|
7601
7627
|
|
|
7602
7628
|
if( this.options.onlyFolders )
|
|
7603
7629
|
{
|
|
7604
|
-
let
|
|
7605
|
-
node.children.forEach( c =>
|
|
7606
|
-
isParent = !!
|
|
7630
|
+
let hasFolders = false;
|
|
7631
|
+
node.children.forEach( c => hasFolders |= (c.type == 'folder') );
|
|
7632
|
+
isParent = !!hasFolders;
|
|
7607
7633
|
}
|
|
7608
7634
|
|
|
7609
7635
|
let item = document.createElement('li');
|
|
@@ -7768,23 +7794,15 @@ class NodeTree {
|
|
|
7768
7794
|
} );
|
|
7769
7795
|
|
|
7770
7796
|
event.panel.add( "Delete", { callback: () => {
|
|
7771
|
-
// It's the root node
|
|
7772
|
-
if( !node.parent )
|
|
7773
|
-
{
|
|
7774
|
-
return;
|
|
7775
|
-
}
|
|
7776
7797
|
|
|
7777
|
-
|
|
7798
|
+
const ok = that.deleteNode( node );
|
|
7799
|
+
|
|
7800
|
+
if( ok && that.onevent )
|
|
7778
7801
|
{
|
|
7779
7802
|
const event = new LX.TreeEvent( LX.TreeEvent.NODE_DELETED, node, e );
|
|
7780
7803
|
that.onevent( event );
|
|
7781
7804
|
}
|
|
7782
7805
|
|
|
7783
|
-
// Delete nodes now
|
|
7784
|
-
let childs = node.parent.children;
|
|
7785
|
-
const index = childs.indexOf( node );
|
|
7786
|
-
childs.splice( index, 1 );
|
|
7787
|
-
|
|
7788
7806
|
this.refresh();
|
|
7789
7807
|
} } );
|
|
7790
7808
|
}
|
|
@@ -7801,23 +7819,26 @@ class NodeTree {
|
|
|
7801
7819
|
|
|
7802
7820
|
if( e.key == "Delete" )
|
|
7803
7821
|
{
|
|
7804
|
-
|
|
7805
|
-
|
|
7822
|
+
const nodesDeleted = [];
|
|
7823
|
+
|
|
7824
|
+
for( let _node of this.selected )
|
|
7806
7825
|
{
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7826
|
+
if( that.deleteNode( _node ) )
|
|
7827
|
+
{
|
|
7828
|
+
nodesDeleted.push( _node );
|
|
7829
|
+
}
|
|
7810
7830
|
}
|
|
7811
7831
|
|
|
7812
|
-
//
|
|
7813
|
-
|
|
7832
|
+
// Send event now so we have the info in selected array..
|
|
7833
|
+
if( nodesDeleted.length && that.onevent )
|
|
7814
7834
|
{
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7835
|
+
const event = new LX.TreeEvent( LX.TreeEvent.NODE_DELETED, nodesDeleted.length > 1 ? nodesDeleted : node, e );
|
|
7836
|
+
event.multiple = nodesDeleted.length > 1;
|
|
7837
|
+
that.onevent( event );
|
|
7818
7838
|
}
|
|
7819
7839
|
|
|
7820
7840
|
this.selected.length = 0;
|
|
7841
|
+
|
|
7821
7842
|
this.refresh();
|
|
7822
7843
|
}
|
|
7823
7844
|
else if( e.key == "ArrowUp" || e.key == "ArrowDown" ) // Unique or zero selected
|
|
@@ -8086,6 +8107,35 @@ class NodeTree {
|
|
|
8086
8107
|
this.selected = [ el.treeData ];
|
|
8087
8108
|
el.focus();
|
|
8088
8109
|
}
|
|
8110
|
+
|
|
8111
|
+
deleteNode( node ) {
|
|
8112
|
+
|
|
8113
|
+
const dataAsArray = ( this.data.constructor === Array );
|
|
8114
|
+
|
|
8115
|
+
// Can be either Array or Object type data
|
|
8116
|
+
if( node.parent )
|
|
8117
|
+
{
|
|
8118
|
+
let childs = node.parent.children;
|
|
8119
|
+
const index = childs.indexOf( node );
|
|
8120
|
+
childs.splice( index, 1 );
|
|
8121
|
+
}
|
|
8122
|
+
else
|
|
8123
|
+
{
|
|
8124
|
+
if( dataAsArray )
|
|
8125
|
+
{
|
|
8126
|
+
const index = this.data.indexOf( node );
|
|
8127
|
+
console.assert( index > -1, "NodeTree: Can't delete root node " + node.id + " from data array!" );
|
|
8128
|
+
this.data.splice( index, 1 );
|
|
8129
|
+
}
|
|
8130
|
+
else
|
|
8131
|
+
{
|
|
8132
|
+
console.warn( "NodeTree: Can't delete root node from object data!" );
|
|
8133
|
+
return false;
|
|
8134
|
+
}
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
return true;
|
|
8138
|
+
}
|
|
8089
8139
|
}
|
|
8090
8140
|
|
|
8091
8141
|
LX.NodeTree = NodeTree;
|
|
@@ -8453,18 +8503,38 @@ class Button extends Widget {
|
|
|
8453
8503
|
wValue.classList.add( "selected" );
|
|
8454
8504
|
}
|
|
8455
8505
|
|
|
8456
|
-
if( options.
|
|
8457
|
-
{
|
|
8458
|
-
const icon = LX.makeIcon( options.icon );
|
|
8459
|
-
wValue.prepend( icon );
|
|
8460
|
-
wValue.classList.add( "justify-center" );
|
|
8461
|
-
}
|
|
8462
|
-
else if( options.img )
|
|
8506
|
+
if( options.img )
|
|
8463
8507
|
{
|
|
8464
8508
|
let img = document.createElement( 'img' );
|
|
8465
8509
|
img.src = options.img;
|
|
8466
8510
|
wValue.prepend( img );
|
|
8467
8511
|
}
|
|
8512
|
+
else if( options.icon )
|
|
8513
|
+
{
|
|
8514
|
+
const icon = LX.makeIcon( options.icon );
|
|
8515
|
+
const iconPosition = options.iconPosition ?? "cover";
|
|
8516
|
+
|
|
8517
|
+
// Default
|
|
8518
|
+
if( iconPosition == "cover" || ( options.swap !== undefined ) )
|
|
8519
|
+
{
|
|
8520
|
+
wValue.prepend( icon );
|
|
8521
|
+
}
|
|
8522
|
+
else
|
|
8523
|
+
{
|
|
8524
|
+
wValue.innerHTML = `<span>${ ( value || "" ) }</span>`;
|
|
8525
|
+
|
|
8526
|
+
if( iconPosition == "start" )
|
|
8527
|
+
{
|
|
8528
|
+
wValue.querySelector( "span" ).prepend( icon );
|
|
8529
|
+
}
|
|
8530
|
+
else // "end"
|
|
8531
|
+
{
|
|
8532
|
+
wValue.querySelector( "span" ).appendChild( icon );
|
|
8533
|
+
}
|
|
8534
|
+
}
|
|
8535
|
+
|
|
8536
|
+
wValue.classList.add( "justify-center" );
|
|
8537
|
+
}
|
|
8468
8538
|
else
|
|
8469
8539
|
{
|
|
8470
8540
|
wValue.innerHTML = `<span>${ ( value || "" ) }</span>`;
|
|
@@ -8920,8 +8990,8 @@ class Select extends Widget {
|
|
|
8920
8990
|
value = newValue;
|
|
8921
8991
|
|
|
8922
8992
|
let item = null;
|
|
8923
|
-
const
|
|
8924
|
-
|
|
8993
|
+
const listOptionsNodes = listOptions.childNodes;
|
|
8994
|
+
listOptionsNodes.forEach( e => {
|
|
8925
8995
|
e.classList.remove( "selected" );
|
|
8926
8996
|
if( e.getAttribute( "value" ) == newValue )
|
|
8927
8997
|
{
|
|
@@ -8941,6 +9011,22 @@ class Select extends Widget {
|
|
|
8941
9011
|
list.refresh( filteredOptions );
|
|
8942
9012
|
}
|
|
8943
9013
|
|
|
9014
|
+
// Update suboptions menu
|
|
9015
|
+
const suboptions = this.root.querySelector( ".lexcustomcontainer" );
|
|
9016
|
+
const suboptionsFunc = options[ `on_${ value }` ];
|
|
9017
|
+
suboptions.toggleAttribute( "hidden", !suboptionsFunc );
|
|
9018
|
+
|
|
9019
|
+
if( suboptionsFunc )
|
|
9020
|
+
{
|
|
9021
|
+
suboptions.innerHTML = "";
|
|
9022
|
+
const suboptionsPanel = new LX.Panel();
|
|
9023
|
+
suboptionsPanel.queue( suboptions );
|
|
9024
|
+
suboptionsFunc.call(this, suboptionsPanel);
|
|
9025
|
+
suboptionsPanel.clearQueue();
|
|
9026
|
+
}
|
|
9027
|
+
|
|
9028
|
+
this.root.dataset["opened"] = ( !!suboptionsFunc );
|
|
9029
|
+
|
|
8944
9030
|
if( !skipCallback )
|
|
8945
9031
|
{
|
|
8946
9032
|
this._trigger( new LX.IEvent( name, value, event ), callback );
|
|
@@ -9237,6 +9323,25 @@ class Select extends Widget {
|
|
|
9237
9323
|
|
|
9238
9324
|
container.appendChild( listDialog );
|
|
9239
9325
|
|
|
9326
|
+
// Element suboptions
|
|
9327
|
+
let suboptions = document.createElement( "div" );
|
|
9328
|
+
suboptions.className = "lexcustomcontainer w-full";
|
|
9329
|
+
|
|
9330
|
+
const suboptionsFunc = options[ `on_${ value }` ];
|
|
9331
|
+
suboptions.toggleAttribute( "hidden", !suboptionsFunc );
|
|
9332
|
+
|
|
9333
|
+
if( suboptionsFunc )
|
|
9334
|
+
{
|
|
9335
|
+
suboptions.innerHTML = "";
|
|
9336
|
+
const suboptionsPanel = new LX.Panel();
|
|
9337
|
+
suboptionsPanel.queue( suboptions );
|
|
9338
|
+
suboptionsFunc.call( this, suboptionsPanel );
|
|
9339
|
+
suboptionsPanel.clearQueue();
|
|
9340
|
+
}
|
|
9341
|
+
|
|
9342
|
+
this.root.appendChild( suboptions );
|
|
9343
|
+
this.root.dataset["opened"] = ( !!suboptionsFunc );
|
|
9344
|
+
|
|
9240
9345
|
LX.doAsync( this.onResize.bind( this ) );
|
|
9241
9346
|
}
|
|
9242
9347
|
|
|
@@ -10340,6 +10445,7 @@ class NumberInput extends Widget {
|
|
|
10340
10445
|
slider.step = options.step ?? 1;
|
|
10341
10446
|
slider.type = "range";
|
|
10342
10447
|
slider.value = value;
|
|
10448
|
+
slider.disabled = this.disabled;
|
|
10343
10449
|
|
|
10344
10450
|
slider.addEventListener( "input", ( e ) => {
|
|
10345
10451
|
this.set( slider.valueAsNumber, false, e );
|
|
@@ -11427,7 +11533,7 @@ class TabSections extends Widget {
|
|
|
11427
11533
|
let tabEl = document.createElement( "div" );
|
|
11428
11534
|
tabEl.className = "lextab " + (i == tabs.length - 1 ? "last" : "") + ( isSelected ? "selected" : "" );
|
|
11429
11535
|
tabEl.innerHTML = ( showNames ? tab.name : "" );
|
|
11430
|
-
tabEl.appendChild( LX.makeIcon( tab.icon ?? "Hash", { title: tab.name } ) );
|
|
11536
|
+
tabEl.appendChild( LX.makeIcon( tab.icon ?? "Hash", { title: tab.name, iconClass: tab.iconClass, svgClass: tab.svgClass } ) );
|
|
11431
11537
|
|
|
11432
11538
|
let infoContainer = document.createElement( "div" );
|
|
11433
11539
|
infoContainer.id = tab.name.replace( /\s/g, '' );
|
|
@@ -11463,7 +11569,7 @@ class TabSections extends Widget {
|
|
|
11463
11569
|
// Push to tab space
|
|
11464
11570
|
const creationPanel = new LX.Panel();
|
|
11465
11571
|
creationPanel.queue( infoContainer );
|
|
11466
|
-
tab.onCreate.call(this, creationPanel);
|
|
11572
|
+
tab.onCreate.call( this, creationPanel, infoContainer );
|
|
11467
11573
|
creationPanel.clearQueue();
|
|
11468
11574
|
}
|
|
11469
11575
|
}
|
|
@@ -11567,16 +11673,16 @@ class Table extends Widget {
|
|
|
11567
11673
|
container.className = "lextable";
|
|
11568
11674
|
this.root.appendChild( container );
|
|
11569
11675
|
|
|
11570
|
-
this.
|
|
11571
|
-
if( this.
|
|
11676
|
+
this._centered = options.centered ?? false;
|
|
11677
|
+
if( this._centered === true )
|
|
11572
11678
|
{
|
|
11573
11679
|
container.classList.add( "centered" );
|
|
11574
11680
|
}
|
|
11575
11681
|
|
|
11682
|
+
this.activeCustomFilters = {};
|
|
11576
11683
|
this.filter = options.filter ?? false;
|
|
11577
|
-
this.toggleColumns = options.toggleColumns ?? false;
|
|
11578
11684
|
this.customFilters = options.customFilters ?? false;
|
|
11579
|
-
this.
|
|
11685
|
+
this._toggleColumns = options.toggleColumns ?? false;
|
|
11580
11686
|
this._currentFilter = options.filterValue;
|
|
11581
11687
|
|
|
11582
11688
|
data.head = data.head ?? [];
|
|
@@ -11584,6 +11690,7 @@ class Table extends Widget {
|
|
|
11584
11690
|
data.checkMap = { };
|
|
11585
11691
|
data.colVisibilityMap = { };
|
|
11586
11692
|
data.head.forEach( (col, index) => { data.colVisibilityMap[ index ] = true; });
|
|
11693
|
+
this.data = data;
|
|
11587
11694
|
|
|
11588
11695
|
const compareFn = ( idx, order, a, b) => {
|
|
11589
11696
|
if (a[idx] < b[idx]) return -order;
|
|
@@ -11597,7 +11704,7 @@ class Table extends Widget {
|
|
|
11597
11704
|
};
|
|
11598
11705
|
|
|
11599
11706
|
// Append header
|
|
11600
|
-
if( this.filter || this.customFilters || this.
|
|
11707
|
+
if( this.filter || this.customFilters || this._toggleColumns )
|
|
11601
11708
|
{
|
|
11602
11709
|
const headerContainer = LX.makeContainer( [ "100%", "auto" ], "flex flex-row" );
|
|
11603
11710
|
|
|
@@ -11709,7 +11816,7 @@ class Table extends Widget {
|
|
|
11709
11816
|
this._resetCustomFiltersBtn.root.classList.add( "hidden" );
|
|
11710
11817
|
}
|
|
11711
11818
|
|
|
11712
|
-
if( this.
|
|
11819
|
+
if( this._toggleColumns )
|
|
11713
11820
|
{
|
|
11714
11821
|
const icon = LX.makeIcon( "Settings2" );
|
|
11715
11822
|
const toggleColumnsBtn = new LX.Button( "toggleColumnsBtn", icon.innerHTML + "View", (value, e) => {
|
|
@@ -11781,7 +11888,9 @@ class Table extends Widget {
|
|
|
11781
11888
|
const body = table.querySelector( "tbody" );
|
|
11782
11889
|
for( const el of body.childNodes )
|
|
11783
11890
|
{
|
|
11784
|
-
|
|
11891
|
+
const rowId = el.getAttribute( "rowId" );
|
|
11892
|
+
if( !rowId ) continue;
|
|
11893
|
+
data.checkMap[ rowId ] = this.checked;
|
|
11785
11894
|
el.querySelector( "input[type='checkbox']" ).checked = this.checked;
|
|
11786
11895
|
}
|
|
11787
11896
|
});
|
|
@@ -11797,7 +11906,7 @@ class Table extends Widget {
|
|
|
11797
11906
|
th.querySelector( "span" ).appendChild( LX.makeIcon( "MenuArrows", { svgClass: "sm" } ) );
|
|
11798
11907
|
|
|
11799
11908
|
const idx = data.head.indexOf( headData );
|
|
11800
|
-
if( this.
|
|
11909
|
+
if( this._centered?.indexOf && this._centered.indexOf( idx ) > -1 )
|
|
11801
11910
|
{
|
|
11802
11911
|
th.classList.add( "centered" );
|
|
11803
11912
|
}
|
|
@@ -11807,7 +11916,7 @@ class Table extends Widget {
|
|
|
11807
11916
|
{ name: "Desc", icon: "ArrowDownAZ", callback: sortFn.bind( this, idx, -1 ) }
|
|
11808
11917
|
];
|
|
11809
11918
|
|
|
11810
|
-
if( this.
|
|
11919
|
+
if( this._toggleColumns )
|
|
11811
11920
|
{
|
|
11812
11921
|
menuOptions.push(
|
|
11813
11922
|
null,
|
|
@@ -11869,6 +11978,9 @@ class Table extends Widget {
|
|
|
11869
11978
|
// Origin row should go to the target row, and the rest should be moved up/down
|
|
11870
11979
|
const fromIdx = rIdx - 1;
|
|
11871
11980
|
const targetIdx = movePending[ 1 ] - 1;
|
|
11981
|
+
|
|
11982
|
+
LX.emit( "@on_table_sort", { instance: this, fromIdx, targetIdx } );
|
|
11983
|
+
|
|
11872
11984
|
const b = data.body[ fromIdx ];
|
|
11873
11985
|
let targetOffset = 0;
|
|
11874
11986
|
|
|
@@ -11989,8 +12101,8 @@ class Table extends Widget {
|
|
|
11989
12101
|
}
|
|
11990
12102
|
|
|
11991
12103
|
const row = document.createElement( 'tr' );
|
|
11992
|
-
const rowId = LX.getSupportedDOMName( bodyData.join( '-' ) );
|
|
11993
|
-
row.setAttribute( "rowId", rowId
|
|
12104
|
+
const rowId = LX.getSupportedDOMName( bodyData.join( '-' ) ).substr(0, 32);
|
|
12105
|
+
row.setAttribute( "rowId", rowId );
|
|
11994
12106
|
|
|
11995
12107
|
if( options.sortable ?? false )
|
|
11996
12108
|
{
|
|
@@ -12074,7 +12186,7 @@ class Table extends Widget {
|
|
|
12074
12186
|
td.innerHTML = `${ rowData }`;
|
|
12075
12187
|
|
|
12076
12188
|
const idx = bodyData.indexOf( rowData );
|
|
12077
|
-
if( this.
|
|
12189
|
+
if( this._centered?.indexOf && this._centered.indexOf( idx ) > -1 )
|
|
12078
12190
|
{
|
|
12079
12191
|
td.classList.add( "centered" );
|
|
12080
12192
|
}
|
|
@@ -12106,7 +12218,7 @@ class Table extends Widget {
|
|
|
12106
12218
|
}
|
|
12107
12219
|
else if( action == "menu" )
|
|
12108
12220
|
{
|
|
12109
|
-
button = LX.makeIcon( "
|
|
12221
|
+
button = LX.makeIcon( "EllipsisVertical", { title: "Menu" } );
|
|
12110
12222
|
button.addEventListener( 'click', function( event ) {
|
|
12111
12223
|
if( !options.onMenuAction )
|
|
12112
12224
|
{
|
|
@@ -12145,6 +12257,17 @@ class Table extends Widget {
|
|
|
12145
12257
|
|
|
12146
12258
|
body.appendChild( row );
|
|
12147
12259
|
}
|
|
12260
|
+
|
|
12261
|
+
if( body.childNodes.length == 0 )
|
|
12262
|
+
{
|
|
12263
|
+
const row = document.createElement( 'tr' );
|
|
12264
|
+
const td = document.createElement( 'td' );
|
|
12265
|
+
td.setAttribute( "colspan", data.head.length + this.rowOffsetCount + 1 ); // +1 for rowActions
|
|
12266
|
+
td.className = "empty-row";
|
|
12267
|
+
td.innerHTML = "No results.";
|
|
12268
|
+
row.appendChild( td );
|
|
12269
|
+
body.appendChild( row );
|
|
12270
|
+
}
|
|
12148
12271
|
}
|
|
12149
12272
|
|
|
12150
12273
|
for( const v in data.colVisibilityMap )
|
|
@@ -12164,8 +12287,50 @@ class Table extends Widget {
|
|
|
12164
12287
|
|
|
12165
12288
|
LX.doAsync( this.onResize.bind( this ) );
|
|
12166
12289
|
}
|
|
12290
|
+
|
|
12291
|
+
getSelectedRows() {
|
|
12292
|
+
|
|
12293
|
+
const selectedRows = [];
|
|
12294
|
+
|
|
12295
|
+
for( const row of this.data.body )
|
|
12296
|
+
{
|
|
12297
|
+
const rowId = LX.getSupportedDOMName( row.join( '-' ) ).substr( 0, 32 );
|
|
12298
|
+
if( this.data.checkMap[ rowId ] === true )
|
|
12299
|
+
{
|
|
12300
|
+
selectedRows.push( row );
|
|
12301
|
+
}
|
|
12302
|
+
}
|
|
12303
|
+
|
|
12304
|
+
return selectedRows;
|
|
12305
|
+
}
|
|
12306
|
+
|
|
12307
|
+
_setCentered( v ) {
|
|
12308
|
+
|
|
12309
|
+
if( v.constructor == Boolean )
|
|
12310
|
+
{
|
|
12311
|
+
const container = this.root.querySelector( ".lextable" );
|
|
12312
|
+
container.classList.toggle( "centered", v );
|
|
12313
|
+
}
|
|
12314
|
+
else
|
|
12315
|
+
{
|
|
12316
|
+
// Make sure this is an array containing which columns have
|
|
12317
|
+
// to be centered
|
|
12318
|
+
v = [].concat( v );
|
|
12319
|
+
}
|
|
12320
|
+
|
|
12321
|
+
this._centered = v;
|
|
12322
|
+
|
|
12323
|
+
this.refresh();
|
|
12324
|
+
}
|
|
12167
12325
|
}
|
|
12168
12326
|
|
|
12327
|
+
Object.defineProperty( Table.prototype, "centered", {
|
|
12328
|
+
get: function() { return this._centered; },
|
|
12329
|
+
set: function( v ) { this._setCentered( v ); },
|
|
12330
|
+
enumerable: true,
|
|
12331
|
+
configurable: true
|
|
12332
|
+
});
|
|
12333
|
+
|
|
12169
12334
|
LX.Table = Table;
|
|
12170
12335
|
|
|
12171
12336
|
/**
|
|
@@ -12280,8 +12445,8 @@ class Map2D extends Widget {
|
|
|
12280
12445
|
}
|
|
12281
12446
|
}
|
|
12282
12447
|
|
|
12283
|
-
LX.Map2D = Map2D;
|
|
12284
|
-
|
|
12448
|
+
LX.Map2D = Map2D;
|
|
12449
|
+
|
|
12285
12450
|
// panel.js @jxarco
|
|
12286
12451
|
|
|
12287
12452
|
/**
|
|
@@ -12887,6 +13052,7 @@ class Panel {
|
|
|
12887
13052
|
* hideName: Don't use name as label [false]
|
|
12888
13053
|
* disabled: Make the widget disabled [false]
|
|
12889
13054
|
* icon: Icon class to show as button value
|
|
13055
|
+
* iconPosition: Icon position (cover|start|end)
|
|
12890
13056
|
* fileInput: Button click requests a file
|
|
12891
13057
|
* fileInputType: Type of the requested file
|
|
12892
13058
|
* img: Path to image to show as button value
|
|
@@ -13378,6 +13544,8 @@ class Panel {
|
|
|
13378
13544
|
* @param {Array} tabs Contains objects with {
|
|
13379
13545
|
* name: Name of the tab (if icon, use as title)
|
|
13380
13546
|
* icon: Icon to be used as the tab icon (optional)
|
|
13547
|
+
* iconClass: Class to be added to the icon (optional)
|
|
13548
|
+
* svgClass: Class to be added to the inner SVG of the icon (optional)
|
|
13381
13549
|
* onCreate: Func to be called at tab creation
|
|
13382
13550
|
* onSelect: Func to be called on select tab (optional)
|
|
13383
13551
|
* }
|
|
@@ -13463,8 +13631,8 @@ class Panel {
|
|
|
13463
13631
|
}
|
|
13464
13632
|
}
|
|
13465
13633
|
|
|
13466
|
-
LX.Panel = Panel;
|
|
13467
|
-
|
|
13634
|
+
LX.Panel = Panel;
|
|
13635
|
+
|
|
13468
13636
|
// branch.js @jxarco
|
|
13469
13637
|
|
|
13470
13638
|
/**
|
|
@@ -13688,8 +13856,8 @@ class Branch {
|
|
|
13688
13856
|
}
|
|
13689
13857
|
}
|
|
13690
13858
|
}
|
|
13691
|
-
LX.Branch = Branch;
|
|
13692
|
-
|
|
13859
|
+
LX.Branch = Branch;
|
|
13860
|
+
|
|
13693
13861
|
// menubar.js @jxarco
|
|
13694
13862
|
|
|
13695
13863
|
/**
|
|
@@ -13977,7 +14145,7 @@ class Menubar {
|
|
|
13977
14145
|
this.buttonContainer.className = "lexmenubuttons";
|
|
13978
14146
|
this.buttonContainer.classList.add( options.float ?? "center" );
|
|
13979
14147
|
|
|
13980
|
-
if( options.
|
|
14148
|
+
if( options.float == "right" )
|
|
13981
14149
|
{
|
|
13982
14150
|
this.buttonContainer.right = true;
|
|
13983
14151
|
}
|
|
@@ -13996,7 +14164,7 @@ class Menubar {
|
|
|
13996
14164
|
{
|
|
13997
14165
|
const data = buttons[ i ];
|
|
13998
14166
|
const title = data.title;
|
|
13999
|
-
const button = new LX.Button( title,
|
|
14167
|
+
const button = new LX.Button( title, data.label, data.callback, { title, buttonClass: "bg-none", disabled: data.disabled, icon: data.icon, hideName: true, swap: data.swap, iconPosition: "start" } );
|
|
14000
14168
|
this.buttonContainer.appendChild( button.root );
|
|
14001
14169
|
|
|
14002
14170
|
if( title )
|
|
@@ -14006,8 +14174,8 @@ class Menubar {
|
|
|
14006
14174
|
}
|
|
14007
14175
|
}
|
|
14008
14176
|
}
|
|
14009
|
-
LX.Menubar = Menubar;
|
|
14010
|
-
|
|
14177
|
+
LX.Menubar = Menubar;
|
|
14178
|
+
|
|
14011
14179
|
// sidebar.js @jxarco
|
|
14012
14180
|
|
|
14013
14181
|
/**
|
|
@@ -14702,8 +14870,8 @@ class Sidebar {
|
|
|
14702
14870
|
}
|
|
14703
14871
|
}
|
|
14704
14872
|
}
|
|
14705
|
-
LX.Sidebar = Sidebar;
|
|
14706
|
-
|
|
14873
|
+
LX.Sidebar = Sidebar;
|
|
14874
|
+
|
|
14707
14875
|
// asset_view.js @jxarco
|
|
14708
14876
|
|
|
14709
14877
|
class AssetViewEvent {
|
|
@@ -15570,6 +15738,6 @@ class AssetView {
|
|
|
15570
15738
|
}
|
|
15571
15739
|
}
|
|
15572
15740
|
|
|
15573
|
-
LX.AssetView = AssetView;
|
|
15574
|
-
|
|
15575
|
-
export { ADD_CUSTOM_WIDGET, Area, AssetView, AssetViewEvent, Branch, LX, Menubar, Panel, Sidebar, Widget };
|
|
15741
|
+
LX.AssetView = AssetView;
|
|
15742
|
+
|
|
15743
|
+
export { ADD_CUSTOM_WIDGET, Area, AssetView, AssetViewEvent, Branch, LX, Menubar, Panel, Sidebar, Widget };
|