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,457 @@
|
|
|
1
|
+
import type { TableQueryParams } from '../search/types'
|
|
2
|
+
import {
|
|
3
|
+
isSelectionFullyLoaded,
|
|
4
|
+
serializeSelection,
|
|
5
|
+
type SelectionDescriptor,
|
|
6
|
+
type SelectionState,
|
|
7
|
+
} from '../selection/selection'
|
|
8
|
+
import {
|
|
9
|
+
parseTableDecimal,
|
|
10
|
+
roundTableDecimal,
|
|
11
|
+
TableDecimal,
|
|
12
|
+
tableDecimalToString,
|
|
13
|
+
type TableDecimalInstance,
|
|
14
|
+
} from '../shared/decimal'
|
|
15
|
+
import { getTableRowValue } from '../shared/row'
|
|
16
|
+
import {
|
|
17
|
+
TABLE_TASK_YIELD_INTERVAL,
|
|
18
|
+
yieldTableMainThread,
|
|
19
|
+
} from '../shared/scheduler'
|
|
20
|
+
import type { TableKeyOf, TableRow } from '../shared/types'
|
|
21
|
+
import { TABLE_DEFAULT_AVERAGE_PRECISION } from './constants'
|
|
22
|
+
|
|
23
|
+
export type TableSummaryScope = 'page' | 'selection' | 'all'
|
|
24
|
+
export type TableSummaryOperation =
|
|
25
|
+
| 'sum'
|
|
26
|
+
| 'avg'
|
|
27
|
+
| 'min'
|
|
28
|
+
| 'max'
|
|
29
|
+
| 'count'
|
|
30
|
+
| 'custom'
|
|
31
|
+
|
|
32
|
+
export type TableSummaryAwaitable<T> = T | PromiseLike<T>
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 自定义本地汇总只能通过受控迭代器读取行,框架会在分片边界检查取消并让出主线程。
|
|
36
|
+
* 大数据全量汇总仍应使用远程 provider,避免把业务闭包序列化进 Worker。
|
|
37
|
+
*/
|
|
38
|
+
export interface TableSummaryAggregateContext<T extends TableRow = TableRow> {
|
|
39
|
+
/** 新汇总任务、组件销毁或主动取消时触发的信号。 */
|
|
40
|
+
signal: AbortSignal
|
|
41
|
+
/** 当前汇总范围内可迭代的业务行总数。 */
|
|
42
|
+
rowCount: number
|
|
43
|
+
/** 可取消、分片地遍历汇总范围内的每一行业务数据。 */
|
|
44
|
+
forEachRow(
|
|
45
|
+
visitor: (row: T, index: number) => TableSummaryAwaitable<void>
|
|
46
|
+
): Promise<void>
|
|
47
|
+
/** 可取消、分片地把汇总范围内的业务行归约为单个结果。 */
|
|
48
|
+
reduceRows<R>(
|
|
49
|
+
initial: R,
|
|
50
|
+
reducer: (accumulator: R, row: T, index: number) => TableSummaryAwaitable<R>
|
|
51
|
+
): Promise<R>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface TableSummaryColumnBase<T extends TableRow = TableRow> {
|
|
55
|
+
/** 参与汇总的 DTO 字段 key,也是结果 values 中的 key。 */
|
|
56
|
+
key: TableKeyOf<T>
|
|
57
|
+
/** 汇总行显示名称,省略时继承业务列标题。 */
|
|
58
|
+
label?: string
|
|
59
|
+
/** 平均值保留的小数位数,默认 6 位,并移除末尾的零。 */
|
|
60
|
+
precision?: number
|
|
61
|
+
/** 从每行提取参与聚合的值,默认按 key 读取。 */
|
|
62
|
+
value?: (row: T) => unknown
|
|
63
|
+
/** 对聚合结果进行最终显示格式化,不改变原始 values。 */
|
|
64
|
+
format?: (value: unknown, column: TableSummaryColumn<T>) => unknown
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** custom 汇总必须提供 aggregate;内置操作禁止携带不会被执行的 aggregate。 */
|
|
68
|
+
export type TableSummaryColumn<T extends TableRow = TableRow> =
|
|
69
|
+
TableSummaryColumnBase<T> &
|
|
70
|
+
(
|
|
71
|
+
| {
|
|
72
|
+
/** 使用业务自定义聚合函数。 */
|
|
73
|
+
operation: 'custom'
|
|
74
|
+
/** 通过受控迭代上下文计算当前列的汇总原始值。 */
|
|
75
|
+
aggregate: (
|
|
76
|
+
context: TableSummaryAggregateContext<T>,
|
|
77
|
+
column: TableSummaryColumn<T>
|
|
78
|
+
) => TableSummaryAwaitable<unknown>
|
|
79
|
+
}
|
|
80
|
+
| {
|
|
81
|
+
/** 使用内置 sum、avg、min、max 或 count 聚合。 */
|
|
82
|
+
operation: Exclude<TableSummaryOperation, 'custom'>
|
|
83
|
+
/** 内置聚合不接受自定义 aggregate,避免配置被静默忽略。 */
|
|
84
|
+
aggregate?: never
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
/** 本地或远程汇总成功后返回的原始值和格式化值。 */
|
|
89
|
+
export interface TableSummaryResult {
|
|
90
|
+
/** 本次实际执行的汇总数据范围。 */
|
|
91
|
+
scope: TableSummaryScope
|
|
92
|
+
/** 汇总由浏览器本地计算还是远程 provider 完成。 */
|
|
93
|
+
source: 'local' | 'remote'
|
|
94
|
+
/** 按汇总列 key 索引的原始聚合结果。 */
|
|
95
|
+
values: Record<string, unknown>
|
|
96
|
+
/** 按汇总列 key 索引、已执行 format 的展示结果。 */
|
|
97
|
+
formattedValues: Record<string, unknown>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** 发送给远程汇总 provider 的稳定请求合同。 */
|
|
101
|
+
export interface RemoteSummaryRequest {
|
|
102
|
+
/** 发起汇总的稳定表格业务标识。 */
|
|
103
|
+
tableKey: string
|
|
104
|
+
/** 需要远程处理的已选数据或全部匹配数据。 */
|
|
105
|
+
scope: 'selection' | 'all'
|
|
106
|
+
/** 当前查询参数;全量匹配范围可据此在服务端重建数据集。 */
|
|
107
|
+
query?: TableQueryParams
|
|
108
|
+
/** 可序列化的显式选择或全部匹配选择描述。 */
|
|
109
|
+
selection: SelectionDescriptor
|
|
110
|
+
/** 服务端需要执行的汇总列和聚合规则。 */
|
|
111
|
+
columns: Array<{
|
|
112
|
+
/** 参与汇总的 DTO 字段名。 */
|
|
113
|
+
key: string
|
|
114
|
+
/** 服务端需要执行的聚合操作。 */
|
|
115
|
+
operation: TableSummaryOperation
|
|
116
|
+
/** 平均值等结果允许保留的小数位数。 */
|
|
117
|
+
precision?: number
|
|
118
|
+
}>
|
|
119
|
+
/** 汇总格式化使用的区域语言。 */
|
|
120
|
+
locale?: string
|
|
121
|
+
/** 日期时间汇总使用的 IANA 时区。 */
|
|
122
|
+
timeZone?: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** 远程汇总 provider 收到的任务生命周期上下文。 */
|
|
126
|
+
export interface TableSummaryContext {
|
|
127
|
+
/** 新任务、组件销毁或主动取消时触发的信号。 */
|
|
128
|
+
signal: AbortSignal
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type TableSummaryProvider = (
|
|
132
|
+
request: RemoteSummaryRequest,
|
|
133
|
+
context: TableSummaryContext
|
|
134
|
+
) => Promise<{
|
|
135
|
+
/** 按请求汇总列 key 索引的服务端原始聚合结果。 */
|
|
136
|
+
values: Record<string, unknown>
|
|
137
|
+
}>
|
|
138
|
+
|
|
139
|
+
/** 汇总执行器使用的完整数据、范围和 provider 选项。 */
|
|
140
|
+
interface RunTableSummaryOptions<T extends TableRow = TableRow> {
|
|
141
|
+
/** 发起汇总的稳定表格业务标识。 */
|
|
142
|
+
tableKey: string
|
|
143
|
+
/** 本次请求的汇总数据范围。 */
|
|
144
|
+
scope: TableSummaryScope
|
|
145
|
+
/** 当前已加载、可用于本地汇总的业务行。 */
|
|
146
|
+
rows: readonly T[]
|
|
147
|
+
/** 当前完整行选择状态。 */
|
|
148
|
+
selection: SelectionState<T>
|
|
149
|
+
/** 需要计算的汇总列。 */
|
|
150
|
+
columns: readonly TableSummaryColumn<T>[]
|
|
151
|
+
/** 当前表格是否使用远程数据源。 */
|
|
152
|
+
remote: boolean
|
|
153
|
+
/** 当前分页、筛选和排序查询参数。 */
|
|
154
|
+
query?: TableQueryParams
|
|
155
|
+
/** 处理全部匹配或未完整加载选择范围的远程 provider。 */
|
|
156
|
+
provider?: TableSummaryProvider
|
|
157
|
+
/** 汇总格式化使用的区域语言。 */
|
|
158
|
+
locale?: string
|
|
159
|
+
/** 日期时间汇总使用的 IANA 时区。 */
|
|
160
|
+
timeZone?: string
|
|
161
|
+
/** 主动取消本次汇总任务的信号。 */
|
|
162
|
+
signal?: AbortSignal
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
class TableSummaryProviderRequiredError extends Error {
|
|
166
|
+
readonly code = 'TABLE_SUMMARY_PROVIDER_REQUIRED'
|
|
167
|
+
|
|
168
|
+
constructor(readonly scope: TableSummaryScope) {
|
|
169
|
+
super(
|
|
170
|
+
`[TableComponent] Summary scope "${scope}" requires a remote summary provider.`
|
|
171
|
+
)
|
|
172
|
+
this.name = 'TableSummaryProviderRequiredError'
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const countTableSelectionCells = (
|
|
177
|
+
ranges: readonly (readonly number[])[]
|
|
178
|
+
): number =>
|
|
179
|
+
ranges.reduce((total, range) => {
|
|
180
|
+
const [row, column, row2, column2] = range
|
|
181
|
+
if (
|
|
182
|
+
row === undefined ||
|
|
183
|
+
column === undefined ||
|
|
184
|
+
row2 === undefined ||
|
|
185
|
+
column2 === undefined
|
|
186
|
+
)
|
|
187
|
+
return total
|
|
188
|
+
return total + (Math.abs(row2 - row) + 1) * (Math.abs(column2 - column) + 1)
|
|
189
|
+
}, 0)
|
|
190
|
+
|
|
191
|
+
/** 对任意单元格或嵌套区域值做十进制安全求和。 */
|
|
192
|
+
export const sumTableNumericValues = (
|
|
193
|
+
values: Iterable<unknown>
|
|
194
|
+
): string | null => {
|
|
195
|
+
let sum = new TableDecimal(0)
|
|
196
|
+
let count = 0
|
|
197
|
+
const append = (value: unknown) => {
|
|
198
|
+
if (Array.isArray(value)) {
|
|
199
|
+
value.forEach(append)
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
const decimal = parseTableDecimal(value)
|
|
203
|
+
if (!decimal) return
|
|
204
|
+
sum = sum.plus(decimal)
|
|
205
|
+
count += 1
|
|
206
|
+
}
|
|
207
|
+
for (const value of values) append(value)
|
|
208
|
+
return count ? tableDecimalToString(sum) : null
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** 大选区求和的可取消分片版本。 */
|
|
212
|
+
export const sumTableNumericValuesAsync = async (
|
|
213
|
+
values: Iterable<unknown>,
|
|
214
|
+
options: { signal?: AbortSignal; yieldInterval?: number } = {}
|
|
215
|
+
): Promise<string | null> => {
|
|
216
|
+
let sum = new TableDecimal(0)
|
|
217
|
+
let count = 0
|
|
218
|
+
let processed = 0
|
|
219
|
+
const yieldInterval = Math.max(
|
|
220
|
+
1,
|
|
221
|
+
options.yieldInterval ?? TABLE_TASK_YIELD_INTERVAL
|
|
222
|
+
)
|
|
223
|
+
for (const source of values) {
|
|
224
|
+
const pending = [source]
|
|
225
|
+
while (pending.length) {
|
|
226
|
+
if (options.signal?.aborted) throw options.signal.reason
|
|
227
|
+
const value = pending.pop()
|
|
228
|
+
if (Array.isArray(value)) {
|
|
229
|
+
pending.push(...value)
|
|
230
|
+
continue
|
|
231
|
+
}
|
|
232
|
+
const decimal = parseTableDecimal(value)
|
|
233
|
+
if (decimal) {
|
|
234
|
+
sum = sum.plus(decimal)
|
|
235
|
+
count += 1
|
|
236
|
+
}
|
|
237
|
+
processed += 1
|
|
238
|
+
if (processed % yieldInterval === 0) await yieldTableMainThread()
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (options.signal?.aborted) throw options.signal.reason
|
|
242
|
+
return count ? tableDecimalToString(sum) : null
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const countSummaryValue = (value: unknown) => {
|
|
246
|
+
// 多值单元格按实际元素数统计,普通单元格按非空值统计。
|
|
247
|
+
if (Array.isArray(value)) return value.length
|
|
248
|
+
return value == null || value === '' ? 0 : 1
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const selectSummaryDecimal = (
|
|
252
|
+
operation: 'min' | 'max',
|
|
253
|
+
current: TableDecimalInstance,
|
|
254
|
+
candidate: TableDecimalInstance
|
|
255
|
+
) => {
|
|
256
|
+
if (operation === 'min') return candidate.lt(current) ? candidate : current
|
|
257
|
+
return candidate.gt(current) ? candidate : current
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const createSummaryAggregateContext = <T extends TableRow>(
|
|
261
|
+
rows: readonly T[],
|
|
262
|
+
signal: AbortSignal
|
|
263
|
+
): TableSummaryAggregateContext<T> => {
|
|
264
|
+
const isPromiseLike = <R>(
|
|
265
|
+
value: TableSummaryAwaitable<R>
|
|
266
|
+
): value is PromiseLike<R> =>
|
|
267
|
+
typeof value === 'object' &&
|
|
268
|
+
value !== null &&
|
|
269
|
+
typeof (value as PromiseLike<R>).then === 'function'
|
|
270
|
+
const visitRows = async (
|
|
271
|
+
visitor: (row: T, index: number) => TableSummaryAwaitable<void>
|
|
272
|
+
) => {
|
|
273
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
274
|
+
if (signal.aborted) throw signal.reason
|
|
275
|
+
const pending = visitor(rows[index]!, index)
|
|
276
|
+
if (isPromiseLike(pending)) await pending
|
|
277
|
+
if ((index + 1) % TABLE_TASK_YIELD_INTERVAL === 0) {
|
|
278
|
+
await yieldTableMainThread()
|
|
279
|
+
if (signal.aborted) throw signal.reason
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const reduceRows = async <R>(
|
|
284
|
+
initial: R,
|
|
285
|
+
reducer: (accumulator: R, row: T, index: number) => TableSummaryAwaitable<R>
|
|
286
|
+
) => {
|
|
287
|
+
let accumulator = initial
|
|
288
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
289
|
+
if (signal.aborted) throw signal.reason
|
|
290
|
+
const pending = reducer(accumulator, rows[index]!, index)
|
|
291
|
+
accumulator = isPromiseLike(pending) ? await pending : pending
|
|
292
|
+
if ((index + 1) % TABLE_TASK_YIELD_INTERVAL === 0) {
|
|
293
|
+
await yieldTableMainThread()
|
|
294
|
+
if (signal.aborted) throw signal.reason
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return accumulator
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
signal,
|
|
301
|
+
rowCount: rows.length,
|
|
302
|
+
reduceRows,
|
|
303
|
+
forEachRow: visitRows,
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const calculateColumn = async <T extends TableRow>(
|
|
308
|
+
rows: readonly T[],
|
|
309
|
+
column: TableSummaryColumn<T>,
|
|
310
|
+
signal: AbortSignal
|
|
311
|
+
) => {
|
|
312
|
+
// custom 完全交给调用方,其余内置操作统一使用 Decimal 精确十进制实现。
|
|
313
|
+
if (column.operation === 'custom') {
|
|
314
|
+
const columnKey = column.key
|
|
315
|
+
const aggregate = column.aggregate
|
|
316
|
+
if (typeof aggregate !== 'function') {
|
|
317
|
+
throw new Error(
|
|
318
|
+
`[TableComponent] Summary column "${String(columnKey)}" requires aggregate().`
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
const value = await aggregate(
|
|
322
|
+
createSummaryAggregateContext(rows, signal),
|
|
323
|
+
column
|
|
324
|
+
)
|
|
325
|
+
if (signal.aborted) throw signal.reason
|
|
326
|
+
return value
|
|
327
|
+
}
|
|
328
|
+
if (column.operation === 'count') {
|
|
329
|
+
let count = 0
|
|
330
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
331
|
+
if (signal?.aborted) throw signal.reason
|
|
332
|
+
const row = rows[index]!
|
|
333
|
+
const raw = column.value
|
|
334
|
+
? column.value(row)
|
|
335
|
+
: getTableRowValue(row, column.key)
|
|
336
|
+
count += countSummaryValue(raw)
|
|
337
|
+
if ((index + 1) % TABLE_TASK_YIELD_INTERVAL === 0)
|
|
338
|
+
await yieldTableMainThread()
|
|
339
|
+
}
|
|
340
|
+
return count
|
|
341
|
+
}
|
|
342
|
+
let count = 0
|
|
343
|
+
let sum = new TableDecimal(0)
|
|
344
|
+
let target: TableDecimalInstance | undefined
|
|
345
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {
|
|
346
|
+
const row = rows[rowIndex]!
|
|
347
|
+
if (rowIndex % 256 === 0 && signal?.aborted) throw signal.reason
|
|
348
|
+
const raw = column.value
|
|
349
|
+
? column.value(row)
|
|
350
|
+
: getTableRowValue(row, column.key)
|
|
351
|
+
const values = Array.isArray(raw) ? raw : [raw]
|
|
352
|
+
values.forEach((value) => {
|
|
353
|
+
const decimal = parseTableDecimal(value)
|
|
354
|
+
if (!decimal) return
|
|
355
|
+
count += 1
|
|
356
|
+
if (column.operation === 'min' || column.operation === 'max') {
|
|
357
|
+
target = target
|
|
358
|
+
? selectSummaryDecimal(column.operation, target, decimal)
|
|
359
|
+
: decimal
|
|
360
|
+
} else {
|
|
361
|
+
sum = sum.plus(decimal)
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
if ((rowIndex + 1) % TABLE_TASK_YIELD_INTERVAL === 0)
|
|
365
|
+
await yieldTableMainThread()
|
|
366
|
+
}
|
|
367
|
+
if (!count) return column.operation === 'sum' ? '0' : null
|
|
368
|
+
if (column.operation === 'min' || column.operation === 'max') {
|
|
369
|
+
return tableDecimalToString(target!)
|
|
370
|
+
}
|
|
371
|
+
return column.operation === 'avg'
|
|
372
|
+
? tableDecimalToString(
|
|
373
|
+
roundTableDecimal(
|
|
374
|
+
sum.div(count),
|
|
375
|
+
column.precision ?? TABLE_DEFAULT_AVERAGE_PRECISION
|
|
376
|
+
)
|
|
377
|
+
)
|
|
378
|
+
: tableDecimalToString(sum)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const formatValues = <T extends TableRow>(
|
|
382
|
+
values: Record<string, unknown>,
|
|
383
|
+
columns: readonly TableSummaryColumn<T>[]
|
|
384
|
+
) =>
|
|
385
|
+
Object.fromEntries(
|
|
386
|
+
columns.map((column) => {
|
|
387
|
+
const key = String(column.key)
|
|
388
|
+
const value = values[key]
|
|
389
|
+
return [key, column.format ? column.format(value, column) : value]
|
|
390
|
+
})
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* 按 page/selection/all 范围执行汇总。
|
|
395
|
+
*
|
|
396
|
+
* 当前数据完整时使用 Decimal 精确十进制算法;远程全量或跨页选择必须交给 provider,
|
|
397
|
+
* 不允许用当前页数据伪装全量合计。
|
|
398
|
+
*/
|
|
399
|
+
export const runTableSummary = async <T extends TableRow>(
|
|
400
|
+
options: RunTableSummaryOptions<T>
|
|
401
|
+
): Promise<TableSummaryResult> => {
|
|
402
|
+
if (options.signal?.aborted) throw options.signal.reason
|
|
403
|
+
const requiresRemote =
|
|
404
|
+
(options.scope === 'all' && options.remote) ||
|
|
405
|
+
(options.scope === 'selection' &&
|
|
406
|
+
!isSelectionFullyLoaded(options.selection))
|
|
407
|
+
if (requiresRemote) {
|
|
408
|
+
if (!options.provider) {
|
|
409
|
+
throw new TableSummaryProviderRequiredError(options.scope)
|
|
410
|
+
}
|
|
411
|
+
const signal = options.signal ?? new AbortController().signal
|
|
412
|
+
const response = await options.provider(
|
|
413
|
+
{
|
|
414
|
+
tableKey: options.tableKey,
|
|
415
|
+
scope: options.scope as 'selection' | 'all',
|
|
416
|
+
query: options.query,
|
|
417
|
+
selection: serializeSelection(options.selection),
|
|
418
|
+
columns: options.columns.map((column) => ({
|
|
419
|
+
key: String(column.key),
|
|
420
|
+
operation: column.operation,
|
|
421
|
+
precision: column.precision,
|
|
422
|
+
})),
|
|
423
|
+
locale: options.locale,
|
|
424
|
+
timeZone: options.timeZone,
|
|
425
|
+
},
|
|
426
|
+
{ signal }
|
|
427
|
+
)
|
|
428
|
+
if (signal.aborted) throw signal.reason
|
|
429
|
+
const values = response.values
|
|
430
|
+
return {
|
|
431
|
+
scope: options.scope,
|
|
432
|
+
source: 'remote',
|
|
433
|
+
values,
|
|
434
|
+
formattedValues: formatValues(values, options.columns),
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// 显式选择只有在全部键都已加载时才会进入本地分支。
|
|
439
|
+
const rows =
|
|
440
|
+
options.scope === 'selection'
|
|
441
|
+
? [...options.selection.loadedRows.values()]
|
|
442
|
+
: options.rows
|
|
443
|
+
const values: Record<string, unknown> = {}
|
|
444
|
+
const signal = options.signal ?? new AbortController().signal
|
|
445
|
+
for (const column of options.columns) {
|
|
446
|
+
if (signal.aborted) throw signal.reason
|
|
447
|
+
const value = await calculateColumn(rows, column, signal)
|
|
448
|
+
if (signal.aborted) throw signal.reason
|
|
449
|
+
values[String(column.key)] = value
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
scope: options.scope,
|
|
453
|
+
source: 'local',
|
|
454
|
+
values,
|
|
455
|
+
formattedValues: formatValues(values, options.columns),
|
|
456
|
+
}
|
|
457
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transfer'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** 单列复制、粘贴与自动填充策略。 */
|
|
2
|
+
export interface TableTransferConfig {
|
|
3
|
+
/** 限制该列只能粘贴同一个表格实例复制出来的数据。 */
|
|
4
|
+
pasteSource?: 'any' | 'same-table'
|
|
5
|
+
/** 要求复制源和粘贴目标覆盖完全相同的可视列范围。 */
|
|
6
|
+
pasteShape?: 'any' | 'same-columns'
|
|
7
|
+
/** 粘贴或自动填充时,把源行的这些关联字段放入同一变更事务。 */
|
|
8
|
+
synchronizedFields?: readonly string[]
|
|
9
|
+
}
|