mapa-library-ui 1.2.0 → 1.4.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/fesm2022/mapa-library-ui-src-lib-components-capability.mjs +24 -2
- package/fesm2022/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-chart.mjs +28 -6
- package/fesm2022/mapa-library-ui-src-lib-components-chart.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-datepicker-range.mjs +77 -13
- package/fesm2022/mapa-library-ui-src-lib-components-datepicker-range.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-datepicker.mjs +77 -13
- package/fesm2022/mapa-library-ui-src-lib-components-datepicker.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-dropdown-tree.mjs +27 -5
- package/fesm2022/mapa-library-ui-src-lib-components-dropdown-tree.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-dropdown.mjs +24 -2
- package/fesm2022/mapa-library-ui-src-lib-components-dropdown.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-filters.mjs +58 -7
- package/fesm2022/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-form.mjs +216 -29
- package/fesm2022/mapa-library-ui-src-lib-components-form.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-input.mjs +34 -6
- package/fesm2022/mapa-library-ui-src-lib-components-input.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-radio-button.mjs +29 -5
- package/fesm2022/mapa-library-ui-src-lib-components-radio-button.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-slide-toggle.mjs +29 -5
- package/fesm2022/mapa-library-ui-src-lib-components-slide-toggle.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-table.mjs +77 -13
- package/fesm2022/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
- package/fesm2022/mapa-library-ui-src-lib-components-textarea.mjs +27 -3
- package/fesm2022/mapa-library-ui-src-lib-components-textarea.mjs.map +1 -1
- package/fesm2022/mapa-library-ui.mjs +306 -87
- package/fesm2022/mapa-library-ui.mjs.map +1 -1
- package/index.d.ts +67 -10
- package/mapa-library-ui-1.4.0.tgz +0 -0
- package/package.json +2 -2
- package/src/lib/components/capability/index.d.ts +6 -2
- package/src/lib/components/dropdown/index.d.ts +6 -2
- package/src/lib/components/form/index.d.ts +23 -7
- package/src/lib/components/input/index.d.ts +6 -2
- package/src/lib/components/radio-button/index.d.ts +7 -3
- package/src/lib/components/slide-toggle/index.d.ts +7 -3
- package/src/lib/components/textarea/index.d.ts +6 -2
- package/mapa-library-ui-1.2.0.tgz +0 -0
|
@@ -22,7 +22,7 @@ import * as i3$1 from '@angular/router';
|
|
|
22
22
|
import { RouterModule } from '@angular/router';
|
|
23
23
|
import * as i1$1 from '@angular/platform-browser';
|
|
24
24
|
import * as i1$2 from '@angular/common/http';
|
|
25
|
-
import { getMapaUiTexts } from 'mapa-frontend-i18n';
|
|
25
|
+
import { getMapaUiTexts, getIntlLocale, getStoredAppLanguage } from 'mapa-frontend-i18n';
|
|
26
26
|
|
|
27
27
|
class BubblePaginationDirective {
|
|
28
28
|
constructor(matPag, elementRef, ren) {
|
|
@@ -493,6 +493,9 @@ const DAY_MONTH_YEAR_PATTERN = /^(\d{2})\/(\d{2})\/(\d{4})$/;
|
|
|
493
493
|
function isValidDate(date) {
|
|
494
494
|
return !Number.isNaN(date.getTime());
|
|
495
495
|
}
|
|
496
|
+
function buildUtcDate(date, dayOffset, hours, minutes, seconds, milliseconds) {
|
|
497
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + dayOffset, hours, minutes, seconds, milliseconds));
|
|
498
|
+
}
|
|
496
499
|
function formatDateAsDayMonthYear(date) {
|
|
497
500
|
const day = `${date.getDate()}`.padStart(2, "0");
|
|
498
501
|
const month = `${date.getMonth() + 1}`.padStart(2, "0");
|
|
@@ -514,18 +517,11 @@ function parseDateValue(value) {
|
|
|
514
517
|
if (!trimmedValue) {
|
|
515
518
|
return null;
|
|
516
519
|
}
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
const year = Number(yearValue);
|
|
523
|
-
const parsedDate = new Date(year, month - 1, day);
|
|
524
|
-
if (parsedDate.getFullYear() === year &&
|
|
525
|
-
parsedDate.getMonth() === month - 1 &&
|
|
526
|
-
parsedDate.getDate() === day) {
|
|
527
|
-
return parsedDate;
|
|
528
|
-
}
|
|
520
|
+
const brazilianDate = parseBrazilianDate(trimmedValue);
|
|
521
|
+
if (brazilianDate) {
|
|
522
|
+
return brazilianDate;
|
|
523
|
+
}
|
|
524
|
+
if (DAY_MONTH_YEAR_PATTERN.test(trimmedValue)) {
|
|
529
525
|
return null;
|
|
530
526
|
}
|
|
531
527
|
const parsedDate = new Date(trimmedValue);
|
|
@@ -534,6 +530,62 @@ function parseDateValue(value) {
|
|
|
534
530
|
function isDateValue(value) {
|
|
535
531
|
return parseDateValue(value) !== null;
|
|
536
532
|
}
|
|
533
|
+
function parseBrazilianDate(value) {
|
|
534
|
+
const match = DAY_MONTH_YEAR_PATTERN.exec(value.trim());
|
|
535
|
+
if (!match) {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
const [, dayValue, monthValue, yearValue] = match;
|
|
539
|
+
const day = Number(dayValue);
|
|
540
|
+
const month = Number(monthValue);
|
|
541
|
+
const year = Number(yearValue);
|
|
542
|
+
const parsedDate = new Date(year, month - 1, day);
|
|
543
|
+
if (parsedDate.getFullYear() !== year ||
|
|
544
|
+
parsedDate.getMonth() !== month - 1 ||
|
|
545
|
+
parsedDate.getDate() !== day) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
return parsedDate;
|
|
549
|
+
}
|
|
550
|
+
function normalizeDateInput(value) {
|
|
551
|
+
return parseDateValue(value);
|
|
552
|
+
}
|
|
553
|
+
function formatBrazilianDate(value) {
|
|
554
|
+
const date = normalizeDateInput(value);
|
|
555
|
+
return date ? formatDateAsDayMonthYear(date) : "";
|
|
556
|
+
}
|
|
557
|
+
function addDays(date, days) {
|
|
558
|
+
const nextDate = new Date(date);
|
|
559
|
+
nextDate.setDate(nextDate.getDate() + days);
|
|
560
|
+
return nextDate;
|
|
561
|
+
}
|
|
562
|
+
function formatLocaleDate(value, dateStyle = "short") {
|
|
563
|
+
const date = normalizeDateInput(value);
|
|
564
|
+
if (!date) {
|
|
565
|
+
return "";
|
|
566
|
+
}
|
|
567
|
+
return new Intl.DateTimeFormat(getIntlLocale(getStoredAppLanguage()), {
|
|
568
|
+
dateStyle,
|
|
569
|
+
}).format(date);
|
|
570
|
+
}
|
|
571
|
+
function formatLocaleDateTime(value, options = {}) {
|
|
572
|
+
const date = normalizeDateInput(value);
|
|
573
|
+
if (!date) {
|
|
574
|
+
return "";
|
|
575
|
+
}
|
|
576
|
+
const { dateStyle = "short", timeStyle = "short" } = options;
|
|
577
|
+
return new Intl.DateTimeFormat(getIntlLocale(getStoredAppLanguage()), {
|
|
578
|
+
dateStyle,
|
|
579
|
+
timeStyle,
|
|
580
|
+
}).format(date);
|
|
581
|
+
}
|
|
582
|
+
function getDefaultDateRange(days = 60) {
|
|
583
|
+
const today = new Date();
|
|
584
|
+
return {
|
|
585
|
+
startDate: formatBrazilianDate(addDays(today, -days)),
|
|
586
|
+
endDate: formatBrazilianDate(today),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
537
589
|
function getRelativeDateRange(daysBack) {
|
|
538
590
|
const endDate = new Date();
|
|
539
591
|
endDate.setHours(23, 59, 59, 999);
|
|
@@ -542,6 +594,18 @@ function getRelativeDateRange(daysBack) {
|
|
|
542
594
|
startDate.setDate(startDate.getDate() - daysBack);
|
|
543
595
|
return { startDate, endDate };
|
|
544
596
|
}
|
|
597
|
+
function toUtcRangeStartIso(value) {
|
|
598
|
+
const date = normalizeDateInput(value);
|
|
599
|
+
return date ? buildUtcDate(date, 0, 3, 0, 0, 0).toISOString() : undefined;
|
|
600
|
+
}
|
|
601
|
+
function toUtcRangeEndIso(value) {
|
|
602
|
+
const date = normalizeDateInput(value);
|
|
603
|
+
return date ? buildUtcDate(date, 1, 2, 59, 59, 999).toISOString() : undefined;
|
|
604
|
+
}
|
|
605
|
+
function toUtcDayExclusiveEndIso(value) {
|
|
606
|
+
const date = normalizeDateInput(value);
|
|
607
|
+
return date ? buildUtcDate(date, 1, 3, 0, 0, 0).toISOString() : undefined;
|
|
608
|
+
}
|
|
545
609
|
|
|
546
610
|
class MapaTableComponent {
|
|
547
611
|
constructor(cdr, i18n) {
|