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,802 @@
|
|
|
1
|
+
import type { CellChange } from 'handsontable'
|
|
2
|
+
import { normalizeTableTotal } from '../../pagination/config'
|
|
3
|
+
import type {
|
|
4
|
+
PreferenceStatus,
|
|
5
|
+
TablePreference,
|
|
6
|
+
TablePreferenceSession,
|
|
7
|
+
TablePreferenceUpdater,
|
|
8
|
+
} from '../../preference'
|
|
9
|
+
import type { TableQuery, TableQueryParams } from '../../search/types'
|
|
10
|
+
import {
|
|
11
|
+
createEmptyTableSelectionState,
|
|
12
|
+
type TableRowSelectionUpdate,
|
|
13
|
+
type TableSelection,
|
|
14
|
+
type TableSelectionOptions,
|
|
15
|
+
} from '../../selection/selection'
|
|
16
|
+
import type { SelectionState } from '../../selection/types'
|
|
17
|
+
import { resolveTableKey } from '../../shared/tableKey'
|
|
18
|
+
import type { TableRow } from '../../shared/types'
|
|
19
|
+
import type {
|
|
20
|
+
TableExportProvider,
|
|
21
|
+
TableExportTask,
|
|
22
|
+
TableXlsxWriter,
|
|
23
|
+
} from '../../summary/export'
|
|
24
|
+
import type {
|
|
25
|
+
TableSummaryProvider,
|
|
26
|
+
TableSummaryResult,
|
|
27
|
+
} from '../../summary/summary'
|
|
28
|
+
import type { RowKeyResolver } from '../editing'
|
|
29
|
+
import type {
|
|
30
|
+
ChangeSet,
|
|
31
|
+
ChangeSetHandler,
|
|
32
|
+
ConflictResolution,
|
|
33
|
+
TableChangeTracker,
|
|
34
|
+
VersionConflict,
|
|
35
|
+
} from '../editing/changeSet'
|
|
36
|
+
import type {
|
|
37
|
+
TableMutationBatchResult,
|
|
38
|
+
TableMutationColumn,
|
|
39
|
+
} from '../editing/mutation'
|
|
40
|
+
import type {
|
|
41
|
+
TableValidation,
|
|
42
|
+
TableValidationOptions,
|
|
43
|
+
TableValidationResult,
|
|
44
|
+
} from '../editing/validation'
|
|
45
|
+
import type { GridSettings } from '../grid'
|
|
46
|
+
import { TableDirtyReloadError, assertTableSaveIdle } from './errors'
|
|
47
|
+
import { prepareTableDataReplacement } from './tableDataReplacement'
|
|
48
|
+
import { prepareTableDomainConfiguration } from './tableDomainConfiguration'
|
|
49
|
+
import { TableEditingCommands } from './tableEditingCommands'
|
|
50
|
+
import { TableGridHost } from './tableGridHost'
|
|
51
|
+
import { resolveTableRowKey } from './tableIdentity'
|
|
52
|
+
import { TableMutationPipeline } from './tableMutationPipeline'
|
|
53
|
+
import { TableQueryCoordinator } from './tableQueryCoordinator'
|
|
54
|
+
import { TableReportingCoordinator } from './tableReportingCoordinator'
|
|
55
|
+
import { TableSaveCoordinator } from './tableSaveCoordinator'
|
|
56
|
+
import { TableSnapshotPublisher } from './tableSnapshot'
|
|
57
|
+
import type {
|
|
58
|
+
TableControllerOptions,
|
|
59
|
+
TableControllerConfigurationPatch,
|
|
60
|
+
TableDataSourceConfiguration,
|
|
61
|
+
TableDataProjection,
|
|
62
|
+
TableCellState,
|
|
63
|
+
TableEditingOptions,
|
|
64
|
+
TableExportExecutionOptions,
|
|
65
|
+
TableQueryExecutionOptions,
|
|
66
|
+
TableSnapshot,
|
|
67
|
+
TableSnapshotListener,
|
|
68
|
+
TableSummaryExecutionOptions,
|
|
69
|
+
} from './types'
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* TableComponent 的框架无关控制中枢。
|
|
73
|
+
*
|
|
74
|
+
* 它统一持有数据、远程查询、选择、编辑事务、校验、汇总、导出以及 Handsontable
|
|
75
|
+
* 实例生命周期。React 层只负责把快照映射到界面和把用户事件转成这里的命令,
|
|
76
|
+
* 不能在适配层复制一套业务状态。
|
|
77
|
+
*/
|
|
78
|
+
export class TableController<T extends TableRow = TableRow> {
|
|
79
|
+
private readonly grid: TableGridHost<T>
|
|
80
|
+
private readonly snapshots: TableSnapshotPublisher<T>
|
|
81
|
+
private readonly query: TableQueryCoordinator<T>
|
|
82
|
+
private changeTracker: TableChangeTracker<T> | null = null
|
|
83
|
+
private selection: TableSelection<T> | null = null
|
|
84
|
+
private validation: TableValidation<T> | null = null
|
|
85
|
+
private mutation = new TableMutationPipeline<T>()
|
|
86
|
+
private readonly reporting: TableReportingCoordinator<T>
|
|
87
|
+
private readonly save: TableSaveCoordinator<T>
|
|
88
|
+
private readonly editingCommands: TableEditingCommands<T>
|
|
89
|
+
private commitChanges: ChangeSetHandler<T> | null = null
|
|
90
|
+
private rowKeyResolver: RowKeyResolver<T> | null = null
|
|
91
|
+
private rows: T[]
|
|
92
|
+
private total: number
|
|
93
|
+
private baselineTotal: number
|
|
94
|
+
private error: unknown = null
|
|
95
|
+
private snapshotRows: readonly T[]
|
|
96
|
+
private currentDataRevision = 0
|
|
97
|
+
private notificationBatchDepth = 0
|
|
98
|
+
private notificationPending = false
|
|
99
|
+
private notificationRowsChanged = false
|
|
100
|
+
private preferenceSession: TablePreferenceSession | null = null
|
|
101
|
+
|
|
102
|
+
/** 创建控制器并装配已显式启用的查询、选择、编辑、校验、汇总和导出能力。 */
|
|
103
|
+
constructor(readonly options: TableControllerOptions<T>) {
|
|
104
|
+
this.rows = [...(options.initialData ?? [])]
|
|
105
|
+
this.snapshotRows = Object.freeze([...this.rows])
|
|
106
|
+
this.total = this.rows.length
|
|
107
|
+
this.baselineTotal = this.total
|
|
108
|
+
this.snapshots = new TableSnapshotPublisher(() => this.createSnapshot())
|
|
109
|
+
this.grid = new TableGridHost({
|
|
110
|
+
tableKey: options.tableKey,
|
|
111
|
+
runtime: options.runtime,
|
|
112
|
+
getRows: () => this.rows,
|
|
113
|
+
getDataRevision: () => this.currentDataRevision,
|
|
114
|
+
})
|
|
115
|
+
this.query = new TableQueryCoordinator({
|
|
116
|
+
tableKey: options.tableKey,
|
|
117
|
+
getRows: () => this.rows,
|
|
118
|
+
getTotal: () => this.total,
|
|
119
|
+
guardReload: () => {
|
|
120
|
+
if (this.hasDirtyChanges())
|
|
121
|
+
throw new TableDirtyReloadError(this.tableKey)
|
|
122
|
+
},
|
|
123
|
+
applyResult: (rows, total, params, queryIdentity) => {
|
|
124
|
+
const preparedData = this.prepareDataReplacement(rows, total)
|
|
125
|
+
this.batchStateNotifications(() => {
|
|
126
|
+
preparedData.commit()
|
|
127
|
+
this.query.commitAppliedParams(params, queryIdentity)
|
|
128
|
+
this.selection?.applyQueryIdentity(queryIdentity)
|
|
129
|
+
this.publishRowsChanged(preparedData.render)
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
applyLocalResult: (params, queryIdentity) => {
|
|
133
|
+
this.batchStateNotifications(() => {
|
|
134
|
+
this.query.commitAppliedParams(params, queryIdentity)
|
|
135
|
+
this.selection?.applyQueryIdentity(queryIdentity)
|
|
136
|
+
this.notify()
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
commitState: (commitPreparedState) => {
|
|
140
|
+
this.batchStateNotifications(() => {
|
|
141
|
+
commitPreparedState()
|
|
142
|
+
this.notify()
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
setError: (error) => {
|
|
146
|
+
this.error = error
|
|
147
|
+
},
|
|
148
|
+
notify: () => this.notify(),
|
|
149
|
+
})
|
|
150
|
+
this.reporting = new TableReportingCoordinator({
|
|
151
|
+
tableKey: options.tableKey,
|
|
152
|
+
getRows: () => this.rows,
|
|
153
|
+
getSelection: () => this.getSelection(),
|
|
154
|
+
isRemote: () => this.query.remote,
|
|
155
|
+
getQuery: () => this.query.params,
|
|
156
|
+
notify: () => this.notify(),
|
|
157
|
+
})
|
|
158
|
+
this.save = new TableSaveCoordinator({
|
|
159
|
+
tableKey: options.tableKey,
|
|
160
|
+
getRows: () => this.rows,
|
|
161
|
+
getDataRevision: () => this.currentDataRevision,
|
|
162
|
+
getTracker: () => this.changeTracker,
|
|
163
|
+
getValidation: () => this.validation,
|
|
164
|
+
getCommitChanges: () => this.commitChanges,
|
|
165
|
+
applyCommitResult: (tracker, result, submission) => {
|
|
166
|
+
const settlement = tracker.applyCommitResult(
|
|
167
|
+
this.rows,
|
|
168
|
+
result,
|
|
169
|
+
submission
|
|
170
|
+
)
|
|
171
|
+
this.rows = settlement.rows
|
|
172
|
+
settlement.keyRemaps.forEach(({ previousKey, nextKey, row }) => {
|
|
173
|
+
this.selection?.remapKey(previousKey, nextKey, row)
|
|
174
|
+
this.validation?.remapKey(previousKey, nextKey)
|
|
175
|
+
})
|
|
176
|
+
this.refreshSnapshotRows()
|
|
177
|
+
this.baselineTotal =
|
|
178
|
+
this.total - tracker.pendingCreateCount + tracker.pendingRemoveCount
|
|
179
|
+
// 服务端和编辑基线已经提交后,展示层失败只能进入 error 状态,不能把保存伪装成失败。
|
|
180
|
+
this.runGridEffect(() => this.grid.render())
|
|
181
|
+
},
|
|
182
|
+
setError: (error) => {
|
|
183
|
+
this.error = error
|
|
184
|
+
},
|
|
185
|
+
notify: () => this.notify(),
|
|
186
|
+
})
|
|
187
|
+
this.editingCommands = new TableEditingCommands({
|
|
188
|
+
tableKey: options.tableKey,
|
|
189
|
+
getSavePromise: () => this.save.inFlight,
|
|
190
|
+
getRows: () => this.rows,
|
|
191
|
+
setRows: (rows) => {
|
|
192
|
+
this.rows = rows
|
|
193
|
+
},
|
|
194
|
+
getTotal: () => this.total,
|
|
195
|
+
setTotal: (total) => {
|
|
196
|
+
this.total = total
|
|
197
|
+
},
|
|
198
|
+
getBaselineTotal: () => this.baselineTotal,
|
|
199
|
+
getRow: (visualRow) => this.getRow(visualRow),
|
|
200
|
+
getTracker: () => this.changeTracker,
|
|
201
|
+
getSelection: () => this.selection,
|
|
202
|
+
getValidation: () => this.validation,
|
|
203
|
+
getRowIdentity: (row) =>
|
|
204
|
+
this.rowKeyResolver
|
|
205
|
+
? resolveTableRowKey(row, this.rowKeyResolver)
|
|
206
|
+
: row,
|
|
207
|
+
refreshRevision: () => this.refreshSnapshotRevision(),
|
|
208
|
+
reloadRows: () => this.publishRowsChanged(),
|
|
209
|
+
notify: () => this.notify(),
|
|
210
|
+
})
|
|
211
|
+
this.reconfigure({
|
|
212
|
+
editing: options.editing,
|
|
213
|
+
selection: options.selection,
|
|
214
|
+
validation: options.validation,
|
|
215
|
+
mutation: options.mutation,
|
|
216
|
+
})
|
|
217
|
+
this.setSummaryProvider(options.summaryProvider)
|
|
218
|
+
this.setExport(options.export)
|
|
219
|
+
this.setQuery(options.query)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** 返回控制器稳定身份,用于实例隔离、查询上下文和诊断信息。 */
|
|
223
|
+
get tableKey() {
|
|
224
|
+
return this.options.tableKey
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 返回当前 Handsontable 实例;尚未挂载或已销毁时为 null。 */
|
|
228
|
+
get instance() {
|
|
229
|
+
return this.grid.instance
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** 判断有效 Handsontable 实例是否已经挂载。 */
|
|
233
|
+
get mounted() {
|
|
234
|
+
return this.grid.mounted
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** 返回业务行集版本;替换、增删或单元格变更后递增。 */
|
|
238
|
+
get dataRevision() {
|
|
239
|
+
return this.currentDataRevision
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** 返回按通知周期缓存的结构只读状态快照。 */
|
|
243
|
+
get snapshot(): TableSnapshot<T> {
|
|
244
|
+
return this.snapshots.snapshot
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** 从当前领域状态组装一次完整快照,由发布器负责缓存。 */
|
|
248
|
+
private createSnapshot(): TableSnapshot<T> {
|
|
249
|
+
// Set/Map 等复杂状态由各子状态机返回防御性副本;rows 冻结集合外壳但不深冻结 DTO。
|
|
250
|
+
return {
|
|
251
|
+
tableKey: this.tableKey,
|
|
252
|
+
rows: this.snapshotRows,
|
|
253
|
+
dataRevision: this.currentDataRevision,
|
|
254
|
+
total: this.total,
|
|
255
|
+
loading: this.query.loading,
|
|
256
|
+
saving: this.save.saving,
|
|
257
|
+
isDirty: this.changeTracker?.isDirty ?? false,
|
|
258
|
+
dirtyCount: this.changeTracker?.dirtyCount ?? 0,
|
|
259
|
+
dirtyCells: this.changeTracker?.cells ?? [],
|
|
260
|
+
conflicts: this.changeTracker?.conflicts ?? [],
|
|
261
|
+
selection: this.getSelection(),
|
|
262
|
+
validating: this.save.validating,
|
|
263
|
+
validationIssues: this.validation?.issues ?? [],
|
|
264
|
+
summarizing: this.reporting.summarizing,
|
|
265
|
+
exporting: this.reporting.exporting,
|
|
266
|
+
error: this.error,
|
|
267
|
+
requestId: this.query.requestId,
|
|
268
|
+
mounted: this.mounted,
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** 订阅状态快照并立即接收当前值;返回幂等取消函数。 */
|
|
273
|
+
subscribe(listener: TableSnapshotListener<T>) {
|
|
274
|
+
return this.snapshots.subscribe(listener)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** 在业务行集合结构变化后推进版本,并生成新的只读 rows 集合外壳。 */
|
|
278
|
+
private refreshSnapshotRows() {
|
|
279
|
+
this.currentDataRevision += 1
|
|
280
|
+
this.snapshotRows = Object.freeze([...this.rows])
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** 在行对象原地变化后只推进版本,避免为每次单元格编辑复制完整 rows。 */
|
|
284
|
+
private refreshSnapshotRevision() {
|
|
285
|
+
this.currentDataRevision += 1
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** 失效快照缓存并通知全部订阅者;结构变化时同时刷新 rows 集合外壳。 */
|
|
289
|
+
private notify(rowsChanged = false) {
|
|
290
|
+
if (this.notificationBatchDepth > 0) {
|
|
291
|
+
this.notificationPending = true
|
|
292
|
+
this.notificationRowsChanged ||= rowsChanged
|
|
293
|
+
return
|
|
294
|
+
}
|
|
295
|
+
if (rowsChanged) this.refreshSnapshotRows()
|
|
296
|
+
this.snapshots.notify()
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** 发布一致快照后再执行网格副作用;渲染失败只进入 error 状态。 */
|
|
300
|
+
private publishRowsChanged(render = () => this.grid.loadData()) {
|
|
301
|
+
this.refreshSnapshotRows()
|
|
302
|
+
this.notify()
|
|
303
|
+
this.runGridEffect(render)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
private runGridEffect(effect: () => void) {
|
|
307
|
+
try {
|
|
308
|
+
effect()
|
|
309
|
+
} catch (error) {
|
|
310
|
+
this.error = error
|
|
311
|
+
this.notify()
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** 预检领域状态和网格投影,返回不再调用业务代码的同步提交。 */
|
|
316
|
+
private prepareDataReplacement(rows: readonly T[], total = rows.length) {
|
|
317
|
+
const prepared = prepareTableDataReplacement({
|
|
318
|
+
tableKey: this.tableKey,
|
|
319
|
+
rows,
|
|
320
|
+
total,
|
|
321
|
+
savePromise: this.save.inFlight,
|
|
322
|
+
dirty: this.hasDirtyChanges(),
|
|
323
|
+
rowKey: this.rowKeyResolver,
|
|
324
|
+
tracker: this.changeTracker,
|
|
325
|
+
selection: this.selection,
|
|
326
|
+
validation: this.validation,
|
|
327
|
+
})
|
|
328
|
+
const render = this.grid.prepareLoadData(
|
|
329
|
+
prepared.rows,
|
|
330
|
+
this.currentDataRevision + 1
|
|
331
|
+
)
|
|
332
|
+
return {
|
|
333
|
+
render,
|
|
334
|
+
commit: () => {
|
|
335
|
+
this.rows = prepared.rows
|
|
336
|
+
this.total = prepared.total
|
|
337
|
+
this.baselineTotal = prepared.total
|
|
338
|
+
prepared.commitDomains()
|
|
339
|
+
},
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** 把多个领域状态变更合并为一个可观察快照。 */
|
|
344
|
+
private batchStateNotifications<R>(action: () => R): R {
|
|
345
|
+
this.notificationBatchDepth += 1
|
|
346
|
+
try {
|
|
347
|
+
return action()
|
|
348
|
+
} finally {
|
|
349
|
+
this.notificationBatchDepth -= 1
|
|
350
|
+
if (this.notificationBatchDepth === 0 && this.notificationPending) {
|
|
351
|
+
const rowsChanged = this.notificationRowsChanged
|
|
352
|
+
this.notificationPending = false
|
|
353
|
+
this.notificationRowsChanged = false
|
|
354
|
+
if (rowsChanged) this.refreshSnapshotRows()
|
|
355
|
+
this.snapshots.notify()
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** 热切换远程查询实现,取消旧请求并清除旧查询上下文。 */
|
|
361
|
+
setQuery(query?: TableQuery<T>) {
|
|
362
|
+
this.query.setQuery(query)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* 原子切换查询 provider 与可选本地数据。remote → local 时先完成全部数据预检,
|
|
367
|
+
* 再一次发布新 provider、rows、total 和领域基线。
|
|
368
|
+
*/
|
|
369
|
+
reconfigureDataSource(configuration: TableDataSourceConfiguration<T>) {
|
|
370
|
+
const commitQuery =
|
|
371
|
+
'query' in configuration
|
|
372
|
+
? this.query.prepareQuery(configuration.query)
|
|
373
|
+
: () => {}
|
|
374
|
+
const preparedData =
|
|
375
|
+
'rows' in configuration
|
|
376
|
+
? this.prepareDataReplacement(
|
|
377
|
+
[...(configuration.rows ?? [])],
|
|
378
|
+
configuration.total ?? configuration.rows?.length ?? 0
|
|
379
|
+
)
|
|
380
|
+
: undefined
|
|
381
|
+
this.batchStateNotifications(() => {
|
|
382
|
+
commitQuery()
|
|
383
|
+
preparedData?.commit()
|
|
384
|
+
if (preparedData) this.publishRowsChanged(preparedData.render)
|
|
385
|
+
else this.notify()
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* 先在控制器外构造并验证所有候选领域对象,全部成功后才交换引用和发布快照。
|
|
391
|
+
*/
|
|
392
|
+
reconfigure(configuration: TableControllerConfigurationPatch<T>) {
|
|
393
|
+
const changesEditing = 'editing' in configuration
|
|
394
|
+
const changesValidation = 'validation' in configuration
|
|
395
|
+
if (changesEditing || changesValidation) {
|
|
396
|
+
assertTableSaveIdle(this.save.inFlight, this.tableKey, 'reconfigure')
|
|
397
|
+
}
|
|
398
|
+
if (changesEditing && this.hasDirtyChanges()) {
|
|
399
|
+
throw new Error(
|
|
400
|
+
`[TableComponent] Table "${this.tableKey}" cannot reconfigure editing while dirty.`
|
|
401
|
+
)
|
|
402
|
+
}
|
|
403
|
+
const next = prepareTableDomainConfiguration({
|
|
404
|
+
configuration,
|
|
405
|
+
rows: this.rows,
|
|
406
|
+
tracker: this.changeTracker,
|
|
407
|
+
selection: this.selection,
|
|
408
|
+
validation: this.validation,
|
|
409
|
+
mutation: this.mutation,
|
|
410
|
+
commitChanges: this.commitChanges,
|
|
411
|
+
})
|
|
412
|
+
this.batchStateNotifications(() => {
|
|
413
|
+
if (next.changesEditing) {
|
|
414
|
+
this.changeTracker = next.tracker
|
|
415
|
+
this.baselineTotal = this.total
|
|
416
|
+
}
|
|
417
|
+
if (next.changesSelection) this.selection = next.selection
|
|
418
|
+
if (next.changesValidation) {
|
|
419
|
+
this.save.resetValidation()
|
|
420
|
+
this.validation = next.validation
|
|
421
|
+
}
|
|
422
|
+
if (next.changesMutation) this.mutation = next.mutation
|
|
423
|
+
this.rowKeyResolver = next.rowKey
|
|
424
|
+
this.commitChanges = next.commitChanges
|
|
425
|
+
this.notify()
|
|
426
|
+
})
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** 配置显式保存事务;存在脏数据时拒绝重建变更跟踪基线。 */
|
|
430
|
+
setEditing(options?: TableEditingOptions<T>) {
|
|
431
|
+
this.reconfigure({ editing: options })
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** 重建行选择状态机,并以当前业务行作为已加载集合。 */
|
|
435
|
+
setSelection(options?: TableSelectionOptions<T>) {
|
|
436
|
+
this.reconfigure({ selection: options })
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** 热切换校验规则,取消进行中的校验并清理旧问题。 */
|
|
440
|
+
setValidation(options?: TableValidationOptions<T>) {
|
|
441
|
+
this.reconfigure({ validation: options })
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/** 编译各列的输入解析、准入和派生变更规则。 */
|
|
445
|
+
setMutation(columns?: readonly TableMutationColumn<T>[]) {
|
|
446
|
+
this.reconfigure({ mutation: columns })
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** 热切换远程汇总 provider,并取消进行中的旧汇总。 */
|
|
450
|
+
setSummaryProvider(provider?: TableSummaryProvider) {
|
|
451
|
+
this.reporting.setSummaryProvider(provider)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** 热切换导出 provider/XLSX writer,并取消进行中的旧导出。 */
|
|
455
|
+
setExport(options?: {
|
|
456
|
+
provider?: TableExportProvider
|
|
457
|
+
xlsxWriter?: TableXlsxWriter<T>
|
|
458
|
+
}) {
|
|
459
|
+
this.reporting.setExport(options)
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** 执行受竞态保护的查询;存在脏数据时拒绝替换 rows,避免静默丢改。 */
|
|
463
|
+
runQuery(params: TableQueryParams, options: TableQueryExecutionOptions = {}) {
|
|
464
|
+
return this.query.run(params, options)
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** 取消进行中的远程查询,但保留查询 provider 供下一次用户意图复用。 */
|
|
468
|
+
cancelQuery() {
|
|
469
|
+
this.query.cancel()
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/** 创建并占有网格实例;仍存活的重复挂载会失败,脱离文档的旧实例可安全接管。 */
|
|
473
|
+
mount(container: HTMLElement, settings: GridSettings) {
|
|
474
|
+
const instance = this.grid.mount(container, settings)
|
|
475
|
+
this.notify()
|
|
476
|
+
return instance
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* 释放指定组件创建的 Handsontable 挂载,但保留查询、选择、编辑和订阅状态。
|
|
481
|
+
* 传入 mount 返回的实例可避免旧组件卸载时销毁已经由新组件接管的网格。
|
|
482
|
+
*/
|
|
483
|
+
unmountGrid(expectedInstance = this.instance) {
|
|
484
|
+
if (!expectedInstance) return false
|
|
485
|
+
const unmounted = this.grid.unmount(expectedInstance)
|
|
486
|
+
if (unmounted) this.notify()
|
|
487
|
+
return unmounted
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/** 将增量网格设置转交给当前 Handsontable 实例。 */
|
|
491
|
+
updateSettings(settings: GridSettings) {
|
|
492
|
+
this.grid.updateSettings(settings)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** 订阅列宽、行高和数据投影等会改变网格内容尺寸的布局变化。 */
|
|
496
|
+
subscribeGridLayout(listener: () => void) {
|
|
497
|
+
return this.grid.subscribeLayout(listener)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* 注册适配层展示数据投影。Controller 始终只持有业务 rows,Handsontable 可以额外
|
|
502
|
+
* 接收 summary 等只读展示行。返回的 disposer 只释放本次注册,避免旧组件卸载时
|
|
503
|
+
* 清除新挂载组件的投影。
|
|
504
|
+
*/
|
|
505
|
+
setDataProjection = (projection: TableDataProjection<T>) =>
|
|
506
|
+
this.grid.setDataProjection(projection)
|
|
507
|
+
|
|
508
|
+
/** 当 summary 等只读展示投影改变时,由 Controller 统一刷新 HOT。 */
|
|
509
|
+
refreshDataProjection = () => this.runGridEffect(() => this.grid.loadData())
|
|
510
|
+
|
|
511
|
+
/** 替换完整业务行集和总数,并重置编辑、选择、校验的加载基线。 */
|
|
512
|
+
replaceData(rows: T[], total = rows.length) {
|
|
513
|
+
const prepared = this.prepareDataReplacement(rows, total)
|
|
514
|
+
this.batchStateNotifications(() => {
|
|
515
|
+
prepared.commit()
|
|
516
|
+
this.publishRowsChanged(prepared.render)
|
|
517
|
+
})
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* 只更新分页总数,不替换当前业务行。
|
|
522
|
+
*
|
|
523
|
+
* 编辑事务期间会把待新增/待删除数量从外部总数中反推到加载基线,确保随后放弃
|
|
524
|
+
* 修改时仍回到本次更新后的服务端总数,而不是过期的初始值。
|
|
525
|
+
*/
|
|
526
|
+
setTotal(total: number) {
|
|
527
|
+
const nextTotal = normalizeTableTotal(total)
|
|
528
|
+
const tracker = this.changeTracker
|
|
529
|
+
this.baselineTotal = normalizeTableTotal(
|
|
530
|
+
nextTotal -
|
|
531
|
+
(tracker?.pendingCreateCount ?? 0) +
|
|
532
|
+
(tracker?.pendingRemoveCount ?? 0)
|
|
533
|
+
)
|
|
534
|
+
if (nextTotal === this.total) return
|
|
535
|
+
this.total = nextTotal
|
|
536
|
+
this.notify()
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/** 返回业务行数组副本,防止调用方直接改变控制器集合结构。 */
|
|
540
|
+
getData = () => [...this.rows]
|
|
541
|
+
|
|
542
|
+
/** 按视觉行定位业务行;已挂载时自动处理排序后的物理行映射。 */
|
|
543
|
+
getRow(visualRow: number) {
|
|
544
|
+
return this.grid.getRow(visualRow)
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** 通过 Handsontable 公共 API 写入单元格,并保留来源标记。 */
|
|
548
|
+
setCell(visualRow: number, key: string, value: unknown, source?: string) {
|
|
549
|
+
this.grid.setCell(visualRow, key, value, source)
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** 通过受控来源提交框架浮层值,并同步返回 mutation 门禁是否接受。 */
|
|
553
|
+
commitControlledCell(visualRow: number, key: string, value: unknown) {
|
|
554
|
+
return this.grid.commitControlledCell(visualRow, key, value)
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** 对一次编辑批次执行解析、准入与派生字段计算,返回接受/拒绝明细。 */
|
|
558
|
+
processChanges(
|
|
559
|
+
changes: Array<CellChange | null>,
|
|
560
|
+
rawSource = 'edit'
|
|
561
|
+
): TableMutationBatchResult<T> {
|
|
562
|
+
return this.mutation.process(changes, (row) => this.getRow(row), rawSource)
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** 将 HOT 已落库的变更登记到事务基线,并清除对应单元格旧校验问题。 */
|
|
566
|
+
recordChanges(changes: CellChange[]) {
|
|
567
|
+
this.editingCommands.recordChanges(changes)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** 为网格 cells() 热路径提供常量时间的错误和冲突查询。 */
|
|
571
|
+
getCellState(rowKey: unknown, prop: string): TableCellState {
|
|
572
|
+
return this.editingCommands.getCellState(rowKey, prop)
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** 在指定位置插入业务行,并同步 total、选择模型和网格投影。 */
|
|
576
|
+
addRow(row: T, index = this.rows.length) {
|
|
577
|
+
this.editingCommands.addRow(row, index)
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** 按稳定行身份批量删除实际存在的行,并同步关联领域状态。 */
|
|
581
|
+
removeRows(rows: readonly T[]) {
|
|
582
|
+
this.editingCommands.removeRows(rows)
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/** 返回当前待提交的新增、更新和删除集合;未启用编辑时返回空集合。 */
|
|
586
|
+
getChangeSet(): ChangeSet<T> {
|
|
587
|
+
return (
|
|
588
|
+
this.changeTracker?.getChangeSet() ?? {
|
|
589
|
+
creates: [],
|
|
590
|
+
updates: [],
|
|
591
|
+
removes: [],
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** 返回当前未解决的乐观锁版本冲突。 */
|
|
597
|
+
getConflicts(): readonly VersionConflict<T>[] {
|
|
598
|
+
return this.changeTracker?.conflicts ?? []
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/** 应用某一行冲突解决策略,并同步选择、校验和网格数据。 */
|
|
602
|
+
resolveConflict(rowKey: string | number, resolution: ConflictResolution) {
|
|
603
|
+
this.editingCommands.resolveConflict(rowKey, resolution)
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/** 判断当前是否存在尚未提交或丢弃的显式编辑。 */
|
|
607
|
+
hasDirtyChanges() {
|
|
608
|
+
return this.changeTracker?.isDirty ?? false
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/** 取消旧公开校验并校验当前完整业务行集,同时发布 validating 状态。 */
|
|
612
|
+
async validate(): Promise<TableValidationResult> {
|
|
613
|
+
return this.save.validate()
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/** 校验并提交完整变更集,合并服务端结果和主键映射,保留 HOT 撤销历史。 */
|
|
617
|
+
saveChanges() {
|
|
618
|
+
return this.save.save()
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** 放弃全部未保存修改,恢复编辑基线及其 total、校验和网格状态。 */
|
|
622
|
+
discardChanges() {
|
|
623
|
+
this.editingCommands.discardChanges()
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/** 判断 Handsontable 撤销栈当前是否可用。 */
|
|
627
|
+
canUndo() {
|
|
628
|
+
return this.grid.instance?.getPlugin('undoRedo').isUndoAvailable() ?? false
|
|
629
|
+
}
|
|
630
|
+
/** 判断 Handsontable 重做栈当前是否可用。 */
|
|
631
|
+
canRedo() {
|
|
632
|
+
return this.grid.instance?.getPlugin('undoRedo').isRedoAvailable() ?? false
|
|
633
|
+
}
|
|
634
|
+
/** 执行一次 Handsontable 撤销命令。 */
|
|
635
|
+
undo() {
|
|
636
|
+
this.grid.instance?.getPlugin('undoRedo').undo()
|
|
637
|
+
}
|
|
638
|
+
/** 执行一次 Handsontable 重做命令。 */
|
|
639
|
+
redo() {
|
|
640
|
+
this.grid.instance?.getPlugin('undoRedo').redo()
|
|
641
|
+
}
|
|
642
|
+
/** 返回选择状态的防御性快照;未启用选择时返回空显式选择。 */
|
|
643
|
+
getSelection(): SelectionState<T> {
|
|
644
|
+
return this.selection?.state ?? createEmptyTableSelectionState<T>()
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** 返回当前已加载页面中被选中的业务行。 */
|
|
648
|
+
getLoadedSelectedRows() {
|
|
649
|
+
return this.selection?.loadedSelectedRows ?? []
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/** 判断某业务行是否处于当前选择语义下的选中状态。 */
|
|
653
|
+
isRowSelected(row: T) {
|
|
654
|
+
return this.selection?.isSelected(row) ?? false
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/** 判断某业务行是否通过 selectable 准入规则。 */
|
|
658
|
+
canSelectRow(row: T) {
|
|
659
|
+
return this.selection?.canSelect(row) ?? false
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** 切换单行业务选择状态并发布新快照。 */
|
|
663
|
+
toggleRowSelection(row: T, selected: boolean) {
|
|
664
|
+
this.selection?.toggle(row, selected)
|
|
665
|
+
this.notify()
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/** 按批量更新指令改变给定行集合的选择状态。 */
|
|
669
|
+
updateRowSelection(rows: readonly T[], update: TableRowSelectionUpdate) {
|
|
670
|
+
this.selection?.updateRows(rows, update)
|
|
671
|
+
this.notify()
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** 选中或取消当前页可选择行,默认作用于全部已加载业务行。 */
|
|
675
|
+
selectPage(rows: readonly T[] = this.rows, selected = true) {
|
|
676
|
+
this.selection?.selectPage(rows, selected)
|
|
677
|
+
this.notify()
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** 用指定业务行替换显式选择集合。 */
|
|
681
|
+
setSelectedRows(rows: readonly T[]) {
|
|
682
|
+
this.selection?.replaceExplicit(rows)
|
|
683
|
+
this.notify()
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/** 进入“选择全部查询结果”模式,并绑定不可变查询令牌和结果集身份。 */
|
|
687
|
+
selectAllMatching(queryToken: string) {
|
|
688
|
+
const queryIdentity = this.query.identity
|
|
689
|
+
if (!queryIdentity) {
|
|
690
|
+
throw new Error(
|
|
691
|
+
`[TableComponent] Table "${this.tableKey}" must apply a query before selecting all matching rows.`
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
if (!this.selection) {
|
|
695
|
+
throw new Error(
|
|
696
|
+
`[TableComponent] Table "${this.tableKey}" has no selection model.`
|
|
697
|
+
)
|
|
698
|
+
}
|
|
699
|
+
this.selection.selectAllMatching(queryToken, queryIdentity, this.rows)
|
|
700
|
+
this.notify()
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** 当查询身份变化时使旧的全量选择失效;返回是否发生状态变化。 */
|
|
704
|
+
invalidateSelectionQuery(nextQueryToken?: string) {
|
|
705
|
+
const invalidated =
|
|
706
|
+
this.selection?.invalidateQueryToken(nextQueryToken) ?? false
|
|
707
|
+
if (invalidated) this.notify()
|
|
708
|
+
return invalidated
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/** 清空显式选择或全量选择状态。 */
|
|
712
|
+
clearSelection() {
|
|
713
|
+
this.selection?.clear()
|
|
714
|
+
this.notify()
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** 返回最近一次成功应用的查询参数,供汇总和导出复用。 */
|
|
718
|
+
getQueryParams() {
|
|
719
|
+
return this.query.params
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/** 执行当前页、选择范围或远程全量汇总,并取消同类旧任务。 */
|
|
723
|
+
async summarize(
|
|
724
|
+
options: TableSummaryExecutionOptions<T>
|
|
725
|
+
): Promise<TableSummaryResult> {
|
|
726
|
+
return this.reporting.summarize(options)
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/** 执行指定范围和格式的数据导出,并取消同类旧任务。 */
|
|
730
|
+
async exportData(
|
|
731
|
+
options: TableExportExecutionOptions<T>
|
|
732
|
+
): Promise<TableExportTask> {
|
|
733
|
+
return this.reporting.exportData(options)
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/** 请求 Handsontable 重绘当前视图。 */
|
|
737
|
+
render() {
|
|
738
|
+
this.grid.render()
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** 通知 Handsontable 重新测量宿主尺寸。 */
|
|
742
|
+
refreshDimensions() {
|
|
743
|
+
this.grid.refreshDimensions()
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* 标记外层布局正在连续改变可用尺寸;结束时 Core 会合并为一次最终尺寸刷新。
|
|
748
|
+
*/
|
|
749
|
+
setLayoutTransitioning(active: boolean) {
|
|
750
|
+
this.grid.setLayoutTransitioning(active)
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/** 由框架适配器绑定当前表格唯一的偏好会话。 */
|
|
754
|
+
bindPreferenceSession(session: TablePreferenceSession | null) {
|
|
755
|
+
this.preferenceSession = session
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** 获取当前规范化偏好;适配器尚未绑定偏好会话时返回 undefined。 */
|
|
759
|
+
getPreference(): TablePreference | undefined {
|
|
760
|
+
return this.preferenceSession?.snapshot.value
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/** 获取偏好加载状态;适配器尚未绑定偏好会话时为 idle。 */
|
|
764
|
+
getPreferenceStatus(): PreferenceStatus {
|
|
765
|
+
return this.preferenceSession?.status ?? 'idle'
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/** 从配置的存储适配器重新加载偏好。 */
|
|
769
|
+
async reloadPreference() {
|
|
770
|
+
return this.preferenceSession?.load()
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** 基于会话最新值原子更新偏好。 */
|
|
774
|
+
async updatePreference(updater: TablePreferenceUpdater) {
|
|
775
|
+
return this.preferenceSession?.update(updater)
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/** 删除当前表格持久化偏好并恢复组件默认值。 */
|
|
779
|
+
async resetPreference() {
|
|
780
|
+
return this.preferenceSession?.reset()
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/** 取消全部异步任务,销毁网格并释放所有快照订阅者。 */
|
|
784
|
+
destroy() {
|
|
785
|
+
// 先取消全部异步任务,再销毁网格和订阅者,防止卸载后继续回写适配层。
|
|
786
|
+
this.query.destroy()
|
|
787
|
+
this.save.destroy()
|
|
788
|
+
this.reporting.destroy()
|
|
789
|
+
this.preferenceSession = null
|
|
790
|
+
this.grid.destroy()
|
|
791
|
+
this.snapshots.destroy()
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/** 创建框架无关的 TableController。 */
|
|
796
|
+
export const createTableController = <T extends TableRow = TableRow>(
|
|
797
|
+
options: TableControllerOptions<T>
|
|
798
|
+
) =>
|
|
799
|
+
new TableController<T>({
|
|
800
|
+
...options,
|
|
801
|
+
tableKey: resolveTableKey(options.tableKey),
|
|
802
|
+
})
|