sf-i-events 1.0.839 → 1.0.840
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 +1 -1
- package/package.json +1 -1
- package/sf-i-events.d.ts +1 -0
- package/sf-i-events.js +20 -2
- package/src/sf-i-events.ts +25 -2
package/dev/index.html
CHANGED
|
@@ -734,7 +734,7 @@
|
|
|
734
734
|
</div>
|
|
735
735
|
|
|
736
736
|
</sf-i-events> -->
|
|
737
|
-
<sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition" apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat" apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws" fill="solid" username="Viewer J1" userprofileid="344c84d2-5976-47ff-949b-49f6fa9627eb" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" countryid="07d73b44-648d-4301-82c4-d6df43397824" myrole="viewer" showregisterexport="false" features="["notices"]" eventfielddependencies="[{"type": "foreignkey", "parent": "country", "child": "state"},{"type": "foreignkey", "parent": "category", "child": "subcategory"},{"type": "foreignkey", "parent": "frequency", "child": "subfrequency"}]" 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"}]" eventpreviewfields="["obligation"]" eventhidefields="["comments","documents","lastupdated","approved","tags"]" calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="
|
|
737
|
+
<sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition" apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat" apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws" fill="solid" username="Viewer J1" userprofileid="344c84d2-5976-47ff-949b-49f6fa9627eb" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" countryid="07d73b44-648d-4301-82c4-d6df43397824" myrole="viewer" showregisterexport="false" features="["notices"]" eventfielddependencies="[{"type": "foreignkey", "parent": "country", "child": "state"},{"type": "foreignkey", "parent": "category", "child": "subcategory"},{"type": "foreignkey", "parent": "frequency", "child": "subfrequency"}]" 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"}]" eventpreviewfields="["obligation"]" eventhidefields="["comments","documents","lastupdated","approved","tags"]" calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
|
|
738
738
|
|
|
739
739
|
<div slot="uploader">
|
|
740
740
|
<sf-i-uploader id="uploader" max="10" apiid="1peg5170d3" allowedextensions="["jpg","png","pdf","xls","xlsx","doc","docx"]" extract="yes" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" maxsize="5242880" allowdownload="yes"></sf-i-uploader>
|
package/package.json
CHANGED
package/sf-i-events.d.ts
CHANGED
|
@@ -504,6 +504,7 @@ export declare class SfIEvents extends LitElement {
|
|
|
504
504
|
attachHandlers: (eventContainer: HTMLDivElement, valueStart: string, valueEnd: string) => void;
|
|
505
505
|
processFindSelection: (eventContainer: HTMLDivElement, searchString: string) => Promise<void>;
|
|
506
506
|
processDateSelection: (eventContainer: HTMLDivElement, fetchData?: boolean, showBackgroundButton?: boolean) => Promise<void>;
|
|
507
|
+
isLessThanYearApart: (date1: string | Date, date2: string | Date) => boolean;
|
|
507
508
|
processDateSelectionViewer: (eventContainer: HTMLDivElement) => Promise<void>;
|
|
508
509
|
initFindRightCol: () => void;
|
|
509
510
|
initCustomRightCol: () => void;
|
package/sf-i-events.js
CHANGED
|
@@ -5283,7 +5283,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
5283
5283
|
this._SfStreamEventStatus.innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
|
|
5284
5284
|
return;
|
|
5285
5285
|
}
|
|
5286
|
-
if ((
|
|
5286
|
+
if (!this.isLessThanYearApart(valueEnd, valueStart)) {
|
|
5287
5287
|
this._SfStreamEventStatus.innerHTML = "Chosen time window cannot be greater than 365 days";
|
|
5288
5288
|
return;
|
|
5289
5289
|
}
|
|
@@ -5312,6 +5312,23 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
5312
5312
|
this.renderCompletenessGraph(eventContainer);
|
|
5313
5313
|
}
|
|
5314
5314
|
};
|
|
5315
|
+
this.isLessThanYearApart = (date1, date2) => {
|
|
5316
|
+
let d1 = new Date(date1);
|
|
5317
|
+
let d2 = new Date(date2);
|
|
5318
|
+
// Ensure d1 is always the earlier date
|
|
5319
|
+
if (d1 > d2) {
|
|
5320
|
+
[d1, d2] = [d2, d1];
|
|
5321
|
+
}
|
|
5322
|
+
// Check if the dates are exactly one year apart (same month & day)
|
|
5323
|
+
if (d2.getFullYear() - d1.getFullYear() === 1 && d2.getMonth() === d1.getMonth() && d2.getDate() === d1.getDate()) {
|
|
5324
|
+
return false;
|
|
5325
|
+
}
|
|
5326
|
+
// Calculate difference in milliseconds
|
|
5327
|
+
const diffInMs = d2.getTime() - d1.getTime();
|
|
5328
|
+
// One full year in milliseconds, considering leap years
|
|
5329
|
+
const oneYearInMs = 365.25 * 24 * 60 * 60 * 1000;
|
|
5330
|
+
return diffInMs < oneYearInMs;
|
|
5331
|
+
};
|
|
5315
5332
|
this.processDateSelectionViewer = async (eventContainer) => {
|
|
5316
5333
|
// var startDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + this.calendarStartYYYY);
|
|
5317
5334
|
// var endDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + (parseInt(this.calendarStartYYYY) + 1));
|
|
@@ -5396,7 +5413,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
5396
5413
|
this._SfStreamEventStatus.innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
|
|
5397
5414
|
return;
|
|
5398
5415
|
}
|
|
5399
|
-
if ((
|
|
5416
|
+
if (!this.isLessThanYearApart(valueEnd, valueStart)) {
|
|
5417
|
+
console.log('dates entered', valueEnd, valueStart);
|
|
5400
5418
|
this._SfStreamEventStatus.innerHTML = "Chosen time window cannot be greater than 365 days";
|
|
5401
5419
|
return;
|
|
5402
5420
|
}
|
package/src/sf-i-events.ts
CHANGED
|
@@ -7916,7 +7916,7 @@ export class SfIEvents extends LitElement {
|
|
|
7916
7916
|
(this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
|
|
7917
7917
|
return;
|
|
7918
7918
|
}
|
|
7919
|
-
if((
|
|
7919
|
+
if(!this.isLessThanYearApart(valueEnd, valueStart)) {
|
|
7920
7920
|
(this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen time window cannot be greater than 365 days";
|
|
7921
7921
|
return;
|
|
7922
7922
|
}
|
|
@@ -7948,6 +7948,28 @@ export class SfIEvents extends LitElement {
|
|
|
7948
7948
|
|
|
7949
7949
|
}
|
|
7950
7950
|
|
|
7951
|
+
isLessThanYearApart = (date1: string | Date, date2: string | Date) => {
|
|
7952
|
+
let d1: Date = new Date(date1);
|
|
7953
|
+
let d2: Date = new Date(date2);
|
|
7954
|
+
|
|
7955
|
+
// Ensure d1 is always the earlier date
|
|
7956
|
+
if (d1 > d2) {
|
|
7957
|
+
[d1, d2] = [d2, d1];
|
|
7958
|
+
}
|
|
7959
|
+
|
|
7960
|
+
// Check if the dates are exactly one year apart (same month & day)
|
|
7961
|
+
if (d2.getFullYear() - d1.getFullYear() === 1 && d2.getMonth() === d1.getMonth() && d2.getDate() === d1.getDate()) {
|
|
7962
|
+
return false;
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7965
|
+
// Calculate difference in milliseconds
|
|
7966
|
+
const diffInMs = d2.getTime() - d1.getTime();
|
|
7967
|
+
|
|
7968
|
+
// One full year in milliseconds, considering leap years
|
|
7969
|
+
const oneYearInMs = 365.25 * 24 * 60 * 60 * 1000;
|
|
7970
|
+
|
|
7971
|
+
return diffInMs < oneYearInMs;
|
|
7972
|
+
}
|
|
7951
7973
|
processDateSelectionViewer = async (eventContainer: HTMLDivElement) => {
|
|
7952
7974
|
|
|
7953
7975
|
// var startDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + this.calendarStartYYYY);
|
|
@@ -8034,7 +8056,8 @@ export class SfIEvents extends LitElement {
|
|
|
8034
8056
|
(this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
|
|
8035
8057
|
return;
|
|
8036
8058
|
}
|
|
8037
|
-
if((
|
|
8059
|
+
if(!this.isLessThanYearApart(valueEnd, valueStart)) {
|
|
8060
|
+
console.log('dates entered', valueEnd, valueStart);
|
|
8038
8061
|
(this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen time window cannot be greater than 365 days";
|
|
8039
8062
|
return;
|
|
8040
8063
|
}
|