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,324 @@
|
|
|
1
|
+
import type Handsontable from 'handsontable'
|
|
2
|
+
import { getTableRowValue } from '../../shared/row'
|
|
3
|
+
import { claimTableKey } from '../../shared/tableKey'
|
|
4
|
+
import type { TableRow } from '../../shared/types'
|
|
5
|
+
import { TABLE_CHANGE_SOURCE } from '../editing'
|
|
6
|
+
import {
|
|
7
|
+
createHandsontable,
|
|
8
|
+
type GridSettings,
|
|
9
|
+
type TableRuntimeOptions,
|
|
10
|
+
} from '../grid'
|
|
11
|
+
import { createTableLayoutScheduler } from '../layout/layoutScheduler'
|
|
12
|
+
import type { TableDataProjection } from './types'
|
|
13
|
+
|
|
14
|
+
interface TableGridHostOptions<T extends TableRow> {
|
|
15
|
+
tableKey: string
|
|
16
|
+
runtime?: TableRuntimeOptions
|
|
17
|
+
getRows: () => T[]
|
|
18
|
+
getDataRevision: () => number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface TableGridSize {
|
|
22
|
+
width: number
|
|
23
|
+
height: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface TableLayoutSettlement {
|
|
27
|
+
lastSize: TableGridSize | null
|
|
28
|
+
stableSamples: number
|
|
29
|
+
startedAt: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const TABLE_LAYOUT_STABLE_SAMPLE_COUNT = 2
|
|
33
|
+
const TABLE_LAYOUT_SETTLE_TIMEOUT_MS = 500
|
|
34
|
+
|
|
35
|
+
const reportTableLayoutSubscriberError = (error: unknown) => {
|
|
36
|
+
const reporter = Reflect.get(globalThis, 'reportError')
|
|
37
|
+
if (typeof reporter === 'function') {
|
|
38
|
+
Reflect.apply(reporter, globalThis, [error])
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
throw error
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handsontable 宿主边界:只管理第三方实例、tableKey 占用和展示数据投影,不持有
|
|
48
|
+
* 查询、编辑、选择等业务状态。
|
|
49
|
+
*/
|
|
50
|
+
export class TableGridHost<T extends TableRow> {
|
|
51
|
+
private hot: Handsontable | null = null
|
|
52
|
+
private releaseTableKey: (() => void) | null = null
|
|
53
|
+
private dataProjection: TableDataProjection<T> | null = null
|
|
54
|
+
private layoutTransitioning = false
|
|
55
|
+
private layoutSettlement: TableLayoutSettlement | null = null
|
|
56
|
+
private pendingLayoutRender: Handsontable | null = null
|
|
57
|
+
private readonly layoutListeners = new Set<() => void>()
|
|
58
|
+
private readonly layoutScheduler = createTableLayoutScheduler({
|
|
59
|
+
onFrame: () => {
|
|
60
|
+
if (this.pendingLayoutRender) {
|
|
61
|
+
this.finalizeLayout()
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
this.settleLayout()
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
private readonly guardDimensionRefresh = () =>
|
|
68
|
+
this.layoutTransitioning ||
|
|
69
|
+
this.layoutSettlement ||
|
|
70
|
+
this.pendingLayoutRender
|
|
71
|
+
? false
|
|
72
|
+
: undefined
|
|
73
|
+
private readonly notifyLayoutChange = () => {
|
|
74
|
+
this.layoutListeners.forEach((listener) => {
|
|
75
|
+
try {
|
|
76
|
+
listener()
|
|
77
|
+
} catch (error) {
|
|
78
|
+
reportTableLayoutSubscriberError(error)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
constructor(private readonly options: TableGridHostOptions<T>) {}
|
|
84
|
+
|
|
85
|
+
private settleLayout() {
|
|
86
|
+
const settlement = this.layoutSettlement
|
|
87
|
+
const hot = this.hot
|
|
88
|
+
if (
|
|
89
|
+
!settlement ||
|
|
90
|
+
this.layoutTransitioning ||
|
|
91
|
+
!hot ||
|
|
92
|
+
hot.isDestroyed ||
|
|
93
|
+
hot.rootWrapperElement?.isConnected === false
|
|
94
|
+
) {
|
|
95
|
+
this.layoutSettlement = null
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const { width, height } = hot.rootElement.getBoundingClientRect()
|
|
100
|
+
const sizeUnchanged =
|
|
101
|
+
settlement.lastSize?.width === width &&
|
|
102
|
+
settlement.lastSize.height === height
|
|
103
|
+
settlement.lastSize = { width, height }
|
|
104
|
+
settlement.stableSamples = sizeUnchanged ? settlement.stableSamples + 1 : 1
|
|
105
|
+
|
|
106
|
+
const timedOut =
|
|
107
|
+
performance.now() - settlement.startedAt >= TABLE_LAYOUT_SETTLE_TIMEOUT_MS
|
|
108
|
+
if (
|
|
109
|
+
settlement.stableSamples < TABLE_LAYOUT_STABLE_SAMPLE_COUNT &&
|
|
110
|
+
!timedOut
|
|
111
|
+
) {
|
|
112
|
+
this.layoutScheduler.scheduleFrame()
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.layoutSettlement = null
|
|
117
|
+
hot.refreshDimensions()
|
|
118
|
+
// refreshDimensions 的首轮渲染先提交最终列宽。AutoRowSize 必须在下一帧基于
|
|
119
|
+
// 已提交的列宽再次测量,rowHeaders 等 overlay 才能消费同一份最终行高。
|
|
120
|
+
this.pendingLayoutRender = hot
|
|
121
|
+
this.layoutScheduler.scheduleFrame()
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private finalizeLayout() {
|
|
125
|
+
const hot = this.pendingLayoutRender
|
|
126
|
+
this.pendingLayoutRender = null
|
|
127
|
+
if (
|
|
128
|
+
this.layoutTransitioning ||
|
|
129
|
+
!hot ||
|
|
130
|
+
hot !== this.hot ||
|
|
131
|
+
hot.isDestroyed ||
|
|
132
|
+
hot.rootWrapperElement?.isConnected === false
|
|
133
|
+
)
|
|
134
|
+
return
|
|
135
|
+
hot.render()
|
|
136
|
+
this.notifyLayoutChange()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** 返回当前实例;尚未挂载或已经销毁时为 null。 */
|
|
140
|
+
get instance() {
|
|
141
|
+
return this.hot
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** 判断宿主是否持有一个尚未销毁的 Handsontable 实例。 */
|
|
145
|
+
get mounted() {
|
|
146
|
+
return this.hot !== null && !this.hot.isDestroyed
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** 创建实例;仍连接文档的挂载必须显式卸载,脱离文档的旧实例允许安全接管。 */
|
|
150
|
+
mount(container: HTMLElement, settings: GridSettings) {
|
|
151
|
+
if (this.mounted && this.hot?.rootWrapperElement?.isConnected) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
`[TableComponent] Controller "${this.options.tableKey}" is already mounted by another live component.`
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
this.unmount()
|
|
157
|
+
this.releaseTableKey = claimTableKey(this.options.tableKey)
|
|
158
|
+
try {
|
|
159
|
+
this.hot = createHandsontable(container, settings, this.options.runtime)
|
|
160
|
+
// Handsontable 自己会观察 rootElement 尺寸。外层动画及尺寸稳定检测期间在其
|
|
161
|
+
// 原生刷新钩子处阻断,避免逐帧重绘;真实宽高稳定后再统一刷新一次。
|
|
162
|
+
this.hot.addHook('beforeRefreshDimensions', this.guardDimensionRefresh)
|
|
163
|
+
this.hot.addHook('afterColumnResize', this.notifyLayoutChange)
|
|
164
|
+
this.hot.addHook('afterRowResize', this.notifyLayoutChange)
|
|
165
|
+
this.notifyLayoutChange()
|
|
166
|
+
return this.hot
|
|
167
|
+
} catch (error) {
|
|
168
|
+
this.releaseTableKey()
|
|
169
|
+
this.releaseTableKey = null
|
|
170
|
+
throw error
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 只释放当前网格挂载,不销毁 Controller 持有的数据投影和业务状态。
|
|
176
|
+
* expectedInstance 用于阻止旧组件卸载时误伤同一 Controller 的新挂载。
|
|
177
|
+
*/
|
|
178
|
+
unmount(expectedInstance?: Handsontable) {
|
|
179
|
+
if (expectedInstance && this.hot !== expectedInstance) return false
|
|
180
|
+
this.layoutScheduler.cancel()
|
|
181
|
+
this.layoutSettlement = null
|
|
182
|
+
this.pendingLayoutRender = null
|
|
183
|
+
if (this.hot && !this.hot.isDestroyed) {
|
|
184
|
+
const rootWrapper = this.hot.rootWrapperElement
|
|
185
|
+
this.hot.destroy()
|
|
186
|
+
if (rootWrapper) Reflect.deleteProperty(rootWrapper, '__hotInstance')
|
|
187
|
+
}
|
|
188
|
+
const changed = this.hot !== null || this.releaseTableKey !== null
|
|
189
|
+
this.hot = null
|
|
190
|
+
this.releaseTableKey?.()
|
|
191
|
+
this.releaseTableKey = null
|
|
192
|
+
return changed
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** 将增量设置传给当前实例。 */
|
|
196
|
+
updateSettings(settings: GridSettings) {
|
|
197
|
+
this.hot?.updateSettings(settings)
|
|
198
|
+
this.notifyLayoutChange()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** 订阅会改变网格内容尺寸的布局事件;所有框架适配层共享同一事件源。 */
|
|
202
|
+
subscribeLayout(listener: () => void) {
|
|
203
|
+
this.layoutListeners.add(listener)
|
|
204
|
+
let active = true
|
|
205
|
+
return () => {
|
|
206
|
+
if (!active) return
|
|
207
|
+
active = false
|
|
208
|
+
this.layoutListeners.delete(listener)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 注册展示数据投影,并返回只释放本次注册的 disposer。 */
|
|
213
|
+
setDataProjection(projection: TableDataProjection<T>) {
|
|
214
|
+
this.dataProjection = projection
|
|
215
|
+
return () => {
|
|
216
|
+
if (this.dataProjection === projection) this.dataProjection = null
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 在领域状态提交前计算展示投影;返回函数只执行 Handsontable 写入,不再调用投影器。
|
|
222
|
+
*/
|
|
223
|
+
prepareLoadData(
|
|
224
|
+
rows = this.options.getRows(),
|
|
225
|
+
dataRevision = this.options.getDataRevision()
|
|
226
|
+
) {
|
|
227
|
+
const hot = this.hot
|
|
228
|
+
if (!hot) return () => {}
|
|
229
|
+
const projected = this.dataProjection?.(rows, dataRevision)
|
|
230
|
+
const projection = Array.isArray(projected)
|
|
231
|
+
? { data: projected }
|
|
232
|
+
: (projected ?? { data: rows })
|
|
233
|
+
return () => {
|
|
234
|
+
hot.batch(() => {
|
|
235
|
+
if (projection.settings) hot.updateSettings(projection.settings)
|
|
236
|
+
hot.loadData(projection.data)
|
|
237
|
+
})
|
|
238
|
+
this.notifyLayoutChange()
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** 重新计算展示投影,并在一个 HOT batch 内提交设置和数据。 */
|
|
243
|
+
loadData() {
|
|
244
|
+
this.prepareLoadData()()
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** 按视觉行读取源数据,自动适配排序后的物理行映射。 */
|
|
248
|
+
getRow(visualRow: number) {
|
|
249
|
+
const rows = this.options.getRows()
|
|
250
|
+
if (!this.hot) return rows[visualRow]
|
|
251
|
+
return this.hot.getSourceDataAtRow(this.hot.toPhysicalRow(visualRow)) as T
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** 通过 Handsontable 写入单元格并透传 change source。 */
|
|
255
|
+
setCell(visualRow: number, key: string, value: unknown, source?: string) {
|
|
256
|
+
this.hot?.setDataAtRowProp(visualRow, key, value, source)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** 提交框架浮层值,并通过同步数据结果判断 mutation 门禁是否接受。 */
|
|
260
|
+
commitControlledCell(visualRow: number, key: string, value: unknown) {
|
|
261
|
+
const previousRow = this.getRow(visualRow)
|
|
262
|
+
if (!previousRow) return false
|
|
263
|
+
const previousValue = getTableRowValue(previousRow, key)
|
|
264
|
+
this.setCell(visualRow, key, value, TABLE_CHANGE_SOURCE.controlledEdit)
|
|
265
|
+
const nextRow = this.getRow(visualRow)
|
|
266
|
+
return (
|
|
267
|
+
nextRow !== undefined &&
|
|
268
|
+
(Object.is(previousValue, value) ||
|
|
269
|
+
!Object.is(getTableRowValue(nextRow, key), previousValue))
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** 请求当前实例重绘。 */
|
|
274
|
+
render() {
|
|
275
|
+
this.hot?.render()
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** 请求当前实例重新测量宿主尺寸。 */
|
|
279
|
+
refreshDimensions() {
|
|
280
|
+
if (
|
|
281
|
+
this.layoutTransitioning ||
|
|
282
|
+
this.layoutSettlement ||
|
|
283
|
+
this.pendingLayoutRender
|
|
284
|
+
)
|
|
285
|
+
return
|
|
286
|
+
this.hot?.refreshDimensions()
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** 合并外层连续布局变化;尺寸稳定后按最终列宽完成测量、渲染和布局通知。 */
|
|
290
|
+
setLayoutTransitioning(active: boolean) {
|
|
291
|
+
if (this.layoutTransitioning === active) return
|
|
292
|
+
this.layoutTransitioning = active
|
|
293
|
+
if (active) {
|
|
294
|
+
this.layoutScheduler.cancel()
|
|
295
|
+
this.layoutSettlement = null
|
|
296
|
+
this.pendingLayoutRender = null
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
const hot = this.hot
|
|
300
|
+
if (
|
|
301
|
+
!hot ||
|
|
302
|
+
hot.isDestroyed ||
|
|
303
|
+
hot.rootWrapperElement?.isConnected === false
|
|
304
|
+
)
|
|
305
|
+
return
|
|
306
|
+
this.layoutSettlement = {
|
|
307
|
+
lastSize: null,
|
|
308
|
+
stableSamples: 0,
|
|
309
|
+
startedAt: performance.now(),
|
|
310
|
+
}
|
|
311
|
+
this.layoutScheduler.scheduleFrame()
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* 销毁第三方实例并释放 tableKey;额外删除 wrapper 残留的实例引用,避免反向保留
|
|
316
|
+
* Walkontable 子树。
|
|
317
|
+
*/
|
|
318
|
+
destroy() {
|
|
319
|
+
this.unmount()
|
|
320
|
+
this.layoutTransitioning = false
|
|
321
|
+
this.dataProjection = null
|
|
322
|
+
this.layoutListeners.clear()
|
|
323
|
+
}
|
|
324
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getTableRowValue } from '../../shared/row'
|
|
2
|
+
import { walkTableRows } from '../../shared/treeRows'
|
|
3
|
+
import type { TableRow } from '../../shared/types'
|
|
4
|
+
import {
|
|
5
|
+
encodeTableRowKey,
|
|
6
|
+
isRowKey,
|
|
7
|
+
type RowKey,
|
|
8
|
+
type RowKeyResolver,
|
|
9
|
+
} from '../editing'
|
|
10
|
+
|
|
11
|
+
/** 使用统一语义解析行身份;所有有状态领域都复用这一实现。 */
|
|
12
|
+
export const resolveTableRowKey = <T extends TableRow>(
|
|
13
|
+
row: T,
|
|
14
|
+
rowKey: RowKeyResolver<T>
|
|
15
|
+
): RowKey => {
|
|
16
|
+
const value =
|
|
17
|
+
typeof rowKey === 'function' ? rowKey(row) : getTableRowValue(row, rowKey)
|
|
18
|
+
if (!isRowKey(value)) {
|
|
19
|
+
throw new Error('[TableComponent] Every stateful row requires a rowKey.')
|
|
20
|
+
}
|
|
21
|
+
return value
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 选择、编辑和校验必须共享同一个身份解析器;函数解析器要求复用同一函数引用,避免
|
|
26
|
+
* 新数据进入后才暴露出各领域对同一行计算出不同 key。
|
|
27
|
+
*/
|
|
28
|
+
export const resolveCanonicalTableRowKey = <T extends TableRow>(
|
|
29
|
+
resolvers: ReadonlyArray<RowKeyResolver<T> | null | undefined>
|
|
30
|
+
) => {
|
|
31
|
+
const configured = resolvers.filter(
|
|
32
|
+
(resolver): resolver is RowKeyResolver<T> => resolver != null
|
|
33
|
+
)
|
|
34
|
+
const canonical = configured[0] ?? null
|
|
35
|
+
if (
|
|
36
|
+
canonical &&
|
|
37
|
+
configured.some((resolver) => !Object.is(resolver, canonical))
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'[TableComponent] editing, selection and validation must share one canonical rowKey resolver.'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
return canonical
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 一次遍历验证父子行全树身份并返回与树前序一致的 key,供编辑和选择共享,避免重复
|
|
48
|
+
* 执行业务 rowKey resolver。
|
|
49
|
+
*/
|
|
50
|
+
export const assertTableRowIdentity = <T extends TableRow>(
|
|
51
|
+
rows: readonly T[],
|
|
52
|
+
rowKey: RowKeyResolver<T>
|
|
53
|
+
) => {
|
|
54
|
+
const seen = new Set<string>()
|
|
55
|
+
const keys: RowKey[] = []
|
|
56
|
+
walkTableRows(rows, ({ row }) => {
|
|
57
|
+
const value = resolveTableRowKey(row, rowKey)
|
|
58
|
+
const encoded = encodeTableRowKey(value)
|
|
59
|
+
if (seen.has(encoded)) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`[TableComponent] Duplicate rowKey "${String(value)}" in loaded rows.`
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
seen.add(encoded)
|
|
65
|
+
keys.push(value)
|
|
66
|
+
})
|
|
67
|
+
return keys
|
|
68
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { CellChange } from 'handsontable'
|
|
2
|
+
import { getTableRowValue, type TableRow } from '../../shared'
|
|
3
|
+
import {
|
|
4
|
+
processTableMutation,
|
|
5
|
+
type TableMutationBatchResult,
|
|
6
|
+
type TableMutationColumn,
|
|
7
|
+
type TableMutationRejected,
|
|
8
|
+
} from '../editing/mutation'
|
|
9
|
+
|
|
10
|
+
/** 统一处理 edit、paste、autofill 和 API 输入的解析、准入与派生字段。 */
|
|
11
|
+
export class TableMutationPipeline<T extends TableRow> {
|
|
12
|
+
private columns = new Map<string, TableMutationColumn<T>>()
|
|
13
|
+
|
|
14
|
+
/** 按字段 key 重建可变更列索引。 */
|
|
15
|
+
setColumns(columns?: readonly TableMutationColumn<T>[]) {
|
|
16
|
+
this.columns = new Map(
|
|
17
|
+
columns?.map((column) => [String(column.prop), column]) ?? []
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 处理一个 HOT change batch;拒绝项原位改为 null,派生字段追加到同一批次,确保
|
|
23
|
+
* 最终只形成一个撤销事务。
|
|
24
|
+
*/
|
|
25
|
+
process(
|
|
26
|
+
changes: Array<CellChange | null>,
|
|
27
|
+
getRow: (visualRow: number) => T | undefined,
|
|
28
|
+
rawSource = 'edit'
|
|
29
|
+
): TableMutationBatchResult<T> {
|
|
30
|
+
const accepted: TableMutationBatchResult<T>['accepted'] = []
|
|
31
|
+
const rejected: TableMutationRejected<T>[] = []
|
|
32
|
+
const scheduledKeys = new Set(
|
|
33
|
+
changes.flatMap((change) =>
|
|
34
|
+
change &&
|
|
35
|
+
(typeof change[1] === 'string' || typeof change[1] === 'number')
|
|
36
|
+
? [`${change[0]}:${String(change[1])}`]
|
|
37
|
+
: []
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
for (let index = 0; index < changes.length; index += 1) {
|
|
42
|
+
const change = changes[index]
|
|
43
|
+
if (!change) continue
|
|
44
|
+
const [visualRow, prop, oldValue, newValue] = change
|
|
45
|
+
if (typeof prop !== 'string' && typeof prop !== 'number') continue
|
|
46
|
+
const row = getRow(visualRow)
|
|
47
|
+
if (!row) continue
|
|
48
|
+
const key = String(prop)
|
|
49
|
+
const result = processTableMutation(
|
|
50
|
+
{ row, rowIndex: visualRow, prop: key, oldValue, newValue, rawSource },
|
|
51
|
+
this.columns.get(key)
|
|
52
|
+
)
|
|
53
|
+
if (result.accepted !== true) {
|
|
54
|
+
changes[index] = null
|
|
55
|
+
rejected.push(result)
|
|
56
|
+
continue
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
change[3] = result.value
|
|
60
|
+
accepted.push(result)
|
|
61
|
+
Object.entries(result.derivedChanges).forEach(
|
|
62
|
+
([derivedProp, derivedValue]) => {
|
|
63
|
+
if (derivedProp === key) return
|
|
64
|
+
const identity = `${visualRow}:${derivedProp}`
|
|
65
|
+
if (scheduledKeys.has(identity)) return
|
|
66
|
+
scheduledKeys.add(identity)
|
|
67
|
+
changes.push([
|
|
68
|
+
visualRow,
|
|
69
|
+
derivedProp,
|
|
70
|
+
getTableRowValue(row, derivedProp),
|
|
71
|
+
derivedValue,
|
|
72
|
+
])
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return { accepted, rejected }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createTableQueryIdentity,
|
|
3
|
+
createTableQueryParamsSnapshot,
|
|
4
|
+
} from '../../search/query'
|
|
5
|
+
import {
|
|
6
|
+
createRemoteQueryRunner,
|
|
7
|
+
type RemoteQueryOutcome,
|
|
8
|
+
} from '../../search/remoteQuery'
|
|
9
|
+
import type { TableQuery, TableQueryParams } from '../../search/types'
|
|
10
|
+
import type { TableRow } from '../../shared'
|
|
11
|
+
import { TableQueryIncompleteError, TableQueryResultLimitError } from './errors'
|
|
12
|
+
import type { TableQueryExecutionOptions } from './types'
|
|
13
|
+
|
|
14
|
+
interface TableQueryCoordinatorContext<T extends TableRow> {
|
|
15
|
+
tableKey: string
|
|
16
|
+
getRows: () => T[]
|
|
17
|
+
getTotal: () => number
|
|
18
|
+
guardReload: () => void
|
|
19
|
+
applyResult: (
|
|
20
|
+
rows: T[],
|
|
21
|
+
total: number,
|
|
22
|
+
params: TableQueryParams,
|
|
23
|
+
queryIdentity: string
|
|
24
|
+
) => void
|
|
25
|
+
applyLocalResult: (params: TableQueryParams, queryIdentity: string) => void
|
|
26
|
+
commitState: (commitPreparedState: () => void) => void
|
|
27
|
+
setError: (error: unknown) => void
|
|
28
|
+
notify: () => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 远程查询协调器:管理请求竞态、查询快照、限制校验和 loading 状态。 */
|
|
32
|
+
export class TableQueryCoordinator<T extends TableRow> {
|
|
33
|
+
private runner: ReturnType<typeof createRemoteQueryRunner<T>> | null = null
|
|
34
|
+
private querySource: TableQuery<T> | undefined
|
|
35
|
+
private lastParams: TableQueryParams | undefined
|
|
36
|
+
private lastIdentity: string | undefined
|
|
37
|
+
private running = false
|
|
38
|
+
|
|
39
|
+
constructor(private readonly context: TableQueryCoordinatorContext<T>) {}
|
|
40
|
+
|
|
41
|
+
/** 最近一次成功应用的查询参数。 */
|
|
42
|
+
get params() {
|
|
43
|
+
return this.lastParams
|
|
44
|
+
? createTableQueryParamsSnapshot(this.lastParams)
|
|
45
|
+
: undefined
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 最近一次成功应用的查询结果集身份,不包含分页位置。 */
|
|
49
|
+
get identity() {
|
|
50
|
+
return this.lastIdentity
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 当前是否正在执行查询。 */
|
|
54
|
+
get loading() {
|
|
55
|
+
return this.running
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** 当前远程请求序号;没有远程查询时为 0。 */
|
|
59
|
+
get requestId() {
|
|
60
|
+
return this.runner?.currentRequestId ?? 0
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 是否配置了远程查询函数。 */
|
|
64
|
+
get remote() {
|
|
65
|
+
return Boolean(this.runner)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 仅由 Controller 的同步事务调用,提交已通过全部预检的查询参数。 */
|
|
69
|
+
commitAppliedParams(params: TableQueryParams, queryIdentity: string) {
|
|
70
|
+
this.lastParams = params
|
|
71
|
+
this.lastIdentity = queryIdentity
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 构造无副作用的查询 provider 切换提交;调用方可与数据替换组合成更大的事务。
|
|
76
|
+
*/
|
|
77
|
+
prepareQuery(query?: TableQuery<T>) {
|
|
78
|
+
if (this.querySource === query) return () => {}
|
|
79
|
+
this.context.guardReload()
|
|
80
|
+
const nextRunner = query
|
|
81
|
+
? createRemoteQueryRunner(query, { tableKey: this.context.tableKey })
|
|
82
|
+
: null
|
|
83
|
+
return () => {
|
|
84
|
+
this.runner?.cancel()
|
|
85
|
+
this.querySource = query
|
|
86
|
+
this.lastParams = undefined
|
|
87
|
+
this.lastIdentity = undefined
|
|
88
|
+
this.runner = nextRunner
|
|
89
|
+
this.running = false
|
|
90
|
+
this.context.setError(null)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** 热切换查询函数,取消旧请求并清理旧查询上下文。 */
|
|
95
|
+
setQuery(query?: TableQuery<T>) {
|
|
96
|
+
const commit = this.prepareQuery(query)
|
|
97
|
+
this.context.commitState(commit)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** 执行查询;只允许最后一个请求写入状态和数据。 */
|
|
101
|
+
async run(
|
|
102
|
+
params: TableQueryParams,
|
|
103
|
+
options: TableQueryExecutionOptions = {}
|
|
104
|
+
): Promise<RemoteQueryOutcome<T>> {
|
|
105
|
+
this.context.guardReload()
|
|
106
|
+
const paramsSnapshot = createTableQueryParamsSnapshot(params)
|
|
107
|
+
const queryIdentity = createTableQueryIdentity(paramsSnapshot)
|
|
108
|
+
const runner = this.runner
|
|
109
|
+
if (!runner) {
|
|
110
|
+
this.context.applyLocalResult(paramsSnapshot, queryIdentity)
|
|
111
|
+
const rows = this.context.getRows()
|
|
112
|
+
return {
|
|
113
|
+
status: 'applied',
|
|
114
|
+
requestId: 0,
|
|
115
|
+
result: { list: [...rows], total: this.context.getTotal() },
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const requestId = runner.currentRequestId + 1
|
|
120
|
+
this.running = true
|
|
121
|
+
this.context.setError(null)
|
|
122
|
+
this.context.notify()
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
// provider 获得独立副本;即使业务代码原地修改请求,也不会污染最终应用的快照。
|
|
126
|
+
const outcome = await runner.run(
|
|
127
|
+
createTableQueryParamsSnapshot(paramsSnapshot)
|
|
128
|
+
)
|
|
129
|
+
if (outcome.status === 'applied' && outcome.result) {
|
|
130
|
+
const receivedRows = outcome.result.list?.length ?? 0
|
|
131
|
+
const resultTotal = Math.max(0, outcome.result.total ?? receivedRows)
|
|
132
|
+
if (
|
|
133
|
+
options.maxRows !== undefined &&
|
|
134
|
+
(resultTotal > options.maxRows || receivedRows > options.maxRows)
|
|
135
|
+
) {
|
|
136
|
+
throw new TableQueryResultLimitError(
|
|
137
|
+
options.maxRows,
|
|
138
|
+
resultTotal,
|
|
139
|
+
receivedRows
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
if (options.requireComplete && receivedRows !== resultTotal) {
|
|
143
|
+
throw new TableQueryIncompleteError(resultTotal, receivedRows)
|
|
144
|
+
}
|
|
145
|
+
// 请求期间仍允许用户编辑,因此必须在同步提交区再次校验。Controller 只接收
|
|
146
|
+
// 声明式查询身份,并自行提交 rows、total、params 和选择状态,不执行外部闭包。
|
|
147
|
+
this.context.guardReload()
|
|
148
|
+
this.context.applyResult(
|
|
149
|
+
outcome.result.list ?? [],
|
|
150
|
+
resultTotal,
|
|
151
|
+
paramsSnapshot,
|
|
152
|
+
queryIdentity
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
return outcome
|
|
156
|
+
} catch (error) {
|
|
157
|
+
if (this.runner === runner && runner.currentRequestId === requestId) {
|
|
158
|
+
this.context.setError(error)
|
|
159
|
+
}
|
|
160
|
+
throw error
|
|
161
|
+
} finally {
|
|
162
|
+
if (this.runner === runner && runner.currentRequestId === requestId) {
|
|
163
|
+
this.running = false
|
|
164
|
+
this.context.notify()
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** 取消当前请求并保留 query provider,供更晚的用户意图重新发起查询。 */
|
|
170
|
+
cancel() {
|
|
171
|
+
if (!this.runner) return
|
|
172
|
+
const wasRunning = this.running
|
|
173
|
+
this.runner.cancel()
|
|
174
|
+
this.running = false
|
|
175
|
+
if (wasRunning) this.context.notify()
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 取消进行中的查询并清理运行状态。 */
|
|
179
|
+
destroy() {
|
|
180
|
+
this.runner?.cancel()
|
|
181
|
+
this.runner = null
|
|
182
|
+
this.querySource = undefined
|
|
183
|
+
this.lastParams = undefined
|
|
184
|
+
this.lastIdentity = undefined
|
|
185
|
+
this.running = false
|
|
186
|
+
}
|
|
187
|
+
}
|