@ifto/mantine-kit 0.0.0-stage → 0.1.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 +471 -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 +108 -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 +123 -0
- package/dist/component/organism/ViewTable/ViewTable.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 +12 -0
- package/dist/hook/useService.js +29 -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 +37 -0
- package/dist/util/DateUtil.js +53 -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 +149 -5
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
// src/i18n/messages/ptBR.ts
|
|
4
|
+
/** Brazilian Portuguese texts. */
|
|
5
|
+
var ptBR = {
|
|
6
|
+
common: {
|
|
7
|
+
back: "Voltar",
|
|
8
|
+
save: "Salvar",
|
|
9
|
+
cancel: "Cancelar",
|
|
10
|
+
confirm: "Confirmar",
|
|
11
|
+
add: "Adicionar",
|
|
12
|
+
home: "Início",
|
|
13
|
+
success: "Sucesso",
|
|
14
|
+
warning: "Atenção",
|
|
15
|
+
error: "Erro",
|
|
16
|
+
loadError: "Erro ao carregar dados",
|
|
17
|
+
dateFormat: "DD/MM/YYYY"
|
|
18
|
+
},
|
|
19
|
+
form: {
|
|
20
|
+
action: {
|
|
21
|
+
create: "Criar",
|
|
22
|
+
edit: "Atualizar",
|
|
23
|
+
view: "Visualizar",
|
|
24
|
+
custom: "Personalizar"
|
|
25
|
+
},
|
|
26
|
+
saveSuccess: (action) => `Sucesso ao ${action.toLowerCase()} cadastro!`,
|
|
27
|
+
saveError: (action) => `Erro ao ${action.toLowerCase()} cadastro`,
|
|
28
|
+
createSuccess: "Registro cadastrado com sucesso",
|
|
29
|
+
createError: "Houve um erro ao realizar o cadastro!",
|
|
30
|
+
updateSuccess: "Cadastro atualizado com sucesso",
|
|
31
|
+
updateError: "Houve um erro ao atualizar o cadastro",
|
|
32
|
+
confirmTitle: "Confirme sua ação"
|
|
33
|
+
},
|
|
34
|
+
table: {
|
|
35
|
+
actions: "Ações",
|
|
36
|
+
view: "Visualizar",
|
|
37
|
+
edit: "Editar",
|
|
38
|
+
delete: "Deletar",
|
|
39
|
+
deleteConfirm: "Você está prestes a excluir este cadastro. Tem certeza de que deseja continuar?",
|
|
40
|
+
deleteSuccess: "Cadastro excluído com sucesso!",
|
|
41
|
+
noRecords: "Não há registros disponíveis para exibição.",
|
|
42
|
+
recordsPerPage: "Registros por página",
|
|
43
|
+
pagination: ({ from, to, totalRecords }) => `Exibindo ${from} a ${to} de ${totalRecords} registros`,
|
|
44
|
+
listTitle: (pluralName) => `Lista de ${pluralName}`
|
|
45
|
+
},
|
|
46
|
+
rowEdit: {
|
|
47
|
+
edit: "Editar valores (Enter)",
|
|
48
|
+
confirm: "Confirmar edição (Enter)",
|
|
49
|
+
cancel: "Cancelar edição (Esc)"
|
|
50
|
+
},
|
|
51
|
+
select: {
|
|
52
|
+
placeholder: (label) => `Selecione o(a) ${label}`,
|
|
53
|
+
nothingFound: (label) => `${label} não encontrado(a)`
|
|
54
|
+
},
|
|
55
|
+
layout: {
|
|
56
|
+
userMenu: "Acessar opções do usuário",
|
|
57
|
+
userMenuTitle: "Opções do Usuário",
|
|
58
|
+
enableDarkTheme: "Ativar tema escuro",
|
|
59
|
+
enableLightTheme: "Ativar tema claro",
|
|
60
|
+
collapseNavigation: "Recolher menu de navegação",
|
|
61
|
+
expandNavigation: "Expandir menu de navegação"
|
|
62
|
+
},
|
|
63
|
+
print: {
|
|
64
|
+
pdfTipTitle: "Para salvar em PDF",
|
|
65
|
+
pdfTip: "Na janela de impressão, escolha \"Salvar como PDF\" como destino e desmarque \"Cabeçalhos e rodapés\", para o PDF ter só os do relatório.",
|
|
66
|
+
printButton: "Imprimir ou salvar como PDF"
|
|
67
|
+
},
|
|
68
|
+
stats: { comparedToLastMonth: "Comparado ao último mês" },
|
|
69
|
+
export: {
|
|
70
|
+
button: "Exportar",
|
|
71
|
+
failed: (formatLabel) => `Não foi possível exportar em ${formatLabel}.`,
|
|
72
|
+
generatedAt: (date) => `Gerado em ${dayjs(date).format("DD/MM/YYYY [às] HH:mm")}`,
|
|
73
|
+
footer: (systemName) => `Dados gerados pelo ${systemName}`,
|
|
74
|
+
excelPageNumber: "Página &P de &N",
|
|
75
|
+
invalidCell: "Erro",
|
|
76
|
+
defaultFileName: "dados",
|
|
77
|
+
defaultSheetName: (position) => `Aba ${position}`
|
|
78
|
+
},
|
|
79
|
+
chart: {
|
|
80
|
+
types: {
|
|
81
|
+
bar: "Colunas",
|
|
82
|
+
line: "Linha",
|
|
83
|
+
"stacked-bar": "Colunas empilhadas",
|
|
84
|
+
donut: "Rosca (um ano)"
|
|
85
|
+
},
|
|
86
|
+
saveAsImage: "Exportar imagem",
|
|
87
|
+
total: (formattedTotal) => `Total: ${formattedTotal}`
|
|
88
|
+
},
|
|
89
|
+
http: {
|
|
90
|
+
unknownError: "Erro desconhecido",
|
|
91
|
+
noResponse: "Nenhuma resposta recebida",
|
|
92
|
+
requestFailed: "Requisição falhou"
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
export { ptBR };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=ptBR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ptBR.js","names":[],"sources":["../../../src/i18n/messages/ptBR.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { KitMessages } from '../KitMessages';\n\n/** Brazilian Portuguese texts. */\nexport const ptBR: KitMessages = {\n common: {\n back: 'Voltar',\n save: 'Salvar',\n cancel: 'Cancelar',\n confirm: 'Confirmar',\n add: 'Adicionar',\n home: 'Início',\n success: 'Sucesso',\n warning: 'Atenção',\n error: 'Erro',\n loadError: 'Erro ao carregar dados',\n dateFormat: 'DD/MM/YYYY'\n },\n form: {\n action: { create: 'Criar', edit: 'Atualizar', view: 'Visualizar', custom: 'Personalizar' },\n saveSuccess: action => `Sucesso ao ${action.toLowerCase()} cadastro!`,\n saveError: action => `Erro ao ${action.toLowerCase()} cadastro`,\n createSuccess: 'Registro cadastrado com sucesso',\n createError: 'Houve um erro ao realizar o cadastro!',\n updateSuccess: 'Cadastro atualizado com sucesso',\n updateError: 'Houve um erro ao atualizar o cadastro',\n confirmTitle: 'Confirme sua ação'\n },\n table: {\n actions: 'Ações',\n view: 'Visualizar',\n edit: 'Editar',\n delete: 'Deletar',\n deleteConfirm: 'Você está prestes a excluir este cadastro. Tem certeza de que deseja continuar?',\n deleteSuccess: 'Cadastro excluído com sucesso!',\n noRecords: 'Não há registros disponíveis para exibição.',\n recordsPerPage: 'Registros por página',\n pagination: ({ from, to, totalRecords }) => `Exibindo ${from} a ${to} de ${totalRecords} registros`,\n listTitle: pluralName => `Lista de ${pluralName}`\n },\n rowEdit: {\n edit: 'Editar valores (Enter)',\n confirm: 'Confirmar edição (Enter)',\n cancel: 'Cancelar edição (Esc)'\n },\n select: {\n placeholder: label => `Selecione o(a) ${label}`,\n nothingFound: label => `${label} não encontrado(a)`\n },\n layout: {\n userMenu: 'Acessar opções do usuário',\n userMenuTitle: 'Opções do Usuário',\n enableDarkTheme: 'Ativar tema escuro',\n enableLightTheme: 'Ativar tema claro',\n collapseNavigation: 'Recolher menu de navegação',\n expandNavigation: 'Expandir menu de navegação'\n },\n print: {\n pdfTipTitle: 'Para salvar em PDF',\n pdfTip:\n 'Na janela de impressão, escolha \"Salvar como PDF\" como destino e desmarque \"Cabeçalhos e rodapés\", ' +\n 'para o PDF ter só os do relatório.',\n printButton: 'Imprimir ou salvar como PDF'\n },\n stats: {\n comparedToLastMonth: 'Comparado ao último mês'\n },\n export: {\n button: 'Exportar',\n failed: formatLabel => `Não foi possível exportar em ${formatLabel}.`,\n generatedAt: date => `Gerado em ${dayjs(date).format('DD/MM/YYYY [às] HH:mm')}`,\n footer: systemName => `Dados gerados pelo ${systemName}`,\n excelPageNumber: 'Página &P de &N',\n invalidCell: 'Erro',\n defaultFileName: 'dados',\n defaultSheetName: position => `Aba ${position}`\n },\n chart: {\n types: { bar: 'Colunas', line: 'Linha', 'stacked-bar': 'Colunas empilhadas', donut: 'Rosca (um ano)' },\n saveAsImage: 'Exportar imagem',\n total: formattedTotal => `Total: ${formattedTotal}`\n },\n http: {\n unknownError: 'Erro desconhecido',\n noResponse: 'Nenhuma resposta recebida',\n requestFailed: 'Requisição falhou'\n }\n};\n"],"mappings":";;;;AAKA,IAAa,OAAoB;CAC7B,QAAQ;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,SAAS;EACT,KAAK;EACL,MAAM;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACP,WAAW;EACX,YAAY;CAChB;CACA,MAAM;EACF,QAAQ;GAAE,QAAQ;GAAS,MAAM;GAAa,MAAM;GAAc,QAAQ;EAAe;EACzF,cAAa,WAAU,cAAc,OAAO,YAAY,EAAE;EAC1D,YAAW,WAAU,WAAW,OAAO,YAAY,EAAE;EACrD,eAAe;EACf,aAAa;EACb,eAAe;EACf,aAAa;EACb,cAAc;CAClB;CACA,OAAO;EACH,SAAS;EACT,MAAM;EACN,MAAM;EACN,QAAQ;EACR,eAAe;EACf,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,aAAa,EAAE,MAAM,IAAI,mBAAmB,YAAY,KAAK,KAAK,GAAG,MAAM,aAAa;EACxF,YAAW,eAAc,YAAY;CACzC;CACA,SAAS;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACZ;CACA,QAAQ;EACJ,cAAa,UAAS,kBAAkB;EACxC,eAAc,UAAS,GAAG,MAAM;CACpC;CACA,QAAQ;EACJ,UAAU;EACV,eAAe;EACf,iBAAiB;EACjB,kBAAkB;EAClB,oBAAoB;EACpB,kBAAkB;CACtB;CACA,OAAO;EACH,aAAa;EACb,QACI;EAEJ,aAAa;CACjB;CACA,OAAO,EACH,qBAAqB,0BACzB;CACA,QAAQ;EACJ,QAAQ;EACR,SAAQ,gBAAe,gCAAgC,YAAY;EACnE,cAAa,SAAQ,aAAa,MAAM,IAAI,CAAC,CAAC,OAAO,uBAAuB;EAC5E,SAAQ,eAAc,sBAAsB;EAC5C,iBAAiB;EACjB,aAAa;EACb,iBAAiB;EACjB,mBAAkB,aAAY,OAAO;CACzC;CACA,OAAO;EACH,OAAO;GAAE,KAAK;GAAW,MAAM;GAAS,eAAe;GAAsB,OAAO;EAAiB;EACrG,aAAa;EACb,QAAO,mBAAkB,UAAU;CACvC;CACA,MAAM;EACF,cAAc;EACd,YAAY;EACZ,eAAe;CACnB;AACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KitLocale } from './KitLocale';
|
|
2
|
+
import { KitMessages, KitMessagesOverride } from './KitMessages';
|
|
3
|
+
/** Built-in message catalog of each locale. */
|
|
4
|
+
export declare const KIT_MESSAGES: Readonly<Record<KitLocale, KitMessages>>;
|
|
5
|
+
/** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */
|
|
6
|
+
export declare const DEFAULT_MESSAGES: KitMessages;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the texts of a locale, with the texts the app overrides.
|
|
9
|
+
* @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}
|
|
10
|
+
* @param override texts that replace the ones of the locale, by section
|
|
11
|
+
* @return the texts, with every section complete
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveMessages(locale?: KitLocale, override?: KitMessagesOverride): KitMessages;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DEFAULT_LOCALE } from "./KitLocale.js";
|
|
3
|
+
import { enUS } from "./messages/enUS.js";
|
|
4
|
+
import { ptBR } from "./messages/ptBR.js";
|
|
5
|
+
// src/i18n/resolveMessages.ts
|
|
6
|
+
/** Built-in message catalog of each locale. */
|
|
7
|
+
var KIT_MESSAGES = {
|
|
8
|
+
"pt-BR": ptBR,
|
|
9
|
+
"en-US": enUS
|
|
10
|
+
};
|
|
11
|
+
/** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */
|
|
12
|
+
var DEFAULT_MESSAGES = KIT_MESSAGES[DEFAULT_LOCALE];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the texts of a locale, with the texts the app overrides.
|
|
15
|
+
* @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}
|
|
16
|
+
* @param override texts that replace the ones of the locale, by section
|
|
17
|
+
* @return the texts, with every section complete
|
|
18
|
+
*/
|
|
19
|
+
function resolveMessages(locale = DEFAULT_LOCALE, override = {}) {
|
|
20
|
+
const base = KIT_MESSAGES[locale];
|
|
21
|
+
const sections = Object.keys(base);
|
|
22
|
+
return Object.fromEntries(sections.map((section) => [section, {
|
|
23
|
+
...base[section],
|
|
24
|
+
...override[section]
|
|
25
|
+
}]));
|
|
26
|
+
}
|
|
27
|
+
export { DEFAULT_MESSAGES, KIT_MESSAGES, resolveMessages };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=resolveMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMessages.js","names":[],"sources":["../../src/i18n/resolveMessages.ts"],"sourcesContent":["import { DEFAULT_LOCALE, KitLocale } from './KitLocale';\nimport { KitMessages, KitMessagesOverride } from './KitMessages';\nimport { enUS } from './messages/enUS';\nimport { ptBR } from './messages/ptBR';\n\n/** Built-in message catalog of each locale. */\nexport const KIT_MESSAGES: Readonly<Record<KitLocale, KitMessages>> = { 'pt-BR': ptBR, 'en-US': enUS };\n\n/** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */\nexport const DEFAULT_MESSAGES: KitMessages = KIT_MESSAGES[DEFAULT_LOCALE];\n\n/**\n * Returns the texts of a locale, with the texts the app overrides.\n * @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}\n * @param override texts that replace the ones of the locale, by section\n * @return the texts, with every section complete\n */\nexport function resolveMessages(locale: KitLocale = DEFAULT_LOCALE, override: KitMessagesOverride = {}): KitMessages {\n const base = KIT_MESSAGES[locale];\n const sections = Object.keys(base) as (keyof KitMessages)[];\n\n return Object.fromEntries(\n sections.map(section => [section, { ...base[section], ...override[section] }])\n ) as KitMessages;\n}\n"],"mappings":";;;;;;AAMA,IAAa,eAAyD;CAAE,SAAS;CAAM,SAAS;AAAK;;AAGrG,IAAa,mBAAgC,aAAa;;;;;;;AAQ1D,SAAgB,gBAAgB,SAAoB,gBAAgB,WAAgC,CAAC,GAAgB;CACjH,MAAM,OAAO,aAAa;CAC1B,MAAM,WAAW,OAAO,KAAK,IAAI;CAEjC,OAAO,OAAO,YACV,SAAS,KAAI,YAAW,CAAC,SAAS;EAAE,GAAG,KAAK;EAAU,GAAG,SAAS;CAAS,CAAC,CAAC,CACjF;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { KitLocale } from '../i18n/KitLocale';
|
|
2
|
+
import { KitMessages, KitMessagesOverride } from '../i18n/KitMessages';
|
|
3
|
+
import { FormRouteSegments } from '../router/FormRouteSegments';
|
|
4
|
+
import { RouterAdapter } from '../router/RouterAdapter';
|
|
5
|
+
/** Options an app gives to the `KitProvider`. All of them are optional. */
|
|
6
|
+
export type KitOptions = {
|
|
7
|
+
/** Router of the app; without it, links reload the page (see `anchorRouter`). */
|
|
8
|
+
router?: RouterAdapter;
|
|
9
|
+
/** Name of the app, shown in the browser tab title by the page templates (e.g. "Regions - My System"). */
|
|
10
|
+
appName?: string;
|
|
11
|
+
/** Locale of the texts and of the number and date formats. Default: `en-US`. */
|
|
12
|
+
locale?: KitLocale;
|
|
13
|
+
/** Texts that replace the ones of the locale (e.g. translations from the i18n library of the app). */
|
|
14
|
+
messages?: KitMessagesOverride;
|
|
15
|
+
/** URL segments of the CRUD form pages (create, edit and view). */
|
|
16
|
+
formRouteSegments?: FormRouteSegments;
|
|
17
|
+
};
|
|
18
|
+
/** Configuration the components read from the `KitProvider`: the {@link KitOptions} with the defaults applied. */
|
|
19
|
+
export type KitConfig = {
|
|
20
|
+
router: RouterAdapter;
|
|
21
|
+
appName?: string;
|
|
22
|
+
locale: KitLocale;
|
|
23
|
+
/** Texts of the locale, with the ones the app overrides. */
|
|
24
|
+
messages: KitMessages;
|
|
25
|
+
formRouteSegments: FormRouteSegments;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KitConfig, KitOptions } from './KitConfig';
|
|
2
|
+
/**
|
|
3
|
+
* Applies the defaults to the options of an app.
|
|
4
|
+
* @param options options given to the `KitProvider`
|
|
5
|
+
* @return the complete configuration
|
|
6
|
+
*/
|
|
7
|
+
export declare function kitConfig(options?: KitOptions): KitConfig;
|
|
8
|
+
/** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */
|
|
9
|
+
export declare const KitContext: import("react").Context<KitConfig>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../i18n/KitLocale.js";
|
|
3
|
+
import { resolveMessages } from "../i18n/resolveMessages.js";
|
|
4
|
+
import { anchorRouter } from "../router/anchorRouter.js";
|
|
5
|
+
import { DEFAULT_FORM_ROUTE_SEGMENTS } from "../router/FormRouteSegments.js";
|
|
6
|
+
import { createContext } from "react";
|
|
7
|
+
// src/provider/KitContext.ts
|
|
8
|
+
/**
|
|
9
|
+
* Applies the defaults to the options of an app.
|
|
10
|
+
* @param options options given to the `KitProvider`
|
|
11
|
+
* @return the complete configuration
|
|
12
|
+
*/
|
|
13
|
+
function kitConfig(options = {}) {
|
|
14
|
+
const locale = options.locale ?? "en-US";
|
|
15
|
+
return {
|
|
16
|
+
router: options.router ?? anchorRouter,
|
|
17
|
+
appName: options.appName,
|
|
18
|
+
locale,
|
|
19
|
+
messages: resolveMessages(locale, options.messages),
|
|
20
|
+
formRouteSegments: options.formRouteSegments ?? DEFAULT_FORM_ROUTE_SEGMENTS
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */
|
|
24
|
+
var KitContext = createContext(kitConfig());
|
|
25
|
+
export { KitContext, kitConfig };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=KitContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KitContext.js","names":[],"sources":["../../src/provider/KitContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { DEFAULT_LOCALE } from '../i18n/KitLocale';\nimport { resolveMessages } from '../i18n/resolveMessages';\nimport { anchorRouter } from '../router/anchorRouter';\nimport { DEFAULT_FORM_ROUTE_SEGMENTS } from '../router/FormRouteSegments';\nimport { KitConfig, KitOptions } from './KitConfig';\n\n/**\n * Applies the defaults to the options of an app.\n * @param options options given to the `KitProvider`\n * @return the complete configuration\n */\nexport function kitConfig(options: KitOptions = {}): KitConfig {\n const locale = options.locale ?? DEFAULT_LOCALE;\n\n return {\n router: options.router ?? anchorRouter,\n appName: options.appName,\n locale,\n messages: resolveMessages(locale, options.messages),\n formRouteSegments: options.formRouteSegments ?? DEFAULT_FORM_ROUTE_SEGMENTS\n };\n}\n\n/** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */\nexport const KitContext = createContext<KitConfig>(kitConfig());\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,UAAU,UAAsB,CAAC,GAAc;CAC3D,MAAM,SAAS,QAAQ,UAAA;CAEvB,OAAO;EACH,QAAQ,QAAQ,UAAU;EAC1B,SAAS,QAAQ;EACjB;EACA,UAAU,gBAAgB,QAAQ,QAAQ,QAAQ;EAClD,mBAAmB,QAAQ,qBAAqB;CACpD;AACJ;;AAGA,IAAa,aAAa,cAAyB,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { KitOptions } from './KitConfig';
|
|
3
|
+
/**
|
|
4
|
+
* Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,
|
|
5
|
+
* inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).
|
|
6
|
+
*/
|
|
7
|
+
export declare function KitProvider({ children, router, appName, locale, messages, formRouteSegments }: PropsWithChildren<KitOptions>): ReactElement;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { KitContext, kitConfig } from "./KitContext.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/provider/KitProvider.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,
|
|
8
|
+
* inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).
|
|
9
|
+
*/
|
|
10
|
+
function KitProvider({ children, router, appName, locale, messages, formRouteSegments }) {
|
|
11
|
+
const config = useMemo(() => kitConfig({
|
|
12
|
+
router,
|
|
13
|
+
appName,
|
|
14
|
+
locale,
|
|
15
|
+
messages,
|
|
16
|
+
formRouteSegments
|
|
17
|
+
}), [
|
|
18
|
+
router,
|
|
19
|
+
appName,
|
|
20
|
+
locale,
|
|
21
|
+
messages,
|
|
22
|
+
formRouteSegments
|
|
23
|
+
]);
|
|
24
|
+
return /* @__PURE__ */ jsx(KitContext.Provider, {
|
|
25
|
+
value: config,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { KitProvider };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=KitProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KitProvider.js","names":[],"sources":["../../src/provider/KitProvider.tsx"],"sourcesContent":["import { PropsWithChildren, ReactElement, useMemo } from 'react';\n\nimport { KitOptions } from './KitConfig';\nimport { kitConfig, KitContext } from './KitContext';\n\n/**\n * Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,\n * inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).\n */\nexport function KitProvider({\n children,\n router,\n appName,\n locale,\n messages,\n formRouteSegments\n}: PropsWithChildren<KitOptions>): ReactElement {\n const config = useMemo(\n () => kitConfig({ router, appName, locale, messages, formRouteSegments }),\n [router, appName, locale, messages, formRouteSegments]\n );\n\n return <KitContext.Provider value={config}>{children}</KitContext.Provider>;\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,YAAY,EACxB,UACA,QACA,SACA,QACA,UACA,qBAC4C;CAC5C,MAAM,SAAS,cACL,UAAU;EAAE;EAAQ;EAAS;EAAQ;EAAU;CAAkB,CAAC,GACxE;EAAC;EAAQ;EAAS;EAAQ;EAAU;CAAiB,CACzD;CAEA,OAAO,oBAAC,WAAW,UAAZ;EAAqB,OAAO;EAAS;CAA8B,CAAA;AAC9E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KitMessages } from '../i18n/KitMessages';
|
|
2
|
+
import { RouterAdapter } from '../router/RouterAdapter';
|
|
3
|
+
import { KitConfig } from './KitConfig';
|
|
4
|
+
/** @return the configuration of the app, given to the `KitProvider` */
|
|
5
|
+
export declare function useKitConfig(): KitConfig;
|
|
6
|
+
/** @return the router of the app, given to the `KitProvider` */
|
|
7
|
+
export declare function useKitRouter(): RouterAdapter;
|
|
8
|
+
/** @return the texts of the locale chosen in the `KitProvider` */
|
|
9
|
+
export declare function useKitMessages(): KitMessages;
|
|
10
|
+
/**
|
|
11
|
+
* Builds the browser tab title of a page: the page title followed by the app name, if any.
|
|
12
|
+
* @param pageTitle title of the page
|
|
13
|
+
* @return the title, such as "Regions - My System"
|
|
14
|
+
*/
|
|
15
|
+
export declare function useDocumentTitle(pageTitle: string): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { KitContext } from "./KitContext.js";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
// src/provider/useKit.ts
|
|
5
|
+
/** @return the configuration of the app, given to the `KitProvider` */
|
|
6
|
+
function useKitConfig() {
|
|
7
|
+
return useContext(KitContext);
|
|
8
|
+
}
|
|
9
|
+
/** @return the router of the app, given to the `KitProvider` */
|
|
10
|
+
function useKitRouter() {
|
|
11
|
+
return useContext(KitContext).router;
|
|
12
|
+
}
|
|
13
|
+
/** @return the texts of the locale chosen in the `KitProvider` */
|
|
14
|
+
function useKitMessages() {
|
|
15
|
+
return useContext(KitContext).messages;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Builds the browser tab title of a page: the page title followed by the app name, if any.
|
|
19
|
+
* @param pageTitle title of the page
|
|
20
|
+
* @return the title, such as "Regions - My System"
|
|
21
|
+
*/
|
|
22
|
+
function useDocumentTitle(pageTitle) {
|
|
23
|
+
const { appName } = useKitConfig();
|
|
24
|
+
return appName ? `${pageTitle} - ${appName}` : pageTitle;
|
|
25
|
+
}
|
|
26
|
+
export { useDocumentTitle, useKitConfig, useKitMessages, useKitRouter };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=useKit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKit.js","names":[],"sources":["../../src/provider/useKit.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport { KitMessages } from '../i18n/KitMessages';\nimport { RouterAdapter } from '../router/RouterAdapter';\nimport { KitConfig } from './KitConfig';\nimport { KitContext } from './KitContext';\n\n/** @return the configuration of the app, given to the `KitProvider` */\nexport function useKitConfig(): KitConfig {\n return useContext(KitContext);\n}\n\n/** @return the router of the app, given to the `KitProvider` */\nexport function useKitRouter(): RouterAdapter {\n return useContext(KitContext).router;\n}\n\n/** @return the texts of the locale chosen in the `KitProvider` */\nexport function useKitMessages(): KitMessages {\n return useContext(KitContext).messages;\n}\n\n/**\n * Builds the browser tab title of a page: the page title followed by the app name, if any.\n * @param pageTitle title of the page\n * @return the title, such as \"Regions - My System\"\n */\nexport function useDocumentTitle(pageTitle: string): string {\n const { appName } = useKitConfig();\n\n return appName ? `${pageTitle} - ${appName}` : pageTitle;\n}\n"],"mappings":";;;;;AAQA,SAAgB,eAA0B;CACtC,OAAO,WAAW,UAAU;AAChC;;AAGA,SAAgB,eAA8B;CAC1C,OAAO,WAAW,UAAU,CAAC,CAAC;AAClC;;AAGA,SAAgB,iBAA8B;CAC1C,OAAO,WAAW,UAAU,CAAC,CAAC;AAClC;;;;;;AAOA,SAAgB,iBAAiB,WAA2B;CACxD,MAAM,EAAE,YAAY,aAAa;CAEjC,OAAO,UAAU,GAAG,UAAU,KAAK,YAAY;AACnD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL segments of the CRUD form pages, after the base path of a feature (e.g. `/region/edit/5`). They are not
|
|
3
|
+
* translated with the locale, since a URL should not change with the user's language: the app chooses them once, in
|
|
4
|
+
* the `formRouteSegments` option of the `KitProvider`, from the presets below or with its own words.
|
|
5
|
+
*/
|
|
6
|
+
export type FormRouteSegments = {
|
|
7
|
+
create: string;
|
|
8
|
+
edit: string;
|
|
9
|
+
view: string;
|
|
10
|
+
};
|
|
11
|
+
/** English segments: `create`, `edit/:id` and `view/:id`. */
|
|
12
|
+
export declare const ENGLISH_FORM_ROUTE_SEGMENTS: FormRouteSegments;
|
|
13
|
+
/** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */
|
|
14
|
+
export declare const PORTUGUESE_FORM_ROUTE_SEGMENTS: FormRouteSegments;
|
|
15
|
+
/** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */
|
|
16
|
+
export declare const DEFAULT_FORM_ROUTE_SEGMENTS: FormRouteSegments;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/router/FormRouteSegments.ts
|
|
3
|
+
/** English segments: `create`, `edit/:id` and `view/:id`. */
|
|
4
|
+
var ENGLISH_FORM_ROUTE_SEGMENTS = {
|
|
5
|
+
create: "create",
|
|
6
|
+
edit: "edit",
|
|
7
|
+
view: "view"
|
|
8
|
+
};
|
|
9
|
+
/** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */
|
|
10
|
+
var PORTUGUESE_FORM_ROUTE_SEGMENTS = {
|
|
11
|
+
create: "criar",
|
|
12
|
+
edit: "editar",
|
|
13
|
+
view: "visualizar"
|
|
14
|
+
};
|
|
15
|
+
/** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */
|
|
16
|
+
var DEFAULT_FORM_ROUTE_SEGMENTS = ENGLISH_FORM_ROUTE_SEGMENTS;
|
|
17
|
+
export { DEFAULT_FORM_ROUTE_SEGMENTS, ENGLISH_FORM_ROUTE_SEGMENTS, PORTUGUESE_FORM_ROUTE_SEGMENTS };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=FormRouteSegments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRouteSegments.js","names":[],"sources":["../../src/router/FormRouteSegments.ts"],"sourcesContent":["/**\n * URL segments of the CRUD form pages, after the base path of a feature (e.g. `/region/edit/5`). They are not\n * translated with the locale, since a URL should not change with the user's language: the app chooses them once, in\n * the `formRouteSegments` option of the `KitProvider`, from the presets below or with its own words.\n */\nexport type FormRouteSegments = {\n create: string;\n edit: string;\n view: string;\n};\n\n/** English segments: `create`, `edit/:id` and `view/:id`. */\nexport const ENGLISH_FORM_ROUTE_SEGMENTS: FormRouteSegments = { create: 'create', edit: 'edit', view: 'view' };\n\n/** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */\nexport const PORTUGUESE_FORM_ROUTE_SEGMENTS: FormRouteSegments = {\n create: 'criar',\n edit: 'editar',\n view: 'visualizar'\n};\n\n/** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */\nexport const DEFAULT_FORM_ROUTE_SEGMENTS: FormRouteSegments = ENGLISH_FORM_ROUTE_SEGMENTS;\n"],"mappings":";;;AAYA,IAAa,8BAAiD;CAAE,QAAQ;CAAU,MAAM;CAAQ,MAAM;AAAO;;AAG7G,IAAa,iCAAoD;CAC7D,QAAQ;CACR,MAAM;CACN,MAAM;AACV;;AAGA,IAAa,8BAAiD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CSSProperties, ForwardRefExoticComponent, MouseEventHandler, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
/** Props the library components pass to the link component of the router. */
|
|
3
|
+
export interface RouterLinkProps {
|
|
4
|
+
href: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Bridge between the library and the router of the app (Next.js, React Router or another one). The components import
|
|
12
|
+
* no router: they navigate and build links only through this contract, given to the `KitProvider`.
|
|
13
|
+
*/
|
|
14
|
+
export interface RouterAdapter {
|
|
15
|
+
/**
|
|
16
|
+
* Link component of the router. It receives the destination in `href` (the adapter converts it, e.g. to the `to`
|
|
17
|
+
* of React Router) and forwards the `ref` to the `<a>`, which Mantine uses to place tooltips.
|
|
18
|
+
*/
|
|
19
|
+
Link: ForwardRefExoticComponent<RouterLinkProps & RefAttributes<HTMLAnchorElement>>;
|
|
20
|
+
/** Hook that returns the path of the current page (e.g. `/region`), without the query string. */
|
|
21
|
+
usePathname: () => string;
|
|
22
|
+
/** Hook that returns the function that navigates to a URL. */
|
|
23
|
+
useNavigate: () => (url: string) => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RouterAdapter } from './RouterAdapter';
|
|
2
|
+
/**
|
|
3
|
+
* Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through
|
|
4
|
+
* `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,
|
|
5
|
+
* React Router) should give their own adapter.
|
|
6
|
+
*/
|
|
7
|
+
export declare const anchorRouter: RouterAdapter;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/router/anchorRouter.tsx
|
|
5
|
+
/** Plain HTML link: reloads the page when navigating. */
|
|
6
|
+
var AnchorLink = forwardRef((props, ref) => /* @__PURE__ */ jsx("a", {
|
|
7
|
+
ref,
|
|
8
|
+
...props
|
|
9
|
+
}));
|
|
10
|
+
AnchorLink.displayName = "AnchorLink";
|
|
11
|
+
/**
|
|
12
|
+
* Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through
|
|
13
|
+
* `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,
|
|
14
|
+
* React Router) should give their own adapter.
|
|
15
|
+
*/
|
|
16
|
+
var anchorRouter = {
|
|
17
|
+
Link: AnchorLink,
|
|
18
|
+
usePathname: () => typeof window === "undefined" ? "/" : window.location.pathname,
|
|
19
|
+
useNavigate: () => (url) => window.location.assign(url)
|
|
20
|
+
};
|
|
21
|
+
export { anchorRouter };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=anchorRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchorRouter.js","names":[],"sources":["../../src/router/anchorRouter.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { RouterAdapter, RouterLinkProps } from './RouterAdapter';\n\n/** Plain HTML link: reloads the page when navigating. */\nconst AnchorLink = forwardRef<HTMLAnchorElement, RouterLinkProps>((props, ref) => <a ref={ref} {...props} />);\nAnchorLink.displayName = 'AnchorLink';\n\n/**\n * Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through\n * `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,\n * React Router) should give their own adapter.\n */\nexport const anchorRouter: RouterAdapter = {\n Link: AnchorLink,\n usePathname: () => (typeof window === 'undefined' ? '/' : window.location.pathname),\n useNavigate: () => (url: string) => window.location.assign(url)\n};\n"],"mappings":";;;;;AAKA,IAAM,aAAa,YAAgD,OAAO,QAAQ,oBAAC,KAAD;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAAC;AAC5G,WAAW,cAAc;;;;;;AAOzB,IAAa,eAA8B;CACvC,MAAM;CACN,mBAAoB,OAAO,WAAW,cAAc,MAAM,OAAO,SAAS;CAC1E,oBAAoB,QAAgB,OAAO,SAAS,OAAO,GAAG;AAClE"}
|
|
@@ -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
|
+
}
|