sf-i-events 1.0.944 → 1.0.946
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 +32 -2
- package/package.json +1 -1
- package/sf-i-events.js +8 -4
- package/src/sf-i-events.ts +8 -4
- package/src/util.ts +19 -10
- package/util.js +14 -7
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,6 +1084,36 @@
|
|
|
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"
|
|
1088
|
+
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
|
|
1089
|
+
apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
|
|
1090
|
+
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
|
1091
|
+
apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws"
|
|
1092
|
+
apiidagreements="swago3unro2te55ikvjuqwcrr40wluqh.lambda-url.us-east-1.on.aws"
|
|
1093
|
+
apiidlicenses="lbtsbsctcdsyah4qdszkv4rctq0tnvel.lambda-url.us-east-1.on.aws"
|
|
1094
|
+
apiidrcmresources="jra3sghasmaxn5aiq7rtv6pjzq0oeuaw.lambda-url.us-east-1.on.aws" fill="solid"
|
|
1095
|
+
username="Local Approver 1" userprofileid="c44dcd04-aebb-4417-ba6b-fac170efd5d0"
|
|
1096
|
+
projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global"
|
|
1097
|
+
countryid="07d73b44-648d-4301-82c4-d6df43397824" selectedcriteria="Country - India" myrole="approver"
|
|
1098
|
+
showregisterexport="false"
|
|
1099
|
+
features="["notices","contracts","licenses","rcmresources"]"
|
|
1100
|
+
eventfielddependencies="[{"type": "foreignkey", "parent": "country", "child": "state"},{"type": "foreignkey", "parent": "category", "child": "subcategory"},{"type": "foreignkey", "parent": "frequency", "child": "subfrequency"}]"
|
|
1101
|
+
eventfields="[{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/riskarea", "field": "riskarea"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/jurisdiction", "field": "jurisdiction"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/updatetype", "field": "updatetype"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/country", "field": "country"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/specificity", "field": "specificity"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/risk", "field": "risk"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/frequency", "field": "frequency"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/category", "field": "category"},{"type": "sf-i-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/obligationtype", "field": "obligationtype"},{"type": "sf-i-sub-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/state", "field": "state"},{"type": "sf-i-sub-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/subfrequency", "field": "subfrequency"},{"type": "sf-i-sub-select", "apiId": "dnytrdlrmxgsy.cloudfront.net/subcategory", "field": "subcategory"},{"type": "sf-i-form", "apiId": "dnytrdlrmxgsy.cloudfront.net/statute", "field": "statute", "projectField": "name"}]"
|
|
1102
|
+
eventpreviewfields="["obligation"]"
|
|
1103
|
+
eventhidefields="["comments","documents","lastupdated","approved","tags"]"
|
|
1104
|
+
calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
|
|
1105
|
+
|
|
1106
|
+
<div slot="uploader">
|
|
1107
|
+
<sf-i-uploader id="uploader" max="10" apiid="1peg5170d3"
|
|
1108
|
+
allowedextensions="["jpg","jpeg","png","pdf","xls","xlsx","doc","docx","zip"]"
|
|
1109
|
+
extract="yes" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" maxsize="31457280"
|
|
1110
|
+
allowdownload="yes"></sf-i-uploader>
|
|
1111
|
+
</div>
|
|
1112
|
+
<div slot="reporting">
|
|
1113
|
+
<sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
|
|
1114
|
+
</div>
|
|
1115
|
+
|
|
1116
|
+
</sf-i-events>
|
|
1087
1117
|
<!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
|
|
1088
1118
|
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
|
|
1089
1119
|
apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
|
package/package.json
CHANGED
package/sf-i-events.js
CHANGED
|
@@ -13264,15 +13264,19 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13264
13264
|
return;
|
|
13265
13265
|
}
|
|
13266
13266
|
let reportformatvalues = {};
|
|
13267
|
+
let reportformatvaluesStr = "";
|
|
13267
13268
|
let reportingReporting = this._SfDetailContainer.querySelector('#reporting-reporting');
|
|
13268
13269
|
console.log('renew reporting', reportingReporting);
|
|
13269
13270
|
if (reportingReporting != null) {
|
|
13270
13271
|
reportformatvalues = reportingReporting.selectedValues();
|
|
13272
|
+
reportformatvaluesStr = JSON.stringify(reportingReporting.selectedValues());
|
|
13271
13273
|
}
|
|
13272
13274
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues));
|
|
13273
|
-
console.log('reportformatvalues', reportformatvalues, comparedObj);
|
|
13274
|
-
|
|
13275
|
-
|
|
13275
|
+
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj);
|
|
13276
|
+
if (Object.keys(comparedObj).length > 0) {
|
|
13277
|
+
await this.sendSuggestions(listEvent.id, comparedObj);
|
|
13278
|
+
}
|
|
13279
|
+
// return;
|
|
13276
13280
|
var clickEvent = new MouseEvent("click", {
|
|
13277
13281
|
"view": window,
|
|
13278
13282
|
"bubbles": true,
|
|
@@ -13285,7 +13289,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13285
13289
|
console.log('mmddyyyy', mmddyyyy);
|
|
13286
13290
|
if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "compliance")) {
|
|
13287
13291
|
if (approved) {
|
|
13288
|
-
await this.renewRCMResource(listEvent,
|
|
13292
|
+
await this.renewRCMResource(listEvent, reportformatvaluesStr);
|
|
13289
13293
|
}
|
|
13290
13294
|
else {
|
|
13291
13295
|
console.log('renew reporting', reportformatvalues);
|
package/src/sf-i-events.ts
CHANGED
|
@@ -17114,15 +17114,19 @@ export class SfIEvents extends LitElement {
|
|
|
17114
17114
|
return;
|
|
17115
17115
|
}
|
|
17116
17116
|
let reportformatvalues: any = {}
|
|
17117
|
+
let reportformatvaluesStr: string = ""
|
|
17117
17118
|
let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting') as SfIReporting
|
|
17118
17119
|
console.log('renew reporting', reportingReporting)
|
|
17119
17120
|
if (reportingReporting != null) {
|
|
17120
17121
|
reportformatvalues = reportingReporting!.selectedValues()
|
|
17122
|
+
reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
|
|
17121
17123
|
}
|
|
17122
17124
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
|
|
17123
|
-
console.log('reportformatvalues', reportformatvalues, comparedObj)
|
|
17124
|
-
|
|
17125
|
-
|
|
17125
|
+
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues),comparedObj)
|
|
17126
|
+
if(Object.keys(comparedObj).length > 0){
|
|
17127
|
+
await this.sendSuggestions(listEvent.id, comparedObj);
|
|
17128
|
+
}
|
|
17129
|
+
// return;
|
|
17126
17130
|
var clickEvent = new MouseEvent("click", {
|
|
17127
17131
|
"view": window,
|
|
17128
17132
|
"bubbles": true,
|
|
@@ -17136,7 +17140,7 @@ export class SfIEvents extends LitElement {
|
|
|
17136
17140
|
console.log('mmddyyyy', mmddyyyy)
|
|
17137
17141
|
if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "compliance")) {
|
|
17138
17142
|
if (approved) {
|
|
17139
|
-
await this.renewRCMResource(listEvent,
|
|
17143
|
+
await this.renewRCMResource(listEvent, reportformatvaluesStr);
|
|
17140
17144
|
} else {
|
|
17141
17145
|
console.log('renew reporting', reportformatvalues)
|
|
17142
17146
|
}
|
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
|
-
//
|
|
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
|
|
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] =
|
|
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
|
-
|
|
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:
|
|
645
|
+
const diff: any = {};
|
|
637
646
|
|
|
638
647
|
for (const key of keys) {
|
|
639
648
|
if (!(key in obj1)) {
|
|
640
|
-
diff[key] =
|
|
649
|
+
diff[key] = obj2[key];
|
|
641
650
|
} else if (!(key in obj2)) {
|
|
642
|
-
diff[key] =
|
|
651
|
+
diff[key] = obj1[key];
|
|
643
652
|
} else {
|
|
644
|
-
const valueDiff = compareObjects(
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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] =
|
|
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
|
-
//
|
|
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] =
|
|
546
|
+
diff[key] = obj2[key];
|
|
540
547
|
}
|
|
541
548
|
else if (!(key in obj2)) {
|
|
542
|
-
diff[key] =
|
|
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
|
-
//
|
|
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
|