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,371 @@
|
|
|
1
|
+
import { loadConfigFromFile, loadEnv } from 'vite'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { readdir, readFile } from 'node:fs/promises'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import test from 'node:test'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const strProjectRoot = path.resolve(
|
|
9
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
10
|
+
'../../..'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
test('development API proxy respects the insecure TLS setting', async () => {
|
|
14
|
+
const objEnv = loadEnv('development', strProjectRoot)
|
|
15
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
16
|
+
{ command: 'serve', mode: 'development' },
|
|
17
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
18
|
+
strProjectRoot
|
|
19
|
+
)
|
|
20
|
+
const strApiProxy = objEnv.VITE_API_PROXY.trim()
|
|
21
|
+
const objApiProxy = objLoadedConfig?.config.server?.proxy?.[strApiProxy]
|
|
22
|
+
|
|
23
|
+
assert.ok(objApiProxy)
|
|
24
|
+
assert.equal(objApiProxy.target, objEnv.VITE_API_BASE_URL.trim())
|
|
25
|
+
assert.equal(objApiProxy.changeOrigin, true)
|
|
26
|
+
assert.equal(objApiProxy.secure, false)
|
|
27
|
+
assert.equal(objLoadedConfig?.config.server?.strictPort, true)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('invalid build configuration reports the field and recovery action', async () => {
|
|
31
|
+
const strPreviousPort = process.env.VITE_PORT
|
|
32
|
+
process.env.VITE_PORT = 'invalid'
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
await assert.rejects(
|
|
36
|
+
loadConfigFromFile(
|
|
37
|
+
{ command: 'serve', mode: 'development' },
|
|
38
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
39
|
+
strProjectRoot,
|
|
40
|
+
'silent'
|
|
41
|
+
),
|
|
42
|
+
(objError) => {
|
|
43
|
+
assert.match(objError.message, /BUILD_CONFIG_INVALID/)
|
|
44
|
+
assert.match(objError.message, /VITE_PORT/)
|
|
45
|
+
assert.match(objError.message, /pnpm scaffold:check/)
|
|
46
|
+
assert.doesNotMatch(objError.message, /VITE_PORT:\s*invalid/)
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
} finally {
|
|
51
|
+
if (strPreviousPort === undefined) delete process.env.VITE_PORT
|
|
52
|
+
else process.env.VITE_PORT = strPreviousPort
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('production console plugin removes logs but keeps errors', async () => {
|
|
57
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
58
|
+
{ command: 'build', mode: 'production' },
|
|
59
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
60
|
+
strProjectRoot
|
|
61
|
+
)
|
|
62
|
+
const objRemoveConsolePlugin = objLoadedConfig?.config.plugins?.find(
|
|
63
|
+
(objPlugin) => objPlugin?.name === 'vite:remove-console'
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
assert.ok(objRemoveConsolePlugin)
|
|
67
|
+
assert.equal(objRemoveConsolePlugin.apply, 'build')
|
|
68
|
+
assert.equal(typeof objRemoveConsolePlugin.transform, 'function')
|
|
69
|
+
|
|
70
|
+
const objResult = await objRemoveConsolePlugin.transform(
|
|
71
|
+
'console.log("remove me")\nconsole.error("keep me")',
|
|
72
|
+
'/src/consoleFixture.ts'
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
assert.doesNotMatch(objResult.code, /remove me/)
|
|
76
|
+
assert.match(objResult.code, /console\.error\(['"]keep me['"]\)/)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('build injects public release metadata without runtime secrets', async () => {
|
|
80
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
81
|
+
{ command: 'build', mode: 'production' },
|
|
82
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
83
|
+
strProjectRoot
|
|
84
|
+
)
|
|
85
|
+
const objDefine = objLoadedConfig?.config.define
|
|
86
|
+
|
|
87
|
+
assert.equal(objDefine?.strBuildAppVersion, '"0.1.0"')
|
|
88
|
+
assert.match(objDefine?.strBuildCommit, /^"(?:[a-f0-9]+|unknown)"$/)
|
|
89
|
+
assert.match(
|
|
90
|
+
JSON.parse(objDefine?.strBuildTime),
|
|
91
|
+
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/
|
|
92
|
+
)
|
|
93
|
+
assert.doesNotMatch(JSON.stringify(objDefine), /token|password|secret/i)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
async function fnCollectTsxFiles(strDirectory) {
|
|
97
|
+
const arrEntries = await readdir(strDirectory, { withFileTypes: true })
|
|
98
|
+
const arrFiles = await Promise.all(
|
|
99
|
+
arrEntries.map((objEntry) => {
|
|
100
|
+
const strEntryPath = path.resolve(strDirectory, objEntry.name)
|
|
101
|
+
if (objEntry.isDirectory()) return fnCollectTsxFiles(strEntryPath)
|
|
102
|
+
return objEntry.isFile() && objEntry.name.endsWith('.tsx')
|
|
103
|
+
? [strEntryPath]
|
|
104
|
+
: []
|
|
105
|
+
})
|
|
106
|
+
)
|
|
107
|
+
return arrFiles.flat()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
test('future application tables must use the licensed boundary and stable keys', async () => {
|
|
111
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
112
|
+
{ command: 'build', mode: 'production' },
|
|
113
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
114
|
+
strProjectRoot
|
|
115
|
+
)
|
|
116
|
+
assert.equal(
|
|
117
|
+
objLoadedConfig?.config.plugins?.some((objPlugin) =>
|
|
118
|
+
objPlugin?.name?.includes('auto-component-name')
|
|
119
|
+
),
|
|
120
|
+
false
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const objTypeScript = await import('typescript')
|
|
124
|
+
const arrFiles = await fnCollectTsxFiles(path.resolve(strProjectRoot, 'src'))
|
|
125
|
+
for (const strFilePath of arrFiles) {
|
|
126
|
+
const strSource = await readFile(strFilePath, 'utf8')
|
|
127
|
+
const bIsAppTableBoundary = strFilePath.endsWith(
|
|
128
|
+
path.join('components', 'AppTable', 'AppTable.tsx')
|
|
129
|
+
)
|
|
130
|
+
const bIsOwnedTableSource = strFilePath.includes(
|
|
131
|
+
path.join('components', 'AppTable', 'table')
|
|
132
|
+
)
|
|
133
|
+
if (strSource.includes('<TableComponent')) {
|
|
134
|
+
assert.equal(
|
|
135
|
+
bIsAppTableBoundary || bIsOwnedTableSource,
|
|
136
|
+
true,
|
|
137
|
+
`${path.relative(strProjectRoot, strFilePath)} 必须通过 AppTable 使用 TableComponent`
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
if (!strSource.includes('<AppTable')) continue
|
|
141
|
+
const objSourceFile = objTypeScript.createSourceFile(
|
|
142
|
+
strFilePath,
|
|
143
|
+
strSource,
|
|
144
|
+
objTypeScript.ScriptTarget.Latest,
|
|
145
|
+
true,
|
|
146
|
+
objTypeScript.ScriptKind.TSX
|
|
147
|
+
)
|
|
148
|
+
const fnVisit = (objNode) => {
|
|
149
|
+
if (
|
|
150
|
+
(objTypeScript.isJsxOpeningElement(objNode) ||
|
|
151
|
+
objTypeScript.isJsxSelfClosingElement(objNode)) &&
|
|
152
|
+
objNode.tagName.getText(objSourceFile) === 'AppTable'
|
|
153
|
+
) {
|
|
154
|
+
assert.ok(
|
|
155
|
+
objNode.attributes.properties.some(
|
|
156
|
+
(objAttribute) =>
|
|
157
|
+
objTypeScript.isJsxAttribute(objAttribute) &&
|
|
158
|
+
objAttribute.name.getText(objSourceFile) === 'tableKey'
|
|
159
|
+
),
|
|
160
|
+
`${path.relative(strProjectRoot, strFilePath)} 中的 AppTable 必须显式配置 tableKey`
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
objTypeScript.forEachChild(objNode, fnVisit)
|
|
164
|
+
}
|
|
165
|
+
fnVisit(objSourceFile)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
test('production does not silently accept the Handsontable evaluation license', async () => {
|
|
170
|
+
const [strProductionEnv, strAppTable, strLicenseResolver] = await Promise.all(
|
|
171
|
+
[
|
|
172
|
+
readFile(path.resolve(strProjectRoot, '.env.production'), 'utf8'),
|
|
173
|
+
readFile(
|
|
174
|
+
path.resolve(strProjectRoot, 'src/components/AppTable/AppTable.tsx'),
|
|
175
|
+
'utf8'
|
|
176
|
+
).catch(() => undefined),
|
|
177
|
+
readFile(
|
|
178
|
+
path.resolve(
|
|
179
|
+
strProjectRoot,
|
|
180
|
+
'src/components/AppTable/config/license.ts'
|
|
181
|
+
),
|
|
182
|
+
'utf8'
|
|
183
|
+
).catch(() => undefined),
|
|
184
|
+
]
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
assert.doesNotMatch(strProductionEnv, /non-commercial-and-evaluation/)
|
|
188
|
+
if (strAppTable) {
|
|
189
|
+
assert.match(strAppTable, /import\.meta\.env\.PROD/)
|
|
190
|
+
assert.match(strAppTable, /fnResolveAdvancedTableLicense/)
|
|
191
|
+
assert.match(strLicenseResolver, /TABLE_HANDSONTABLE_LICENSE_REQUIRED/)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
195
|
+
{ command: 'build', mode: 'production' },
|
|
196
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
197
|
+
strProjectRoot
|
|
198
|
+
)
|
|
199
|
+
const objGuardPlugin = objLoadedConfig?.config.plugins?.find(
|
|
200
|
+
(objPlugin) => objPlugin?.name === 'enterprise:app-table-build-guard'
|
|
201
|
+
)
|
|
202
|
+
const fnGenerateBundle =
|
|
203
|
+
typeof objGuardPlugin?.generateBundle === 'function'
|
|
204
|
+
? objGuardPlugin.generateBundle
|
|
205
|
+
: objGuardPlugin?.generateBundle?.handler
|
|
206
|
+
|
|
207
|
+
assert.equal(typeof fnGenerateBundle, 'function')
|
|
208
|
+
assert.throws(
|
|
209
|
+
() =>
|
|
210
|
+
fnGenerateBundle.call(
|
|
211
|
+
{
|
|
212
|
+
error(strMessage) {
|
|
213
|
+
throw new Error(strMessage)
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{},
|
|
217
|
+
{
|
|
218
|
+
'app-table.js': {
|
|
219
|
+
type: 'chunk',
|
|
220
|
+
fileName: 'app-table.js',
|
|
221
|
+
imports: [],
|
|
222
|
+
isEntry: false,
|
|
223
|
+
modules: {
|
|
224
|
+
'/workspace/src/components/AppTable/AppTable.tsx': {},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
'index.js': {
|
|
228
|
+
type: 'chunk',
|
|
229
|
+
fileName: 'index.js',
|
|
230
|
+
imports: [],
|
|
231
|
+
isEntry: true,
|
|
232
|
+
modules: { '/workspace/src/main.tsx': {} },
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
false
|
|
236
|
+
),
|
|
237
|
+
/APP_TABLE_LICENSE_REQUIRED/
|
|
238
|
+
)
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
test('production keeps the advanced table outside the initial chunk graph', async () => {
|
|
242
|
+
const strPreviousLicense = process.env.VITE_HANDSONTABLE_LICENSE_KEY
|
|
243
|
+
process.env.VITE_HANDSONTABLE_LICENSE_KEY = '12345-12345-12345-12345-12345'
|
|
244
|
+
|
|
245
|
+
try {
|
|
246
|
+
const objLoadedConfig = await loadConfigFromFile(
|
|
247
|
+
{ command: 'build', mode: 'production' },
|
|
248
|
+
path.resolve(strProjectRoot, 'vite.config.ts'),
|
|
249
|
+
strProjectRoot
|
|
250
|
+
)
|
|
251
|
+
const objGuardPlugin = objLoadedConfig?.config.plugins?.find(
|
|
252
|
+
(objPlugin) => objPlugin?.name === 'enterprise:app-table-build-guard'
|
|
253
|
+
)
|
|
254
|
+
const fnGenerateBundle =
|
|
255
|
+
typeof objGuardPlugin?.generateBundle === 'function'
|
|
256
|
+
? objGuardPlugin.generateBundle
|
|
257
|
+
: objGuardPlugin?.generateBundle?.handler
|
|
258
|
+
const objPluginContext = {
|
|
259
|
+
error(strMessage) {
|
|
260
|
+
throw new Error(strMessage)
|
|
261
|
+
},
|
|
262
|
+
}
|
|
263
|
+
const objLazyBundle = {
|
|
264
|
+
'app-table.js': {
|
|
265
|
+
type: 'chunk',
|
|
266
|
+
fileName: 'app-table.js',
|
|
267
|
+
imports: ['advanced-table-vendor.js'],
|
|
268
|
+
isEntry: false,
|
|
269
|
+
modules: {
|
|
270
|
+
'/workspace/src/components/AppTable/AppTable.tsx': {},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
'advanced-table-vendor.js': {
|
|
274
|
+
type: 'chunk',
|
|
275
|
+
fileName: 'advanced-table-vendor.js',
|
|
276
|
+
imports: [],
|
|
277
|
+
isEntry: false,
|
|
278
|
+
modules: {
|
|
279
|
+
'/workspace/node_modules/handsontable/base.mjs': {},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
'index.js': {
|
|
283
|
+
type: 'chunk',
|
|
284
|
+
dynamicImports: ['app-table.js'],
|
|
285
|
+
fileName: 'index.js',
|
|
286
|
+
imports: [],
|
|
287
|
+
isEntry: true,
|
|
288
|
+
modules: { '/workspace/src/main.tsx': {} },
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
assert.doesNotThrow(() =>
|
|
293
|
+
fnGenerateBundle.call(objPluginContext, {}, objLazyBundle, false)
|
|
294
|
+
)
|
|
295
|
+
objLazyBundle['index.js'].imports = ['app-table.js']
|
|
296
|
+
assert.throws(
|
|
297
|
+
() => fnGenerateBundle.call(objPluginContext, {}, objLazyBundle, false),
|
|
298
|
+
/APP_TABLE_EAGER_LOAD/
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
const objOutput = objLoadedConfig?.config.build?.rollupOptions?.output
|
|
302
|
+
const fnManualChunks = Array.isArray(objOutput)
|
|
303
|
+
? undefined
|
|
304
|
+
: objOutput?.manualChunks
|
|
305
|
+
assert.equal(typeof fnManualChunks, 'function')
|
|
306
|
+
assert.equal(
|
|
307
|
+
fnManualChunks('/workspace/node_modules/handsontable/base.mjs'),
|
|
308
|
+
'advanced-table-vendor'
|
|
309
|
+
)
|
|
310
|
+
} finally {
|
|
311
|
+
if (strPreviousLicense === undefined) {
|
|
312
|
+
delete process.env.VITE_HANDSONTABLE_LICENSE_KEY
|
|
313
|
+
} else {
|
|
314
|
+
process.env.VITE_HANDSONTABLE_LICENSE_KEY = strPreviousLicense
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
test('OpenAPI generator reads the backend service array', async () => {
|
|
320
|
+
const objServices = JSON.parse(
|
|
321
|
+
await readFile(
|
|
322
|
+
path.resolve(strProjectRoot, 'src/api/config/services.json'),
|
|
323
|
+
'utf8'
|
|
324
|
+
)
|
|
325
|
+
)
|
|
326
|
+
const strGenerator = await readFile(
|
|
327
|
+
path.resolve(strProjectRoot, 'tools/openapi/generate.mjs'),
|
|
328
|
+
'utf8'
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
assert.deepEqual(objServices, [
|
|
332
|
+
{
|
|
333
|
+
name: 'backend',
|
|
334
|
+
baseUrlEnv: 'VITE_API_BASE_URL',
|
|
335
|
+
openapiPath: '/swagger/openapi.json',
|
|
336
|
+
},
|
|
337
|
+
])
|
|
338
|
+
assert.match(strGenerator, /VITE_API_BASE_URL/)
|
|
339
|
+
assert.match(strGenerator, /services\.json/)
|
|
340
|
+
assert.match(strGenerator, /baseUrlEnv/)
|
|
341
|
+
assert.match(strGenerator, /openapiPath/)
|
|
342
|
+
assert.doesNotMatch(strGenerator, /includePaths/)
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
test('OpenAPI generation remains a protected scaffold capability', async () => {
|
|
346
|
+
const [strPackage, strGenerator, strGitignore, strReadme] = await Promise.all(
|
|
347
|
+
[
|
|
348
|
+
readFile(path.resolve(strProjectRoot, 'package.json'), 'utf8'),
|
|
349
|
+
readFile(
|
|
350
|
+
path.resolve(strProjectRoot, 'tools/openapi/generate.mjs'),
|
|
351
|
+
'utf8'
|
|
352
|
+
),
|
|
353
|
+
readFile(path.resolve(strProjectRoot, '.gitignore'), 'utf8'),
|
|
354
|
+
readFile(path.resolve(strProjectRoot, 'README.md'), 'utf8'),
|
|
355
|
+
]
|
|
356
|
+
)
|
|
357
|
+
const objPackage = JSON.parse(strPackage)
|
|
358
|
+
|
|
359
|
+
assert.equal(objPackage.scripts.api, 'node tools/openapi/generate.mjs')
|
|
360
|
+
assert.match(objPackage.devDependencies['swagger-typescript-api'], /^\^13\./)
|
|
361
|
+
assert.match(
|
|
362
|
+
strGenerator,
|
|
363
|
+
/import \{ generateApi \} from 'swagger-typescript-api'/
|
|
364
|
+
)
|
|
365
|
+
assert.match(strGenerator, /src\/api\/generated/)
|
|
366
|
+
assert.match(strGenerator, /mkdtemp/)
|
|
367
|
+
assert.match(strGenerator, /fnReplaceDirectory/)
|
|
368
|
+
assert.match(strGitignore, /src\/api\/generated\//)
|
|
369
|
+
assert.match(strReadme, /不是冗余目录/)
|
|
370
|
+
assert.match(strReadme, /原子替换/)
|
|
371
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import '@/styles/index.css'
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { render } from 'vitest-browser-react'
|
|
4
|
+
import { ThemeProvider } from '@/context/ThemeProvider'
|
|
5
|
+
|
|
6
|
+
const strThemeStorageKey = 'enterprise-admin.theme'
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
localStorage.setItem(strThemeStorageKey, 'dark')
|
|
10
|
+
|
|
11
|
+
const objThemeColor = document.createElement('meta')
|
|
12
|
+
objThemeColor.name = 'theme-color'
|
|
13
|
+
objThemeColor.dataset.testThemeColor = 'true'
|
|
14
|
+
document.head.append(objThemeColor)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
localStorage.removeItem(strThemeStorageKey)
|
|
19
|
+
document.documentElement.classList.remove('dark')
|
|
20
|
+
document.documentElement.style.colorScheme = ''
|
|
21
|
+
for (const strProperty of [
|
|
22
|
+
'--brand-light-primary',
|
|
23
|
+
'--brand-light-primary-foreground',
|
|
24
|
+
'--brand-light-secondary',
|
|
25
|
+
'--brand-light-secondary-foreground',
|
|
26
|
+
'--brand-dark-primary',
|
|
27
|
+
'--brand-dark-primary-foreground',
|
|
28
|
+
'--brand-dark-secondary',
|
|
29
|
+
'--brand-dark-secondary-foreground',
|
|
30
|
+
]) {
|
|
31
|
+
document.documentElement.style.removeProperty(strProperty)
|
|
32
|
+
}
|
|
33
|
+
document.querySelector('[data-test-theme-color]')?.remove()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
describe('ThemeProvider', () => {
|
|
37
|
+
it('uses the neutral-black palette for the app and scoped table theme', async () => {
|
|
38
|
+
await render(
|
|
39
|
+
<ThemeProvider>
|
|
40
|
+
<div className='hgw-table-theme' data-testid='table-theme' />
|
|
41
|
+
</ThemeProvider>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
await expect
|
|
45
|
+
.poll(() => document.documentElement.classList.contains('dark'))
|
|
46
|
+
.toBe(true)
|
|
47
|
+
|
|
48
|
+
const objTableTheme = document.querySelector<HTMLElement>(
|
|
49
|
+
'[data-testid="table-theme"]'
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
expect(objTableTheme).not.toBeNull()
|
|
53
|
+
expect(
|
|
54
|
+
getComputedStyle(document.documentElement)
|
|
55
|
+
.getPropertyValue('--background')
|
|
56
|
+
.trim()
|
|
57
|
+
).toBe('#000')
|
|
58
|
+
expect(
|
|
59
|
+
document.documentElement.style.getPropertyValue('--brand-dark-primary')
|
|
60
|
+
).toBe('#8aadff')
|
|
61
|
+
expect(
|
|
62
|
+
document.documentElement.style.getPropertyValue(
|
|
63
|
+
'--brand-dark-primary-foreground'
|
|
64
|
+
)
|
|
65
|
+
).toBe('#0f172a')
|
|
66
|
+
expect(
|
|
67
|
+
getComputedStyle(objTableTheme!).getPropertyValue('--primary').trim()
|
|
68
|
+
).toBe('#8aadff')
|
|
69
|
+
expect(
|
|
70
|
+
getComputedStyle(objTableTheme!).getPropertyValue('--background').trim()
|
|
71
|
+
).toBe('#000')
|
|
72
|
+
expect(
|
|
73
|
+
document.querySelector<HTMLMetaElement>('meta[name="theme-color"]')
|
|
74
|
+
?.content
|
|
75
|
+
).toBe('#000000')
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('tracks operating-system theme changes while system mode is active', async () => {
|
|
79
|
+
localStorage.setItem(strThemeStorageKey, 'system')
|
|
80
|
+
const objMediaQuery = Object.assign(new EventTarget(), {
|
|
81
|
+
matches: false,
|
|
82
|
+
media: '(prefers-color-scheme: dark)',
|
|
83
|
+
onchange: null,
|
|
84
|
+
addListener: () => undefined,
|
|
85
|
+
removeListener: () => undefined,
|
|
86
|
+
}) as MediaQueryList
|
|
87
|
+
vi.spyOn(window, 'matchMedia').mockReturnValue(objMediaQuery)
|
|
88
|
+
|
|
89
|
+
await render(
|
|
90
|
+
<ThemeProvider>
|
|
91
|
+
<div />
|
|
92
|
+
</ThemeProvider>
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
await expect
|
|
96
|
+
.poll(() => document.documentElement.classList.contains('dark'))
|
|
97
|
+
.toBe(false)
|
|
98
|
+
objMediaQuery.dispatchEvent(
|
|
99
|
+
Object.assign(new Event('change'), {
|
|
100
|
+
matches: true,
|
|
101
|
+
media: '(prefers-color-scheme: dark)',
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
await expect
|
|
105
|
+
.poll(() => document.documentElement.classList.contains('dark'))
|
|
106
|
+
.toBe(true)
|
|
107
|
+
})
|
|
108
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Outlet,
|
|
4
|
+
RouterProvider,
|
|
5
|
+
createMemoryHistory,
|
|
6
|
+
createRootRoute,
|
|
7
|
+
createRoute,
|
|
8
|
+
createRouter,
|
|
9
|
+
} from '@tanstack/react-router'
|
|
10
|
+
import { LocaleProvider } from '@/locale'
|
|
11
|
+
import { describe, expect, it } from 'vitest'
|
|
12
|
+
import { render } from 'vitest-browser-react'
|
|
13
|
+
import { userEvent } from 'vitest/browser'
|
|
14
|
+
import {
|
|
15
|
+
UnsavedChangesProvider,
|
|
16
|
+
useUnsavedChangesRegistration,
|
|
17
|
+
} from '@/context/UnsavedChangesProvider'
|
|
18
|
+
|
|
19
|
+
function TestRootLayout() {
|
|
20
|
+
return (
|
|
21
|
+
<LocaleProvider strLocale='en-US' strTimeZone='UTC'>
|
|
22
|
+
<UnsavedChangesProvider>
|
|
23
|
+
<Outlet />
|
|
24
|
+
</UnsavedChangesProvider>
|
|
25
|
+
</LocaleProvider>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function TestEditor() {
|
|
30
|
+
const [bIsDirty, fnSetDirty] = useState(false)
|
|
31
|
+
useUnsavedChangesRegistration({ bIsDirty })
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<main>
|
|
35
|
+
<h1>Editor</h1>
|
|
36
|
+
<button type='button' onClick={() => fnSetDirty(true)}>
|
|
37
|
+
Change draft
|
|
38
|
+
</button>
|
|
39
|
+
</main>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function fnCreateUnsavedChangesRouter() {
|
|
44
|
+
const objRootRoute = createRootRoute({ component: TestRootLayout })
|
|
45
|
+
const objEditorRoute = createRoute({
|
|
46
|
+
getParentRoute: () => objRootRoute,
|
|
47
|
+
path: '/',
|
|
48
|
+
component: TestEditor,
|
|
49
|
+
})
|
|
50
|
+
const objNextRoute = createRoute({
|
|
51
|
+
getParentRoute: () => objRootRoute,
|
|
52
|
+
path: '/next',
|
|
53
|
+
component: () => <h1>Next page</h1>,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return createRouter({
|
|
57
|
+
routeTree: objRootRoute.addChildren([objEditorRoute, objNextRoute]),
|
|
58
|
+
history: createMemoryHistory({ initialEntries: ['/'] }),
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
describe('UnsavedChangesProvider', () => {
|
|
63
|
+
it('uses one localized confirmation flow for SPA navigation', async () => {
|
|
64
|
+
const objRouter = fnCreateUnsavedChangesRouter()
|
|
65
|
+
await objRouter.load()
|
|
66
|
+
const objScreen = await render(<RouterProvider router={objRouter} />)
|
|
67
|
+
|
|
68
|
+
await userEvent.click(
|
|
69
|
+
objScreen.getByRole('button', { name: 'Change draft' })
|
|
70
|
+
)
|
|
71
|
+
objRouter.history.push('/next')
|
|
72
|
+
await expect
|
|
73
|
+
.element(objScreen.getByRole('dialog'))
|
|
74
|
+
.toHaveTextContent('Unsaved changes')
|
|
75
|
+
await expect
|
|
76
|
+
.element(objScreen.getByRole('dialog'))
|
|
77
|
+
.toHaveTextContent(
|
|
78
|
+
'You have unsaved changes. Leaving this page will discard them.'
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
await userEvent.click(
|
|
82
|
+
objScreen.getByRole('button', { name: 'Stay on page' })
|
|
83
|
+
)
|
|
84
|
+
await expect
|
|
85
|
+
.element(objScreen.getByRole('heading', { name: 'Editor' }))
|
|
86
|
+
.toBeVisible()
|
|
87
|
+
|
|
88
|
+
objRouter.history.push('/next')
|
|
89
|
+
await userEvent.click(objScreen.getByRole('button', { name: 'Leave page' }))
|
|
90
|
+
await expect
|
|
91
|
+
.element(objScreen.getByRole('heading', { name: 'Next page' }))
|
|
92
|
+
.toBeVisible()
|
|
93
|
+
})
|
|
94
|
+
})
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
fnCreateApplicationScope,
|
|
4
|
+
fnResolveApplicationMetadataScope,
|
|
5
|
+
fnResolveApplicationQueryScope,
|
|
6
|
+
} from '@/context/applicationScope'
|
|
7
|
+
|
|
8
|
+
describe('application runtime scope', () => {
|
|
9
|
+
it('reuses the session generation for every metadata resource', () => {
|
|
10
|
+
const objScope = fnCreateApplicationScope({
|
|
11
|
+
nSessionGeneration: 7,
|
|
12
|
+
strLocale: 'zh-CN',
|
|
13
|
+
strTenantId: 'tenant-a',
|
|
14
|
+
strUserId: 'user-a',
|
|
15
|
+
strWorkspaceId: 'workspace-a',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
expect(fnResolveApplicationMetadataScope(objScope)).toEqual({
|
|
19
|
+
nSessionGeneration: 7,
|
|
20
|
+
strTenantId: 'tenant-a',
|
|
21
|
+
strWorkspaceId: 'workspace-a',
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('allows resource overrides without changing the application identity', () => {
|
|
26
|
+
const objScope = fnCreateApplicationScope({
|
|
27
|
+
nSessionGeneration: 2,
|
|
28
|
+
strLocale: 'en-US',
|
|
29
|
+
strTenantId: 'tenant-a',
|
|
30
|
+
strUserId: 'user-a',
|
|
31
|
+
strWorkspaceId: 'workspace-a',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
expect(
|
|
35
|
+
fnResolveApplicationMetadataScope(objScope, {
|
|
36
|
+
strNamespace: 'public',
|
|
37
|
+
strWorkspaceId: 'workspace-b',
|
|
38
|
+
})
|
|
39
|
+
).toEqual({
|
|
40
|
+
nSessionGeneration: 2,
|
|
41
|
+
strNamespace: 'public',
|
|
42
|
+
strTenantId: 'tenant-a',
|
|
43
|
+
strWorkspaceId: 'workspace-b',
|
|
44
|
+
})
|
|
45
|
+
expect(objScope.strWorkspaceId).toBe('workspace-a')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('uses one explicit anonymous identity before authentication', () => {
|
|
49
|
+
const objScope = fnCreateApplicationScope({
|
|
50
|
+
nSessionGeneration: 0,
|
|
51
|
+
strLocale: 'zh-CN',
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
expect(fnResolveApplicationQueryScope(objScope)).toEqual({
|
|
55
|
+
nSessionGeneration: 0,
|
|
56
|
+
strLocale: 'zh-CN',
|
|
57
|
+
strTenantId: undefined,
|
|
58
|
+
strUserId: 'anonymous',
|
|
59
|
+
strWorkspaceId: undefined,
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|