jsuites 5.10.0 → 5.11.1

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/dist/jsuites.css CHANGED
@@ -2996,22 +2996,16 @@ div[data-before]:before {
2996
2996
  background-color:#f2f2f2;
2997
2997
  }
2998
2998
 
2999
-
3000
2999
  .jtoolbar .jpicker {
3001
- padding-left:0px;
3002
- padding-right:0px;
3000
+ padding-left: 0;
3001
+ padding-right: 0;
3003
3002
  }
3004
3003
 
3005
3004
  .jtoolbar .jpicker-header {
3006
- height: 24px;
3007
- line-height: 24px;
3008
- padding: 0px;
3009
- padding-right: 20px;
3010
- padding-left: 8px;
3011
- background-position: top 50% right 0px;
3005
+ padding: 0 20px 0 8px;
3006
+ background-position: top 50% right 0;
3012
3007
  display: flex;
3013
3008
  align-items: center;
3014
- font-size: 0.9em;
3015
3009
  }
3016
3010
 
3017
3011
  .jtoolbar .jpicker-content > div {
package/dist/jsuites.js CHANGED
@@ -574,49 +574,88 @@ Helpers.findElement = function(element, condition) {
574
574
 
575
575
  /* harmony default export */ var helpers = (Helpers);
576
576
  ;// CONCATENATED MODULE: ./src/utils/path.js
577
- function Path(str, val, remove) {
578
- str = str.split('.');
579
- if (str.length) {
580
- let o = this;
581
- let p = null;
582
- while (str.length > 1) {
583
- // Get the property
584
- p = str.shift();
585
- // Check if the property exists
586
- if (o.hasOwnProperty(p)) {
587
- o = o[p];
588
- } else {
589
- // Property does not exists
590
- if (typeof(val) === 'undefined') {
591
- return undefined;
592
- } else {
593
- // Create the property
594
- o[p] = {};
595
- // Next property
596
- o = o[p];
597
- }
598
- }
599
- }
600
- // Get the property
601
- p = str.shift();
602
- // Set or get the value
603
- if (typeof(val) !== 'undefined') {
604
- if (remove === true) {
605
- delete o[p];
577
+ function Path(pathString, value, remove) {
578
+ // Ensure the path is a valid, non-empty string
579
+ if (typeof pathString !== 'string' || pathString.length === 0) {
580
+ return undefined;
581
+ }
582
+
583
+ // Split the path into individual keys and filter out empty keys
584
+ const keys = pathString.split('.');
585
+ if (keys.length === 0) {
586
+ return undefined;
587
+ }
588
+
589
+ // Start with the root object
590
+ let currentObject = this;
591
+
592
+ // Read mode: retrieve a value
593
+ if (typeof value === 'undefined' && typeof remove === 'undefined') {
594
+ // Traverse all keys
595
+ for (let i = 0; i < keys.length; i++) {
596
+ const key = keys[i];
597
+ // Check if the current object is valid and has the key
598
+ if (
599
+ currentObject != null &&
600
+ typeof currentObject === 'object' &&
601
+ Object.prototype.hasOwnProperty.call(currentObject, key)
602
+ ) {
603
+ currentObject = currentObject[key];
606
604
  } else {
607
- o[p] = val;
605
+ // Return undefined if the path is invalid or currentObject is null/undefined
606
+ return undefined;
608
607
  }
609
- // Success
608
+ }
609
+ // Return the final value
610
+ return currentObject;
611
+ }
612
+
613
+ // Write mode: set or delete a value
614
+ // Traverse all keys except the last one
615
+ for (let i = 0; i < keys.length - 1; i++) {
616
+ const key = keys[i];
617
+
618
+ // Check if the current object is invalid (null/undefined or non-object)
619
+ if (currentObject == null || typeof currentObject !== 'object') {
620
+ console.warn(`Cannot set value: path '${pathString}' blocked by invalid object at '${key}'`);
621
+ return false;
622
+ }
623
+
624
+ // If the key exists but is null/undefined or a non-object, replace it with an empty object
625
+ if (
626
+ Object.prototype.hasOwnProperty.call(currentObject, key) &&
627
+ (currentObject[key] == null || typeof currentObject[key] !== 'object')
628
+ ) {
629
+ currentObject[key] = {};
630
+ } else if (!Object.prototype.hasOwnProperty.call(currentObject, key)) {
631
+ // If the key doesn't exist, create an empty object
632
+ currentObject[key] = {};
633
+ }
634
+
635
+ // Move to the next level
636
+ currentObject = currentObject[key];
637
+ }
638
+
639
+ // Handle the final key
640
+ const finalKey = keys[keys.length - 1];
641
+
642
+ // Check if the current object is valid for setting/deleting
643
+ if (currentObject == null || typeof currentObject !== 'object') {
644
+ return false;
645
+ }
646
+
647
+ // Delete the property if remove is true
648
+ if (remove === true) {
649
+ if (Object.prototype.hasOwnProperty.call(currentObject, finalKey)) {
650
+ delete currentObject[finalKey];
610
651
  return true;
611
- } else {
612
- // Return the value
613
- if (o) {
614
- return o[p];
615
- }
616
652
  }
653
+ return false; // Nothing to delete
617
654
  }
618
- // Something went wrong
619
- return false;
655
+
656
+ // Set the value
657
+ currentObject[finalKey] = value;
658
+ return true;
620
659
  }
621
660
  ;// CONCATENATED MODULE: ./src/utils/sorting.js
622
661
  function Sorting(el, options) {
@@ -12957,7 +12996,7 @@ var jsuites_jSuites = {
12957
12996
  ...dictionary,
12958
12997
  ...helpers,
12959
12998
  /** Current version */
12960
- version: '5.9.3',
12999
+ version: '5.11.0',
12961
13000
  /** Bind new extensions to Jsuites */
12962
13001
  setExtensions: function(o) {
12963
13002
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "5.10.0",
29
+ "version": "5.11.1",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",