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,253 @@
|
|
|
1
|
+
import { OptionalEditorError } from './errors'
|
|
2
|
+
import type {
|
|
3
|
+
IMigrateOptionalEditorDocumentOptions,
|
|
4
|
+
IOptionalEditorDocument,
|
|
5
|
+
IOptionalEditorDocumentInput,
|
|
6
|
+
IOptionalEditorMountInput,
|
|
7
|
+
IOptionalEditorMountRequest,
|
|
8
|
+
TOptionalEditorKind,
|
|
9
|
+
TOptionalEditorMode,
|
|
10
|
+
} from './types'
|
|
11
|
+
|
|
12
|
+
const nMaxIdentifierLength = 200
|
|
13
|
+
const nMaxMigrationSteps = 20
|
|
14
|
+
|
|
15
|
+
function fnNormalizeRequiredText(
|
|
16
|
+
strValue: string,
|
|
17
|
+
strField: string,
|
|
18
|
+
strCode: 'INVALID_DOCUMENT' | 'INVALID_REQUEST' | 'MIGRATION_FAILED'
|
|
19
|
+
) {
|
|
20
|
+
const strNormalizedValue = typeof strValue === 'string' ? strValue.trim() : ''
|
|
21
|
+
if (!strNormalizedValue || strNormalizedValue.length > nMaxIdentifierLength) {
|
|
22
|
+
throw new OptionalEditorError(
|
|
23
|
+
strCode,
|
|
24
|
+
`可选编辑器字段 ${strField} 必须是长度不超过 ${nMaxIdentifierLength} 的非空字符串。`
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
return strNormalizedValue
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 校验地图、富文本或图形编辑器能力分类。 */
|
|
31
|
+
export function fnNormalizeOptionalEditorKind(
|
|
32
|
+
strEditorKind: string
|
|
33
|
+
): TOptionalEditorKind {
|
|
34
|
+
if (
|
|
35
|
+
strEditorKind !== 'diagram' &&
|
|
36
|
+
strEditorKind !== 'map' &&
|
|
37
|
+
strEditorKind !== 'richText'
|
|
38
|
+
) {
|
|
39
|
+
throw new OptionalEditorError(
|
|
40
|
+
'INVALID_DOCUMENT',
|
|
41
|
+
'文档包含不受支持的编辑器能力分类。'
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
return strEditorKind
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** 校验编辑器查看或编辑模式。 */
|
|
48
|
+
export function fnNormalizeOptionalEditorMode(
|
|
49
|
+
strMode: string
|
|
50
|
+
): TOptionalEditorMode {
|
|
51
|
+
if (strMode !== 'edit' && strMode !== 'view') {
|
|
52
|
+
throw new OptionalEditorError(
|
|
53
|
+
'INVALID_REQUEST',
|
|
54
|
+
'可选编辑器模式必须是 edit 或 view。'
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
return strMode
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 校验文档信封并保持项目拥有的结构化文档值。 */
|
|
61
|
+
export function fnNormalizeOptionalEditorDocument<TDocument extends object>(
|
|
62
|
+
objInput: IOptionalEditorDocumentInput<TDocument>,
|
|
63
|
+
strExpectedKind?: TOptionalEditorKind
|
|
64
|
+
): IOptionalEditorDocument<TDocument> {
|
|
65
|
+
if (
|
|
66
|
+
!objInput ||
|
|
67
|
+
typeof objInput !== 'object' ||
|
|
68
|
+
!objInput.objDocument ||
|
|
69
|
+
typeof objInput.objDocument !== 'object' ||
|
|
70
|
+
Array.isArray(objInput.objDocument)
|
|
71
|
+
) {
|
|
72
|
+
throw new OptionalEditorError('INVALID_DOCUMENT', '编辑器文档无效。')
|
|
73
|
+
}
|
|
74
|
+
const strEditorKind = fnNormalizeOptionalEditorKind(objInput.strEditorKind)
|
|
75
|
+
if (strExpectedKind && strEditorKind !== strExpectedKind) {
|
|
76
|
+
throw new OptionalEditorError(
|
|
77
|
+
'INVALID_DOCUMENT',
|
|
78
|
+
'文档类型与当前编辑器 Adapter 不匹配。'
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
objDocument: objInput.objDocument,
|
|
83
|
+
strContentRevision:
|
|
84
|
+
objInput.strContentRevision === undefined
|
|
85
|
+
? undefined
|
|
86
|
+
: fnNormalizeRequiredText(
|
|
87
|
+
objInput.strContentRevision,
|
|
88
|
+
'strContentRevision',
|
|
89
|
+
'INVALID_DOCUMENT'
|
|
90
|
+
),
|
|
91
|
+
strDocumentId: fnNormalizeRequiredText(
|
|
92
|
+
objInput.strDocumentId,
|
|
93
|
+
'strDocumentId',
|
|
94
|
+
'INVALID_DOCUMENT'
|
|
95
|
+
),
|
|
96
|
+
strEditorKind,
|
|
97
|
+
strSchemaVersion: fnNormalizeRequiredText(
|
|
98
|
+
objInput.strSchemaVersion,
|
|
99
|
+
'strSchemaVersion',
|
|
100
|
+
'INVALID_DOCUMENT'
|
|
101
|
+
),
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 校验专用容器、身份作用域、文档和模式并创建完整挂载请求。 */
|
|
106
|
+
export function fnNormalizeOptionalEditorMountRequest<TDocument extends object>(
|
|
107
|
+
objInput: IOptionalEditorMountInput<TDocument>,
|
|
108
|
+
strExpectedKind: TOptionalEditorKind,
|
|
109
|
+
fnValidateDocument: (objDocument: TDocument) => TDocument,
|
|
110
|
+
objSignal: AbortSignal
|
|
111
|
+
): IOptionalEditorMountRequest<TDocument> {
|
|
112
|
+
if (
|
|
113
|
+
!objInput ||
|
|
114
|
+
typeof objInput !== 'object' ||
|
|
115
|
+
typeof HTMLElement === 'undefined' ||
|
|
116
|
+
!(objInput.objContainer instanceof HTMLElement)
|
|
117
|
+
) {
|
|
118
|
+
throw new OptionalEditorError(
|
|
119
|
+
'INVALID_REQUEST',
|
|
120
|
+
'可选编辑器必须挂载到有效的专用 HTMLElement。'
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
const objDocument = fnNormalizeOptionalEditorDocument(
|
|
124
|
+
objInput.objDocument,
|
|
125
|
+
strExpectedKind
|
|
126
|
+
)
|
|
127
|
+
let objValidatedDocument: TDocument
|
|
128
|
+
try {
|
|
129
|
+
objValidatedDocument = fnValidateDocument(objDocument.objDocument)
|
|
130
|
+
} catch {
|
|
131
|
+
throw new OptionalEditorError(
|
|
132
|
+
'INVALID_DOCUMENT',
|
|
133
|
+
'项目 Adapter 拒绝了当前结构化文档。'
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
return Object.freeze({
|
|
137
|
+
objContainer: objInput.objContainer,
|
|
138
|
+
objDocument: Object.freeze({
|
|
139
|
+
...objDocument,
|
|
140
|
+
objDocument: objValidatedDocument,
|
|
141
|
+
}),
|
|
142
|
+
objScope: objInput.objScope,
|
|
143
|
+
objSignal,
|
|
144
|
+
strMode: fnNormalizeOptionalEditorMode(objInput.strMode),
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** 清理供应商失败原因码,避免正文、URL 或堆栈进入快照。 */
|
|
149
|
+
export function fnNormalizeOptionalEditorReasonCode(
|
|
150
|
+
strReasonCode: string | undefined
|
|
151
|
+
) {
|
|
152
|
+
if (strReasonCode === undefined) return undefined
|
|
153
|
+
const strNormalizedValue = strReasonCode.trim()
|
|
154
|
+
return /^[A-Z0-9_.:-]{1,100}$/.test(strNormalizedValue)
|
|
155
|
+
? strNormalizedValue
|
|
156
|
+
: undefined
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** 按唯一线性路径迁移项目结构版本,并在每一步重新校验。 */
|
|
160
|
+
export function fnMigrateOptionalEditorDocument<TDocument extends object>({
|
|
161
|
+
arrMigrations,
|
|
162
|
+
objDocument: objDocumentInput,
|
|
163
|
+
fnValidateDocument,
|
|
164
|
+
strTargetVersion: strTargetVersionInput,
|
|
165
|
+
}: IMigrateOptionalEditorDocumentOptions<TDocument>): IOptionalEditorDocument<TDocument> {
|
|
166
|
+
const objDocument = fnNormalizeOptionalEditorDocument(objDocumentInput)
|
|
167
|
+
const strTargetVersion = fnNormalizeRequiredText(
|
|
168
|
+
strTargetVersionInput,
|
|
169
|
+
'strTargetVersion',
|
|
170
|
+
'MIGRATION_FAILED'
|
|
171
|
+
)
|
|
172
|
+
if (arrMigrations.length > nMaxMigrationSteps) {
|
|
173
|
+
throw new OptionalEditorError(
|
|
174
|
+
'MIGRATION_FAILED',
|
|
175
|
+
`单次文档迁移最多允许 ${nMaxMigrationSteps} 步。`
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
const objMigrationByVersion = new Map(
|
|
179
|
+
arrMigrations.map((objMigration) => [
|
|
180
|
+
fnNormalizeRequiredText(
|
|
181
|
+
objMigration.strFromVersion,
|
|
182
|
+
'strFromVersion',
|
|
183
|
+
'MIGRATION_FAILED'
|
|
184
|
+
),
|
|
185
|
+
objMigration,
|
|
186
|
+
])
|
|
187
|
+
)
|
|
188
|
+
if (objMigrationByVersion.size !== arrMigrations.length) {
|
|
189
|
+
throw new OptionalEditorError(
|
|
190
|
+
'MIGRATION_FAILED',
|
|
191
|
+
'同一个文档版本只能声明一个前向迁移。'
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let objCurrentValue: TDocument
|
|
196
|
+
try {
|
|
197
|
+
objCurrentValue = fnValidateDocument(objDocument.objDocument)
|
|
198
|
+
} catch {
|
|
199
|
+
throw new OptionalEditorError(
|
|
200
|
+
'INVALID_DOCUMENT',
|
|
201
|
+
'迁移前文档没有通过项目 Adapter 校验。'
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
let strCurrentVersion = objDocument.strSchemaVersion
|
|
205
|
+
const objVisitedVersions = new Set<string>()
|
|
206
|
+
for (let nStep = 0; strCurrentVersion !== strTargetVersion; nStep += 1) {
|
|
207
|
+
if (
|
|
208
|
+
nStep >= nMaxMigrationSteps ||
|
|
209
|
+
objVisitedVersions.has(strCurrentVersion)
|
|
210
|
+
) {
|
|
211
|
+
throw new OptionalEditorError(
|
|
212
|
+
'MIGRATION_FAILED',
|
|
213
|
+
'文档迁移路径包含循环或超过最大步数。'
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
objVisitedVersions.add(strCurrentVersion)
|
|
217
|
+
const objMigration = objMigrationByVersion.get(strCurrentVersion)
|
|
218
|
+
if (!objMigration) {
|
|
219
|
+
throw new OptionalEditorError(
|
|
220
|
+
'MIGRATION_PATH_MISSING',
|
|
221
|
+
`缺少从文档版本 ${strCurrentVersion} 开始的迁移。`
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
const strNextVersion = fnNormalizeRequiredText(
|
|
225
|
+
objMigration.strToVersion,
|
|
226
|
+
'strToVersion',
|
|
227
|
+
'MIGRATION_FAILED'
|
|
228
|
+
)
|
|
229
|
+
if (strNextVersion === strCurrentVersion) {
|
|
230
|
+
throw new OptionalEditorError(
|
|
231
|
+
'MIGRATION_FAILED',
|
|
232
|
+
'文档迁移不能指向相同版本。'
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
objCurrentValue = fnValidateDocument(
|
|
237
|
+
objMigration.fnMigrate(objCurrentValue)
|
|
238
|
+
)
|
|
239
|
+
} catch {
|
|
240
|
+
throw new OptionalEditorError(
|
|
241
|
+
'MIGRATION_FAILED',
|
|
242
|
+
`文档从版本 ${strCurrentVersion} 迁移失败。`
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
strCurrentVersion = strNextVersion
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return Object.freeze({
|
|
249
|
+
...objDocument,
|
|
250
|
+
objDocument: objCurrentValue,
|
|
251
|
+
strSchemaVersion: strCurrentVersion,
|
|
252
|
+
})
|
|
253
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useEffectEvent,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
useSyncExternalStore,
|
|
8
|
+
} from 'react'
|
|
9
|
+
import { useAppQueryScope } from '@/api/query'
|
|
10
|
+
import { fnCreateOptionalEditorController } from './controller'
|
|
11
|
+
import type {
|
|
12
|
+
IOptionalEditorMountInput,
|
|
13
|
+
IUseOptionalEditorOptions,
|
|
14
|
+
TUseOptionalEditorResult,
|
|
15
|
+
} from './types'
|
|
16
|
+
|
|
17
|
+
/** 在当前路由拥有一个可销毁、可导出且带 dirty 状态的可选编辑器会话。 */
|
|
18
|
+
export function useOptionalEditor<TDocument extends object, TBinding>({
|
|
19
|
+
bIsEnabled = true,
|
|
20
|
+
objAdapter,
|
|
21
|
+
objDocument,
|
|
22
|
+
strMode,
|
|
23
|
+
strWorkspaceId,
|
|
24
|
+
}: IUseOptionalEditorOptions<TDocument, TBinding>): TUseOptionalEditorResult<
|
|
25
|
+
TDocument,
|
|
26
|
+
TBinding
|
|
27
|
+
> {
|
|
28
|
+
const objScope = useAppQueryScope({ strWorkspaceId })
|
|
29
|
+
const [objContainer, fnSetContainer] = useState<HTMLElement | null>(null)
|
|
30
|
+
const objController = useMemo(
|
|
31
|
+
() => fnCreateOptionalEditorController(objAdapter),
|
|
32
|
+
[objAdapter]
|
|
33
|
+
)
|
|
34
|
+
const fnCreateMountInput = useEffectEvent(
|
|
35
|
+
(objNextContainer: HTMLElement): IOptionalEditorMountInput<TDocument> => ({
|
|
36
|
+
objContainer: objNextContainer,
|
|
37
|
+
objDocument,
|
|
38
|
+
objScope,
|
|
39
|
+
strMode,
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
const objSnapshot = useSyncExternalStore(
|
|
43
|
+
objController.fnSubscribe,
|
|
44
|
+
objController.fnGetSnapshot,
|
|
45
|
+
objController.fnGetSnapshot
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!bIsEnabled || !objContainer) {
|
|
50
|
+
objController.fnClose()
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
void objController.fnMount(fnCreateMountInput(objContainer))
|
|
54
|
+
return () => {
|
|
55
|
+
objController.fnClose()
|
|
56
|
+
}
|
|
57
|
+
}, [
|
|
58
|
+
bIsEnabled,
|
|
59
|
+
objContainer,
|
|
60
|
+
objController,
|
|
61
|
+
objDocument.strContentRevision,
|
|
62
|
+
objDocument.strDocumentId,
|
|
63
|
+
objDocument.strEditorKind,
|
|
64
|
+
objDocument.strSchemaVersion,
|
|
65
|
+
objScope,
|
|
66
|
+
strMode,
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
const fnClose = useCallback(() => {
|
|
70
|
+
objController.fnClose()
|
|
71
|
+
}, [objController])
|
|
72
|
+
const fnExportDocument = useCallback(() => {
|
|
73
|
+
return objController.fnExportDocument()
|
|
74
|
+
}, [objController])
|
|
75
|
+
const fnMarkSaved = useCallback(() => {
|
|
76
|
+
objController.fnMarkSaved()
|
|
77
|
+
}, [objController])
|
|
78
|
+
|
|
79
|
+
return useMemo(
|
|
80
|
+
() => ({
|
|
81
|
+
...objSnapshot,
|
|
82
|
+
fnClose,
|
|
83
|
+
fnExportDocument,
|
|
84
|
+
fnMarkSaved,
|
|
85
|
+
fnSetContainer,
|
|
86
|
+
}),
|
|
87
|
+
[fnClose, fnExportDocument, fnMarkSaved, objSnapshot]
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { IAppQueryScope } from '@/api/query'
|
|
2
|
+
import type { OptionalEditorError } from './errors'
|
|
3
|
+
|
|
4
|
+
/** 脚手架可选编辑器的稳定能力分类。 */
|
|
5
|
+
export type TOptionalEditorKind = 'diagram' | 'map' | 'richText'
|
|
6
|
+
|
|
7
|
+
/** 可选编辑器当前查看或编辑模式。 */
|
|
8
|
+
export type TOptionalEditorMode = 'edit' | 'view'
|
|
9
|
+
|
|
10
|
+
/** 可选编辑器边界的稳定错误码。 */
|
|
11
|
+
export type TOptionalEditorErrorCode =
|
|
12
|
+
| 'ADAPTER_FAILED'
|
|
13
|
+
| 'EXPORT_FAILED'
|
|
14
|
+
| 'INVALID_DOCUMENT'
|
|
15
|
+
| 'INVALID_EVENT'
|
|
16
|
+
| 'INVALID_REQUEST'
|
|
17
|
+
| 'MIGRATION_FAILED'
|
|
18
|
+
| 'MIGRATION_PATH_MISSING'
|
|
19
|
+
| 'SESSION_INACTIVE'
|
|
20
|
+
|
|
21
|
+
/** 从接口或本地迁移边界进入编辑器的文档信封。 */
|
|
22
|
+
export interface IOptionalEditorDocumentInput<TDocument extends object> {
|
|
23
|
+
/** 项目定义且经过 Adapter 校验的结构化文档值。 */
|
|
24
|
+
objDocument: TDocument
|
|
25
|
+
/** 同一文档 ID 的服务端内容版本;变化时 Hook 会重建编辑器会话。 */
|
|
26
|
+
strContentRevision?: string
|
|
27
|
+
/** 后端授权返回的稳定业务文档 ID。 */
|
|
28
|
+
strDocumentId: string
|
|
29
|
+
/** 文档所属编辑器能力;不接受任意供应商名称。 */
|
|
30
|
+
strEditorKind: string
|
|
31
|
+
/** 项目拥有的不可变文档结构版本,不等同于 SDK 版本。 */
|
|
32
|
+
strSchemaVersion: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 经过校验、可交给具体编辑器 Adapter 的文档信封。 */
|
|
36
|
+
export interface IOptionalEditorDocument<TDocument extends object> {
|
|
37
|
+
/** 项目定义且经过 Adapter 校验的结构化文档值。 */
|
|
38
|
+
readonly objDocument: TDocument
|
|
39
|
+
/** 同一文档 ID 的服务端内容版本。 */
|
|
40
|
+
readonly strContentRevision?: string
|
|
41
|
+
/** 后端授权返回的稳定业务文档 ID。 */
|
|
42
|
+
readonly strDocumentId: string
|
|
43
|
+
/** 当前地图、富文本或图形编辑器能力分类。 */
|
|
44
|
+
readonly strEditorKind: TOptionalEditorKind
|
|
45
|
+
/** 项目拥有的不可变文档结构版本。 */
|
|
46
|
+
readonly strSchemaVersion: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 打开一个可选编辑器会话所需的输入。 */
|
|
50
|
+
export interface IOptionalEditorMountInput<TDocument extends object> {
|
|
51
|
+
/** 仅供 SDK 挂载的空白专用容器,不得传入应用根节点。 */
|
|
52
|
+
readonly objContainer: HTMLElement
|
|
53
|
+
/** 当前需要编辑或查看的结构化文档。 */
|
|
54
|
+
readonly objDocument: IOptionalEditorDocumentInput<TDocument>
|
|
55
|
+
/** 当前用户、会话、租户、工作空间和语言组成的身份作用域。 */
|
|
56
|
+
readonly objScope: IAppQueryScope
|
|
57
|
+
/** 当前查看或编辑模式。 */
|
|
58
|
+
readonly strMode: TOptionalEditorMode
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 交给项目编辑器 Adapter 的完整挂载请求。 */
|
|
62
|
+
export interface IOptionalEditorMountRequest<
|
|
63
|
+
TDocument extends object,
|
|
64
|
+
> extends Omit<IOptionalEditorMountInput<TDocument>, 'objDocument'> {
|
|
65
|
+
/** 经过基础字段和项目文档校验的结构化文档。 */
|
|
66
|
+
readonly objDocument: IOptionalEditorDocument<TDocument>
|
|
67
|
+
/** 文档切换、容器卸载或路由离开时触发的取消信号。 */
|
|
68
|
+
readonly objSignal: AbortSignal
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 编辑器产生的 dirty 状态变化事件。 */
|
|
72
|
+
export interface IOptionalEditorDirtyChangedEvent {
|
|
73
|
+
/** 当前文档是否包含尚未由业务后端确认保存的变化。 */
|
|
74
|
+
readonly bIsDirty: boolean
|
|
75
|
+
/** 可判别事件类型。 */
|
|
76
|
+
readonly strType: 'dirtyChanged'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 编辑器 SDK 无法继续工作时产生的安全失败事件。 */
|
|
80
|
+
export interface IOptionalEditorSessionFailedEvent {
|
|
81
|
+
/** 稳定、非敏感原因码,不得包含正文、Token、URL 或堆栈。 */
|
|
82
|
+
readonly strReasonCode?: string
|
|
83
|
+
/** 可判别事件类型。 */
|
|
84
|
+
readonly strType: 'sessionFailed'
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 可选编辑器允许发送给控制器的全部事件。 */
|
|
88
|
+
export type TOptionalEditorSessionEvent =
|
|
89
|
+
| IOptionalEditorDirtyChangedEvent
|
|
90
|
+
| IOptionalEditorSessionFailedEvent
|
|
91
|
+
|
|
92
|
+
/** 一个已经挂载到专用容器的供应商编辑器会话。 */
|
|
93
|
+
export interface IOptionalEditorSession<TDocument extends object, TBinding> {
|
|
94
|
+
/** 交给具体 Feature 使用的项目强类型编辑器 Binding。 */
|
|
95
|
+
readonly objBinding: TBinding
|
|
96
|
+
/**
|
|
97
|
+
* 销毁编辑器实例、事件监听、Worker、Observer、对象 URL 和专用 DOM;必须可重复调用。
|
|
98
|
+
*/
|
|
99
|
+
readonly fnDestroy: () => Promise<void> | void
|
|
100
|
+
/** 从 SDK 导出当前结构化文档,不得返回 HTML DOM、Canvas 或供应商实例。 */
|
|
101
|
+
readonly fnReadDocument: () => Promise<TDocument> | TDocument
|
|
102
|
+
/** 订阅 dirty 和致命失败事件;返回函数必须解除全部监听。 */
|
|
103
|
+
readonly fnSubscribe: (
|
|
104
|
+
fnOnEvent: (objEvent: TOptionalEditorSessionEvent) => void
|
|
105
|
+
) => () => void
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** 项目接入具体地图、富文本或图形 SDK 的唯一边界。 */
|
|
109
|
+
export interface IOptionalEditorAdapter<TDocument extends object, TBinding> {
|
|
110
|
+
/** 当前 Adapter 支持的唯一编辑器能力。 */
|
|
111
|
+
readonly strEditorKind: TOptionalEditorKind
|
|
112
|
+
/** 懒加载 SDK 并挂载到专用容器。 */
|
|
113
|
+
readonly fnMount: (
|
|
114
|
+
objRequest: IOptionalEditorMountRequest<TDocument>
|
|
115
|
+
) => Promise<IOptionalEditorSession<TDocument, TBinding>>
|
|
116
|
+
/** 在挂载、迁移和导出后校验项目拥有的结构化文档契约。 */
|
|
117
|
+
readonly fnValidateDocument: (objDocument: TDocument) => TDocument
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** 尚未挂载可选编辑器。 */
|
|
121
|
+
export interface IOptionalEditorIdleSnapshot {
|
|
122
|
+
/** 每次可观察状态变化后递增。 */
|
|
123
|
+
readonly nRevision: number
|
|
124
|
+
/** 可判别空闲状态。 */
|
|
125
|
+
readonly strStatus: 'idle'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** 正在校验文档、加载 SDK 或挂载编辑器。 */
|
|
129
|
+
export interface IOptionalEditorLoadingSnapshot {
|
|
130
|
+
/** 每次可观察状态变化后递增。 */
|
|
131
|
+
readonly nRevision: number
|
|
132
|
+
/** 同一文档 ID 的服务端内容版本。 */
|
|
133
|
+
readonly strContentRevision?: string
|
|
134
|
+
/** 当前准备挂载的业务文档 ID。 */
|
|
135
|
+
readonly strDocumentId: string
|
|
136
|
+
/** 当前编辑器能力分类。 */
|
|
137
|
+
readonly strEditorKind: TOptionalEditorKind
|
|
138
|
+
/** 当前查看或编辑模式。 */
|
|
139
|
+
readonly strMode: TOptionalEditorMode
|
|
140
|
+
/** 当前项目文档结构版本。 */
|
|
141
|
+
readonly strSchemaVersion: string
|
|
142
|
+
/** 可判别加载状态。 */
|
|
143
|
+
readonly strStatus: 'loading'
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** SDK 已经挂载且可以由 Feature 消费。 */
|
|
147
|
+
export interface IOptionalEditorActiveSnapshot<TBinding> {
|
|
148
|
+
/** 是否包含尚未由业务后端确认保存的变化。 */
|
|
149
|
+
readonly bIsDirty: boolean
|
|
150
|
+
/** 每次可观察状态变化后递增。 */
|
|
151
|
+
readonly nRevision: number
|
|
152
|
+
/** 交给具体 Feature 的项目强类型编辑器 Binding。 */
|
|
153
|
+
readonly objBinding: TBinding
|
|
154
|
+
/** 同一文档 ID 的服务端内容版本。 */
|
|
155
|
+
readonly strContentRevision?: string
|
|
156
|
+
/** 当前业务文档 ID。 */
|
|
157
|
+
readonly strDocumentId: string
|
|
158
|
+
/** 当前编辑器能力分类。 */
|
|
159
|
+
readonly strEditorKind: TOptionalEditorKind
|
|
160
|
+
/** 当前查看或编辑模式。 */
|
|
161
|
+
readonly strMode: TOptionalEditorMode
|
|
162
|
+
/** 当前项目文档结构版本。 */
|
|
163
|
+
readonly strSchemaVersion: string
|
|
164
|
+
/** 可判别活动状态。 */
|
|
165
|
+
readonly strStatus: 'active'
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** 文档、Adapter、SDK 或迁移无法继续工作。 */
|
|
169
|
+
export interface IOptionalEditorErrorSnapshot {
|
|
170
|
+
/** 每次可观察状态变化后递增。 */
|
|
171
|
+
readonly nRevision: number
|
|
172
|
+
/** 已清理供应商细节的稳定错误。 */
|
|
173
|
+
readonly objError: OptionalEditorError
|
|
174
|
+
/** 可判别失败状态。 */
|
|
175
|
+
readonly strStatus: 'error'
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** React 与非 React 消费者读取的统一可选编辑器状态。 */
|
|
179
|
+
export type TOptionalEditorSnapshot<TBinding> =
|
|
180
|
+
| IOptionalEditorActiveSnapshot<TBinding>
|
|
181
|
+
| IOptionalEditorErrorSnapshot
|
|
182
|
+
| IOptionalEditorIdleSnapshot
|
|
183
|
+
| IOptionalEditorLoadingSnapshot
|
|
184
|
+
|
|
185
|
+
/** 非 React 可选编辑器生命周期控制器。 */
|
|
186
|
+
export interface IOptionalEditorController<TDocument extends object, TBinding> {
|
|
187
|
+
/** 取消挂载、解除订阅并销毁当前 SDK 会话。 */
|
|
188
|
+
readonly fnClose: () => TOptionalEditorSnapshot<TBinding>
|
|
189
|
+
/** 导出并重新校验当前结构化文档。 */
|
|
190
|
+
readonly fnExportDocument: () => Promise<IOptionalEditorDocument<TDocument>>
|
|
191
|
+
/** 同步读取当前稳定快照。 */
|
|
192
|
+
readonly fnGetSnapshot: () => TOptionalEditorSnapshot<TBinding>
|
|
193
|
+
/** 业务保存成功后清除 dirty 状态。 */
|
|
194
|
+
readonly fnMarkSaved: () => TOptionalEditorSnapshot<TBinding>
|
|
195
|
+
/** 在专用容器挂载或替换编辑器;只有最后一次请求可以生效。 */
|
|
196
|
+
readonly fnMount: (
|
|
197
|
+
objInput: IOptionalEditorMountInput<TDocument>
|
|
198
|
+
) => Promise<TOptionalEditorSnapshot<TBinding>>
|
|
199
|
+
/** 订阅控制器快照变化。 */
|
|
200
|
+
readonly fnSubscribe: (fnListener: () => void) => () => void
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** 一步项目文档结构迁移。 */
|
|
204
|
+
export interface IOptionalEditorMigration<TDocument extends object> {
|
|
205
|
+
/** 迁移前的项目结构版本。 */
|
|
206
|
+
readonly strFromVersion: string
|
|
207
|
+
/** 迁移后的项目结构版本。 */
|
|
208
|
+
readonly strToVersion: string
|
|
209
|
+
/** 无副作用地返回新结构;不得读取网络、DOM 或供应商全局状态。 */
|
|
210
|
+
readonly fnMigrate: (objDocument: TDocument) => TDocument
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** 执行可选编辑器文档迁移的完整参数。 */
|
|
214
|
+
export interface IMigrateOptionalEditorDocumentOptions<
|
|
215
|
+
TDocument extends object,
|
|
216
|
+
> {
|
|
217
|
+
/** 唯一、线性的前向迁移列表。 */
|
|
218
|
+
readonly arrMigrations: readonly IOptionalEditorMigration<TDocument>[]
|
|
219
|
+
/** 需要迁移的结构化文档信封。 */
|
|
220
|
+
readonly objDocument: IOptionalEditorDocumentInput<TDocument>
|
|
221
|
+
/** 每一步之后执行的项目文档运行时校验。 */
|
|
222
|
+
readonly fnValidateDocument: (objDocument: TDocument) => TDocument
|
|
223
|
+
/** 目标项目结构版本。 */
|
|
224
|
+
readonly strTargetVersion: string
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 路由级可选编辑器 Hook 的公共参数。 */
|
|
228
|
+
export interface IUseOptionalEditorOptions<TDocument extends object, TBinding> {
|
|
229
|
+
/** 是否允许挂载编辑器,默认启用。 */
|
|
230
|
+
readonly bIsEnabled?: boolean
|
|
231
|
+
/** 项目编辑器 SDK Adapter。 */
|
|
232
|
+
readonly objAdapter: IOptionalEditorAdapter<TDocument, TBinding>
|
|
233
|
+
/** 当前结构化业务文档。 */
|
|
234
|
+
readonly objDocument: IOptionalEditorDocumentInput<TDocument>
|
|
235
|
+
/** 当前查看或编辑模式。 */
|
|
236
|
+
readonly strMode: TOptionalEditorMode
|
|
237
|
+
/** 跨工作空间 Feature 显式指定的工作空间 ID。 */
|
|
238
|
+
readonly strWorkspaceId?: string
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** 路由级可选编辑器 Hook 返回的快照与命令。 */
|
|
242
|
+
export type TUseOptionalEditorResult<
|
|
243
|
+
TDocument extends object,
|
|
244
|
+
TBinding,
|
|
245
|
+
> = TOptionalEditorSnapshot<TBinding> & {
|
|
246
|
+
/** 关闭并销毁当前编辑器会话。 */
|
|
247
|
+
readonly fnClose: () => void
|
|
248
|
+
/** 导出并重新校验当前结构化文档。 */
|
|
249
|
+
readonly fnExportDocument: () => Promise<IOptionalEditorDocument<TDocument>>
|
|
250
|
+
/** 业务保存成功后清除 dirty 状态。 */
|
|
251
|
+
readonly fnMarkSaved: () => void
|
|
252
|
+
/** 传给专用编辑器宿主元素的 React ref 回调。 */
|
|
253
|
+
readonly fnSetContainer: (objContainer: HTMLElement | null) => void
|
|
254
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useAuthStore } from '@/stores/authStore'
|
|
2
|
+
import { fnHasPermissions } from '@/lib/accessControl'
|
|
3
|
+
import type { TPermissionMatchMode, TPermissionRequirement } from './types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 响应式判断当前用户是否具备操作权限。
|
|
7
|
+
*
|
|
8
|
+
* 权限数据直接来自认证会话;身份刷新后组件会自动重新渲染。
|
|
9
|
+
*/
|
|
10
|
+
export function usePermission(
|
|
11
|
+
objRequirement?: TPermissionRequirement,
|
|
12
|
+
strMatchMode: TPermissionMatchMode = 'all'
|
|
13
|
+
) {
|
|
14
|
+
const objUser = useAuthStore((objState) => objState.objUser)
|
|
15
|
+
return fnHasPermissions(objUser, objRequirement, strMatchMode)
|
|
16
|
+
}
|