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,145 @@
|
|
|
1
|
+
import { getTableRowValue } from '../shared/row'
|
|
2
|
+
import {
|
|
3
|
+
TABLE_TASK_YIELD_INTERVAL,
|
|
4
|
+
yieldTableMainThread,
|
|
5
|
+
} from '../shared/scheduler'
|
|
6
|
+
import type { TableRow } from '../shared/types'
|
|
7
|
+
import type { TableQueryParams } from './types'
|
|
8
|
+
|
|
9
|
+
const throwIfAborted = (signal?: AbortSignal) => {
|
|
10
|
+
if (signal?.aborted) throw signal.reason
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const matchesTableWhere = (
|
|
14
|
+
value: unknown,
|
|
15
|
+
where: TableQueryParams['where'][number]
|
|
16
|
+
) => {
|
|
17
|
+
const target = where.value
|
|
18
|
+
const normalizedValue = String(value ?? '').toLocaleLowerCase()
|
|
19
|
+
const normalizedTarget = String(target ?? '').toLocaleLowerCase()
|
|
20
|
+
|
|
21
|
+
switch (where.operator) {
|
|
22
|
+
case 'eq':
|
|
23
|
+
return Object.is(value, target) || normalizedValue === normalizedTarget
|
|
24
|
+
case 'ne':
|
|
25
|
+
return !(Object.is(value, target) || normalizedValue === normalizedTarget)
|
|
26
|
+
case 'include':
|
|
27
|
+
case 'contains':
|
|
28
|
+
return normalizedValue.includes(normalizedTarget)
|
|
29
|
+
case 'notInclude':
|
|
30
|
+
return !normalizedValue.includes(normalizedTarget)
|
|
31
|
+
case 'startsWith':
|
|
32
|
+
return normalizedValue.startsWith(normalizedTarget)
|
|
33
|
+
case 'endsWith':
|
|
34
|
+
return normalizedValue.endsWith(normalizedTarget)
|
|
35
|
+
case 'gt':
|
|
36
|
+
return Number(value) > Number(target)
|
|
37
|
+
case 'gte':
|
|
38
|
+
return Number(value) >= Number(target)
|
|
39
|
+
case 'lt':
|
|
40
|
+
return Number(value) < Number(target)
|
|
41
|
+
case 'lte':
|
|
42
|
+
return Number(value) <= Number(target)
|
|
43
|
+
case 'in':
|
|
44
|
+
return Array.isArray(target)
|
|
45
|
+
? target.some((entry) => Object.is(entry, value))
|
|
46
|
+
: false
|
|
47
|
+
case 'notIn':
|
|
48
|
+
return Array.isArray(target)
|
|
49
|
+
? !target.some((entry) => Object.is(entry, value))
|
|
50
|
+
: true
|
|
51
|
+
case 'between':
|
|
52
|
+
return Array.isArray(target) && target.length === 2
|
|
53
|
+
? String(value) >= String(target[0]) &&
|
|
54
|
+
String(value) <= String(target[1])
|
|
55
|
+
: true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const compareTableRows = <T extends TableRow>(
|
|
60
|
+
left: T,
|
|
61
|
+
right: T,
|
|
62
|
+
sort: NonNullable<TableQueryParams['sort']>
|
|
63
|
+
) => {
|
|
64
|
+
for (const item of sort) {
|
|
65
|
+
const result = String(
|
|
66
|
+
getTableRowValue(left, item.field) ?? ''
|
|
67
|
+
).localeCompare(
|
|
68
|
+
String(getTableRowValue(right, item.field) ?? ''),
|
|
69
|
+
'zh-CN',
|
|
70
|
+
{ numeric: true }
|
|
71
|
+
)
|
|
72
|
+
if (result !== 0) return item.direction === 'asc' ? result : -result
|
|
73
|
+
}
|
|
74
|
+
return 0
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 可取消的稳定归并排序;大型本地查询不会被一次原生 sort 长任务独占主线程。 */
|
|
78
|
+
const sortTableRows = async <T extends TableRow>(
|
|
79
|
+
rows: T[],
|
|
80
|
+
sort: NonNullable<TableQueryParams['sort']>,
|
|
81
|
+
signal: AbortSignal | undefined,
|
|
82
|
+
yieldInterval: number
|
|
83
|
+
) => {
|
|
84
|
+
if (rows.length < 2) return rows
|
|
85
|
+
let source = [...rows]
|
|
86
|
+
let target = new Array<T>(rows.length)
|
|
87
|
+
let operations = 0
|
|
88
|
+
|
|
89
|
+
for (let width = 1; width < rows.length; width *= 2) {
|
|
90
|
+
for (let start = 0; start < rows.length; start += width * 2) {
|
|
91
|
+
const middle = Math.min(start + width, rows.length)
|
|
92
|
+
const end = Math.min(start + width * 2, rows.length)
|
|
93
|
+
let left = start
|
|
94
|
+
let right = middle
|
|
95
|
+
let write = start
|
|
96
|
+
while (left < middle || right < end) {
|
|
97
|
+
target[write++] =
|
|
98
|
+
right >= end ||
|
|
99
|
+
(left < middle &&
|
|
100
|
+
compareTableRows(source[left]!, source[right]!, sort) <= 0)
|
|
101
|
+
? source[left++]!
|
|
102
|
+
: source[right++]!
|
|
103
|
+
operations += 1
|
|
104
|
+
if (operations % yieldInterval === 0) {
|
|
105
|
+
throwIfAborted(signal)
|
|
106
|
+
await yieldTableMainThread()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
;[source, target] = [target, source]
|
|
111
|
+
throwIfAborted(signal)
|
|
112
|
+
}
|
|
113
|
+
return source
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** 在主线程分片执行本地筛选和排序;大数据跨页查询仍应优先使用远程 provider。 */
|
|
117
|
+
export const runTableLocalQuery = async <T extends TableRow>(
|
|
118
|
+
rows: readonly T[],
|
|
119
|
+
params: TableQueryParams,
|
|
120
|
+
options: { signal?: AbortSignal; yieldInterval?: number } = {}
|
|
121
|
+
) => {
|
|
122
|
+
const yieldInterval = Math.max(
|
|
123
|
+
1,
|
|
124
|
+
options.yieldInterval ?? TABLE_TASK_YIELD_INTERVAL
|
|
125
|
+
)
|
|
126
|
+
const filtered: T[] = []
|
|
127
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
128
|
+
const row = rows[index]!
|
|
129
|
+
if (
|
|
130
|
+
params.where.every((where) =>
|
|
131
|
+
matchesTableWhere(getTableRowValue(row, where.field), where)
|
|
132
|
+
)
|
|
133
|
+
) {
|
|
134
|
+
filtered.push(row)
|
|
135
|
+
}
|
|
136
|
+
if ((index + 1) % yieldInterval === 0) {
|
|
137
|
+
throwIfAborted(options.signal)
|
|
138
|
+
await yieldTableMainThread()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
throwIfAborted(options.signal)
|
|
142
|
+
return params.sort?.length
|
|
143
|
+
? sortTableRows(filtered, params.sort, options.signal, yieldInterval)
|
|
144
|
+
: filtered
|
|
145
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { cloneTableValue } from '../shared/valueSnapshot'
|
|
2
|
+
import type {
|
|
3
|
+
TableQueryOperator,
|
|
4
|
+
TableQueryParams,
|
|
5
|
+
TableSearchCondition,
|
|
6
|
+
TableSearchModel,
|
|
7
|
+
TableSort,
|
|
8
|
+
TableWhere,
|
|
9
|
+
} from './types'
|
|
10
|
+
|
|
11
|
+
/** 创建与调用方完全断开引用的查询参数快照,避免请求或报表 provider 反向改写状态。 */
|
|
12
|
+
export const createTableQueryParamsSnapshot = (
|
|
13
|
+
params: Readonly<TableQueryParams>
|
|
14
|
+
): TableQueryParams => ({
|
|
15
|
+
page: params.page,
|
|
16
|
+
pageSize: params.pageSize,
|
|
17
|
+
where: params.where.map(({ field, operator, value }) => ({
|
|
18
|
+
field,
|
|
19
|
+
operator,
|
|
20
|
+
value: cloneTableValue(value),
|
|
21
|
+
})),
|
|
22
|
+
...(params.sort?.length
|
|
23
|
+
? {
|
|
24
|
+
sort: params.sort.map(({ field, direction }) => ({ field, direction })),
|
|
25
|
+
}
|
|
26
|
+
: {}),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const normalizeQueryIdentityValue = (
|
|
30
|
+
value: unknown,
|
|
31
|
+
ancestors: WeakSet<object>
|
|
32
|
+
): unknown => {
|
|
33
|
+
if (value === null || typeof value !== 'object') return value
|
|
34
|
+
if (value instanceof Date) return value.toISOString()
|
|
35
|
+
if (ancestors.has(value)) {
|
|
36
|
+
throw new Error('[TableComponent] Query values must not contain cycles.')
|
|
37
|
+
}
|
|
38
|
+
ancestors.add(value)
|
|
39
|
+
const normalized = Array.isArray(value)
|
|
40
|
+
? value.map((item) => normalizeQueryIdentityValue(item, ancestors))
|
|
41
|
+
: Object.fromEntries(
|
|
42
|
+
Object.keys(value)
|
|
43
|
+
.sort()
|
|
44
|
+
.map((key) => [
|
|
45
|
+
key,
|
|
46
|
+
normalizeQueryIdentityValue(
|
|
47
|
+
Reflect.get(value as object, key),
|
|
48
|
+
ancestors
|
|
49
|
+
),
|
|
50
|
+
])
|
|
51
|
+
)
|
|
52
|
+
ancestors.delete(value)
|
|
53
|
+
return normalized
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 生成不包含分页位置的稳定结果集身份。相同筛选/排序即使对象键顺序不同也得到同一值。
|
|
58
|
+
*/
|
|
59
|
+
export const createTableQueryIdentity = (params: Readonly<TableQueryParams>) =>
|
|
60
|
+
JSON.stringify(
|
|
61
|
+
normalizeQueryIdentityValue(
|
|
62
|
+
{ where: params.where, sort: params.sort ?? [] },
|
|
63
|
+
new WeakSet()
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
export const resolveTableSearchConditionLabels = (
|
|
68
|
+
conditions: readonly TableSearchCondition[],
|
|
69
|
+
columnLabels: Readonly<Record<string, string>> = {}
|
|
70
|
+
): TableSearchCondition[] =>
|
|
71
|
+
conditions.map((condition) => ({
|
|
72
|
+
...condition,
|
|
73
|
+
label:
|
|
74
|
+
condition.label?.trim() || columnLabels[condition.key] || condition.key,
|
|
75
|
+
}))
|
|
76
|
+
|
|
77
|
+
const isEmptySearchValue = (value: unknown): boolean =>
|
|
78
|
+
value === undefined ||
|
|
79
|
+
value === null ||
|
|
80
|
+
value === '' ||
|
|
81
|
+
(Array.isArray(value) && value.length === 0)
|
|
82
|
+
|
|
83
|
+
const isConditionSearchValue = (
|
|
84
|
+
value: unknown
|
|
85
|
+
): value is { operator: TableQueryOperator; value: unknown } =>
|
|
86
|
+
Boolean(
|
|
87
|
+
value &&
|
|
88
|
+
typeof value === 'object' &&
|
|
89
|
+
'operator' in value &&
|
|
90
|
+
'value' in value
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
const getDefaultOperator = (
|
|
94
|
+
condition: TableSearchCondition,
|
|
95
|
+
value: unknown
|
|
96
|
+
): TableQueryOperator => {
|
|
97
|
+
if (condition.operator) return condition.operator
|
|
98
|
+
if (condition.type === 'dateRange') return 'between'
|
|
99
|
+
if (
|
|
100
|
+
condition.type === 'multiSelect' ||
|
|
101
|
+
(condition.type === 'remoteSelect' && condition.remoteMultiple) ||
|
|
102
|
+
Array.isArray(value)
|
|
103
|
+
)
|
|
104
|
+
return 'in'
|
|
105
|
+
return condition.type === 'input' || condition.type === undefined
|
|
106
|
+
? 'include'
|
|
107
|
+
: 'eq'
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const normalizeTableWhereResult = (
|
|
111
|
+
result: TableWhere | TableWhere[] | null | undefined
|
|
112
|
+
): TableWhere[] => {
|
|
113
|
+
if (!result) return []
|
|
114
|
+
return Array.isArray(result) ? result : [result]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const appendDateRangeBoundary = (
|
|
118
|
+
value: unknown,
|
|
119
|
+
boundary: TableSearchCondition['dateRangeBoundary']
|
|
120
|
+
) => {
|
|
121
|
+
if (boundary !== 'day' || !Array.isArray(value) || value.length !== 2) {
|
|
122
|
+
return value
|
|
123
|
+
}
|
|
124
|
+
const [start, end] = value
|
|
125
|
+
return [
|
|
126
|
+
typeof start === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(start)
|
|
127
|
+
? `${start} 00:00:00`
|
|
128
|
+
: start,
|
|
129
|
+
typeof end === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(end)
|
|
130
|
+
? `${end} 23:59:59`
|
|
131
|
+
: end,
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** 将筛选模型编译为后端无关的 where 数组,空值不会生成条件。 */
|
|
136
|
+
const buildTableWhere = (
|
|
137
|
+
conditions: TableSearchCondition[],
|
|
138
|
+
model: TableSearchModel
|
|
139
|
+
): TableWhere[] =>
|
|
140
|
+
conditions.flatMap((condition) => {
|
|
141
|
+
const modelValue = model[condition.key]
|
|
142
|
+
const rawValue = isConditionSearchValue(modelValue)
|
|
143
|
+
? modelValue.value
|
|
144
|
+
: modelValue
|
|
145
|
+
const normalizedValue =
|
|
146
|
+
typeof rawValue === 'string' ? rawValue.trim() : rawValue
|
|
147
|
+
if (isEmptySearchValue(normalizedValue)) return []
|
|
148
|
+
const value = appendDateRangeBoundary(
|
|
149
|
+
normalizedValue,
|
|
150
|
+
condition.dateRangeBoundary
|
|
151
|
+
)
|
|
152
|
+
if (condition.toWhere) {
|
|
153
|
+
// 自定义转换允许返回单条、多条或空结果,这里统一成 flatMap 所需数组。
|
|
154
|
+
return normalizeTableWhereResult(condition.toWhere(value, condition))
|
|
155
|
+
}
|
|
156
|
+
return [
|
|
157
|
+
{
|
|
158
|
+
field: condition.key,
|
|
159
|
+
operator: isConditionSearchValue(modelValue)
|
|
160
|
+
? modelValue.operator
|
|
161
|
+
: getDefaultOperator(condition, value),
|
|
162
|
+
value,
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
export const buildTableQueryParams = (
|
|
168
|
+
page: number,
|
|
169
|
+
pageSize: number,
|
|
170
|
+
conditions: TableSearchCondition[],
|
|
171
|
+
model: TableSearchModel,
|
|
172
|
+
sort: readonly TableSort[] = []
|
|
173
|
+
): TableQueryParams => {
|
|
174
|
+
const params: TableQueryParams = {
|
|
175
|
+
page,
|
|
176
|
+
pageSize,
|
|
177
|
+
where: buildTableWhere(conditions, model),
|
|
178
|
+
}
|
|
179
|
+
if (sort.length) params.sort = [...sort]
|
|
180
|
+
return params
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const createSearchModel = (
|
|
184
|
+
conditions: readonly TableSearchCondition[]
|
|
185
|
+
): TableSearchModel =>
|
|
186
|
+
Object.fromEntries(
|
|
187
|
+
conditions.map((condition) => [
|
|
188
|
+
condition.key,
|
|
189
|
+
condition.type === 'condition'
|
|
190
|
+
? {
|
|
191
|
+
operator:
|
|
192
|
+
condition.operator ??
|
|
193
|
+
condition.operatorOptions?.[0]?.value ??
|
|
194
|
+
'include',
|
|
195
|
+
value: Array.isArray(condition.defaultValue)
|
|
196
|
+
? [...condition.defaultValue]
|
|
197
|
+
: condition.defaultValue,
|
|
198
|
+
}
|
|
199
|
+
: Array.isArray(condition.defaultValue)
|
|
200
|
+
? [...condition.defaultValue]
|
|
201
|
+
: condition.defaultValue,
|
|
202
|
+
])
|
|
203
|
+
)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { TableRow } from '../shared/types'
|
|
2
|
+
import type {
|
|
3
|
+
TableQuery,
|
|
4
|
+
TableQueryContext,
|
|
5
|
+
TableQueryParams,
|
|
6
|
+
TableQueryResult,
|
|
7
|
+
} from './types'
|
|
8
|
+
|
|
9
|
+
export type RemoteQueryStatus = 'applied' | 'aborted' | 'stale'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 一次远程查询的可观察结果。
|
|
13
|
+
*
|
|
14
|
+
* `stale` 表示请求虽然已经返回,但在它之后又发起了更新的请求,因此调用方不得
|
|
15
|
+
* 再用该结果覆盖表格;`aborted` 表示请求被主动取消。这两个状态都不是业务异常。
|
|
16
|
+
*/
|
|
17
|
+
export interface RemoteQueryOutcome<T extends TableRow = TableRow> {
|
|
18
|
+
/** 请求应用结果;stale 和 aborted 都不应覆盖当前表格数据。 */
|
|
19
|
+
status: RemoteQueryStatus
|
|
20
|
+
/** 控制器为本次查询分配的递增请求序号。 */
|
|
21
|
+
requestId: number
|
|
22
|
+
/** status 为 applied 时返回的业务查询结果。 */
|
|
23
|
+
result?: TableQueryResult<T>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface RemoteQueryRunnerOptions {
|
|
27
|
+
/** 当前表格稳定标识,会传入每次查询的上下文。 */
|
|
28
|
+
tableKey: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const normalizeResult = <T extends TableRow>(
|
|
32
|
+
value: TableQueryResult<T> | { data: TableQueryResult<T> }
|
|
33
|
+
): TableQueryResult<T> => ('data' in value ? value.data : value)
|
|
34
|
+
|
|
35
|
+
const isAbortError = (error: unknown) =>
|
|
36
|
+
error instanceof DOMException
|
|
37
|
+
? error.name === 'AbortError'
|
|
38
|
+
: error instanceof Error && error.name === 'AbortError'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 框架无关的远程查询执行器,采用“最后一次请求生效”策略。
|
|
42
|
+
*
|
|
43
|
+
* 每次 `run()` 都会取消上一次请求,并通过递增的 requestId 再做一层竞态保护。
|
|
44
|
+
* 即使业务请求库没有正确响应 AbortSignal,迟到结果也只会返回 `stale`,不会污染
|
|
45
|
+
* 当前数据。所有 React 查询入口共同复用这里的并发语义。
|
|
46
|
+
*/
|
|
47
|
+
class RemoteQueryRunner<T extends TableRow = TableRow> {
|
|
48
|
+
private requestId = 0
|
|
49
|
+
private controller: AbortController | null = null
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly query: TableQuery<T>,
|
|
53
|
+
private readonly options: RemoteQueryRunnerOptions
|
|
54
|
+
) {}
|
|
55
|
+
|
|
56
|
+
get currentRequestId() {
|
|
57
|
+
return this.requestId
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async run(params: TableQueryParams): Promise<RemoteQueryOutcome<T>> {
|
|
61
|
+
// AbortSignal 负责尽快释放网络资源,requestId 负责兜底拦截无法真正取消的请求。
|
|
62
|
+
this.controller?.abort()
|
|
63
|
+
const controller = new AbortController()
|
|
64
|
+
const requestId = ++this.requestId
|
|
65
|
+
this.controller = controller
|
|
66
|
+
|
|
67
|
+
const context: TableQueryContext = {
|
|
68
|
+
signal: controller.signal,
|
|
69
|
+
requestId,
|
|
70
|
+
tableKey: this.options.tableKey,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const result = normalizeResult(await this.query(params, context))
|
|
75
|
+
if (requestId !== this.requestId) return { status: 'stale', requestId }
|
|
76
|
+
return { status: 'applied', requestId, result }
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (controller.signal.aborted || isAbortError(error)) {
|
|
79
|
+
return { status: 'aborted', requestId }
|
|
80
|
+
}
|
|
81
|
+
if (requestId !== this.requestId) return { status: 'stale', requestId }
|
|
82
|
+
throw error
|
|
83
|
+
} finally {
|
|
84
|
+
if (this.controller === controller) this.controller = null
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 取消当前请求并推进请求世代,同时保留 provider 与递增 requestId。 */
|
|
89
|
+
cancel() {
|
|
90
|
+
this.controller?.abort()
|
|
91
|
+
this.controller = null
|
|
92
|
+
this.requestId += 1
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const createRemoteQueryRunner = <T extends TableRow>(
|
|
97
|
+
query: TableQuery<T>,
|
|
98
|
+
options: RemoteQueryRunnerOptions
|
|
99
|
+
) => new RemoteQueryRunner(query, options)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TABLE_SEARCH_DEFAULTS } from './constants'
|
|
2
|
+
|
|
3
|
+
interface TableSearchEnterEvent {
|
|
4
|
+
defaultPrevented?: boolean
|
|
5
|
+
isComposing?: boolean
|
|
6
|
+
keyCode?: number
|
|
7
|
+
target?: unknown
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const SEARCH_ENTER_EXCLUSION =
|
|
11
|
+
".el-select, .el-date-editor, [role='combobox'], [role='listbox']"
|
|
12
|
+
|
|
13
|
+
export const shouldSubmitTableSearchOnEnter = (
|
|
14
|
+
event: TableSearchEnterEvent
|
|
15
|
+
) => {
|
|
16
|
+
if (
|
|
17
|
+
event.defaultPrevented ||
|
|
18
|
+
event.isComposing ||
|
|
19
|
+
event.keyCode === TABLE_SEARCH_DEFAULTS.imeProcessKeyCode
|
|
20
|
+
) {
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
const target = event.target
|
|
24
|
+
if (!target || (typeof target !== 'object' && typeof target !== 'function')) {
|
|
25
|
+
return true
|
|
26
|
+
}
|
|
27
|
+
const isContentEditable = Reflect.get(target, 'isContentEditable')
|
|
28
|
+
const tagName = Reflect.get(target, 'tagName')
|
|
29
|
+
if (
|
|
30
|
+
isContentEditable === true ||
|
|
31
|
+
(typeof tagName === 'string' && tagName.toUpperCase() === 'TEXTAREA')
|
|
32
|
+
) {
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
const closest = Reflect.get(target, 'closest')
|
|
36
|
+
return (
|
|
37
|
+
typeof closest !== 'function' ||
|
|
38
|
+
!Reflect.apply(closest, target, [SEARCH_ENTER_EXCLUSION])
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const isTableSearchContentOverflowing = (
|
|
43
|
+
scrollHeight: number,
|
|
44
|
+
clientHeight: number,
|
|
45
|
+
tolerance = TABLE_SEARCH_DEFAULTS.contentOverflowTolerance
|
|
46
|
+
) => scrollHeight > clientHeight + tolerance
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { TableOption, TableRow } from '../shared/types'
|
|
2
|
+
|
|
3
|
+
/** 搜索表单的动态值集合;读取后必须按条件类型收窄。 */
|
|
4
|
+
export type TableSearchModel = Record<string, unknown>
|
|
5
|
+
|
|
6
|
+
export type TableQueryOperator =
|
|
7
|
+
| 'eq'
|
|
8
|
+
| 'ne'
|
|
9
|
+
| 'include'
|
|
10
|
+
| 'notInclude'
|
|
11
|
+
| 'startsWith'
|
|
12
|
+
| 'endsWith'
|
|
13
|
+
| 'contains'
|
|
14
|
+
| 'gt'
|
|
15
|
+
| 'gte'
|
|
16
|
+
| 'lt'
|
|
17
|
+
| 'lte'
|
|
18
|
+
| 'in'
|
|
19
|
+
| 'notIn'
|
|
20
|
+
| 'between'
|
|
21
|
+
|
|
22
|
+
/** 日期范围提交给后端时是否补齐自然日的起止时间。 */
|
|
23
|
+
export type TableDateRangeBoundary = 'raw' | 'day'
|
|
24
|
+
|
|
25
|
+
/** 点击重置后只清空条件,或清空并立即重新查询。 */
|
|
26
|
+
export type TableSearchResetBehavior = 'clear' | 'query'
|
|
27
|
+
|
|
28
|
+
export interface TableSearchCondition {
|
|
29
|
+
/** 搜索字段稳定 key,默认同时作为提交给后端的 field。 */
|
|
30
|
+
key: string
|
|
31
|
+
/** 未填写时先继承同 key 表格列标题,仍不存在则回退为 key。 */
|
|
32
|
+
label?: string
|
|
33
|
+
/** 搜索控件类型,默认 input;custom 需要由框架适配层的 renderer 或插槽提供 UI。 */
|
|
34
|
+
type?:
|
|
35
|
+
| 'input'
|
|
36
|
+
| 'condition'
|
|
37
|
+
| 'select'
|
|
38
|
+
| 'multiSelect'
|
|
39
|
+
| 'remoteSelect'
|
|
40
|
+
| 'date'
|
|
41
|
+
| 'dateRange'
|
|
42
|
+
| 'datetime'
|
|
43
|
+
| 'custom'
|
|
44
|
+
/** 默认查询运算符;不同控件类型会在未配置时使用各自安全默认值。 */
|
|
45
|
+
operator?: TableQueryOperator
|
|
46
|
+
/** condition 控件允许用户切换的运算符及显示文案。 */
|
|
47
|
+
operatorOptions?: Array<{
|
|
48
|
+
/** 运算符下拉项文案。 */
|
|
49
|
+
label: string
|
|
50
|
+
/** 提交给后端的稳定运算符值。 */
|
|
51
|
+
value: TableQueryOperator
|
|
52
|
+
}>
|
|
53
|
+
/** 输入控件的占位文案。 */
|
|
54
|
+
placeholder?: string
|
|
55
|
+
/** 是否允许清空当前条件值,默认 true。 */
|
|
56
|
+
clearable?: boolean
|
|
57
|
+
/** select/multiSelect 使用的静态候选项。 */
|
|
58
|
+
options?: TableOption[]
|
|
59
|
+
/** remoteSelect 的可取消远程选项加载器。 */
|
|
60
|
+
loadOptions?: TableSearchOptionLoader
|
|
61
|
+
/** remoteSelect 是否允许多选,默认 false。 */
|
|
62
|
+
remoteMultiple?: boolean
|
|
63
|
+
/** 搜索模型首次创建时写入的默认值。 */
|
|
64
|
+
defaultValue?: unknown
|
|
65
|
+
/** dateRange 专用;day 会生成 00:00:00 到 23:59:59,默认 raw。 */
|
|
66
|
+
dateRangeBoundary?: TableDateRangeBoundary
|
|
67
|
+
/** 自定义 UI 或特殊后端条件的纯函数转换出口,不能在这里操作 React 状态。 */
|
|
68
|
+
toWhere?: (
|
|
69
|
+
value: unknown,
|
|
70
|
+
condition: TableSearchCondition
|
|
71
|
+
) => TableWhere | TableWhere[] | null | undefined
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface TableSearchOptionRequest {
|
|
75
|
+
/** 用户当前输入的远程搜索文本。 */
|
|
76
|
+
query: string
|
|
77
|
+
/** 新请求或组件销毁时会中止的信号。 */
|
|
78
|
+
signal: AbortSignal
|
|
79
|
+
/** 发起搜索的表格稳定 key。 */
|
|
80
|
+
tableKey: string
|
|
81
|
+
/** 发起搜索的条件稳定 key。 */
|
|
82
|
+
conditionKey: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type TableSearchOptionLoader = (
|
|
86
|
+
request: TableSearchOptionRequest
|
|
87
|
+
) => Promise<readonly TableOption[]>
|
|
88
|
+
|
|
89
|
+
export interface TableWhere<TValue = unknown> {
|
|
90
|
+
/** 后端查询字段名。 */
|
|
91
|
+
field: string
|
|
92
|
+
/** 后端与前端共同约定的查询运算符。 */
|
|
93
|
+
operator: TableQueryOperator
|
|
94
|
+
/** 未经字符串化的查询值。 */
|
|
95
|
+
value: TValue
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface TableSort {
|
|
99
|
+
/** 后端排序字段名。 */
|
|
100
|
+
field: string
|
|
101
|
+
/** 排序方向。 */
|
|
102
|
+
direction: 'asc' | 'desc'
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 远程查询的稳定请求结构,可由 React 页面直接提交给业务 API。 */
|
|
106
|
+
export interface TableQueryParams {
|
|
107
|
+
/** 从 1 开始的当前页码。 */
|
|
108
|
+
page: number
|
|
109
|
+
/** 每页请求条数。 */
|
|
110
|
+
pageSize: number
|
|
111
|
+
/** 由搜索模型编译出的结构化查询条件。 */
|
|
112
|
+
where: TableWhere[]
|
|
113
|
+
/** 远程排序优先级列表;数组顺序表示多列排序优先级。 */
|
|
114
|
+
sort?: TableSort[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface TableSearchSubmitContext {
|
|
118
|
+
/** 当前只读搜索表单模型。 */
|
|
119
|
+
model: Readonly<TableSearchModel>
|
|
120
|
+
/** 即将提交的完整查询参数。 */
|
|
121
|
+
params: Readonly<TableQueryParams>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** 返回 false 取消内置查询,返回 params 改写请求,void 继续使用原请求。 */
|
|
125
|
+
export type TableSearchSubmitInterceptor = (
|
|
126
|
+
context: TableSearchSubmitContext
|
|
127
|
+
) => false | void | TableQueryParams | Promise<false | void | TableQueryParams>
|
|
128
|
+
|
|
129
|
+
export interface TableQueryResult<T extends TableRow = TableRow> {
|
|
130
|
+
/** 当前请求返回的业务行列表。 */
|
|
131
|
+
list: T[]
|
|
132
|
+
/** 当前筛选条件下的后端总条数。 */
|
|
133
|
+
total: number
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** engine 提供给查询函数的实例身份与并发控制上下文。 */
|
|
137
|
+
export interface TableQueryContext {
|
|
138
|
+
/** 新查询或组件销毁时会中止的信号。 */
|
|
139
|
+
signal: AbortSignal
|
|
140
|
+
/** 当前实例单调递增的请求编号,用于识别晚到响应。 */
|
|
141
|
+
requestId: number
|
|
142
|
+
/** 发起查询的表格稳定 key。 */
|
|
143
|
+
tableKey: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type TableQuery<T extends TableRow = TableRow> = (
|
|
147
|
+
params: TableQueryParams,
|
|
148
|
+
context: TableQueryContext
|
|
149
|
+
) => Promise<
|
|
150
|
+
| TableQueryResult<T>
|
|
151
|
+
| {
|
|
152
|
+
/** 兼容常见 HTTP 客户端响应包装的查询结果。 */
|
|
153
|
+
data: TableQueryResult<T>
|
|
154
|
+
}
|
|
155
|
+
>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TableRow } from '../shared/types'
|
|
2
|
+
import type { RowKeyResolver } from '../table/editing'
|
|
3
|
+
import type { TableSelectionOptions } from './selection'
|
|
4
|
+
|
|
5
|
+
/** 将公开选择配置收敛为纯 JS Selection 状态机的输入。 */
|
|
6
|
+
export const buildTableSelectionOptions = <T extends TableRow>(
|
|
7
|
+
rowKey: RowKeyResolver<T>,
|
|
8
|
+
options: Pick<TableSelectionOptions<T>, 'multiple' | 'isRowSelectable'> = {}
|
|
9
|
+
): TableSelectionOptions<T> => ({
|
|
10
|
+
rowKey,
|
|
11
|
+
multiple: options.multiple,
|
|
12
|
+
isRowSelectable: options.isRowSelectable,
|
|
13
|
+
})
|