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
|
@@ -360,6 +360,7 @@ class CodeEditor {
|
|
|
360
360
|
this.onCreateStatusPanel = options.onCreateStatusPanel;
|
|
361
361
|
this.onContextMenu = options.onContextMenu;
|
|
362
362
|
this.onNewTab = options.onNewTab;
|
|
363
|
+
this.onSelectTab = options.onSelectTab;
|
|
363
364
|
|
|
364
365
|
// File explorer
|
|
365
366
|
if( this.useFileExplorer )
|
|
@@ -671,16 +672,18 @@ class CodeEditor {
|
|
|
671
672
|
|
|
672
673
|
// Add search LINE box
|
|
673
674
|
{
|
|
674
|
-
|
|
675
|
-
box.className = "searchbox
|
|
675
|
+
const box = document.createElement( 'div' );
|
|
676
|
+
box.className = "searchbox";
|
|
676
677
|
|
|
677
|
-
|
|
678
|
+
const searchPanel = new LX.Panel();
|
|
678
679
|
box.appendChild( searchPanel.root );
|
|
679
680
|
|
|
681
|
+
searchPanel.sameLine( 2 );
|
|
680
682
|
searchPanel.addText( null, "", ( value, event ) => {
|
|
681
683
|
input.value = ":" + value.replaceAll( ':', '' );
|
|
682
684
|
this.goToLine( input.value.slice( 1 ) );
|
|
683
685
|
}, { placeholder: "Go to line", trigger: "input" } );
|
|
686
|
+
searchPanel.addButton( null, "x", this.hideSearchLineBox.bind( this ), { icon: "X", title: "Close", tooltip: true } );
|
|
684
687
|
|
|
685
688
|
let input = box.querySelector( 'input' );
|
|
686
689
|
input.addEventListener( 'keyup', e => {
|
|
@@ -1334,6 +1337,13 @@ class CodeEditor {
|
|
|
1334
1337
|
}
|
|
1335
1338
|
}
|
|
1336
1339
|
|
|
1340
|
+
// Clear signals
|
|
1341
|
+
clear() {
|
|
1342
|
+
console.assert( this.rightStatusPanel && this.leftStatusPanel, "No panels to clear." );
|
|
1343
|
+
this.rightStatusPanel.clear();
|
|
1344
|
+
this.leftStatusPanel.clear();
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1337
1347
|
static getInstances()
|
|
1338
1348
|
{
|
|
1339
1349
|
return CodeEditor.__instances;
|
|
@@ -1737,7 +1747,7 @@ class CodeEditor {
|
|
|
1737
1747
|
this.onCreateStatusPanel( panel, this );
|
|
1738
1748
|
}
|
|
1739
1749
|
|
|
1740
|
-
let leftStatusPanel = new LX.Panel( { id: "FontSizeZoomStatusComponent", height: "auto" } );
|
|
1750
|
+
let leftStatusPanel = this.leftStatusPanel = new LX.Panel( { id: "FontSizeZoomStatusComponent", height: "auto" } );
|
|
1741
1751
|
leftStatusPanel.sameLine();
|
|
1742
1752
|
|
|
1743
1753
|
if( this.skipTabs )
|
|
@@ -1751,7 +1761,7 @@ class CodeEditor {
|
|
|
1751
1761
|
leftStatusPanel.endLine( "justify-start" );
|
|
1752
1762
|
panel.attach( leftStatusPanel.root );
|
|
1753
1763
|
|
|
1754
|
-
let rightStatusPanel = new LX.Panel( { height: "auto" } );
|
|
1764
|
+
let rightStatusPanel = this.rightStatusPanel = new LX.Panel( { height: "auto" } );
|
|
1755
1765
|
rightStatusPanel.sameLine();
|
|
1756
1766
|
rightStatusPanel.addLabel( this.code?.title ?? "", { id: "EditorFilenameStatusComponent", fit: true, signal: "@tab-name" });
|
|
1757
1767
|
rightStatusPanel.addButton( null, "Ln 1, Col 1", this.showSearchLineBox.bind( this ), { id: "EditorSelectionStatusComponent", fit: true, signal: "@cursor-data" });
|
|
@@ -1928,9 +1938,16 @@ class CodeEditor {
|
|
|
1928
1938
|
|
|
1929
1939
|
this._removeSecondaryCursors();
|
|
1930
1940
|
|
|
1931
|
-
|
|
1932
|
-
|
|
1941
|
+
const cursor = this.getCurrentCursor( true );
|
|
1942
|
+
const lastCode = this.code;
|
|
1943
|
+
|
|
1944
|
+
if( lastCode )
|
|
1945
|
+
{
|
|
1946
|
+
this.saveCursor( cursor, lastCode.cursorState );
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1933
1949
|
this.code = this.loadedTabs[ name ];
|
|
1950
|
+
|
|
1934
1951
|
this.restoreCursor( cursor, this.code.cursorState );
|
|
1935
1952
|
|
|
1936
1953
|
this.endSelection();
|
|
@@ -1949,6 +1966,11 @@ class CodeEditor {
|
|
|
1949
1966
|
}
|
|
1950
1967
|
|
|
1951
1968
|
this.processLines();
|
|
1969
|
+
|
|
1970
|
+
if( !isNewTabButton && this.onSelectTab )
|
|
1971
|
+
{
|
|
1972
|
+
this.onSelectTab( name, this );
|
|
1973
|
+
}
|
|
1952
1974
|
}
|
|
1953
1975
|
|
|
1954
1976
|
_onContextMenuTab( isNewTabButton, event, name, ) {
|
|
@@ -2036,6 +2058,10 @@ class CodeEditor {
|
|
|
2036
2058
|
this.loadedTabs[ name ] = code;
|
|
2037
2059
|
this.openedTabs[ name ] = code;
|
|
2038
2060
|
|
|
2061
|
+
const lastCode = this.code;
|
|
2062
|
+
|
|
2063
|
+
this.code = code;
|
|
2064
|
+
|
|
2039
2065
|
const tabIcon = this._getFileIcon( name );
|
|
2040
2066
|
|
|
2041
2067
|
if( this.useFileExplorer && !isNewTabButton )
|
|
@@ -2063,13 +2089,6 @@ class CodeEditor {
|
|
|
2063
2089
|
|
|
2064
2090
|
this.endSelection();
|
|
2065
2091
|
|
|
2066
|
-
if( selected )
|
|
2067
|
-
{
|
|
2068
|
-
this.code = code;
|
|
2069
|
-
this.resetCursorPos( CodeEditor.CURSOR_LEFT_TOP );
|
|
2070
|
-
this.mustProcessLines = true;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
2092
|
if( options.language )
|
|
2074
2093
|
{
|
|
2075
2094
|
code.languageOverride = options.language;
|
|
@@ -2083,6 +2102,16 @@ class CodeEditor {
|
|
|
2083
2102
|
this.mustProcessLines = true;
|
|
2084
2103
|
}
|
|
2085
2104
|
|
|
2105
|
+
if( selected )
|
|
2106
|
+
{
|
|
2107
|
+
this.resetCursorPos( CodeEditor.CURSOR_LEFT_TOP );
|
|
2108
|
+
this.mustProcessLines = true;
|
|
2109
|
+
}
|
|
2110
|
+
else
|
|
2111
|
+
{
|
|
2112
|
+
this.code = lastCode;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2086
2115
|
this._processLinesIfNecessary();
|
|
2087
2116
|
|
|
2088
2117
|
this._updateDataInfoPanel( "@tab-name", name );
|
|
@@ -4158,7 +4187,7 @@ class CodeEditor {
|
|
|
4158
4187
|
const customStringKeys = Object.assign( {}, this.stringKeys );
|
|
4159
4188
|
const lineNumber = this._currentLineNumber;
|
|
4160
4189
|
const tokenStartIndex = this._currentTokenPositions[ tokenIndex ];
|
|
4161
|
-
const inBlockComment = ( this._buildingBlockComment ?? this._inBlockCommentSection( lineNumber, tokenStartIndex, token.length ) !== undefined
|
|
4190
|
+
const inBlockComment = ( this._buildingBlockComment ?? this._inBlockCommentSection( lineNumber, tokenStartIndex, token.length ) ) !== undefined;
|
|
4162
4191
|
|
|
4163
4192
|
var usePreviousTokenToCheckString = false;
|
|
4164
4193
|
|
|
@@ -131,13 +131,51 @@ class Timeline {
|
|
|
131
131
|
}
|
|
132
132
|
this.resize(this.size);
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
/**
|
|
135
|
+
* updates theme (light - dark) based on LX's current theme
|
|
136
|
+
*/
|
|
137
|
+
function updateTheme( ){
|
|
138
|
+
Timeline.BACKGROUND_COLOR = LX.getThemeColor("global-blur-background");
|
|
139
|
+
Timeline.TRACK_COLOR_PRIMARY = LX.getThemeColor("global-color-primary");
|
|
140
|
+
Timeline.TRACK_COLOR_SECONDARY = LX.getThemeColor("global-color-secondary");
|
|
141
|
+
Timeline.TRACK_COLOR_TERCIARY = LX.getThemeColor("global-color-terciary");
|
|
142
|
+
Timeline.TRACK_COLOR_QUATERNARY = LX.getThemeColor("global-color-quaternary");
|
|
143
|
+
Timeline.FONT = LX.getThemeColor("global-font");
|
|
144
|
+
Timeline.FONT_COLOR_PRIMARY = LX.getThemeColor("global-text-primary");
|
|
145
|
+
Timeline.FONT_COLOR_TERTIARY = LX.getThemeColor("global-text-tertiary");
|
|
146
|
+
Timeline.FONT_COLOR_QUATERNARY = LX.getThemeColor("global-text-quaternary");
|
|
147
|
+
|
|
148
|
+
Timeline.KEYFRAME_COLOR = LX.getThemeColor("lxTimeline-keyframe");
|
|
149
|
+
Timeline.KEYFRAME_COLOR_SELECTED = Timeline.KEYFRAME_COLOR_HOVERED = LX.getThemeColor("lxTimeline-keyframe-selected");
|
|
150
|
+
Timeline.KEYFRAME_COLOR_LOCK = LX.getThemeColor("lxTimeline-keyframe-locked");
|
|
151
|
+
Timeline.KEYFRAME_COLOR_EDITED = LX.getThemeColor("lxTimeline-keyframe-edited");
|
|
152
|
+
Timeline.KEYFRAME_COLOR_INACTIVE = LX.getThemeColor("lxTimeline-keyframe-inactive");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this.updateTheme = updateTheme.bind(this);
|
|
156
|
+
LX.addSignal( "@on_new_color_scheme", this.updateTheme );
|
|
140
157
|
}
|
|
158
|
+
|
|
159
|
+
// makes it ready to be deleted
|
|
160
|
+
clear(){
|
|
161
|
+
if( this.header ){
|
|
162
|
+
this.header.clear();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if( this.leftPanel ){
|
|
166
|
+
this.leftPanel.clear();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if( this.updateTheme ){
|
|
170
|
+
let signals = LX.signals[ "@on_new_color_scheme" ] ?? [];
|
|
171
|
+
for( let i =0; i < signals.length; ++i ){
|
|
172
|
+
if( signals[i] == this.updateTheme ){
|
|
173
|
+
signals.splice(i, 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
141
179
|
|
|
142
180
|
/**
|
|
143
181
|
* @method updateHeader
|
|
@@ -1249,28 +1287,6 @@ class Timeline {
|
|
|
1249
1287
|
this.updateLeftPanel();
|
|
1250
1288
|
}
|
|
1251
1289
|
|
|
1252
|
-
/**
|
|
1253
|
-
* updates theme (light - dark) based on LX's current theme
|
|
1254
|
-
*/
|
|
1255
|
-
updateTheme( ){
|
|
1256
|
-
Timeline.BACKGROUND_COLOR = LX.getThemeColor("global-blur-background");
|
|
1257
|
-
Timeline.TRACK_COLOR_PRIMARY = LX.getThemeColor("global-color-primary");
|
|
1258
|
-
Timeline.TRACK_COLOR_SECONDARY = LX.getThemeColor("global-color-secondary");
|
|
1259
|
-
Timeline.TRACK_COLOR_TERCIARY = LX.getThemeColor("global-color-terciary");
|
|
1260
|
-
Timeline.TRACK_COLOR_QUATERNARY = LX.getThemeColor("global-color-quaternary");
|
|
1261
|
-
Timeline.FONT = LX.getThemeColor("global-font");
|
|
1262
|
-
Timeline.FONT_COLOR_PRIMARY = LX.getThemeColor("global-text-primary");
|
|
1263
|
-
Timeline.FONT_COLOR_TERTIARY = LX.getThemeColor("global-text-tertiary");
|
|
1264
|
-
Timeline.FONT_COLOR_QUATERNARY = LX.getThemeColor("global-text-quaternary");
|
|
1265
|
-
|
|
1266
|
-
Timeline.KEYFRAME_COLOR = LX.getThemeColor("lxTimeline-keyframe");
|
|
1267
|
-
Timeline.KEYFRAME_COLOR_SELECTED = Timeline.KEYFRAME_COLOR_HOVERED = LX.getThemeColor("lxTimeline-keyframe-selected");
|
|
1268
|
-
Timeline.KEYFRAME_COLOR_LOCK = LX.getThemeColor("lxTimeline-keyframe-locked");
|
|
1269
|
-
Timeline.KEYFRAME_COLOR_EDITED = LX.getThemeColor("lxTimeline-keyframe-edited");
|
|
1270
|
-
Timeline.KEYFRAME_COLOR_INACTIVE =LX.getThemeColor("lxTimeline-keyframe-inactive");
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
1290
|
// ----- BASE FUNCTIONS -----
|
|
1275
1291
|
/**
|
|
1276
1292
|
These functions might be overriden by child classes. Nonetheless, they must have the same attributes, at least.
|
package/build/lexgui.css
CHANGED
|
@@ -4614,13 +4614,19 @@ ul.lexassetscontent {
|
|
|
4614
4614
|
overflow: auto;
|
|
4615
4615
|
}
|
|
4616
4616
|
|
|
4617
|
-
.lexassetscontent.
|
|
4617
|
+
.lexassetscontent.compact {
|
|
4618
4618
|
width: 100%;
|
|
4619
4619
|
display: grid;
|
|
4620
4620
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
4621
4621
|
column-gap: 0.5rem;
|
|
4622
4622
|
}
|
|
4623
4623
|
|
|
4624
|
+
.lexassetscontent.list {
|
|
4625
|
+
width: 100%;
|
|
4626
|
+
display: flex;
|
|
4627
|
+
flex-direction: column;
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4624
4630
|
.lexassetscontent li {
|
|
4625
4631
|
-webkit-text-size-adjust: 100%;
|
|
4626
4632
|
font-size: var(--global-font-size);
|
|
@@ -4670,7 +4676,7 @@ ul.lexassetscontent {
|
|
|
4670
4676
|
opacity: 1;
|
|
4671
4677
|
}
|
|
4672
4678
|
|
|
4673
|
-
.lexassetscontent.list li {
|
|
4679
|
+
.lexassetscontent.list li, .lexassetscontent.compact li {
|
|
4674
4680
|
width: 100%;
|
|
4675
4681
|
height: 1.8em;
|
|
4676
4682
|
border-top: 0px;
|
|
@@ -4755,7 +4761,7 @@ ul.lexassetscontent {
|
|
|
4755
4761
|
z-index: 1;
|
|
4756
4762
|
}
|
|
4757
4763
|
|
|
4758
|
-
.lexassetscontent.list li .lexassettitle {
|
|
4764
|
+
.lexassetscontent.list li .lexassettitle, .lexassetscontent.compact li .lexassettitle {
|
|
4759
4765
|
width: 100%;
|
|
4760
4766
|
height: 100%;
|
|
4761
4767
|
text-align: left;
|
|
@@ -4774,13 +4780,13 @@ ul.lexassetscontent {
|
|
|
4774
4780
|
display: none;
|
|
4775
4781
|
}
|
|
4776
4782
|
|
|
4777
|
-
.lexassetscontent.list li .lexassetinfo {
|
|
4783
|
+
.lexassetscontent.list li .lexassetinfo, .lexassetscontent.compact li .lexassetinfo {
|
|
4778
4784
|
display: block;
|
|
4779
4785
|
right: 6px;
|
|
4780
4786
|
z-index: 1;
|
|
4781
4787
|
}
|
|
4782
4788
|
|
|
4783
|
-
.lexassetscontent.list li:has(.lexcheckbox) .lexassetinfo {
|
|
4789
|
+
.lexassetscontent.list li:has(.lexcheckbox) .lexassetinfo, .lexassetscontent.compact li:has(.lexcheckbox) .lexassetinfo {
|
|
4784
4790
|
display: block;
|
|
4785
4791
|
right: 32px;
|
|
4786
4792
|
z-index: 1;
|
|
@@ -4794,7 +4800,7 @@ ul.lexassetscontent {
|
|
|
4794
4800
|
height: 1.15em;
|
|
4795
4801
|
}
|
|
4796
4802
|
|
|
4797
|
-
.lexassetscontent.list li .lexcheckbox {
|
|
4803
|
+
.lexassetscontent.list li .lexcheckbox, .lexassetscontent.compact li .lexcheckbox {
|
|
4798
4804
|
right: 3px;
|
|
4799
4805
|
top: 3px;
|
|
4800
4806
|
}
|
|
@@ -4819,7 +4825,7 @@ ul.lexassetscontent {
|
|
|
4819
4825
|
transition: all 0.2s;
|
|
4820
4826
|
}
|
|
4821
4827
|
|
|
4822
|
-
.lexassetscontent.list img {
|
|
4828
|
+
.lexassetscontent.list img, .lexassetscontent.compact img {
|
|
4823
4829
|
width: unset;
|
|
4824
4830
|
object-fit: contain;
|
|
4825
4831
|
float: left;
|
|
@@ -4831,7 +4837,7 @@ ul.lexassetscontent {
|
|
|
4831
4837
|
transform: translateY(-6px);
|
|
4832
4838
|
}
|
|
4833
4839
|
|
|
4834
|
-
.lexassetscontent.list li.folder img {
|
|
4840
|
+
.lexassetscontent.list li.folder img, .lexassetscontent.compact li.folder img {
|
|
4835
4841
|
transform: scale(0.9);
|
|
4836
4842
|
}
|
|
4837
4843
|
|
|
@@ -4922,7 +4928,7 @@ ul.lexassetscontent {
|
|
|
4922
4928
|
display: flex;
|
|
4923
4929
|
position: relative;
|
|
4924
4930
|
overflow: inherit;
|
|
4925
|
-
background-color:
|
|
4931
|
+
background-color: var(--global-color-secondary);
|
|
4926
4932
|
}
|
|
4927
4933
|
|
|
4928
4934
|
.codebasearea * {
|
|
@@ -5009,7 +5015,7 @@ ul.lexassetscontent {
|
|
|
5009
5015
|
}
|
|
5010
5016
|
|
|
5011
5017
|
.lexcodetabinfo {
|
|
5012
|
-
background-color:
|
|
5018
|
+
background-color: var(--global-color-secondary);
|
|
5013
5019
|
position: absolute;
|
|
5014
5020
|
z-index: 3;
|
|
5015
5021
|
bottom: 0px;
|
|
@@ -5254,7 +5260,6 @@ ul.lexassetscontent {
|
|
|
5254
5260
|
|
|
5255
5261
|
.lexcodeeditor .searchbox {
|
|
5256
5262
|
background-color: var(--global-color-secondary);
|
|
5257
|
-
/* width: 256px; */
|
|
5258
5263
|
position: absolute;
|
|
5259
5264
|
right: 6px;
|
|
5260
5265
|
top: 26px;
|
|
@@ -5268,10 +5273,6 @@ ul.lexassetscontent {
|
|
|
5268
5273
|
transition: transform 0.2s ease-in, opacity 0.2s ease-in;
|
|
5269
5274
|
}
|
|
5270
5275
|
|
|
5271
|
-
.lexcodeeditor .searchbox.gotoline {
|
|
5272
|
-
width: 124px;
|
|
5273
|
-
}
|
|
5274
|
-
|
|
5275
5276
|
.lexcodeeditor .searchbox.opened {
|
|
5276
5277
|
transform: translateY(0px);
|
|
5277
5278
|
opacity: 1;
|
package/build/lexgui.js
CHANGED
|
@@ -14,7 +14,7 @@ console.warn( 'Script _build/lexgui.js_ is depracated and will be removed soon.
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const LX = {
|
|
17
|
-
version: "0.7.
|
|
17
|
+
version: "0.7.8",
|
|
18
18
|
ready: false,
|
|
19
19
|
extensions: [], // Store extensions used
|
|
20
20
|
signals: {}, // Events and triggers
|
|
@@ -1246,7 +1246,7 @@ class DropdownMenu {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
1248
|
const menuItem = document.createElement('div');
|
|
1249
|
-
menuItem.className = "lexdropdownmenuitem" + ( item.name ? "" : " label" ) + ( item.disabled ?? false ? " disabled" : "" ) + ( ` ${ item.className ?? "" }` );
|
|
1249
|
+
menuItem.className = "lexdropdownmenuitem" + ( ( item.name || item.options ) ? "" : " label" ) + ( item.disabled ?? false ? " disabled" : "" ) + ( ` ${ item.className ?? "" }` );
|
|
1250
1250
|
menuItem.dataset["id"] = pKey;
|
|
1251
1251
|
menuItem.innerHTML = `<span>${ key }</span>`;
|
|
1252
1252
|
menuItem.tabIndex = "1";
|
|
@@ -1332,7 +1332,7 @@ class DropdownMenu {
|
|
|
1332
1332
|
else
|
|
1333
1333
|
{
|
|
1334
1334
|
menuItem.addEventListener( "click", () => {
|
|
1335
|
-
const f = item
|
|
1335
|
+
const f = item.callback;
|
|
1336
1336
|
if( f )
|
|
1337
1337
|
{
|
|
1338
1338
|
f.call( this, key, menuItem );
|
|
@@ -1344,7 +1344,11 @@ class DropdownMenu {
|
|
|
1344
1344
|
this._trigger[ radioName ] = key;
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
|
-
|
|
1347
|
+
// If has options, it's a radio group label, so don't close the menu
|
|
1348
|
+
if( !item.options && ( item.closeOnClick ?? true ) )
|
|
1349
|
+
{
|
|
1350
|
+
this.destroy( true );
|
|
1351
|
+
}
|
|
1348
1352
|
} );
|
|
1349
1353
|
}
|
|
1350
1354
|
|
|
@@ -1382,8 +1386,6 @@ class DropdownMenu {
|
|
|
1382
1386
|
|
|
1383
1387
|
if( item.options )
|
|
1384
1388
|
{
|
|
1385
|
-
this._addSeparator();
|
|
1386
|
-
|
|
1387
1389
|
console.assert( this._trigger[ item.name ] && "An item of the radio group must be selected!" );
|
|
1388
1390
|
this._radioGroup = {
|
|
1389
1391
|
name: item.name,
|
|
@@ -6617,6 +6619,22 @@ Object.assign(LX, {
|
|
|
6617
6619
|
}
|
|
6618
6620
|
});
|
|
6619
6621
|
|
|
6622
|
+
/**
|
|
6623
|
+
* @method formatBytes
|
|
6624
|
+
* @param {Number} bytes
|
|
6625
|
+
**/
|
|
6626
|
+
function formatBytes( bytes )
|
|
6627
|
+
{
|
|
6628
|
+
if( bytes === 0 ) return "0 B";
|
|
6629
|
+
const k = 1024;
|
|
6630
|
+
const sizes = [ "B", "KB", "MB", "GB", "TB" ];
|
|
6631
|
+
const i = Math.floor( Math.log( bytes ) / Math.log( k ) );
|
|
6632
|
+
const value = bytes / Math.pow( k, i );
|
|
6633
|
+
return value.toFixed( 2 ) + " " + sizes[ i ];
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6636
|
+
LX.formatBytes = formatBytes;
|
|
6637
|
+
|
|
6620
6638
|
/**
|
|
6621
6639
|
* @method compareThreshold
|
|
6622
6640
|
* @param {String} url
|
|
@@ -16166,7 +16184,8 @@ LX.AssetViewEvent = AssetViewEvent;
|
|
|
16166
16184
|
class AssetView {
|
|
16167
16185
|
|
|
16168
16186
|
static LAYOUT_GRID = 0;
|
|
16169
|
-
static
|
|
16187
|
+
static LAYOUT_COMPACT = 1;
|
|
16188
|
+
static LAYOUT_LIST = 2;
|
|
16170
16189
|
|
|
16171
16190
|
static CONTENT_SORT_ASC = 0;
|
|
16172
16191
|
static CONTENT_SORT_DESC = 1;
|
|
@@ -16428,7 +16447,9 @@ class AssetView {
|
|
|
16428
16447
|
}
|
|
16429
16448
|
else
|
|
16430
16449
|
{
|
|
16450
|
+
area.root.classList.add( "flex", "flex-col" );
|
|
16431
16451
|
this.toolsPanel = area.addPanel({ className: 'flex flex-col overflow-hidden', height:"auto" });
|
|
16452
|
+
this.toolsPanel.root.style.flex = "none";
|
|
16432
16453
|
this.contentPanel = area.addPanel({ className: 'lexassetcontentpanel flex flex-col overflow-hidden' });
|
|
16433
16454
|
}
|
|
16434
16455
|
|
|
@@ -16445,7 +16466,8 @@ class AssetView {
|
|
|
16445
16466
|
const _onChangeView = ( value, event ) => {
|
|
16446
16467
|
new LX.DropdownMenu( event.target, [
|
|
16447
16468
|
{ name: "Grid", icon: "LayoutGrid", callback: () => this._setContentLayout( AssetView.LAYOUT_GRID ) },
|
|
16448
|
-
{ name: "
|
|
16469
|
+
{ name: "Compact", icon: "LayoutList", callback: () => this._setContentLayout( AssetView.LAYOUT_COMPACT ) },
|
|
16470
|
+
{ name: "List", icon: "List", callback: () => this._setContentLayout( AssetView.LAYOUT_LIST ) }
|
|
16449
16471
|
], { side: "right", align: "start" });
|
|
16450
16472
|
};
|
|
16451
16473
|
|
|
@@ -16555,11 +16577,13 @@ class AssetView {
|
|
|
16555
16577
|
_refreshContent( searchValue, filter ) {
|
|
16556
16578
|
|
|
16557
16579
|
const isGridLayout = ( this.layout == AssetView.LAYOUT_GRID ); // default
|
|
16580
|
+
const isCompactLayout = ( this.layout == AssetView.LAYOUT_COMPACT );
|
|
16581
|
+
const isListLayout = ( this.layout == AssetView.LAYOUT_LIST );
|
|
16558
16582
|
|
|
16559
16583
|
this.filter = filter ?? ( this.filter ?? "None" );
|
|
16560
16584
|
this.searchValue = searchValue ?? (this.searchValue ?? "");
|
|
16561
16585
|
this.content.innerHTML = "";
|
|
16562
|
-
this.content.className =
|
|
16586
|
+
this.content.className = `lexassetscontent${ isCompactLayout ? " compact" : ( isListLayout ? " list" : "" ) }`;
|
|
16563
16587
|
let that = this;
|
|
16564
16588
|
|
|
16565
16589
|
const _addItem = function(item) {
|
|
@@ -16573,6 +16597,11 @@ class AssetView {
|
|
|
16573
16597
|
itemEl.tabIndex = -1;
|
|
16574
16598
|
that.content.appendChild( itemEl );
|
|
16575
16599
|
|
|
16600
|
+
if( item.lastModified && !item.lastModifiedDate )
|
|
16601
|
+
{
|
|
16602
|
+
item.lastModifiedDate = that._lastModifiedToStringDate( item.lastModified );
|
|
16603
|
+
}
|
|
16604
|
+
|
|
16576
16605
|
if( !that.useNativeTitle )
|
|
16577
16606
|
{
|
|
16578
16607
|
let desc = document.createElement( 'span' );
|
|
@@ -16694,14 +16723,17 @@ class AssetView {
|
|
|
16694
16723
|
}
|
|
16695
16724
|
}
|
|
16696
16725
|
|
|
16697
|
-
|
|
16726
|
+
// Add item type info
|
|
16727
|
+
let itemInfoHtml = type;
|
|
16728
|
+
|
|
16729
|
+
if( isListLayout )
|
|
16698
16730
|
{
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
info.innerText = type;
|
|
16702
|
-
itemEl.appendChild(info);
|
|
16731
|
+
if( item.bytesize ) itemInfoHtml += ` | ${ LX.formatBytes( item.bytesize ) }`;
|
|
16732
|
+
if( item.lastModifiedDate ) itemInfoHtml += ` | ${ item.lastModifiedDate }`;
|
|
16703
16733
|
}
|
|
16704
16734
|
|
|
16735
|
+
LX.makeContainer( [ "auto", "auto" ], "lexassetinfo", itemInfoHtml, itemEl );
|
|
16736
|
+
|
|
16705
16737
|
itemEl.addEventListener('click', function( e ) {
|
|
16706
16738
|
e.stopImmediatePropagation();
|
|
16707
16739
|
e.stopPropagation();
|
|
@@ -16843,18 +16875,18 @@ class AssetView {
|
|
|
16843
16875
|
const options = { disabled: true };
|
|
16844
16876
|
|
|
16845
16877
|
this.previewPanel.addText("Filename", file.id, null, options);
|
|
16846
|
-
if( file.
|
|
16878
|
+
if( file.lastModifiedDate ) this.previewPanel.addText("Last Modified", file.lastModifiedDate, null, options);
|
|
16847
16879
|
if( file._path || file.src ) this.previewPanel.addText("URL", file._path ? file._path : file.src, null, options);
|
|
16848
16880
|
this.previewPanel.addText("Path", this.path.join('/'), null, options);
|
|
16849
16881
|
this.previewPanel.addText("Type", file.type, null, options);
|
|
16850
|
-
if( file.bytesize ) this.previewPanel.addText("Size", (file.bytesize
|
|
16882
|
+
if( file.bytesize ) this.previewPanel.addText("Size", LX.formatBytes( file.bytesize ), null, options);
|
|
16851
16883
|
if( file.type == "folder" ) this.previewPanel.addText("Files", file.children ? file.children.length.toString() : "0", null, options);
|
|
16852
16884
|
|
|
16853
16885
|
this.previewPanel.addSeparator();
|
|
16854
16886
|
|
|
16855
16887
|
const previewActions = [...this.previewActions];
|
|
16856
16888
|
|
|
16857
|
-
if( !previewActions.length )
|
|
16889
|
+
if( !previewActions.length && file.type !== "folder" )
|
|
16858
16890
|
{
|
|
16859
16891
|
// By default
|
|
16860
16892
|
previewActions.push({
|
|
@@ -16894,7 +16926,8 @@ class AssetView {
|
|
|
16894
16926
|
"id": file.name,
|
|
16895
16927
|
"src": e.currentTarget.result,
|
|
16896
16928
|
"extension": ext,
|
|
16897
|
-
"lastModified": file.lastModified
|
|
16929
|
+
"lastModified": file.lastModified,
|
|
16930
|
+
"lastModifiedDate": this._lastModifiedToStringDate( file.lastModified )
|
|
16898
16931
|
};
|
|
16899
16932
|
|
|
16900
16933
|
switch(ext)
|
|
@@ -17007,6 +17040,11 @@ class AssetView {
|
|
|
17007
17040
|
|
|
17008
17041
|
this._processData( this.data );
|
|
17009
17042
|
}
|
|
17043
|
+
|
|
17044
|
+
_lastModifiedToStringDate( lm ) {
|
|
17045
|
+
const d = new Date( lm ).toLocaleString();
|
|
17046
|
+
return d.substring( 0, d.indexOf( ',' ) );
|
|
17047
|
+
}
|
|
17010
17048
|
}
|
|
17011
17049
|
|
|
17012
17050
|
LX.AssetView = AssetView;
|