jsuites 4.13.2 → 4.13.5

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.
@@ -16,6 +16,10 @@
16
16
  --safe-area-bottom: env(safe-area-inset-bottom);
17
17
  }
18
18
 
19
+ [data-visible="false"] {
20
+ display: none;
21
+ }
22
+
19
23
  div[data-before]:before {
20
24
  content: attr(data-before);
21
25
  }
@@ -15,10 +15,14 @@
15
15
 
16
16
  'use strict';
17
17
 
18
- var Version = '4.13.0';
18
+ var jSuites = {};
19
+
20
+ var Version = '4.13.5';
19
21
 
20
22
  var Events = function() {
21
23
 
24
+ document.jsuitesComponents = [];
25
+
22
26
  var find = function(DOMElement, component) {
23
27
  if (DOMElement[component.type] && DOMElement[component.type] == component) {
24
28
  return true;
@@ -33,10 +37,10 @@ var Events = function() {
33
37
  }
34
38
 
35
39
  var isOpened = function(e) {
36
- if (jSuites.current && jSuites.current.length > 0) {
37
- for (var i = 0; i < jSuites.current.length; i++) {
38
- if (jSuites.current[i] && ! find(e, jSuites.current[i])) {
39
- jSuites.current[i].close();
40
+ if (document.jsuitesComponents && document.jsuitesComponents.length > 0) {
41
+ for (var i = 0; i < document.jsuitesComponents.length; i++) {
42
+ if (document.jsuitesComponents[i] && ! find(e, document.jsuitesComponents[i])) {
43
+ document.jsuitesComponents[i].close();
40
44
  }
41
45
  }
42
46
  }
@@ -319,8 +323,8 @@ var Events = function() {
319
323
  }
320
324
  }
321
325
 
322
- if (jSuites.current && jSuites.current.length) {
323
- if (item = jSuites.current[jSuites.current.length - 1]) {
326
+ if (document.jsuitesComponents && document.jsuitesComponents.length) {
327
+ if (item = document.jsuitesComponents[document.jsuitesComponents.length - 1]) {
324
328
  if (e.key == "Escape" && typeof(item.close) == 'function') {
325
329
  item.close();
326
330
  e.preventDefault();
@@ -337,22 +341,13 @@ var Events = function() {
337
341
  document.addEventListener('dblclick', dblClick);
338
342
  document.addEventListener('keydown', keyDown);
339
343
  document.addEventListener('contextmenu', contextMenu);
340
- };
341
-
342
- var jSuites = {};
344
+ }
343
345
 
344
346
  /**
345
347
  * Global jsuites event
346
348
  */
347
- if (typeof(document) !== "undefined") {
348
- if (window.jSuites) {
349
- jSuites = window.jSuites;
350
- } else {
351
- Events();
352
-
353
- // Keep references
354
- window.jSuites = jSuites;
355
- }
349
+ if (typeof(document) !== "undefined" && ! document.jsuitesComponents) {
350
+ Events();
356
351
  }
357
352
 
358
353
  jSuites.version = Version;
@@ -367,24 +362,20 @@ jSuites.setExtensions = function(o) {
367
362
  }
368
363
 
369
364
  jSuites.tracking = function(component, state) {
370
- if (! jSuites.current) {
371
- jSuites.current = [];
372
- }
373
-
374
365
  if (state == true) {
375
- jSuites.current = jSuites.current.filter(function(v) {
366
+ document.jsuitesComponents = document.jsuitesComponents.filter(function(v) {
376
367
  return v !== null;
377
368
  });
378
369
 
379
370
  // Start after all events
380
371
  setTimeout(function() {
381
- jSuites.current.push(component);
372
+ document.jsuitesComponents.push(component);
382
373
  }, 0);
383
374
 
384
375
  } else {
385
- var index = jSuites.current.indexOf(component);
376
+ var index = document.jsuitesComponents.indexOf(component);
386
377
  if (index >= 0) {
387
- jSuites.current.splice(index, 1);
378
+ document.jsuitesComponents.splice(index, 1);
388
379
  }
389
380
  }
390
381
  }
@@ -3973,8 +3964,20 @@ jSuites.dropdown = (function(el, options) {
3973
3964
  }
3974
3965
 
3975
3966
  obj.setData = function(data) {
3967
+ // Reset current value
3968
+ resetValue();
3969
+
3970
+ // Make sure the content container is blank
3971
+ content.innerHTML = '';
3972
+
3973
+ // Reset
3974
+ obj.header.value = '';
3975
+
3976
+ // Reset items and values
3977
+ obj.items = [];
3978
+
3976
3979
  // Prepare data
3977
- if (data.length) {
3980
+ if (data && data.length) {
3978
3981
  for (var i = 0; i < data.length; i++) {
3979
3982
  // Compatibility
3980
3983
  if (typeof(data[i]) != 'object') {
@@ -3993,24 +3996,17 @@ jSuites.dropdown = (function(el, options) {
3993
3996
  }
3994
3997
  }
3995
3998
 
3996
- // Reset current value
3997
- resetValue();
3998
-
3999
- // Make sure the content container is blank
4000
- content.innerHTML = '';
4001
-
4002
- // Reset
4003
- obj.header.value = '';
4004
-
4005
- // Reset items and values
4006
- obj.items = [];
4007
-
4008
3999
  // Append data
4009
4000
  obj.appendData(data);
4010
4001
 
4011
4002
  // Update data
4012
4003
  obj.options.data = data;
4004
+ } else {
4005
+ // Update data
4006
+ obj.options.data = [];
4013
4007
  }
4008
+
4009
+ obj.close();
4014
4010
  }
4015
4011
 
4016
4012
  obj.getData = function() {
@@ -6274,6 +6270,9 @@ jSuites.focus = function(el) {
6274
6270
  }
6275
6271
 
6276
6272
  jSuites.isNumeric = (function (num) {
6273
+ if (typeof(num) === 'string') {
6274
+ num = num.trim();
6275
+ }
6277
6276
  return !isNaN(num) && num !== null && num !== '';
6278
6277
  });
6279
6278
 
package/dist/jsuites.css CHANGED
@@ -16,6 +16,10 @@
16
16
  --safe-area-bottom: env(safe-area-inset-bottom);
17
17
  }
18
18
 
19
+ [data-visible="false"] {
20
+ display: none;
21
+ }
22
+
19
23
  div[data-before]:before {
20
24
  content: attr(data-before);
21
25
  }
package/dist/jsuites.js CHANGED
@@ -15,10 +15,14 @@
15
15
 
16
16
  'use strict';
17
17
 
18
- var Version = '4.13.0';
18
+ var jSuites = {};
19
+
20
+ var Version = '4.13.5';
19
21
 
20
22
  var Events = function() {
21
23
 
24
+ document.jsuitesComponents = [];
25
+
22
26
  var find = function(DOMElement, component) {
23
27
  if (DOMElement[component.type] && DOMElement[component.type] == component) {
24
28
  return true;
@@ -33,10 +37,10 @@ var Events = function() {
33
37
  }
34
38
 
35
39
  var isOpened = function(e) {
36
- if (jSuites.current && jSuites.current.length > 0) {
37
- for (var i = 0; i < jSuites.current.length; i++) {
38
- if (jSuites.current[i] && ! find(e, jSuites.current[i])) {
39
- jSuites.current[i].close();
40
+ if (document.jsuitesComponents && document.jsuitesComponents.length > 0) {
41
+ for (var i = 0; i < document.jsuitesComponents.length; i++) {
42
+ if (document.jsuitesComponents[i] && ! find(e, document.jsuitesComponents[i])) {
43
+ document.jsuitesComponents[i].close();
40
44
  }
41
45
  }
42
46
  }
@@ -319,8 +323,8 @@ var Events = function() {
319
323
  }
320
324
  }
321
325
 
322
- if (jSuites.current && jSuites.current.length) {
323
- if (item = jSuites.current[jSuites.current.length - 1]) {
326
+ if (document.jsuitesComponents && document.jsuitesComponents.length) {
327
+ if (item = document.jsuitesComponents[document.jsuitesComponents.length - 1]) {
324
328
  if (e.key == "Escape" && typeof(item.close) == 'function') {
325
329
  item.close();
326
330
  e.preventDefault();
@@ -337,22 +341,13 @@ var Events = function() {
337
341
  document.addEventListener('dblclick', dblClick);
338
342
  document.addEventListener('keydown', keyDown);
339
343
  document.addEventListener('contextmenu', contextMenu);
340
- };
341
-
342
- var jSuites = {};
344
+ }
343
345
 
344
346
  /**
345
347
  * Global jsuites event
346
348
  */
347
- if (typeof(document) !== "undefined") {
348
- if (window.jSuites) {
349
- jSuites = window.jSuites;
350
- } else {
351
- Events();
352
-
353
- // Keep references
354
- window.jSuites = jSuites;
355
- }
349
+ if (typeof(document) !== "undefined" && ! document.jsuitesComponents) {
350
+ Events();
356
351
  }
357
352
 
358
353
  jSuites.version = Version;
@@ -367,24 +362,20 @@ jSuites.setExtensions = function(o) {
367
362
  }
368
363
 
369
364
  jSuites.tracking = function(component, state) {
370
- if (! jSuites.current) {
371
- jSuites.current = [];
372
- }
373
-
374
365
  if (state == true) {
375
- jSuites.current = jSuites.current.filter(function(v) {
366
+ document.jsuitesComponents = document.jsuitesComponents.filter(function(v) {
376
367
  return v !== null;
377
368
  });
378
369
 
379
370
  // Start after all events
380
371
  setTimeout(function() {
381
- jSuites.current.push(component);
372
+ document.jsuitesComponents.push(component);
382
373
  }, 0);
383
374
 
384
375
  } else {
385
- var index = jSuites.current.indexOf(component);
376
+ var index = document.jsuitesComponents.indexOf(component);
386
377
  if (index >= 0) {
387
- jSuites.current.splice(index, 1);
378
+ document.jsuitesComponents.splice(index, 1);
388
379
  }
389
380
  }
390
381
  }
@@ -3984,8 +3975,20 @@ jSuites.dropdown = (function(el, options) {
3984
3975
  }
3985
3976
 
3986
3977
  obj.setData = function(data) {
3978
+ // Reset current value
3979
+ resetValue();
3980
+
3981
+ // Make sure the content container is blank
3982
+ content.innerHTML = '';
3983
+
3984
+ // Reset
3985
+ obj.header.value = '';
3986
+
3987
+ // Reset items and values
3988
+ obj.items = [];
3989
+
3987
3990
  // Prepare data
3988
- if (data.length) {
3991
+ if (data && data.length) {
3989
3992
  for (var i = 0; i < data.length; i++) {
3990
3993
  // Compatibility
3991
3994
  if (typeof(data[i]) != 'object') {
@@ -4004,24 +4007,17 @@ jSuites.dropdown = (function(el, options) {
4004
4007
  }
4005
4008
  }
4006
4009
 
4007
- // Reset current value
4008
- resetValue();
4009
-
4010
- // Make sure the content container is blank
4011
- content.innerHTML = '';
4012
-
4013
- // Reset
4014
- obj.header.value = '';
4015
-
4016
- // Reset items and values
4017
- obj.items = [];
4018
-
4019
4010
  // Append data
4020
4011
  obj.appendData(data);
4021
4012
 
4022
4013
  // Update data
4023
4014
  obj.options.data = data;
4015
+ } else {
4016
+ // Update data
4017
+ obj.options.data = [];
4024
4018
  }
4019
+
4020
+ obj.close();
4025
4021
  }
4026
4022
 
4027
4023
  obj.getData = function() {
@@ -6699,6 +6695,9 @@ jSuites.focus = function(el) {
6699
6695
  }
6700
6696
 
6701
6697
  jSuites.isNumeric = (function (num) {
6698
+ if (typeof(num) === 'string') {
6699
+ num = num.trim();
6700
+ }
6702
6701
  return !isNaN(num) && num !== null && num !== '';
6703
6702
  });
6704
6703
 
@@ -1,20 +1,3 @@
1
- /**
2
- * (c) jSuites Javascript Web Components
3
- *
4
- * Website: https://jsuites.net
5
- * Description: Create amazing web based applications.
6
- *
7
- * MIT License
8
- *
9
- */
10
- ;(function (global, factory) {
11
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
12
- typeof define === 'function' && define.amd ? define(factory) :
13
- global.jSuites = factory();
14
- }(this, (function () {
15
-
16
- 'use strict';
17
-
18
1
  jSuites.crop = (function(el, options) {
19
2
  // Already created, update options
20
3
  if (el.crop) {
@@ -3468,9 +3451,3 @@ jSuites.timeline = (function(el, options) {
3468
3451
 
3469
3452
  return obj;
3470
3453
  });
3471
-
3472
-
3473
-
3474
- return jSuites;
3475
-
3476
- })));
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "javascript plugins"
20
20
  ],
21
21
  "main": "dist/jsuites.js",
22
- "version": "4.13.2",
22
+ "version": "4.13.5",
23
23
  "bugs": "https://github.com/jsuites/jsuites/issues",
24
24
  "homepage": "https://github.com/jsuites/jsuites",
25
25
  "docs": "https://jsuites.net",