sf-i-events 1.0.944 → 1.0.945

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/dev/index.html CHANGED
@@ -824,7 +824,7 @@
824
824
  allowdownload="yes"></sf-i-uploader></div>
825
825
  <div slot="reporting"><sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting></div>
826
826
  </sf-i-events> -->
827
- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
827
+ <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
828
828
  apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
829
829
  apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
830
830
  apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
@@ -849,7 +849,7 @@
849
849
  <sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
850
850
  </div>
851
851
 
852
- </sf-i-events>
852
+ </sf-i-events> -->
853
853
  <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
854
854
  apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
855
855
  apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
@@ -1084,7 +1084,7 @@
1084
1084
  disablesignoff="yes" disableclientresponse="yes">
1085
1085
 
1086
1086
  </sf-i-events> -->
1087
- <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
1087
+ <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
1088
1088
  apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
1089
1089
  apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
1090
1090
  apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
@@ -1112,7 +1112,7 @@
1112
1112
  <sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
1113
1113
  </div>
1114
1114
 
1115
- </sf-i-events> -->
1115
+ </sf-i-events>
1116
1116
  <script>
1117
1117
 
1118
1118
  function setCookie(name, value, days) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.944",
4
+ "version": "1.0.945",
5
5
  "description": "Superflows Navigation Component",
6
6
  "main": "sf-i-events.js",
7
7
  "module": "sf-i-events.js",
package/sf-i-events.js CHANGED
@@ -13270,9 +13270,11 @@ let SfIEvents = class SfIEvents extends LitElement {
13270
13270
  reportformatvalues = reportingReporting.selectedValues();
13271
13271
  }
13272
13272
  let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues));
