@ifto/mantine-kit 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +475 -2
- package/dist/component/atom/AppMain/App.module.js +7 -0
- package/dist/component/atom/AppMain/App.module.js.map +1 -0
- package/dist/component/atom/AppMain/AppMain.d.ts +7 -0
- package/dist/component/atom/AppMain/AppMain.js +14 -0
- package/dist/component/atom/AppMain/AppMain.js.map +1 -0
- package/dist/component/atom/CancelEditButton/CancelEditButton.d.ts +6 -0
- package/dist/component/atom/CancelEditButton/CancelEditButton.js +24 -0
- package/dist/component/atom/CancelEditButton/CancelEditButton.js.map +1 -0
- package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.d.ts +13 -0
- package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.js +30 -0
- package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.js.map +1 -0
- package/dist/component/atom/DateField/DateField.d.ts +7 -0
- package/dist/component/atom/DateField/DateField.js +21 -0
- package/dist/component/atom/DateField/DateField.js.map +1 -0
- package/dist/component/atom/EditValueButton/EditValueButton.d.ts +6 -0
- package/dist/component/atom/EditValueButton/EditValueButton.js +24 -0
- package/dist/component/atom/EditValueButton/EditValueButton.js.map +1 -0
- package/dist/component/atom/ErrorAlert/ErrorAlert.d.ts +8 -0
- package/dist/component/atom/ErrorAlert/ErrorAlert.js +21 -0
- package/dist/component/atom/ErrorAlert/ErrorAlert.js.map +1 -0
- package/dist/component/atom/Surface/Surface.d.ts +20 -0
- package/dist/component/atom/Surface/Surface.js +15 -0
- package/dist/component/atom/Surface/Surface.js.map +1 -0
- package/dist/component/molecule/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/component/molecule/Breadcrumb/Breadcrumb.js +38 -0
- package/dist/component/molecule/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/component/molecule/ExportMenuButton/ExportMenuButton.d.ts +25 -0
- package/dist/component/molecule/ExportMenuButton/ExportMenuButton.js +49 -0
- package/dist/component/molecule/ExportMenuButton/ExportMenuButton.js.map +1 -0
- package/dist/component/molecule/PaperCard/PaperCard.d.ts +7 -0
- package/dist/component/molecule/PaperCard/PaperCard.js +17 -0
- package/dist/component/molecule/PaperCard/PaperCard.js.map +1 -0
- package/dist/component/molecule/PrintSection/PrintSection.d.ts +14 -0
- package/dist/component/molecule/PrintSection/PrintSection.js +29 -0
- package/dist/component/molecule/PrintSection/PrintSection.js.map +1 -0
- package/dist/component/molecule/SelectField/SelectField.d.ts +32 -0
- package/dist/component/molecule/SelectField/SelectField.js +38 -0
- package/dist/component/molecule/SelectField/SelectField.js.map +1 -0
- package/dist/component/molecule/StatsCard/Stats.module.js +15 -0
- package/dist/component/molecule/StatsCard/Stats.module.js.map +1 -0
- package/dist/component/molecule/StatsCard/StatsCard.d.ts +18 -0
- package/dist/component/molecule/StatsCard/StatsCard.js +60 -0
- package/dist/component/molecule/StatsCard/StatsCard.js.map +1 -0
- package/dist/component/organism/DataForm/DataForm.d.ts +26 -0
- package/dist/component/organism/DataForm/DataForm.js +83 -0
- package/dist/component/organism/DataForm/DataForm.js.map +1 -0
- package/dist/component/organism/DataTabList/DataTabList.d.ts +24 -0
- package/dist/component/organism/DataTabList/DataTabList.js +37 -0
- package/dist/component/organism/DataTabList/DataTabList.js.map +1 -0
- package/dist/component/organism/DataTabList/DataTabList.module.js +13 -0
- package/dist/component/organism/DataTabList/DataTabList.module.js.map +1 -0
- package/dist/component/organism/EChart/EChart.d.ts +47 -0
- package/dist/component/organism/EChart/EChart.js +37 -0
- package/dist/component/organism/EChart/EChart.js.map +1 -0
- package/dist/component/organism/EChart/buildEChartOption.d.ts +40 -0
- package/dist/component/organism/EChart/buildEChartOption.js +57 -0
- package/dist/component/organism/EChart/buildEChartOption.js.map +1 -0
- package/dist/component/organism/EChart/chart/BarChart.d.ts +22 -0
- package/dist/component/organism/EChart/chart/BarChart.js +34 -0
- package/dist/component/organism/EChart/chart/BarChart.js.map +1 -0
- package/dist/component/organism/EChart/chart/CartesianChart.d.ts +48 -0
- package/dist/component/organism/EChart/chart/CartesianChart.js +63 -0
- package/dist/component/organism/EChart/chart/CartesianChart.js.map +1 -0
- package/dist/component/organism/EChart/chart/ChartHeader.d.ts +36 -0
- package/dist/component/organism/EChart/chart/ChartHeader.js +105 -0
- package/dist/component/organism/EChart/chart/ChartHeader.js.map +1 -0
- package/dist/component/organism/EChart/chart/ChartSeries.d.ts +50 -0
- package/dist/component/organism/EChart/chart/ChartSeries.js +23 -0
- package/dist/component/organism/EChart/chart/ChartSeries.js.map +1 -0
- package/dist/component/organism/EChart/chart/ChartTexts.d.ts +12 -0
- package/dist/component/organism/EChart/chart/ChartTexts.js +21 -0
- package/dist/component/organism/EChart/chart/ChartTexts.js.map +1 -0
- package/dist/component/organism/EChart/chart/ChartType.d.ts +50 -0
- package/dist/component/organism/EChart/chart/ChartType.js +1 -0
- package/dist/component/organism/EChart/chart/ChartTypeId.d.ts +2 -0
- package/dist/component/organism/EChart/chart/ChartTypeId.js +1 -0
- package/dist/component/organism/EChart/chart/ChartTypes.d.ts +15 -0
- package/dist/component/organism/EChart/chart/ChartTypes.js +24 -0
- package/dist/component/organism/EChart/chart/ChartTypes.js.map +1 -0
- package/dist/component/organism/EChart/chart/DonutChart.d.ts +32 -0
- package/dist/component/organism/EChart/chart/DonutChart.js +111 -0
- package/dist/component/organism/EChart/chart/DonutChart.js.map +1 -0
- package/dist/component/organism/EChart/chart/LineChart.d.ts +11 -0
- package/dist/component/organism/EChart/chart/LineChart.js +20 -0
- package/dist/component/organism/EChart/chart/LineChart.js.map +1 -0
- package/dist/component/organism/EChart/chart/StackedBarChart.d.ts +15 -0
- package/dist/component/organism/EChart/chart/StackedBarChart.js +30 -0
- package/dist/component/organism/EChart/chart/StackedBarChart.js.map +1 -0
- package/dist/component/organism/EChart/chart/UnitPanels.d.ts +63 -0
- package/dist/component/organism/EChart/chart/UnitPanels.js +127 -0
- package/dist/component/organism/EChart/chart/UnitPanels.js.map +1 -0
- package/dist/component/organism/EChart/echartDefaults.d.ts +32 -0
- package/dist/component/organism/EChart/echartDefaults.js +47 -0
- package/dist/component/organism/EChart/echartDefaults.js.map +1 -0
- package/dist/component/organism/EChart/useEChart.d.ts +35 -0
- package/dist/component/organism/EChart/useEChart.js +112 -0
- package/dist/component/organism/EChart/useEChart.js.map +1 -0
- package/dist/component/organism/Navbar/NavItem.d.ts +16 -0
- package/dist/component/organism/Navbar/NavItem.js +1 -0
- package/dist/component/organism/Navbar/Navbar.d.ts +20 -0
- package/dist/component/organism/Navbar/Navbar.js +64 -0
- package/dist/component/organism/Navbar/Navbar.js.map +1 -0
- package/dist/component/organism/Navbar/Navbar.module.js +19 -0
- package/dist/component/organism/Navbar/Navbar.module.js.map +1 -0
- package/dist/component/organism/PageHeader/PageHeader.d.ts +14 -0
- package/dist/component/organism/PageHeader/PageHeader.js +55 -0
- package/dist/component/organism/PageHeader/PageHeader.js.map +1 -0
- package/dist/component/organism/StatsGrid/StatsGrid.d.ts +12 -0
- package/dist/component/organism/StatsGrid/StatsGrid.js +46 -0
- package/dist/component/organism/StatsGrid/StatsGrid.js.map +1 -0
- package/dist/component/organism/StatsGrid/StatsGrid.module.js +17 -0
- package/dist/component/organism/StatsGrid/StatsGrid.module.js.map +1 -0
- package/dist/component/organism/Table/RowActions.d.ts +23 -0
- package/dist/component/organism/Table/RowActions.js +121 -0
- package/dist/component/organism/Table/RowActions.js.map +1 -0
- package/dist/component/organism/Table/Table.d.ts +51 -0
- package/dist/component/organism/Table/Table.js +110 -0
- package/dist/component/organism/Table/Table.js.map +1 -0
- package/dist/component/organism/ViewTable/ColumnComparator.d.ts +11 -0
- package/dist/component/organism/ViewTable/ColumnComparator.js +25 -0
- package/dist/component/organism/ViewTable/ColumnComparator.js.map +1 -0
- package/dist/component/organism/ViewTable/ViewTable.d.ts +53 -0
- package/dist/component/organism/ViewTable/ViewTable.js +115 -0
- package/dist/component/organism/ViewTable/ViewTable.js.map +1 -0
- package/dist/component/organism/ViewTable/useRowKey.d.ts +8 -0
- package/dist/component/organism/ViewTable/useRowKey.js +24 -0
- package/dist/component/organism/ViewTable/useRowKey.js.map +1 -0
- package/dist/component/template/CreateFormPage/CreateFormPage.d.ts +19 -0
- package/dist/component/template/CreateFormPage/CreateFormPage.js +41 -0
- package/dist/component/template/CreateFormPage/CreateFormPage.js.map +1 -0
- package/dist/component/template/EditFormPage/EditFormPage.d.ts +19 -0
- package/dist/component/template/EditFormPage/EditFormPage.js +42 -0
- package/dist/component/template/EditFormPage/EditFormPage.js.map +1 -0
- package/dist/component/template/FormPage/FormPage.d.ts +25 -0
- package/dist/component/template/FormPage/FormPage.js +130 -0
- package/dist/component/template/FormPage/FormPage.js.map +1 -0
- package/dist/component/template/FormPage/FormType.d.ts +6 -0
- package/dist/component/template/FormPage/FormType.js +12 -0
- package/dist/component/template/FormPage/FormType.js.map +1 -0
- package/dist/component/template/Layout/Layout.d.ts +21 -0
- package/dist/component/template/Layout/Layout.js +121 -0
- package/dist/component/template/Layout/Layout.js.map +1 -0
- package/dist/component/template/Layout/Layout.module.js +19 -0
- package/dist/component/template/Layout/Layout.module.js.map +1 -0
- package/dist/component/template/ListPage/ListPage.d.ts +32 -0
- package/dist/component/template/ListPage/ListPage.js +47 -0
- package/dist/component/template/ListPage/ListPage.js.map +1 -0
- package/dist/component/template/PrintPage/PrintPage.d.ts +25 -0
- package/dist/component/template/PrintPage/PrintPage.js +115 -0
- package/dist/component/template/PrintPage/PrintPage.js.map +1 -0
- package/dist/component/template/ViewPage/ViewPage.d.ts +11 -0
- package/dist/component/template/ViewPage/ViewPage.js +49 -0
- package/dist/component/template/ViewPage/ViewPage.js.map +1 -0
- package/dist/data/ListDataSource.d.ts +12 -0
- package/dist/data/ListDataSource.js +1 -0
- package/dist/data/SaveDataSource.d.ts +16 -0
- package/dist/data/SaveDataSource.js +1 -0
- package/dist/export/ExportCellText.d.ts +18 -0
- package/dist/export/ExportCellText.js +60 -0
- package/dist/export/ExportCellText.js.map +1 -0
- package/dist/export/ExportDocument.d.ts +127 -0
- package/dist/export/ExportDocument.js +59 -0
- package/dist/export/ExportDocument.js.map +1 -0
- package/dist/export/ExportDownload.d.ts +9 -0
- package/dist/export/ExportDownload.js +19 -0
- package/dist/export/ExportDownload.js.map +1 -0
- package/dist/export/ExportFileName.d.ts +11 -0
- package/dist/export/ExportFileName.js +24 -0
- package/dist/export/ExportFileName.js.map +1 -0
- package/dist/export/ExportFormat.d.ts +30 -0
- package/dist/export/ExportFormat.js +1 -0
- package/dist/export/ExportFormats.d.ts +12 -0
- package/dist/export/ExportFormats.js +16 -0
- package/dist/export/ExportFormats.js.map +1 -0
- package/dist/export/ExportTexts.d.ts +14 -0
- package/dist/export/ExportTexts.js +23 -0
- package/dist/export/ExportTexts.js.map +1 -0
- package/dist/export/csv/CsvFormat.d.ts +41 -0
- package/dist/export/csv/CsvFormat.js +91 -0
- package/dist/export/csv/CsvFormat.js.map +1 -0
- package/dist/export/xlsx/XlsxFormat.d.ts +35 -0
- package/dist/export/xlsx/XlsxFormat.js +66 -0
- package/dist/export/xlsx/XlsxFormat.js.map +1 -0
- package/dist/export/xlsx/XlsxNumberFormat.d.ts +8 -0
- package/dist/export/xlsx/XlsxNumberFormat.js +15 -0
- package/dist/export/xlsx/XlsxNumberFormat.js.map +1 -0
- package/dist/export/xlsx/XlsxSheetName.d.ts +12 -0
- package/dist/export/xlsx/XlsxSheetName.js +62 -0
- package/dist/export/xlsx/XlsxSheetName.js.map +1 -0
- package/dist/export/xlsx/XlsxSheetWriter.d.ts +67 -0
- package/dist/export/xlsx/XlsxSheetWriter.js +215 -0
- package/dist/export/xlsx/XlsxSheetWriter.js.map +1 -0
- package/dist/export/xlsx/XlsxStyle.d.ts +51 -0
- package/dist/export/xlsx/XlsxStyle.js +87 -0
- package/dist/export/xlsx/XlsxStyle.js.map +1 -0
- package/dist/hook/useIsMobile.d.ts +5 -0
- package/dist/hook/useIsMobile.js +16 -0
- package/dist/hook/useIsMobile.js.map +1 -0
- package/dist/hook/useKeyedService.d.ts +22 -0
- package/dist/hook/useKeyedService.js +38 -0
- package/dist/hook/useKeyedService.js.map +1 -0
- package/dist/hook/useLightColorSchemeOnPrint.d.ts +9 -0
- package/dist/hook/useLightColorSchemeOnPrint.js +36 -0
- package/dist/hook/useLightColorSchemeOnPrint.js.map +1 -0
- package/dist/hook/useService.d.ts +27 -0
- package/dist/hook/useService.js +23 -0
- package/dist/hook/useService.js.map +1 -0
- package/dist/http/ApiError.d.ts +13 -0
- package/dist/http/ApiError.js +22 -0
- package/dist/http/ApiError.js.map +1 -0
- package/dist/http/AxiosHttpClient.d.ts +21 -0
- package/dist/http/AxiosHttpClient.js +67 -0
- package/dist/http/AxiosHttpClient.js.map +1 -0
- package/dist/http/AxiosHttpClientConfig.d.ts +37 -0
- package/dist/http/AxiosHttpClientConfig.js +19 -0
- package/dist/http/AxiosHttpClientConfig.js.map +1 -0
- package/dist/i18n/KitLocale.d.ts +4 -0
- package/dist/i18n/KitLocale.js +7 -0
- package/dist/i18n/KitLocale.js.map +1 -0
- package/dist/i18n/KitMessages.d.ts +146 -0
- package/dist/i18n/KitMessages.js +1 -0
- package/dist/i18n/messages/enUS.d.ts +3 -0
- package/dist/i18n/messages/enUS.js +112 -0
- package/dist/i18n/messages/enUS.js.map +1 -0
- package/dist/i18n/messages/ptBR.d.ts +3 -0
- package/dist/i18n/messages/ptBR.js +97 -0
- package/dist/i18n/messages/ptBR.js.map +1 -0
- package/dist/i18n/resolveMessages.d.ts +13 -0
- package/dist/i18n/resolveMessages.js +29 -0
- package/dist/i18n/resolveMessages.js.map +1 -0
- package/dist/model/Identifiable.d.ts +7 -0
- package/dist/model/Identifiable.js +1 -0
- package/dist/provider/KitConfig.d.ts +26 -0
- package/dist/provider/KitConfig.js +1 -0
- package/dist/provider/KitContext.d.ts +9 -0
- package/dist/provider/KitContext.js +27 -0
- package/dist/provider/KitContext.js.map +1 -0
- package/dist/provider/KitProvider.d.ts +7 -0
- package/dist/provider/KitProvider.js +31 -0
- package/dist/provider/KitProvider.js.map +1 -0
- package/dist/provider/useKit.d.ts +15 -0
- package/dist/provider/useKit.js +28 -0
- package/dist/provider/useKit.js.map +1 -0
- package/dist/router/FormRouteSegments.d.ts +16 -0
- package/dist/router/FormRouteSegments.js +19 -0
- package/dist/router/FormRouteSegments.js.map +1 -0
- package/dist/router/RouterAdapter.d.ts +24 -0
- package/dist/router/RouterAdapter.js +1 -0
- package/dist/router/anchorRouter.d.ts +7 -0
- package/dist/router/anchorRouter.js +23 -0
- package/dist/router/anchorRouter.js.map +1 -0
- package/dist/styles/print.css +93 -0
- package/dist/styles.css +188 -0
- package/dist/util/ArrayUtil.d.ts +39 -0
- package/dist/util/ArrayUtil.js +48 -0
- package/dist/util/ArrayUtil.js.map +1 -0
- package/dist/util/ColorUtil.d.ts +7 -0
- package/dist/util/ColorUtil.js +16 -0
- package/dist/util/ColorUtil.js.map +1 -0
- package/dist/util/CompareUtil.d.ts +19 -0
- package/dist/util/CompareUtil.js +51 -0
- package/dist/util/CompareUtil.js.map +1 -0
- package/dist/util/DateUtil.d.ts +38 -0
- package/dist/util/DateUtil.js +55 -0
- package/dist/util/DateUtil.js.map +1 -0
- package/dist/util/DownloadUtil.d.ts +6 -0
- package/dist/util/DownloadUtil.js +25 -0
- package/dist/util/DownloadUtil.js.map +1 -0
- package/dist/util/EnumUtil.d.ts +19 -0
- package/dist/util/EnumUtil.js +32 -0
- package/dist/util/EnumUtil.js.map +1 -0
- package/dist/util/FormUtil.d.ts +8 -0
- package/dist/util/FormUtil.js +14 -0
- package/dist/util/FormUtil.js.map +1 -0
- package/dist/util/HtmlUtil.d.ts +8 -0
- package/dist/util/HtmlUtil.js +23 -0
- package/dist/util/HtmlUtil.js.map +1 -0
- package/dist/util/Notifications.d.ts +30 -0
- package/dist/util/Notifications.js +59 -0
- package/dist/util/Notifications.js.map +1 -0
- package/dist/util/NumberUtil.d.ts +19 -0
- package/dist/util/NumberUtil.js +33 -0
- package/dist/util/NumberUtil.js.map +1 -0
- package/dist/util/ObjectUtil.d.ts +22 -0
- package/dist/util/ObjectUtil.js +34 -0
- package/dist/util/ObjectUtil.js.map +1 -0
- package/dist/util/SearchParamsUtil.d.ts +23 -0
- package/dist/util/SearchParamsUtil.js +29 -0
- package/dist/util/SearchParamsUtil.js.map +1 -0
- package/dist/util/TransformData.d.ts +14 -0
- package/dist/util/TransformData.js +31 -0
- package/dist/util/TransformData.js.map +1 -0
- package/dist/util/ValidationUtil.d.ts +9 -0
- package/dist/util/ValidationUtil.js +16 -0
- package/dist/util/ValidationUtil.js.map +1 -0
- package/dist/util/parseActionsPageParams.d.ts +14 -0
- package/dist/util/parseActionsPageParams.js +29 -0
- package/dist/util/parseActionsPageParams.js.map +1 -0
- package/package.json +158 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Print rules of the whole app, mainly used by the reports (PrintPage): the user prints the page or saves it as PDF with
|
|
3
|
+
the browser itself.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
Named pages of the reports: the paper size, the margins and the page number in the margin (only Chrome/Edge 131+ show
|
|
8
|
+
the page margins) apply only to the PrintPage, which uses one of them according to the orientation. Outside the
|
|
9
|
+
reports, the user chooses the paper and the orientation in the print dialog. Both pages repeat the margins, since a
|
|
10
|
+
named page does not inherit from another one. The page number is language neutral ("3 / 10"), since CSS cannot read
|
|
11
|
+
the locale of the app. CSS cannot read the name of the system either: an app that wants the footer text (`footer` of
|
|
12
|
+
the export texts) in the margin adds a `@bottom-left` to the `report` and `report-landscape` pages in its own CSS.
|
|
13
|
+
*/
|
|
14
|
+
@page report {
|
|
15
|
+
size: A4;
|
|
16
|
+
margin: 15mm 12mm 18mm;
|
|
17
|
+
|
|
18
|
+
@bottom-right {
|
|
19
|
+
content: counter(page) ' / ' counter(pages);
|
|
20
|
+
font-size: 8pt;
|
|
21
|
+
color: #5f6b7a;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Wide tables (e.g. a year per column). */
|
|
26
|
+
@page report-landscape {
|
|
27
|
+
size: A4 landscape;
|
|
28
|
+
margin: 15mm 12mm 18mm;
|
|
29
|
+
|
|
30
|
+
@bottom-right {
|
|
31
|
+
content: counter(page) ' / ' counter(pages);
|
|
32
|
+
font-size: 8pt;
|
|
33
|
+
color: #5f6b7a;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-print-orientation='portrait'] {
|
|
38
|
+
page: report;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-print-orientation='landscape'] {
|
|
42
|
+
page: report-landscape;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media print {
|
|
46
|
+
/* The header and the menu of the app are not part of the printed document. */
|
|
47
|
+
.mantine-AppShell-header,
|
|
48
|
+
.mantine-AppShell-navbar,
|
|
49
|
+
[data-print-hidden] {
|
|
50
|
+
display: none !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.mantine-AppShell-main {
|
|
54
|
+
padding: 0 !important;
|
|
55
|
+
min-height: 0 !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Only in the reports, colors and backgrounds are printed as on screen (e.g. the table header), without the user
|
|
59
|
+
having to check "Background graphics". In the other pages, the choice of the user in the print dialog applies. */
|
|
60
|
+
[data-print-orientation] {
|
|
61
|
+
print-color-adjust: exact;
|
|
62
|
+
-webkit-print-color-adjust: exact;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Repeats the table header on every page and does not cut a row in half. */
|
|
66
|
+
thead {
|
|
67
|
+
display: table-header-group;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
tfoot {
|
|
71
|
+
display: table-footer-group;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
tr,
|
|
75
|
+
[data-print-block] {
|
|
76
|
+
break-inside: avoid;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-print-new-page] {
|
|
80
|
+
break-before: page;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-print-keep-with-next] {
|
|
84
|
+
break-after: avoid;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* A scroll container would make the browser cut the table, instead of splitting it across pages. */
|
|
88
|
+
.mantine-Table-scrollContainer,
|
|
89
|
+
.mantine-ScrollArea-root,
|
|
90
|
+
.mantine-ScrollArea-viewport {
|
|
91
|
+
overflow: visible !important;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
.mk-App-module-main-8515C {
|
|
2
|
+
min-height: 95vh;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
[data-mantine-color-scheme='light'] .mk-App-module-main-8515C {
|
|
6
|
+
background-color: var(--mantine-color-gray-0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[data-mantine-color-scheme='dark'] .mk-App-module-main-8515C {
|
|
10
|
+
background-color: var(--mantine-color-dark-6);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* On paper, the page is white and only as tall as its content (see styles/print.css). */
|
|
14
|
+
@media print {.mk-App-module-main-8515C {
|
|
15
|
+
min-height: 0;
|
|
16
|
+
background-color: #fff !important
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
.mk-Stats-module-value-EAntx {
|
|
20
|
+
font-size: calc(1.5rem * var(--mantine-scale));
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mk-Stats-module-diff-r3gSM {
|
|
26
|
+
line-height: 1;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-mantine-color-scheme='dark'] .mk-Stats-module-icon-YG6b9 {
|
|
32
|
+
color: var(--mantine-color-dark-3);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[data-mantine-color-scheme='light'] .mk-Stats-module-icon-YG6b9 {
|
|
36
|
+
color: var(--mantine-color-gray-4);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.mk-Stats-module-title-MzSDP {
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
text-transform: uppercase;
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
* Tabs as wide as their own text (without stretching to fill the row), up to a maximum width.
|
|
45
|
+
* A title longer than the limit wraps in more than one line inside the tab, instead of widening it.
|
|
46
|
+
*/
|
|
47
|
+
.mk-DataTabList-module-tab-15vyU {
|
|
48
|
+
max-width: 14rem;
|
|
49
|
+
min-height: 2.5rem;
|
|
50
|
+
white-space: normal;
|
|
51
|
+
line-height: 1.25;
|
|
52
|
+
|
|
53
|
+
/* Border on the inactive tabs, so they look clickable, and not like loose text of the page. */
|
|
54
|
+
border: 1px solid var(--mantine-color-default-border);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mk-DataTabList-module-tab-15vyU[data-active] {
|
|
58
|
+
border-color: var(--mantine-primary-color-filled);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Same size for any given icon, so all tabs have the same height. */
|
|
62
|
+
.mk-DataTabList-module-tabSection-WA0SY svg {
|
|
63
|
+
width: 1rem;
|
|
64
|
+
height: 1rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.mk-DataTabList-module-panel-R37nf {
|
|
68
|
+
padding-top: var(--mantine-spacing-xs);
|
|
69
|
+
}
|
|
70
|
+
.mk-Navbar-module-navbar-0W9zF {
|
|
71
|
+
padding: var(--mantine-spacing-md);
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
border-right: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-gray-3);
|
|
75
|
+
}
|
|
76
|
+
[data-mantine-color-scheme='dark'] .mk-Navbar-module-navbar-0W9zF {
|
|
77
|
+
border-right: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-dark-4);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.mk-Navbar-module-navbarMain-QxMWi {
|
|
81
|
+
flex: 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.mk-Navbar-module-header-q16r1 {
|
|
85
|
+
padding-bottom: var(--mantine-spacing-md);
|
|
86
|
+
margin-bottom: calc(var(--mantine-spacing-md) * 1.5);
|
|
87
|
+
border-bottom: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-gray-3);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[data-mantine-color-scheme='dark'] .mk-Navbar-module-header-q16r1 {
|
|
91
|
+
border-bottom: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-dark-4);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.mk-Navbar-module-footer-48Z0e {
|
|
95
|
+
padding-top: var(--mantine-spacing-md);
|
|
96
|
+
margin-top: var(--mantine-spacing-md);
|
|
97
|
+
border-top: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-gray-3);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[data-mantine-color-scheme='dark'] .mk-Navbar-module-footer-48Z0e {
|
|
101
|
+
border-top: calc(0.0625rem * var(--mantine-scale)) solid var(--mantine-color-dark-4);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.mk-Navbar-module-link-eQT-Z {
|
|
105
|
+
border-radius: var(--mantine-radius-md);
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.mk-Navbar-module-linkIcon-5b3By {
|
|
110
|
+
color: var(--mantine-color-gray-6);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[data-mantine-color-scheme='dark'] .mk-Navbar-module-linkIcon-5b3By {
|
|
114
|
+
color: var(--mantine-color-dark-2);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mk-Navbar-module-linkIcon-5b3By {
|
|
118
|
+
margin-right: var(--mantine-spacing-sm);
|
|
119
|
+
width: calc(1.5625rem * var(--mantine-scale));
|
|
120
|
+
height: calc(1.5625rem * var(--mantine-scale));
|
|
121
|
+
}
|
|
122
|
+
.mk-StatsGrid-module-root-zSIO5 {
|
|
123
|
+
padding: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.mk-StatsGrid-module-value-wk1kb {
|
|
127
|
+
font-size: calc(1.5rem * var(--mantine-scale));
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
line-height: 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.mk-StatsGrid-module-diff-AUfON {
|
|
133
|
+
line-height: 1;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-mantine-color-scheme='dark'] .mk-StatsGrid-module-icon-ERQtf {
|
|
139
|
+
color: var(--mantine-color-dark-3);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[data-mantine-color-scheme='light'] .mk-StatsGrid-module-icon-ERQtf {
|
|
143
|
+
color: var(--mantine-color-gray-4);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.mk-StatsGrid-module-title-yuu3f {
|
|
147
|
+
font-weight: 500;
|
|
148
|
+
text-transform: uppercase;
|
|
149
|
+
}
|
|
150
|
+
.mk-Layout-module-shrinkable-JUv2C {
|
|
151
|
+
min-width: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.mk-Layout-module-fixed-Z1ueS {
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.mk-Layout-module-icon-EDq-h {
|
|
159
|
+
width: 20px;
|
|
160
|
+
height: 20px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-mantine-color-scheme='dark'] .mk-Layout-module-dark-Zx9Wz {
|
|
164
|
+
display: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[data-mantine-color-scheme='light'] .mk-Layout-module-dark-Zx9Wz {
|
|
168
|
+
display: block;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[data-mantine-color-scheme='light'] .mk-Layout-module-light--F7XT {
|
|
172
|
+
display: none;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
[data-mantine-color-scheme='dark'] .mk-Layout-module-light--F7XT {
|
|
176
|
+
display: block;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Responsive spacing of the header groups: the `gap` prop of the Mantine Group accepts no values per breakpoint. */
|
|
180
|
+
.mk-Layout-module-headerGap-VrPBg {
|
|
181
|
+
gap: var(--mantine-spacing-xs);
|
|
182
|
+
}
|
|
183
|
+
@media (min-width: 48em) {
|
|
184
|
+
.mk-Layout-module-headerGap-VrPBg {
|
|
185
|
+
gap: var(--mantine-spacing-md)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of the given size, with the values from 0 to size - 1.
|
|
3
|
+
* @param size size of the array
|
|
4
|
+
*/
|
|
5
|
+
export declare function createSequentialArray(size: number): number[];
|
|
6
|
+
/**
|
|
7
|
+
* Creates an array of any size, filled with the given value.
|
|
8
|
+
* @param size size of the array
|
|
9
|
+
* @param fillValue value of every element
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFilledArray(size: number, fillValue?: number): number[];
|
|
12
|
+
/**
|
|
13
|
+
* Operation over two numbers that returns a new value from them.
|
|
14
|
+
* @param number1 a number
|
|
15
|
+
* @param number2 another number
|
|
16
|
+
* @return a new value computed from the two numbers
|
|
17
|
+
*/
|
|
18
|
+
export type NumbersMapFunction = (number1: number, number2: number) => number;
|
|
19
|
+
/**
|
|
20
|
+
* Applies an operation to the elements at the same position of two arrays, mapping each pair of values to a new value.
|
|
21
|
+
* @param array1 an array
|
|
22
|
+
* @param array2 another array
|
|
23
|
+
* @param operation operation applied to each pair of elements at the same position (see {@link NumbersMapFunction})
|
|
24
|
+
* @param defaultItemValue value used when one array has no element at a position of the other one (when the arrays
|
|
25
|
+
* have different sizes). A `NaN` (e.g. an empty year) is not replaced by the default: it propagates, so the
|
|
26
|
+
* result for that position is empty too.
|
|
27
|
+
* @return a new array with the result of the operation for each position
|
|
28
|
+
*/
|
|
29
|
+
export declare function arraysMap(array1: number[], array2: number[], operation: NumbersMapFunction, defaultItemValue?: number): number[];
|
|
30
|
+
/**
|
|
31
|
+
* Transposes a matrix, turning the rows into columns and vice versa.
|
|
32
|
+
* @param matrix matrix to transpose, where each row is an array of values
|
|
33
|
+
* @param defaultValForUndefinedCol value used when a row has no value for a column, which happens when the rows have
|
|
34
|
+
* different sizes. Without it, the missing column is `undefined`. The parameter has no default value on purpose:
|
|
35
|
+
* in JavaScript, passing `undefined` to a parameter with a default uses the default, so an `undefined`
|
|
36
|
+
* explicitly asked by the caller would become another value.
|
|
37
|
+
* @return the transposed matrix
|
|
38
|
+
*/
|
|
39
|
+
export declare function transposeMatrix(matrix: number[][], defaultValForUndefinedCol?: number): number[][];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/util/ArrayUtil.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates an array of the given size, with the values from 0 to size - 1.
|
|
5
|
+
* @param size size of the array
|
|
6
|
+
*/
|
|
7
|
+
function createSequentialArray(size) {
|
|
8
|
+
return Array.from({ length: size }, (_, i) => i);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates an array of any size, filled with the given value.
|
|
12
|
+
* @param size size of the array
|
|
13
|
+
* @param fillValue value of every element
|
|
14
|
+
*/
|
|
15
|
+
function createFilledArray(size, fillValue = 0) {
|
|
16
|
+
return Array(size).fill(fillValue);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Applies an operation to the elements at the same position of two arrays, mapping each pair of values to a new value.
|
|
20
|
+
* @param array1 an array
|
|
21
|
+
* @param array2 another array
|
|
22
|
+
* @param operation operation applied to each pair of elements at the same position (see {@link NumbersMapFunction})
|
|
23
|
+
* @param defaultItemValue value used when one array has no element at a position of the other one (when the arrays
|
|
24
|
+
* have different sizes). A `NaN` (e.g. an empty year) is not replaced by the default: it propagates, so the
|
|
25
|
+
* result for that position is empty too.
|
|
26
|
+
* @return a new array with the result of the operation for each position
|
|
27
|
+
*/
|
|
28
|
+
function arraysMap(array1, array2, operation, defaultItemValue = 0) {
|
|
29
|
+
if (array1.length === 0) return array2;
|
|
30
|
+
if (array2.length === 0) return array1;
|
|
31
|
+
return createSequentialArray(Math.max(array1.length, array2.length)).map((i) => operation(array1[i] ?? defaultItemValue, array2[i] ?? defaultItemValue));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Transposes a matrix, turning the rows into columns and vice versa.
|
|
35
|
+
* @param matrix matrix to transpose, where each row is an array of values
|
|
36
|
+
* @param defaultValForUndefinedCol value used when a row has no value for a column, which happens when the rows have
|
|
37
|
+
* different sizes. Without it, the missing column is `undefined`. The parameter has no default value on purpose:
|
|
38
|
+
* in JavaScript, passing `undefined` to a parameter with a default uses the default, so an `undefined`
|
|
39
|
+
* explicitly asked by the caller would become another value.
|
|
40
|
+
* @return the transposed matrix
|
|
41
|
+
*/
|
|
42
|
+
function transposeMatrix(matrix, defaultValForUndefinedCol) {
|
|
43
|
+
const reducer = (acc, curr) => curr > acc ? curr : acc;
|
|
44
|
+
return createSequentialArray(matrix.map((line) => line.length).reduce(reducer, 0)).map((col) => matrix.map((line) => line[col] ?? defaultValForUndefinedCol));
|
|
45
|
+
}
|
|
46
|
+
export { arraysMap, createFilledArray, createSequentialArray, transposeMatrix };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=ArrayUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayUtil.js","names":[],"sources":["../../src/util/ArrayUtil.ts"],"sourcesContent":["/**\n * Creates an array of the given size, with the values from 0 to size - 1.\n * @param size size of the array\n */\nexport function createSequentialArray(size: number): number[] {\n return Array.from({ length: size }, (_, i) => i);\n}\n\n/**\n * Creates an array of any size, filled with the given value.\n * @param size size of the array\n * @param fillValue value of every element\n */\nexport function createFilledArray(size: number, fillValue: number = 0): number[] {\n return Array(size).fill(fillValue);\n}\n\n/**\n * Operation over two numbers that returns a new value from them.\n * @param number1 a number\n * @param number2 another number\n * @return a new value computed from the two numbers\n */\nexport type NumbersMapFunction = (number1: number, number2: number) => number;\n\n/**\n * Applies an operation to the elements at the same position of two arrays, mapping each pair of values to a new value.\n * @param array1 an array\n * @param array2 another array\n * @param operation operation applied to each pair of elements at the same position (see {@link NumbersMapFunction})\n * @param defaultItemValue value used when one array has no element at a position of the other one (when the arrays\n * have different sizes). A `NaN` (e.g. an empty year) is not replaced by the default: it propagates, so the\n * result for that position is empty too.\n * @return a new array with the result of the operation for each position\n */\nexport function arraysMap(\n array1: number[],\n array2: number[],\n operation: NumbersMapFunction,\n defaultItemValue: number = 0\n): number[] {\n if (array1.length === 0) return array2;\n\n if (array2.length === 0) return array1;\n\n const maxLen = Math.max(array1.length, array2.length);\n\n /* An array with just the indexes of the longest array, so that the result has the size of the longest one while\n keeping the order of the arguments (which may change the result of the operation). */\n const indexesArray = createSequentialArray(maxLen);\n return indexesArray.map(i => operation(array1[i] ?? defaultItemValue, array2[i] ?? defaultItemValue));\n}\n\n/**\n * Transposes a matrix, turning the rows into columns and vice versa.\n * @param matrix matrix to transpose, where each row is an array of values\n * @param defaultValForUndefinedCol value used when a row has no value for a column, which happens when the rows have\n * different sizes. Without it, the missing column is `undefined`. The parameter has no default value on purpose:\n * in JavaScript, passing `undefined` to a parameter with a default uses the default, so an `undefined`\n * explicitly asked by the caller would become another value.\n * @return the transposed matrix\n */\nexport function transposeMatrix(matrix: number[][], defaultValForUndefinedCol?: number): number[][] {\n const reducer = (acc: number, curr: number) => (curr > acc ? curr : acc);\n\n // Length of the longest row of the matrix\n const maxCols = matrix.map(line => line.length).reduce(reducer, 0);\n const colIndexes = createSequentialArray(maxCols);\n // `??`, not `||`: a 0 (a real value) and a NaN (an empty year) are kept, and only a missing column uses the default.\n return colIndexes.map(col => matrix.map(line => line[col] ?? defaultValForUndefinedCol));\n}\n"],"mappings":";;;;;;AAIA,SAAgB,sBAAsB,MAAwB;CAC1D,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,CAAC;AACnD;;;;;;AAOA,SAAgB,kBAAkB,MAAc,YAAoB,GAAa;CAC7E,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,SAAS;AACrC;;;;;;;;;;;AAoBA,SAAgB,UACZ,QACA,QACA,WACA,mBAA2B,GACnB;CACR,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,IAAI,OAAO,WAAW,GAAG,OAAO;CAOhC,OADqB,sBAJN,KAAK,IAAI,OAAO,QAAQ,OAAO,MAIH,CACpC,CAAA,CAAa,KAAI,MAAK,UAAU,OAAO,MAAM,kBAAkB,OAAO,MAAM,gBAAgB,CAAC;AACxG;;;;;;;;;;AAWA,SAAgB,gBAAgB,QAAoB,2BAAgD;CAChG,MAAM,WAAW,KAAa,SAAkB,OAAO,MAAM,OAAO;CAMpE,OAFmB,sBADH,OAAO,KAAI,SAAQ,KAAK,MAAM,CAAC,CAAC,OAAO,SAAS,CACvB,CAElC,CAAA,CAAW,KAAI,QAAO,OAAO,KAAI,SAAQ,KAAK,QAAQ,yBAAyB,CAAC;AAC3F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changes the shade of a hexadecimal color in the `#RRGGBB` format.
|
|
3
|
+
* @param hexColor hexadecimal color
|
|
4
|
+
* @param scale value added to (or, if negative, subtracted from) the color
|
|
5
|
+
* @return the hexadecimal color in a different shade, according to the scale
|
|
6
|
+
*/
|
|
7
|
+
export declare function changeColorShade(hexColor: string, scale: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/util/ColorUtil.ts
|
|
3
|
+
/**
|
|
4
|
+
* Changes the shade of a hexadecimal color in the `#RRGGBB` format.
|
|
5
|
+
* @param hexColor hexadecimal color
|
|
6
|
+
* @param scale value added to (or, if negative, subtracted from) the color
|
|
7
|
+
* @return the hexadecimal color in a different shade, according to the scale
|
|
8
|
+
*/
|
|
9
|
+
function changeColorShade(hexColor, scale) {
|
|
10
|
+
if (!/^#[0-9A-Fa-f]{6}$/.test(hexColor)) throw new Error("Invalid hexadecimal color code");
|
|
11
|
+
const hexDigits = hexColor.substring(1);
|
|
12
|
+
return "#" + (parseInt(hexDigits, 16) + scale).toString(16);
|
|
13
|
+
}
|
|
14
|
+
export { changeColorShade };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=ColorUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorUtil.js","names":[],"sources":["../../src/util/ColorUtil.ts"],"sourcesContent":["/**\n * Changes the shade of a hexadecimal color in the `#RRGGBB` format.\n * @param hexColor hexadecimal color\n * @param scale value added to (or, if negative, subtracted from) the color\n * @return the hexadecimal color in a different shade, according to the scale\n */\nexport function changeColorShade(hexColor: string, scale: number): string {\n if (!/^#[0-9A-Fa-f]{6}$/.test(hexColor)) {\n throw new Error('Invalid hexadecimal color code');\n }\n\n // Hexadecimal code of the color, without the leading #\n const hexDigits = hexColor.substring(1);\n const gradedBgColorInt = parseInt(hexDigits, 16) + scale;\n return '#' + gradedBgColorInt.toString(16);\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,iBAAiB,UAAkB,OAAuB;CACtE,IAAI,CAAC,oBAAoB,KAAK,QAAQ,GAClC,MAAM,IAAI,MAAM,gCAAgC;CAIpD,MAAM,YAAY,SAAS,UAAU,CAAC;CAEtC,OAAO,OADkB,SAAS,WAAW,EAAE,IAAI,MAAA,CACrB,SAAS,EAAE;AAC7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comparison functions used to sort lists and tables according to a locale.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Compares two texts according to a locale, to be used in `Array.prototype.sort`.
|
|
6
|
+
* @param locale locale of the comparison; defaults to `en-US`
|
|
7
|
+
* @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent
|
|
8
|
+
*/
|
|
9
|
+
export declare function compareText(a: string, b: string, locale?: string): number;
|
|
10
|
+
/** Tells whether a value is absent (`null` or `undefined`). */
|
|
11
|
+
export declare const isAbsent: (value: unknown) => value is null | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Compares two values of any type in ascending order, to be used in `Array.prototype.sort`: numbers and dates by
|
|
14
|
+
* value, texts according to the locale and the other values by their text representation. Absent values
|
|
15
|
+
* (`null`/`undefined`) always come last.
|
|
16
|
+
* @param locale locale of the text comparison; defaults to `en-US`
|
|
17
|
+
* @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent
|
|
18
|
+
*/
|
|
19
|
+
export declare function compareValues(a: unknown, b: unknown, locale?: string): number;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DEFAULT_LOCALE } from "../i18n/KitLocale.js";
|
|
3
|
+
// src/util/CompareUtil.ts
|
|
4
|
+
/**
|
|
5
|
+
* Comparison functions used to sort lists and tables according to a locale.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Text collators already created, by locale. Creating an `Intl.Collator` is much more expensive than using it.
|
|
9
|
+
* Accented letters stay with the letter without accent and upper case letters with the lower case ones (e.g.
|
|
10
|
+
* "Émile" before "emma", which comes before "Frank"). Numbers inside the text are compared by value (`numeric`), so
|
|
11
|
+
* "District 2" comes before "District 10".
|
|
12
|
+
*/
|
|
13
|
+
var collators = /* @__PURE__ */ new Map();
|
|
14
|
+
/**
|
|
15
|
+
* Returns the text collator of a locale, created only the first time.
|
|
16
|
+
* @param locale locale of the comparison
|
|
17
|
+
*/
|
|
18
|
+
function collator(locale) {
|
|
19
|
+
let result = collators.get(locale);
|
|
20
|
+
if (!result) {
|
|
21
|
+
result = new Intl.Collator(locale, { numeric: true });
|
|
22
|
+
collators.set(locale, result);
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Compares two texts according to a locale, to be used in `Array.prototype.sort`.
|
|
28
|
+
* @param locale locale of the comparison; defaults to `en-US`
|
|
29
|
+
* @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent
|
|
30
|
+
*/
|
|
31
|
+
function compareText(a, b, locale = DEFAULT_LOCALE) {
|
|
32
|
+
return collator(locale).compare(a, b);
|
|
33
|
+
}
|
|
34
|
+
/** Tells whether a value is absent (`null` or `undefined`). */
|
|
35
|
+
var isAbsent = (value) => value === null || value === void 0;
|
|
36
|
+
/**
|
|
37
|
+
* Compares two values of any type in ascending order, to be used in `Array.prototype.sort`: numbers and dates by
|
|
38
|
+
* value, texts according to the locale and the other values by their text representation. Absent values
|
|
39
|
+
* (`null`/`undefined`) always come last.
|
|
40
|
+
* @param locale locale of the text comparison; defaults to `en-US`
|
|
41
|
+
* @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent
|
|
42
|
+
*/
|
|
43
|
+
function compareValues(a, b, locale = DEFAULT_LOCALE) {
|
|
44
|
+
if (isAbsent(a) || isAbsent(b)) return Number(isAbsent(a)) - Number(isAbsent(b));
|
|
45
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
46
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
47
|
+
return compareText(String(a), String(b), locale);
|
|
48
|
+
}
|
|
49
|
+
export { compareText, compareValues, isAbsent };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=CompareUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompareUtil.js","names":[],"sources":["../../src/util/CompareUtil.ts"],"sourcesContent":["/**\n * Comparison functions used to sort lists and tables according to a locale.\n */\n\nimport { DEFAULT_LOCALE } from '../i18n/KitLocale';\n\n/**\n * Text collators already created, by locale. Creating an `Intl.Collator` is much more expensive than using it.\n * Accented letters stay with the letter without accent and upper case letters with the lower case ones (e.g.\n * \"Émile\" before \"emma\", which comes before \"Frank\"). Numbers inside the text are compared by value (`numeric`), so\n * \"District 2\" comes before \"District 10\".\n */\nconst collators = new Map<string, Intl.Collator>();\n\n/**\n * Returns the text collator of a locale, created only the first time.\n * @param locale locale of the comparison\n */\nfunction collator(locale: string): Intl.Collator {\n let result = collators.get(locale);\n if (!result) {\n result = new Intl.Collator(locale, { numeric: true });\n collators.set(locale, result);\n }\n\n return result;\n}\n\n/**\n * Compares two texts according to a locale, to be used in `Array.prototype.sort`.\n * @param locale locale of the comparison; defaults to `en-US`\n * @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent\n */\nexport function compareText(a: string, b: string, locale: string = DEFAULT_LOCALE): number {\n return collator(locale).compare(a, b);\n}\n\n/** Tells whether a value is absent (`null` or `undefined`). */\nexport const isAbsent = (value: unknown): value is null | undefined => value === null || value === undefined;\n\n/**\n * Compares two values of any type in ascending order, to be used in `Array.prototype.sort`: numbers and dates by\n * value, texts according to the locale and the other values by their text representation. Absent values\n * (`null`/`undefined`) always come last.\n * @param locale locale of the text comparison; defaults to `en-US`\n * @return negative if `a` comes before `b`, positive if it comes after and 0 if they are equivalent\n */\nexport function compareValues(a: unknown, b: unknown, locale: string = DEFAULT_LOCALE): number {\n if (isAbsent(a) || isAbsent(b)) return Number(isAbsent(a)) - Number(isAbsent(b));\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n\n return compareText(String(a), String(b), locale);\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,4BAAY,IAAI,IAA2B;;;;;AAMjD,SAAS,SAAS,QAA+B;CAC7C,IAAI,SAAS,UAAU,IAAI,MAAM;CACjC,IAAI,CAAC,QAAQ;EACT,SAAS,IAAI,KAAK,SAAS,QAAQ,EAAE,SAAS,KAAK,CAAC;EACpD,UAAU,IAAI,QAAQ,MAAM;CAChC;CAEA,OAAO;AACX;;;;;;AAOA,SAAgB,YAAY,GAAW,GAAW,SAAiB,gBAAwB;CACvF,OAAO,SAAS,MAAM,CAAC,CAAC,QAAQ,GAAG,CAAC;AACxC;;AAGA,IAAa,YAAY,UAA8C,UAAU,QAAQ,UAAU,KAAA;;;;;;;;AASnG,SAAgB,cAAc,GAAY,GAAY,SAAiB,gBAAwB;CAC3F,IAAI,SAAS,CAAC,KAAK,SAAS,CAAC,GAAG,OAAO,OAAO,SAAS,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC,CAAC;CAC/E,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU,OAAO,IAAI;CAC/D,IAAI,aAAa,QAAQ,aAAa,MAAM,OAAO,EAAE,QAAQ,IAAI,EAAE,QAAQ;CAE3E,OAAO,YAAY,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,MAAM;AACnD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Value of a date field: a `Date`, a text in the given format, or nothing. */
|
|
2
|
+
export type DateFieldValue = Date | string | null | undefined;
|
|
3
|
+
export declare const BR_DATE_FORMAT = "DD/MM/YYYY";
|
|
4
|
+
export declare const ISO_DATE_FORMAT = "YYYY-MM-DD";
|
|
5
|
+
/**
|
|
6
|
+
* Minimum value for a date to be considered valid when Zod coerces it. It is later than the date created by
|
|
7
|
+
* `new Date(null)` (12/31/1969), which Zod's `coerce` produces when a date field is not filled and receives `null`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MIN_VALID_DATE: Date;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a date.
|
|
12
|
+
* @param date date to format
|
|
13
|
+
* @param format format, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}
|
|
14
|
+
* @return the formatted date, or `null` if there is no date
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatDate(date: Date | undefined | null, format?: string): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Formats a date in the ISO 8601 format.
|
|
19
|
+
* @param date date to format
|
|
20
|
+
* @see #ISO_DATE_FORMAT
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatDateToISO(date: Date | undefined | null): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Converts a date in the given format to a `Date` object.
|
|
25
|
+
* @param dateValue date to convert
|
|
26
|
+
* @param format format of the date, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}
|
|
27
|
+
* @return the date, or `null` if there is no date
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseDate(dateValue: DateFieldValue, format?: string): Date | null;
|
|
30
|
+
/** @return the current year and month in the `YYYY-MM` format */
|
|
31
|
+
export declare function getCurrentYearMonth(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether the end date is after the start date.
|
|
34
|
+
* @param startDate start of the interval
|
|
35
|
+
* @param endDate end of the interval; an absent or empty (before {@link MIN_VALID_DATE}) end date is valid
|
|
36
|
+
* @return `true` if the interval is valid
|
|
37
|
+
*/
|
|
38
|
+
export declare function validDateInterval(startDate: Date, endDate: Date | undefined): boolean;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
4
|
+
// src/util/DateUtil.ts
|
|
5
|
+
dayjs.extend(customParseFormat);
|
|
6
|
+
var BR_DATE_FORMAT = "DD/MM/YYYY";
|
|
7
|
+
var ISO_DATE_FORMAT = "YYYY-MM-DD";
|
|
8
|
+
/**
|
|
9
|
+
* Minimum value for a date to be considered valid when Zod coerces it. It is later than the date created by
|
|
10
|
+
* `new Date(null)` (12/31/1969), which Zod's `coerce` produces when a date field is not filled and receives `null`.
|
|
11
|
+
*/
|
|
12
|
+
var MIN_VALID_DATE = /* @__PURE__ */ new Date("01/01/1970");
|
|
13
|
+
/**
|
|
14
|
+
* Formats a date.
|
|
15
|
+
* @param date date to format
|
|
16
|
+
* @param format format, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}
|
|
17
|
+
* @return the formatted date, or `null` if there is no date
|
|
18
|
+
*/
|
|
19
|
+
function formatDate(date, format = BR_DATE_FORMAT) {
|
|
20
|
+
return date ? dayjs(date).format(format) : null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Formats a date in the ISO 8601 format.
|
|
24
|
+
* @param date date to format
|
|
25
|
+
* @see #ISO_DATE_FORMAT
|
|
26
|
+
*/
|
|
27
|
+
function formatDateToISO(date) {
|
|
28
|
+
return date ? dayjs(date).format(ISO_DATE_FORMAT) : null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Converts a date in the given format to a `Date` object.
|
|
32
|
+
* @param dateValue date to convert
|
|
33
|
+
* @param format format of the date, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}
|
|
34
|
+
* @return the date, or `null` if there is no date
|
|
35
|
+
*/
|
|
36
|
+
function parseDate(dateValue, format = BR_DATE_FORMAT) {
|
|
37
|
+
return dateValue ? dayjs(dateValue, format).toDate() : null;
|
|
38
|
+
}
|
|
39
|
+
/** @return the current year and month in the `YYYY-MM` format */
|
|
40
|
+
function getCurrentYearMonth() {
|
|
41
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
42
|
+
return `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, "0")}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Checks whether the end date is after the start date.
|
|
46
|
+
* @param startDate start of the interval
|
|
47
|
+
* @param endDate end of the interval; an absent or empty (before {@link MIN_VALID_DATE}) end date is valid
|
|
48
|
+
* @return `true` if the interval is valid
|
|
49
|
+
*/
|
|
50
|
+
function validDateInterval(startDate, endDate) {
|
|
51
|
+
return !endDate || endDate <= MIN_VALID_DATE || endDate > startDate;
|
|
52
|
+
}
|
|
53
|
+
export { BR_DATE_FORMAT, ISO_DATE_FORMAT, MIN_VALID_DATE, formatDate, formatDateToISO, getCurrentYearMonth, parseDate, validDateInterval };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=DateUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateUtil.js","names":[],"sources":["../../src/util/DateUtil.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js';\n\n/* Without this plugin, Day.js ignores the format given to `dayjs(value, format)` and parses the text month first. */\ndayjs.extend(customParseFormat);\n\n/** Value of a date field: a `Date`, a text in the given format, or nothing. */\nexport type DateFieldValue = Date | string | null | undefined;\n\nexport const BR_DATE_FORMAT = 'DD/MM/YYYY';\nexport const ISO_DATE_FORMAT = 'YYYY-MM-DD';\n\n/**\n * Minimum value for a date to be considered valid when Zod coerces it. It is later than the date created by\n * `new Date(null)` (12/31/1969), which Zod's `coerce` produces when a date field is not filled and receives `null`.\n */\nexport const MIN_VALID_DATE = new Date('01/01/1970');\n\n/**\n * Formats a date.\n * @param date date to format\n * @param format format, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}\n * @return the formatted date, or `null` if there is no date\n */\nexport function formatDate(date: Date | undefined | null, format: string = BR_DATE_FORMAT): string | null {\n return date ? dayjs(date).format(format) : null;\n}\n\n/**\n * Formats a date in the ISO 8601 format.\n * @param date date to format\n * @see #ISO_DATE_FORMAT\n */\nexport function formatDateToISO(date: Date | undefined | null): string | null {\n return date ? dayjs(date).format(ISO_DATE_FORMAT) : null;\n}\n\n/**\n * Converts a date in the given format to a `Date` object.\n * @param dateValue date to convert\n * @param format format of the date, in Day.js tokens; defaults to {@link BR_DATE_FORMAT}\n * @return the date, or `null` if there is no date\n */\nexport function parseDate(dateValue: DateFieldValue, format: string = BR_DATE_FORMAT): Date | null {\n return dateValue ? dayjs(dateValue, format).toDate() : null;\n}\n\n/** @return the current year and month in the `YYYY-MM` format */\nexport function getCurrentYearMonth(): string {\n const currentDate = new Date();\n const year = currentDate.getFullYear();\n const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');\n return `${year}-${month}`;\n}\n\n/**\n * Checks whether the end date is after the start date.\n * @param startDate start of the interval\n * @param endDate end of the interval; an absent or empty (before {@link MIN_VALID_DATE}) end date is valid\n * @return `true` if the interval is valid\n */\nexport function validDateInterval(startDate: Date, endDate: Date | undefined): boolean {\n return !endDate || endDate <= MIN_VALID_DATE || endDate > startDate;\n}\n"],"mappings":";;;;AAIA,MAAM,OAAO,iBAAiB;AAK9B,IAAa,iBAAiB;AAC9B,IAAa,kBAAkB;;;;;AAM/B,IAAa,iCAAiB,IAAI,KAAK,YAAY;;;;;;;AAQnD,SAAgB,WAAW,MAA+B,SAAiB,gBAA+B;CACtG,OAAO,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,MAAM,IAAI;AAC/C;;;;;;AAOA,SAAgB,gBAAgB,MAA8C;CAC1E,OAAO,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,eAAe,IAAI;AACxD;;;;;;;AAQA,SAAgB,UAAU,WAA2B,SAAiB,gBAA6B;CAC/F,OAAO,YAAY,MAAM,WAAW,MAAM,CAAC,CAAC,OAAO,IAAI;AAC3D;;AAGA,SAAgB,sBAA8B;CAC1C,MAAM,8BAAc,IAAI,KAAK;CAG7B,OAAO,GAFM,YAAY,YAEf,EAAK,IADA,YAAY,SAAS,IAAI,EAAA,CAAG,SAAS,CAAC,CAAC,SAAS,GAAG,GAChD;AACtB;;;;;;;AAQA,SAAgB,kBAAkB,WAAiB,SAAoC;CACnF,OAAO,CAAC,WAAW,WAAW,kBAAkB,UAAU;AAC9D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the browser download a content generated in the page itself (e.g. an exported file), as a download link would.
|
|
3
|
+
* @param blob content of the file
|
|
4
|
+
* @param fileName name of the saved file
|
|
5
|
+
*/
|
|
6
|
+
export declare function downloadBlob(blob: Blob, fileName: string): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/util/DownloadUtil.ts
|
|
3
|
+
/**
|
|
4
|
+
* Time (ms) until the URL of the downloaded content is released. The download starts after the click, asynchronously:
|
|
5
|
+
* releasing the URL right after makes some browsers (e.g. Firefox and Safari) cancel the download or save an empty file.
|
|
6
|
+
*/
|
|
7
|
+
var REVOKE_DELAY = 1e4;
|
|
8
|
+
/**
|
|
9
|
+
* Makes the browser download a content generated in the page itself (e.g. an exported file), as a download link would.
|
|
10
|
+
* @param blob content of the file
|
|
11
|
+
* @param fileName name of the saved file
|
|
12
|
+
*/
|
|
13
|
+
function downloadBlob(blob, fileName) {
|
|
14
|
+
const url = URL.createObjectURL(blob);
|
|
15
|
+
const link = document.createElement("a");
|
|
16
|
+
link.href = url;
|
|
17
|
+
link.download = fileName;
|
|
18
|
+
document.body.appendChild(link);
|
|
19
|
+
link.click();
|
|
20
|
+
link.remove();
|
|
21
|
+
setTimeout(() => URL.revokeObjectURL(url), REVOKE_DELAY);
|
|
22
|
+
}
|
|
23
|
+
export { downloadBlob };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=DownloadUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadUtil.js","names":[],"sources":["../../src/util/DownloadUtil.ts"],"sourcesContent":["/**\n * Time (ms) until the URL of the downloaded content is released. The download starts after the click, asynchronously:\n * releasing the URL right after makes some browsers (e.g. Firefox and Safari) cancel the download or save an empty file.\n */\nconst REVOKE_DELAY = 10_000;\n\n/**\n * Makes the browser download a content generated in the page itself (e.g. an exported file), as a download link would.\n * @param blob content of the file\n * @param fileName name of the saved file\n */\nexport function downloadBlob(blob: Blob, fileName: string): void {\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n document.body.appendChild(link);\n link.click();\n link.remove();\n setTimeout(() => URL.revokeObjectURL(url), REVOKE_DELAY);\n}\n"],"mappings":";;;;;;AAIA,IAAM,eAAe;;;;;;AAOrB,SAAgB,aAAa,MAAY,UAAwB;CAC7D,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,OAAO,SAAS,cAAc,GAAG;CACvC,KAAK,OAAO;CACZ,KAAK,WAAW;CAChB,SAAS,KAAK,YAAY,IAAI;CAC9B,KAAK,MAAM;CACX,KAAK,OAAO;CACZ,iBAAiB,IAAI,gBAAgB,GAAG,GAAG,YAAY;AAC3D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the number values of an enum. Values of other types are not returned.
|
|
3
|
+
* @param enumType enum to read the values from
|
|
4
|
+
*/
|
|
5
|
+
export declare function getEnumValues(enumType: object): number[];
|
|
6
|
+
/**
|
|
7
|
+
* Returns the keys of an enum.
|
|
8
|
+
* @param enumType enum to read the keys from
|
|
9
|
+
* @template KeyType type of the returned keys. The keys are strings by default. To use them to read the enum values
|
|
10
|
+
* as an array (`MyEnum[key]`), use `keyof typeof MyEnum`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEnumKeys<KeyType = string>(enumType: object): KeyType[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns a `Map` whose keys are the values of the enum items and whose values are the keys of these items.
|
|
15
|
+
* @param enumType enum to read the entries from
|
|
16
|
+
* @template KeyType type of the returned keys. The keys are strings by default. To use them to read the enum values
|
|
17
|
+
* as an array (`MyEnum[key]`), use `keyof typeof MyEnum`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getEnumEntries<KeyType = string>(enumType: object): Map<number, KeyType>;
|