dts-backoffice-util 15.1.0 → 15.3.0
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/README.md +8 -4
- package/esm2020/lib/services/menu-datasul.service.mjs +9 -1
- package/esm2020/lib/utils/disclaimer.util.mjs +38 -1
- package/fesm2015/dts-backoffice-util.mjs +45 -0
- package/fesm2015/dts-backoffice-util.mjs.map +1 -1
- package/fesm2020/dts-backoffice-util.mjs +45 -0
- package/fesm2020/dts-backoffice-util.mjs.map +1 -1
- package/lib/services/menu-datasul.service.d.ts +2 -0
- package/lib/utils/disclaimer.util.d.ts +4 -2
- package/package.json +1 -1
|
@@ -268,6 +268,14 @@ class MenuDatasulService {
|
|
|
268
268
|
openPath(programName, params, parent = true) {
|
|
269
269
|
const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
|
|
270
270
|
let baseUrl = `/${datasulPath}/#/${datasulPath}/program-html/${programName}/#`;
|
|
271
|
+
this.openHTMLProgram(baseUrl, params, parent);
|
|
272
|
+
}
|
|
273
|
+
openTHF(externalName, params, parent = true) {
|
|
274
|
+
const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
|
|
275
|
+
let baseUrl = `/${datasulPath}/#/${externalName}/#`;
|
|
276
|
+
this.openHTMLProgram(baseUrl, params, parent);
|
|
277
|
+
}
|
|
278
|
+
openHTMLProgram(baseUrl, params, parent) {
|
|
271
279
|
if (params) {
|
|
272
280
|
baseUrl = `${baseUrl}/${params}`;
|
|
273
281
|
}
|
|
@@ -627,6 +635,18 @@ class DisclaimerUtil {
|
|
|
627
635
|
value: `${value.valInitial};${value.valFinal}`
|
|
628
636
|
};
|
|
629
637
|
}
|
|
638
|
+
makeDisclaimerFromDatepickerRange(property, value, hideClose = false) {
|
|
639
|
+
if (!value) {
|
|
640
|
+
return { label: '', property: '', value: '' };
|
|
641
|
+
}
|
|
642
|
+
let filterRangeDate = {
|
|
643
|
+
iniInitial: new Date(1900, 1, 1),
|
|
644
|
+
valInitial: this.ajustDate(value.start),
|
|
645
|
+
iniFinal: new Date(9999, 11, 31),
|
|
646
|
+
valFinal: this.ajustDate(value.end)
|
|
647
|
+
};
|
|
648
|
+
return this.makeDisclaimerFromRangeDate(property, filterRangeDate, hideClose, true);
|
|
649
|
+
}
|
|
630
650
|
makeDisclaimerFromRangeDate(property, value, hideClose = false, validateEqual = true) {
|
|
631
651
|
let valInitDate = this.ajustDate(value.valInitial);
|
|
632
652
|
let valFinalDate = this.ajustDate(value.valFinal);
|
|
@@ -800,6 +820,22 @@ class DisclaimerUtil {
|
|
|
800
820
|
}
|
|
801
821
|
return this.atzRangeNumFromQueryParam(value, rangeNum);
|
|
802
822
|
}
|
|
823
|
+
atzDatepickerRangeFromDisclamer(disclaimers, property, rangeDate) {
|
|
824
|
+
let filterRangeDate = {
|
|
825
|
+
iniInitial: null,
|
|
826
|
+
valInitial: rangeDate ? this.ajustDate(rangeDate.start) : null,
|
|
827
|
+
iniFinal: null,
|
|
828
|
+
valFinal: rangeDate ? this.ajustDate(rangeDate.end) : null
|
|
829
|
+
};
|
|
830
|
+
filterRangeDate = this.atzRangeDateFromDisclamer(disclaimers, property, filterRangeDate);
|
|
831
|
+
if (filterRangeDate.valInitial === null || filterRangeDate.valFinal === null) {
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
return {
|
|
835
|
+
start: filterRangeDate.valInitial,
|
|
836
|
+
end: filterRangeDate.valFinal
|
|
837
|
+
};
|
|
838
|
+
}
|
|
803
839
|
atzRangeDateFromDisclamer(disclaimers, property, rangeDate) {
|
|
804
840
|
let value = '';
|
|
805
841
|
if (disclaimers && disclaimers.length > 0) {
|
|
@@ -856,12 +892,18 @@ class DisclaimerUtil {
|
|
|
856
892
|
return rangeDate;
|
|
857
893
|
}
|
|
858
894
|
dateToQueryParam(date) {
|
|
895
|
+
if (date === null) {
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
859
898
|
const iDay = date.getDate();
|
|
860
899
|
const iMonth = date.getMonth() + 1;
|
|
861
900
|
const iYear = date.getFullYear();
|
|
862
901
|
return `${iYear}-${this.pad(iMonth)}-${this.pad(iDay)}`;
|
|
863
902
|
}
|
|
864
903
|
queryParamToDate(param) {
|
|
904
|
+
if (param === null) {
|
|
905
|
+
return null;
|
|
906
|
+
}
|
|
865
907
|
const iDay = +param.split('-')[2];
|
|
866
908
|
const iMonth = +param.split('-')[1];
|
|
867
909
|
const iYear = +param.split('-')[0];
|
|
@@ -871,6 +913,9 @@ class DisclaimerUtil {
|
|
|
871
913
|
return date instanceof Date && !isNaN(date.getTime());
|
|
872
914
|
}
|
|
873
915
|
ajustDate(param) {
|
|
916
|
+
if (param === null) {
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
874
919
|
if (param instanceof Date) {
|
|
875
920
|
return param;
|
|
876
921
|
}
|