lexgui 0.5.10 → 0.5.11
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/lexgui.css +6 -3
- package/build/lexgui.js +80 -18
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +80 -18
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +10 -1
- package/demo.js +6 -4
- package/package.json +1 -1
package/build/lexgui.css
CHANGED
|
@@ -1434,7 +1434,10 @@ a svg, svg path {
|
|
|
1434
1434
|
|
|
1435
1435
|
.lexwidget .lextext.formlabel {
|
|
1436
1436
|
margin-left: 8px;
|
|
1437
|
-
margin-bottom: -
|
|
1437
|
+
margin-bottom: -6px;
|
|
1438
|
+
font-weight: 500;
|
|
1439
|
+
padding: 0;
|
|
1440
|
+
font-size: var(--global-font-size-sm);
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1440
1443
|
.lexwidget .lextext.outline {
|
|
@@ -4851,6 +4854,7 @@ ul.lexassetscontent {
|
|
|
4851
4854
|
.lexassetscontent li .lexassettitle {
|
|
4852
4855
|
position: absolute;
|
|
4853
4856
|
width: 100%;
|
|
4857
|
+
height: 24px;
|
|
4854
4858
|
bottom: 0px;
|
|
4855
4859
|
-webkit-text-size-adjust: 100%;
|
|
4856
4860
|
font-size: var(--global-font-size);
|
|
@@ -4859,12 +4863,11 @@ ul.lexassetscontent {
|
|
|
4859
4863
|
text-align: center;
|
|
4860
4864
|
box-sizing: border-box;
|
|
4861
4865
|
display: block;
|
|
4862
|
-
height: 20px;
|
|
4863
4866
|
padding: 0.1em;
|
|
4864
|
-
padding-top: 0.15em;
|
|
4865
4867
|
overflow: hidden;
|
|
4866
4868
|
text-overflow: ellipsis;
|
|
4867
4869
|
white-space: nowrap;
|
|
4870
|
+
align-content: center;
|
|
4868
4871
|
background-color: var(--global-intense-background);
|
|
4869
4872
|
transition: all 0.1s;
|
|
4870
4873
|
z-index: 1;
|
package/build/lexgui.js
CHANGED
|
@@ -12,7 +12,7 @@ console.warn( 'Script _build/lexgui.js_ is depracated and will be removed soon.
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
var LX = {
|
|
15
|
-
version: "0.5.
|
|
15
|
+
version: "0.5.11",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // Specific pre-build components
|
|
18
18
|
signals: {}, // Events and triggers
|
|
@@ -210,6 +210,29 @@ function setTheme( colorScheme )
|
|
|
210
210
|
|
|
211
211
|
LX.setTheme = setTheme;
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* @method getTheme
|
|
215
|
+
* @description Gets either "dark" or "light" theme value
|
|
216
|
+
*/
|
|
217
|
+
function getTheme()
|
|
218
|
+
{
|
|
219
|
+
return document.documentElement.getAttribute( "data-theme" ) ?? "dark";
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
LX.getTheme = getTheme;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @method switchTheme
|
|
226
|
+
* @description Toggles between "dark" and "light" themes
|
|
227
|
+
*/
|
|
228
|
+
function switchTheme()
|
|
229
|
+
{
|
|
230
|
+
const currentTheme = getTheme();
|
|
231
|
+
setTheme( currentTheme == "dark" ? "light" : "dark" );
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
LX.switchTheme = switchTheme;
|
|
235
|
+
|
|
213
236
|
/**
|
|
214
237
|
* @method setThemeColor
|
|
215
238
|
* @description Sets a new value for one of the main theme variables
|
|
@@ -1708,35 +1731,52 @@ function badge( text, className, options = {} )
|
|
|
1708
1731
|
LX.badge = badge;
|
|
1709
1732
|
|
|
1710
1733
|
/**
|
|
1711
|
-
* @method
|
|
1712
|
-
* @param {
|
|
1734
|
+
* @method makeElement
|
|
1735
|
+
* @param {String} htmlType
|
|
1713
1736
|
* @param {String} className
|
|
1714
1737
|
* @param {String} innerHTML
|
|
1715
1738
|
* @param {HTMLElement} parent
|
|
1716
1739
|
* @param {Object} overrideStyle
|
|
1717
1740
|
*/
|
|
1718
1741
|
|
|
1719
|
-
function
|
|
1742
|
+
function makeElement( htmlType, className, innerHTML, parent, overrideStyle = {} )
|
|
1720
1743
|
{
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
container.style.height = size && size[ 1 ] ? size[ 1 ] : "100%";
|
|
1726
|
-
Object.assign( container.style, overrideStyle );
|
|
1744
|
+
const element = document.createElement( htmlType );
|
|
1745
|
+
element.className = className ?? ""
|
|
1746
|
+
element.innerHTML = innerHTML ?? "";
|
|
1747
|
+
Object.assign( element.style, overrideStyle );
|
|
1727
1748
|
|
|
1728
1749
|
if( parent )
|
|
1729
1750
|
{
|
|
1730
1751
|
if( parent.attach ) // Use attach method if possible
|
|
1731
1752
|
{
|
|
1732
|
-
parent.attach(
|
|
1753
|
+
parent.attach( element );
|
|
1733
1754
|
}
|
|
1734
1755
|
else // its a native HTMLElement
|
|
1735
1756
|
{
|
|
1736
|
-
parent.appendChild(
|
|
1757
|
+
parent.appendChild( element );
|
|
1737
1758
|
}
|
|
1738
1759
|
}
|
|
1739
1760
|
|
|
1761
|
+
return element;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
LX.makeElement = makeElement;
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* @method makeContainer
|
|
1768
|
+
* @param {Array} size
|
|
1769
|
+
* @param {String} className
|
|
1770
|
+
* @param {String} innerHTML
|
|
1771
|
+
* @param {HTMLElement} parent
|
|
1772
|
+
* @param {Object} overrideStyle
|
|
1773
|
+
*/
|
|
1774
|
+
|
|
1775
|
+
function makeContainer( size, className, innerHTML, parent, overrideStyle = {} )
|
|
1776
|
+
{
|
|
1777
|
+
const container = LX.makeElement( "div", "lexcontainer " + ( className ?? "" ), innerHTML, parent, overrideStyle );
|
|
1778
|
+
container.style.width = size && size[ 0 ] ? size[ 0 ] : "100%";
|
|
1779
|
+
container.style.height = size && size[ 1 ] ? size[ 1 ] : "100%";
|
|
1740
1780
|
return container;
|
|
1741
1781
|
}
|
|
1742
1782
|
|
|
@@ -7258,12 +7298,17 @@ class Form extends Widget {
|
|
|
7258
7298
|
if( entryData.constructor != Object )
|
|
7259
7299
|
{
|
|
7260
7300
|
entryData = { };
|
|
7301
|
+
data[ entry ] = entryData;
|
|
7261
7302
|
}
|
|
7262
7303
|
|
|
7263
7304
|
entryData.placeholder = entryData.placeholder ?? entry;
|
|
7264
7305
|
entryData.width = "100%";
|
|
7265
7306
|
|
|
7266
|
-
|
|
7307
|
+
if( !( options.skipLabels ?? false ) )
|
|
7308
|
+
{
|
|
7309
|
+
const label = new TextInput( null, entry, null, { disabled: true, inputClass: "formlabel nobg" } );
|
|
7310
|
+
container.appendChild( label.root );
|
|
7311
|
+
}
|
|
7267
7312
|
|
|
7268
7313
|
entryData.textWidget = new TextInput( null, entryData.constructor == Object ? entryData.value : entryData, ( value ) => {
|
|
7269
7314
|
container.formData[ entry ] = value;
|
|
@@ -7273,9 +7318,21 @@ class Form extends Widget {
|
|
|
7273
7318
|
container.formData[ entry ] = entryData.constructor == Object ? entryData.value : entryData;
|
|
7274
7319
|
}
|
|
7275
7320
|
|
|
7276
|
-
|
|
7321
|
+
const buttonContainer = LX.makeContainer( ["100%", "auto"], "flex flex-row", "", container );
|
|
7322
|
+
|
|
7323
|
+
if( options.secondaryActionName || options.secondaryActionCallback )
|
|
7324
|
+
{
|
|
7325
|
+
const secondaryButton = new Button( null, options.secondaryActionName ?? "Cancel", ( value, event ) => {
|
|
7326
|
+
if( callback )
|
|
7327
|
+
{
|
|
7328
|
+
callback( container.formData, event );
|
|
7329
|
+
}
|
|
7330
|
+
}, { width: "100%", minWidth: "0", buttonClass: options.secondaryButtonClass ?? "primary" } );
|
|
7331
|
+
|
|
7332
|
+
buttonContainer.appendChild( secondaryButton.root );
|
|
7333
|
+
}
|
|
7277
7334
|
|
|
7278
|
-
const
|
|
7335
|
+
const primaryButton = new Button( null, options.primaryActionName ?? "Submit", ( value, event ) => {
|
|
7279
7336
|
|
|
7280
7337
|
for( let entry in data )
|
|
7281
7338
|
{
|
|
@@ -7291,9 +7348,9 @@ class Form extends Widget {
|
|
|
7291
7348
|
{
|
|
7292
7349
|
callback( container.formData, event );
|
|
7293
7350
|
}
|
|
7294
|
-
}, { buttonClass: "
|
|
7351
|
+
}, { width: "100%", minWidth: "0", buttonClass: options.primaryButtonClass ?? "contrast" } );
|
|
7295
7352
|
|
|
7296
|
-
|
|
7353
|
+
buttonContainer.appendChild( primaryButton.root );
|
|
7297
7354
|
}
|
|
7298
7355
|
}
|
|
7299
7356
|
|
|
@@ -11223,7 +11280,12 @@ class Panel {
|
|
|
11223
11280
|
* @param {Object} data Form data
|
|
11224
11281
|
* @param {Function} callback Callback function on submit form
|
|
11225
11282
|
* @param {Object} options:
|
|
11226
|
-
*
|
|
11283
|
+
* primaryActionName: Text to be shown in the primary action button ['Submit']
|
|
11284
|
+
* primaryButtonClass: Button class for primary action button ['contrast']
|
|
11285
|
+
* secondaryActionName: Text to be shown in the secondary action button ['Cancel']
|
|
11286
|
+
* secondaryActionCallback: Callback function on press secondary button
|
|
11287
|
+
* secondaryButtonClass: Button class for secondary action button ['primary']
|
|
11288
|
+
* skipLabels: Do not show input field labels [false]
|
|
11227
11289
|
*/
|
|
11228
11290
|
|
|
11229
11291
|
addForm( name, data, callback, options = {} ) {
|