@multiplatform.one/frappe-ui 7.23.1 → 7.24.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/dist/cjs/FrappeCalendar.cjs +1 -1
- package/dist/cjs/FrappeCalendar.native.js +1 -1
- package/dist/cjs/FrappeCalendar.native.js.map +1 -1
- package/dist/cjs/FrappeDashboard.cjs +1 -1
- package/dist/cjs/FrappeDashboard.native.js +1 -1
- package/dist/cjs/FrappeDashboard.native.js.map +1 -1
- package/dist/cjs/FrappeForm.cjs +8 -0
- package/dist/cjs/FrappeForm.native.js +9 -0
- package/dist/cjs/FrappeForm.native.js.map +1 -1
- package/dist/cjs/FrappeImageView.cjs +1 -1
- package/dist/cjs/FrappeImageView.native.js +1 -1
- package/dist/cjs/FrappeImageView.native.js.map +1 -1
- package/dist/cjs/FrappeInsights.cjs +380 -0
- package/dist/cjs/FrappeInsights.native.js +447 -0
- package/dist/cjs/FrappeInsights.native.js.map +1 -0
- package/dist/cjs/FrappeLikedBy.cjs +5 -2
- package/dist/cjs/FrappeLikedBy.native.js +5 -2
- package/dist/cjs/FrappeLikedBy.native.js.map +1 -1
- package/dist/cjs/FrappeListView.cjs +406 -39
- package/dist/cjs/FrappeListView.native.js +469 -42
- package/dist/cjs/FrappeListView.native.js.map +1 -1
- package/dist/cjs/FrappeNotConfigured.cjs +54 -0
- package/dist/cjs/FrappeNotConfigured.native.js +58 -0
- package/dist/cjs/FrappeNotConfigured.native.js.map +1 -0
- package/dist/cjs/FrappeRecordView.cjs +199 -0
- package/dist/cjs/FrappeRecordView.native.js +218 -0
- package/dist/cjs/FrappeRecordView.native.js.map +1 -0
- package/dist/cjs/FrappeReportBuilder.cjs +2 -2
- package/dist/cjs/FrappeReportBuilder.native.js +2 -2
- package/dist/cjs/FrappeReportBuilder.native.js.map +1 -1
- package/dist/cjs/FrappeReportView.cjs +1 -1
- package/dist/cjs/FrappeReportView.native.js +2 -2
- package/dist/cjs/FrappeReportView.native.js.map +1 -1
- package/dist/cjs/FrappeTreeView.cjs +1 -1
- package/dist/cjs/FrappeTreeView.native.js +1 -1
- package/dist/cjs/desk/awesomebar.cjs +1 -1
- package/dist/cjs/desk/awesomebar.native.js +3 -3
- package/dist/cjs/desk/awesomebar.native.js.map +1 -1
- package/dist/cjs/fields/CodeEditor/index.cjs +1 -1
- package/dist/cjs/fields/CodeEditor/index.native.js +1 -1
- package/dist/cjs/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/cjs/fields/Color/index.cjs +1 -0
- package/dist/cjs/fields/Color/index.native.js +1 -0
- package/dist/cjs/fields/Color/index.native.js.map +1 -1
- package/dist/cjs/fields/FileUpload.cjs +1 -1
- package/dist/cjs/fields/FileUpload.native.js +1 -1
- package/dist/cjs/fields/FileUpload.native.js.map +1 -1
- package/dist/cjs/fields/Heading/index.cjs +19 -12
- package/dist/cjs/fields/Heading/index.native.js +22 -13
- package/dist/cjs/fields/Heading/index.native.js.map +1 -1
- package/dist/cjs/fields/MarkdownEditor/index.cjs +2 -1
- package/dist/cjs/fields/MarkdownEditor/index.native.js +1 -1
- package/dist/cjs/fields/MarkdownEditor/index.native.js.map +1 -1
- package/dist/cjs/frappeNavigation.cjs +12 -2
- package/dist/cjs/frappeNavigation.native.js +13 -2
- package/dist/cjs/frappeNavigation.native.js.map +1 -1
- package/dist/cjs/index.cjs +34 -0
- package/dist/cjs/index.native.js +34 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/insights/InsightsFacetTags.cjs +147 -0
- package/dist/cjs/insights/InsightsFacetTags.native.js +165 -0
- package/dist/cjs/insights/InsightsFacetTags.native.js.map +1 -0
- package/dist/cjs/insights/InsightsKpiBand.cjs +124 -0
- package/dist/cjs/insights/InsightsKpiBand.native.js +133 -0
- package/dist/cjs/insights/InsightsKpiBand.native.js.map +1 -0
- package/dist/cjs/insights/InsightsLeaders.cjs +150 -0
- package/dist/cjs/insights/InsightsLeaders.native.js +178 -0
- package/dist/cjs/insights/InsightsLeaders.native.js.map +1 -0
- package/dist/cjs/insights/InsightsRecords.cjs +105 -0
- package/dist/cjs/insights/InsightsRecords.native.js +109 -0
- package/dist/cjs/insights/InsightsRecords.native.js.map +1 -0
- package/dist/cjs/insights/InsightsTable.cjs +157 -0
- package/dist/cjs/insights/InsightsTable.native.js +194 -0
- package/dist/cjs/insights/InsightsTable.native.js.map +1 -0
- package/dist/cjs/insights/insightsData.cjs +114 -0
- package/dist/cjs/insights/insightsData.native.js +220 -0
- package/dist/cjs/insights/insightsData.native.js.map +1 -0
- package/dist/cjs/insights/insightsRecord.cjs +35 -0
- package/dist/cjs/insights/insightsRecord.native.js +38 -0
- package/dist/cjs/insights/insightsRecord.native.js.map +1 -0
- package/dist/cjs/list/FacetBadge.cjs +62 -0
- package/dist/cjs/list/FacetBadge.native.js +66 -0
- package/dist/cjs/list/FacetBadge.native.js.map +1 -0
- package/dist/cjs/list/FacetRail.cjs +199 -0
- package/dist/cjs/list/FacetRail.native.js +223 -0
- package/dist/cjs/list/FacetRail.native.js.map +1 -0
- package/dist/cjs/list/ImageWell.cjs +111 -0
- package/dist/cjs/list/ImageWell.native.js +126 -0
- package/dist/cjs/list/ImageWell.native.js.map +1 -0
- package/dist/cjs/list/ListControls.cjs +226 -0
- package/dist/cjs/list/ListControls.native.js +252 -0
- package/dist/cjs/list/ListControls.native.js.map +1 -0
- package/dist/cjs/list/ListToastHost.cjs +54 -0
- package/dist/cjs/list/ListToastHost.native.js +59 -0
- package/dist/cjs/list/ListToastHost.native.js.map +1 -0
- package/dist/cjs/list/RangeFilter.cjs +122 -0
- package/dist/cjs/list/RangeFilter.native.js +135 -0
- package/dist/cjs/list/RangeFilter.native.js.map +1 -0
- package/dist/cjs/list/RecordCard.cjs +233 -0
- package/dist/cjs/list/RecordCard.native.js +173 -0
- package/dist/cjs/list/RecordCard.native.js.map +1 -0
- package/dist/cjs/list/ShufflePanel.cjs +112 -0
- package/dist/cjs/list/ShufflePanel.native.js +139 -0
- package/dist/cjs/list/ShufflePanel.native.js.map +1 -0
- package/dist/cjs/list/facetReading.cjs +71 -0
- package/dist/cjs/list/facetReading.native.js +163 -0
- package/dist/cjs/list/facetReading.native.js.map +1 -0
- package/dist/cjs/list/favorites.cjs +79 -0
- package/dist/cjs/list/favorites.native.js +91 -0
- package/dist/cjs/list/favorites.native.js.map +1 -0
- package/dist/cjs/list/listState.cjs +100 -0
- package/dist/cjs/list/listState.native.js +234 -0
- package/dist/cjs/list/listState.native.js.map +1 -0
- package/dist/cjs/list/recordLook.cjs +35 -0
- package/dist/cjs/list/recordLook.native.js +39 -0
- package/dist/cjs/list/recordLook.native.js.map +1 -0
- package/dist/cjs/list/useListControls.cjs +189 -0
- package/dist/cjs/list/useListControls.native.js +272 -0
- package/dist/cjs/list/useListControls.native.js.map +1 -0
- package/dist/cjs/record/RecordBars.cjs +200 -0
- package/dist/cjs/record/RecordBars.native.js +225 -0
- package/dist/cjs/record/RecordBars.native.js.map +1 -0
- package/dist/cjs/record/RecordGallery.cjs +67 -0
- package/dist/cjs/record/RecordGallery.native.js +75 -0
- package/dist/cjs/record/RecordGallery.native.js.map +1 -0
- package/dist/cjs/record/RecordHero.cjs +239 -0
- package/dist/cjs/record/RecordHero.native.js +250 -0
- package/dist/cjs/record/RecordHero.native.js.map +1 -0
- package/dist/cjs/record/RecordPage.cjs +330 -0
- package/dist/cjs/record/RecordPage.native.js +364 -0
- package/dist/cjs/record/RecordPage.native.js.map +1 -0
- package/dist/cjs/record/RecordPager.cjs +125 -0
- package/dist/cjs/record/RecordPager.native.js +130 -0
- package/dist/cjs/record/RecordPager.native.js.map +1 -0
- package/dist/cjs/record/RecordRows.cjs +126 -0
- package/dist/cjs/record/RecordRows.native.js +140 -0
- package/dist/cjs/record/RecordRows.native.js.map +1 -0
- package/dist/cjs/record/recordData.cjs +122 -0
- package/dist/cjs/record/recordData.native.js +189 -0
- package/dist/cjs/record/recordData.native.js.map +1 -0
- package/dist/cjs/record/recordSections.cjs +30 -0
- package/dist/cjs/record/recordSections.native.js +33 -0
- package/dist/cjs/record/recordSections.native.js.map +1 -0
- package/dist/cjs/useFrappeFacets.cjs +1 -1
- package/dist/cjs/useFrappeFacets.native.js +1 -1
- package/dist/cjs/useFrappeFacets.native.js.map +1 -1
- package/dist/esm/FrappeCalendar.mjs +1 -1
- package/dist/esm/FrappeCalendar.mjs.map +1 -1
- package/dist/esm/FrappeCalendar.native.js +1 -1
- package/dist/esm/FrappeCalendar.native.js.map +1 -1
- package/dist/esm/FrappeDashboard.mjs +1 -1
- package/dist/esm/FrappeDashboard.mjs.map +1 -1
- package/dist/esm/FrappeDashboard.native.js +1 -1
- package/dist/esm/FrappeDashboard.native.js.map +1 -1
- package/dist/esm/FrappeForm.mjs +8 -0
- package/dist/esm/FrappeForm.mjs.map +1 -1
- package/dist/esm/FrappeForm.native.js +9 -0
- package/dist/esm/FrappeForm.native.js.map +1 -1
- package/dist/esm/FrappeImageView.mjs +1 -1
- package/dist/esm/FrappeImageView.mjs.map +1 -1
- package/dist/esm/FrappeImageView.native.js +1 -1
- package/dist/esm/FrappeImageView.native.js.map +1 -1
- package/dist/esm/FrappeInsights.mjs +355 -0
- package/dist/esm/FrappeInsights.mjs.map +1 -0
- package/dist/esm/FrappeInsights.native.js +419 -0
- package/dist/esm/FrappeInsights.native.js.map +1 -0
- package/dist/esm/FrappeLikedBy.mjs +6 -3
- package/dist/esm/FrappeLikedBy.mjs.map +1 -1
- package/dist/esm/FrappeLikedBy.native.js +6 -3
- package/dist/esm/FrappeLikedBy.native.js.map +1 -1
- package/dist/esm/FrappeListView.mjs +410 -43
- package/dist/esm/FrappeListView.mjs.map +1 -1
- package/dist/esm/FrappeListView.native.js +473 -46
- package/dist/esm/FrappeListView.native.js.map +1 -1
- package/dist/esm/FrappeNotConfigured.mjs +29 -0
- package/dist/esm/FrappeNotConfigured.mjs.map +1 -0
- package/dist/esm/FrappeNotConfigured.native.js +30 -0
- package/dist/esm/FrappeNotConfigured.native.js.map +1 -0
- package/dist/esm/FrappeRecordView.mjs +174 -0
- package/dist/esm/FrappeRecordView.mjs.map +1 -0
- package/dist/esm/FrappeRecordView.native.js +190 -0
- package/dist/esm/FrappeRecordView.native.js.map +1 -0
- package/dist/esm/FrappeReportBuilder.mjs +2 -2
- package/dist/esm/FrappeReportBuilder.mjs.map +1 -1
- package/dist/esm/FrappeReportBuilder.native.js +2 -2
- package/dist/esm/FrappeReportBuilder.native.js.map +1 -1
- package/dist/esm/FrappeReportView.mjs +1 -1
- package/dist/esm/FrappeReportView.mjs.map +1 -1
- package/dist/esm/FrappeReportView.native.js +2 -2
- package/dist/esm/FrappeReportView.native.js.map +1 -1
- package/dist/esm/FrappeTreeView.mjs +1 -1
- package/dist/esm/FrappeTreeView.mjs.map +1 -1
- package/dist/esm/FrappeTreeView.native.js +1 -1
- package/dist/esm/desk/awesomebar.mjs +1 -1
- package/dist/esm/desk/awesomebar.mjs.map +1 -1
- package/dist/esm/desk/awesomebar.native.js +3 -3
- package/dist/esm/desk/awesomebar.native.js.map +1 -1
- package/dist/esm/fields/CodeEditor/index.mjs +2 -2
- package/dist/esm/fields/CodeEditor/index.mjs.map +1 -1
- package/dist/esm/fields/CodeEditor/index.native.js +2 -2
- package/dist/esm/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/esm/fields/Color/index.mjs +1 -0
- package/dist/esm/fields/Color/index.mjs.map +1 -1
- package/dist/esm/fields/Color/index.native.js +1 -0
- package/dist/esm/fields/Color/index.native.js.map +1 -1
- package/dist/esm/fields/FileUpload.mjs +2 -2
- package/dist/esm/fields/FileUpload.mjs.map +1 -1
- package/dist/esm/fields/FileUpload.native.js +2 -2
- package/dist/esm/fields/FileUpload.native.js.map +1 -1
- package/dist/esm/fields/Heading/index.mjs +21 -14
- package/dist/esm/fields/Heading/index.mjs.map +1 -1
- package/dist/esm/fields/Heading/index.native.js +24 -15
- package/dist/esm/fields/Heading/index.native.js.map +1 -1
- package/dist/esm/fields/MarkdownEditor/index.mjs +2 -1
- package/dist/esm/fields/MarkdownEditor/index.mjs.map +1 -1
- package/dist/esm/fields/MarkdownEditor/index.native.js +2 -2
- package/dist/esm/fields/MarkdownEditor/index.native.js.map +1 -1
- package/dist/esm/frappeNavigation.mjs +11 -2
- package/dist/esm/frappeNavigation.mjs.map +1 -1
- package/dist/esm/frappeNavigation.native.js +12 -2
- package/dist/esm/frappeNavigation.native.js.map +1 -1
- package/dist/esm/index.mjs +14 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +14 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/insights/InsightsFacetTags.mjs +122 -0
- package/dist/esm/insights/InsightsFacetTags.mjs.map +1 -0
- package/dist/esm/insights/InsightsFacetTags.native.js +137 -0
- package/dist/esm/insights/InsightsFacetTags.native.js.map +1 -0
- package/dist/esm/insights/InsightsKpiBand.mjs +99 -0
- package/dist/esm/insights/InsightsKpiBand.mjs.map +1 -0
- package/dist/esm/insights/InsightsKpiBand.native.js +105 -0
- package/dist/esm/insights/InsightsKpiBand.native.js.map +1 -0
- package/dist/esm/insights/InsightsLeaders.mjs +125 -0
- package/dist/esm/insights/InsightsLeaders.mjs.map +1 -0
- package/dist/esm/insights/InsightsLeaders.native.js +150 -0
- package/dist/esm/insights/InsightsLeaders.native.js.map +1 -0
- package/dist/esm/insights/InsightsRecords.mjs +80 -0
- package/dist/esm/insights/InsightsRecords.mjs.map +1 -0
- package/dist/esm/insights/InsightsRecords.native.js +81 -0
- package/dist/esm/insights/InsightsRecords.native.js.map +1 -0
- package/dist/esm/insights/InsightsTable.mjs +132 -0
- package/dist/esm/insights/InsightsTable.mjs.map +1 -0
- package/dist/esm/insights/InsightsTable.native.js +166 -0
- package/dist/esm/insights/InsightsTable.native.js.map +1 -0
- package/dist/esm/insights/insightsData.mjs +82 -0
- package/dist/esm/insights/insightsData.mjs.map +1 -0
- package/dist/esm/insights/insightsData.native.js +185 -0
- package/dist/esm/insights/insightsData.native.js.map +1 -0
- package/dist/esm/insights/insightsRecord.mjs +9 -0
- package/dist/esm/insights/insightsRecord.mjs.map +1 -0
- package/dist/esm/insights/insightsRecord.native.js +9 -0
- package/dist/esm/insights/insightsRecord.native.js.map +1 -0
- package/dist/esm/list/FacetBadge.mjs +37 -0
- package/dist/esm/list/FacetBadge.mjs.map +1 -0
- package/dist/esm/list/FacetBadge.native.js +38 -0
- package/dist/esm/list/FacetBadge.native.js.map +1 -0
- package/dist/esm/list/FacetRail.mjs +174 -0
- package/dist/esm/list/FacetRail.mjs.map +1 -0
- package/dist/esm/list/FacetRail.native.js +195 -0
- package/dist/esm/list/FacetRail.native.js.map +1 -0
- package/dist/esm/list/ImageWell.mjs +86 -0
- package/dist/esm/list/ImageWell.mjs.map +1 -0
- package/dist/esm/list/ImageWell.native.js +98 -0
- package/dist/esm/list/ImageWell.native.js.map +1 -0
- package/dist/esm/list/ListControls.mjs +201 -0
- package/dist/esm/list/ListControls.mjs.map +1 -0
- package/dist/esm/list/ListControls.native.js +224 -0
- package/dist/esm/list/ListControls.native.js.map +1 -0
- package/dist/esm/list/ListToastHost.mjs +18 -0
- package/dist/esm/list/ListToastHost.mjs.map +1 -0
- package/dist/esm/list/ListToastHost.native.js +20 -0
- package/dist/esm/list/ListToastHost.native.js.map +1 -0
- package/dist/esm/list/RangeFilter.mjs +85 -0
- package/dist/esm/list/RangeFilter.mjs.map +1 -0
- package/dist/esm/list/RangeFilter.native.js +95 -0
- package/dist/esm/list/RangeFilter.native.js.map +1 -0
- package/dist/esm/list/RecordCard.mjs +208 -0
- package/dist/esm/list/RecordCard.mjs.map +1 -0
- package/dist/esm/list/RecordCard.native.js +145 -0
- package/dist/esm/list/RecordCard.native.js.map +1 -0
- package/dist/esm/list/ShufflePanel.mjs +87 -0
- package/dist/esm/list/ShufflePanel.mjs.map +1 -0
- package/dist/esm/list/ShufflePanel.native.js +111 -0
- package/dist/esm/list/ShufflePanel.native.js.map +1 -0
- package/dist/esm/list/facetReading.mjs +45 -0
- package/dist/esm/list/facetReading.mjs.map +1 -0
- package/dist/esm/list/facetReading.native.js +134 -0
- package/dist/esm/list/facetReading.native.js.map +1 -0
- package/dist/esm/list/favorites.mjs +50 -0
- package/dist/esm/list/favorites.mjs.map +1 -0
- package/dist/esm/list/favorites.native.js +59 -0
- package/dist/esm/list/favorites.native.js.map +1 -0
- package/dist/esm/list/listState.mjs +71 -0
- package/dist/esm/list/listState.mjs.map +1 -0
- package/dist/esm/list/listState.native.js +202 -0
- package/dist/esm/list/listState.native.js.map +1 -0
- package/dist/esm/list/recordLook.mjs +10 -0
- package/dist/esm/list/recordLook.mjs.map +1 -0
- package/dist/esm/list/recordLook.native.js +11 -0
- package/dist/esm/list/recordLook.native.js.map +1 -0
- package/dist/esm/list/useListControls.mjs +164 -0
- package/dist/esm/list/useListControls.mjs.map +1 -0
- package/dist/esm/list/useListControls.native.js +244 -0
- package/dist/esm/list/useListControls.native.js.map +1 -0
- package/dist/esm/record/RecordBars.mjs +175 -0
- package/dist/esm/record/RecordBars.mjs.map +1 -0
- package/dist/esm/record/RecordBars.native.js +197 -0
- package/dist/esm/record/RecordBars.native.js.map +1 -0
- package/dist/esm/record/RecordGallery.mjs +42 -0
- package/dist/esm/record/RecordGallery.mjs.map +1 -0
- package/dist/esm/record/RecordGallery.native.js +47 -0
- package/dist/esm/record/RecordGallery.native.js.map +1 -0
- package/dist/esm/record/RecordHero.mjs +205 -0
- package/dist/esm/record/RecordHero.mjs.map +1 -0
- package/dist/esm/record/RecordHero.native.js +213 -0
- package/dist/esm/record/RecordHero.native.js.map +1 -0
- package/dist/esm/record/RecordPage.mjs +305 -0
- package/dist/esm/record/RecordPage.mjs.map +1 -0
- package/dist/esm/record/RecordPage.native.js +336 -0
- package/dist/esm/record/RecordPage.native.js.map +1 -0
- package/dist/esm/record/RecordPager.mjs +100 -0
- package/dist/esm/record/RecordPager.mjs.map +1 -0
- package/dist/esm/record/RecordPager.native.js +102 -0
- package/dist/esm/record/RecordPager.native.js.map +1 -0
- package/dist/esm/record/RecordRows.mjs +101 -0
- package/dist/esm/record/RecordRows.mjs.map +1 -0
- package/dist/esm/record/RecordRows.native.js +112 -0
- package/dist/esm/record/RecordRows.native.js.map +1 -0
- package/dist/esm/record/recordData.mjs +92 -0
- package/dist/esm/record/recordData.mjs.map +1 -0
- package/dist/esm/record/recordData.native.js +156 -0
- package/dist/esm/record/recordData.native.js.map +1 -0
- package/dist/esm/record/recordSections.mjs +5 -0
- package/dist/esm/record/recordSections.mjs.map +1 -0
- package/dist/esm/record/recordSections.native.js +5 -0
- package/dist/esm/record/recordSections.native.js.map +1 -0
- package/dist/esm/useFrappeFacets.mjs +1 -1
- package/dist/esm/useFrappeFacets.mjs.map +1 -1
- package/dist/esm/useFrappeFacets.native.js +1 -1
- package/dist/esm/useFrappeFacets.native.js.map +1 -1
- package/dist/jsx/FrappeCalendar.mjs +1 -1
- package/dist/jsx/FrappeCalendar.mjs.map +1 -1
- package/dist/jsx/FrappeCalendar.native.js +1 -1
- package/dist/jsx/FrappeCalendar.native.js.map +1 -1
- package/dist/jsx/FrappeDashboard.mjs +1 -1
- package/dist/jsx/FrappeDashboard.mjs.map +1 -1
- package/dist/jsx/FrappeDashboard.native.js +1 -1
- package/dist/jsx/FrappeDashboard.native.js.map +1 -1
- package/dist/jsx/FrappeForm.mjs +8 -0
- package/dist/jsx/FrappeForm.mjs.map +1 -1
- package/dist/jsx/FrappeForm.native.js +9 -0
- package/dist/jsx/FrappeForm.native.js.map +1 -1
- package/dist/jsx/FrappeImageView.mjs +1 -1
- package/dist/jsx/FrappeImageView.mjs.map +1 -1
- package/dist/jsx/FrappeImageView.native.js +1 -1
- package/dist/jsx/FrappeImageView.native.js.map +1 -1
- package/dist/jsx/FrappeInsights.mjs +355 -0
- package/dist/jsx/FrappeInsights.mjs.map +1 -0
- package/dist/jsx/FrappeInsights.native.js +447 -0
- package/dist/jsx/FrappeInsights.native.js.map +1 -0
- package/dist/jsx/FrappeLikedBy.mjs +6 -3
- package/dist/jsx/FrappeLikedBy.mjs.map +1 -1
- package/dist/jsx/FrappeLikedBy.native.js +5 -2
- package/dist/jsx/FrappeLikedBy.native.js.map +1 -1
- package/dist/jsx/FrappeListView.mjs +410 -43
- package/dist/jsx/FrappeListView.mjs.map +1 -1
- package/dist/jsx/FrappeListView.native.js +469 -42
- package/dist/jsx/FrappeListView.native.js.map +1 -1
- package/dist/jsx/FrappeNotConfigured.mjs +29 -0
- package/dist/jsx/FrappeNotConfigured.mjs.map +1 -0
- package/dist/jsx/FrappeNotConfigured.native.js +58 -0
- package/dist/jsx/FrappeNotConfigured.native.js.map +1 -0
- package/dist/jsx/FrappeRecordView.mjs +174 -0
- package/dist/jsx/FrappeRecordView.mjs.map +1 -0
- package/dist/jsx/FrappeRecordView.native.js +218 -0
- package/dist/jsx/FrappeRecordView.native.js.map +1 -0
- package/dist/jsx/FrappeReportBuilder.mjs +2 -2
- package/dist/jsx/FrappeReportBuilder.mjs.map +1 -1
- package/dist/jsx/FrappeReportBuilder.native.js +2 -2
- package/dist/jsx/FrappeReportBuilder.native.js.map +1 -1
- package/dist/jsx/FrappeReportView.mjs +1 -1
- package/dist/jsx/FrappeReportView.mjs.map +1 -1
- package/dist/jsx/FrappeReportView.native.js +2 -2
- package/dist/jsx/FrappeReportView.native.js.map +1 -1
- package/dist/jsx/FrappeTreeView.mjs +1 -1
- package/dist/jsx/FrappeTreeView.mjs.map +1 -1
- package/dist/jsx/FrappeTreeView.native.js +1 -1
- package/dist/jsx/desk/awesomebar.mjs +1 -1
- package/dist/jsx/desk/awesomebar.mjs.map +1 -1
- package/dist/jsx/desk/awesomebar.native.js +3 -3
- package/dist/jsx/desk/awesomebar.native.js.map +1 -1
- package/dist/jsx/fields/CodeEditor/index.mjs +2 -2
- package/dist/jsx/fields/CodeEditor/index.mjs.map +1 -1
- package/dist/jsx/fields/CodeEditor/index.native.js +1 -1
- package/dist/jsx/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/jsx/fields/Color/index.mjs +1 -0
- package/dist/jsx/fields/Color/index.mjs.map +1 -1
- package/dist/jsx/fields/Color/index.native.js +1 -0
- package/dist/jsx/fields/Color/index.native.js.map +1 -1
- package/dist/jsx/fields/FileUpload.mjs +2 -2
- package/dist/jsx/fields/FileUpload.mjs.map +1 -1
- package/dist/jsx/fields/FileUpload.native.js +1 -1
- package/dist/jsx/fields/FileUpload.native.js.map +1 -1
- package/dist/jsx/fields/Heading/index.mjs +21 -14
- package/dist/jsx/fields/Heading/index.mjs.map +1 -1
- package/dist/jsx/fields/Heading/index.native.js +22 -13
- package/dist/jsx/fields/Heading/index.native.js.map +1 -1
- package/dist/jsx/fields/MarkdownEditor/index.mjs +2 -1
- package/dist/jsx/fields/MarkdownEditor/index.mjs.map +1 -1
- package/dist/jsx/fields/MarkdownEditor/index.native.js +1 -1
- package/dist/jsx/fields/MarkdownEditor/index.native.js.map +1 -1
- package/dist/jsx/frappeNavigation.mjs +11 -2
- package/dist/jsx/frappeNavigation.mjs.map +1 -1
- package/dist/jsx/frappeNavigation.native.js +13 -2
- package/dist/jsx/frappeNavigation.native.js.map +1 -1
- package/dist/jsx/index.js +14 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +14 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +34 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/insights/InsightsFacetTags.mjs +122 -0
- package/dist/jsx/insights/InsightsFacetTags.mjs.map +1 -0
- package/dist/jsx/insights/InsightsFacetTags.native.js +165 -0
- package/dist/jsx/insights/InsightsFacetTags.native.js.map +1 -0
- package/dist/jsx/insights/InsightsKpiBand.mjs +99 -0
- package/dist/jsx/insights/InsightsKpiBand.mjs.map +1 -0
- package/dist/jsx/insights/InsightsKpiBand.native.js +133 -0
- package/dist/jsx/insights/InsightsKpiBand.native.js.map +1 -0
- package/dist/jsx/insights/InsightsLeaders.mjs +125 -0
- package/dist/jsx/insights/InsightsLeaders.mjs.map +1 -0
- package/dist/jsx/insights/InsightsLeaders.native.js +178 -0
- package/dist/jsx/insights/InsightsLeaders.native.js.map +1 -0
- package/dist/jsx/insights/InsightsRecords.mjs +80 -0
- package/dist/jsx/insights/InsightsRecords.mjs.map +1 -0
- package/dist/jsx/insights/InsightsRecords.native.js +109 -0
- package/dist/jsx/insights/InsightsRecords.native.js.map +1 -0
- package/dist/jsx/insights/InsightsTable.mjs +132 -0
- package/dist/jsx/insights/InsightsTable.mjs.map +1 -0
- package/dist/jsx/insights/InsightsTable.native.js +194 -0
- package/dist/jsx/insights/InsightsTable.native.js.map +1 -0
- package/dist/jsx/insights/insightsData.mjs +82 -0
- package/dist/jsx/insights/insightsData.mjs.map +1 -0
- package/dist/jsx/insights/insightsData.native.js +220 -0
- package/dist/jsx/insights/insightsData.native.js.map +1 -0
- package/dist/jsx/insights/insightsRecord.mjs +9 -0
- package/dist/jsx/insights/insightsRecord.mjs.map +1 -0
- package/dist/jsx/insights/insightsRecord.native.js +38 -0
- package/dist/jsx/insights/insightsRecord.native.js.map +1 -0
- package/dist/jsx/list/FacetBadge.mjs +37 -0
- package/dist/jsx/list/FacetBadge.mjs.map +1 -0
- package/dist/jsx/list/FacetBadge.native.js +66 -0
- package/dist/jsx/list/FacetBadge.native.js.map +1 -0
- package/dist/jsx/list/FacetRail.mjs +174 -0
- package/dist/jsx/list/FacetRail.mjs.map +1 -0
- package/dist/jsx/list/FacetRail.native.js +223 -0
- package/dist/jsx/list/FacetRail.native.js.map +1 -0
- package/dist/jsx/list/ImageWell.mjs +86 -0
- package/dist/jsx/list/ImageWell.mjs.map +1 -0
- package/dist/jsx/list/ImageWell.native.js +126 -0
- package/dist/jsx/list/ImageWell.native.js.map +1 -0
- package/dist/jsx/list/ListControls.mjs +201 -0
- package/dist/jsx/list/ListControls.mjs.map +1 -0
- package/dist/jsx/list/ListControls.native.js +252 -0
- package/dist/jsx/list/ListControls.native.js.map +1 -0
- package/dist/jsx/list/ListToastHost.mjs +18 -0
- package/dist/jsx/list/ListToastHost.mjs.map +1 -0
- package/dist/jsx/list/ListToastHost.native.js +59 -0
- package/dist/jsx/list/ListToastHost.native.js.map +1 -0
- package/dist/jsx/list/RangeFilter.mjs +85 -0
- package/dist/jsx/list/RangeFilter.mjs.map +1 -0
- package/dist/jsx/list/RangeFilter.native.js +135 -0
- package/dist/jsx/list/RangeFilter.native.js.map +1 -0
- package/dist/jsx/list/RecordCard.mjs +208 -0
- package/dist/jsx/list/RecordCard.mjs.map +1 -0
- package/dist/jsx/list/RecordCard.native.js +173 -0
- package/dist/jsx/list/RecordCard.native.js.map +1 -0
- package/dist/jsx/list/ShufflePanel.mjs +87 -0
- package/dist/jsx/list/ShufflePanel.mjs.map +1 -0
- package/dist/jsx/list/ShufflePanel.native.js +139 -0
- package/dist/jsx/list/ShufflePanel.native.js.map +1 -0
- package/dist/jsx/list/facetReading.mjs +45 -0
- package/dist/jsx/list/facetReading.mjs.map +1 -0
- package/dist/jsx/list/facetReading.native.js +163 -0
- package/dist/jsx/list/facetReading.native.js.map +1 -0
- package/dist/jsx/list/favorites.mjs +50 -0
- package/dist/jsx/list/favorites.mjs.map +1 -0
- package/dist/jsx/list/favorites.native.js +91 -0
- package/dist/jsx/list/favorites.native.js.map +1 -0
- package/dist/jsx/list/listState.mjs +71 -0
- package/dist/jsx/list/listState.mjs.map +1 -0
- package/dist/jsx/list/listState.native.js +234 -0
- package/dist/jsx/list/listState.native.js.map +1 -0
- package/dist/jsx/list/recordLook.mjs +10 -0
- package/dist/jsx/list/recordLook.mjs.map +1 -0
- package/dist/jsx/list/recordLook.native.js +39 -0
- package/dist/jsx/list/recordLook.native.js.map +1 -0
- package/dist/jsx/list/useListControls.mjs +164 -0
- package/dist/jsx/list/useListControls.mjs.map +1 -0
- package/dist/jsx/list/useListControls.native.js +272 -0
- package/dist/jsx/list/useListControls.native.js.map +1 -0
- package/dist/jsx/record/RecordBars.mjs +175 -0
- package/dist/jsx/record/RecordBars.mjs.map +1 -0
- package/dist/jsx/record/RecordBars.native.js +225 -0
- package/dist/jsx/record/RecordBars.native.js.map +1 -0
- package/dist/jsx/record/RecordGallery.mjs +42 -0
- package/dist/jsx/record/RecordGallery.mjs.map +1 -0
- package/dist/jsx/record/RecordGallery.native.js +75 -0
- package/dist/jsx/record/RecordGallery.native.js.map +1 -0
- package/dist/jsx/record/RecordHero.mjs +205 -0
- package/dist/jsx/record/RecordHero.mjs.map +1 -0
- package/dist/jsx/record/RecordHero.native.js +250 -0
- package/dist/jsx/record/RecordHero.native.js.map +1 -0
- package/dist/jsx/record/RecordPage.mjs +305 -0
- package/dist/jsx/record/RecordPage.mjs.map +1 -0
- package/dist/jsx/record/RecordPage.native.js +364 -0
- package/dist/jsx/record/RecordPage.native.js.map +1 -0
- package/dist/jsx/record/RecordPager.mjs +100 -0
- package/dist/jsx/record/RecordPager.mjs.map +1 -0
- package/dist/jsx/record/RecordPager.native.js +130 -0
- package/dist/jsx/record/RecordPager.native.js.map +1 -0
- package/dist/jsx/record/RecordRows.mjs +101 -0
- package/dist/jsx/record/RecordRows.mjs.map +1 -0
- package/dist/jsx/record/RecordRows.native.js +140 -0
- package/dist/jsx/record/RecordRows.native.js.map +1 -0
- package/dist/jsx/record/recordData.mjs +92 -0
- package/dist/jsx/record/recordData.mjs.map +1 -0
- package/dist/jsx/record/recordData.native.js +189 -0
- package/dist/jsx/record/recordData.native.js.map +1 -0
- package/dist/jsx/record/recordSections.mjs +5 -0
- package/dist/jsx/record/recordSections.mjs.map +1 -0
- package/dist/jsx/record/recordSections.native.js +33 -0
- package/dist/jsx/record/recordSections.native.js.map +1 -0
- package/dist/jsx/useFrappeFacets.mjs +1 -1
- package/dist/jsx/useFrappeFacets.mjs.map +1 -1
- package/dist/jsx/useFrappeFacets.native.js +1 -1
- package/dist/jsx/useFrappeFacets.native.js.map +1 -1
- package/package.json +16 -16
- package/src/FormSidebar.stories.tsx +2 -0
- package/src/FrappeCalendar.stories.tsx +2 -0
- package/src/FrappeCalendar.tsx +2 -2
- package/src/FrappeChartCard.stories.tsx +2 -0
- package/src/FrappeDashboard.stories.tsx +2 -0
- package/src/FrappeDashboard.tsx +2 -2
- package/src/FrappeForm.tsx +7 -1
- package/src/FrappeImageView.stories.tsx +2 -0
- package/src/FrappeImageView.tsx +2 -1
- package/src/FrappeInsights.spec.tsx +171 -0
- package/src/FrappeInsights.tsx +422 -0
- package/src/FrappeKPICard.stories.tsx +3 -3
- package/src/FrappeKanban.stories.tsx +4 -8
- package/src/FrappeLikedBy.tsx +7 -5
- package/src/FrappeListView.card.spec.tsx +157 -0
- package/src/FrappeListView.controls.spec.tsx +225 -0
- package/src/FrappeListView.seed.spec.tsx +30 -0
- package/src/FrappeListView.stories.tsx +2 -0
- package/src/FrappeListView.tsx +589 -45
- package/src/FrappeNotConfigured.tsx +29 -0
- package/src/FrappeRecordView.spec.tsx +276 -0
- package/src/FrappeRecordView.tsx +231 -0
- package/src/FrappeReportBuilder.tsx +4 -5
- package/src/FrappeReportView.tsx +1 -1
- package/src/FrappeTreeView.tsx +1 -1
- package/src/clientCache.auth.spec.tsx +94 -0
- package/src/desk/DeskFormSidebar.stories.tsx +2 -0
- package/src/desk/DeskShell.stories.tsx +12 -6
- package/src/desk/awesomebar.auth.spec.tsx +77 -0
- package/src/desk/awesomebar.tsx +1 -1
- package/src/fields/CodeEditor/index.tsx +8 -2
- package/src/fields/Color/Color.stories.tsx +2 -0
- package/src/fields/Color/index.tsx +1 -0
- package/src/fields/FileUpload.tsx +8 -2
- package/src/fields/Heading/index.tsx +41 -17
- package/src/fields/MarkdownEditor/index.native.tsx +8 -2
- package/src/fields/MarkdownEditor/index.tsx +8 -1
- package/src/fields/ReadOnly/ReadOnly.stories.tsx +2 -0
- package/src/frappeNavigation.loader.spec.tsx +45 -0
- package/src/frappeNavigation.tsx +32 -1
- package/src/frappeRoutes.notConfigured.spec.tsx +77 -0
- package/src/index.ts +53 -1
- package/src/insights/InsightsFacetTags.tsx +131 -0
- package/src/insights/InsightsKpiBand.tsx +114 -0
- package/src/insights/InsightsLeaders.tsx +146 -0
- package/src/insights/InsightsRecords.tsx +71 -0
- package/src/insights/InsightsTable.tsx +169 -0
- package/src/insights/insightsData.spec.ts +143 -0
- package/src/insights/insightsData.ts +122 -0
- package/src/insights/insightsRecord.ts +36 -0
- package/src/list/FacetBadge.tsx +41 -0
- package/src/list/FacetRail.tsx +235 -0
- package/src/list/ImageWell.tsx +110 -0
- package/src/list/ListControls.tsx +208 -0
- package/src/list/ListToastHost.tsx +27 -0
- package/src/list/RangeFilter.tsx +83 -0
- package/src/list/RecordCard.native.tsx +126 -0
- package/src/list/RecordCard.tsx +260 -0
- package/src/list/ShufflePanel.tsx +107 -0
- package/src/list/facetReading.ts +79 -0
- package/src/list/favorites.spec.ts +80 -0
- package/src/list/favorites.ts +79 -0
- package/src/list/listState.spec.ts +156 -0
- package/src/list/listState.ts +184 -0
- package/src/list/recordLook.ts +37 -0
- package/src/list/useListControls.tsx +223 -0
- package/src/record/RecordBars.tsx +187 -0
- package/src/record/RecordGallery.tsx +47 -0
- package/src/record/RecordHero.tsx +186 -0
- package/src/record/RecordPage.tsx +358 -0
- package/src/record/RecordPager.tsx +97 -0
- package/src/record/RecordRows.tsx +90 -0
- package/src/record/recordData.spec.ts +148 -0
- package/src/record/recordData.ts +124 -0
- package/src/record/recordSections.ts +62 -0
- package/src/schemaForm/SchemaForm.stories.tsx +2 -2
- package/src/useFrappeFacets.ts +14 -7
- package/types/FrappeForm.d.ts +2 -1
- package/types/FrappeForm.d.ts.map +1 -1
- package/types/FrappeImageView.d.ts.map +1 -1
- package/types/FrappeInsights.d.ts +55 -0
- package/types/FrappeInsights.d.ts.map +1 -0
- package/types/FrappeLikedBy.d.ts.map +1 -1
- package/types/FrappeListView.d.ts +85 -3
- package/types/FrappeListView.d.ts.map +1 -1
- package/types/FrappeNotConfigured.d.ts +11 -0
- package/types/FrappeNotConfigured.d.ts.map +1 -0
- package/types/FrappeRecordView.d.ts +69 -0
- package/types/FrappeRecordView.d.ts.map +1 -0
- package/types/FrappeReportBuilder.d.ts.map +1 -1
- package/types/fields/CodeEditor/index.d.ts.map +1 -1
- package/types/fields/Color/index.d.ts.map +1 -1
- package/types/fields/FileUpload.d.ts.map +1 -1
- package/types/fields/Heading/index.d.ts.map +1 -1
- package/types/fields/MarkdownEditor/index.d.ts.map +1 -1
- package/types/fields/MarkdownEditor/index.native.d.ts.map +1 -1
- package/types/frappeNavigation.d.ts +21 -0
- package/types/frappeNavigation.d.ts.map +1 -1
- package/types/index.d.ts +14 -2
- package/types/index.d.ts.map +1 -1
- package/types/insights/InsightsFacetTags.d.ts +11 -0
- package/types/insights/InsightsFacetTags.d.ts.map +1 -0
- package/types/insights/InsightsKpiBand.d.ts +22 -0
- package/types/insights/InsightsKpiBand.d.ts.map +1 -0
- package/types/insights/InsightsLeaders.d.ts +16 -0
- package/types/insights/InsightsLeaders.d.ts.map +1 -0
- package/types/insights/InsightsRecords.d.ts +19 -0
- package/types/insights/InsightsRecords.d.ts.map +1 -0
- package/types/insights/InsightsTable.d.ts +17 -0
- package/types/insights/InsightsTable.d.ts.map +1 -0
- package/types/insights/insightsData.d.ts +45 -0
- package/types/insights/insightsData.d.ts.map +1 -0
- package/types/insights/insightsRecord.d.ts +29 -0
- package/types/insights/insightsRecord.d.ts.map +1 -0
- package/types/list/FacetBadge.d.ts +13 -0
- package/types/list/FacetBadge.d.ts.map +1 -0
- package/types/list/FacetRail.d.ts +26 -0
- package/types/list/FacetRail.d.ts.map +1 -0
- package/types/list/ImageWell.d.ts +24 -0
- package/types/list/ImageWell.d.ts.map +1 -0
- package/types/list/ListControls.d.ts +30 -0
- package/types/list/ListControls.d.ts.map +1 -0
- package/types/list/ListToastHost.d.ts +7 -0
- package/types/list/ListToastHost.d.ts.map +1 -0
- package/types/list/RangeFilter.d.ts +14 -0
- package/types/list/RangeFilter.d.ts.map +1 -0
- package/types/list/RecordCard.d.ts +38 -0
- package/types/list/RecordCard.d.ts.map +1 -0
- package/types/list/RecordCard.native.d.ts +9 -0
- package/types/list/RecordCard.native.d.ts.map +1 -0
- package/types/list/ShufflePanel.d.ts +24 -0
- package/types/list/ShufflePanel.d.ts.map +1 -0
- package/types/list/facetReading.d.ts +33 -0
- package/types/list/facetReading.d.ts.map +1 -0
- package/types/list/favorites.d.ts +26 -0
- package/types/list/favorites.d.ts.map +1 -0
- package/types/list/listState.d.ts +94 -0
- package/types/list/listState.d.ts.map +1 -0
- package/types/list/recordLook.d.ts +25 -0
- package/types/list/recordLook.d.ts.map +1 -0
- package/types/list/useListControls.d.ts +48 -0
- package/types/list/useListControls.d.ts.map +1 -0
- package/types/record/RecordBars.d.ts +11 -0
- package/types/record/RecordBars.d.ts.map +1 -0
- package/types/record/RecordGallery.d.ts +17 -0
- package/types/record/RecordGallery.d.ts.map +1 -0
- package/types/record/RecordHero.d.ts +42 -0
- package/types/record/RecordHero.d.ts.map +1 -0
- package/types/record/RecordPage.d.ts +54 -0
- package/types/record/RecordPage.d.ts.map +1 -0
- package/types/record/RecordPager.d.ts +13 -0
- package/types/record/RecordPager.d.ts.map +1 -0
- package/types/record/RecordRows.d.ts +13 -0
- package/types/record/RecordRows.d.ts.map +1 -0
- package/types/record/recordData.d.ts +46 -0
- package/types/record/recordData.d.ts.map +1 -0
- package/types/record/recordSections.d.ts +67 -0
- package/types/record/recordSections.d.ts.map +1 -0
- package/types/useFrappeFacets.d.ts.map +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EmptyState, ListPageLayout, PageHeader } from "@multiplatform.one/components";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
export interface FrappeNotConfiguredProps {
|
|
5
|
+
doctype: string;
|
|
6
|
+
/** A routed page keeps the page template, the doctype as its title. */
|
|
7
|
+
page?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What a doctype's list or form shows when neither a bench URL nor a fixture
|
|
12
|
+
* corpus is configured (a host built with Frappe off), in place of the view.
|
|
13
|
+
*/
|
|
14
|
+
export function FrappeNotConfigured({ doctype, page = false }: FrappeNotConfiguredProps) {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const state = (
|
|
17
|
+
<EmptyState
|
|
18
|
+
testID="frappe-not-configured"
|
|
19
|
+
title={t("Frappe is not configured")}
|
|
20
|
+
description={t("{{doctype}} can't load without a Frappe bench URL.", { doctype })}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
if (!page) return state;
|
|
24
|
+
return (
|
|
25
|
+
<ListPageLayout scroll={false} header={<PageHeader title={doctype} divider={false} />}>
|
|
26
|
+
{state}
|
|
27
|
+
</ListPageLayout>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// FrappeRecordView (MPO-411): a doctype's record page declared from its look,
|
|
2
|
+
// facet, metrics and tabs, the way pokemon's detail page drew itself by hand.
|
|
3
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
4
|
+
import { ArrowSquareOutIcon } from "@phosphor-icons/react";
|
|
5
|
+
import { cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
|
|
6
|
+
import i18next from "i18next";
|
|
7
|
+
import { initReactI18next } from "react-i18next";
|
|
8
|
+
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
|
9
|
+
import { Order } from "@multiplatform.one/frappe";
|
|
10
|
+
import {
|
|
11
|
+
createRosterFixtures,
|
|
12
|
+
rosterPokemon,
|
|
13
|
+
rosterPokemonFields,
|
|
14
|
+
rosterPokemonMeta,
|
|
15
|
+
type RosterPokemon,
|
|
16
|
+
} from "../tests/fixtures/pokemonRoster";
|
|
17
|
+
import type { FrappeNavigation } from "./frappeNavigation";
|
|
18
|
+
import { FrappeProvider } from "./FrappeProvider";
|
|
19
|
+
import { FrappeRecordView, type FrappeRecordViewProps } from "./FrappeRecordView";
|
|
20
|
+
import { favoritesStore } from "./list/favorites";
|
|
21
|
+
|
|
22
|
+
const host = "https://record-view.spec.test";
|
|
23
|
+
const realFetch = globalThis.fetch;
|
|
24
|
+
const favoritesKey = "record-spec-favorites";
|
|
25
|
+
|
|
26
|
+
beforeAll(async () => {
|
|
27
|
+
await i18next.use(initReactI18next).init({
|
|
28
|
+
lng: "en",
|
|
29
|
+
interpolation: { escapeValue: false },
|
|
30
|
+
resources: { en: { translation: {} } },
|
|
31
|
+
});
|
|
32
|
+
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
33
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
34
|
+
if (url.startsWith(host)) {
|
|
35
|
+
const body = /\/api\/resource\/DocType\//.test(url)
|
|
36
|
+
? { data: rosterPokemonMeta }
|
|
37
|
+
: { data: [] };
|
|
38
|
+
return new Response(JSON.stringify(body), {
|
|
39
|
+
status: 200,
|
|
40
|
+
headers: { "Content-Type": "application/json" },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return realFetch(input as RequestInfo, init);
|
|
44
|
+
}) as typeof fetch;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterAll(() => {
|
|
48
|
+
globalThis.fetch = realFetch;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
cleanup();
|
|
53
|
+
vi.restoreAllMocks();
|
|
54
|
+
favoritesStore(favoritesKey).setState(() => ({ names: [] }));
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const pokemon = rosterPokemon.map((doc) =>
|
|
58
|
+
doc.name === "pikachu"
|
|
59
|
+
? {
|
|
60
|
+
...doc,
|
|
61
|
+
owner: "ash@example.com",
|
|
62
|
+
creation: "2026-08-01 10:00:00",
|
|
63
|
+
modified_by: "misty@example.com",
|
|
64
|
+
stats: [
|
|
65
|
+
{ stat_name: "speed", base_stat: 90 },
|
|
66
|
+
{ stat_name: "hp", base_stat: 35 },
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
: { ...doc },
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const declaration: Partial<FrappeRecordViewProps<RosterPokemon>> = {
|
|
73
|
+
listTitle: "Roster",
|
|
74
|
+
fields: rosterPokemonFields,
|
|
75
|
+
orderBy: [{ field: "poke_id", order: Order.Asc }],
|
|
76
|
+
connections: [
|
|
77
|
+
{ doctype: "Pokemon Poke Type", fieldname: "pokemon", fields: ["poke_type", "slot"] },
|
|
78
|
+
{
|
|
79
|
+
doctype: "Pokemon Poke Ability",
|
|
80
|
+
fieldname: "pokemon",
|
|
81
|
+
fields: ["poke_ability", "is_hidden", "slot"],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
doctype: "Pokemon Poke Move",
|
|
85
|
+
fieldname: "pokemon",
|
|
86
|
+
fields: ["poke_move", "level_learned_at", "move_learn_method"],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
look: {
|
|
90
|
+
title: (doc) => (doc.pokemon_name ?? "").toUpperCase(),
|
|
91
|
+
code: (doc) => `#${String(doc.poke_id ?? 0).padStart(3, "0")}`,
|
|
92
|
+
subtitle: (doc) => doc.species,
|
|
93
|
+
images: (doc) => [`https://art.spec.test/${doc.poke_id}.png`],
|
|
94
|
+
},
|
|
95
|
+
facet: {
|
|
96
|
+
param: "type",
|
|
97
|
+
doctype: "Pokemon Poke Type",
|
|
98
|
+
field: "poke_type",
|
|
99
|
+
orderBy: "slot",
|
|
100
|
+
options: [],
|
|
101
|
+
label: "Type",
|
|
102
|
+
optionLabel: (value) => `type:${value}`,
|
|
103
|
+
tint: (value) => (value === "grass" ? "grass" : "purple"),
|
|
104
|
+
},
|
|
105
|
+
metrics: [{ field: "base_experience", label: "Base XP", max: 608 }],
|
|
106
|
+
summary: (doc) => ({ text: `${doc.pokemon_name}, the ${doc.species}.`, cite: "The dex" }),
|
|
107
|
+
favorites: favoritesKey,
|
|
108
|
+
actions: [
|
|
109
|
+
{
|
|
110
|
+
label: "Open in backoffice",
|
|
111
|
+
icon: ArrowSquareOutIcon,
|
|
112
|
+
href: (doc) => `/backoffice/pokemon/${doc.name}`,
|
|
113
|
+
testID: "hop",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
tabs: [
|
|
117
|
+
{
|
|
118
|
+
value: "overview",
|
|
119
|
+
label: "Overview",
|
|
120
|
+
sections: [
|
|
121
|
+
{
|
|
122
|
+
kind: "rows",
|
|
123
|
+
doctype: "Pokemon Poke Ability",
|
|
124
|
+
field: "poke_ability",
|
|
125
|
+
title: "Abilities",
|
|
126
|
+
orderBy: ["slot"],
|
|
127
|
+
flag: { field: "is_hidden", label: "Hidden" },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
kind: "bars",
|
|
131
|
+
id: "stats",
|
|
132
|
+
table: "stats",
|
|
133
|
+
label: "stat_name",
|
|
134
|
+
value: "base_stat",
|
|
135
|
+
max: 255,
|
|
136
|
+
order: ["hp", "speed"],
|
|
137
|
+
title: "Stats",
|
|
138
|
+
totalLabel: "Stat total",
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: "moves",
|
|
144
|
+
label: "Moves",
|
|
145
|
+
count: "Pokemon Poke Move",
|
|
146
|
+
sections: [
|
|
147
|
+
{
|
|
148
|
+
kind: "rows",
|
|
149
|
+
doctype: "Pokemon Poke Move",
|
|
150
|
+
field: "poke_move",
|
|
151
|
+
orderBy: ["move_learn_method", "level_learned_at", "poke_move"],
|
|
152
|
+
detail: { field: "level_learned_at", label: (level) => `Lv ${level}` },
|
|
153
|
+
groupBy: { field: "move_learn_method", label: (method) => method.toUpperCase() },
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
function renderRecord(name: string, navigate = vi.fn()) {
|
|
161
|
+
const navigation: FrappeNavigation = {
|
|
162
|
+
usePathname: () => `/pokemon/${name}`,
|
|
163
|
+
useNavigate: () => navigate,
|
|
164
|
+
};
|
|
165
|
+
return renderWithProviders(
|
|
166
|
+
<FrappeProvider
|
|
167
|
+
baseURL={host}
|
|
168
|
+
fixtures={createRosterFixtures({ Pokemon: pokemon })}
|
|
169
|
+
navigation={navigation}
|
|
170
|
+
>
|
|
171
|
+
<FrappeRecordView<RosterPokemon> doctype="Pokemon" route="/pokemon" {...declaration} />
|
|
172
|
+
</FrappeProvider>,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function identity(): Promise<HTMLElement> {
|
|
177
|
+
return screen.findByTestId("pokemon-hero-identity", {}, { timeout: 5000 });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
describe("FrappeRecordView heads the record from its look and facet", () => {
|
|
181
|
+
it("names the record by code, title and subtitle under the list's breadcrumb", async () => {
|
|
182
|
+
renderRecord("bulbasaur");
|
|
183
|
+
const hero = await identity();
|
|
184
|
+
expect(hero.textContent).toContain("#001");
|
|
185
|
+
expect(hero.textContent).toContain("BULBASAUR");
|
|
186
|
+
expect(hero.textContent).toContain("Seed Pokémon");
|
|
187
|
+
expect(screen.getByText("Roster")).toBeTruthy();
|
|
188
|
+
expect(screen.getByText("#001 BULBASAUR")).toBeTruthy();
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it("badges the facet's values in slot order and draws the first image", async () => {
|
|
192
|
+
renderRecord("bulbasaur");
|
|
193
|
+
const hero = await identity();
|
|
194
|
+
await waitFor(() => expect(hero.textContent).toContain("type:poison"));
|
|
195
|
+
const text = hero.textContent ?? "";
|
|
196
|
+
expect(text.indexOf("type:grass")).toBeLessThan(text.indexOf("type:poison"));
|
|
197
|
+
const art = screen.getByTestId("pokemon-hero-art");
|
|
198
|
+
expect(art.querySelector("img")?.getAttribute("src")).toBe("https://art.spec.test/1.png");
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("tiles each metric, a max adding a bar", async () => {
|
|
202
|
+
renderRecord("bulbasaur");
|
|
203
|
+
const hero = await identity();
|
|
204
|
+
expect(hero.textContent).toContain("Base XP");
|
|
205
|
+
expect(hero.textContent).toContain("64");
|
|
206
|
+
expect(within(hero).getByLabelText("Base XP")).toBeTruthy();
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe("FrappeRecordView tabs the record's rows", () => {
|
|
211
|
+
it("opens with the summary, the linked rows in order with their flags, and the audit trail", async () => {
|
|
212
|
+
renderRecord("pikachu");
|
|
213
|
+
await identity();
|
|
214
|
+
expect(await screen.findByText("pikachu, the Mouse Pokémon.")).toBeTruthy();
|
|
215
|
+
await waitFor(() => expect(screen.getByText("lightning rod")).toBeTruthy());
|
|
216
|
+
expect(screen.getAllByText("Hidden")).toHaveLength(1);
|
|
217
|
+
expect(screen.getByText("Record history")).toBeTruthy();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("draws a child table as bars on a fixed scale with their total", async () => {
|
|
221
|
+
renderRecord("pikachu");
|
|
222
|
+
await identity();
|
|
223
|
+
expect(await screen.findByTestId("pokemon-stats-chart")).toBeTruthy();
|
|
224
|
+
expect(screen.getByText("Stat total")).toBeTruthy();
|
|
225
|
+
expect(screen.getByText("125")).toBeTruthy();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("badges a tab with its rows' count and groups them, detailed", async () => {
|
|
229
|
+
renderRecord("pikachu");
|
|
230
|
+
await identity();
|
|
231
|
+
const movesTab = await waitFor(() => {
|
|
232
|
+
const tab = screen.getAllByRole("tab").find((node) => node.textContent?.includes("Moves"));
|
|
233
|
+
expect(tab?.textContent).toContain("3");
|
|
234
|
+
return tab as HTMLElement;
|
|
235
|
+
});
|
|
236
|
+
fireEvent.click(movesTab);
|
|
237
|
+
expect(await screen.findByText("LEVEL-UP")).toBeTruthy();
|
|
238
|
+
expect(screen.getByText("MACHINE")).toBeTruthy();
|
|
239
|
+
expect(screen.getByText("Lv 16")).toBeTruthy();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
describe("FrappeRecordView's controls", () => {
|
|
244
|
+
it("opens the neighbors in the list's order and the edit form", async () => {
|
|
245
|
+
const navigate = vi.fn();
|
|
246
|
+
renderRecord("pikachu", navigate);
|
|
247
|
+
await identity();
|
|
248
|
+
fireEvent.click(await screen.findByTestId("pokemon-next", {}, { timeout: 5000 }));
|
|
249
|
+
expect(navigate).toHaveBeenCalledWith("/pokemon/gengar");
|
|
250
|
+
fireEvent.click(screen.getByTestId("pokemon-prev"));
|
|
251
|
+
expect(navigate).toHaveBeenCalledWith("/pokemon/squirtle");
|
|
252
|
+
fireEvent.click(screen.getByTestId("pokemon-detail-edit"));
|
|
253
|
+
expect(navigate).toHaveBeenCalledWith("/pokemon/pikachu/edit");
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it("toggles the favorite from a real button and hops through a declared action", async () => {
|
|
257
|
+
const navigate = vi.fn();
|
|
258
|
+
renderRecord("pikachu", navigate);
|
|
259
|
+
const heart = await screen.findByTestId("pokemon-detail-favorite", {}, { timeout: 5000 });
|
|
260
|
+
expect(heart.tagName).toBe("BUTTON");
|
|
261
|
+
expect(heart.getAttribute("type")).toBe("button");
|
|
262
|
+
expect(heart.getAttribute("aria-pressed")).toBe("false");
|
|
263
|
+
fireEvent.click(heart);
|
|
264
|
+
await waitFor(() => expect(favoritesStore(favoritesKey).state.names).toEqual(["pikachu"]));
|
|
265
|
+
fireEvent.click(screen.getByTestId("hop"));
|
|
266
|
+
expect(navigate).toHaveBeenCalledWith("/backoffice/pokemon/pikachu");
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("names a missing record and offers the way back", async () => {
|
|
270
|
+
const navigate = vi.fn();
|
|
271
|
+
renderRecord("missingno", navigate);
|
|
272
|
+
expect(await screen.findByText("Pokemon not found", {}, { timeout: 5000 })).toBeTruthy();
|
|
273
|
+
fireEvent.click(screen.getByText("Back to Roster"));
|
|
274
|
+
expect(navigate).toHaveBeenCalledWith("/pokemon");
|
|
275
|
+
});
|
|
276
|
+
});
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { EmptyState, Screen, ScreenToolbar, YStack } from "@multiplatform.one/components";
|
|
2
|
+
import { Button } from "@multiplatform.one/forms";
|
|
3
|
+
import type { Order } from "@multiplatform.one/frappe";
|
|
4
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
5
|
+
import { ArrowLeftIcon } from "@phosphor-icons/react";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
import type { FrappeConnection } from "./frappeConnections";
|
|
9
|
+
import { FrappeForm } from "./FrappeForm";
|
|
10
|
+
import { frappeRouteTarget, useFrappeRouter, useRouteLoaderData } from "./frappeNavigation";
|
|
11
|
+
import { FrappeNotConfigured } from "./FrappeNotConfigured";
|
|
12
|
+
import { useFrappeConfig } from "./FrappeProvider";
|
|
13
|
+
import { useDocRights } from "./formEngine/useDocRights";
|
|
14
|
+
import { orderRows } from "./insights/insightsData";
|
|
15
|
+
import type { FrappeInsightsMetric } from "./insights/insightsRecord";
|
|
16
|
+
import type { FrappeListFacet } from "./list/listState";
|
|
17
|
+
import type { FrappeRecordLook } from "./list/recordLook";
|
|
18
|
+
import { RecordBreadcrumbBone, RecordSkeleton } from "./record/RecordHero";
|
|
19
|
+
import { RecordPage, type FrappeRecordAction, type RecordPageProps } from "./record/RecordPage";
|
|
20
|
+
import type { FrappeRecordTab } from "./record/recordSections";
|
|
21
|
+
import { useFrappeConnection, useFrappeRows } from "./useFrappeRows";
|
|
22
|
+
|
|
23
|
+
export type {
|
|
24
|
+
FrappeRecordBarsSection,
|
|
25
|
+
FrappeRecordRowsSection,
|
|
26
|
+
FrappeRecordSection,
|
|
27
|
+
FrappeRecordTab,
|
|
28
|
+
} from "./record/recordSections";
|
|
29
|
+
|
|
30
|
+
export type { FrappeRecordAction } from "./record/RecordPage";
|
|
31
|
+
|
|
32
|
+
type Row = Record<string, unknown>;
|
|
33
|
+
|
|
34
|
+
export interface FrappeRecordViewProps<TDoc extends { name: string; doctype: string }> {
|
|
35
|
+
doctype: string;
|
|
36
|
+
/** The doctype's list route: breadcrumb, Back, Edit and the neighbors hang off it. */
|
|
37
|
+
route: string;
|
|
38
|
+
/** Defaults to the record the route names. */
|
|
39
|
+
name?: string;
|
|
40
|
+
/** The list's title; defaults to the doctype. */
|
|
41
|
+
listTitle?: string;
|
|
42
|
+
/** The record a route loader rendered on the server. */
|
|
43
|
+
initialDoc?: Partial<TDoc>;
|
|
44
|
+
/** The route's loader (`frappeDocLoader`), read through the host's navigation. */
|
|
45
|
+
loader?: (...args: never[]) => Promise<{ doc: Partial<TDoc> | null }>;
|
|
46
|
+
/** The list's read, so the neighbors follow the list's order. */
|
|
47
|
+
fields?: readonly (keyof TDoc & string)[];
|
|
48
|
+
limit?: number;
|
|
49
|
+
orderBy?: Array<{ field: keyof TDoc & string; order: Order }>;
|
|
50
|
+
/** Declared connections; defaults to the meta's (a Guest cannot read meta). */
|
|
51
|
+
connections?: readonly FrappeConnection[];
|
|
52
|
+
look?: FrappeRecordLook<TDoc>;
|
|
53
|
+
titleField?: string;
|
|
54
|
+
/** Its values badge the hero and tint it. */
|
|
55
|
+
facet?: FrappeListFacet;
|
|
56
|
+
/** Numeric fields as fact tiles in the hero; `max` adds a bar. */
|
|
57
|
+
metrics?: readonly FrappeInsightsMetric[];
|
|
58
|
+
/** A quote opening the first tab. */
|
|
59
|
+
summary?: (doc: Partial<TDoc>) => { text: string; cite?: string } | undefined;
|
|
60
|
+
tabs?: readonly FrappeRecordTab[];
|
|
61
|
+
/** Star the record: true keys the stars by doctype, a string names the key. */
|
|
62
|
+
favorites?: boolean | string;
|
|
63
|
+
actions?: readonly FrappeRecordAction<TDoc>[];
|
|
64
|
+
/** False leaves the audit trail off the first tab. */
|
|
65
|
+
history?: boolean;
|
|
66
|
+
/** Prefix of the page's test ids; defaults to the doctype's slug. */
|
|
67
|
+
testID?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const noTabs: readonly FrappeRecordTab[] = [];
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A doctype's record page, read first: the list's breadcrumb and Back, the
|
|
74
|
+
* favorite heart, the record's hops and Edit under the write right; a hero
|
|
75
|
+
* with the record's images, code, title, subtitle, facet badges and metric
|
|
76
|
+
* tiles, tinted by the facet; tabs of linked rows and child-table bars with
|
|
77
|
+
* the audit trail; and the records either side of it in the list's order.
|
|
78
|
+
* FrappeForm reads the record and its connections live; loading, not found
|
|
79
|
+
* and error keep the page's wayfinding.
|
|
80
|
+
*/
|
|
81
|
+
export function FrappeRecordView<TDoc extends { name: string; doctype: string }>({
|
|
82
|
+
doctype,
|
|
83
|
+
route,
|
|
84
|
+
name: nameProp,
|
|
85
|
+
listTitle,
|
|
86
|
+
initialDoc,
|
|
87
|
+
loader,
|
|
88
|
+
fields,
|
|
89
|
+
limit,
|
|
90
|
+
orderBy,
|
|
91
|
+
connections,
|
|
92
|
+
look,
|
|
93
|
+
titleField,
|
|
94
|
+
facet,
|
|
95
|
+
metrics = [],
|
|
96
|
+
summary,
|
|
97
|
+
tabs = noTabs,
|
|
98
|
+
favorites,
|
|
99
|
+
actions = [],
|
|
100
|
+
history = true,
|
|
101
|
+
testID,
|
|
102
|
+
}: FrappeRecordViewProps<TDoc>) {
|
|
103
|
+
const { t } = useTranslation();
|
|
104
|
+
const { knobProps } = useResolvedKnobs();
|
|
105
|
+
const config = useFrappeConfig();
|
|
106
|
+
const connection = useFrappeConnection();
|
|
107
|
+
const router = useFrappeRouter();
|
|
108
|
+
const target = router ? frappeRouteTarget(route, router.pathname) : undefined;
|
|
109
|
+
const name = nameProp ?? (target?.mode === "view" ? target.name : "");
|
|
110
|
+
const slug = testID ?? doctype.toLowerCase().replace(/\s+/g, "-");
|
|
111
|
+
const loaded = useRouteLoaderData(loader) as { doc?: Partial<TDoc> | null } | undefined;
|
|
112
|
+
const listName = listTitle ?? doctype;
|
|
113
|
+
const navigate = (href: string) => router?.navigate(href);
|
|
114
|
+
|
|
115
|
+
const orderKey = JSON.stringify(orderBy ?? null);
|
|
116
|
+
const readOptions = useMemo(
|
|
117
|
+
() => ({ fields, limit, orderBy: JSON.parse(orderKey) }),
|
|
118
|
+
[fields, limit, orderKey],
|
|
119
|
+
);
|
|
120
|
+
const { rows: readRows } = useFrappeRows<TDoc>(connection, doctype, readOptions);
|
|
121
|
+
const listRows = useMemo(
|
|
122
|
+
() => orderRows(readRows as never[], JSON.parse(orderKey)) as Partial<TDoc>[],
|
|
123
|
+
[readRows, orderKey],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
if (!config?.baseURL && !config?.fixtures) return <FrappeNotConfigured doctype={doctype} page />;
|
|
127
|
+
|
|
128
|
+
const backButton = (
|
|
129
|
+
<ScreenToolbar
|
|
130
|
+
leading={
|
|
131
|
+
<Button
|
|
132
|
+
outlined
|
|
133
|
+
minHeight={knobProps.sizeToken}
|
|
134
|
+
onPress={() => navigate(route)}
|
|
135
|
+
icon={<ArrowLeftIcon size={16} />}
|
|
136
|
+
testID={`${slug}-detail-back`}
|
|
137
|
+
>
|
|
138
|
+
{t("Back")}
|
|
139
|
+
</Button>
|
|
140
|
+
}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<FrappeForm<TDoc>
|
|
146
|
+
doctype={doctype}
|
|
147
|
+
name={name}
|
|
148
|
+
initialDoc={initialDoc ?? loaded?.doc ?? undefined}
|
|
149
|
+
connections={connections}
|
|
150
|
+
showToolbar={false}
|
|
151
|
+
showSidebar={false}
|
|
152
|
+
showTimeline={false}
|
|
153
|
+
loadingFallback={
|
|
154
|
+
<Screen>
|
|
155
|
+
<YStack gap="$2">
|
|
156
|
+
<RecordBreadcrumbBone />
|
|
157
|
+
{backButton}
|
|
158
|
+
</YStack>
|
|
159
|
+
<RecordSkeleton testID={`${slug}-detail-skeleton`} />
|
|
160
|
+
</Screen>
|
|
161
|
+
}
|
|
162
|
+
notFoundFallback={
|
|
163
|
+
<Screen scroll={false}>
|
|
164
|
+
{backButton}
|
|
165
|
+
<EmptyState
|
|
166
|
+
title={t("{{doctype}} not found", { doctype })}
|
|
167
|
+
description={t("No {{doctype}} is named {{name}}.", { doctype, name })}
|
|
168
|
+
action={
|
|
169
|
+
<Button theme="accent" onPress={() => navigate(route)}>
|
|
170
|
+
{t("Back to {{title}}", { title: listName })}
|
|
171
|
+
</Button>
|
|
172
|
+
}
|
|
173
|
+
/>
|
|
174
|
+
</Screen>
|
|
175
|
+
}
|
|
176
|
+
errorFallback={
|
|
177
|
+
<Screen scroll={false}>
|
|
178
|
+
{backButton}
|
|
179
|
+
<EmptyState
|
|
180
|
+
intent="error"
|
|
181
|
+
title={t("Couldn't load this {{doctype}}", { doctype })}
|
|
182
|
+
description={t("Check the connection and try again.")}
|
|
183
|
+
/>
|
|
184
|
+
</Screen>
|
|
185
|
+
}
|
|
186
|
+
>
|
|
187
|
+
{({ doc, connections: linked, meta }) => (
|
|
188
|
+
<RecordWithRights
|
|
189
|
+
doc={doc}
|
|
190
|
+
meta={meta}
|
|
191
|
+
page={{
|
|
192
|
+
linked: linked as Record<string, Row[]>,
|
|
193
|
+
doctype,
|
|
194
|
+
route,
|
|
195
|
+
listName,
|
|
196
|
+
listRows,
|
|
197
|
+
look,
|
|
198
|
+
titleField: titleField ?? meta?.title_field,
|
|
199
|
+
facet,
|
|
200
|
+
metrics,
|
|
201
|
+
summary,
|
|
202
|
+
tabs,
|
|
203
|
+
favorites,
|
|
204
|
+
actions,
|
|
205
|
+
history,
|
|
206
|
+
slug,
|
|
207
|
+
baseURL: config?.baseURL,
|
|
208
|
+
navigate,
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
)}
|
|
212
|
+
</FrappeForm>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function RecordWithRights<TDoc extends { name: string; doctype: string }>({
|
|
217
|
+
doc,
|
|
218
|
+
meta,
|
|
219
|
+
page,
|
|
220
|
+
}: {
|
|
221
|
+
doc: Partial<TDoc>;
|
|
222
|
+
meta: Parameters<typeof useDocRights>[1];
|
|
223
|
+
page: Omit<RecordPageProps<TDoc>, "doc" | "canEdit">;
|
|
224
|
+
}) {
|
|
225
|
+
const connection = useFrappeConnection();
|
|
226
|
+
const owner = (doc as Row).owner;
|
|
227
|
+
const { rights } = useDocRights(connection, meta, {
|
|
228
|
+
owner: typeof owner === "string" ? owner : undefined,
|
|
229
|
+
});
|
|
230
|
+
return <RecordPage<TDoc> {...page} doc={doc} canEdit={Boolean(rights.write)} />;
|
|
231
|
+
}
|
|
@@ -331,12 +331,11 @@ export function FrappeReportBuilder({
|
|
|
331
331
|
{...knobProps.panelPadding}
|
|
332
332
|
alignItems="center"
|
|
333
333
|
justifyContent="center"
|
|
334
|
+
gap="$2"
|
|
334
335
|
{...stackProps}
|
|
335
336
|
>
|
|
336
337
|
<Spinner size="large" />
|
|
337
|
-
<Text color="$color10"
|
|
338
|
-
{t("Loading {{doctype}} schema...", { doctype })}
|
|
339
|
-
</Text>
|
|
338
|
+
<Text color="$color10">{t("Loading {{doctype}} schema...", { doctype })}</Text>
|
|
340
339
|
</YStack>
|
|
341
340
|
);
|
|
342
341
|
}
|
|
@@ -354,9 +353,9 @@ export function FrappeReportBuilder({
|
|
|
354
353
|
|
|
355
354
|
if (isLoading) {
|
|
356
355
|
return (
|
|
357
|
-
<YStack {...knobProps.panelPadding} alignItems="center" {...stackProps}>
|
|
356
|
+
<YStack {...knobProps.panelPadding} alignItems="center" gap="$1" {...stackProps}>
|
|
358
357
|
<Spinner size="small" />
|
|
359
|
-
<Text color="$color10" fontSize="$2"
|
|
358
|
+
<Text color="$color10" fontSize="$2">
|
|
360
359
|
{t("Loading data...")}
|
|
361
360
|
</Text>
|
|
362
361
|
</YStack>
|
package/src/FrappeReportView.tsx
CHANGED
|
@@ -349,7 +349,7 @@ export interface FrappeReportConnection {
|
|
|
349
349
|
const callCache = new Map<string, CallModule>();
|
|
350
350
|
|
|
351
351
|
function getCall(connection: FrappeReportConnection): CallModule {
|
|
352
|
-
const key = `${connection.baseURL}:${connection.auth?.token ?? ""}:${connection.auth?.type ?? ""}`;
|
|
352
|
+
const key = `${connection.baseURL}:${connection.auth?.useToken ? "t" : ""}:${connection.auth?.token ?? ""}:${connection.auth?.type ?? ""}`;
|
|
353
353
|
let call = callCache.get(key);
|
|
354
354
|
if (!call) {
|
|
355
355
|
const authConfig: AuthConfig | undefined = connection.auth
|
package/src/FrappeTreeView.tsx
CHANGED
|
@@ -398,7 +398,7 @@ export function FrappeTreeView<TDoc extends { name: string; doctype: string }>({
|
|
|
398
398
|
{valueField &&
|
|
399
399
|
node.data &&
|
|
400
400
|
(node.data as Record<string, unknown>)[valueField] != null && (
|
|
401
|
-
<Text color={formCommonColors.muted} {...knobProps.label}
|
|
401
|
+
<Text color={formCommonColors.muted} {...knobProps.label} paddingInlineStart="$2">
|
|
402
402
|
{String((node.data as Record<string, unknown>)[valueField])}
|
|
403
403
|
</Text>
|
|
404
404
|
)}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Each hook here caches its REST client per connection. Two connections to
|
|
2
|
+
// one bench that differ only in useToken must not share a client, or the
|
|
3
|
+
// first one built decides whether the other sends its token (MPO-399,
|
|
4
|
+
// MPO-406). The bench answers a tokenless call as Guest.
|
|
5
|
+
import { renderHook, waitFor } from "@testing-library/react";
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
7
|
+
import { useFrappeReport } from "./FrappeReportView";
|
|
8
|
+
import { useFrappeAggregate } from "./useFrappeAggregate";
|
|
9
|
+
import { useFrappeFacets } from "./useFrappeFacets";
|
|
10
|
+
|
|
11
|
+
const token = "token key:secret";
|
|
12
|
+
let sent: (string | null)[] = [];
|
|
13
|
+
|
|
14
|
+
function reply(url: URL): unknown {
|
|
15
|
+
const method = url.pathname.replace(/^\/api\/method\//, "");
|
|
16
|
+
if (method === "frappe.client.get_count") return { message: 3 };
|
|
17
|
+
if (method === "frappe.desk.reportview.get_sidebar_stats") return { message: { stats: {} } };
|
|
18
|
+
if (method === "frappe.desk.query_report.run") return { message: { columns: [], result: [] } };
|
|
19
|
+
return { message: [] };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
sent = [];
|
|
24
|
+
vi.stubGlobal("fetch", async (input: string | URL | Request, init?: RequestInit) => {
|
|
25
|
+
sent.push(new Headers(init?.headers).get("Authorization"));
|
|
26
|
+
return new Response(JSON.stringify(reply(new URL(String(input)))), {
|
|
27
|
+
headers: { "content-type": "application/json" },
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
33
|
+
|
|
34
|
+
function connection(baseURL: string, useToken: boolean) {
|
|
35
|
+
return { baseURL, realtime: false, auth: { useToken, token: "key:secret", type: "token" } };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function authorizationPerConnection(
|
|
39
|
+
mount: (useToken: boolean) => () => boolean,
|
|
40
|
+
): Promise<{ off: (string | null)[]; on: (string | null)[] }> {
|
|
41
|
+
const offSettled = mount(false);
|
|
42
|
+
await waitFor(() => expect(offSettled()).toBe(true));
|
|
43
|
+
const off = sent.splice(0);
|
|
44
|
+
const onSettled = mount(true);
|
|
45
|
+
await waitFor(() => expect(onSettled()).toBe(true));
|
|
46
|
+
return { off, on: sent.splice(0) };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe("cached REST clients never drop a connection's token", () => {
|
|
50
|
+
it("useFrappeAggregate", async () => {
|
|
51
|
+
const { off, on } = await authorizationPerConnection((useToken) => {
|
|
52
|
+
const { result } = renderHook(() =>
|
|
53
|
+
useFrappeAggregate(connection("http://aggregate-auth.test", useToken), {
|
|
54
|
+
doctype: "ToDo",
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
return () => !result.current.isLoading;
|
|
58
|
+
});
|
|
59
|
+
expect(off).toEqual([null]);
|
|
60
|
+
expect(on).toEqual([token]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("useFrappeFacets", async () => {
|
|
64
|
+
const { off, on } = await authorizationPerConnection((useToken) => {
|
|
65
|
+
const { result } = renderHook(() =>
|
|
66
|
+
useFrappeFacets("ToDo", [], {
|
|
67
|
+
connection: connection("http://facets-auth.test", useToken),
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
return () =>
|
|
71
|
+
!result.current.assigned.isLoading &&
|
|
72
|
+
!result.current.owner.isLoading &&
|
|
73
|
+
!result.current.tags.isLoading;
|
|
74
|
+
});
|
|
75
|
+
expect(off.length).toBeGreaterThan(0);
|
|
76
|
+
expect(new Set(off)).toEqual(new Set([null]));
|
|
77
|
+
expect(on.length).toBe(off.length);
|
|
78
|
+
expect(new Set(on)).toEqual(new Set([token]));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("useFrappeReport (FrappeReportView)", async () => {
|
|
82
|
+
const { off, on } = await authorizationPerConnection((useToken) => {
|
|
83
|
+
const { result } = renderHook(() =>
|
|
84
|
+
useFrappeReport(connection("http://report-auth.test", useToken), {
|
|
85
|
+
reportName: "ToDo Summary",
|
|
86
|
+
debounceMs: 0,
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
89
|
+
return () => !result.current.isLoading;
|
|
90
|
+
});
|
|
91
|
+
expect(off).toEqual([null]);
|
|
92
|
+
expect(on).toEqual([token]);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -3,6 +3,8 @@ import { YStack } from "tamagui";
|
|
|
3
3
|
import { FrappeProvider } from "../FrappeProvider";
|
|
4
4
|
import { DeskFormSidebar } from "./DeskFormSidebar";
|
|
5
5
|
|
|
6
|
+
// hex-escape: generated image fixtures are data, not paint
|
|
7
|
+
|
|
6
8
|
export default {
|
|
7
9
|
title: "FrappeUI/Desk/DeskFormSidebar",
|
|
8
10
|
component: DeskFormSidebar,
|