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,178 @@
|
|
|
1
|
+
# Query Key 与 Mutation 一致性约定
|
|
2
|
+
|
|
3
|
+
这份约定是脚手架内所有 Feature 使用 TanStack Query 的公共缓存契约。它解决同一浏览器
|
|
4
|
+
会话中用户、租户、语言或工作空间切换后的数据隔离,以及 Mutation 成功、失败和并发时
|
|
5
|
+
缓存如何收敛。它不包装 `useQuery`/`useMutation`,也不替代 Feature 自己的 DTO 映射、
|
|
6
|
+
Repository 和权限规则。
|
|
7
|
+
|
|
8
|
+
公共入口统一从 `@/api/query` 导入。主要消费者是 Feature 查询 Hook、
|
|
9
|
+
路由 Loader 和 Mutation;枚举与全局参数拥有自己的目录级 Key,但仍遵循相同的租户、
|
|
10
|
+
语言、授权版本和取消原则。
|
|
11
|
+
|
|
12
|
+
## 缓存身份
|
|
13
|
+
|
|
14
|
+
Feature 在 React 中调用 `useAppQueryScope()`,作用域由当前认证状态和 Locale 唯一来源
|
|
15
|
+
派生,不允许页面自行传入另一个用户或租户:
|
|
16
|
+
|
|
17
|
+
| 字段 | 含义 | 变化后的行为 |
|
|
18
|
+
| -------------------- | -------------------------------------------- | ---------------------------- |
|
|
19
|
+
| `strUserId` | 当前稳定用户 ID;未登录统一为 `anonymous` | 使用新 Key,旧会话缓存被清理 |
|
|
20
|
+
| `strTenantId` | 当前租户 ID;单租户系统省略 | 使用新 Key,重新请求 |
|
|
21
|
+
| `strLocale` | 当前应用语言 | 使用新 Key,重新请求 |
|
|
22
|
+
| `nSessionGeneration` | 登录、退出、角色、权限或租户变化后的会话版本 | 使用新 Key并重新校验权限 |
|
|
23
|
+
| `strWorkspaceId` | Feature 显式传入的工作空间;默认不启用 | 使用新 Key,重新请求 |
|
|
24
|
+
|
|
25
|
+
作用域只能包含稳定标识,不能放入 Access Token、Refresh Token、Cookie、邮箱、手机号或
|
|
26
|
+
其他凭据和个人信息。用户、租户或授权上下文变化时,认证生命周期还会清理 QueryClient,
|
|
27
|
+
作为防止跨会话数据残留的第二道边界。
|
|
28
|
+
|
|
29
|
+
React 外的路由 Loader 从认证状态取得用户与租户;需要工作空间隔离时,把所属 Feature 已
|
|
30
|
+
校验的 `strWorkspaceId` 传给 `fnCreateAppQueryScope()`。项目启用 `tenantWorkspace` 可选能力
|
|
31
|
+
后,也可以使用 `fnGetTenantWorkspaceCurrent()` 读取选择结果,但仍需显式传入查询作用域。
|
|
32
|
+
切换顺序、失败恢复和 Adapter 接入见
|
|
33
|
+
[`tenant-workspace-context.md`](tenant-workspace-context.md)。
|
|
34
|
+
|
|
35
|
+
## Key 层级
|
|
36
|
+
|
|
37
|
+
每个 Feature 使用 `fnCreateAppQueryKeys(strFeature, objScope)` 创建工厂,Key 固定为以下
|
|
38
|
+
层级:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
appQuery
|
|
42
|
+
└── feature
|
|
43
|
+
└── user + tenant + locale + session + workspace
|
|
44
|
+
└── resource
|
|
45
|
+
├── list
|
|
46
|
+
│ └── filters + sort + page
|
|
47
|
+
└── detail
|
|
48
|
+
└── entityId
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| 工厂成员 | 用途 |
|
|
52
|
+
| ---------------------------------- | ----------------------------------------- |
|
|
53
|
+
| `arrAll` | 当前 Feature 的所有作用域,只用于清理诊断 |
|
|
54
|
+
| `arrScope` | 当前身份作用域内该 Feature 的全部查询 |
|
|
55
|
+
| `fnResource('records')` | 当前资源的列表和详情根 Key |
|
|
56
|
+
| `fnLists('records')` | 当前资源的全部列表 |
|
|
57
|
+
| `fnList('records', objParameters)` | 一个精确列表 |
|
|
58
|
+
| `fnDetails('records')` | 当前资源的全部详情 |
|
|
59
|
+
| `fnDetail('records', strRecordId)` | 一个精确详情 |
|
|
60
|
+
|
|
61
|
+
列表参数必须是只读、JSON 可序列化的数据。日期先转为 ISO 字符串;省略未定义字段;不能传
|
|
62
|
+
`Date`、函数、类实例、DOM、Signal 或 Token。分页、排序、筛选的服务端语义只要不同,就
|
|
63
|
+
必须进入参数对象。顶层字段会按名称规范化,避免对象声明顺序制造重复缓存。
|
|
64
|
+
|
|
65
|
+
Query Key 只标识服务端缓存,不负责浏览器刷新、分享或前进后退。AppTable 的查询、排序和
|
|
66
|
+
分页参数应直接进入列表 Query Key;确实需要可分享 URL 时,由所属 Feature 的路由 Schema
|
|
67
|
+
读写同一份已校验参数,不再引入全局页面筛选状态层。
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
const objScope = useAppQueryScope()
|
|
71
|
+
const objKeys = useMemo(
|
|
72
|
+
() => fnCreateAppQueryKeys('recordDirectory', objScope),
|
|
73
|
+
[objScope]
|
|
74
|
+
)
|
|
75
|
+
const objQuery = useQuery({
|
|
76
|
+
queryKey: objKeys.fnList('records', {
|
|
77
|
+
nPage: objSearch.nPage,
|
|
78
|
+
strKeyword: objSearch.strKeyword,
|
|
79
|
+
}),
|
|
80
|
+
queryFn: ({ signal: objSignal }) =>
|
|
81
|
+
objRecordRepository.fnList(objSearch, objSignal),
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Repository 的 connected Adapter 必须把 `objSignal` 继续传给 Swagger 生成客户端。用户
|
|
86
|
+
离开页面、Key 变化或 Query 被替换时才能真正取消网络请求。服务端数据只保留在 Query
|
|
87
|
+
缓存中,不复制到 Zustand。
|
|
88
|
+
|
|
89
|
+
## Mutation 失效矩阵
|
|
90
|
+
|
|
91
|
+
失效使用最小但完整的资源根 Key。`exact: true` 只用于确定的单条详情;省略 `exact` 时
|
|
92
|
+
按前缀覆盖该根下的列表或详情。
|
|
93
|
+
|
|
94
|
+
| Mutation 结果 | 成功后的缓存动作 |
|
|
95
|
+
| ------------- | --------------------------------------------------------------- |
|
|
96
|
+
| 创建 | 失效 `fnLists(resource)` |
|
|
97
|
+
| 更新 | 失效精确 `fnDetail(resource, id)`,同时失效 `fnLists(resource)` |
|
|
98
|
+
| 删除 | 移除精确详情,再失效 `fnLists(resource)` |
|
|
99
|
+
| 批量操作 | 失效 `fnResource(resource)`;部分成功时由返回结果决定更小范围 |
|
|
100
|
+
| 关联资源变化 | 同时失效被当前 Mutation 实际改变的其他资源根 Key |
|
|
101
|
+
|
|
102
|
+
不要在 `onSuccess` 手工拼接 Key。成功后失效由服务器重新确认最终状态;请求失败时保留最后
|
|
103
|
+
一次有效服务端数据。错误提示继续使用统一 `ApiError` 和请求关联 ID。
|
|
104
|
+
|
|
105
|
+
## 乐观更新与回滚
|
|
106
|
+
|
|
107
|
+
只有可逆、冲突边界明确且用户确实需要即时反馈的操作才做乐观更新。使用
|
|
108
|
+
`fnApplyOptimisticQueryUpdate()` 会先取消同一精确 Query,再保存快照并写入乐观值;
|
|
109
|
+
`onError` 使用 `fnRollbackOptimisticQueryUpdate()` 恢复旧值。原 Query 不存在时,回滚会
|
|
110
|
+
删除临时缓存,而不是留下伪造的服务端数据。
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
const objMutation = useMutation({
|
|
114
|
+
mutationFn: (objInput) =>
|
|
115
|
+
objRecordRepository.fnUpdate(strRecordId, objInput),
|
|
116
|
+
scope: fnCreateAppMutationScope(
|
|
117
|
+
objKeys.fnDetail('records', strRecordId)
|
|
118
|
+
),
|
|
119
|
+
onMutate: (objInput) =>
|
|
120
|
+
fnApplyOptimisticQueryUpdate(
|
|
121
|
+
objQueryClient,
|
|
122
|
+
objKeys.fnDetail('records', strRecordId),
|
|
123
|
+
(objRecord) => ({ ...objRecord, ...objInput })
|
|
124
|
+
),
|
|
125
|
+
onError: (_objError, _objInput, objSnapshot) => {
|
|
126
|
+
if (objSnapshot) {
|
|
127
|
+
fnRollbackOptimisticQueryUpdate(objQueryClient, objSnapshot)
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
onSettled: async () => {
|
|
131
|
+
await Promise.all([
|
|
132
|
+
objQueryClient.invalidateQueries({
|
|
133
|
+
exact: true,
|
|
134
|
+
queryKey: objKeys.fnDetail('records', strRecordId),
|
|
135
|
+
}),
|
|
136
|
+
objQueryClient.invalidateQueries({
|
|
137
|
+
queryKey: objKeys.fnLists('records'),
|
|
138
|
+
}),
|
|
139
|
+
])
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
按钮和路由使用前端权限系统控制可见性与可操作性;Mutation 仍直接调用生成客户端,
|
|
145
|
+
最终授权由后端执行。后端返回的 `401/403` 通过统一 `ApiError` 进入回滚和错误反馈。
|
|
146
|
+
|
|
147
|
+
删除、审批、付款、批量导入等不可逆或部分成功操作默认不做乐观更新。它们等待后端返回,
|
|
148
|
+
展示明确提交状态,再按实际结果失效缓存。
|
|
149
|
+
|
|
150
|
+
批量选择由 Table 提供,Feature 使用后端批量接口并组合权限、二次确认和幂等执行;不能在
|
|
151
|
+
页面循环调用单条 Mutation。部分成功与失败明细按具体后端契约在 Feature 内展示。
|
|
152
|
+
|
|
153
|
+
## 并发策略
|
|
154
|
+
|
|
155
|
+
`fnCreateAppMutationScope()` 从资源或详情 Key 生成 TanStack Mutation `scope`。相同 scope
|
|
156
|
+
串行执行,不同 scope 并行:
|
|
157
|
+
|
|
158
|
+
- 绑定单个实体的编辑 Hook 使用 `fnDetail()`,只串行同一实体写入。
|
|
159
|
+
- 通用创建或批量 Hook 使用 `fnResource()`,以资源级串行作为安全默认值。
|
|
160
|
+
- 不要为所有 Feature 共用一个全局 scope,否则无关写入会互相阻塞。
|
|
161
|
+
- Mutation 完成后仍执行失效;串行只能控制客户端顺序,不能替代后端版本检查、事务和
|
|
162
|
+
幂等约束。
|
|
163
|
+
|
|
164
|
+
请求超时后的重复提交遵循
|
|
165
|
+
[`mutation-idempotency.md`](mutation-idempotency.md) 的原键重试约定;在后端提供幂等协议前
|
|
166
|
+
仍不能由 Query Key 伪装解决。遇到版本冲突时应展示服务端返回的冲突错误并重新获取数据,
|
|
167
|
+
不能用本地乐观值覆盖较新的服务端事实。
|
|
168
|
+
|
|
169
|
+
## 不支持范围
|
|
170
|
+
|
|
171
|
+
- 不提供万能 CRUD Hook、全局 Repository 注册表或事件总线。
|
|
172
|
+
- 不把生成 DTO 直接当作 Feature 领域模型;映射边界由 Feature 拥有。
|
|
173
|
+
- 不用 Query 缓存替代后端授权、事务、审计或幂等。
|
|
174
|
+
- 不自动持久化服务端缓存到 Local Storage。
|
|
175
|
+
- 不强制枚举、参数等目录型基础设施迁移到 Feature Key 形状。
|
|
176
|
+
|
|
177
|
+
新增 Feature 时应通过公共工厂创建所有 Key,并为至少一个列表失效、详情失效、错误回滚
|
|
178
|
+
或并发场景补充行为测试。工具层 Feature 数据模板直接复用这份契约。
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# 实时协作接入
|
|
2
|
+
|
|
3
|
+
`src/realtimeCollaboration` 提供厂商中立的文档协作会话边界。它负责
|
|
4
|
+
连接竞态、状态订阅、成员列表、手动重连和路由卸载清理;不实现 CRDT、编辑器绑定、
|
|
5
|
+
光标映射、离线合并或供应商协议。
|
|
6
|
+
|
|
7
|
+
## 职责边界
|
|
8
|
+
|
|
9
|
+
| 层级 | 必须负责 | 不负责内容 |
|
|
10
|
+
| --------------------------- | --------------------------------------------------------- | ---------------------------------- |
|
|
11
|
+
| 业务后端 | 文档级最终授权、短期会话票据、撤销、限流和审计 | 信任前端入口显隐 |
|
|
12
|
+
| 协作服务或供应商 | CRDT、WebSocket、重连、冲突收敛、光标和编辑器 Provider | 应用路由和业务权限 |
|
|
13
|
+
| 项目 Adapter | 请求短期票据、懒加载 SDK、建立连接并映射稳定事件 | 暴露 Token、管理密钥或原始文档内容 |
|
|
14
|
+
| `src/realtimeCollaboration` | 会话生命周期、竞态取消、运行时校验、成员状态和 React Hook | 持久化服务端状态或实现协作算法 |
|
|
15
|
+
| 文档 Feature | 编辑器界面、在线成员展示、同步状态、错误和只读体验 | 直接持有全局 WebSocket |
|
|
16
|
+
|
|
17
|
+
协作权限必须由后端按当前身份、租户、工作空间、文档和请求模式重新判断。路由与按钮
|
|
18
|
+
可以用前端权限系统改善体验,但 Hook 不重复执行客户端授权。
|
|
19
|
+
|
|
20
|
+
## Adapter 与短期会话
|
|
21
|
+
|
|
22
|
+
Adapter 是具体 SDK 的唯一入口。建议先使用 Swagger 生成客户端向业务后端申请一次性或
|
|
23
|
+
短时协作票据,再动态加载供应商 SDK。浏览器不能持有供应商管理密钥,票据不能进入
|
|
24
|
+
URL、日志、可观测性事件、全局 Store 或返回快照。
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import type { ICollaborationAdapter } from '@/realtimeCollaboration'
|
|
28
|
+
import { objGeneratedApi } from '@/api/generated/project'
|
|
29
|
+
|
|
30
|
+
interface IEditorBinding {
|
|
31
|
+
readonly objProvider: VendorProvider
|
|
32
|
+
readonly objSharedText: VendorSharedText
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const objContractCollaborationAdapter: ICollaborationAdapter<
|
|
36
|
+
IEditorBinding
|
|
37
|
+
> = {
|
|
38
|
+
async fnConnect(objRequest) {
|
|
39
|
+
const objSessionResponse = await objGeneratedApi.collaboration.open(
|
|
40
|
+
{
|
|
41
|
+
documentId: objRequest.strDocumentId,
|
|
42
|
+
documentType: objRequest.strDocumentType,
|
|
43
|
+
mode: objRequest.strMode,
|
|
44
|
+
workspaceId: objRequest.objScope.strWorkspaceId,
|
|
45
|
+
},
|
|
46
|
+
{ signal: objRequest.objSignal }
|
|
47
|
+
)
|
|
48
|
+
const { fnConnectVendorDocument } = await import(
|
|
49
|
+
'./vendorCollaborationAdapter'
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return fnConnectVendorDocument({
|
|
53
|
+
objSignal: objRequest.objSignal,
|
|
54
|
+
strSessionTicket: objSessionResponse.data.sessionTicket,
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`fnConnectVendorDocument` 必须返回 `ICollaborationConnection<TBinding>`:
|
|
61
|
+
|
|
62
|
+
- `objBinding` 是编辑器集成所需的项目强类型对象,基础层不会读取或持久化。
|
|
63
|
+
- `arrParticipants` 和后续 `participantsChanged` 都是最新完整列表,不是增量事件。
|
|
64
|
+
- `fnSubscribe` 返回解除全部监听器的清理函数。
|
|
65
|
+
- `fnDisconnect` 关闭 Provider、WebSocket、Awareness、CRDT 文档和编辑器绑定,且可重复调用。
|
|
66
|
+
- `connectionChanged` 表示 SDK 正在自动重连;无法恢复时发送 `sessionFailed`。
|
|
67
|
+
- `sessionFailed.strReasonCode` 只能是稳定、非敏感原因码。
|
|
68
|
+
|
|
69
|
+
Adapter 必须监听 `objSignal`。即使供应商初始化无法真正取消,也要在取消后立即释放
|
|
70
|
+
迟到的连接;控制器只允许最后一次文档请求成为活动会话。
|
|
71
|
+
|
|
72
|
+
## 路由级消费
|
|
73
|
+
|
|
74
|
+
实时协作不能装到应用根 Provider,也不提供默认页面、路由或菜单。文档 Feature 应
|
|
75
|
+
按路由懒加载编辑器、Adapter 和供应商 SDK:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { useRealtimeCollaboration } from '@/realtimeCollaboration'
|
|
79
|
+
import { objContractCollaborationAdapter } from './collaborationAdapter'
|
|
80
|
+
|
|
81
|
+
export function ContractEditor({ strDocumentId }: { strDocumentId: string }) {
|
|
82
|
+
const objCollaboration = useRealtimeCollaboration({
|
|
83
|
+
objAdapter: objContractCollaborationAdapter,
|
|
84
|
+
strDocumentId,
|
|
85
|
+
strDocumentType: 'contract',
|
|
86
|
+
strMode: 'edit',
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
if (objCollaboration.strStatus === 'connecting') {
|
|
90
|
+
return <p>正在连接协作文档…</p>
|
|
91
|
+
}
|
|
92
|
+
if (objCollaboration.strStatus === 'error') {
|
|
93
|
+
return (
|
|
94
|
+
<button onClick={objCollaboration.fnReconnect}>重新连接</button>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
if (objCollaboration.strStatus !== 'active') return null
|
|
98
|
+
|
|
99
|
+
return <ContractEditorView objBinding={objCollaboration.objBinding} />
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
身份、会话版本、租户、工作空间、语言、文档或模式变化时,Hook 会关闭旧会话再建立
|
|
104
|
+
新会话。路由卸载、`bIsEnabled` 关闭或显式调用 `fnClose` 时会取消连接、退订事件并
|
|
105
|
+
释放 SDK。`fnReconnect` 只用于致命失败后的用户重试;网络抖动的自动重连策略属于
|
|
106
|
+
SDK,并通过 `strConnectionState: 'reconnecting'` 呈现。
|
|
107
|
+
|
|
108
|
+
## 状态与用户体验
|
|
109
|
+
|
|
110
|
+
- `idle`:未启用或已经关闭,不展示陈旧编辑器绑定。
|
|
111
|
+
- `connecting`:申请票据或初始化 SDK,可展示可取消的连接反馈。
|
|
112
|
+
- `active`:可读取 `objBinding`、成员列表、连接状态和同步状态。
|
|
113
|
+
- `error`:连接失败或 SDK 状态无效,旧连接已经释放,可提供手动重连。
|
|
114
|
+
|
|
115
|
+
编辑模式应同时检查 `strMode` 和编辑器自身只读状态。同步中不能虚构“已保存”;只有
|
|
116
|
+
SDK 报告 `synced` 才能展示已同步。成员名称只作为 React 纯文本渲染,不允许作为
|
|
117
|
+
HTML;脚手架只接受有界的名称、成员 ID、用户 ID 和 active/idle 状态,不提供任意
|
|
118
|
+
成员元数据载荷。
|
|
119
|
+
|
|
120
|
+
## 安全、隐私与运维
|
|
121
|
+
|
|
122
|
+
- 票据必须短期有效、限定文档和模式,并支持权限撤销后断开现有连接。
|
|
123
|
+
- WebSocket 鉴权、Origin 校验、消息大小、速率、最大成员数和租户隔离由服务端负责。
|
|
124
|
+
- Token、Cookie、票据、文档正文、选区内容、DOM 节点和成员个人数据默认禁止采集。
|
|
125
|
+
- CSP 的 `connect-src` 只放行选定协作域名;SDK 版本、许可证和供应链风险进入项目审查。
|
|
126
|
+
- 通过 P2-02 Feature Flag/Kill Switch 控制入口和新建连接;后端仍需独立关闭能力。
|
|
127
|
+
- 供应商故障时应允许安全只读、下载或稍后重试,具体降级由文档 Feature 决定。
|
|
128
|
+
|
|
129
|
+
离线缓存、后台同步、权限过期后的本地数据清理和离线冲突交互属于 P2-08,不能因为
|
|
130
|
+
SDK 默认能力而隐式开启。更换供应商前,应验证 Binding 隔离使编辑器 Feature 不依赖
|
|
131
|
+
管理 API、内部事件名或票据格式。
|
|
132
|
+
|
|
133
|
+
## 验收重点
|
|
134
|
+
|
|
135
|
+
- 无权限时不会调用项目 Adapter,后端仍会对实际连接再次授权。
|
|
136
|
+
- 快速切换文档时只有最后一次连接可见,迟到连接会立即释放。
|
|
137
|
+
- 路由卸载会取消请求、解除订阅并断开协作资源。
|
|
138
|
+
- 成员列表、状态值、重复 ID、最大成员数和安全原因码经过运行时校验。
|
|
139
|
+
- 供应商异常事件会关闭当前会话,不泄漏底层异常、票据或文档内容。
|
|
140
|
+
- 模块没有根 Provider、默认业务页面、供应商依赖或首屏静态导入。
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# 报表、打印和模板接入
|
|
2
|
+
|
|
3
|
+
`src/reporting` 提供模板目录、服务端报表生成和当前路由打印的厂商中立边界。它复用
|
|
4
|
+
`src/files` 的任务生命周期与受保护下载能力,不包含模板设计器、通用参数表单、PDF
|
|
5
|
+
引擎、Office SDK 或具体业务报表。
|
|
6
|
+
|
|
7
|
+
## 能力边界
|
|
8
|
+
|
|
9
|
+
| 场景 | 脚手架负责 | 项目或后端负责 |
|
|
10
|
+
| ------------- | ---------------------------------------------- | -------------------------------------------- |
|
|
11
|
+
| AppTable 导出 | 已有当前页/选择/全部、CSV/XLSX 和异步任务能力 | 具体字段、权限、行数和后端导出 |
|
|
12
|
+
| 模板目录 | 身份作用域缓存、运行时校验和失效 | 模板制作、版本发布、授权和参数 DTO |
|
|
13
|
+
| 报表生成 | 取消、重试、轮询、进度、格式/MIME/文件身份校验 | 数据查询、渲染、资源限制、文件存储和最终授权 |
|
|
14
|
+
| 浏览器打印 | 调用当前路由的原生打印 | 入口权限、打印版式、分页和浏览器兼容性 |
|
|
15
|
+
| 生成文件消费 | 复用文件下载和预览边界 | 按 `fileId` 重新授权并返回真实文件 |
|
|
16
|
+
|
|
17
|
+
普通表格导出继续使用 `AppTable.exportOptions`,不要为了名称统一迁移到本模块。复杂 PDF、
|
|
18
|
+
固定格式合同、凭证、标签、套打和跨数据源汇总才使用服务端模板报表。
|
|
19
|
+
|
|
20
|
+
## 模板目录
|
|
21
|
+
|
|
22
|
+
模板目录必须来自后端接口,并且只返回当前用户在当前租户和工作空间有权使用的模板。
|
|
23
|
+
`fnCreateReportTemplateSource` 用于把 Swagger 生成客户端包装成经过校验的数据源:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { fnCreateReportTemplateSource } from '@/reporting'
|
|
27
|
+
import { objGeneratedApi } from '@/api/generated/project'
|
|
28
|
+
|
|
29
|
+
export const objReportTemplateSource = fnCreateReportTemplateSource(
|
|
30
|
+
async ({ objSignal }) => {
|
|
31
|
+
const objResponse = await objGeneratedApi.reportTemplates.list({
|
|
32
|
+
signal: objSignal,
|
|
33
|
+
})
|
|
34
|
+
return {
|
|
35
|
+
arrTemplates: objResponse.data.items.map((objTemplate) => ({
|
|
36
|
+
arrFormats: objTemplate.formats,
|
|
37
|
+
strDescription: objTemplate.description,
|
|
38
|
+
strTemplateId: objTemplate.id,
|
|
39
|
+
strTemplateName: objTemplate.name,
|
|
40
|
+
strTemplateVersion: objTemplate.version,
|
|
41
|
+
})),
|
|
42
|
+
strCatalogVersion: objResponse.data.version,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Feature 使用 `useReportTemplates` 获取目录。缓存 Key 自动包含用户、会话版本、租户、
|
|
49
|
+
工作空间和语言;后端发布、停用模板或权限变更后可调用
|
|
50
|
+
`fnInvalidateReportTemplates`。目录最多 200 项,拒绝重复模板 ID、重复格式和未知格式。
|
|
51
|
+
|
|
52
|
+
目录只包含 ID、名称、说明、不可变版本和输出格式,不接受 HTML、模板正文、任意配置
|
|
53
|
+
对象或供应商内部表达式。参数控件由具体 Feature 使用 `AppPageForm` 和 Swagger DTO
|
|
54
|
+
声明,脚手架不会根据任意 JSON Schema 生成万能业务表单。
|
|
55
|
+
|
|
56
|
+
## 服务端报表生成
|
|
57
|
+
|
|
58
|
+
`useReportGeneration<TParameters>` 复用 `useFileTask` 的 `starting`、`queued`、
|
|
59
|
+
`running`、`success`、`error` 和 `canceled` 状态。`TParameters` 应直接使用生成客户端的
|
|
60
|
+
请求 DTO 或 Feature 明确映射后的类型:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { useReportGeneration } from '@/reporting'
|
|
64
|
+
import type { ContractReportRequest } from '@/api/generated/project'
|
|
65
|
+
|
|
66
|
+
const objReportTask = useReportGeneration<ContractReportRequest>({
|
|
67
|
+
objSource: {
|
|
68
|
+
async fnStartReport({ objRequest, objScope, objSignal }) {
|
|
69
|
+
const objResponse = await objGeneratedApi.reports.create(
|
|
70
|
+
{
|
|
71
|
+
format: objRequest.strFormat,
|
|
72
|
+
parameters: objRequest.objParameters,
|
|
73
|
+
templateId: objRequest.strTemplateId,
|
|
74
|
+
templateVersion: objRequest.strTemplateVersion,
|
|
75
|
+
workspaceId: objScope.strWorkspaceId,
|
|
76
|
+
},
|
|
77
|
+
{ signal: objSignal }
|
|
78
|
+
)
|
|
79
|
+
return objResponse.data.completed
|
|
80
|
+
? {
|
|
81
|
+
strMode: 'completed',
|
|
82
|
+
objResult: fnMapReportOutput(objResponse.data),
|
|
83
|
+
}
|
|
84
|
+
: {
|
|
85
|
+
strMode: 'background',
|
|
86
|
+
strTaskId: objResponse.data.taskId,
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async fnPollReport({ objSignal, strTaskId }) {
|
|
90
|
+
const objResponse = await objGeneratedApi.reports.detail(strTaskId, {
|
|
91
|
+
signal: objSignal,
|
|
92
|
+
})
|
|
93
|
+
return fnMapReportTask(objResponse.data)
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
await objReportTask.fnRun({
|
|
99
|
+
objParameters: { contractId: strContractId },
|
|
100
|
+
strFormat: 'pdf',
|
|
101
|
+
strTemplateId: objTemplate.strTemplateId,
|
|
102
|
+
strTemplateVersion: objTemplate.strTemplateVersion,
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
生成结果只允许返回 `reportId`、`fileId`、清理后的文件名、格式和对应 MIME,不允许
|
|
107
|
+
返回 Blob、任意 URL 或模板 HTML。支持 PDF、DOCX、XLSX 和 CSV;文件名扩展名会与
|
|
108
|
+
格式对齐,格式替换、HTML MIME、无效进度和未知任务状态都会失败。
|
|
109
|
+
|
|
110
|
+
任务成功后,Feature 使用 `fnDownloadFile` 携带 `fileId` 调用受保护下载接口;预览 PDF
|
|
111
|
+
时复用 `FilePreview`。下载接口必须重新确认用户、租户、文件归属和有效期,不能因为
|
|
112
|
+
生成请求曾经成功就永久公开文件。
|
|
113
|
+
|
|
114
|
+
## 当前路由打印
|
|
115
|
+
|
|
116
|
+
简单详情页、凭证或已经安全渲染的报表页面可使用原生浏览器打印:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { fnPrintCurrentDocument } from '@/reporting'
|
|
120
|
+
|
|
121
|
+
<button
|
|
122
|
+
type='button'
|
|
123
|
+
onClick={() => fnPrintCurrentDocument()}
|
|
124
|
+
>
|
|
125
|
+
打印
|
|
126
|
+
</button>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
打印函数不接收 HTML 字符串或 URL,只打印当前受控路由。Feature 使用语义化 HTML 和
|
|
130
|
+
局部 `@media print` 样式隐藏导航、操作区并定义分页;不要用 `document.write`、
|
|
131
|
+
`innerHTML` 或弹出窗口拼接模板。浏览器 API 无法可靠区分用户打印、另存 PDF 或取消,
|
|
132
|
+
因此不能仅根据 `window.print()` 返回值记录“打印成功”的权威审计事实。
|
|
133
|
+
|
|
134
|
+
需要像素级套打、批量打印、可信页码、服务器字体、电子签章或可重复归档时,应由后端
|
|
135
|
+
生成 PDF,再走受保护文件预览/下载。浏览器打印不能作为合规归档结果。
|
|
136
|
+
|
|
137
|
+
## 安全与服务端要求
|
|
138
|
+
|
|
139
|
+
- 服务端按当前身份、租户、工作空间、模板、版本、参数和数据范围执行最终授权。
|
|
140
|
+
- 参数 DTO、最大时间范围、最大行数、并发任务、执行时长和文件大小必须有硬限制。
|
|
141
|
+
- 模板发布采用不可变版本;旧版本撤销后,服务端拒绝新的生成请求。
|
|
142
|
+
- 模板表达式和辅助函数采用白名单沙箱,禁止文件系统、网络、进程和任意代码执行。
|
|
143
|
+
- CSV/XLSX 生成必须防止公式注入;PDF/DOCX 资源地址必须经过协议与 Origin 控制。
|
|
144
|
+
- 文件元数据、模板内容、业务参数、报表正文、Token 和签名 URL 不进入前端日志。
|
|
145
|
+
- 生成、下载和高风险打印入口应产生后端审计事实,并支持 P2-02 Kill Switch。
|
|
146
|
+
- 外部 PDF/Office 服务或字体 CDN 必须经过许可证、数据合规、CSP 和退出策略审查。
|
|
147
|
+
|
|
148
|
+
## 按需加载和验收
|
|
149
|
+
|
|
150
|
+
报表路由应懒加载报表 Feature、模板参数表单和任何项目选定的渲染 SDK。本模块不接入
|
|
151
|
+
应用根 Provider、默认路由或菜单;Knip 入口只声明它是脚手架的可选公共能力,不会让
|
|
152
|
+
代码进入生产首屏模块图。
|
|
153
|
+
|
|
154
|
+
验收至少覆盖:后端 `401/403` 错误反馈、模板目录隔离身份作用域、任务取消与重试、同步
|
|
155
|
+
和后台结果、格式/MIME 替换、恶意文件名、模板版本失效、受保护下载,以及主要目标
|
|
156
|
+
浏览器的分页、长表格、中文字体和打印预览。
|