13273
- console.log('reportformatvalues', reportformatvalues, comparedObj);
13274
- await this.sendSuggestions(listEvent.id, comparedObj);
13275
- return;
13273
+ console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj);
13274
+ if (Object.keys(comparedObj).length > 0) {
13275
+ await this.sendSuggestions(listEvent.id, comparedObj);
13276
+ }
13277
+ // return;
13276
13278
  var clickEvent = new MouseEvent("click", {
13277
13279
  "view": window,
13278
13280
  "bubbles": true,
@@ -17120,9 +17120,11 @@ export class SfIEvents extends LitElement {
17120
17120
  reportformatvalues = reportingReporting!.selectedValues()
17121
17121
  }
17122
17122
  let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
17123
- console.log('reportformatvalues', reportformatvalues, comparedObj)
17124
- await this.sendSuggestions(listEvent.id, comparedObj);
17125
- return;
17123
+ console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues),comparedObj)
17124
+ if(Object.keys(comparedObj).length > 0){
17125
+ await this.sendSuggestions(listEvent.id, comparedObj);
17126
+ }
17127
+ // return;
17126
17128
  var clickEvent = new MouseEvent("click", {
17127
17129
  "view": window,
17128
17130
  "bubbles": true,
package/src/util.ts CHANGED
@@ -605,16 +605,24 @@ function isVisible(el: HTMLElement): boolean {
605
605
  function compareObjects(obj1: any, obj2: any): any {
606
606
  if (obj1 === obj2) return {};
607
607
 
608
- // If both are arrays
608
+ // Case: both are arrays
609
609
  if (Array.isArray(obj1) && Array.isArray(obj2)) {
610
+ // One empty, one not → full diff
611
+ if (obj1.length === 0 && obj2.length > 0) {
612
+ return obj2;
613
+ }
614
+ if (obj2.length === 0 && obj1.length > 0) {
615
+ return obj1;
616
+ }
617
+
610
618
  const maxLength = Math.max(obj1.length, obj2.length);
611
- const result: any[] = [];
619
+ const result = [];
612
620
 
613
621
  for (let i = 0; i < maxLength; i++) {
614
622
  if (i >= obj1.length) {
615
623
  result[i] = obj2[i]; // new item
616
624
  } else if (i >= obj2.length) {
617
- result[i] = undefined; // removed item
625
+ result[i] = obj1[i]; // removed item
618
626
  } else {
619
627
  const diff = compareObjects(obj1[i], obj2[i]);
620
628
  if (Object.keys(diff).length > 0) {
@@ -625,7 +633,8 @@ function compareObjects(obj1: any, obj2: any): any {
625
633
 
626
634
  return result.filter(v => v !== undefined).length > 0 ? result : {};
627
635
  }
628
- // If both are objects
636
+
637
+ // Case: both are objects
629
638
  if (
630
639
  typeof obj1 === "object" &&
631
640
  obj1 !== null &&
@@ -633,15 +642,15 @@ function compareObjects(obj1: any, obj2: any): any {
633
642
  obj2 !== null
634
643
  ) {
635
644
  const keys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
636
- const diff: Record<string, any> = {};
645
+ const diff: any = {};
637
646
 
638
647
  for (const key of keys) {
639
648
  if (!(key in obj1)) {
640
- diff[key] = [null, (obj2 as any)[key]];
649
+ diff[key] = obj2[key];
641
650
  } else if (!(key in obj2)) {
642
- diff[key] = [(obj1 as any)[key], null];
651
+ diff[key] = obj1[key];
643
652
  } else {
644
- const valueDiff = compareObjects((obj1 as any)[key], (obj2 as any)[key]);
653
+ const valueDiff = compareObjects(obj1[key], obj2[key]);
645
654
  if (
646
655
  typeof valueDiff === "object" &&
647
656
  valueDiff !== null &&
@@ -658,8 +667,8 @@ function compareObjects(obj1: any, obj2: any): any {
658
667
  return Object.keys(diff).length > 0 ? diff : {};
659
668
  }
660
669
 
661
- // Primitive comparison
662
- return obj1 !== obj2 ? [obj1, obj2] : [];
670
+ // Case: primitives
671
+ return obj1 !== obj2 ? [obj1, obj2] : {};
663
672
  }
664
673
  const exportFunctions = {
665
674
  callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, getProjectConfigHome, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible, compareObjects
package/util.js CHANGED
@@ -507,8 +507,15 @@ function isVisible(el) {
507
507
  function compareObjects(obj1, obj2) {
508
508
  if (obj1 === obj2)
509
509
  return {};
510
- // If both are arrays
510
+ // Case: both are arrays
511
511
  if (Array.isArray(obj1) && Array.isArray(obj2)) {
512
+ // One empty, one not → full diff
513
+ if (obj1.length === 0 && obj2.length > 0) {
514
+ return obj2;
515
+ }
516
+ if (obj2.length === 0 && obj1.length > 0) {
517
+ return obj1;
518
+ }
512
519
  const maxLength = Math.max(obj1.length, obj2.length);
513
520
  const result = [];
514
521
  for (let i = 0; i < maxLength; i++) {
@@ -516,7 +523,7 @@ function compareObjects(obj1, obj2) {
516
523
  result[i] = obj2[i]; // new item
517
524
  }
518
525
  else if (i >= obj2.length) {
519
- result[i] = undefined; // removed item
526
+ result[i] = obj1[i]; // removed item
520
527
  }
521
528
  else {
522
529
  const diff = compareObjects(obj1[i], obj2[i]);
@@ -527,7 +534,7 @@ function compareObjects(obj1, obj2) {
527
534
  }
528
535
  return result.filter(v => v !== undefined).length > 0 ? result : {};
529
536
  }
530
- // If both are objects
537
+ // Case: both are objects
531
538
  if (typeof obj1 === "object" &&
532
539
  obj1 !== null &&
533
540
  typeof obj2 === "object" &&
@@ -536,10 +543,10 @@ function compareObjects(obj1, obj2) {
536
543
  const diff = {};
537
544
  for (const key of keys) {
538
545
  if (!(key in obj1)) {
539
- diff[key] = [null, obj2[key]];
546
+ diff[key] = obj2[key];
540
547
  }
541
548
  else if (!(key in obj2)) {
542
- diff[key] = [obj1[key], null];
549
+ diff[key] = obj1[key];
543
550
  }
544
551
  else {
545
552
  const valueDiff = compareObjects(obj1[key], obj2[key]);
@@ -555,8 +562,8 @@ function compareObjects(obj1, obj2) {
555
562
  }
556
563
  return Object.keys(diff).length > 0 ? diff : {};
557
564
  }
558
- // Primitive comparison
559
- return obj1 !== obj2 ? [obj1, obj2] : [];
565
+ // Case: primitives
566
+ return obj1 !== obj2 ? [obj1, obj2] : {};
560
567
  }
561
568
  const exportFunctions = {
562
569
  callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, getProjectConfigHome, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible, compareObjects