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,192 @@
|
|
|
1
|
+
import { fnDefineLocaleMessages } from '@/locale'
|
|
2
|
+
|
|
3
|
+
/** 脚手架功能演示页面共用的中英文文案。 */
|
|
4
|
+
export const objShowcaseMessages = fnDefineLocaleMessages({
|
|
5
|
+
'en-US': {
|
|
6
|
+
advancedTableDescription:
|
|
7
|
+
'The optional advanced table provides built-in querying, pagination, selection, editing, preferences, and toolbar actions.',
|
|
8
|
+
advancedTableTitle: 'Advanced AppTable',
|
|
9
|
+
advancedTableUnavailable:
|
|
10
|
+
'The advancedTable capability is not installed, or this is a production build without the demo entry.',
|
|
11
|
+
commonActions: 'Actions',
|
|
12
|
+
commonAdd: 'Add record',
|
|
13
|
+
commonAll: 'All statuses',
|
|
14
|
+
commonDelete: 'Delete',
|
|
15
|
+
commonEdit: 'Edit',
|
|
16
|
+
commonName: 'Name',
|
|
17
|
+
commonNext: 'Next',
|
|
18
|
+
commonOwner: 'Owner',
|
|
19
|
+
commonPrevious: 'Previous',
|
|
20
|
+
commonReset: 'Reset demo',
|
|
21
|
+
commonStatus: 'Status',
|
|
22
|
+
commonSubmit: 'Save record',
|
|
23
|
+
feedbackDialogContent:
|
|
24
|
+
'This dialog uses the project-owned overlay, focus management, and action conventions.',
|
|
25
|
+
feedbackDialogTitle: 'Confirm an operation',
|
|
26
|
+
feedbackConfirm: 'Confirm',
|
|
27
|
+
feedbackConfirmed: 'The demonstration operation was confirmed.',
|
|
28
|
+
feedbackDescription:
|
|
29
|
+
'Switch between page states, open a dialog, trigger a toast, and visit the standard error routes.',
|
|
30
|
+
feedbackEmptyDescription:
|
|
31
|
+
'The request succeeded, but the current filters returned no records.',
|
|
32
|
+
feedbackEmptyTitle: 'No matching records',
|
|
33
|
+
feedbackErrorDescription:
|
|
34
|
+
'The simulated request failed. Retry keeps the current page context.',
|
|
35
|
+
feedbackErrorTitle: 'Request failed',
|
|
36
|
+
feedbackLoadingDescription:
|
|
37
|
+
'The first request is loading and no cached content is available yet.',
|
|
38
|
+
feedbackLoadingTitle: 'Loading data',
|
|
39
|
+
feedbackOpenDialog: 'Open dialog',
|
|
40
|
+
feedbackErrorRoutes: 'Standard error pages',
|
|
41
|
+
feedbackShowEmpty: 'Empty state',
|
|
42
|
+
feedbackShowError: 'Error state',
|
|
43
|
+
feedbackShowLoading: 'Loading state',
|
|
44
|
+
feedbackShowToast: 'Show toast',
|
|
45
|
+
feedbackStateTitle: 'Switch the rendered page state',
|
|
46
|
+
feedbackTitle: 'Dialogs and page feedback',
|
|
47
|
+
feedbackToastContent: 'This is a global success toast.',
|
|
48
|
+
filesDescription:
|
|
49
|
+
'Select an image or PDF to exercise validation, upload progress, completion callbacks, and local preview cleanup.',
|
|
50
|
+
filesNoPreview: 'Select a supported file to display its preview here.',
|
|
51
|
+
filesPreviewTitle: 'File preview',
|
|
52
|
+
filesSelect: 'Select an image or PDF',
|
|
53
|
+
filesTitle: 'Upload and preview',
|
|
54
|
+
filesUploadDescription:
|
|
55
|
+
'Demo adapter only keeps the selected File in memory and does not send it to a server.',
|
|
56
|
+
filesUploadTitle: 'File upload',
|
|
57
|
+
formDepartment: 'Department',
|
|
58
|
+
formDepartmentFinance: 'Finance',
|
|
59
|
+
formDepartmentOperations: 'Operations',
|
|
60
|
+
formDepartmentTechnology: 'Technology',
|
|
61
|
+
formDescription:
|
|
62
|
+
'Use real field types, validation, conditional content, reset behavior, dirty tracking, and submit feedback.',
|
|
63
|
+
formEmail: 'Contact email',
|
|
64
|
+
formDirty: 'Unsaved changes',
|
|
65
|
+
formEditorTitle: 'Application configuration',
|
|
66
|
+
formName: 'Application name',
|
|
67
|
+
formNotes: 'Notes',
|
|
68
|
+
formNotSubmitted: 'Submit a valid form to inspect the resulting model.',
|
|
69
|
+
formPristine: 'No changes',
|
|
70
|
+
formQuota: 'User quota',
|
|
71
|
+
formStatus: 'Lifecycle status',
|
|
72
|
+
formSubmit: 'Validate and submit',
|
|
73
|
+
formSubmitted: 'Latest submitted model',
|
|
74
|
+
formTitle: 'PageForm interaction',
|
|
75
|
+
metadataDescription:
|
|
76
|
+
'The demo sources use the same catalog adapters, Query cache, typed hooks, value lookup, and display components as backend data.',
|
|
77
|
+
metadataEnumKeys: 'Enum keys',
|
|
78
|
+
metadataEnumTitle: 'Global enum catalog',
|
|
79
|
+
metadataLookup: 'Label-to-value lookup',
|
|
80
|
+
metadataParameterTitle: 'Typed global parameters',
|
|
81
|
+
metadataRefresh: 'Refresh catalogs',
|
|
82
|
+
metadataTitle: 'Enums and global parameters',
|
|
83
|
+
metadataValues: 'Complete values',
|
|
84
|
+
metadataVersion: 'Catalog version',
|
|
85
|
+
pageEyebrow: 'Scaffold live demo',
|
|
86
|
+
statusActive: 'Active',
|
|
87
|
+
statusDisabled: 'Disabled',
|
|
88
|
+
statusPending: 'Pending',
|
|
89
|
+
tableBulkActivate: 'Activate selected',
|
|
90
|
+
tableCoreDescription:
|
|
91
|
+
'A lightweight CRUD page composed from AppDataTable, AppPageForm, AppDialog, search, selection, and pagination.',
|
|
92
|
+
tableCoreTitle: 'Core CRUD page',
|
|
93
|
+
tableDescription:
|
|
94
|
+
'Operate the lightweight list and the optional advanced grid instead of reading a component inventory.',
|
|
95
|
+
tablePage: 'Page {current} of {total}',
|
|
96
|
+
tableSearchPlaceholder: 'Search name or owner',
|
|
97
|
+
tableSelected: '{count} selected',
|
|
98
|
+
tableTitle: 'Table scenarios',
|
|
99
|
+
},
|
|
100
|
+
'zh-CN': {
|
|
101
|
+
advancedTableDescription:
|
|
102
|
+
'可选高级表格直接提供查询、分页、选择、编辑、偏好和工具栏操作。',
|
|
103
|
+
advancedTableTitle: '高级 AppTable',
|
|
104
|
+
advancedTableUnavailable:
|
|
105
|
+
'当前没有安装 advancedTable 能力,或生产构建未开放开发演示入口。',
|
|
106
|
+
commonActions: '操作',
|
|
107
|
+
commonAdd: '新增记录',
|
|
108
|
+
commonAll: '全部状态',
|
|
109
|
+
commonDelete: '删除',
|
|
110
|
+
commonEdit: '编辑',
|
|
111
|
+
commonName: '名称',
|
|
112
|
+
commonNext: '下一页',
|
|
113
|
+
commonOwner: '负责人',
|
|
114
|
+
commonPrevious: '上一页',
|
|
115
|
+
commonReset: '重置演示',
|
|
116
|
+
commonStatus: '状态',
|
|
117
|
+
commonSubmit: '保存记录',
|
|
118
|
+
feedbackDialogContent:
|
|
119
|
+
'此弹窗实际使用项目源码内的遮罩层、焦点管理和统一操作区规范。',
|
|
120
|
+
feedbackDialogTitle: '确认执行操作',
|
|
121
|
+
feedbackConfirm: '确认执行',
|
|
122
|
+
feedbackConfirmed: '演示操作已确认。',
|
|
123
|
+
feedbackDescription:
|
|
124
|
+
'切换页面状态、打开弹窗、触发 Toast,并直接访问标准错误页面。',
|
|
125
|
+
feedbackEmptyDescription: '请求已经成功,但当前筛选条件没有匹配记录。',
|
|
126
|
+
feedbackEmptyTitle: '暂无匹配记录',
|
|
127
|
+
feedbackErrorDescription: '模拟请求失败;重试不会丢失当前页面上下文。',
|
|
128
|
+
feedbackErrorTitle: '请求失败',
|
|
129
|
+
feedbackLoadingDescription:
|
|
130
|
+
'首次请求正在加载,当前还没有可展示的缓存内容。',
|
|
131
|
+
feedbackLoadingTitle: '正在加载数据',
|
|
132
|
+
feedbackOpenDialog: '打开弹窗',
|
|
133
|
+
feedbackErrorRoutes: '标准错误页面',
|
|
134
|
+
feedbackShowEmpty: '空状态',
|
|
135
|
+
feedbackShowError: '错误状态',
|
|
136
|
+
feedbackShowLoading: '加载状态',
|
|
137
|
+
feedbackShowToast: '触发 Toast',
|
|
138
|
+
feedbackStateTitle: '切换实际渲染的页面状态',
|
|
139
|
+
feedbackTitle: '弹窗与页面反馈',
|
|
140
|
+
feedbackToastContent: '这是一条全局成功提示。',
|
|
141
|
+
filesDescription:
|
|
142
|
+
'选择图片或 PDF,实际体验文件校验、上传进度、成功回调和本地预览资源释放。',
|
|
143
|
+
filesNoPreview: '请选择支持的文件后在这里查看预览。',
|
|
144
|
+
filesPreviewTitle: '文件预览',
|
|
145
|
+
filesSelect: '选择图片或 PDF',
|
|
146
|
+
filesTitle: '上传与预览',
|
|
147
|
+
filesUploadDescription:
|
|
148
|
+
'演示适配器只在内存中保留所选 File,不会把文件发送到任何服务器。',
|
|
149
|
+
filesUploadTitle: '文件上传',
|
|
150
|
+
formDepartment: '所属部门',
|
|
151
|
+
formDepartmentFinance: '财务部',
|
|
152
|
+
formDepartmentOperations: '运营部',
|
|
153
|
+
formDepartmentTechnology: '技术部',
|
|
154
|
+
formDescription:
|
|
155
|
+
'实际体验字段类型、校验、条件内容、重置、脏状态跟踪和提交反馈。',
|
|
156
|
+
formEmail: '联系邮箱',
|
|
157
|
+
formDirty: '存在未保存修改',
|
|
158
|
+
formEditorTitle: '应用配置',
|
|
159
|
+
formName: '应用名称',
|
|
160
|
+
formNotes: '补充说明',
|
|
161
|
+
formNotSubmitted: '提交一份校验通过的表单后,这里会展示最终模型。',
|
|
162
|
+
formPristine: '尚未修改',
|
|
163
|
+
formQuota: '用户配额',
|
|
164
|
+
formStatus: '生命周期状态',
|
|
165
|
+
formSubmit: '校验并提交',
|
|
166
|
+
formSubmitted: '最近提交模型',
|
|
167
|
+
formTitle: 'PageForm 交互',
|
|
168
|
+
metadataDescription:
|
|
169
|
+
'演示数据源与后端数据使用相同的目录适配、Query 缓存、类型 Hook、值反查和展示组件。',
|
|
170
|
+
metadataEnumKeys: '枚举 Key',
|
|
171
|
+
metadataEnumTitle: '全局枚举目录',
|
|
172
|
+
metadataLookup: '文案反查值',
|
|
173
|
+
metadataParameterTitle: '类型安全全局参数',
|
|
174
|
+
metadataRefresh: '刷新目录',
|
|
175
|
+
metadataTitle: '枚举与全局参数',
|
|
176
|
+
metadataValues: '完整 Value 列表',
|
|
177
|
+
metadataVersion: '目录版本',
|
|
178
|
+
pageEyebrow: '脚手架功能实演',
|
|
179
|
+
statusActive: '启用',
|
|
180
|
+
statusDisabled: '停用',
|
|
181
|
+
statusPending: '待审核',
|
|
182
|
+
tableBulkActivate: '批量启用',
|
|
183
|
+
tableCoreDescription:
|
|
184
|
+
'由 AppDataTable、AppPageForm、AppDialog、搜索、选择和分页组合出的轻量 CRUD 页面。',
|
|
185
|
+
tableCoreTitle: '核心 CRUD 页面',
|
|
186
|
+
tableDescription: '直接操作轻量列表和可选高级网格,不再只展示组件名称。',
|
|
187
|
+
tablePage: '第 {current} / {total} 页',
|
|
188
|
+
tableSearchPlaceholder: '搜索名称或负责人',
|
|
189
|
+
tableSelected: '已选择 {count} 项',
|
|
190
|
+
tableTitle: '表格业务场景',
|
|
191
|
+
},
|
|
192
|
+
})
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { FileCapabilityError } from './errors'
|
|
2
|
+
import { fnParseDownloadFileName } from './filename'
|
|
3
|
+
import type {
|
|
4
|
+
IExternalFileDownloadOptions,
|
|
5
|
+
IFileMemoryDownloadOptions,
|
|
6
|
+
IFileTransferProgress,
|
|
7
|
+
} from './types'
|
|
8
|
+
|
|
9
|
+
const nDefaultMaxMemoryBytes = 100 * 1024 * 1024
|
|
10
|
+
|
|
11
|
+
function fnIsErrorContentType(strContentType: string) {
|
|
12
|
+
const strNormalized = strContentType.toLowerCase()
|
|
13
|
+
return (
|
|
14
|
+
strNormalized.includes('application/json') ||
|
|
15
|
+
strNormalized.includes('application/problem+json') ||
|
|
16
|
+
strNormalized.includes('text/html')
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 使用对象 URL 保存 Blob,并在当前事件循环结束后释放资源。 */
|
|
21
|
+
export function fnSaveBlob(objBlob: Blob, strFileName: string) {
|
|
22
|
+
const strObjectUrl = URL.createObjectURL(objBlob)
|
|
23
|
+
const objAnchor = document.createElement('a')
|
|
24
|
+
objAnchor.href = strObjectUrl
|
|
25
|
+
objAnchor.download = strFileName
|
|
26
|
+
objAnchor.rel = 'noopener'
|
|
27
|
+
objAnchor.style.display = 'none'
|
|
28
|
+
document.body.append(objAnchor)
|
|
29
|
+
objAnchor.click()
|
|
30
|
+
objAnchor.remove()
|
|
31
|
+
window.setTimeout(() => URL.revokeObjectURL(strObjectUrl), 0)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 下载适合放入浏览器内存的文件。
|
|
36
|
+
*
|
|
37
|
+
* 大文件必须在请求前选择 `fnRunExternalFileDownload` 或异步导出任务,不能先
|
|
38
|
+
* 创建超大 Blob 再补救。
|
|
39
|
+
*/
|
|
40
|
+
export async function fnDownloadFile(
|
|
41
|
+
objOptions: IFileMemoryDownloadOptions,
|
|
42
|
+
objSignal: AbortSignal = new AbortController().signal,
|
|
43
|
+
fnOnProgress: (objProgress: IFileTransferProgress) => void = () => undefined
|
|
44
|
+
) {
|
|
45
|
+
const objResponse = await objOptions.fnRequest({ objSignal, fnOnProgress })
|
|
46
|
+
const strContentType =
|
|
47
|
+
objResponse.strContentType || objResponse.objBlob.type || ''
|
|
48
|
+
const bIsAttachment = /(?:^|;)\s*attachment(?:;|$)/i.test(
|
|
49
|
+
objResponse.strContentDisposition ?? ''
|
|
50
|
+
)
|
|
51
|
+
if (fnIsErrorContentType(strContentType) && !bIsAttachment) {
|
|
52
|
+
throw new FileCapabilityError({
|
|
53
|
+
bRetriable: true,
|
|
54
|
+
strCode: 'DOWNLOAD_ERROR_CONTENT',
|
|
55
|
+
strMessage: '下载接口返回了错误内容,请稍后重试',
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const nMaxBytes = objOptions.nMaxBytes ?? nDefaultMaxMemoryBytes
|
|
60
|
+
if (objResponse.objBlob.size > nMaxBytes) {
|
|
61
|
+
throw new FileCapabilityError({
|
|
62
|
+
strCode: 'DOWNLOAD_TOO_LARGE_FOR_MEMORY',
|
|
63
|
+
strMessage: '文件过大,请改用大文件下载或异步导出',
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const strFileName = fnParseDownloadFileName(
|
|
68
|
+
objResponse.strContentDisposition,
|
|
69
|
+
objOptions.strFallbackFileName
|
|
70
|
+
)
|
|
71
|
+
fnSaveBlob(objResponse.objBlob, strFileName)
|
|
72
|
+
return strFileName
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 执行不经过 Blob 内存缓存的大文件下载适配器。 */
|
|
76
|
+
export async function fnRunExternalFileDownload(
|
|
77
|
+
objOptions: IExternalFileDownloadOptions,
|
|
78
|
+
objSignal: AbortSignal = new AbortController().signal,
|
|
79
|
+
fnOnProgress: (objProgress: IFileTransferProgress) => void = () => undefined
|
|
80
|
+
) {
|
|
81
|
+
await objOptions.objAdapter.fnDownload({ objSignal, fnOnProgress })
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiError } from '@/api/ApiError'
|
|
2
|
+
import type { IFileCapabilityErrorOptions } from './types'
|
|
3
|
+
|
|
4
|
+
/** 文件上传、下载、预览与任务协调的标准错误。 */
|
|
5
|
+
export class FileCapabilityError extends ApiError {
|
|
6
|
+
constructor(objOptions: IFileCapabilityErrorOptions) {
|
|
7
|
+
super({
|
|
8
|
+
bRetriable: objOptions.bRetriable ?? false,
|
|
9
|
+
strCode: objOptions.strCode,
|
|
10
|
+
strKind: 'client',
|
|
11
|
+
strMessage: objOptions.strMessage,
|
|
12
|
+
})
|
|
13
|
+
this.name = 'FileCapabilityError'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const nMaxFileNameLength = 180
|
|
2
|
+
|
|
3
|
+
function fnDecodeExtendedFileName(strValue: string) {
|
|
4
|
+
const strEncoded = strValue.replace(/^UTF-8''/i, '')
|
|
5
|
+
try {
|
|
6
|
+
return decodeURIComponent(strEncoded)
|
|
7
|
+
} catch {
|
|
8
|
+
return strEncoded
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 清理来自响应头或业务输入的文件名,移除路径、控制字符和平台保留结尾。
|
|
14
|
+
*/
|
|
15
|
+
export function fnSanitizeFileName(
|
|
16
|
+
strFileName: string,
|
|
17
|
+
strFallback = 'download'
|
|
18
|
+
) {
|
|
19
|
+
const strBaseName = strFileName
|
|
20
|
+
.replaceAll('\\', '/')
|
|
21
|
+
.split('/')
|
|
22
|
+
.at(-1)
|
|
23
|
+
?.split('')
|
|
24
|
+
.map((strCharacter) => {
|
|
25
|
+
const nCodePoint = strCharacter.codePointAt(0) ?? 0
|
|
26
|
+
return nCodePoint <= 31 || nCodePoint === 127 ? ' ' : strCharacter
|
|
27
|
+
})
|
|
28
|
+
.join('')
|
|
29
|
+
.replace(/[<>:"|?*]/g, '_')
|
|
30
|
+
.replace(/[. ]+$/g, '')
|
|
31
|
+
.trim()
|
|
32
|
+
if (!strBaseName || strBaseName === '.' || strBaseName === '..') {
|
|
33
|
+
return strFallback
|
|
34
|
+
}
|
|
35
|
+
return Array.from(strBaseName).slice(0, nMaxFileNameLength).join('')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 优先解析 RFC 5987 `filename*`,再回退到普通 `filename`。 */
|
|
39
|
+
export function fnParseDownloadFileName(
|
|
40
|
+
strContentDisposition: string | undefined,
|
|
41
|
+
strFallback = 'download'
|
|
42
|
+
) {
|
|
43
|
+
if (!strContentDisposition) return fnSanitizeFileName(strFallback)
|
|
44
|
+
|
|
45
|
+
const objExtendedMatch = /filename\*\s*=\s*([^;]+)/i.exec(
|
|
46
|
+
strContentDisposition
|
|
47
|
+
)
|
|
48
|
+
if (objExtendedMatch?.[1]) {
|
|
49
|
+
const strValue = objExtendedMatch[1].trim().replace(/^"|"$/g, '')
|
|
50
|
+
return fnSanitizeFileName(
|
|
51
|
+
fnDecodeExtendedFileName(strValue),
|
|
52
|
+
fnSanitizeFileName(strFallback)
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const objBasicMatch = /filename\s*=\s*(?:"([^"]*)"|([^;]*))/i.exec(
|
|
57
|
+
strContentDisposition
|
|
58
|
+
)
|
|
59
|
+
const strValue = (objBasicMatch?.[1] ?? objBasicMatch?.[2])?.trim()
|
|
60
|
+
return fnSanitizeFileName(strValue ?? strFallback, strFallback)
|
|
61
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export {
|
|
2
|
+
fnDownloadFile,
|
|
3
|
+
fnRunExternalFileDownload,
|
|
4
|
+
fnSaveBlob,
|
|
5
|
+
} from './download'
|
|
6
|
+
export { FileCapabilityError } from './errors'
|
|
7
|
+
export { fnParseDownloadFileName, fnSanitizeFileName } from './filename'
|
|
8
|
+
export { useFileTask } from './useFileTask'
|
|
9
|
+
export { useFileUpload } from './useFileUpload'
|
|
10
|
+
export { fnCreateFileAccept, fnValidateFiles } from './validation'
|
|
11
|
+
export type {
|
|
12
|
+
IExternalFileDownloadAdapter,
|
|
13
|
+
IExternalFileDownloadOptions,
|
|
14
|
+
IFileCapabilityErrorOptions,
|
|
15
|
+
IFileDownloadContext,
|
|
16
|
+
IFileDownloadResponse,
|
|
17
|
+
IFileMemoryDownloadOptions,
|
|
18
|
+
IFileTaskAdapter,
|
|
19
|
+
IFileTaskContext,
|
|
20
|
+
IFileTransferProgress,
|
|
21
|
+
IFileUploadContext,
|
|
22
|
+
IFileValidationIssue,
|
|
23
|
+
IFileValidationOptions,
|
|
24
|
+
IFileValidationResult,
|
|
25
|
+
IUseFileTaskOptions,
|
|
26
|
+
IUseFileTaskResult,
|
|
27
|
+
IUseFileUploadOptions,
|
|
28
|
+
IUseFileUploadResult,
|
|
29
|
+
TFileCapabilityErrorCode,
|
|
30
|
+
TFileDownloadRequest,
|
|
31
|
+
TExternalFileDownloadContext,
|
|
32
|
+
TFileTaskPollResult,
|
|
33
|
+
TFileTaskStartResult,
|
|
34
|
+
TFileTaskState,
|
|
35
|
+
TFileUploadRequest,
|
|
36
|
+
TFileUploadState,
|
|
37
|
+
TFileValidationIssueCode,
|
|
38
|
+
} from './types'
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/** 文件校验失败的稳定错误码。 */
|
|
2
|
+
export type TFileValidationIssueCode =
|
|
3
|
+
| 'EMPTY_FILE'
|
|
4
|
+
| 'FILE_TOO_LARGE'
|
|
5
|
+
| 'FILE_TYPE_NOT_ALLOWED'
|
|
6
|
+
| 'TOO_MANY_FILES'
|
|
7
|
+
|
|
8
|
+
/** 文件能力层抛出的稳定错误码。 */
|
|
9
|
+
export type TFileCapabilityErrorCode =
|
|
10
|
+
| 'DOWNLOAD_ERROR_CONTENT'
|
|
11
|
+
| 'DOWNLOAD_TOO_LARGE_FOR_MEMORY'
|
|
12
|
+
| 'INVALID_PREVIEW_URL'
|
|
13
|
+
| 'TASK_POLLING_NOT_CONFIGURED'
|
|
14
|
+
| 'UNSUPPORTED_PREVIEW_TYPE'
|
|
15
|
+
|
|
16
|
+
/** 单个文件校验问题;不得包含文件内容或服务端原始响应。 */
|
|
17
|
+
export interface IFileValidationIssue {
|
|
18
|
+
/** 供界面分支和测试使用的稳定错误码。 */
|
|
19
|
+
strCode: TFileValidationIssueCode
|
|
20
|
+
/** 可直接展示给用户的安全说明。 */
|
|
21
|
+
strMessage: string
|
|
22
|
+
/** 发生问题的文件名;数量限制等集合问题可能不存在。 */
|
|
23
|
+
strFileName?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 浏览器选中文件后的体验校验规则,不能替代后端鉴权、扫描和内容校验。 */
|
|
27
|
+
export interface IFileValidationOptions {
|
|
28
|
+
/** 允许的扩展名,建议包含点号,例如 `.pdf`;比较时忽略大小写。 */
|
|
29
|
+
arrAcceptedExtensions?: readonly string[]
|
|
30
|
+
/** 允许的 MIME,可使用 `image/*`;浏览器声明的 MIME 不能作为安全依据。 */
|
|
31
|
+
arrAcceptedMimeTypes?: readonly string[]
|
|
32
|
+
/** 是否允许零字节文件,默认不允许。 */
|
|
33
|
+
bAllowEmptyFile?: boolean
|
|
34
|
+
/** 单个文件最大字节数;省略表示不在浏览器侧限制。 */
|
|
35
|
+
nMaxBytes?: number
|
|
36
|
+
/** 一次最多选择的文件数量;省略表示不限制。 */
|
|
37
|
+
nMaxFiles?: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 一次文件校验的完整结果。 */
|
|
41
|
+
export interface IFileValidationResult {
|
|
42
|
+
/** 通过浏览器体验校验、可继续提交的文件。 */
|
|
43
|
+
arrAcceptedFiles: readonly File[]
|
|
44
|
+
/** 所有集合级和文件级问题。 */
|
|
45
|
+
arrIssues: readonly IFileValidationIssue[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 上传、下载或后台任务的统一进度。 */
|
|
49
|
+
export interface IFileTransferProgress {
|
|
50
|
+
/** 已处理字节数;后台任务没有字节概念时可省略。 */
|
|
51
|
+
nLoadedBytes?: number
|
|
52
|
+
/** 总字节数;服务端未提供时可省略。 */
|
|
53
|
+
nTotalBytes?: number
|
|
54
|
+
/** 0 至 100 的显示百分比;无法计算时可省略。 */
|
|
55
|
+
nPercent?: number
|
|
56
|
+
/** 业务适配器提供的安全阶段说明,例如“正在校验”。 */
|
|
57
|
+
strMessage?: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 上传适配器接收的运行上下文。 */
|
|
61
|
+
export interface IFileUploadContext {
|
|
62
|
+
/** 已通过浏览器体验校验的文件。 */
|
|
63
|
+
arrFiles: readonly File[]
|
|
64
|
+
/** 取消信号,必须透传给 Swagger 生成客户端的 Axios 配置。 */
|
|
65
|
+
objSignal: AbortSignal
|
|
66
|
+
/** 将 Axios 上传进度转换为统一进度后调用。 */
|
|
67
|
+
fnOnProgress: (objProgress: IFileTransferProgress) => void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 由业务层使用 Swagger 生成客户端实现的上传函数。 */
|
|
71
|
+
export type TFileUploadRequest<TResult> = (
|
|
72
|
+
objContext: IFileUploadContext
|
|
73
|
+
) => Promise<TResult>
|
|
74
|
+
|
|
75
|
+
/** 上传钩子的配置。 */
|
|
76
|
+
export interface IUseFileUploadOptions<TResult> {
|
|
77
|
+
/** 实际上传函数;文件能力层不会自行拼接地址或直接请求后端。 */
|
|
78
|
+
fnUpload: TFileUploadRequest<TResult>
|
|
79
|
+
/** 浏览器体验校验规则。 */
|
|
80
|
+
objValidation?: IFileValidationOptions
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** 上传过程的互斥状态。 */
|
|
84
|
+
export type TFileUploadState<TResult> =
|
|
85
|
+
| {
|
|
86
|
+
/** 尚未选择或上传文件。 */
|
|
87
|
+
strStatus: 'idle'
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
/** 上传请求正在执行。 */
|
|
91
|
+
strStatus: 'uploading'
|
|
92
|
+
/** 当前上传的文件。 */
|
|
93
|
+
arrFiles: readonly File[]
|
|
94
|
+
/** 最近一次上传进度。 */
|
|
95
|
+
objProgress: IFileTransferProgress
|
|
96
|
+
}
|
|
97
|
+
| {
|
|
98
|
+
/** 上传已经成功完成。 */
|
|
99
|
+
strStatus: 'success'
|
|
100
|
+
/** 已完成上传的文件。 */
|
|
101
|
+
arrFiles: readonly File[]
|
|
102
|
+
/** 业务上传适配器返回的结果。 */
|
|
103
|
+
objResult: TResult
|
|
104
|
+
}
|
|
105
|
+
| {
|
|
106
|
+
/** 浏览器体验校验或上传请求失败。 */
|
|
107
|
+
strStatus: 'error'
|
|
108
|
+
/** 本次尝试选择的文件。 */
|
|
109
|
+
arrFiles: readonly File[]
|
|
110
|
+
/** 浏览器体验校验问题;服务端失败时为空数组。 */
|
|
111
|
+
arrIssues: readonly IFileValidationIssue[]
|
|
112
|
+
/** 可安全展示或上报的标准错误。 */
|
|
113
|
+
objError: Error
|
|
114
|
+
}
|
|
115
|
+
| {
|
|
116
|
+
/** 用户取消了上传请求。 */
|
|
117
|
+
strStatus: 'canceled'
|
|
118
|
+
/** 被取消上传的文件。 */
|
|
119
|
+
arrFiles: readonly File[]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** 上传钩子返回的命令与单一状态快照。 */
|
|
123
|
+
export interface IUseFileUploadResult<TResult> {
|
|
124
|
+
/** 取消当前上传;完成后调用没有副作用。 */
|
|
125
|
+
fnCancel: () => void
|
|
126
|
+
/** 使用最近一次文件重新上传;没有历史文件时保持空闲。 */
|
|
127
|
+
fnRetry: () => Promise<TResult | undefined>
|
|
128
|
+
/** 校验并上传指定文件;校验不通过时不会调用后端。 */
|
|
129
|
+
fnUpload: (arrFiles: readonly File[]) => Promise<TResult | undefined>
|
|
130
|
+
/** 当前互斥状态,避免多个布尔值组合出非法状态。 */
|
|
131
|
+
objState: TFileUploadState<TResult>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** 下载适配器接收的运行上下文。 */
|
|
135
|
+
export interface IFileDownloadContext {
|
|
136
|
+
/** 取消信号,必须透传给 Swagger 生成客户端。 */
|
|
137
|
+
objSignal: AbortSignal
|
|
138
|
+
/** 将 Axios 下载进度转换为统一进度后调用。 */
|
|
139
|
+
fnOnProgress: (objProgress: IFileTransferProgress) => void
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** 由生成客户端适配后的内存下载响应。 */
|
|
143
|
+
export interface IFileDownloadResponse {
|
|
144
|
+
/** Axios 使用 `responseType: 'blob'` 返回的文件内容。 */
|
|
145
|
+
objBlob: Blob
|
|
146
|
+
/** 原始 Content-Disposition;仅用于受控文件名解析,不得直接写入 DOM。 */
|
|
147
|
+
strContentDisposition?: string
|
|
148
|
+
/** 原始 Content-Type;仅用于响应分类,不能作为内容安全证明。 */
|
|
149
|
+
strContentType?: string
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** 由业务层使用 Swagger 生成客户端实现的下载请求。 */
|
|
153
|
+
export type TFileDownloadRequest = (
|
|
154
|
+
objContext: IFileDownloadContext
|
|
155
|
+
) => Promise<IFileDownloadResponse>
|
|
156
|
+
|
|
157
|
+
/** 适合中小文件的 Blob 内存下载配置。 */
|
|
158
|
+
export interface IFileMemoryDownloadOptions {
|
|
159
|
+
/** 实际下载请求。 */
|
|
160
|
+
fnRequest: TFileDownloadRequest
|
|
161
|
+
/** Blob 允许占用的最大字节数,默认 100 MiB。 */
|
|
162
|
+
nMaxBytes?: number
|
|
163
|
+
/** 响应未提供合法文件名时使用的名称。 */
|
|
164
|
+
strFallbackFileName?: string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** 大文件、签名 URL 或原生流式保存适配器的运行上下文。 */
|
|
168
|
+
export type TExternalFileDownloadContext = IFileDownloadContext
|
|
169
|
+
|
|
170
|
+
/** 大文件下载适配器;基础层不假定具体对象存储或浏览器流方案。 */
|
|
171
|
+
export interface IExternalFileDownloadAdapter {
|
|
172
|
+
/** 启动外部下载,并负责目标 URL 信任校验、凭据策略和资源释放。 */
|
|
173
|
+
fnDownload: (objContext: TExternalFileDownloadContext) => Promise<void>
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** 外部下载执行配置。 */
|
|
177
|
+
export interface IExternalFileDownloadOptions {
|
|
178
|
+
/** 业务或基础设施层提供的大文件下载适配器。 */
|
|
179
|
+
objAdapter: IExternalFileDownloadAdapter
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** 文件任务适配器接收的运行上下文。 */
|
|
183
|
+
export interface IFileTaskContext {
|
|
184
|
+
/** 取消信号,必须透传给启动和轮询请求。 */
|
|
185
|
+
objSignal: AbortSignal
|
|
186
|
+
/** 同步转换或服务端任务进度回调。 */
|
|
187
|
+
fnOnProgress: (objProgress: IFileTransferProgress) => void
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** 文件任务启动后立即完成或进入后台队列。 */
|
|
191
|
+
export type TFileTaskStartResult<TResult> =
|
|
192
|
+
| {
|
|
193
|
+
/** 请求内已经完成,无需轮询。 */
|
|
194
|
+
strMode: 'completed'
|
|
195
|
+
/** 同步任务结果。 */
|
|
196
|
+
objResult: TResult
|
|
197
|
+
}
|
|
198
|
+
| {
|
|
199
|
+
/** 服务端已创建后台任务。 */
|
|
200
|
+
strMode: 'background'
|
|
201
|
+
/** 服务端任务稳定标识。 */
|
|
202
|
+
strTaskId: string
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 后台文件任务单次轮询结果。 */
|
|
206
|
+
export type TFileTaskPollResult<TResult> =
|
|
207
|
+
| {
|
|
208
|
+
/** 后台任务仍在排队或执行。 */
|
|
209
|
+
strStatus: 'queued' | 'running'
|
|
210
|
+
/** 服务端最近一次返回的任务进度。 */
|
|
211
|
+
objProgress?: IFileTransferProgress
|
|
212
|
+
}
|
|
213
|
+
| {
|
|
214
|
+
/** 后台任务成功完成。 */
|
|
215
|
+
strStatus: 'success'
|
|
216
|
+
/** 后台任务结果。 */
|
|
217
|
+
objResult: TResult
|
|
218
|
+
}
|
|
219
|
+
| {
|
|
220
|
+
/** 后台任务以业务失败结束。 */
|
|
221
|
+
strStatus: 'error'
|
|
222
|
+
/** 适配后的安全错误。 */
|
|
223
|
+
objError: Error
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** 同步或异步导入导出任务的业务适配器。 */
|
|
227
|
+
export interface IFileTaskAdapter<TInput, TResult> {
|
|
228
|
+
/** 启动任务;闭包中可使用生成客户端提交文件或导出条件。 */
|
|
229
|
+
fnStart: (
|
|
230
|
+
objInput: TInput,
|
|
231
|
+
objContext: IFileTaskContext
|
|
232
|
+
) => Promise<TFileTaskStartResult<TResult>>
|
|
233
|
+
/** 查询后台任务;仅当 `fnStart` 返回 background 时需要。 */
|
|
234
|
+
fnPoll?: (
|
|
235
|
+
strTaskId: string,
|
|
236
|
+
objContext: IFileTaskContext
|
|
237
|
+
) => Promise<TFileTaskPollResult<TResult>>
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** 文件任务钩子的配置。 */
|
|
241
|
+
export interface IUseFileTaskOptions<TInput, TResult> {
|
|
242
|
+
/** 同步或异步任务适配器。 */
|
|
243
|
+
objAdapter: IFileTaskAdapter<TInput, TResult>
|
|
244
|
+
/** 后台任务轮询间隔,默认 1500ms,最小 250ms。 */
|
|
245
|
+
nPollIntervalMs?: number
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** 同步/异步文件任务的互斥状态。 */
|
|
249
|
+
export type TFileTaskState<TResult> =
|
|
250
|
+
| {
|
|
251
|
+
/** 尚未启动任务。 */
|
|
252
|
+
strStatus: 'idle'
|
|
253
|
+
}
|
|
254
|
+
| {
|
|
255
|
+
/** 任务正在启动、排队或执行。 */
|
|
256
|
+
strStatus: 'starting' | 'queued' | 'running'
|
|
257
|
+
/** 最近一次任务进度。 */
|
|
258
|
+
objProgress: IFileTransferProgress
|
|
259
|
+
/** 后台任务标识;同步启动阶段不存在。 */
|
|
260
|
+
strTaskId?: string
|
|
261
|
+
}
|
|
262
|
+
| {
|
|
263
|
+
/** 同步或后台任务成功完成。 */
|
|
264
|
+
strStatus: 'success'
|
|
265
|
+
/** 文件任务结果。 */
|
|
266
|
+
objResult: TResult
|
|
267
|
+
}
|
|
268
|
+
| {
|
|
269
|
+
/** 启动、轮询或业务任务失败。 */
|
|
270
|
+
strStatus: 'error'
|
|
271
|
+
/** 可安全展示或上报的标准错误。 */
|
|
272
|
+
objError: Error
|
|
273
|
+
}
|
|
274
|
+
| {
|
|
275
|
+
/** 用户取消了任务。 */
|
|
276
|
+
strStatus: 'canceled'
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** 文件任务钩子返回的命令与状态。 */
|
|
280
|
+
export interface IUseFileTaskResult<TInput, TResult> {
|
|
281
|
+
/** 取消当前启动或轮询请求。 */
|
|
282
|
+
fnCancel: () => void
|
|
283
|
+
/** 使用最近一次输入重新开始任务。 */
|
|
284
|
+
fnRetry: () => Promise<TResult | undefined>
|
|
285
|
+
/** 启动同步或异步任务。 */
|
|
286
|
+
fnRun: (objInput: TInput) => Promise<TResult | undefined>
|
|
287
|
+
/** 当前互斥状态。 */
|
|
288
|
+
objState: TFileTaskState<TResult>
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** 构造文件能力错误的参数。 */
|
|
292
|
+
export interface IFileCapabilityErrorOptions {
|
|
293
|
+
/** 稳定文件能力错误码。 */
|
|
294
|
+
strCode: TFileCapabilityErrorCode
|
|
295
|
+
/** 面向用户的安全错误说明。 */
|
|
296
|
+
strMessage: string
|
|
297
|
+
/** 用户是否可通过重试恢复。 */
|
|
298
|
+
bRetriable?: boolean
|
|
299
|
+
}
|