lexgui 0.7.11 → 0.7.13
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 +85 -25
- package/build/extensions/timeline.js +206 -110
- package/build/lexgui.css +0 -1
- package/build/lexgui.js +129 -33
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +153 -57
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +30 -1
- package/examples/editor.html +31 -4
- 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.7.
|
|
10
|
+
version: "0.7.13",
|
|
11
11
|
ready: false,
|
|
12
12
|
extensions: [], // Store extensions used
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -4570,8 +4570,8 @@ Element.prototype.ignore = function( eventName, callbackName ) {
|
|
|
4570
4570
|
callbackName = callbackName ?? ( "_on" + eventName );
|
|
4571
4571
|
const callback = this[ callbackName ];
|
|
4572
4572
|
this.removeEventListener( eventName, callback );
|
|
4573
|
-
};
|
|
4574
|
-
|
|
4573
|
+
};
|
|
4574
|
+
|
|
4575
4575
|
// icons.js @jxarco
|
|
4576
4576
|
|
|
4577
4577
|
const RAW_ICONS = {
|
|
@@ -4752,8 +4752,8 @@ LX.LucideIconAlias = {
|
|
|
4752
4752
|
"RotateRight": "RotateCw",
|
|
4753
4753
|
"RotateBack": "RotateCcw",
|
|
4754
4754
|
"RotateLeft": "RotateCcw",
|
|
4755
|
-
};
|
|
4756
|
-
|
|
4755
|
+
};
|
|
4756
|
+
|
|
4757
4757
|
// utils.js @jxarco
|
|
4758
4758
|
|
|
4759
4759
|
function clamp( num, min, max ) { return Math.min( Math.max( num, min ), max ); }
|
|
@@ -5322,11 +5322,12 @@ LX.guidGenerator = guidGenerator;
|
|
|
5322
5322
|
function buildTextPattern( options = {} )
|
|
5323
5323
|
{
|
|
5324
5324
|
let patterns = [];
|
|
5325
|
-
if
|
|
5326
|
-
if
|
|
5327
|
-
if
|
|
5328
|
-
if
|
|
5329
|
-
if
|
|
5325
|
+
if( options.lowercase ) patterns.push("(?=.*[a-z])");
|
|
5326
|
+
if( options.uppercase ) patterns.push("(?=.*[A-Z])");
|
|
5327
|
+
if( options.digit ) patterns.push("(?=.*\\d)");
|
|
5328
|
+
if( options.specialChar ) patterns.push("(?=.*[@#$%^&+=!])");
|
|
5329
|
+
if( options.noSpaces ) patterns.push("(?!.*\\s)");
|
|
5330
|
+
if( options.email ) patterns.push("(^[^\s@]+@[^\s@]+\.[^\s@]+$)");
|
|
5330
5331
|
|
|
5331
5332
|
let minLength = options.minLength || 0;
|
|
5332
5333
|
let maxLength = options.maxLength || ""; // Empty means no max length restriction
|
|
@@ -5337,6 +5338,45 @@ function buildTextPattern( options = {} )
|
|
|
5337
5338
|
|
|
5338
5339
|
LX.buildTextPattern = buildTextPattern;
|
|
5339
5340
|
|
|
5341
|
+
/**
|
|
5342
|
+
* Checks a value against a set of pattern requirements and returns an array
|
|
5343
|
+
* of specific error messages for all criteria that failed.
|
|
5344
|
+
* @param { String } value The string to validate.
|
|
5345
|
+
* @param { Object } pattern The pattern options
|
|
5346
|
+
* @returns { Array } An array of error messages for failed criteria.
|
|
5347
|
+
*/
|
|
5348
|
+
function validateValueAtPattern( value, pattern = {}, ...args )
|
|
5349
|
+
{
|
|
5350
|
+
const errors = [];
|
|
5351
|
+
const minLength = pattern.minLength || 0;
|
|
5352
|
+
const maxLength = pattern.maxLength; // undefined means no max limit
|
|
5353
|
+
|
|
5354
|
+
// Length requirements
|
|
5355
|
+
if( value.length < minLength ) errors.push(`Must be at least ${ minLength } characters long.`);
|
|
5356
|
+
else if( maxLength !== undefined && value.length > maxLength ) errors.push(`Must be no more than ${ maxLength } characters long.`);
|
|
5357
|
+
|
|
5358
|
+
// Check for Lowercase, Uppercase, Digits
|
|
5359
|
+
if( pattern.lowercase && !/[a-z]/.test( value ) ) errors.push( "Must contain at least one lowercase letter (a-z)." );
|
|
5360
|
+
if( pattern.uppercase && !/[A-Z]/.test( value ) ) errors.push( "Must contain at least one uppercase letter (A-Z)." );
|
|
5361
|
+
if( pattern.digit && !/\d/.test( value ) ) errors.push( "Must contain at least one number (0-9)." );
|
|
5362
|
+
|
|
5363
|
+
// Check for No Spaces (The original regex was (?!.*\s), meaning 'not followed by any character and a space')
|
|
5364
|
+
if( pattern.noSpaces && /\s/.test(value)) errors.push("Must NOT contain any spaces.");
|
|
5365
|
+
|
|
5366
|
+
// Check for Special Character (using the same set as buildTextPattern)
|
|
5367
|
+
if( pattern.specialChar && !/[@#$%^&+=!]/.test( value ) ) errors.push("Must contain at least one special character (e.g., @, #, $, %, ^, &, +, =, !).");
|
|
5368
|
+
|
|
5369
|
+
// Check email formatting
|
|
5370
|
+
if( pattern.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test( value ) ) errors.push("Must have a valid email format.");
|
|
5371
|
+
|
|
5372
|
+
// Check match to any other text word
|
|
5373
|
+
if( pattern.fieldMatchName && value !== ( args[ 0 ] ) ) errors.push(`Must match ${ pattern.fieldMatchName } field.`);
|
|
5374
|
+
|
|
5375
|
+
return errors;
|
|
5376
|
+
}
|
|
5377
|
+
|
|
5378
|
+
LX.validateValueAtPattern = validateValueAtPattern;
|
|
5379
|
+
|
|
5340
5380
|
/**
|
|
5341
5381
|
* @method makeDraggable
|
|
5342
5382
|
* @description Allows an element to be dragged
|
|
@@ -6736,8 +6776,8 @@ function drawSpline( ctx, pts, t )
|
|
|
6736
6776
|
ctx.restore();
|
|
6737
6777
|
}
|
|
6738
6778
|
|
|
6739
|
-
LX.drawSpline = drawSpline;
|
|
6740
|
-
|
|
6779
|
+
LX.drawSpline = drawSpline;
|
|
6780
|
+
|
|
6741
6781
|
// area.js @jxarco
|
|
6742
6782
|
|
|
6743
6783
|
class AreaOverlayButtons {
|
|
@@ -7887,8 +7927,8 @@ class Area {
|
|
|
7887
7927
|
}
|
|
7888
7928
|
}
|
|
7889
7929
|
}
|
|
7890
|
-
LX.Area = Area;
|
|
7891
|
-
|
|
7930
|
+
LX.Area = Area;
|
|
7931
|
+
|
|
7892
7932
|
// base_component.js @jxarco
|
|
7893
7933
|
|
|
7894
7934
|
/**
|
|
@@ -9055,7 +9095,14 @@ class TextInput extends BaseComponent
|
|
|
9055
9095
|
|
|
9056
9096
|
this.onSetValue = ( newValue, skipCallback, event ) => {
|
|
9057
9097
|
|
|
9058
|
-
|
|
9098
|
+
let skipTrigger = ( this._lastValueTriggered == newValue );
|
|
9099
|
+
|
|
9100
|
+
if( !options.ignoreValidation )
|
|
9101
|
+
{
|
|
9102
|
+
skipTrigger |= ( !this.valid( newValue ) );
|
|
9103
|
+
}
|
|
9104
|
+
|
|
9105
|
+
if( skipTrigger )
|
|
9059
9106
|
{
|
|
9060
9107
|
return;
|
|
9061
9108
|
}
|
|
@@ -9075,11 +9122,11 @@ class TextInput extends BaseComponent
|
|
|
9075
9122
|
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
9076
9123
|
};
|
|
9077
9124
|
|
|
9078
|
-
this.valid = ( v ) => {
|
|
9125
|
+
this.valid = ( v, matchField ) => {
|
|
9079
9126
|
v = v ?? this.value();
|
|
9080
|
-
if(
|
|
9081
|
-
const
|
|
9082
|
-
return
|
|
9127
|
+
if( !options.pattern ) return true;
|
|
9128
|
+
const errs = LX.validateValueAtPattern( v, options.pattern, matchField );
|
|
9129
|
+
return ( errs.length == 0 );
|
|
9083
9130
|
};
|
|
9084
9131
|
|
|
9085
9132
|
let container = document.createElement( 'div' );
|
|
@@ -9108,7 +9155,7 @@ class TextInput extends BaseComponent
|
|
|
9108
9155
|
|
|
9109
9156
|
if( options.pattern )
|
|
9110
9157
|
{
|
|
9111
|
-
wValue.setAttribute( "pattern", options.pattern );
|
|
9158
|
+
wValue.setAttribute( "pattern", LX.buildTextPattern( options.pattern ) );
|
|
9112
9159
|
}
|
|
9113
9160
|
|
|
9114
9161
|
const trigger = options.trigger ?? "default";
|
|
@@ -9778,13 +9825,14 @@ class Form extends BaseComponent
|
|
|
9778
9825
|
|
|
9779
9826
|
if( entryData.constructor != Object )
|
|
9780
9827
|
{
|
|
9781
|
-
const oldValue =
|
|
9828
|
+
const oldValue = LX.deepCopy( entryData );
|
|
9782
9829
|
entryData = { value: oldValue };
|
|
9783
9830
|
data[ entry ] = entryData;
|
|
9784
9831
|
}
|
|
9785
9832
|
|
|
9786
|
-
entryData.placeholder = entryData.placeholder ?? ( entryData.label ?? `Enter ${ entry }` );
|
|
9787
9833
|
entryData.width = "100%";
|
|
9834
|
+
entryData.placeholder = entryData.placeholder ?? ( entryData.label ?? `Enter ${ entry }` );
|
|
9835
|
+
entryData.ignoreValidation = true;
|
|
9788
9836
|
|
|
9789
9837
|
if( !( options.skipLabels ?? false ) )
|
|
9790
9838
|
{
|
|
@@ -9800,14 +9848,14 @@ class Form extends BaseComponent
|
|
|
9800
9848
|
container.formData[ entry ] = entryData.constructor == Object ? entryData.value : entryData;
|
|
9801
9849
|
}
|
|
9802
9850
|
|
|
9803
|
-
const buttonContainer = LX.makeContainer( ["100%", "auto"], "flex flex-row", "", container );
|
|
9851
|
+
const buttonContainer = LX.makeContainer( ["100%", "auto"], "flex flex-row mt-2", "", container );
|
|
9804
9852
|
|
|
9805
9853
|
if( options.secondaryActionName || options.secondaryActionCallback )
|
|
9806
9854
|
{
|
|
9807
9855
|
const secondaryButton = new LX.Button( null, options.secondaryActionName ?? "Cancel", ( value, event ) => {
|
|
9808
|
-
if(
|
|
9856
|
+
if( options.secondaryActionCallback )
|
|
9809
9857
|
{
|
|
9810
|
-
|
|
9858
|
+
options.secondaryActionCallback( container.formData, event );
|
|
9811
9859
|
}
|
|
9812
9860
|
}, { width: "100%", minWidth: "0", buttonClass: options.secondaryButtonClass ?? "primary" } );
|
|
9813
9861
|
|
|
@@ -9822,9 +9870,22 @@ class Form extends BaseComponent
|
|
|
9822
9870
|
{
|
|
9823
9871
|
let entryData = data[ entry ];
|
|
9824
9872
|
|
|
9825
|
-
|
|
9873
|
+
const pattern = entryData.pattern;
|
|
9874
|
+
const matchField = pattern?.fieldMatchName ? container.formData[ pattern.fieldMatchName ] : undefined;
|
|
9875
|
+
|
|
9876
|
+
if( !entryData.textComponent.valid( undefined, matchField ) )
|
|
9826
9877
|
{
|
|
9827
|
-
|
|
9878
|
+
const err = { entry, type: "input_not_valid" };
|
|
9879
|
+
err.messages = [];
|
|
9880
|
+
if( pattern )
|
|
9881
|
+
{
|
|
9882
|
+
err.messages = LX.validateValueAtPattern(
|
|
9883
|
+
container.formData[ entry ],
|
|
9884
|
+
pattern,
|
|
9885
|
+
matchField
|
|
9886
|
+
);
|
|
9887
|
+
}
|
|
9888
|
+
errors.push( err );
|
|
9828
9889
|
}
|
|
9829
9890
|
}
|
|
9830
9891
|
|
|
@@ -12698,6 +12759,7 @@ class Table extends BaseComponent
|
|
|
12698
12759
|
this.filter = options.filter ?? false;
|
|
12699
12760
|
this.customFilters = options.customFilters ?? false;
|
|
12700
12761
|
this._toggleColumns = options.toggleColumns ?? false;
|
|
12762
|
+
this._sortColumns = options.sortColumns ?? true;
|
|
12701
12763
|
this._currentFilter = options.filterValue;
|
|
12702
12764
|
|
|
12703
12765
|
data.head = data.head ?? [];
|
|
@@ -12964,28 +13026,62 @@ class Table extends BaseComponent
|
|
|
12964
13026
|
th.classList.add( "centered" );
|
|
12965
13027
|
}
|
|
12966
13028
|
|
|
12967
|
-
const menuOptions = [
|
|
12968
|
-
{ name: "Asc", icon: "ArrowUpAZ", callback: sortFn.bind( this, idx, 1 ) },
|
|
12969
|
-
{ name: "Desc", icon: "ArrowDownAZ", callback: sortFn.bind( this, idx, -1 ) }
|
|
12970
|
-
];
|
|
13029
|
+
const menuOptions = [];
|
|
12971
13030
|
|
|
12972
|
-
if(
|
|
13031
|
+
if( options.columnActions )
|
|
12973
13032
|
{
|
|
12974
|
-
|
|
12975
|
-
|
|
13033
|
+
for( let action of options.columnActions )
|
|
13034
|
+
{
|
|
13035
|
+
if( !action.name )
|
|
12976
13036
|
{
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
const cells = table.querySelectorAll(`tr > *:nth-child(${idx + this.rowOffsetCount + 1})`);
|
|
12980
|
-
cells.forEach( cell => {
|
|
12981
|
-
cell.style.display = ( cell.style.display === "none" ) ? "" : "none";
|
|
12982
|
-
} );
|
|
12983
|
-
}
|
|
13037
|
+
console.warn( "Invalid column action (missing name):", action );
|
|
13038
|
+
continue;
|
|
12984
13039
|
}
|
|
13040
|
+
|
|
13041
|
+
menuOptions.push( { name: action.name, icon: action.icon, className: action.className, callback: () => {
|
|
13042
|
+
const colRows = this.data.body.map( row => [ row[ idx ] ] );
|
|
13043
|
+
const mustRefresh = action.callback( colRows, table );
|
|
13044
|
+
if( mustRefresh )
|
|
13045
|
+
{
|
|
13046
|
+
this.refresh();
|
|
13047
|
+
}
|
|
13048
|
+
} } );
|
|
13049
|
+
}
|
|
13050
|
+
}
|
|
13051
|
+
|
|
13052
|
+
if( this._sortColumns )
|
|
13053
|
+
{
|
|
13054
|
+
if( menuOptions.length > 0 )
|
|
13055
|
+
{
|
|
13056
|
+
menuOptions.push( null );
|
|
13057
|
+
}
|
|
13058
|
+
|
|
13059
|
+
menuOptions.push(
|
|
13060
|
+
{ name: "Asc", icon: "ArrowUpAZ", callback: sortFn.bind( this, idx, 1 ) },
|
|
13061
|
+
{ name: "Desc", icon: "ArrowDownAZ", callback: sortFn.bind( this, idx, -1 ) }
|
|
12985
13062
|
);
|
|
12986
13063
|
}
|
|
12987
13064
|
|
|
13065
|
+
if( this._toggleColumns )
|
|
13066
|
+
{
|
|
13067
|
+
if( menuOptions.length > 0 )
|
|
13068
|
+
{
|
|
13069
|
+
menuOptions.push( null );
|
|
13070
|
+
}
|
|
13071
|
+
|
|
13072
|
+
menuOptions.push( {
|
|
13073
|
+
name: "Hide", icon: "EyeOff", callback: () => {
|
|
13074
|
+
data.colVisibilityMap[ idx ] = false;
|
|
13075
|
+
const cells = table.querySelectorAll(`tr > *:nth-child(${idx + this.rowOffsetCount + 1})`);
|
|
13076
|
+
cells.forEach( cell => {
|
|
13077
|
+
cell.style.display = ( cell.style.display === "none" ) ? "" : "none";
|
|
13078
|
+
} );
|
|
13079
|
+
}
|
|
13080
|
+
} );
|
|
13081
|
+
}
|
|
13082
|
+
|
|
12988
13083
|
th.addEventListener( 'click', event => {
|
|
13084
|
+
if( menuOptions.length === 0 ) return;
|
|
12989
13085
|
new LX.DropdownMenu( event.target, menuOptions, { side: "bottom", align: "start" });
|
|
12990
13086
|
});
|
|
12991
13087
|
|
|
@@ -13693,8 +13789,8 @@ class Rate extends BaseComponent
|
|
|
13693
13789
|
}
|
|
13694
13790
|
}
|
|
13695
13791
|
|
|
13696
|
-
LX.Rate = Rate;
|
|
13697
|
-
|
|
13792
|
+
LX.Rate = Rate;
|
|
13793
|
+
|
|
13698
13794
|
// panel.js @jxarco
|
|
13699
13795
|
|
|
13700
13796
|
/**
|
|
@@ -14893,8 +14989,8 @@ class Panel {
|
|
|
14893
14989
|
}
|
|
14894
14990
|
}
|
|
14895
14991
|
|
|
14896
|
-
LX.Panel = Panel;
|
|
14897
|
-
|
|
14992
|
+
LX.Panel = Panel;
|
|
14993
|
+
|
|
14898
14994
|
// branch.js @jxarco
|
|
14899
14995
|
|
|
14900
14996
|
/**
|
|
@@ -15118,8 +15214,8 @@ class Branch {
|
|
|
15118
15214
|
}
|
|
15119
15215
|
}
|
|
15120
15216
|
}
|
|
15121
|
-
LX.Branch = Branch;
|
|
15122
|
-
|
|
15217
|
+
LX.Branch = Branch;
|
|
15218
|
+
|
|
15123
15219
|
// menubar.js @jxarco
|
|
15124
15220
|
|
|
15125
15221
|
/**
|
|
@@ -15451,8 +15547,8 @@ class Menubar {
|
|
|
15451
15547
|
}
|
|
15452
15548
|
}
|
|
15453
15549
|
}
|
|
15454
|
-
LX.Menubar = Menubar;
|
|
15455
|
-
|
|
15550
|
+
LX.Menubar = Menubar;
|
|
15551
|
+
|
|
15456
15552
|
// sidebar.js @jxarco
|
|
15457
15553
|
|
|
15458
15554
|
/**
|
|
@@ -16176,8 +16272,8 @@ class Sidebar {
|
|
|
16176
16272
|
}
|
|
16177
16273
|
}
|
|
16178
16274
|
}
|
|
16179
|
-
LX.Sidebar = Sidebar;
|
|
16180
|
-
|
|
16275
|
+
LX.Sidebar = Sidebar;
|
|
16276
|
+
|
|
16181
16277
|
// asset_view.js @jxarco
|
|
16182
16278
|
|
|
16183
16279
|
class AssetViewEvent {
|
|
@@ -17129,8 +17225,8 @@ class AssetView {
|
|
|
17129
17225
|
}
|
|
17130
17226
|
}
|
|
17131
17227
|
|
|
17132
|
-
LX.AssetView = AssetView;
|
|
17133
|
-
|
|
17228
|
+
LX.AssetView = AssetView;
|
|
17229
|
+
|
|
17134
17230
|
// tour.js @jxarco
|
|
17135
17231
|
|
|
17136
17232
|
class Tour {
|
|
@@ -17428,6 +17524,6 @@ class Tour {
|
|
|
17428
17524
|
} );
|
|
17429
17525
|
}
|
|
17430
17526
|
}
|
|
17431
|
-
LX.Tour = Tour;
|
|
17432
|
-
|
|
17433
|
-
export { ADD_CUSTOM_COMPONENT, Area, AssetView, AssetViewEvent, BaseComponent, Branch, LX, Menubar, Panel, Sidebar, Tour };
|
|
17527
|
+
LX.Tour = Tour;
|
|
17528
|
+
|
|
17529
|
+
export { ADD_CUSTOM_COMPONENT, Area, AssetView, AssetViewEvent, BaseComponent, Branch, LX, Menubar, Panel, Sidebar, Tour };
|