lexgui 0.7.7 → 0.7.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/extensions/codeeditor.js +44 -15
- package/build/extensions/timeline.js +44 -28
- package/build/lexgui.css +16 -15
- package/build/lexgui.js +56 -18
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +56 -18
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +17 -1
- package/examples/asset-view.html +1 -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.7.
|
|
10
|
+
version: "0.7.8",
|
|
11
11
|
ready: false,
|
|
12
12
|
extensions: [], // Store extensions used
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -1239,7 +1239,7 @@ class DropdownMenu {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
1241
|
const menuItem = document.createElement('div');
|
|
1242
|
-
menuItem.className = "lexdropdownmenuitem" + ( item.name ? "" : " label" ) + ( item.disabled ?? false ? " disabled" : "" ) + ( ` ${ item.className ?? "" }` );
|
|
1242
|
+
menuItem.className = "lexdropdownmenuitem" + ( ( item.name || item.options ) ? "" : " label" ) + ( item.disabled ?? false ? " disabled" : "" ) + ( ` ${ item.className ?? "" }` );
|
|
1243
1243
|
menuItem.dataset["id"] = pKey;
|
|
1244
1244
|
menuItem.innerHTML = `<span>${ key }</span>`;
|
|
1245
1245
|
menuItem.tabIndex = "1";
|
|
@@ -1325,7 +1325,7 @@ class DropdownMenu {
|
|
|
1325
1325
|
else
|
|
1326
1326
|
{
|
|
1327
1327
|
menuItem.addEventListener( "click", () => {
|
|
1328
|
-
const f = item
|
|
1328
|
+
const f = item.callback;
|
|
1329
1329
|
if( f )
|
|
1330
1330
|
{
|
|
1331
1331
|
f.call( this, key, menuItem );
|
|
@@ -1337,7 +1337,11 @@ class DropdownMenu {
|
|
|
1337
1337
|
this._trigger[ radioName ] = key;
|
|
1338
1338
|
}
|
|
1339
1339
|
|
|
1340
|
-
|
|
1340
|
+
// If has options, it's a radio group label, so don't close the menu
|
|
1341
|
+
if( !item.options && ( item.closeOnClick ?? true ) )
|
|
1342
|
+
{
|
|
1343
|
+
this.destroy( true );
|
|
1344
|
+
}
|
|
1341
1345
|
} );
|
|
1342
1346
|
}
|
|
1343
1347
|
|
|
@@ -1375,8 +1379,6 @@ class DropdownMenu {
|
|
|
1375
1379
|
|
|
1376
1380
|
if( item.options )
|
|
1377
1381
|
{
|
|
1378
|
-
this._addSeparator();
|
|
1379
|
-
|
|
1380
1382
|
console.assert( this._trigger[ item.name ] && "An item of the radio group must be selected!" );
|
|
1381
1383
|
this._radioGroup = {
|
|
1382
1384
|
name: item.name,
|
|
@@ -6610,6 +6612,22 @@ Object.assign(LX, {
|
|
|
6610
6612
|
}
|
|
6611
6613
|
});
|
|
6612
6614
|
|
|
6615
|
+
/**
|
|
6616
|
+
* @method formatBytes
|
|
6617
|
+
* @param {Number} bytes
|
|
6618
|
+
**/
|
|
6619
|
+
function formatBytes( bytes )
|
|
6620
|
+
{
|
|
6621
|
+
if( bytes === 0 ) return "0 B";
|
|
6622
|
+
const k = 1024;
|
|
6623
|
+
const sizes = [ "B", "KB", "MB", "GB", "TB" ];
|
|
6624
|
+
const i = Math.floor( Math.log( bytes ) / Math.log( k ) );
|
|
6625
|
+
const value = bytes / Math.pow( k, i );
|
|
6626
|
+
return value.toFixed( 2 ) + " " + sizes[ i ];
|
|
6627
|
+
}
|
|
6628
|
+
|
|
6629
|
+
LX.formatBytes = formatBytes;
|
|
6630
|
+
|
|
6613
6631
|
/**
|
|
6614
6632
|
* @method compareThreshold
|
|
6615
6633
|
* @param {String} url
|
|
@@ -16159,7 +16177,8 @@ LX.AssetViewEvent = AssetViewEvent;
|
|
|
16159
16177
|
class AssetView {
|
|
16160
16178
|
|
|
16161
16179
|
static LAYOUT_GRID = 0;
|
|
16162
|
-
static
|
|
16180
|
+
static LAYOUT_COMPACT = 1;
|
|
16181
|
+
static LAYOUT_LIST = 2;
|
|
16163
16182
|
|
|
16164
16183
|
static CONTENT_SORT_ASC = 0;
|
|
16165
16184
|
static CONTENT_SORT_DESC = 1;
|
|
@@ -16421,7 +16440,9 @@ class AssetView {
|
|
|
16421
16440
|
}
|
|
16422
16441
|
else
|
|
16423
16442
|
{
|
|
16443
|
+
area.root.classList.add( "flex", "flex-col" );
|
|
16424
16444
|
this.toolsPanel = area.addPanel({ className: 'flex flex-col overflow-hidden', height:"auto" });
|
|
16445
|
+
this.toolsPanel.root.style.flex = "none";
|
|
16425
16446
|
this.contentPanel = area.addPanel({ className: 'lexassetcontentpanel flex flex-col overflow-hidden' });
|
|
16426
16447
|
}
|
|
16427
16448
|
|
|
@@ -16438,7 +16459,8 @@ class AssetView {
|
|
|
16438
16459
|
const _onChangeView = ( value, event ) => {
|
|
16439
16460
|
new LX.DropdownMenu( event.target, [
|
|
16440
16461
|
{ name: "Grid", icon: "LayoutGrid", callback: () => this._setContentLayout( AssetView.LAYOUT_GRID ) },
|
|
16441
|
-
{ name: "
|
|
16462
|
+
{ name: "Compact", icon: "LayoutList", callback: () => this._setContentLayout( AssetView.LAYOUT_COMPACT ) },
|
|
16463
|
+
{ name: "List", icon: "List", callback: () => this._setContentLayout( AssetView.LAYOUT_LIST ) }
|
|
16442
16464
|
], { side: "right", align: "start" });
|
|
16443
16465
|
};
|
|
16444
16466
|
|
|
@@ -16548,11 +16570,13 @@ class AssetView {
|
|
|
16548
16570
|
_refreshContent( searchValue, filter ) {
|
|
16549
16571
|
|
|
16550
16572
|
const isGridLayout = ( this.layout == AssetView.LAYOUT_GRID ); // default
|
|
16573
|
+
const isCompactLayout = ( this.layout == AssetView.LAYOUT_COMPACT );
|
|
16574
|
+
const isListLayout = ( this.layout == AssetView.LAYOUT_LIST );
|
|
16551
16575
|
|
|
16552
16576
|
this.filter = filter ?? ( this.filter ?? "None" );
|
|
16553
16577
|
this.searchValue = searchValue ?? (this.searchValue ?? "");
|
|
16554
16578
|
this.content.innerHTML = "";
|
|
16555
|
-
this.content.className =
|
|
16579
|
+
this.content.className = `lexassetscontent${ isCompactLayout ? " compact" : ( isListLayout ? " list" : "" ) }`;
|
|
16556
16580
|
let that = this;
|
|
16557
16581
|
|
|
16558
16582
|
const _addItem = function(item) {
|
|
@@ -16566,6 +16590,11 @@ class AssetView {
|
|
|
16566
16590
|
itemEl.tabIndex = -1;
|
|
16567
16591
|
that.content.appendChild( itemEl );
|
|
16568
16592
|
|
|
16593
|
+
if( item.lastModified && !item.lastModifiedDate )
|
|
16594
|
+
{
|
|
16595
|
+
item.lastModifiedDate = that._lastModifiedToStringDate( item.lastModified );
|
|
16596
|
+
}
|
|
16597
|
+
|
|
16569
16598
|
if( !that.useNativeTitle )
|
|
16570
16599
|
{
|
|
16571
16600
|
let desc = document.createElement( 'span' );
|
|
@@ -16687,14 +16716,17 @@ class AssetView {
|
|
|
16687
16716
|
}
|
|
16688
16717
|
}
|
|
16689
16718
|
|
|
16690
|
-
|
|
16719
|
+
// Add item type info
|
|
16720
|
+
let itemInfoHtml = type;
|
|
16721
|
+
|
|
16722
|
+
if( isListLayout )
|
|
16691
16723
|
{
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
info.innerText = type;
|
|
16695
|
-
itemEl.appendChild(info);
|
|
16724
|
+
if( item.bytesize ) itemInfoHtml += ` | ${ LX.formatBytes( item.bytesize ) }`;
|
|
16725
|
+
if( item.lastModifiedDate ) itemInfoHtml += ` | ${ item.lastModifiedDate }`;
|
|
16696
16726
|
}
|
|
16697
16727
|
|
|
16728
|
+
LX.makeContainer( [ "auto", "auto" ], "lexassetinfo", itemInfoHtml, itemEl );
|
|
16729
|
+
|
|
16698
16730
|
itemEl.addEventListener('click', function( e ) {
|
|
16699
16731
|
e.stopImmediatePropagation();
|
|
16700
16732
|
e.stopPropagation();
|
|
@@ -16836,18 +16868,18 @@ class AssetView {
|
|
|
16836
16868
|
const options = { disabled: true };
|
|
16837
16869
|
|
|
16838
16870
|
this.previewPanel.addText("Filename", file.id, null, options);
|
|
16839
|
-
if( file.
|
|
16871
|
+
if( file.lastModifiedDate ) this.previewPanel.addText("Last Modified", file.lastModifiedDate, null, options);
|
|
16840
16872
|
if( file._path || file.src ) this.previewPanel.addText("URL", file._path ? file._path : file.src, null, options);
|
|
16841
16873
|
this.previewPanel.addText("Path", this.path.join('/'), null, options);
|
|
16842
16874
|
this.previewPanel.addText("Type", file.type, null, options);
|
|
16843
|
-
if( file.bytesize ) this.previewPanel.addText("Size", (file.bytesize
|
|
16875
|
+
if( file.bytesize ) this.previewPanel.addText("Size", LX.formatBytes( file.bytesize ), null, options);
|
|
16844
16876
|
if( file.type == "folder" ) this.previewPanel.addText("Files", file.children ? file.children.length.toString() : "0", null, options);
|
|
16845
16877
|
|
|
16846
16878
|
this.previewPanel.addSeparator();
|
|
16847
16879
|
|
|
16848
16880
|
const previewActions = [...this.previewActions];
|
|
16849
16881
|
|
|
16850
|
-
if( !previewActions.length )
|
|
16882
|
+
if( !previewActions.length && file.type !== "folder" )
|
|
16851
16883
|
{
|
|
16852
16884
|
// By default
|
|
16853
16885
|
previewActions.push({
|
|
@@ -16887,7 +16919,8 @@ class AssetView {
|
|
|
16887
16919
|
"id": file.name,
|
|
16888
16920
|
"src": e.currentTarget.result,
|
|
16889
16921
|
"extension": ext,
|
|
16890
|
-
"lastModified": file.lastModified
|
|
16922
|
+
"lastModified": file.lastModified,
|
|
16923
|
+
"lastModifiedDate": this._lastModifiedToStringDate( file.lastModified )
|
|
16891
16924
|
};
|
|
16892
16925
|
|
|
16893
16926
|
switch(ext)
|
|
@@ -17000,6 +17033,11 @@ class AssetView {
|
|
|
17000
17033
|
|
|
17001
17034
|
this._processData( this.data );
|
|
17002
17035
|
}
|
|
17036
|
+
|
|
17037
|
+
_lastModifiedToStringDate( lm ) {
|
|
17038
|
+
const d = new Date( lm ).toLocaleString();
|
|
17039
|
+
return d.substring( 0, d.indexOf( ',' ) );
|
|
17040
|
+
}
|
|
17003
17041
|
}
|
|
17004
17042
|
|
|
17005
17043
|
LX.AssetView = AssetView;
|