sf-i-events 1.0.943 → 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 +2 -2
- package/package.json +1 -1
- package/sf-i-events.js +14 -8
- package/src/sf-i-events.ts +14 -8
- package/src/util.ts +28 -12
- package/util.js +19 -9
package/dev/index.html
CHANGED
|
@@ -850,7 +850,7 @@
|
|
|
850
850
|
</div>
|
|
851
851
|
|
|
852
852
|
</sf-i-events> -->
|
|
853
|
-
<sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
|
|
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"
|
|
856
856
|
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
|
@@ -879,7 +879,7 @@
|
|
|
879
879
|
<sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
|
|
880
880
|
</div>
|
|
881
881
|
|
|
882
|
-
</sf-i-events>
|
|
882
|
+
</sf-i-events> -->
|
|
883
883
|
<!-- <sf-i-events projectid="5a05b884-d7ed-4f63-b623-4d305ea2cfd6" projectname="Standard Radiators Private Limited"
|
|
884
884
|
mode="onboarding"
|
|
885
885
|
locations="{"India":{"Punjab":["Punjab Warehouse"],"Gujarat":["RO & Unit I","Unit II"]}}"
|
package/package.json
CHANGED
package/sf-i-events.js
CHANGED
|
@@ -4981,12 +4981,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4981
4981
|
if (indexNext < titleArr.length - 1) {
|
|
4982
4982
|
if (Util.isVisible(titleArr[indexNext + 1])) {
|
|
4983
4983
|
nextString = titleArr[indexNext + 1].id;
|
|
4984
|
+
console.log('prev nextString', nextString);
|
|
4984
4985
|
let nextIdArr = nextString.split("-");
|
|
4986
|
+
console.log('prev nextArr', nextIdArr);
|
|
4985
4987
|
if (((_b = nextIdArr[7]) !== null && _b !== void 0 ? _b : "") == "reportedlocations") {
|
|
4986
4988
|
nextString = "";
|
|
4989
|
+
console.log('prev nextString2', nextString);
|
|
4987
4990
|
indexNext++;
|
|
4988
4991
|
}
|
|
4989
4992
|
else {
|
|
4993
|
+
console.log('prev nextString3', nextString);
|
|
4990
4994
|
flagNext = false;
|
|
4991
4995
|
}
|
|
4992
4996
|
}
|
|
@@ -4999,7 +5003,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4999
5003
|
}
|
|
5000
5004
|
}
|
|
5001
5005
|
// this.renderEventDetail(this.events[mmdd][j], mmdd + "/" + yyyy, null);
|
|
5002
|
-
this.fetchEventDetails(this.events[mmdd][j], mmdd + "/" + yyyy, null, eventsContainer);
|
|
5006
|
+
this.fetchEventDetails(this.events[mmdd][j], mmdd + "/" + yyyy, null, eventsContainer, prevString, nextString);
|
|
5003
5007
|
}
|
|
5004
5008
|
});
|
|
5005
5009
|
}
|
|
@@ -13177,10 +13181,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13177
13181
|
reportingReporting.configjson = reportingSchemaJson;
|
|
13178
13182
|
if (reportingSchemaValues != "")
|
|
13179
13183
|
reportingReporting.prepopulateValJson = reportingSchemaValues;
|
|
13180
|
-
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
13181
|
-
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
+
// reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
13185
|
+
// reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
13186
|
+
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view";
|
|
13187
|
+
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true";
|
|
13184
13188
|
reportingReporting.flow = "reporting";
|
|
13185
13189
|
setTimeout(() => {
|
|
13186
13190
|
reportingReporting.loadMode();
|
|
@@ -13266,8 +13270,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13266
13270
|
reportformatvalues = reportingReporting.selectedValues();
|
|
13267
13271
|
}
|
|
13268
13272
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues));
|
|
13269
|
-
console.log('reportformatvalues', reportformatvalues, comparedObj);
|
|
13270
|
-
|
|
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
|
+
}
|
|
13271
13277
|
// return;
|
|
13272
13278
|
var clickEvent = new MouseEvent("click", {
|
|
13273
13279
|
"view": window,
|
|
@@ -22027,7 +22033,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
22027
22033
|
}
|
|
22028
22034
|
};
|
|
22029
22035
|
this.sendSuggestions = async (eventid, eventdelta) => {
|
|
22030
|
-
let url = "https://" + this.
|
|
22036
|
+
let url = "https://" + this.apiIdRCMResources + "/sendsuggestions";
|
|
22031
22037
|
const body = {
|
|
22032
22038
|
"projectid": this.projectId,
|
|
22033
22039
|
"objectid": eventid,
|
package/src/sf-i-events.ts
CHANGED
|
@@ -7424,11 +7424,15 @@ export class SfIEvents extends LitElement {
|
|
|
7424
7424
|
if (indexNext < titleArr.length - 1) {
|
|
7425
7425
|
if (Util.isVisible((titleArr[indexNext + 1] as HTMLButtonElement))) {
|
|
7426
7426
|
nextString = (titleArr[indexNext + 1] as HTMLButtonElement).id;
|
|
7427
|
+
console.log('prev nextString', nextString)
|
|
7427
7428
|
let nextIdArr = nextString.split("-")
|
|
7429
|
+
console.log('prev nextArr', nextIdArr)
|
|
7428
7430
|
if ((nextIdArr[7] ?? "") == "reportedlocations") {
|
|
7429
7431
|
nextString = "";
|
|
7432
|
+
console.log('prev nextString2', nextString)
|
|
7430
7433
|
indexNext++;
|
|
7431
7434
|
} else {
|
|
7435
|
+
console.log('prev nextString3', nextString)
|
|
7432
7436
|
flagNext = false;
|
|
7433
7437
|
}
|
|
7434
7438
|
} else {
|
|
@@ -7440,7 +7444,7 @@ export class SfIEvents extends LitElement {
|
|
|
7440
7444
|
}
|
|
7441
7445
|
|
|
7442
7446
|
// this.renderEventDetail(this.events[mmdd][j], mmdd + "/" + yyyy, null);
|
|
7443
|
-
this.fetchEventDetails(this.events[mmdd][j], mmdd + "/" + yyyy, null, eventsContainer);
|
|
7447
|
+
this.fetchEventDetails(this.events[mmdd][j], mmdd + "/" + yyyy, null, eventsContainer, prevString, nextString);
|
|
7444
7448
|
}
|
|
7445
7449
|
})
|
|
7446
7450
|
|
|
@@ -17018,10 +17022,10 @@ export class SfIEvents extends LitElement {
|
|
|
17018
17022
|
if (reportingSchemaJson != "" && reportingReporting != null) {
|
|
17019
17023
|
reportingReporting.configjson = reportingSchemaJson;
|
|
17020
17024
|
if (reportingSchemaValues != "") reportingReporting.prepopulateValJson = reportingSchemaValues
|
|
17021
|
-
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
17022
|
-
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
+
// reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
17026
|
+
// reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
17027
|
+
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
17028
|
+
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
17025
17029
|
reportingReporting.flow = "reporting"
|
|
17026
17030
|
setTimeout(() => {
|
|
17027
17031
|
reportingReporting.loadMode();
|
|
@@ -17116,8 +17120,10 @@ export class SfIEvents extends LitElement {
|
|
|
17116
17120
|
reportformatvalues = reportingReporting!.selectedValues()
|
|
17117
17121
|
}
|
|
17118
17122
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
|
|
17119
|
-
console.log('reportformatvalues', reportformatvalues, comparedObj)
|
|
17120
|
-
|
|
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
|
+
}
|
|
17121
17127
|
// return;
|
|
17122
17128
|
var clickEvent = new MouseEvent("click", {
|
|
17123
17129
|
"view": window,
|
|
@@ -27858,7 +27864,7 @@ export class SfIEvents extends LitElement {
|
|
|
27858
27864
|
}
|
|
27859
27865
|
|
|
27860
27866
|
sendSuggestions = async (eventid: string, eventdelta:any) => {
|
|
27861
|
-
let url = "https://" + this.
|
|
27867
|
+
let url = "https://" + this.apiIdRCMResources + "/sendsuggestions";
|
|
27862
27868
|
|
|
27863
27869
|
const body = {
|
|
27864
27870
|
"projectid": this.projectId,
|
package/src/util.ts
CHANGED
|
@@ -583,11 +583,18 @@ function isJSONParsable(str: unknown): boolean {
|
|
|
583
583
|
function isVisible(el: HTMLElement): boolean {
|
|
584
584
|
const style = window.getComputedStyle(el);
|
|
585
585
|
const rect = el.getBoundingClientRect();
|
|
586
|
-
console.log('previous style', style.display, rect, el.id
|
|
586
|
+
console.log('previous style', style.display, rect, el.id, (
|
|
587
|
+
rect.height > 0 &&
|
|
588
|
+
rect.width > 0
|
|
589
|
+
) && (
|
|
590
|
+
style.display !== "none" &&
|
|
591
|
+
style.visibility !== "hidden" &&
|
|
592
|
+
style.opacity !== "0"
|
|
593
|
+
));
|
|
587
594
|
|
|
588
595
|
return (
|
|
589
596
|
rect.height > 0 &&
|
|
590
|
-
rect.width
|
|
597
|
+
rect.width > 0
|
|
591
598
|
) && (
|
|
592
599
|
style.display !== "none" &&
|
|
593
600
|
style.visibility !== "hidden" &&
|
|
@@ -598,16 +605,24 @@ function isVisible(el: HTMLElement): boolean {
|
|
|
598
605
|
function compareObjects(obj1: any, obj2: any): any {
|
|
599
606
|
if (obj1 === obj2) return {};
|
|
600
607
|
|
|
601
|
-
//
|
|
608
|
+
// Case: both are arrays
|
|
602
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
|
+
|
|
603
618
|
const maxLength = Math.max(obj1.length, obj2.length);
|
|
604
|
-
const result
|
|
619
|
+
const result = [];
|
|
605
620
|
|
|
606
621
|
for (let i = 0; i < maxLength; i++) {
|
|
607
622
|
if (i >= obj1.length) {
|
|
608
623
|
result[i] = obj2[i]; // new item
|
|
609
624
|
} else if (i >= obj2.length) {
|
|
610
|
-
result[i] =
|
|
625
|
+
result[i] = obj1[i]; // removed item
|
|
611
626
|
} else {
|
|
612
627
|
const diff = compareObjects(obj1[i], obj2[i]);
|
|
613
628
|
if (Object.keys(diff).length > 0) {
|
|
@@ -618,7 +633,8 @@ function compareObjects(obj1: any, obj2: any): any {
|
|
|
618
633
|
|
|
619
634
|
return result.filter(v => v !== undefined).length > 0 ? result : {};
|
|
620
635
|
}
|
|
621
|
-
|
|
636
|
+
|
|
637
|
+
// Case: both are objects
|
|
622
638
|
if (
|
|
623
639
|
typeof obj1 === "object" &&
|
|
624
640
|
obj1 !== null &&
|
|
@@ -626,15 +642,15 @@ function compareObjects(obj1: any, obj2: any): any {
|
|
|
626
642
|
obj2 !== null
|
|
627
643
|
) {
|
|
628
644
|
const keys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
|
|
629
|
-
const diff:
|
|
645
|
+
const diff: any = {};
|
|
630
646
|
|
|
631
647
|
for (const key of keys) {
|
|
632
648
|
if (!(key in obj1)) {
|
|
633
|
-
diff[key] =
|
|
649
|
+
diff[key] = obj2[key];
|
|
634
650
|
} else if (!(key in obj2)) {
|
|
635
|
-
diff[key] =
|
|
651
|
+
diff[key] = obj1[key];
|
|
636
652
|
} else {
|
|
637
|
-
const valueDiff = compareObjects(
|
|
653
|
+
const valueDiff = compareObjects(obj1[key], obj2[key]);
|
|
638
654
|
if (
|
|
639
655
|
typeof valueDiff === "object" &&
|
|
640
656
|
valueDiff !== null &&
|
|
@@ -651,8 +667,8 @@ function compareObjects(obj1: any, obj2: any): any {
|
|
|
651
667
|
return Object.keys(diff).length > 0 ? diff : {};
|
|
652
668
|
}
|
|
653
669
|
|
|
654
|
-
//
|
|
655
|
-
return obj1 !== obj2 ? [obj1, obj2] :
|
|
670
|
+
// Case: primitives
|
|
671
|
+
return obj1 !== obj2 ? [obj1, obj2] : {};
|
|
656
672
|
}
|
|
657
673
|
const exportFunctions = {
|
|
658
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
|
@@ -495,17 +495,27 @@ function isJSONParsable(str) {
|
|
|
495
495
|
function isVisible(el) {
|
|
496
496
|
const style = window.getComputedStyle(el);
|
|
497
497
|
const rect = el.getBoundingClientRect();
|
|
498
|
-
console.log('previous style', style.display, rect, el.id
|
|
498
|
+
console.log('previous style', style.display, rect, el.id, (rect.height > 0 &&
|
|
499
|
+
rect.width > 0) && (style.display !== "none" &&
|
|
500
|
+
style.visibility !== "hidden" &&
|
|
501
|
+
style.opacity !== "0"));
|
|
499
502
|
return (rect.height > 0 &&
|
|
500
|
-
rect.width
|
|
503
|
+
rect.width > 0) && (style.display !== "none" &&
|
|
501
504
|
style.visibility !== "hidden" &&
|
|
502
505
|
style.opacity !== "0");
|
|
503
506
|
}
|
|
504
507
|
function compareObjects(obj1, obj2) {
|
|
505
508
|
if (obj1 === obj2)
|
|
506
509
|
return {};
|
|
507
|
-
//
|
|
510
|
+
// Case: both are arrays
|
|
508
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
|
+
}
|
|
509
519
|
const maxLength = Math.max(obj1.length, obj2.length);
|
|
510
520
|
const result = [];
|
|
511
521
|
for (let i = 0; i < maxLength; i++) {
|
|
@@ -513,7 +523,7 @@ function compareObjects(obj1, obj2) {
|
|
|
513
523
|
result[i] = obj2[i]; // new item
|
|
514
524
|
}
|
|
515
525
|
else if (i >= obj2.length) {
|
|
516
|
-
result[i] =
|
|
526
|
+
result[i] = obj1[i]; // removed item
|
|
517
527
|
}
|
|
518
528
|
else {
|
|
519
529
|
const diff = compareObjects(obj1[i], obj2[i]);
|
|
@@ -524,7 +534,7 @@ function compareObjects(obj1, obj2) {
|
|
|
524
534
|
}
|
|
525
535
|
return result.filter(v => v !== undefined).length > 0 ? result : {};
|
|
526
536
|
}
|
|
527
|
-
//
|
|
537
|
+
// Case: both are objects
|
|
528
538
|
if (typeof obj1 === "object" &&
|
|
529
539
|
obj1 !== null &&
|
|
530
540
|
typeof obj2 === "object" &&
|
|
@@ -533,10 +543,10 @@ function compareObjects(obj1, obj2) {
|
|
|
533
543
|
const diff = {};
|
|
534
544
|
for (const key of keys) {
|
|
535
545
|
if (!(key in obj1)) {
|
|
536
|
-
diff[key] =
|
|
546
|
+
diff[key] = obj2[key];
|
|
537
547
|
}
|
|
538
548
|
else if (!(key in obj2)) {
|
|
539
|
-
diff[key] =
|
|
549
|
+
diff[key] = obj1[key];
|
|
540
550
|
}
|
|
541
551
|
else {
|
|
542
552
|
const valueDiff = compareObjects(obj1[key], obj2[key]);
|
|
@@ -552,8 +562,8 @@ function compareObjects(obj1, obj2) {
|
|
|
552
562
|
}
|
|
553
563
|
return Object.keys(diff).length > 0 ? diff : {};
|
|
554
564
|
}
|
|
555
|
-
//
|
|
556
|
-
return obj1 !== obj2 ? [obj1, obj2] :
|
|
565
|
+
// Case: primitives
|
|
566
|
+
return obj1 !== obj2 ? [obj1, obj2] : {};
|
|
557
567
|
}
|
|
558
568
|
const exportFunctions = {
|
|
559
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
|