create-react-admin-template 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/README.md +46 -2
- package/bin/create.mjs +5 -0
- package/package.json +22 -4
- package/template/.dockerignore +12 -0
- package/template/.editorconfig +12 -0
- package/template/.env +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +2 -0
- package/template/.env.test +5 -0
- package/template/.github/workflows/ci.yml +40 -0
- package/template/.gitlab-ci.yml +208 -0
- package/template/.husky/commit-msg +1 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.nvmrc +1 -0
- package/template/.prettierignore +11 -0
- package/template/.prettierrc +47 -0
- package/template/Dockerfile +16 -0
- package/template/README.md +372 -0
- package/template/build/advancedTable.ts +103 -0
- package/template/build/environment.ts +150 -0
- package/template/commitlint.config.js +32 -0
- package/template/components.json +21 -0
- package/template/deploy/README.md +132 -0
- package/template/deploy/host-nginx/react-admin-api.conf +14 -0
- package/template/deploy/host-nginx/react-admin-web.conf +8 -0
- package/template/deploy/nginx.conf +38 -0
- package/template/docs/activity-status.md +217 -0
- package/template/docs/audit-logs.md +158 -0
- package/template/docs/authentication-adapters.md +219 -0
- package/template/docs/browser-security.md +58 -0
- package/template/docs/bundle-budgets.md +65 -0
- package/template/docs/component-source-governance.md +99 -0
- package/template/docs/data-masking.md +169 -0
- package/template/docs/enterprise-scaffold.md +208 -0
- package/template/docs/feature-data-template.md +227 -0
- package/template/docs/feature-flags.md +169 -0
- package/template/docs/file-capabilities.md +196 -0
- package/template/docs/locale-and-i18n.md +132 -0
- package/template/docs/mutation-idempotency.md +24 -0
- package/template/docs/optional-editors.md +203 -0
- package/template/docs/page-feedback.md +83 -0
- package/template/docs/query-data-conventions.md +178 -0
- package/template/docs/realtime-collaboration.md +140 -0
- package/template/docs/reporting-printing-templates.md +156 -0
- package/template/docs/scaffold-capability-roadmap.md +226 -0
- package/template/docs/scaffold-guide.md +443 -0
- package/template/docs/template-changelog.md +30 -0
- package/template/docs/template-versioning.md +26 -0
- package/template/docs/tenant-workspace-context.md +147 -0
- package/template/docs/unsaved-changes.md +58 -0
- package/template/docs/white-label.md +102 -0
- package/template/eslint.config.js +697 -0
- package/template/gitignore +39 -0
- package/template/index.html +26 -0
- package/template/knip.config.ts +42 -0
- package/template/lint-staged.config.js +8 -0
- package/template/package.json +133 -0
- package/template/pnpm-lock.yaml +8694 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/logo.svg +1 -0
- package/template/public/runtime-config.json +49 -0
- package/template/scaffold.template.json +5 -0
- package/template/src/Application.tsx +114 -0
- package/template/src/api/ApiError.ts +33 -0
- package/template/src/api/activity/ActivityProvider.tsx +167 -0
- package/template/src/api/activity/access.ts +13 -0
- package/template/src/api/activity/errors.ts +17 -0
- package/template/src/api/activity/index.ts +67 -0
- package/template/src/api/activity/model.ts +227 -0
- package/template/src/api/activity/query.ts +163 -0
- package/template/src/api/activity/source.ts +16 -0
- package/template/src/api/activity/subscription.ts +292 -0
- package/template/src/api/activity/transports.ts +271 -0
- package/template/src/api/activity/types.ts +402 -0
- package/template/src/api/authClient.ts +134 -0
- package/template/src/api/authSession.ts +307 -0
- package/template/src/api/clients/configureApiClient.ts +62 -0
- package/template/src/api/clients/httpStatus.ts +4 -0
- package/template/src/api/config/services.json +7 -0
- package/template/src/api/demoAuthClient.ts +46 -0
- package/template/src/api/enums/EnumCatalogProvider.tsx +169 -0
- package/template/src/api/enums/EnumDictionary.ts +55 -0
- package/template/src/api/enums/access.ts +130 -0
- package/template/src/api/enums/catalog.ts +216 -0
- package/template/src/api/enums/errors.ts +21 -0
- package/template/src/api/enums/index.ts +48 -0
- package/template/src/api/enums/query.ts +82 -0
- package/template/src/api/enums/scope.ts +58 -0
- package/template/src/api/enums/types.ts +251 -0
- package/template/src/api/hooks/error.ts +198 -0
- package/template/src/api/hooks/index.ts +4 -0
- package/template/src/api/hooks/request.ts +99 -0
- package/template/src/api/hooks/requestId.ts +65 -0
- package/template/src/api/hooks/response.ts +22 -0
- package/template/src/api/hooks/types.ts +20 -0
- package/template/src/api/idempotency/index.ts +1 -0
- package/template/src/api/idempotency/key.ts +23 -0
- package/template/src/api/index.ts +14 -0
- package/template/src/api/metadata/MetadataProvider.tsx +37 -0
- package/template/src/api/metadata/index.ts +2 -0
- package/template/src/api/metadata/types.ts +30 -0
- package/template/src/api/parameters/GlobalParameterProvider.tsx +210 -0
- package/template/src/api/parameters/access.ts +117 -0
- package/template/src/api/parameters/catalog.ts +170 -0
- package/template/src/api/parameters/errors.ts +21 -0
- package/template/src/api/parameters/index.ts +53 -0
- package/template/src/api/parameters/query.ts +84 -0
- package/template/src/api/parameters/scope.ts +58 -0
- package/template/src/api/parameters/types.ts +214 -0
- package/template/src/api/query/index.ts +13 -0
- package/template/src/api/query/keys.ts +155 -0
- package/template/src/api/query/mutation.ts +48 -0
- package/template/src/api/query/react.ts +36 -0
- package/template/src/api/query/scope.ts +38 -0
- package/template/src/api/query/types.ts +147 -0
- package/template/src/api/types.ts +144 -0
- package/template/src/application/types.ts +52 -0
- package/template/src/auditLogs/errors.ts +17 -0
- package/template/src/auditLogs/export.ts +85 -0
- package/template/src/auditLogs/index.ts +54 -0
- package/template/src/auditLogs/model.ts +526 -0
- package/template/src/auditLogs/query.ts +113 -0
- package/template/src/auditLogs/react.ts +36 -0
- package/template/src/auditLogs/source.ts +51 -0
- package/template/src/auditLogs/types.ts +357 -0
- package/template/src/authentication/controller.ts +351 -0
- package/template/src/authentication/index.ts +8 -0
- package/template/src/authentication/redirect.ts +72 -0
- package/template/src/authentication/types.ts +300 -0
- package/template/src/bootstrap.tsx +96 -0
- package/template/src/components/AppDataTable/AppDataTable.tsx +74 -0
- package/template/src/components/AppDataTable/index.ts +2 -0
- package/template/src/components/AppDataTable/types.ts +27 -0
- package/template/src/components/AppDialog/AppConfirmDialog.tsx +44 -0
- package/template/src/components/AppDialog/AppDialog.tsx +113 -0
- package/template/src/components/AppDialog/index.ts +3 -0
- package/template/src/components/AppDialog/messages.tsx +22 -0
- package/template/src/components/AppDialog/types.ts +53 -0
- package/template/src/components/AppPageForm/AppPageForm.tsx +21 -0
- package/template/src/components/AppPageForm/PageForm.tsx +765 -0
- package/template/src/components/AppPageForm/SOURCE.md +26 -0
- package/template/src/components/AppPageForm/config.ts +253 -0
- package/template/src/components/AppPageForm/controller.ts +580 -0
- package/template/src/components/AppPageForm/index.ts +2 -0
- package/template/src/components/AppPageForm/messages.ts +90 -0
- package/template/src/components/AppPageForm/optionUtils.ts +91 -0
- package/template/src/components/AppPageForm/options.ts +397 -0
- package/template/src/components/AppPageForm/query.ts +44 -0
- package/template/src/components/AppPageForm/style.css +119 -0
- package/template/src/components/AppPageForm/types.ts +632 -0
- package/template/src/components/AppPageForm/validation.ts +233 -0
- package/template/src/components/AppTable/AppTable.tsx +26 -0
- package/template/src/components/AppTable/SOURCE.md +72 -0
- package/template/src/components/AppTable/cell/customCell/TableCellLayer.tsx +73 -0
- package/template/src/components/AppTable/cell/customCell/actions/ActionDropdownCell.tsx +104 -0
- package/template/src/components/AppTable/cell/customCell/cellLayer.ts +358 -0
- package/template/src/components/AppTable/cell/customCell/componentProps.ts +30 -0
- package/template/src/components/AppTable/cell/customCell/date/TemporalPickerEditor.tsx +54 -0
- package/template/src/components/AppTable/cell/customCell/index.ts +2 -0
- package/template/src/components/AppTable/cell/customCell/select/SelectCellEditor.tsx +225 -0
- package/template/src/components/AppTable/cell/customCell/tableCellLayer.css +20 -0
- package/template/src/components/AppTable/cell/customCell/tooltip/TooltipCell.tsx +45 -0
- package/template/src/components/AppTable/cell/customCell/types.ts +63 -0
- package/template/src/components/AppTable/cell/customCell/useCellLayerLifecycle.ts +111 -0
- package/template/src/components/AppTable/cell/frameworkCell/TableCellComponentLayer.tsx +40 -0
- package/template/src/components/AppTable/cell/frameworkCell/cellComponentSession.ts +203 -0
- package/template/src/components/AppTable/cell/frameworkCell/index.ts +3 -0
- package/template/src/components/AppTable/cell/index.ts +2 -0
- package/template/src/components/AppTable/columns/TableColumnEditor.tsx +257 -0
- package/template/src/components/AppTable/columns/index.ts +1 -0
- package/template/src/components/AppTable/columns/useTableColumnPreferenceActions.ts +85 -0
- package/template/src/components/AppTable/config/defaults.ts +46 -0
- package/template/src/components/AppTable/config/index.ts +2 -0
- package/template/src/components/AppTable/config/license.ts +39 -0
- package/template/src/components/AppTable/config/resolver.ts +25 -0
- package/template/src/components/AppTable/config/types.ts +377 -0
- package/template/src/components/AppTable/engine/bottom/index.ts +1 -0
- package/template/src/components/AppTable/engine/bottom/types.ts +14 -0
- package/template/src/components/AppTable/engine/cell/constants.ts +32 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/renderer.ts +162 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/renderer.ts +116 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorBounds.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorTrigger.ts +46 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/layerEditor.ts +244 -0
- package/template/src/components/AppTable/engine/cell/customCell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/columnRenderer.ts +245 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/confirmInput.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/display.ts +78 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/itemList.ts +60 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/links.ts +131 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/selection.ts +41 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/shared.ts +71 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/step.ts +37 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/switch.ts +45 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/renderer.ts +33 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/tooltip.ts +94 -0
- package/template/src/components/AppTable/engine/cell/customCell/types.ts +82 -0
- package/template/src/components/AppTable/engine/cell/formatting.ts +355 -0
- package/template/src/components/AppTable/engine/cell/formula.ts +145 -0
- package/template/src/components/AppTable/engine/cell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/multiSelect.ts +96 -0
- package/template/src/components/AppTable/engine/cell/options.ts +339 -0
- package/template/src/components/AppTable/engine/cell/types.ts +53 -0
- package/template/src/components/AppTable/engine/columns/column.ts +430 -0
- package/template/src/components/AppTable/engine/columns/config/columns.ts +33 -0
- package/template/src/components/AppTable/engine/columns/config/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/config/mutation.ts +138 -0
- package/template/src/components/AppTable/engine/columns/config/temporal.ts +11 -0
- package/template/src/components/AppTable/engine/columns/config/validation.ts +106 -0
- package/template/src/components/AppTable/engine/columns/constants.ts +6 -0
- package/template/src/components/AppTable/engine/columns/gridColumns.ts +332 -0
- package/template/src/components/AppTable/engine/columns/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/rendererPolicies.ts +129 -0
- package/template/src/components/AppTable/engine/component/resolver.ts +272 -0
- package/template/src/components/AppTable/engine/component/types.ts +384 -0
- package/template/src/components/AppTable/engine/config/constants.ts +33 -0
- package/template/src/components/AppTable/engine/config/grid/compiler.ts +65 -0
- package/template/src/components/AppTable/engine/config/grid/defaults.ts +82 -0
- package/template/src/components/AppTable/engine/config/grid/ownership.ts +35 -0
- package/template/src/components/AppTable/engine/config/grid/runtimeDelta.ts +34 -0
- package/template/src/components/AppTable/engine/config/grid/types.ts +30 -0
- package/template/src/components/AppTable/engine/pagination/config.ts +75 -0
- package/template/src/components/AppTable/engine/pagination/constants.ts +5 -0
- package/template/src/components/AppTable/engine/pagination/index.ts +3 -0
- package/template/src/components/AppTable/engine/pagination/types.ts +70 -0
- package/template/src/components/AppTable/engine/preference/index.ts +2 -0
- package/template/src/components/AppTable/engine/preference/preference.ts +535 -0
- package/template/src/components/AppTable/engine/preference/types.ts +28 -0
- package/template/src/components/AppTable/engine/right/index.ts +1 -0
- package/template/src/components/AppTable/engine/right/types.ts +18 -0
- package/template/src/components/AppTable/engine/search/config.ts +64 -0
- package/template/src/components/AppTable/engine/search/constants.ts +8 -0
- package/template/src/components/AppTable/engine/search/index.ts +7 -0
- package/template/src/components/AppTable/engine/search/localQuery.ts +145 -0
- package/template/src/components/AppTable/engine/search/query.ts +203 -0
- package/template/src/components/AppTable/engine/search/remoteQuery.ts +99 -0
- package/template/src/components/AppTable/engine/search/searchInteraction.ts +46 -0
- package/template/src/components/AppTable/engine/search/types.ts +155 -0
- package/template/src/components/AppTable/engine/selection/config.ts +13 -0
- package/template/src/components/AppTable/engine/selection/index.ts +4 -0
- package/template/src/components/AppTable/engine/selection/selection.ts +357 -0
- package/template/src/components/AppTable/engine/selection/selectionHeader.ts +88 -0
- package/template/src/components/AppTable/engine/selection/types.ts +66 -0
- package/template/src/components/AppTable/engine/shared/action.ts +11 -0
- package/template/src/components/AppTable/engine/shared/constants.ts +2 -0
- package/template/src/components/AppTable/engine/shared/decimal.ts +114 -0
- package/template/src/components/AppTable/engine/shared/feedback.ts +62 -0
- package/template/src/components/AppTable/engine/shared/index.ts +13 -0
- package/template/src/components/AppTable/engine/shared/interaction.ts +55 -0
- package/template/src/components/AppTable/engine/shared/messages.ts +161 -0
- package/template/src/components/AppTable/engine/shared/row.ts +32 -0
- package/template/src/components/AppTable/engine/shared/scheduler.ts +17 -0
- package/template/src/components/AppTable/engine/shared/tableKey.ts +31 -0
- package/template/src/components/AppTable/engine/shared/theme.ts +196 -0
- package/template/src/components/AppTable/engine/shared/treeRows.ts +155 -0
- package/template/src/components/AppTable/engine/shared/types.ts +58 -0
- package/template/src/components/AppTable/engine/shared/valueSnapshot.ts +46 -0
- package/template/src/components/AppTable/engine/summary/config/export.ts +117 -0
- package/template/src/components/AppTable/engine/summary/config/index.ts +3 -0
- package/template/src/components/AppTable/engine/summary/config/summary.ts +62 -0
- package/template/src/components/AppTable/engine/summary/config/types.ts +93 -0
- package/template/src/components/AppTable/engine/summary/constants.ts +13 -0
- package/template/src/components/AppTable/engine/summary/excelJs.ts +133 -0
- package/template/src/components/AppTable/engine/summary/export.ts +311 -0
- package/template/src/components/AppTable/engine/summary/index.ts +6 -0
- package/template/src/components/AppTable/engine/summary/selectionSum.ts +92 -0
- package/template/src/components/AppTable/engine/summary/summary.ts +457 -0
- package/template/src/components/AppTable/engine/table/clipboard/index.ts +1 -0
- package/template/src/components/AppTable/engine/table/clipboard/transfer.ts +9 -0
- package/template/src/components/AppTable/engine/table/controller/TableController.ts +802 -0
- package/template/src/components/AppTable/engine/table/controller/errors.ts +106 -0
- package/template/src/components/AppTable/engine/table/controller/index.ts +4 -0
- package/template/src/components/AppTable/engine/table/controller/latestAbortableTask.ts +33 -0
- package/template/src/components/AppTable/engine/table/controller/tableDataReplacement.ts +60 -0
- package/template/src/components/AppTable/engine/table/controller/tableDomainConfiguration.ts +94 -0
- package/template/src/components/AppTable/engine/table/controller/tableEditingCommands.ts +163 -0
- package/template/src/components/AppTable/engine/table/controller/tableGridHost.ts +324 -0
- package/template/src/components/AppTable/engine/table/controller/tableIdentity.ts +68 -0
- package/template/src/components/AppTable/engine/table/controller/tableMutationPipeline.ts +79 -0
- package/template/src/components/AppTable/engine/table/controller/tableQueryCoordinator.ts +187 -0
- package/template/src/components/AppTable/engine/table/controller/tableReportingCoordinator.ts +143 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveCoordinator.ts +227 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveValidation.ts +29 -0
- package/template/src/components/AppTable/engine/table/controller/tableSnapshot.ts +58 -0
- package/template/src/components/AppTable/engine/table/controller/types.ts +202 -0
- package/template/src/components/AppTable/engine/table/editing/baselineStore.ts +134 -0
- package/template/src/components/AppTable/engine/table/editing/changeSet.ts +492 -0
- package/template/src/components/AppTable/engine/table/editing/changeSetSettlement.ts +633 -0
- package/template/src/components/AppTable/engine/table/editing/commitResultIndex.ts +75 -0
- package/template/src/components/AppTable/engine/table/editing/constants.ts +15 -0
- package/template/src/components/AppTable/engine/table/editing/dirtyCellIndex.ts +96 -0
- package/template/src/components/AppTable/engine/table/editing/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/editing/mutation.ts +173 -0
- package/template/src/components/AppTable/engine/table/editing/rowKey.ts +10 -0
- package/template/src/components/AppTable/engine/table/editing/types.ts +404 -0
- package/template/src/components/AppTable/engine/table/editing/validation.ts +452 -0
- package/template/src/components/AppTable/engine/table/grid/cellMeta.ts +90 -0
- package/template/src/components/AppTable/engine/table/grid/handsontable.ts +25 -0
- package/template/src/components/AppTable/engine/table/grid/handsontableExtensions.d.ts +26 -0
- package/template/src/components/AppTable/engine/table/grid/index.ts +5 -0
- package/template/src/components/AppTable/engine/table/grid/moduleRegistry.ts +39 -0
- package/template/src/components/AppTable/engine/table/grid/runtime.ts +31 -0
- package/template/src/components/AppTable/engine/table/grid/types.ts +25 -0
- package/template/src/components/AppTable/engine/table/hooks/fixedEndHooks.ts +44 -0
- package/template/src/components/AppTable/engine/table/hooks/gridHooks.ts +108 -0
- package/template/src/components/AppTable/engine/table/hooks/headerHooks.ts +103 -0
- package/template/src/components/AppTable/engine/table/hooks/index.ts +3 -0
- package/template/src/components/AppTable/engine/table/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/layout/constants.ts +2 -0
- package/template/src/components/AppTable/engine/table/layout/dropdownMenu.ts +89 -0
- package/template/src/components/AppTable/engine/table/layout/fixedColumns.ts +44 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlay.ts +90 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayAccessibility.ts +104 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayRenderer.ts +690 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlaySignature.ts +58 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndRuntime.ts +137 -0
- package/template/src/components/AppTable/engine/table/layout/handsontableDomAdapter.ts +40 -0
- package/template/src/components/AppTable/engine/table/layout/height.ts +72 -0
- package/template/src/components/AppTable/engine/table/layout/index.ts +14 -0
- package/template/src/components/AppTable/engine/table/layout/layoutScheduler.ts +60 -0
- package/template/src/components/AppTable/engine/table/layout/mergeCells.ts +146 -0
- package/template/src/components/AppTable/engine/table/layout/nestedHeaders.ts +271 -0
- package/template/src/components/AppTable/engine/table/layout/types.ts +10 -0
- package/template/src/components/AppTable/engine/toolbar/index.ts +1 -0
- package/template/src/components/AppTable/engine/toolbar/types.ts +56 -0
- package/template/src/components/AppTable/index.ts +11 -0
- package/template/src/components/AppTable/messages.ts +256 -0
- package/template/src/components/AppTable/pagination/TablePaginationBar.tsx +193 -0
- package/template/src/components/AppTable/pagination/index.ts +1 -0
- package/template/src/components/AppTable/pagination/paginationItems.ts +56 -0
- package/template/src/components/AppTable/preference/index.ts +1 -0
- package/template/src/components/AppTable/preference/useTablePreference.ts +208 -0
- package/template/src/components/AppTable/reporting/index.ts +1 -0
- package/template/src/components/AppTable/reporting/useTableReporting.ts +342 -0
- package/template/src/components/AppTable/search/TableSearchBar.tsx +301 -0
- package/template/src/components/AppTable/search/TableSearchConditionEditor.tsx +254 -0
- package/template/src/components/AppTable/search/TableSearchField.tsx +338 -0
- package/template/src/components/AppTable/search/TableSearchFields.tsx +65 -0
- package/template/src/components/AppTable/search/constants.ts +9 -0
- package/template/src/components/AppTable/search/index.ts +3 -0
- package/template/src/components/AppTable/search/tableSearchBar.css +164 -0
- package/template/src/components/AppTable/search/types.ts +7 -0
- package/template/src/components/AppTable/search/useTableQuery.ts +373 -0
- package/template/src/components/AppTable/selection/index.ts +1 -0
- package/template/src/components/AppTable/selection/useTableSelection.ts +188 -0
- package/template/src/components/AppTable/sensitiveData.tsx +41 -0
- package/template/src/components/AppTable/shared/styles.ts +2 -0
- package/template/src/components/AppTable/styles/index.css +6 -0
- package/template/src/components/AppTable/styles/tableComponent.css +297 -0
- package/template/src/components/AppTable/styles/theme.css +133 -0
- package/template/src/components/AppTable/table/components/TableComponent.tsx +567 -0
- package/template/src/components/AppTable/table/components/TableErrorFeedback.tsx +36 -0
- package/template/src/components/AppTable/table/components/TableGridViewport.tsx +85 -0
- package/template/src/components/AppTable/table/components/index.ts +2 -0
- package/template/src/components/AppTable/table/components/types.ts +90 -0
- package/template/src/components/AppTable/table/controller/configuration.ts +89 -0
- package/template/src/components/AppTable/table/controller/index.ts +2 -0
- package/template/src/components/AppTable/table/controller/useTableController.ts +155 -0
- package/template/src/components/AppTable/table/controller/useTableLifecycle.ts +97 -0
- package/template/src/components/AppTable/table/grid/index.ts +1 -0
- package/template/src/components/AppTable/table/grid/useTableGrid.ts +857 -0
- package/template/src/components/AppTable/table/grid/useTableGridRuntimeSettings.ts +49 -0
- package/template/src/components/AppTable/table/index.ts +4 -0
- package/template/src/components/AppTable/table/layout/TablePanels.tsx +389 -0
- package/template/src/components/AppTable/table/layout/index.ts +7 -0
- package/template/src/components/AppTable/table/layout/types.ts +3 -0
- package/template/src/components/AppTable/table/layout/useResizablePanel.ts +213 -0
- package/template/src/components/AppTable/table/layout/useTableAdaptiveHeight.ts +238 -0
- package/template/src/components/AppTable/table/layout/useTablePanels.ts +329 -0
- package/template/src/components/AppTable/table/layout/useTableTheme.ts +123 -0
- package/template/src/components/AppTable/toolbar/TableToolbar.tsx +336 -0
- package/template/src/components/AppTable/toolbar/index.ts +1 -0
- package/template/src/components/BrandLogo/BrandLogo.tsx +41 -0
- package/template/src/components/BrandLogo/index.ts +1 -0
- package/template/src/components/Can/Can.tsx +19 -0
- package/template/src/components/Can/index.ts +7 -0
- package/template/src/components/Can/types.ts +41 -0
- package/template/src/components/EnumBadge/EnumBadge.tsx +44 -0
- package/template/src/components/EnumBadge/index.ts +2 -0
- package/template/src/components/EnumBadge/types.ts +16 -0
- package/template/src/components/EnumText/EnumText.tsx +33 -0
- package/template/src/components/EnumText/index.ts +2 -0
- package/template/src/components/EnumText/types.ts +13 -0
- package/template/src/components/FilePreview/FilePreview.tsx +120 -0
- package/template/src/components/FilePreview/index.ts +11 -0
- package/template/src/components/FilePreview/preview.ts +88 -0
- package/template/src/components/FilePreview/types.ts +91 -0
- package/template/src/components/FileUpload/FileUpload.tsx +172 -0
- package/template/src/components/FileUpload/index.ts +2 -0
- package/template/src/components/FileUpload/types.ts +32 -0
- package/template/src/components/JsonEditor/JsonEditor.tsx +103 -0
- package/template/src/components/JsonEditor/index.ts +1 -0
- package/template/src/components/JsonEditor/types.ts +14 -0
- package/template/src/components/PageFeedback/PageFeedback.tsx +194 -0
- package/template/src/components/PageFeedback/index.ts +10 -0
- package/template/src/components/PageFeedback/types.ts +31 -0
- package/template/src/components/PasswordInput/PasswordInput.tsx +50 -0
- package/template/src/components/PasswordInput/index.ts +1 -0
- package/template/src/components/RouteDialog/RouteDialog.tsx +20 -0
- package/template/src/components/RouteDialog/index.ts +2 -0
- package/template/src/components/RouteDialog/types.ts +8 -0
- package/template/src/components/RouteDialog/useRouteDialogNavigation.ts +30 -0
- package/template/src/components/SensitiveData/SensitiveData.tsx +337 -0
- package/template/src/components/SensitiveData/index.ts +2 -0
- package/template/src/components/SensitiveData/types.ts +31 -0
- package/template/src/components/StatusBadge/StatusBadge.tsx +28 -0
- package/template/src/components/StatusBadge/index.ts +2 -0
- package/template/src/components/StatusBadge/statusBadgeStyles.ts +30 -0
- package/template/src/components/StatusBadge/types.ts +7 -0
- package/template/src/components/layout/AppHeader/AppHeader.tsx +57 -0
- package/template/src/components/layout/AppHeader/HeaderSearch.tsx +160 -0
- package/template/src/components/layout/AppHeader/HeaderUserMenu.tsx +59 -0
- package/template/src/components/layout/AppHeader/ThemeControls.tsx +44 -0
- package/template/src/components/layout/AppHeader/index.ts +1 -0
- package/template/src/components/layout/AppHeader/themeOptions.ts +13 -0
- package/template/src/components/layout/AppSidebar.tsx +268 -0
- package/template/src/components/layout/PageContainer.tsx +16 -0
- package/template/src/components/ui/avatar.tsx +108 -0
- package/template/src/components/ui/badge.tsx +47 -0
- package/template/src/components/ui/button.tsx +63 -0
- package/template/src/components/ui/card.tsx +60 -0
- package/template/src/components/ui/checkbox.tsx +31 -0
- package/template/src/components/ui/collapsible.tsx +33 -0
- package/template/src/components/ui/command.tsx +181 -0
- package/template/src/components/ui/dialog.tsx +157 -0
- package/template/src/components/ui/dropdown-menu.tsx +254 -0
- package/template/src/components/ui/form.tsx +141 -0
- package/template/src/components/ui/input.tsx +20 -0
- package/template/src/components/ui/label.tsx +23 -0
- package/template/src/components/ui/pagination.tsx +127 -0
- package/template/src/components/ui/popover.tsx +41 -0
- package/template/src/components/ui/select.tsx +187 -0
- package/template/src/components/ui/separator.tsx +25 -0
- package/template/src/components/ui/sheet.tsx +142 -0
- package/template/src/components/ui/sidebar.tsx +878 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/sonner.tsx +33 -0
- package/template/src/components/ui/tooltip.tsx +54 -0
- package/template/src/config/RuntimeConfigErrorPage.tsx +48 -0
- package/template/src/config/appConfig.ts +126 -0
- package/template/src/config/buildInfo.ts +8 -0
- package/template/src/config/observabilityAdapter.ts +8 -0
- package/template/src/config/runtimeConfig.ts +360 -0
- package/template/src/config/types.ts +195 -0
- package/template/src/context/ThemeProvider.tsx +84 -0
- package/template/src/context/UnsavedChangesProvider.tsx +123 -0
- package/template/src/context/applicationScope.ts +39 -0
- package/template/src/context/types.ts +41 -0
- package/template/src/dataMasking/index.ts +14 -0
- package/template/src/dataMasking/masking.ts +139 -0
- package/template/src/dataMasking/types.ts +144 -0
- package/template/src/featureFlags/FeatureFlagProvider.tsx +143 -0
- package/template/src/featureFlags/FeatureGate.tsx +12 -0
- package/template/src/featureFlags/catalog.ts +140 -0
- package/template/src/featureFlags/errors.ts +17 -0
- package/template/src/featureFlags/index.ts +43 -0
- package/template/src/featureFlags/query.ts +103 -0
- package/template/src/featureFlags/registry.ts +149 -0
- package/template/src/featureFlags/scope.ts +27 -0
- package/template/src/featureFlags/types.ts +241 -0
- package/template/src/features/auth/AuthLayout.tsx +17 -0
- package/template/src/features/auth/index.ts +2 -0
- package/template/src/features/auth/signIn/components/UserAuthForm.tsx +121 -0
- package/template/src/features/auth/signIn/index.tsx +71 -0
- package/template/src/features/auth/signIn/messages.ts +37 -0
- package/template/src/features/auth/signIn/types.ts +4 -0
- package/template/src/features/errors/ForbiddenError.tsx +34 -0
- package/template/src/features/errors/GeneralError.tsx +46 -0
- package/template/src/features/errors/MaintenanceError.tsx +31 -0
- package/template/src/features/errors/NotFoundError.tsx +34 -0
- package/template/src/features/errors/RouteError.tsx +72 -0
- package/template/src/features/errors/UnauthorizedError.tsx +34 -0
- package/template/src/features/errors/index.ts +6 -0
- package/template/src/features/errors/messages.ts +56 -0
- package/template/src/features/home/index.tsx +107 -0
- package/template/src/features/home/messages.ts +59 -0
- package/template/src/features/showcase/AccessShowcasePage.tsx +284 -0
- package/template/src/features/showcase/AdvancedTableDemo.tsx +120 -0
- package/template/src/features/showcase/FeedbackShowcasePage.tsx +142 -0
- package/template/src/features/showcase/FileShowcasePage.tsx +110 -0
- package/template/src/features/showcase/FormShowcasePage.tsx +156 -0
- package/template/src/features/showcase/MetadataShowcasePage.tsx +241 -0
- package/template/src/features/showcase/ShowcasePageHeader.tsx +24 -0
- package/template/src/features/showcase/TableShowcasePage.tsx +436 -0
- package/template/src/features/showcase/accessMessages.ts +67 -0
- package/template/src/features/showcase/index.ts +6 -0
- package/template/src/features/showcase/messages.ts +192 -0
- package/template/src/files/download.ts +82 -0
- package/template/src/files/errors.ts +15 -0
- package/template/src/files/filename.ts +61 -0
- package/template/src/files/index.ts +38 -0
- package/template/src/files/types.ts +299 -0
- package/template/src/files/useFileTask.ts +153 -0
- package/template/src/files/useFileUpload.ts +117 -0
- package/template/src/files/validation.ts +109 -0
- package/template/src/layouts/AppLayout.tsx +37 -0
- package/template/src/lib/accessControl.ts +42 -0
- package/template/src/lib/navigationRedirect.ts +26 -0
- package/template/src/lib/utils.ts +6 -0
- package/template/src/locale/LocaleProvider.tsx +37 -0
- package/template/src/locale/context.ts +15 -0
- package/template/src/locale/formatters.ts +123 -0
- package/template/src/locale/hooks.ts +35 -0
- package/template/src/locale/index.ts +17 -0
- package/template/src/locale/messages.ts +151 -0
- package/template/src/locale/types.ts +167 -0
- package/template/src/main.tsx +5 -0
- package/template/src/observability/browser.ts +37 -0
- package/template/src/observability/consoleAdapter.ts +18 -0
- package/template/src/observability/index.ts +26 -0
- package/template/src/observability/observer.ts +118 -0
- package/template/src/observability/redaction.ts +85 -0
- package/template/src/observability/types.ts +119 -0
- package/template/src/optionalEditors/controller.ts +327 -0
- package/template/src/optionalEditors/errors.ts +21 -0
- package/template/src/optionalEditors/index.ts +35 -0
- package/template/src/optionalEditors/model.ts +253 -0
- package/template/src/optionalEditors/react.ts +89 -0
- package/template/src/optionalEditors/types.ts +254 -0
- package/template/src/permissions/index.ts +3 -0
- package/template/src/permissions/types.ts +5 -0
- package/template/src/permissions/usePermission.ts +16 -0
- package/template/src/realtimeCollaboration/controller.ts +355 -0
- package/template/src/realtimeCollaboration/errors.ts +20 -0
- package/template/src/realtimeCollaboration/index.ts +39 -0
- package/template/src/realtimeCollaboration/model.ts +212 -0
- package/template/src/realtimeCollaboration/react.ts +72 -0
- package/template/src/realtimeCollaboration/types.ts +251 -0
- package/template/src/reporting/errors.ts +21 -0
- package/template/src/reporting/generation.ts +87 -0
- package/template/src/reporting/index.ts +42 -0
- package/template/src/reporting/model.ts +373 -0
- package/template/src/reporting/print.ts +16 -0
- package/template/src/reporting/query.ts +50 -0
- package/template/src/reporting/react.ts +17 -0
- package/template/src/reporting/source.ts +13 -0
- package/template/src/reporting/types.ts +219 -0
- package/template/src/router/RootRouteLayout.tsx +11 -0
- package/template/src/router/authLifecycle.ts +39 -0
- package/template/src/router/config.ts +293 -0
- package/template/src/router/interceptors.ts +48 -0
- package/template/src/router/lazyRouteComponents.ts +78 -0
- package/template/src/router/messages.ts +48 -0
- package/template/src/router/navigation.ts +167 -0
- package/template/src/router/router.ts +66 -0
- package/template/src/router/searchSchemas.ts +9 -0
- package/template/src/router/types.ts +76 -0
- package/template/src/stores/authSessionStorage.ts +27 -0
- package/template/src/stores/authStore.ts +165 -0
- package/template/src/stores/types.ts +36 -0
- package/template/src/stores/uiPreferenceStore.ts +34 -0
- package/template/src/styles/index.css +141 -0
- package/template/src/styles/theme.css +213 -0
- package/template/src/tenantWorkspace/TenantWorkspaceProvider.tsx +102 -0
- package/template/src/tenantWorkspace/index.ts +33 -0
- package/template/src/tenantWorkspace/store.ts +184 -0
- package/template/src/tenantWorkspace/switch.ts +206 -0
- package/template/src/tenantWorkspace/types.ts +155 -0
- package/template/src/vite-env.d.ts +20 -0
- package/template/stylelint.config.js +28 -0
- package/template/tests/integration/Application.test.tsx +269 -0
- package/template/tests/integration/layout/AppHeader.test.tsx +182 -0
- package/template/tests/integration/layout/AppSidebar.test.tsx +121 -0
- package/template/tests/integration/layout/__screenshots__/AppHeader.test.tsx/AppHeader-command-search-hides-the-duplicate-header-trigger-when-the-desktop-sidebar-collapses-1.png +0 -0
- package/template/tests/integration/router/__screenshots__/config.test.ts/route-tree-authentication-boundaries-exposes-only-scaffold-navigation-metadata-1.png +0 -0
- package/template/tests/integration/router/config.test.ts +123 -0
- package/template/tests/integration/router/interceptors.test.ts +100 -0
- package/template/tests/setup/accessibility.ts +25 -0
- package/template/tests/setup/runtimeConfig.ts +3 -0
- package/template/tests/unit/api/ApiError.test.ts +25 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-clears-the-session-if-a-refresh-identity-loses-administrator-access-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-creates-a-session-from-the-generated-login-response-for-an-admin-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-rejects-and-revokes-the-generated-login-result-for-an-ordinary-user-1.png +0 -0
- package/template/tests/unit/api/activity/ActivityProvider.test.tsx +131 -0
- package/template/tests/unit/api/activity/__screenshots__/transports.test.ts/activity-transport-adapters-polls-sequentially-and-advances-the-last-event-ID-1.png +0 -0
- package/template/tests/unit/api/activity/modelAndQuery.test.ts +144 -0
- package/template/tests/unit/api/activity/subscription.test.ts +103 -0
- package/template/tests/unit/api/activity/transports.test.ts +145 -0
- package/template/tests/unit/api/authClient.test.ts +110 -0
- package/template/tests/unit/api/authSession.test.ts +289 -0
- package/template/tests/unit/api/clients/configureApiClient.test.ts +198 -0
- package/template/tests/unit/api/demoAuthClient.test.ts +47 -0
- package/template/tests/unit/api/enums/access.test.ts +107 -0
- package/template/tests/unit/api/enums/catalog.test.ts +200 -0
- package/template/tests/unit/api/enums/query.test.ts +110 -0
- package/template/tests/unit/api/enums/useEnum.test.tsx +98 -0
- package/template/tests/unit/api/enums/useEnumCatalog.test.tsx +68 -0
- package/template/tests/unit/api/hooks/error.test.ts +168 -0
- package/template/tests/unit/api/hooks/request.test.ts +170 -0
- package/template/tests/unit/api/hooks/response.test.ts +46 -0
- package/template/tests/unit/api/metadata/MetadataProvider.test.tsx +102 -0
- package/template/tests/unit/api/parameters/catalog.test.ts +147 -0
- package/template/tests/unit/api/parameters/query.test.ts +78 -0
- package/template/tests/unit/api/parameters/useGlobalParameter.test.tsx +89 -0
- package/template/tests/unit/api/query/queryPolicy.test.ts +245 -0
- package/template/tests/unit/api/query/useAppQueryScope.test.tsx +74 -0
- package/template/tests/unit/auditLogs/auditLogHooks.test.tsx +194 -0
- package/template/tests/unit/auditLogs/auditLogs.test.ts +199 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-completes-Step-up-callbacks-without-creating-a-second-login-result-1.png +0 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-moves-from-challenge-to-completion-without-retaining-tokens-in-snapshot-1.png +0 -0
- package/template/tests/unit/authentication/authentication.test.ts +376 -0
- package/template/tests/unit/components/AppDialog.test.tsx +225 -0
- package/template/tests/unit/components/AppTable.test.tsx +129 -0
- package/template/tests/unit/components/AppTableLayoutTransition.test.ts +118 -0
- package/template/tests/unit/components/AppTableLocalization.test.ts +58 -0
- package/template/tests/unit/components/AppTableSensitiveData.test.ts +35 -0
- package/template/tests/unit/components/AppTableUpgrade.test.tsx +179 -0
- package/template/tests/unit/components/AppTableUpgradeCore.test.ts +258 -0
- package/template/tests/unit/components/BrandLogo.test.tsx +24 -0
- package/template/tests/unit/components/Can.test.tsx +80 -0
- package/template/tests/unit/components/Dialog.test.tsx +56 -0
- package/template/tests/unit/components/EnumPresentation.test.tsx +64 -0
- package/template/tests/unit/components/FilePreviewEngine.test.ts +51 -0
- package/template/tests/unit/components/JsonEditor.test.tsx +47 -0
- package/template/tests/unit/components/LocalizedSharedComponents.test.tsx +36 -0
- package/template/tests/unit/components/OverlayLayer.test.tsx +151 -0
- package/template/tests/unit/components/PageFeedback.test.tsx +143 -0
- package/template/tests/unit/components/PageForm.test.tsx +272 -0
- package/template/tests/unit/components/PageFormCore.test.ts +74 -0
- package/template/tests/unit/components/PasswordInput.test.tsx +105 -0
- package/template/tests/unit/components/ScaffoldComponents.test.tsx +64 -0
- package/template/tests/unit/components/SensitiveData.test.tsx +151 -0
- package/template/tests/unit/components/StatusBadge.test.tsx +36 -0
- package/template/tests/unit/components/TableComponent.test.tsx +644 -0
- package/template/tests/unit/components/TableCore.test.ts +145 -0
- package/template/tests/unit/components/ThemeAccessibility.test.tsx +27 -0
- package/template/tests/unit/components/__screenshots__/BatchOperationDialog.test.tsx/confirms-a-batch-action-and-presents-partial-failure-details-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PageForm.test.tsx/PageForm-writes-uploaded-values-through-the-public-file-field-and-resets-dirty-state-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PasswordInput.test.tsx/PasswordInput-toggles-the-password-visibility-when-the-show-password-button-is-clicked-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-pins-trailing-action-columns-and-removes-their-header-menu-by-default-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-shadcn-components-through-cellComponent-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-the-toolbar-without-a-bottom-divider-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-resyncs-adaptive-height-after-a-column-resize-changes-wrapped-row-height-1.png +0 -0
- package/template/tests/unit/config/RuntimeConfigErrorPage.test.tsx +23 -0
- package/template/tests/unit/config/appConfig.test.ts +98 -0
- package/template/tests/unit/config/appTableContracts.test.mjs +120 -0
- package/template/tests/unit/config/bundleBudget.test.mjs +190 -0
- package/template/tests/unit/config/componentGovernance.test.mjs +156 -0
- package/template/tests/unit/config/deployConfig.test.mjs +211 -0
- package/template/tests/unit/config/eslintConfig.test.mjs +101 -0
- package/template/tests/unit/config/featureBoundaries.test.mjs +126 -0
- package/template/tests/unit/config/npmPackage.test.mjs +37 -0
- package/template/tests/unit/config/releaseArtifact.test.mjs +105 -0
- package/template/tests/unit/config/runtimeConfig.test.ts +225 -0
- package/template/tests/unit/config/scaffoldCheck.test.mjs +53 -0
- package/template/tests/unit/config/scaffoldFeature.test.mjs +177 -0
- package/template/tests/unit/config/scaffoldInit.test.mjs +218 -0
- package/template/tests/unit/config/scaffoldProject.test.mjs +378 -0
- package/template/tests/unit/config/scaffoldTransaction.test.mjs +77 -0
- package/template/tests/unit/config/viteConfig.test.mjs +371 -0
- package/template/tests/unit/context/ThemeProvider.test.tsx +108 -0
- package/template/tests/unit/context/UnsavedChangesProvider.test.tsx +94 -0
- package/template/tests/unit/context/__screenshots__/ThemeProvider.test.tsx/ThemeProvider-uses-the-neutral-black-palette-for-the-app-and-scoped-table-theme-1.png +0 -0
- package/template/tests/unit/context/applicationScope.test.ts +62 -0
- package/template/tests/unit/dataMasking/dataMasking.test.ts +95 -0
- package/template/tests/unit/featureFlags/featureFlags.test.ts +169 -0
- package/template/tests/unit/featureFlags/useFeatureFlag.test.tsx +108 -0
- package/template/tests/unit/features/FeatureLocalization.test.tsx +54 -0
- package/template/tests/unit/features/RouteError.test.tsx +40 -0
- package/template/tests/unit/features/auth/signIn/UserAuthForm.test.tsx +79 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-passes-validated-values-to-onSubmit-1.png +0 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-shows-validation-messages-when-submitting-an-empty-form-1.png +0 -0
- package/template/tests/unit/files/fileHooks.test.tsx +130 -0
- package/template/tests/unit/files/files.test.ts +112 -0
- package/template/tests/unit/lib/accessControl.test.ts +69 -0
- package/template/tests/unit/locale/locale.test.tsx +90 -0
- package/template/tests/unit/observability/browser.test.ts +48 -0
- package/template/tests/unit/observability/observer.test.ts +115 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-fails-permission-precheck-before-loading-the-project-SDK-1.png +0 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-mounts-a-route-scoped-SDK-into-the-dedicated-host-with-permission-1.png +0 -0
- package/template/tests/unit/optionalEditors/optionalEditors.test.ts +313 -0
- package/template/tests/unit/optionalEditors/useOptionalEditor.test.tsx +141 -0
- package/template/tests/unit/realtimeCollaboration/collaboration.test.ts +240 -0
- package/template/tests/unit/realtimeCollaboration/useRealtimeCollaboration.test.tsx +115 -0
- package/template/tests/unit/reporting/reporting.test.ts +195 -0
- package/template/tests/unit/reporting/reportingHooks.test.tsx +203 -0
- package/template/tests/unit/router/authLifecycle.test.ts +55 -0
- package/template/tests/unit/router/navigation.test.ts +55 -0
- package/template/tests/unit/router/redirects.test.ts +22 -0
- package/template/tests/unit/scaffoldFeatureTemplate/featureTemplate.test.ts +42 -0
- package/template/tests/unit/scaffoldFeatureTemplate/publicContract.test.ts +28 -0
- package/template/tests/unit/scaffoldFeatureTemplate/queries.test.tsx +289 -0
- package/template/tests/unit/stores/authStore.test.ts +128 -0
- package/template/tests/unit/stores/uiPreferenceStore.test.ts +56 -0
- package/template/tests/unit/tenantWorkspace/tenantWorkspace.test.tsx +261 -0
- package/template/tools/bundle/budgets.json +48 -0
- package/template/tools/bundle/check.mjs +307 -0
- package/template/tools/component-governance/check.mjs +703 -0
- package/template/tools/component-governance/manifest.json +112 -0
- package/template/tools/deployment/browser-smoke.mjs +76 -0
- package/template/tools/deployment/browser-smoke.sh +141 -0
- package/template/tools/openapi/generate.mjs +268 -0
- package/template/tools/openapi/templates/README.md +14 -0
- package/template/tools/openapi/templates/base/README.md +7 -0
- package/template/tools/openapi/templates/base/data-contracts.eta +44 -0
- package/template/tools/openapi/templates/base/http-client.eta +3 -0
- package/template/tools/openapi/templates/base/http-clients/axios-http-client.eta +132 -0
- package/template/tools/openapi/templates/base/http-clients/fetch-http-client.eta +220 -0
- package/template/tools/openapi/templates/base/route-docs.eta +31 -0
- package/template/tools/openapi/templates/base/route-name.eta +43 -0
- package/template/tools/openapi/templates/base/route-type.eta +22 -0
- package/template/tools/openapi/templates/default/README.md +7 -0
- package/template/tools/openapi/templates/default/api.eta +67 -0
- package/template/tools/openapi/templates/default/http-client.eta +137 -0
- package/template/tools/openapi/templates/default/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/default/route-docs.eta +40 -0
- package/template/tools/openapi/templates/default/route-types.eta +28 -0
- package/template/tools/openapi/templates/modular/README.md +7 -0
- package/template/tools/openapi/templates/modular/api.eta +28 -0
- package/template/tools/openapi/templates/modular/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/modular/route-types.eta +18 -0
- package/template/tools/release/artifact.mjs +258 -0
- package/template/tools/scaffold/add-capability.mjs +409 -0
- package/template/tools/scaffold/capability-catalog.json +163 -0
- package/template/tools/scaffold/check.mjs +326 -0
- package/template/tools/scaffold/create-feature.mjs +444 -0
- package/template/tools/scaffold/create-project.mjs +482 -0
- package/template/tools/scaffold/init.example.json +64 -0
- package/template/tools/scaffold/init.mjs +419 -0
- package/template/tools/scaffold/lockfile.mjs +193 -0
- package/template/tools/scaffold/templates/feature/index.ts +19 -0
- package/template/tools/scaffold/templates/feature/model.ts +142 -0
- package/template/tools/scaffold/templates/feature/queries.ts +154 -0
- package/template/tools/scaffold/templates/feature/repository.ts +206 -0
- package/template/tools/scaffold/templates/feature/types.ts +168 -0
- package/template/tools/scaffold/workspace-transaction.mjs +111 -0
- package/template/tsconfig.app.json +31 -0
- package/template/tsconfig.json +12 -0
- package/template/tsconfig.node.json +24 -0
- package/template/vite.config.ts +121 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fnSanitizeFileName,
|
|
3
|
+
type IFileTransferProgress,
|
|
4
|
+
type TFileTaskPollResult,
|
|
5
|
+
type TFileTaskStartResult,
|
|
6
|
+
} from '@/files'
|
|
7
|
+
import { ReportingError } from './errors'
|
|
8
|
+
import type {
|
|
9
|
+
IReportGenerationRequest,
|
|
10
|
+
IReportOutput,
|
|
11
|
+
IReportOutputInput,
|
|
12
|
+
IReportTemplate,
|
|
13
|
+
IReportTemplateCatalog,
|
|
14
|
+
IReportTemplateCatalogInput,
|
|
15
|
+
IReportTemplateInput,
|
|
16
|
+
TReportGenerationPollResultInput,
|
|
17
|
+
TReportGenerationStartResultInput,
|
|
18
|
+
TReportOutputFormat,
|
|
19
|
+
} from './types'
|
|
20
|
+
|
|
21
|
+
/** 单次模板目录允许返回的最大模板数量。 */
|
|
22
|
+
export const nMaxReportTemplates = 200
|
|
23
|
+
|
|
24
|
+
const nMaxIdentifierLength = 200
|
|
25
|
+
const nMaxTemplateNameLength = 300
|
|
26
|
+
const nMaxTemplateDescriptionLength = 2_000
|
|
27
|
+
const nMaxProgressMessageLength = 300
|
|
28
|
+
|
|
29
|
+
const objMimeTypeByFormat: Readonly<Record<TReportOutputFormat, string>> = {
|
|
30
|
+
csv: 'text/csv',
|
|
31
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
32
|
+
pdf: 'application/pdf',
|
|
33
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function fnNormalizeRequiredText(
|
|
37
|
+
strValue: string,
|
|
38
|
+
strField: string,
|
|
39
|
+
nMaxLength = nMaxIdentifierLength,
|
|
40
|
+
strCode:
|
|
41
|
+
| 'INVALID_CATALOG'
|
|
42
|
+
| 'INVALID_OUTPUT'
|
|
43
|
+
| 'INVALID_REQUEST'
|
|
44
|
+
| 'INVALID_TASK' = 'INVALID_CATALOG'
|
|
45
|
+
) {
|
|
46
|
+
const strNormalizedValue = typeof strValue === 'string' ? strValue.trim() : ''
|
|
47
|
+
if (!strNormalizedValue || strNormalizedValue.length > nMaxLength) {
|
|
48
|
+
throw new ReportingError(
|
|
49
|
+
strCode,
|
|
50
|
+
`报表字段 ${strField} 必须是长度不超过 ${nMaxLength} 的非空字符串。`
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
return strNormalizedValue
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function fnNormalizeOptionalText(
|
|
57
|
+
strValue: string | undefined,
|
|
58
|
+
strField: string,
|
|
59
|
+
nMaxLength: number
|
|
60
|
+
) {
|
|
61
|
+
return strValue === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: fnNormalizeRequiredText(strValue, strField, nMaxLength, 'INVALID_CATALOG')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function fnIsReportOutputFormat(
|
|
67
|
+
strFormat: string
|
|
68
|
+
): strFormat is TReportOutputFormat {
|
|
69
|
+
return (
|
|
70
|
+
strFormat === 'csv' ||
|
|
71
|
+
strFormat === 'docx' ||
|
|
72
|
+
strFormat === 'pdf' ||
|
|
73
|
+
strFormat === 'xlsx'
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function fnIsNonEmptyStringArray(
|
|
78
|
+
arrValues: readonly string[] | undefined
|
|
79
|
+
): arrValues is readonly string[] {
|
|
80
|
+
return (
|
|
81
|
+
Array.isArray(arrValues) &&
|
|
82
|
+
arrValues.length > 0 &&
|
|
83
|
+
arrValues.every((objValue) => typeof objValue === 'string')
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 校验一个输出格式,拒绝可执行 HTML 等未声明类型。 */
|
|
88
|
+
export function fnNormalizeReportOutputFormat(
|
|
89
|
+
strFormat: string,
|
|
90
|
+
strCode:
|
|
91
|
+
| 'INVALID_CATALOG'
|
|
92
|
+
| 'INVALID_OUTPUT'
|
|
93
|
+
| 'INVALID_REQUEST' = 'INVALID_REQUEST'
|
|
94
|
+
): TReportOutputFormat {
|
|
95
|
+
if (!fnIsReportOutputFormat(strFormat)) {
|
|
96
|
+
throw new ReportingError(strCode, '报表输出格式不受支持。')
|
|
97
|
+
}
|
|
98
|
+
return strFormat
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function fnNormalizeReportTemplate(
|
|
102
|
+
objInput: IReportTemplateInput
|
|
103
|
+
): IReportTemplate {
|
|
104
|
+
if (!objInput || typeof objInput !== 'object') {
|
|
105
|
+
throw new ReportingError('INVALID_CATALOG', '模板目录包含无效模板。')
|
|
106
|
+
}
|
|
107
|
+
if (!fnIsNonEmptyStringArray(objInput.arrFormats)) {
|
|
108
|
+
throw new ReportingError(
|
|
109
|
+
'INVALID_CATALOG',
|
|
110
|
+
'每个报表模板必须声明至少一种输出格式。'
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
const arrFormats = objInput.arrFormats.map((strFormat) =>
|
|
114
|
+
fnNormalizeReportOutputFormat(strFormat, 'INVALID_CATALOG')
|
|
115
|
+
)
|
|
116
|
+
if (new Set(arrFormats).size !== arrFormats.length) {
|
|
117
|
+
throw new ReportingError('INVALID_CATALOG', '报表模板包含重复输出格式。')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
arrFormats: Object.freeze(arrFormats),
|
|
122
|
+
strDescription: fnNormalizeOptionalText(
|
|
123
|
+
objInput.strDescription,
|
|
124
|
+
'strDescription',
|
|
125
|
+
nMaxTemplateDescriptionLength
|
|
126
|
+
),
|
|
127
|
+
strTemplateId: fnNormalizeRequiredText(
|
|
128
|
+
objInput.strTemplateId ?? '',
|
|
129
|
+
'strTemplateId'
|
|
130
|
+
),
|
|
131
|
+
strTemplateName: fnNormalizeRequiredText(
|
|
132
|
+
objInput.strTemplateName ?? '',
|
|
133
|
+
'strTemplateName',
|
|
134
|
+
nMaxTemplateNameLength
|
|
135
|
+
),
|
|
136
|
+
strTemplateVersion: fnNormalizeRequiredText(
|
|
137
|
+
objInput.strTemplateVersion ?? '',
|
|
138
|
+
'strTemplateVersion'
|
|
139
|
+
),
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** 校验并冻结后端模板目录,拒绝重复 ID、未知格式和无界数据。 */
|
|
144
|
+
export function fnNormalizeReportTemplateCatalog(
|
|
145
|
+
objInput: IReportTemplateCatalogInput
|
|
146
|
+
): IReportTemplateCatalog {
|
|
147
|
+
if (
|
|
148
|
+
!objInput ||
|
|
149
|
+
typeof objInput !== 'object' ||
|
|
150
|
+
!Array.isArray(objInput.arrTemplates) ||
|
|
151
|
+
objInput.arrTemplates.length > nMaxReportTemplates
|
|
152
|
+
) {
|
|
153
|
+
throw new ReportingError(
|
|
154
|
+
'INVALID_CATALOG',
|
|
155
|
+
`报表模板目录最多允许 ${nMaxReportTemplates} 项。`
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
const arrTemplates = objInput.arrTemplates.map(fnNormalizeReportTemplate)
|
|
159
|
+
if (
|
|
160
|
+
new Set(arrTemplates.map((objTemplate) => objTemplate.strTemplateId))
|
|
161
|
+
.size !== arrTemplates.length
|
|
162
|
+
) {
|
|
163
|
+
throw new ReportingError('INVALID_CATALOG', '模板目录包含重复模板 ID。')
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return Object.freeze({
|
|
167
|
+
arrTemplates: Object.freeze(arrTemplates),
|
|
168
|
+
strCatalogVersion: fnNormalizeRequiredText(
|
|
169
|
+
objInput.strCatalogVersion ?? '',
|
|
170
|
+
'strCatalogVersion'
|
|
171
|
+
),
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** 校验报表生成请求的稳定模板身份和输出格式。 */
|
|
176
|
+
export function fnNormalizeReportGenerationRequest<TParameters>(
|
|
177
|
+
objRequest: IReportGenerationRequest<TParameters>
|
|
178
|
+
): IReportGenerationRequest<TParameters> {
|
|
179
|
+
if (!objRequest || typeof objRequest !== 'object') {
|
|
180
|
+
throw new ReportingError('INVALID_REQUEST', '报表生成请求无效。')
|
|
181
|
+
}
|
|
182
|
+
return Object.freeze({
|
|
183
|
+
objParameters: objRequest.objParameters,
|
|
184
|
+
strFormat: fnNormalizeReportOutputFormat(
|
|
185
|
+
objRequest.strFormat,
|
|
186
|
+
'INVALID_REQUEST'
|
|
187
|
+
),
|
|
188
|
+
strTemplateId: fnNormalizeRequiredText(
|
|
189
|
+
objRequest.strTemplateId,
|
|
190
|
+
'strTemplateId',
|
|
191
|
+
nMaxIdentifierLength,
|
|
192
|
+
'INVALID_REQUEST'
|
|
193
|
+
),
|
|
194
|
+
strTemplateVersion: fnNormalizeRequiredText(
|
|
195
|
+
objRequest.strTemplateVersion,
|
|
196
|
+
'strTemplateVersion',
|
|
197
|
+
nMaxIdentifierLength,
|
|
198
|
+
'INVALID_REQUEST'
|
|
199
|
+
),
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** 校验报表结果的文件身份、格式、MIME 和安全文件名。 */
|
|
204
|
+
export function fnNormalizeReportOutput(
|
|
205
|
+
objInput: IReportOutputInput,
|
|
206
|
+
strExpectedFormat?: TReportOutputFormat
|
|
207
|
+
): IReportOutput {
|
|
208
|
+
if (!objInput || typeof objInput !== 'object') {
|
|
209
|
+
throw new ReportingError('INVALID_OUTPUT', '报表服务没有返回有效文件。')
|
|
210
|
+
}
|
|
211
|
+
const strFormat = fnNormalizeReportOutputFormat(
|
|
212
|
+
objInput.strFormat ?? '',
|
|
213
|
+
'INVALID_OUTPUT'
|
|
214
|
+
)
|
|
215
|
+
if (strExpectedFormat && strExpectedFormat !== strFormat) {
|
|
216
|
+
throw new ReportingError(
|
|
217
|
+
'INVALID_OUTPUT',
|
|
218
|
+
'报表服务返回的文件格式与请求不一致。'
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
const strMimeType = fnNormalizeRequiredText(
|
|
222
|
+
objInput.strMimeType ?? '',
|
|
223
|
+
'strMimeType',
|
|
224
|
+
nMaxIdentifierLength,
|
|
225
|
+
'INVALID_OUTPUT'
|
|
226
|
+
)
|
|
227
|
+
if (strMimeType !== objMimeTypeByFormat[strFormat]) {
|
|
228
|
+
throw new ReportingError(
|
|
229
|
+
'INVALID_OUTPUT',
|
|
230
|
+
'报表文件 MIME 与输出格式不一致。'
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
const strSanitizedFileName = fnSanitizeFileName(
|
|
234
|
+
fnNormalizeRequiredText(
|
|
235
|
+
objInput.strFileName ?? '',
|
|
236
|
+
'strFileName',
|
|
237
|
+
nMaxTemplateNameLength,
|
|
238
|
+
'INVALID_OUTPUT'
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
const strFileName = strSanitizedFileName
|
|
242
|
+
.toLowerCase()
|
|
243
|
+
.endsWith(`.${strFormat}`)
|
|
244
|
+
? strSanitizedFileName
|
|
245
|
+
: `${strSanitizedFileName}.${strFormat}`
|
|
246
|
+
|
|
247
|
+
return Object.freeze({
|
|
248
|
+
strFileId: fnNormalizeRequiredText(
|
|
249
|
+
objInput.strFileId ?? '',
|
|
250
|
+
'strFileId',
|
|
251
|
+
nMaxIdentifierLength,
|
|
252
|
+
'INVALID_OUTPUT'
|
|
253
|
+
),
|
|
254
|
+
strFileName,
|
|
255
|
+
strFormat,
|
|
256
|
+
strMimeType,
|
|
257
|
+
strReportId: fnNormalizeRequiredText(
|
|
258
|
+
objInput.strReportId ?? '',
|
|
259
|
+
'strReportId',
|
|
260
|
+
nMaxIdentifierLength,
|
|
261
|
+
'INVALID_OUTPUT'
|
|
262
|
+
),
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function fnNormalizeProgress(
|
|
267
|
+
objProgress: IFileTransferProgress | undefined
|
|
268
|
+
): IFileTransferProgress | undefined {
|
|
269
|
+
if (objProgress === undefined) return undefined
|
|
270
|
+
if (!objProgress || typeof objProgress !== 'object') {
|
|
271
|
+
throw new ReportingError('INVALID_TASK', '报表任务返回了无效进度。')
|
|
272
|
+
}
|
|
273
|
+
const { nLoadedBytes, nPercent, nTotalBytes, strMessage } = objProgress
|
|
274
|
+
const bHasInvalidBytes = [nLoadedBytes, nTotalBytes].some(
|
|
275
|
+
(nValue) => nValue !== undefined && (!Number.isFinite(nValue) || nValue < 0)
|
|
276
|
+
)
|
|
277
|
+
if (
|
|
278
|
+
bHasInvalidBytes ||
|
|
279
|
+
(nPercent !== undefined &&
|
|
280
|
+
(!Number.isFinite(nPercent) || nPercent < 0 || nPercent > 100)) ||
|
|
281
|
+
(strMessage !== undefined &&
|
|
282
|
+
(typeof strMessage !== 'string' ||
|
|
283
|
+
strMessage.length > nMaxProgressMessageLength))
|
|
284
|
+
) {
|
|
285
|
+
throw new ReportingError('INVALID_TASK', '报表任务返回了无效进度。')
|
|
286
|
+
}
|
|
287
|
+
return Object.freeze({ nLoadedBytes, nPercent, nTotalBytes, strMessage })
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** 将报表启动响应映射为统一文件任务结果。 */
|
|
291
|
+
export function fnNormalizeReportGenerationStartResult(
|
|
292
|
+
objInput: TReportGenerationStartResultInput,
|
|
293
|
+
strExpectedFormat: TReportOutputFormat
|
|
294
|
+
): TFileTaskStartResult<IReportOutput> {
|
|
295
|
+
if (!objInput || typeof objInput !== 'object') {
|
|
296
|
+
throw new ReportingError('INVALID_TASK', '报表服务返回了无效启动状态。')
|
|
297
|
+
}
|
|
298
|
+
if (objInput.strMode === 'completed') {
|
|
299
|
+
return {
|
|
300
|
+
objResult: fnNormalizeReportOutput(
|
|
301
|
+
objInput.objResult ?? {},
|
|
302
|
+
strExpectedFormat
|
|
303
|
+
),
|
|
304
|
+
strMode: 'completed',
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (objInput.strMode === 'background') {
|
|
308
|
+
return {
|
|
309
|
+
strMode: 'background',
|
|
310
|
+
strTaskId: fnNormalizeRequiredText(
|
|
311
|
+
objInput.strTaskId ?? '',
|
|
312
|
+
'strTaskId',
|
|
313
|
+
nMaxIdentifierLength,
|
|
314
|
+
'INVALID_TASK'
|
|
315
|
+
),
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
throw new ReportingError('INVALID_TASK', '报表服务返回了未知启动状态。')
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** 将报表轮询响应映射为统一文件任务结果。 */
|
|
322
|
+
export function fnNormalizeReportGenerationPollResult(
|
|
323
|
+
objInput: TReportGenerationPollResultInput,
|
|
324
|
+
strExpectedFormat: TReportOutputFormat
|
|
325
|
+
): TFileTaskPollResult<IReportOutput> {
|
|
326
|
+
if (!objInput || typeof objInput !== 'object') {
|
|
327
|
+
throw new ReportingError('INVALID_TASK', '报表服务返回了无效任务状态。')
|
|
328
|
+
}
|
|
329
|
+
if (objInput.strStatus === 'queued' || objInput.strStatus === 'running') {
|
|
330
|
+
return {
|
|
331
|
+
objProgress: fnNormalizeProgress(objInput.objProgress),
|
|
332
|
+
strStatus: objInput.strStatus,
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (objInput.strStatus === 'success') {
|
|
336
|
+
return {
|
|
337
|
+
objResult: fnNormalizeReportOutput(
|
|
338
|
+
objInput.objResult ?? {},
|
|
339
|
+
strExpectedFormat
|
|
340
|
+
),
|
|
341
|
+
strStatus: 'success',
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (objInput.strStatus === 'error') {
|
|
345
|
+
const strSafeMessage =
|
|
346
|
+
objInput.strSafeMessage === undefined
|
|
347
|
+
? '报表生成失败,请稍后重试。'
|
|
348
|
+
: fnNormalizeRequiredText(
|
|
349
|
+
objInput.strSafeMessage,
|
|
350
|
+
'strSafeMessage',
|
|
351
|
+
nMaxProgressMessageLength,
|
|
352
|
+
'INVALID_TASK'
|
|
353
|
+
)
|
|
354
|
+
const strReasonCode =
|
|
355
|
+
objInput.strReasonCode === undefined
|
|
356
|
+
? undefined
|
|
357
|
+
: fnNormalizeRequiredText(
|
|
358
|
+
objInput.strReasonCode,
|
|
359
|
+
'strReasonCode',
|
|
360
|
+
nMaxIdentifierLength,
|
|
361
|
+
'INVALID_TASK'
|
|
362
|
+
)
|
|
363
|
+
return {
|
|
364
|
+
objError: new ReportingError(
|
|
365
|
+
'REPORT_FAILED',
|
|
366
|
+
strSafeMessage,
|
|
367
|
+
strReasonCode
|
|
368
|
+
),
|
|
369
|
+
strStatus: 'error',
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
throw new ReportingError('INVALID_TASK', '报表服务返回了未知任务状态。')
|
|
373
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReportingError } from './errors'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 打印当前受控路由。
|
|
5
|
+
*
|
|
6
|
+
* 不接受 HTML 字符串或外部 URL,实际版式由 Feature 的 `@media print` 样式负责。
|
|
7
|
+
*/
|
|
8
|
+
export function fnPrintCurrentDocument() {
|
|
9
|
+
if (typeof window === 'undefined' || typeof window.print !== 'function') {
|
|
10
|
+
throw new ReportingError(
|
|
11
|
+
'PRINT_UNAVAILABLE',
|
|
12
|
+
'当前运行环境不支持浏览器打印。'
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
window.print()
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { queryOptions, type QueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { fnCreateAppQueryKeys, type IAppQueryScope } from '@/api/query'
|
|
3
|
+
import type { IReportTemplateCatalog, IReportTemplateSource } from './types'
|
|
4
|
+
|
|
5
|
+
const strReportingFeatureKey = 'reporting'
|
|
6
|
+
const strReportTemplateResourceKey = 'templates'
|
|
7
|
+
const nReportTemplateStaleTimeMs = 5 * 60_000
|
|
8
|
+
const nReportTemplateGcTimeMs = 30 * 60_000
|
|
9
|
+
|
|
10
|
+
/** 返回当前身份作用域对应的模板目录 Query Key。 */
|
|
11
|
+
export function fnReportTemplateQueryKey(objScope: IAppQueryScope) {
|
|
12
|
+
return fnCreateAppQueryKeys(strReportingFeatureKey, objScope).fnList(
|
|
13
|
+
strReportTemplateResourceKey
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** 创建当前身份作用域下的模板目录 Query 配置。 */
|
|
18
|
+
export function fnReportTemplateQueryOptions(
|
|
19
|
+
objSource: IReportTemplateSource,
|
|
20
|
+
objScope: IAppQueryScope
|
|
21
|
+
) {
|
|
22
|
+
return queryOptions({
|
|
23
|
+
gcTime: nReportTemplateGcTimeMs,
|
|
24
|
+
queryFn: ({ signal: objSignal }) =>
|
|
25
|
+
objSource.fnListTemplates({ objScope, objSignal }),
|
|
26
|
+
queryKey: fnReportTemplateQueryKey(objScope),
|
|
27
|
+
staleTime: nReportTemplateStaleTimeMs,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 使当前身份作用域下的模板目录失效。 */
|
|
32
|
+
export function fnInvalidateReportTemplates(
|
|
33
|
+
objQueryClient: QueryClient,
|
|
34
|
+
objScope: IAppQueryScope
|
|
35
|
+
) {
|
|
36
|
+
return objQueryClient.invalidateQueries({
|
|
37
|
+
exact: true,
|
|
38
|
+
queryKey: fnReportTemplateQueryKey(objScope),
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 从 QueryClient 同步读取当前身份的模板目录。 */
|
|
43
|
+
export function fnGetCachedReportTemplates(
|
|
44
|
+
objQueryClient: QueryClient,
|
|
45
|
+
objScope: IAppQueryScope
|
|
46
|
+
): IReportTemplateCatalog | undefined {
|
|
47
|
+
return objQueryClient.getQueryData<IReportTemplateCatalog>(
|
|
48
|
+
fnReportTemplateQueryKey(objScope)
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { useAppQueryScope } from '@/api/query'
|
|
3
|
+
import { fnReportTemplateQueryOptions } from './query'
|
|
4
|
+
import type { IUseReportTemplatesOptions } from './types'
|
|
5
|
+
|
|
6
|
+
/** 查询当前身份有权使用的报表模板目录。 */
|
|
7
|
+
export function useReportTemplates({
|
|
8
|
+
bIsEnabled = true,
|
|
9
|
+
objSource,
|
|
10
|
+
strWorkspaceId,
|
|
11
|
+
}: IUseReportTemplatesOptions) {
|
|
12
|
+
const objScope = useAppQueryScope({ strWorkspaceId })
|
|
13
|
+
return useQuery({
|
|
14
|
+
...fnReportTemplateQueryOptions(objSource, objScope),
|
|
15
|
+
enabled: bIsEnabled,
|
|
16
|
+
})
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { fnNormalizeReportTemplateCatalog } from './model'
|
|
2
|
+
import type { IReportTemplateSource, TReportTemplateRequest } from './types'
|
|
3
|
+
|
|
4
|
+
/** 使用 Swagger 生成客户端请求创建带运行时校验的模板目录数据源。 */
|
|
5
|
+
export function fnCreateReportTemplateSource(
|
|
6
|
+
fnRequest: TReportTemplateRequest
|
|
7
|
+
): IReportTemplateSource {
|
|
8
|
+
return {
|
|
9
|
+
async fnListTemplates(objContext) {
|
|
10
|
+
return fnNormalizeReportTemplateCatalog(await fnRequest(objContext))
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IFileTaskContext,
|
|
3
|
+
IFileTransferProgress,
|
|
4
|
+
IUseFileTaskResult,
|
|
5
|
+
} from '@/files'
|
|
6
|
+
import type { IAppQueryScope } from '@/api/query'
|
|
7
|
+
|
|
8
|
+
/** 脚手架允许报表服务返回的文件格式。 */
|
|
9
|
+
export type TReportOutputFormat = 'csv' | 'docx' | 'pdf' | 'xlsx'
|
|
10
|
+
|
|
11
|
+
/** 报表、打印和模板边界的稳定错误码。 */
|
|
12
|
+
export type TReportingErrorCode =
|
|
13
|
+
| 'INVALID_CATALOG'
|
|
14
|
+
| 'INVALID_OUTPUT'
|
|
15
|
+
| 'INVALID_REQUEST'
|
|
16
|
+
| 'INVALID_TASK'
|
|
17
|
+
| 'PRINT_UNAVAILABLE'
|
|
18
|
+
| 'REPORT_FAILED'
|
|
19
|
+
|
|
20
|
+
/** Swagger Adapter 返回的单个报表模板原始元数据。 */
|
|
21
|
+
export interface IReportTemplateInput {
|
|
22
|
+
/** 后端声明的输出格式;会在进入缓存前逐项校验。 */
|
|
23
|
+
arrFormats?: readonly string[]
|
|
24
|
+
/** 可直接作为纯文本展示的模板说明。 */
|
|
25
|
+
strDescription?: string
|
|
26
|
+
/** 后端授权返回的稳定模板 ID。 */
|
|
27
|
+
strTemplateId?: string
|
|
28
|
+
/** 可直接作为纯文本展示的模板名称。 */
|
|
29
|
+
strTemplateName?: string
|
|
30
|
+
/** 不可变模板版本;生成请求必须显式回传。 */
|
|
31
|
+
strTemplateVersion?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** 经过校验、可供报表入口展示的模板元数据。 */
|
|
35
|
+
export interface IReportTemplate {
|
|
36
|
+
/** 当前模板支持的输出格式,至少一项且不重复。 */
|
|
37
|
+
readonly arrFormats: readonly TReportOutputFormat[]
|
|
38
|
+
/** 后端授权返回的安全纯文本说明。 */
|
|
39
|
+
readonly strDescription?: string
|
|
40
|
+
/** 后端授权返回的稳定模板 ID。 */
|
|
41
|
+
readonly strTemplateId: string
|
|
42
|
+
/** 后端授权返回的安全纯文本名称。 */
|
|
43
|
+
readonly strTemplateName: string
|
|
44
|
+
/** 不可变模板版本。 */
|
|
45
|
+
readonly strTemplateVersion: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Swagger Adapter 返回的模板目录原始数据。 */
|
|
49
|
+
export interface IReportTemplateCatalogInput {
|
|
50
|
+
/** 当前用户有权使用的完整模板列表。 */
|
|
51
|
+
arrTemplates?: readonly IReportTemplateInput[]
|
|
52
|
+
/** 后端目录版本,用于诊断和主动失效。 */
|
|
53
|
+
strCatalogVersion?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 当前身份作用域下经过校验的模板目录。 */
|
|
57
|
+
export interface IReportTemplateCatalog {
|
|
58
|
+
/** 当前用户有权使用的完整模板列表,最多 200 项。 */
|
|
59
|
+
readonly arrTemplates: readonly IReportTemplate[]
|
|
60
|
+
/** 后端目录版本。 */
|
|
61
|
+
readonly strCatalogVersion: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 加载报表模板目录的安全请求上下文。 */
|
|
65
|
+
export interface IReportTemplateRequestContext {
|
|
66
|
+
/** 当前用户、会话、租户、工作空间和语言组成的缓存作用域。 */
|
|
67
|
+
readonly objScope: IAppQueryScope
|
|
68
|
+
/** Query 取消、身份变化或路由卸载时触发的取消信号。 */
|
|
69
|
+
readonly objSignal: AbortSignal
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 由 Swagger 生成客户端实现的模板目录请求。 */
|
|
73
|
+
export type TReportTemplateRequest = (
|
|
74
|
+
objContext: IReportTemplateRequestContext
|
|
75
|
+
) => Promise<IReportTemplateCatalogInput>
|
|
76
|
+
|
|
77
|
+
/** 项目报表模板目录数据源。 */
|
|
78
|
+
export interface IReportTemplateSource {
|
|
79
|
+
/** 加载后端已授权的模板目录并返回经过校验的结果。 */
|
|
80
|
+
readonly fnListTemplates: (
|
|
81
|
+
objContext: IReportTemplateRequestContext
|
|
82
|
+
) => Promise<IReportTemplateCatalog>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 报表模板目录 Hook 的公共参数。 */
|
|
86
|
+
export interface IUseReportTemplatesOptions {
|
|
87
|
+
/** 是否允许加载模板目录,默认启用。 */
|
|
88
|
+
readonly bIsEnabled?: boolean
|
|
89
|
+
/** 项目模板目录数据源。 */
|
|
90
|
+
readonly objSource: IReportTemplateSource
|
|
91
|
+
/** 跨工作空间报表 Feature 显式指定的工作空间 ID。 */
|
|
92
|
+
readonly strWorkspaceId?: string
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** 发起一次服务端报表生成所需的强类型输入。 */
|
|
96
|
+
export interface IReportGenerationRequest<TParameters> {
|
|
97
|
+
/** 由具体 Swagger DTO 约束的模板参数,不由脚手架猜测字段。 */
|
|
98
|
+
readonly objParameters: TParameters
|
|
99
|
+
/** 期望生成的文件格式。 */
|
|
100
|
+
readonly strFormat: TReportOutputFormat
|
|
101
|
+
/** 当前选择的稳定模板 ID。 */
|
|
102
|
+
readonly strTemplateId: string
|
|
103
|
+
/** 目录返回的不可变模板版本。 */
|
|
104
|
+
readonly strTemplateVersion: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Swagger Adapter 返回的报表文件原始身份。 */
|
|
108
|
+
export interface IReportOutputInput {
|
|
109
|
+
/** 实际生成的文件格式。 */
|
|
110
|
+
strFormat?: string
|
|
111
|
+
/** 受保护下载接口使用的稳定文件 ID。 */
|
|
112
|
+
strFileId?: string
|
|
113
|
+
/** 后端建议的文件名;进入结果前会清理路径字符。 */
|
|
114
|
+
strFileName?: string
|
|
115
|
+
/** 与格式匹配的受支持 MIME。 */
|
|
116
|
+
strMimeType?: string
|
|
117
|
+
/** 本次报表生成的稳定结果 ID,用于审计和问题追踪。 */
|
|
118
|
+
strReportId?: string
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 经过校验的报表文件身份,不包含 Blob 或任意外部 URL。 */
|
|
122
|
+
export interface IReportOutput {
|
|
123
|
+
/** 实际生成且与请求一致的文件格式。 */
|
|
124
|
+
readonly strFormat: TReportOutputFormat
|
|
125
|
+
/** 受保护下载接口使用的稳定文件 ID。 */
|
|
126
|
+
readonly strFileId: string
|
|
127
|
+
/** 已清理的下载回退文件名。 */
|
|
128
|
+
readonly strFileName: string
|
|
129
|
+
/** 与文件格式严格匹配的 MIME。 */
|
|
130
|
+
readonly strMimeType: string
|
|
131
|
+
/** 本次报表生成的稳定结果 ID。 */
|
|
132
|
+
readonly strReportId: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** 报表服务启动生成后返回的原始状态。 */
|
|
136
|
+
export type TReportGenerationStartResultInput =
|
|
137
|
+
| {
|
|
138
|
+
/** 请求内已经生成完成。 */
|
|
139
|
+
readonly strMode: 'completed'
|
|
140
|
+
/** 已生成文件的原始身份。 */
|
|
141
|
+
readonly objResult?: IReportOutputInput
|
|
142
|
+
}
|
|
143
|
+
| {
|
|
144
|
+
/** 服务端已创建后台任务。 */
|
|
145
|
+
readonly strMode: 'background'
|
|
146
|
+
/** 后端任务稳定 ID。 */
|
|
147
|
+
readonly strTaskId?: string
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** 报表服务单次轮询返回的原始状态。 */
|
|
151
|
+
export type TReportGenerationPollResultInput =
|
|
152
|
+
| {
|
|
153
|
+
/** 后台任务仍在排队或执行。 */
|
|
154
|
+
readonly strStatus: 'queued' | 'running'
|
|
155
|
+
/** 服务端最近一次安全进度。 */
|
|
156
|
+
readonly objProgress?: IFileTransferProgress
|
|
157
|
+
}
|
|
158
|
+
| {
|
|
159
|
+
/** 后台任务成功完成。 */
|
|
160
|
+
readonly strStatus: 'success'
|
|
161
|
+
/** 已生成文件的原始身份。 */
|
|
162
|
+
readonly objResult?: IReportOutputInput
|
|
163
|
+
}
|
|
164
|
+
| {
|
|
165
|
+
/** 后台任务以业务失败结束。 */
|
|
166
|
+
readonly strStatus: 'error'
|
|
167
|
+
/** 稳定、非敏感的后端原因码。 */
|
|
168
|
+
readonly strReasonCode?: string
|
|
169
|
+
/** 可直接展示的安全失败说明。 */
|
|
170
|
+
readonly strSafeMessage?: string
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** 启动报表生成时交给项目 Adapter 的上下文。 */
|
|
174
|
+
export interface IReportGenerationStartContext<
|
|
175
|
+
TParameters,
|
|
176
|
+
> extends IFileTaskContext {
|
|
177
|
+
/** 经过校验的模板、版本、格式和强类型业务参数。 */
|
|
178
|
+
readonly objRequest: IReportGenerationRequest<TParameters>
|
|
179
|
+
/** 当前用户、会话、租户、工作空间和语言组成的作用域。 */
|
|
180
|
+
readonly objScope: IAppQueryScope
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** 轮询后台报表任务时交给项目 Adapter 的上下文。 */
|
|
184
|
+
export interface IReportGenerationPollContext extends IFileTaskContext {
|
|
185
|
+
/** 当前用户、会话、租户、工作空间和语言组成的作用域。 */
|
|
186
|
+
readonly objScope: IAppQueryScope
|
|
187
|
+
/** 启动阶段请求的文件格式。 */
|
|
188
|
+
readonly strExpectedFormat: TReportOutputFormat
|
|
189
|
+
/** 后端任务稳定 ID。 */
|
|
190
|
+
readonly strTaskId: string
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** 项目使用 Swagger 生成客户端实现的报表生成数据源。 */
|
|
194
|
+
export interface IReportGenerationSource<TParameters> {
|
|
195
|
+
/** 启动同步或后台报表生成。 */
|
|
196
|
+
readonly fnStartReport: (
|
|
197
|
+
objContext: IReportGenerationStartContext<TParameters>
|
|
198
|
+
) => Promise<TReportGenerationStartResultInput>
|
|
199
|
+
/** 查询后台报表任务;只支持同步生成的项目可以省略。 */
|
|
200
|
+
readonly fnPollReport?: (
|
|
201
|
+
objContext: IReportGenerationPollContext
|
|
202
|
+
) => Promise<TReportGenerationPollResultInput>
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 服务端报表生成 Hook 的公共参数。 */
|
|
206
|
+
export interface IUseReportGenerationOptions<TParameters> {
|
|
207
|
+
/** 后台任务轮询间隔,默认沿用文件任务策略。 */
|
|
208
|
+
readonly nPollIntervalMs?: number
|
|
209
|
+
/** 项目报表生成数据源。 */
|
|
210
|
+
readonly objSource: IReportGenerationSource<TParameters>
|
|
211
|
+
/** 跨工作空间报表 Feature 显式指定的工作空间 ID。 */
|
|
212
|
+
readonly strWorkspaceId?: string
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** 报表生成 Hook 的标准任务结果。 */
|
|
216
|
+
export type TUseReportGenerationResult<TParameters> = IUseFileTaskResult<
|
|
217
|
+
IReportGenerationRequest<TParameters>,
|
|
218
|
+
IReportOutput
|
|
219
|
+
>
|