lexgui 0.6.7 → 0.6.8
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/lexgui.css +2 -3
- package/build/lexgui.js +75 -14
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +75 -14
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +22 -1
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const LX = {
|
|
10
|
-
version: "0.6.
|
|
10
|
+
version: "0.6.8",
|
|
11
11
|
ready: false,
|
|
12
12
|
components: [], // Specific pre-build components
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -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!
|
|
@@ -6956,6 +6955,12 @@ class Area {
|
|
|
6956
6955
|
return;
|
|
6957
6956
|
}
|
|
6958
6957
|
|
|
6958
|
+
// When manual resizing, we don't need the observer anymore
|
|
6959
|
+
if( this._autoVerticalResizeObserver )
|
|
6960
|
+
{
|
|
6961
|
+
this._autoVerticalResizeObserver.disconnect();
|
|
6962
|
+
}
|
|
6963
|
+
|
|
6959
6964
|
const a1 = this.sections[ 0 ];
|
|
6960
6965
|
var a1Root = a1.root;
|
|
6961
6966
|
|
|
@@ -7376,7 +7381,7 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7376
7381
|
|
|
7377
7382
|
LX.Panel.prototype[ 'add' + customWidgetName ] = function( name, instance, callback ) {
|
|
7378
7383
|
|
|
7379
|
-
|
|
7384
|
+
const userParams = Array.from( arguments ).slice( 3 );
|
|
7380
7385
|
|
|
7381
7386
|
let widget = new Widget( Widget.CUSTOM, name, null, options );
|
|
7382
7387
|
this._attachWidget( widget );
|
|
@@ -7398,6 +7403,11 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7398
7403
|
}
|
|
7399
7404
|
};
|
|
7400
7405
|
|
|
7406
|
+
widget.onResize = ( rect ) => {
|
|
7407
|
+
const realNameWidth = ( widget.root.domName?.style.width ?? "0px" );
|
|
7408
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7409
|
+
};
|
|
7410
|
+
|
|
7401
7411
|
const element = widget.root;
|
|
7402
7412
|
|
|
7403
7413
|
let container, customWidgetsDom;
|
|
@@ -7536,6 +7546,11 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7536
7546
|
}
|
|
7537
7547
|
}
|
|
7538
7548
|
|
|
7549
|
+
if( options.onCreate )
|
|
7550
|
+
{
|
|
7551
|
+
options.onCreate.call( this, this, ...userParams );
|
|
7552
|
+
}
|
|
7553
|
+
|
|
7539
7554
|
this.clearQueue();
|
|
7540
7555
|
}
|
|
7541
7556
|
};
|
|
@@ -11567,16 +11582,16 @@ class Table extends Widget {
|
|
|
11567
11582
|
container.className = "lextable";
|
|
11568
11583
|
this.root.appendChild( container );
|
|
11569
11584
|
|
|
11570
|
-
this.
|
|
11571
|
-
if( this.
|
|
11585
|
+
this._centered = options.centered ?? false;
|
|
11586
|
+
if( this._centered === true )
|
|
11572
11587
|
{
|
|
11573
11588
|
container.classList.add( "centered" );
|
|
11574
11589
|
}
|
|
11575
11590
|
|
|
11591
|
+
this.activeCustomFilters = {};
|
|
11576
11592
|
this.filter = options.filter ?? false;
|
|
11577
|
-
this.toggleColumns = options.toggleColumns ?? false;
|
|
11578
11593
|
this.customFilters = options.customFilters ?? false;
|
|
11579
|
-
this.
|
|
11594
|
+
this._toggleColumns = options.toggleColumns ?? false;
|
|
11580
11595
|
this._currentFilter = options.filterValue;
|
|
11581
11596
|
|
|
11582
11597
|
data.head = data.head ?? [];
|
|
@@ -11584,6 +11599,7 @@ class Table extends Widget {
|
|
|
11584
11599
|
data.checkMap = { };
|
|
11585
11600
|
data.colVisibilityMap = { };
|
|
11586
11601
|
data.head.forEach( (col, index) => { data.colVisibilityMap[ index ] = true; });
|
|
11602
|
+
this.data = data;
|
|
11587
11603
|
|
|
11588
11604
|
const compareFn = ( idx, order, a, b) => {
|
|
11589
11605
|
if (a[idx] < b[idx]) return -order;
|
|
@@ -11597,7 +11613,7 @@ class Table extends Widget {
|
|
|
11597
11613
|
};
|
|
11598
11614
|
|
|
11599
11615
|
// Append header
|
|
11600
|
-
if( this.filter || this.customFilters || this.
|
|
11616
|
+
if( this.filter || this.customFilters || this._toggleColumns )
|
|
11601
11617
|
{
|
|
11602
11618
|
const headerContainer = LX.makeContainer( [ "100%", "auto" ], "flex flex-row" );
|
|
11603
11619
|
|
|
@@ -11709,7 +11725,7 @@ class Table extends Widget {
|
|
|
11709
11725
|
this._resetCustomFiltersBtn.root.classList.add( "hidden" );
|
|
11710
11726
|
}
|
|
11711
11727
|
|
|
11712
|
-
if( this.
|
|
11728
|
+
if( this._toggleColumns )
|
|
11713
11729
|
{
|
|
11714
11730
|
const icon = LX.makeIcon( "Settings2" );
|
|
11715
11731
|
const toggleColumnsBtn = new LX.Button( "toggleColumnsBtn", icon.innerHTML + "View", (value, e) => {
|
|
@@ -11797,7 +11813,7 @@ class Table extends Widget {
|
|
|
11797
11813
|
th.querySelector( "span" ).appendChild( LX.makeIcon( "MenuArrows", { svgClass: "sm" } ) );
|
|
11798
11814
|
|
|
11799
11815
|
const idx = data.head.indexOf( headData );
|
|
11800
|
-
if( this.
|
|
11816
|
+
if( this._centered?.indexOf && this._centered.indexOf( idx ) > -1 )
|
|
11801
11817
|
{
|
|
11802
11818
|
th.classList.add( "centered" );
|
|
11803
11819
|
}
|
|
@@ -11807,7 +11823,7 @@ class Table extends Widget {
|
|
|
11807
11823
|
{ name: "Desc", icon: "ArrowDownAZ", callback: sortFn.bind( this, idx, -1 ) }
|
|
11808
11824
|
];
|
|
11809
11825
|
|
|
11810
|
-
if( this.
|
|
11826
|
+
if( this._toggleColumns )
|
|
11811
11827
|
{
|
|
11812
11828
|
menuOptions.push(
|
|
11813
11829
|
null,
|
|
@@ -11869,6 +11885,9 @@ class Table extends Widget {
|
|
|
11869
11885
|
// Origin row should go to the target row, and the rest should be moved up/down
|
|
11870
11886
|
const fromIdx = rIdx - 1;
|
|
11871
11887
|
const targetIdx = movePending[ 1 ] - 1;
|
|
11888
|
+
|
|
11889
|
+
LX.emit( "@on_table_sort", { instance: this, fromIdx, targetIdx } );
|
|
11890
|
+
|
|
11872
11891
|
const b = data.body[ fromIdx ];
|
|
11873
11892
|
let targetOffset = 0;
|
|
11874
11893
|
|
|
@@ -12074,7 +12093,7 @@ class Table extends Widget {
|
|
|
12074
12093
|
td.innerHTML = `${ rowData }`;
|
|
12075
12094
|
|
|
12076
12095
|
const idx = bodyData.indexOf( rowData );
|
|
12077
|
-
if( this.
|
|
12096
|
+
if( this._centered?.indexOf && this._centered.indexOf( idx ) > -1 )
|
|
12078
12097
|
{
|
|
12079
12098
|
td.classList.add( "centered" );
|
|
12080
12099
|
}
|
|
@@ -12164,8 +12183,50 @@ class Table extends Widget {
|
|
|
12164
12183
|
|
|
12165
12184
|
LX.doAsync( this.onResize.bind( this ) );
|
|
12166
12185
|
}
|
|
12186
|
+
|
|
12187
|
+
getSelectedRows() {
|
|
12188
|
+
|
|
12189
|
+
const selectedRows = [];
|
|
12190
|
+
|
|
12191
|
+
for( const row of this.data.body )
|
|
12192
|
+
{
|
|
12193
|
+
const rowId = LX.getSupportedDOMName( row.join( '-' ) ).substr( 0, 32 );
|
|
12194
|
+
if( this.data.checkMap[ rowId ] === true )
|
|
12195
|
+
{
|
|
12196
|
+
selectedRows.push( row );
|
|
12197
|
+
}
|
|
12198
|
+
}
|
|
12199
|
+
|
|
12200
|
+
return selectedRows;
|
|
12201
|
+
}
|
|
12202
|
+
|
|
12203
|
+
_setCentered( v ) {
|
|
12204
|
+
|
|
12205
|
+
if( v.constructor == Boolean )
|
|
12206
|
+
{
|
|
12207
|
+
const container = this.root.querySelector( ".lextable" );
|
|
12208
|
+
container.classList.toggle( "centered", v );
|
|
12209
|
+
}
|
|
12210
|
+
else
|
|
12211
|
+
{
|
|
12212
|
+
// Make sure this is an array containing which columns have
|
|
12213
|
+
// to be centered
|
|
12214
|
+
v = [].concat( v );
|
|
12215
|
+
}
|
|
12216
|
+
|
|
12217
|
+
this._centered = v;
|
|
12218
|
+
|
|
12219
|
+
this.refresh();
|
|
12220
|
+
}
|
|
12167
12221
|
}
|
|
12168
12222
|
|
|
12223
|
+
Object.defineProperty( Table.prototype, "centered", {
|
|
12224
|
+
get: function() { return this._centered; },
|
|
12225
|
+
set: function( v ) { this._setCentered( v ); },
|
|
12226
|
+
enumerable: true,
|
|
12227
|
+
configurable: true
|
|
12228
|
+
});
|
|
12229
|
+
|
|
12169
12230
|
LX.Table = Table;
|
|
12170
12231
|
|
|
12171
12232
|
/**
|