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,195 @@
|
|
|
1
|
+
import type { TAppLocale } from '@/locale/types'
|
|
2
|
+
|
|
3
|
+
/** 浏览器启动时加载的应用公开配置。不得包含密码、Token 或其他密钥。 */
|
|
4
|
+
export interface IRuntimeConfig {
|
|
5
|
+
/** 运行时配置契约版本;不兼容变更时递增。 */
|
|
6
|
+
nSchemaVersion: 1
|
|
7
|
+
/** 应用品牌、运行模式和浏览器存储配置。 */
|
|
8
|
+
app: IRuntimeApplicationConfig
|
|
9
|
+
/** 后端 API 的浏览器运行时地址。 */
|
|
10
|
+
api: IRuntimeApiConfig
|
|
11
|
+
/** 登录、刷新和退出使用的公开认证参数。 */
|
|
12
|
+
auth: IRuntimeAuthConfig
|
|
13
|
+
/** 日志开关和部署环境;不包含供应商密钥。 */
|
|
14
|
+
observability: IRuntimeObservabilityConfig
|
|
15
|
+
/** 默认语言与统一时区。 */
|
|
16
|
+
locale: IRuntimeLocaleConfig
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 应用默认语言与时区配置。 */
|
|
20
|
+
export interface IRuntimeLocaleConfig {
|
|
21
|
+
/** 当前内建 BCP 47 语言标签。 */
|
|
22
|
+
strLocale: TAppLocale
|
|
23
|
+
/** 统一 IANA 时区,例如 `Asia/Shanghai`。 */
|
|
24
|
+
strTimeZone: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 应用品牌、运行模式和浏览器存储配置。 */
|
|
28
|
+
export interface IRuntimeApplicationConfig {
|
|
29
|
+
/** 稳定白标标识;只用于诊断和受控 CSS 作用域,不是租户权限标识。 */
|
|
30
|
+
strBrandId: string
|
|
31
|
+
/** 浏览器标题和应用内展示的产品名称。 */
|
|
32
|
+
strTitle: string
|
|
33
|
+
/** 页面描述和侧边栏展示的简短说明。 */
|
|
34
|
+
strDescription: string
|
|
35
|
+
/** `public/` 内的相对路径或受信任的 HTTP(S)/图片 Data URL。 */
|
|
36
|
+
strLogoPath: string
|
|
37
|
+
/** 深色主题 Logo;未声明时回退到 `strLogoPath`。 */
|
|
38
|
+
strDarkLogoPath: string
|
|
39
|
+
/** 浏览器页签图标的公开资产路径。 */
|
|
40
|
+
strFaviconPath: string
|
|
41
|
+
/** 受限的明暗品牌语义色;不能包含任意 CSS。 */
|
|
42
|
+
objTheme: IRuntimeBrandTheme
|
|
43
|
+
/** 隔离认证、主题和 UI 偏好的浏览器存储命名空间。 */
|
|
44
|
+
strStorageNamespace: string
|
|
45
|
+
/** `demo` 使用本地演示认证,`connected` 连接真实后端。 */
|
|
46
|
+
strMode: 'connected' | 'demo'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 单个明暗模式允许覆盖的品牌语义色。 */
|
|
50
|
+
export interface IRuntimeBrandPalette {
|
|
51
|
+
/** 主要操作和品牌强调色,必须与主要前景色达到 WCAG AA。 */
|
|
52
|
+
strPrimaryColor: string
|
|
53
|
+
/** 主要操作上的文本和图标颜色。 */
|
|
54
|
+
strPrimaryForegroundColor: string
|
|
55
|
+
/** 次要操作和辅助强调色,必须与次要前景色达到 WCAG AA。 */
|
|
56
|
+
strSecondaryColor: string
|
|
57
|
+
/** 次要操作上的文本和图标颜色。 */
|
|
58
|
+
strSecondaryForegroundColor: string
|
|
59
|
+
/** 浏览器地址栏等宿主界面使用的主题颜色。 */
|
|
60
|
+
strBrowserThemeColor: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 运行时白标的明暗品牌色组合。 */
|
|
64
|
+
export interface IRuntimeBrandTheme {
|
|
65
|
+
/** 浅色模式品牌色。 */
|
|
66
|
+
objLight: IRuntimeBrandPalette
|
|
67
|
+
/** 深色模式品牌色。 */
|
|
68
|
+
objDark: IRuntimeBrandPalette
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 后端 API 的浏览器运行时地址。 */
|
|
72
|
+
export interface IRuntimeApiConfig {
|
|
73
|
+
/** API 基础地址;空字符串表示使用当前站点,同源部署时推荐留空。 */
|
|
74
|
+
strBaseUrl: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 登录、刷新和退出使用的公开认证参数。 */
|
|
78
|
+
export interface IRuntimeAuthConfig {
|
|
79
|
+
/** 认证服务校验的目标 Audience。 */
|
|
80
|
+
strAudience: string
|
|
81
|
+
/** 浏览器应用的公开 OAuth Client ID,不得在这里配置 Client Secret。 */
|
|
82
|
+
strClientId: string
|
|
83
|
+
/** 登录申请的 OAuth Scope,以空格分隔。 */
|
|
84
|
+
strScope: string
|
|
85
|
+
/** 会话保存位置;生产连接模式推荐使用 `memory`。 */
|
|
86
|
+
strSessionStorage: 'memory' | 'session'
|
|
87
|
+
/** 用户名密码登录端点,可使用相对路径或 HTTP(S) 地址。 */
|
|
88
|
+
strSignInPath: string
|
|
89
|
+
/** 刷新访问令牌端点,可使用相对路径或 HTTP(S) 地址。 */
|
|
90
|
+
strRefreshPath: string
|
|
91
|
+
/** 注销端点,可使用相对路径或 HTTP(S) 地址。 */
|
|
92
|
+
strSignOutPath: string
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** 浏览器可观测性的公开部署配置。 */
|
|
96
|
+
export interface IRuntimeObservabilityConfig {
|
|
97
|
+
/** 是否允许向项目配置的 Adapter 发送脱敏事件。 */
|
|
98
|
+
bEnabled: boolean
|
|
99
|
+
/** 用于区分 local、test、staging、production 等部署环境。 */
|
|
100
|
+
strEnvironment: string
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** 经运行时配置转换后供应用模块消费的稳定配置。 */
|
|
104
|
+
export interface IAppConfig {
|
|
105
|
+
/** 当前数据接入模式。 */
|
|
106
|
+
runtime: {
|
|
107
|
+
/** `demo` 使用演示适配器,`connected` 使用真实后端。 */
|
|
108
|
+
strMode: 'connected' | 'demo'
|
|
109
|
+
}
|
|
110
|
+
/** 应用品牌信息。 */
|
|
111
|
+
brand: {
|
|
112
|
+
/** 稳定白标标识,不参与授权。 */
|
|
113
|
+
strId: string
|
|
114
|
+
/** 应用显示名称。 */
|
|
115
|
+
strName: string
|
|
116
|
+
/** 应用简短描述。 */
|
|
117
|
+
strDescription: string
|
|
118
|
+
/** 已结合 Vite public path 解析的 Logo 地址。 */
|
|
119
|
+
strLogoUrl: string
|
|
120
|
+
/** 深色主题使用的已解析 Logo 地址。 */
|
|
121
|
+
strDarkLogoUrl: string
|
|
122
|
+
/** 已解析的浏览器页签图标地址。 */
|
|
123
|
+
strFaviconUrl: string
|
|
124
|
+
/** 已校验并冻结的明暗品牌语义色。 */
|
|
125
|
+
objTheme: IRuntimeBrandTheme
|
|
126
|
+
}
|
|
127
|
+
/** API 连接信息。 */
|
|
128
|
+
api: {
|
|
129
|
+
/** API 基础地址;空字符串表示当前站点。 */
|
|
130
|
+
strBaseUrl: string
|
|
131
|
+
}
|
|
132
|
+
/** 认证公开配置和端点。 */
|
|
133
|
+
auth: {
|
|
134
|
+
/** 认证 Audience。 */
|
|
135
|
+
strAudience: string
|
|
136
|
+
/** 浏览器应用的公开 Client ID。 */
|
|
137
|
+
strClientId: string
|
|
138
|
+
/** 登录申请的 Scope。 */
|
|
139
|
+
strScope: string
|
|
140
|
+
/** 会话保存位置。 */
|
|
141
|
+
strSessionStorage: 'memory' | 'session'
|
|
142
|
+
/** 登录端点。 */
|
|
143
|
+
strSignInPath: string
|
|
144
|
+
/** 刷新端点。 */
|
|
145
|
+
strRefreshPath: string
|
|
146
|
+
/** 注销端点。 */
|
|
147
|
+
strSignOutPath: string
|
|
148
|
+
}
|
|
149
|
+
/** 可观测性运行开关。 */
|
|
150
|
+
observability: {
|
|
151
|
+
/** 是否允许发送已经脱敏的诊断事件。 */
|
|
152
|
+
bEnabled: boolean
|
|
153
|
+
}
|
|
154
|
+
/** 应用统一语言与时区。 */
|
|
155
|
+
locale: {
|
|
156
|
+
/** 当前 BCP 47 语言标签。 */
|
|
157
|
+
strLocale: TAppLocale
|
|
158
|
+
/** 当前统一 IANA 时区。 */
|
|
159
|
+
strTimeZone: string
|
|
160
|
+
}
|
|
161
|
+
/** 当前构建及部署的公开版本上下文。 */
|
|
162
|
+
release: {
|
|
163
|
+
/** `package.json` 应用版本。 */
|
|
164
|
+
strVersion: string
|
|
165
|
+
/** 构建对应 Git Commit。 */
|
|
166
|
+
strCommit: string
|
|
167
|
+
/** 产生静态产物的 ISO 时间。 */
|
|
168
|
+
strBuildTime: string
|
|
169
|
+
/** 部署时配置的环境名称。 */
|
|
170
|
+
strEnvironment: string
|
|
171
|
+
}
|
|
172
|
+
/** 应用导航约定。 */
|
|
173
|
+
navigation: {
|
|
174
|
+
/** 认证成功后的默认页面。 */
|
|
175
|
+
strDefaultAuthenticatedPath: string
|
|
176
|
+
}
|
|
177
|
+
/** 带应用命名空间的浏览器存储 Key。 */
|
|
178
|
+
storage: {
|
|
179
|
+
/** 认证会话存储 Key。 */
|
|
180
|
+
strAuthSessionKey: string
|
|
181
|
+
/** 当前用户租户/工作空间选择的存储 Key。 */
|
|
182
|
+
strTenantWorkspaceKey: string
|
|
183
|
+
/** 主题偏好存储 Key。 */
|
|
184
|
+
strThemeKey: string
|
|
185
|
+
/** 其他 UI 偏好存储 Key。 */
|
|
186
|
+
strUiPreferenceKey: string
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** 运行时配置加载失败的稳定错误码。 */
|
|
191
|
+
export type TRuntimeConfigErrorCode =
|
|
192
|
+
| 'invalid_config'
|
|
193
|
+
| 'invalid_json'
|
|
194
|
+
| 'load_failed'
|
|
195
|
+
| 'not_initialized'
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useState,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
} from 'react'
|
|
8
|
+
import { fnApplyAppBrandTheme, objAppConfig } from '@/config/appConfig'
|
|
9
|
+
import type { TTheme } from './types'
|
|
10
|
+
|
|
11
|
+
export type { TTheme } from './types'
|
|
12
|
+
|
|
13
|
+
type TThemeProviderProps = {
|
|
14
|
+
children: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type TThemeContextValue = {
|
|
18
|
+
strTheme: TTheme
|
|
19
|
+
bIsDarkTheme: boolean
|
|
20
|
+
fnSetTheme: (strTheme: TTheme) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const strThemeStorageKey = objAppConfig.storage.strThemeKey
|
|
24
|
+
const fnThemeContext = createContext<TThemeContextValue | null>(null)
|
|
25
|
+
|
|
26
|
+
function fnGetStoredTheme(): TTheme {
|
|
27
|
+
try {
|
|
28
|
+
const strStoredTheme = localStorage.getItem(strThemeStorageKey)
|
|
29
|
+
return strStoredTheme === 'light' ||
|
|
30
|
+
strStoredTheme === 'dark' ||
|
|
31
|
+
strStoredTheme === 'system'
|
|
32
|
+
? strStoredTheme
|
|
33
|
+
: 'system'
|
|
34
|
+
} catch {
|
|
35
|
+
return 'system'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function ThemeProvider({ children: objChildren }: TThemeProviderProps) {
|
|
40
|
+
const [strTheme, fnSetTheme] = useState<TTheme>(fnGetStoredTheme)
|
|
41
|
+
const [bSystemDarkTheme, fnSetSystemDarkTheme] = useState(
|
|
42
|
+
() => window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
43
|
+
)
|
|
44
|
+
const bIsDarkTheme =
|
|
45
|
+
strTheme === 'dark' || (strTheme === 'system' && bSystemDarkTheme)
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const objSystemTheme = window.matchMedia('(prefers-color-scheme: dark)')
|
|
49
|
+
const fnHandleSystemThemeChange = (objEvent: MediaQueryListEvent) =>
|
|
50
|
+
fnSetSystemDarkTheme(objEvent.matches)
|
|
51
|
+
objSystemTheme.addEventListener('change', fnHandleSystemThemeChange)
|
|
52
|
+
return () =>
|
|
53
|
+
objSystemTheme.removeEventListener('change', fnHandleSystemThemeChange)
|
|
54
|
+
}, [])
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const objRoot = window.document.documentElement
|
|
58
|
+
try {
|
|
59
|
+
localStorage.setItem(strThemeStorageKey, strTheme)
|
|
60
|
+
} catch {
|
|
61
|
+
// 受限存储环境仍应允许主题在当前页面生效。
|
|
62
|
+
}
|
|
63
|
+
objRoot.classList.toggle('dark', bIsDarkTheme)
|
|
64
|
+
objRoot.style.colorScheme = bIsDarkTheme ? 'dark' : 'light'
|
|
65
|
+
fnApplyAppBrandTheme(bIsDarkTheme)
|
|
66
|
+
}, [bIsDarkTheme, strTheme])
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<fnThemeContext.Provider value={{ strTheme, bIsDarkTheme, fnSetTheme }}>
|
|
70
|
+
{objChildren}
|
|
71
|
+
</fnThemeContext.Provider>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
76
|
+
export function useTheme() {
|
|
77
|
+
const objContext = useContext(fnThemeContext)
|
|
78
|
+
|
|
79
|
+
if (!objContext) {
|
|
80
|
+
throw new Error('useTheme 必须在 ThemeProvider 内使用')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return objContext
|
|
84
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useId,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
} from 'react'
|
|
12
|
+
import { useBlocker } from '@tanstack/react-router'
|
|
13
|
+
import { useSharedMessage } from '@/locale'
|
|
14
|
+
import { AppDialog } from '@/components/AppDialog'
|
|
15
|
+
import type { IUnsavedChangesRegistration } from './types'
|
|
16
|
+
|
|
17
|
+
interface IUnsavedChangesContextValue {
|
|
18
|
+
fnSetDirty: (strRegistrationId: string, bIsDirty: boolean) => void
|
|
19
|
+
fnRemove: (strRegistrationId: string) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const fnUnsavedChangesContext =
|
|
23
|
+
createContext<IUnsavedChangesContextValue | null>(null)
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 汇总当前路由子树中的草稿状态,并统一处理 SPA 导航和浏览器离开。
|
|
27
|
+
*
|
|
28
|
+
* 注册表只保存“哪些消费者当前为 dirty”,不复制表单或表格草稿数据。
|
|
29
|
+
*/
|
|
30
|
+
export function UnsavedChangesProvider({
|
|
31
|
+
children: objChildren,
|
|
32
|
+
}: {
|
|
33
|
+
children: ReactNode
|
|
34
|
+
}) {
|
|
35
|
+
const objDirtyRegistrationsRef = useRef(new Map<string, true>())
|
|
36
|
+
const [nDirtyCount, fnSetDirtyCount] = useState(0)
|
|
37
|
+
const bHasUnsavedChanges = nDirtyCount > 0
|
|
38
|
+
const fnSetDirty = useCallback(
|
|
39
|
+
(strRegistrationId: string, bIsDirty: boolean) => {
|
|
40
|
+
const objRegistrations = objDirtyRegistrationsRef.current
|
|
41
|
+
const bWasDirty = objRegistrations.has(strRegistrationId)
|
|
42
|
+
if (bWasDirty === bIsDirty) return
|
|
43
|
+
if (bIsDirty) objRegistrations.set(strRegistrationId, true)
|
|
44
|
+
else objRegistrations.delete(strRegistrationId)
|
|
45
|
+
fnSetDirtyCount(objRegistrations.size)
|
|
46
|
+
},
|
|
47
|
+
[]
|
|
48
|
+
)
|
|
49
|
+
const fnRemove = useCallback((strRegistrationId: string) => {
|
|
50
|
+
const objRegistrations = objDirtyRegistrationsRef.current
|
|
51
|
+
if (!objRegistrations.delete(strRegistrationId)) return
|
|
52
|
+
fnSetDirtyCount(objRegistrations.size)
|
|
53
|
+
}, [])
|
|
54
|
+
const objContext = useMemo(
|
|
55
|
+
() => ({ fnSetDirty, fnRemove }),
|
|
56
|
+
[fnRemove, fnSetDirty]
|
|
57
|
+
)
|
|
58
|
+
const fnShouldBlock = useCallback(
|
|
59
|
+
() => bHasUnsavedChanges,
|
|
60
|
+
[bHasUnsavedChanges]
|
|
61
|
+
)
|
|
62
|
+
const objBlocker = useBlocker({
|
|
63
|
+
shouldBlockFn: fnShouldBlock,
|
|
64
|
+
enableBeforeUnload: fnShouldBlock,
|
|
65
|
+
disabled: !bHasUnsavedChanges,
|
|
66
|
+
withResolver: true,
|
|
67
|
+
})
|
|
68
|
+
const strTitle = useSharedMessage('unsavedChanges.title')
|
|
69
|
+
const strDescription = useSharedMessage('unsavedChanges.description')
|
|
70
|
+
const strStay = useSharedMessage('unsavedChanges.stay')
|
|
71
|
+
const strLeave = useSharedMessage('unsavedChanges.leave')
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!bHasUnsavedChanges && objBlocker.status === 'blocked') {
|
|
75
|
+
objBlocker.proceed()
|
|
76
|
+
}
|
|
77
|
+
}, [bHasUnsavedChanges, objBlocker])
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<fnUnsavedChangesContext.Provider value={objContext}>
|
|
81
|
+
{objChildren}
|
|
82
|
+
<AppDialog
|
|
83
|
+
bOpen={objBlocker.status === 'blocked'}
|
|
84
|
+
fnOnOpenChange={(bOpen) => {
|
|
85
|
+
if (!bOpen && objBlocker.status === 'blocked') objBlocker.reset()
|
|
86
|
+
}}
|
|
87
|
+
strTitle={strTitle}
|
|
88
|
+
strSize='sm'
|
|
89
|
+
strCancelText={strStay}
|
|
90
|
+
strConfirmText={strLeave}
|
|
91
|
+
strConfirmVariant='destructive'
|
|
92
|
+
fnOnCancel={() => {
|
|
93
|
+
if (objBlocker.status === 'blocked') objBlocker.reset()
|
|
94
|
+
}}
|
|
95
|
+
fnOnConfirm={() => {
|
|
96
|
+
if (objBlocker.status === 'blocked') objBlocker.proceed()
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<p>{strDescription}</p>
|
|
100
|
+
</AppDialog>
|
|
101
|
+
</fnUnsavedChangesContext.Provider>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 注册共享组件的 dirty 状态;未挂载 Provider 时保持组件可独立使用。 */
|
|
106
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
107
|
+
export function useUnsavedChangesRegistration({
|
|
108
|
+
bIsDirty,
|
|
109
|
+
bEnabled = true,
|
|
110
|
+
}: IUnsavedChangesRegistration) {
|
|
111
|
+
const objContext = useContext(fnUnsavedChangesContext)
|
|
112
|
+
const strRegistrationId = useId()
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!objContext) return
|
|
116
|
+
objContext.fnSetDirty(strRegistrationId, bEnabled && bIsDirty)
|
|
117
|
+
}, [bEnabled, bIsDirty, objContext, strRegistrationId])
|
|
118
|
+
|
|
119
|
+
useEffect(
|
|
120
|
+
() => () => objContext?.fnRemove(strRegistrationId),
|
|
121
|
+
[objContext, strRegistrationId]
|
|
122
|
+
)
|
|
123
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IApplicationMetadataScopeOverride,
|
|
3
|
+
IApplicationScope,
|
|
4
|
+
IApplicationScopeInput,
|
|
5
|
+
} from './types'
|
|
6
|
+
|
|
7
|
+
/** 创建不可变的应用运行作用域。 */
|
|
8
|
+
export function fnCreateApplicationScope(
|
|
9
|
+
objInput: IApplicationScopeInput
|
|
10
|
+
): IApplicationScope {
|
|
11
|
+
return Object.freeze({ ...objInput })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 为枚举和全局参数派生一致的目录作用域。 */
|
|
15
|
+
export function fnResolveApplicationMetadataScope(
|
|
16
|
+
objScope: IApplicationScope,
|
|
17
|
+
objOverride: IApplicationMetadataScopeOverride = {}
|
|
18
|
+
) {
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
...objOverride,
|
|
21
|
+
nSessionGeneration: objScope.nSessionGeneration,
|
|
22
|
+
strTenantId: objOverride.strTenantId ?? objScope.strTenantId,
|
|
23
|
+
strWorkspaceId: objOverride.strWorkspaceId ?? objScope.strWorkspaceId,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 为服务端查询派生包含显式匿名身份的缓存作用域。 */
|
|
28
|
+
export function fnResolveApplicationQueryScope(
|
|
29
|
+
objScope: IApplicationScope,
|
|
30
|
+
strWorkspaceId = objScope.strWorkspaceId
|
|
31
|
+
) {
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
nSessionGeneration: objScope.nSessionGeneration,
|
|
34
|
+
strLocale: objScope.strLocale,
|
|
35
|
+
strTenantId: objScope.strTenantId,
|
|
36
|
+
strUserId: objScope.strUserId ?? 'anonymous',
|
|
37
|
+
strWorkspaceId,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TAppLocale } from '@/locale'
|
|
2
|
+
|
|
3
|
+
export type TTheme = 'light' | 'dark' | 'system'
|
|
4
|
+
|
|
5
|
+
/** 构建应用运行作用域所需的唯一身份输入。 */
|
|
6
|
+
export interface IApplicationScopeInput {
|
|
7
|
+
/** 登录、退出或授权上下文变化时递增的会话版本。 */
|
|
8
|
+
readonly nSessionGeneration: number
|
|
9
|
+
/** 当前应用语言。 */
|
|
10
|
+
readonly strLocale: TAppLocale
|
|
11
|
+
/** 当前租户稳定标识。 */
|
|
12
|
+
readonly strTenantId?: string
|
|
13
|
+
/** 当前认证用户稳定标识。 */
|
|
14
|
+
readonly strUserId?: string
|
|
15
|
+
/** 当前组织、项目或工作空间稳定标识。 */
|
|
16
|
+
readonly strWorkspaceId?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 认证、租户、工作空间和语言组成的统一应用运行作用域。 */
|
|
20
|
+
export interface IApplicationScope extends IApplicationScopeInput {
|
|
21
|
+
/** 同时作为授权相关资源的缓存版本。 */
|
|
22
|
+
readonly nSessionGeneration: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 枚举和全局参数允许覆盖的附加作用域。 */
|
|
26
|
+
export interface IApplicationMetadataScopeOverride {
|
|
27
|
+
/** 后端目录命名空间。 */
|
|
28
|
+
readonly strNamespace?: string
|
|
29
|
+
/** 显式租户;省略时使用当前应用租户。 */
|
|
30
|
+
readonly strTenantId?: string
|
|
31
|
+
/** 显式工作空间;省略时使用当前应用工作空间。 */
|
|
32
|
+
readonly strWorkspaceId?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 共享组件向应用级离开保护器注册草稿状态的参数。 */
|
|
36
|
+
export interface IUnsavedChangesRegistration {
|
|
37
|
+
/** 当前组件是否持有尚未持久化的用户修改。 */
|
|
38
|
+
bIsDirty: boolean
|
|
39
|
+
/** 是否启用路由与浏览器离开保护;默认启用。 */
|
|
40
|
+
bEnabled?: boolean
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
fnMaskSensitiveText,
|
|
3
|
+
fnResolveSensitiveDataMaskedText,
|
|
4
|
+
objDataMaskingPresets,
|
|
5
|
+
} from './masking'
|
|
6
|
+
export {
|
|
7
|
+
SensitiveDataError,
|
|
8
|
+
type IDataMaskingPolicy,
|
|
9
|
+
type TSensitiveDataClipboardAdapter,
|
|
10
|
+
type TSensitiveDataCopyPolicy,
|
|
11
|
+
type TSensitiveDataRevealAdapter,
|
|
12
|
+
type TSensitiveDataRevealPolicy,
|
|
13
|
+
type TSensitiveDataValue,
|
|
14
|
+
} from './types'
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IDataMaskingPolicy,
|
|
3
|
+
TDataMaskingPreset,
|
|
4
|
+
TSensitiveDataValue,
|
|
5
|
+
} from './types'
|
|
6
|
+
|
|
7
|
+
interface IResolvedSegmentPolicy {
|
|
8
|
+
readonly nMaskLength?: number
|
|
9
|
+
readonly nVisibleEnd: number
|
|
10
|
+
readonly nVisibleStart: number
|
|
11
|
+
readonly strMaskCharacter: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 内建策略默认值;业务可在字段级覆盖首尾可见位数和固定遮罩长度。 */
|
|
15
|
+
export const objDataMaskingPresets: Readonly<
|
|
16
|
+
Record<TDataMaskingPreset, Readonly<IResolvedSegmentPolicy>>
|
|
17
|
+
> = Object.freeze({
|
|
18
|
+
bankCard: Object.freeze({
|
|
19
|
+
nMaskLength: 12,
|
|
20
|
+
nVisibleEnd: 4,
|
|
21
|
+
nVisibleStart: 0,
|
|
22
|
+
strMaskCharacter: '*',
|
|
23
|
+
}),
|
|
24
|
+
email: Object.freeze({
|
|
25
|
+
nMaskLength: 3,
|
|
26
|
+
nVisibleEnd: 0,
|
|
27
|
+
nVisibleStart: 1,
|
|
28
|
+
strMaskCharacter: '*',
|
|
29
|
+
}),
|
|
30
|
+
identity: Object.freeze({
|
|
31
|
+
nMaskLength: 8,
|
|
32
|
+
nVisibleEnd: 4,
|
|
33
|
+
nVisibleStart: 3,
|
|
34
|
+
strMaskCharacter: '*',
|
|
35
|
+
}),
|
|
36
|
+
name: Object.freeze({
|
|
37
|
+
nVisibleEnd: 0,
|
|
38
|
+
nVisibleStart: 1,
|
|
39
|
+
strMaskCharacter: '*',
|
|
40
|
+
}),
|
|
41
|
+
phone: Object.freeze({
|
|
42
|
+
nMaskLength: 4,
|
|
43
|
+
nVisibleEnd: 4,
|
|
44
|
+
nVisibleStart: 3,
|
|
45
|
+
strMaskCharacter: '*',
|
|
46
|
+
}),
|
|
47
|
+
segment: Object.freeze({
|
|
48
|
+
nVisibleEnd: 0,
|
|
49
|
+
nVisibleStart: 0,
|
|
50
|
+
strMaskCharacter: '*',
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
function fnNormalizeCount(nValue: number | undefined, nFallback: number) {
|
|
55
|
+
if (!Number.isFinite(nValue)) return nFallback
|
|
56
|
+
return Math.max(0, Math.trunc(nValue ?? nFallback))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function fnResolveMaskCharacter(strValue: string | undefined) {
|
|
60
|
+
const arrCharacters = Array.from(strValue ?? '')
|
|
61
|
+
if (arrCharacters.length !== 1 || /^\s$/u.test(arrCharacters[0])) return '*'
|
|
62
|
+
return arrCharacters[0]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function fnResolveSegmentPolicy(
|
|
66
|
+
objPolicy: IDataMaskingPolicy
|
|
67
|
+
): IResolvedSegmentPolicy {
|
|
68
|
+
const objPreset = objDataMaskingPresets[objPolicy.strPreset]
|
|
69
|
+
return {
|
|
70
|
+
nMaskLength:
|
|
71
|
+
objPolicy.nMaskLength === undefined
|
|
72
|
+
? objPreset.nMaskLength
|
|
73
|
+
: fnNormalizeCount(objPolicy.nMaskLength, 1),
|
|
74
|
+
nVisibleEnd: fnNormalizeCount(objPolicy.nVisibleEnd, objPreset.nVisibleEnd),
|
|
75
|
+
nVisibleStart: fnNormalizeCount(
|
|
76
|
+
objPolicy.nVisibleStart,
|
|
77
|
+
objPreset.nVisibleStart
|
|
78
|
+
),
|
|
79
|
+
strMaskCharacter: fnResolveMaskCharacter(
|
|
80
|
+
objPolicy.strMaskCharacter ?? objPreset.strMaskCharacter
|
|
81
|
+
),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function fnMaskSegment(strValue: string, objPolicy: IResolvedSegmentPolicy) {
|
|
86
|
+
const arrCharacters = Array.from(strValue)
|
|
87
|
+
if (arrCharacters.length === 0) return ''
|
|
88
|
+
|
|
89
|
+
const nVisibleStart = Math.min(
|
|
90
|
+
objPolicy.nVisibleStart,
|
|
91
|
+
arrCharacters.length - 1
|
|
92
|
+
)
|
|
93
|
+
const nVisibleEnd = Math.min(
|
|
94
|
+
objPolicy.nVisibleEnd,
|
|
95
|
+
arrCharacters.length - nVisibleStart - 1
|
|
96
|
+
)
|
|
97
|
+
const nHiddenLength = arrCharacters.length - nVisibleStart - nVisibleEnd
|
|
98
|
+
const nMaskLength = Math.max(1, objPolicy.nMaskLength ?? nHiddenLength)
|
|
99
|
+
const strStart = arrCharacters.slice(0, nVisibleStart).join('')
|
|
100
|
+
const strEnd = nVisibleEnd ? arrCharacters.slice(-nVisibleEnd).join('') : ''
|
|
101
|
+
|
|
102
|
+
return `${strStart}${objPolicy.strMaskCharacter.repeat(nMaskLength)}${strEnd}`
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function fnMaskEmail(strValue: string, objPolicy: IResolvedSegmentPolicy) {
|
|
106
|
+
const nSeparatorIndex = strValue.lastIndexOf('@')
|
|
107
|
+
if (nSeparatorIndex <= 0 || nSeparatorIndex === strValue.length - 1) {
|
|
108
|
+
return fnMaskSegment(strValue, objPolicy)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const strLocalPart = strValue.slice(0, nSeparatorIndex)
|
|
112
|
+
const strDomain = strValue.slice(nSeparatorIndex)
|
|
113
|
+
return `${fnMaskSegment(strLocalPart, objPolicy)}${strDomain}`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** 按预设和字段级覆盖生成展示脱敏文本,始终至少隐藏一个字符。 */
|
|
117
|
+
export function fnMaskSensitiveText(
|
|
118
|
+
strValue: string,
|
|
119
|
+
objPolicy: IDataMaskingPolicy
|
|
120
|
+
) {
|
|
121
|
+
if (!strValue) return objPolicy.strEmptyText ?? '—'
|
|
122
|
+
|
|
123
|
+
const objResolvedPolicy = fnResolveSegmentPolicy(objPolicy)
|
|
124
|
+
return objPolicy.strPreset === 'email'
|
|
125
|
+
? fnMaskEmail(strValue, objResolvedPolicy)
|
|
126
|
+
: fnMaskSegment(strValue, objResolvedPolicy)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** 优先使用后端脱敏结果,仅在已授权原值存在时执行前端展示脱敏。 */
|
|
130
|
+
export function fnResolveSensitiveDataMaskedText(
|
|
131
|
+
objValue: TSensitiveDataValue,
|
|
132
|
+
objPolicy: IDataMaskingPolicy
|
|
133
|
+
) {
|
|
134
|
+
if (objValue.strState === 'masked') {
|
|
135
|
+
return objValue.strMaskedValue || objPolicy.strEmptyText || '—'
|
|
136
|
+
}
|
|
137
|
+
if (objValue.strMaskedValue) return objValue.strMaskedValue
|
|
138
|
+
return fnMaskSensitiveText(objValue.strValue, objPolicy)
|
|
139
|
+
}
|