sf-i-events 1.0.938 → 1.0.939
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 +29 -0
- package/package.json +1 -1
- package/sf-i-events.js +12 -8
- package/src/sf-i-events.ts +8 -4
- package/src/util.ts +60 -1
- package/util.d.ts +2 -0
- package/util.js +55 -1
package/dev/index.html
CHANGED
|
@@ -1082,6 +1082,35 @@
|
|
|
1082
1082
|
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidusers="dnytrdlrmxgsy.cloudfront.net/userprofile"
|
|
1083
1083
|
disablesignoff="yes" disableclientresponse="yes">
|
|
1084
1084
|
|
|
1085
|
+
</sf-i-events> -->
|
|
1086
|
+
<!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
|
|
1087
|
+
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
|
|
1088
|
+
apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
|
|
1089
|
+
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
|
1090
|
+
apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws"
|
|
1091
|
+
apiidagreements="swago3unro2te55ikvjuqwcrr40wluqh.lambda-url.us-east-1.on.aws"
|
|
1092
|
+
apiidlicenses="lbtsbsctcdsyah4qdszkv4rctq0tnvel.lambda-url.us-east-1.on.aws"
|
|
1093
|
+
apiidrcmresources="jra3sghasmaxn5aiq7rtv6pjzq0oeuaw.lambda-url.us-east-1.on.aws" fill="solid"
|
|
1094
|
+
username="Madhura Zende Internal" userprofileid="8d3edbb1-8318-4525-978a-ecc4c5a8e713"
|
|
1095
|
+
projectid="d7d4d17e-3e20-4eaa-a06a-fb1c87f26532" projectname="FlaggGRC Global"
|
|
1096
|
+
countryid="c48d7cc1-62df-41b3-807a-5744973db3d9" selectedcriteria="Country - India" myrole="approver"
|
|
1097
|
+
showregisterexport="false" features="["rcmresources"]"
|
|
1098
|
+
eventfielddependencies="[{"type": "foreignkey", "parent": "country", "child": "state"},{"type": "foreignkey", "parent": "category", "child": "subcategory"},{"type": "foreignkey", "parent": "frequency", "child": "subfrequency"}]"
|
|
1099
|
+
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"}]"
|
|
1100
|
+
eventpreviewfields="["obligation"]"
|
|
1101
|
+
eventhidefields="["comments","documents","lastupdated","approved","tags"]"
|
|
1102
|
+
calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
|
|
1103
|
+
|
|
1104
|
+
<div slot="uploader">
|
|
1105
|
+
<sf-i-uploader id="uploader" max="10" apiid="1peg5170d3"
|
|
1106
|
+
allowedextensions="["jpg","jpeg","png","pdf","xls","xlsx","doc","docx","zip"]"
|
|
1107
|
+
extract="yes" projectid="d7d4d17e-3e20-4eaa-a06a-fb1c87f26532" maxsize="31457280"
|
|
1108
|
+
allowdownload="yes"></sf-i-uploader>
|
|
1109
|
+
</div>
|
|
1110
|
+
<div slot="reporting">
|
|
1111
|
+
<sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
|
|
1112
|
+
</div>
|
|
1113
|
+
|
|
1085
1114
|
</sf-i-events> -->
|
|
1086
1115
|
<script>
|
|
1087
1116
|
|
package/package.json
CHANGED
package/sf-i-events.js
CHANGED
|
@@ -2914,7 +2914,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
2914
2914
|
let approverStr = event.concise == null ? this.getApproverStringFromEvent(event) : "";
|
|
2915
2915
|
let graphParam = this.getGraphParam(event);
|
|
2916
2916
|
// console.log("graphParam", graphParam.split(';')[0]);
|
|
2917
|
-
html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + ((event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + ((event.module == "compliances" || event.module == null) ? ('<input type="checkbox" id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="input-checkbox" class="material-icons mb-20 ml-10 input-checkbox-review"' + (event.review ? 'checked' : '') + '/><label for="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="label-checkbox" class="label-checkbox mb-20">' + (event.review ? 'Reviewed' : 'Review') + '</label></div>') : '</div>');
|
|
2917
|
+
html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + ((event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null) ? ('<input type="checkbox" id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="input-checkbox" class="material-icons mb-20 ml-10 input-checkbox-review"' + (event.review ? 'checked' : '') + '/><label for="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="label-checkbox" class="label-checkbox mb-20">' + (event.review ? 'Reviewed' : 'Review') + '</label></div>') : '</div>');
|
|
2918
2918
|
// }
|
|
2919
2919
|
return html;
|
|
2920
2920
|
};
|
|
@@ -13164,12 +13164,15 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13164
13164
|
reportingReporting.prepopulateValJson = reportingSchemaValues;
|
|
13165
13165
|
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view";
|
|
13166
13166
|
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true";
|
|
13167
|
+
// reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
13168
|
+
// reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
13167
13169
|
reportingReporting.flow = "reporting";
|
|
13168
13170
|
setTimeout(() => {
|
|
13169
13171
|
reportingReporting.loadMode();
|
|
13170
13172
|
console.log('list-customreporting', reportingSchemaJson);
|
|
13171
13173
|
console.log('list-customreporting1', reportingSchemaValues);
|
|
13172
13174
|
console.log('list-customreporting2', reportingReporting.mode);
|
|
13175
|
+
console.log('list-customreporting3', this.myRole);
|
|
13173
13176
|
}, 500);
|
|
13174
13177
|
}
|
|
13175
13178
|
(_a = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
|
|
@@ -13223,7 +13226,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13223
13226
|
});
|
|
13224
13227
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
13225
13228
|
(_f = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async (ev) => {
|
|
13226
|
-
var _a, _b, _c, _f
|
|
13229
|
+
var _a, _b, _c, _f;
|
|
13227
13230
|
let buttonClick = ev.target;
|
|
13228
13231
|
buttonClick.innerHTML = "Saving...";
|
|
13229
13232
|
const comments = this._SfDetailContainer.querySelector('#input-approver-comments').value;
|
|
@@ -13241,12 +13244,13 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13241
13244
|
}, 3000);
|
|
13242
13245
|
return;
|
|
13243
13246
|
}
|
|
13244
|
-
let reportformatvalues =
|
|
13247
|
+
let reportformatvalues = {};
|
|
13245
13248
|
let reportingReporting = this._SfDetailContainer.querySelector('#reporting-reporting');
|
|
13246
13249
|
console.log('renew reporting', reportingReporting);
|
|
13247
13250
|
if (reportingReporting != null) {
|
|
13248
|
-
reportformatvalues =
|
|
13251
|
+
reportformatvalues = reportingReporting.selectedValues();
|
|
13249
13252
|
}
|
|
13253
|
+
console.log('reportformatvalues', Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues)));
|
|
13250
13254
|
var clickEvent = new MouseEvent("click", {
|
|
13251
13255
|
"view": window,
|
|
13252
13256
|
"bubbles": true,
|
|
@@ -13257,7 +13261,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13257
13261
|
let flagBulk = false;
|
|
13258
13262
|
if (this.selectedItemIds.length <= 1) {
|
|
13259
13263
|
console.log('mmddyyyy', mmddyyyy);
|
|
13260
|
-
if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (
|
|
13264
|
+
if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "compliance")) {
|
|
13261
13265
|
if (approved) {
|
|
13262
13266
|
await this.renewRCMResource(listEvent, reportformatvalues);
|
|
13263
13267
|
}
|
|
@@ -13267,7 +13271,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13267
13271
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
13268
13272
|
if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
13269
13273
|
this.events[mmdd][p].approved = approved;
|
|
13270
|
-
this.events[mmdd][p].terminated = (
|
|
13274
|
+
this.events[mmdd][p].terminated = (_b = (reportformatvalues.terminated)) !== null && _b !== void 0 ? _b : false;
|
|
13271
13275
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
|
|
13272
13276
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
13273
13277
|
}
|
|
@@ -13303,7 +13307,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13303
13307
|
"userid": this.userProfileId,
|
|
13304
13308
|
"userrole": this.myRole,
|
|
13305
13309
|
"year": yearStr,
|
|
13306
|
-
"module": (
|
|
13310
|
+
"module": (_c = listEvent.module) !== null && _c !== void 0 ? _c : "compliance"
|
|
13307
13311
|
});
|
|
13308
13312
|
// await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
|
|
13309
13313
|
// this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
|
|
@@ -13354,7 +13358,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13354
13358
|
"bubbles": true,
|
|
13355
13359
|
"cancelable": false
|
|
13356
13360
|
});
|
|
13357
|
-
(
|
|
13361
|
+
(_f = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _f === void 0 ? void 0 : _f.dispatchEvent(clickEvent);
|
|
13358
13362
|
// if(currentColumnButton != null) {
|
|
13359
13363
|
// currentColumnButton.click();
|
|
13360
13364
|
// }
|
package/src/sf-i-events.ts
CHANGED
|
@@ -5187,7 +5187,7 @@ export class SfIEvents extends LitElement {
|
|
|
5187
5187
|
|
|
5188
5188
|
let graphParam = this.getGraphParam(event);
|
|
5189
5189
|
// console.log("graphParam", graphParam.split(';')[0]);
|
|
5190
|
-
html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + ((event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + ((event.module == "compliances" || event.module == null) ? ('<input type="checkbox" id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="input-checkbox" class="material-icons mb-20 ml-10 input-checkbox-review"' + (event.review ? 'checked' : '') + '/><label for="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="label-checkbox" class="label-checkbox mb-20">' + (event.review ? 'Reviewed' : 'Review') + '</label></div>') : '</div>');
|
|
5190
|
+
html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + ((event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null) ? ('<input type="checkbox" id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="input-checkbox" class="material-icons mb-20 ml-10 input-checkbox-review"' + (event.review ? 'checked' : '') + '/><label for="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="label-checkbox" class="label-checkbox mb-20">' + (event.review ? 'Reviewed' : 'Review') + '</label></div>') : '</div>');
|
|
5191
5191
|
// }
|
|
5192
5192
|
|
|
5193
5193
|
return html;
|
|
@@ -17005,12 +17005,15 @@ export class SfIEvents extends LitElement {
|
|
|
17005
17005
|
if (reportingSchemaValues != "") reportingReporting.prepopulateValJson = reportingSchemaValues
|
|
17006
17006
|
reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
17007
17007
|
reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
17008
|
+
// reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
|
|
17009
|
+
// reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
|
|
17008
17010
|
reportingReporting.flow = "reporting"
|
|
17009
17011
|
setTimeout(() => {
|
|
17010
17012
|
reportingReporting.loadMode();
|
|
17011
17013
|
console.log('list-customreporting', reportingSchemaJson);
|
|
17012
17014
|
console.log('list-customreporting1', reportingSchemaValues);
|
|
17013
17015
|
console.log('list-customreporting2', reportingReporting.mode);
|
|
17016
|
+
console.log('list-customreporting3', this.myRole);
|
|
17014
17017
|
}, 500)
|
|
17015
17018
|
}
|
|
17016
17019
|
|
|
@@ -17091,12 +17094,13 @@ export class SfIEvents extends LitElement {
|
|
|
17091
17094
|
}, 3000);
|
|
17092
17095
|
return;
|
|
17093
17096
|
}
|
|
17094
|
-
let reportformatvalues =
|
|
17097
|
+
let reportformatvalues: any = {}
|
|
17095
17098
|
let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting') as SfIReporting
|
|
17096
17099
|
console.log('renew reporting', reportingReporting)
|
|
17097
17100
|
if (reportingReporting != null) {
|
|
17098
|
-
reportformatvalues =
|
|
17101
|
+
reportformatvalues = reportingReporting!.selectedValues()
|
|
17099
17102
|
}
|
|
17103
|
+
console.log('reportformatvalues', Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues)))
|
|
17100
17104
|
var clickEvent = new MouseEvent("click", {
|
|
17101
17105
|
"view": window,
|
|
17102
17106
|
"bubbles": true,
|
|
@@ -17117,7 +17121,7 @@ export class SfIEvents extends LitElement {
|
|
|
17117
17121
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
17118
17122
|
if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
17119
17123
|
this.events[mmdd][p].approved = approved
|
|
17120
|
-
this.events[mmdd][p].terminated = (
|
|
17124
|
+
this.events[mmdd][p].terminated = (reportformatvalues.terminated) ?? false
|
|
17121
17125
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
17122
17126
|
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
17123
17127
|
}
|
package/src/util.ts
CHANGED
|
@@ -589,8 +589,67 @@ function isVisible(el: HTMLElement): boolean {
|
|
|
589
589
|
);
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
function compareObjects (obj1: any, obj2: any): any {
|
|
593
|
+
if (obj1 === obj2) return {};
|
|
594
|
+
|
|
595
|
+
// If both are arrays
|
|
596
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
597
|
+
const maxLength = Math.max(obj1.length, obj2.length);
|
|
598
|
+
const result: any[] = [];
|
|
599
|
+
|
|
600
|
+
for (let i = 0; i < maxLength; i++) {
|
|
601
|
+
if (i >= obj1.length) {
|
|
602
|
+
result[i] = obj2[i]; // new item
|
|
603
|
+
} else if (i >= obj2.length) {
|
|
604
|
+
result[i] = undefined; // removed item
|
|
605
|
+
} else {
|
|
606
|
+
const diff = compareObjects(obj1[i], obj2[i]);
|
|
607
|
+
if (Object.keys(diff).length > 0) {
|
|
608
|
+
result[i] = diff;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return result.filter(v => v !== undefined).length > 0 ? result : {};
|
|
614
|
+
}
|
|
615
|
+
// If both are objects
|
|
616
|
+
if (
|
|
617
|
+
typeof obj1 === "object" &&
|
|
618
|
+
obj1 !== null &&
|
|
619
|
+
typeof obj2 === "object" &&
|
|
620
|
+
obj2 !== null
|
|
621
|
+
) {
|
|
622
|
+
const keys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
|
|
623
|
+
const diff: Record<string, any> = {};
|
|
624
|
+
|
|
625
|
+
for (const key of keys) {
|
|
626
|
+
if (!(key in obj1)) {
|
|
627
|
+
diff[key] = [null,(obj2 as any)[key]];
|
|
628
|
+
} else if (!(key in obj2)) {
|
|
629
|
+
diff[key] = [(obj1 as any)[key], null];
|
|
630
|
+
} else {
|
|
631
|
+
const valueDiff = compareObjects((obj1 as any)[key], (obj2 as any)[key]);
|
|
632
|
+
if (
|
|
633
|
+
typeof valueDiff === "object" &&
|
|
634
|
+
valueDiff !== null &&
|
|
635
|
+
Object.keys(valueDiff).length === 0
|
|
636
|
+
) {
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
if (valueDiff !== undefined) {
|
|
640
|
+
diff[key] = valueDiff;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return Object.keys(diff).length > 0 ? diff : {};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Primitive comparison
|
|
649
|
+
return obj1 !== obj2 ? [obj1,obj2] : [];
|
|
650
|
+
}
|
|
592
651
|
const exportFunctions = {
|
|
593
|
-
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible
|
|
652
|
+
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible, compareObjects
|
|
594
653
|
};
|
|
595
654
|
|
|
596
655
|
export default exportFunctions;
|
package/util.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare function getFeatures(): any;
|
|
|
24
24
|
export declare const downloadExcelFromCSV: (csvString: string, fileName: string | undefined, title: string, projectname: string) => void;
|
|
25
25
|
declare function isJSONParsable(str: unknown): boolean;
|
|
26
26
|
declare function isVisible(el: HTMLElement): boolean;
|
|
27
|
+
declare function compareObjects(obj1: any, obj2: any): any;
|
|
27
28
|
declare const exportFunctions: {
|
|
28
29
|
callApiPresignedDelete: typeof callApiPresignedDelete;
|
|
29
30
|
callApiPresignedGet: typeof callApiPresignedGet;
|
|
@@ -53,6 +54,7 @@ declare const exportFunctions: {
|
|
|
53
54
|
downloadExcelFromCSV: (csvString: string, fileName: string | undefined, title: string, projectname: string) => void;
|
|
54
55
|
isJSONParsable: typeof isJSONParsable;
|
|
55
56
|
isVisible: typeof isVisible;
|
|
57
|
+
compareObjects: typeof compareObjects;
|
|
56
58
|
};
|
|
57
59
|
export default exportFunctions;
|
|
58
60
|
//# sourceMappingURL=util.d.ts.map
|
package/util.js
CHANGED
|
@@ -495,8 +495,62 @@ function isVisible(el) {
|
|
|
495
495
|
style.visibility !== "hidden" &&
|
|
496
496
|
style.opacity !== "0");
|
|
497
497
|
}
|
|
498
|
+
function compareObjects(obj1, obj2) {
|
|
499
|
+
if (obj1 === obj2)
|
|
500
|
+
return {};
|
|
501
|
+
// If both are arrays
|
|
502
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
503
|
+
const maxLength = Math.max(obj1.length, obj2.length);
|
|
504
|
+
const result = [];
|
|
505
|
+
for (let i = 0; i < maxLength; i++) {
|
|
506
|
+
if (i >= obj1.length) {
|
|
507
|
+
result[i] = obj2[i]; // new item
|
|
508
|
+
}
|
|
509
|
+
else if (i >= obj2.length) {
|
|
510
|
+
result[i] = undefined; // removed item
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
const diff = compareObjects(obj1[i], obj2[i]);
|
|
514
|
+
if (Object.keys(diff).length > 0) {
|
|
515
|
+
result[i] = diff;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return result.filter(v => v !== undefined).length > 0 ? result : {};
|
|
520
|
+
}
|
|
521
|
+
// If both are objects
|
|
522
|
+
if (typeof obj1 === "object" &&
|
|
523
|
+
obj1 !== null &&
|
|
524
|
+
typeof obj2 === "object" &&
|
|
525
|
+
obj2 !== null) {
|
|
526
|
+
const keys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
|
|
527
|
+
const diff = {};
|
|
528
|
+
for (const key of keys) {
|
|
529
|
+
if (!(key in obj1)) {
|
|
530
|
+
diff[key] = [null, obj2[key]];
|
|
531
|
+
}
|
|
532
|
+
else if (!(key in obj2)) {
|
|
533
|
+
diff[key] = [obj1[key], null];
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
const valueDiff = compareObjects(obj1[key], obj2[key]);
|
|
537
|
+
if (typeof valueDiff === "object" &&
|
|
538
|
+
valueDiff !== null &&
|
|
539
|
+
Object.keys(valueDiff).length === 0) {
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (valueDiff !== undefined) {
|
|
543
|
+
diff[key] = valueDiff;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return Object.keys(diff).length > 0 ? diff : {};
|
|
548
|
+
}
|
|
549
|
+
// Primitive comparison
|
|
550
|
+
return obj1 !== obj2 ? [obj1, obj2] : [];
|
|
551
|
+
}
|
|
498
552
|
const exportFunctions = {
|
|
499
|
-
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible
|
|
553
|
+
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString, getCurrentFiscal, getDateTimeStrings, getUsermap, setFeatures, getFeatures, getProjectUsermap, downloadExcelFromCSV, isJSONParsable, isVisible, compareObjects
|
|
500
554
|
};
|
|
501
555
|
export default exportFunctions;
|
|
502
556
|
//# sourceMappingURL=util.js.map
|