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,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useLayoutEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
useState,
|
|
6
|
+
type Dispatch,
|
|
7
|
+
type RefObject,
|
|
8
|
+
type SetStateAction,
|
|
9
|
+
} from 'react'
|
|
10
|
+
import {
|
|
11
|
+
measureTableGridContentHeight,
|
|
12
|
+
resolveTableGridHeight,
|
|
13
|
+
type TableHeight,
|
|
14
|
+
type TableHeightGridInstance,
|
|
15
|
+
} from '@/components/AppTable/engine/table/layout/height'
|
|
16
|
+
import { createTableLayoutScheduler } from '@/components/AppTable/engine/table/layout/layoutScheduler'
|
|
17
|
+
|
|
18
|
+
const nHeightTolerance = 1
|
|
19
|
+
|
|
20
|
+
export { resolveTableInitialGridHeight } from '@/components/AppTable/engine/table/layout/height'
|
|
21
|
+
|
|
22
|
+
interface IAdaptiveHeightGridInstance extends TableHeightGridInstance {
|
|
23
|
+
isDestroyed: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface IAdaptiveHeightController {
|
|
27
|
+
readonly instance: IAdaptiveHeightGridInstance | null
|
|
28
|
+
subscribeGridLayout: (fnListener: () => void) => () => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface IUseTableAdaptiveHeightOptions {
|
|
32
|
+
objSectionRef: RefObject<HTMLElement | null>
|
|
33
|
+
objContainerRef: RefObject<HTMLDivElement | null>
|
|
34
|
+
objController: IAdaptiveHeightController
|
|
35
|
+
objHeight: TableHeight
|
|
36
|
+
nRowCount: number
|
|
37
|
+
/** 远程首批数据尚未结算时先完成离屏测量,不开放临时高度。 */
|
|
38
|
+
bWaitForFirstStableHeight?: boolean
|
|
39
|
+
/** 首批查询已经结算,可以把测量完成的网格交给浏览器绘制。 */
|
|
40
|
+
bCanReveal?: boolean
|
|
41
|
+
/** 外层布局动画期间暂停额外高度测量,结束后只结算一次。 */
|
|
42
|
+
bLayoutTransitioning?: boolean
|
|
43
|
+
fnSetGridHeight: Dispatch<SetStateAction<number>>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function fnReadChromeHeight(
|
|
47
|
+
objSection: HTMLElement,
|
|
48
|
+
objGridRegion: HTMLElement
|
|
49
|
+
) {
|
|
50
|
+
let objGridBranch: HTMLElement = objGridRegion
|
|
51
|
+
while (
|
|
52
|
+
objGridBranch.parentElement &&
|
|
53
|
+
objGridBranch.parentElement !== objSection
|
|
54
|
+
) {
|
|
55
|
+
objGridBranch = objGridBranch.parentElement
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const nSectionChromeHeight = Array.from(objSection.children).reduce(
|
|
59
|
+
(nHeight, objChild) => {
|
|
60
|
+
if (!(objChild instanceof HTMLElement) || objChild === objGridBranch) {
|
|
61
|
+
return nHeight
|
|
62
|
+
}
|
|
63
|
+
return nHeight + objChild.getBoundingClientRect().height
|
|
64
|
+
},
|
|
65
|
+
0
|
|
66
|
+
)
|
|
67
|
+
const objGridColumn = objGridRegion.parentElement
|
|
68
|
+
if (!objGridColumn || objGridColumn === objSection) {
|
|
69
|
+
return nSectionChromeHeight
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const nGridColumnChromeHeight = Array.from(objGridColumn.children).reduce(
|
|
73
|
+
(nHeight, objChild) => {
|
|
74
|
+
if (!(objChild instanceof HTMLElement) || objChild === objGridRegion) {
|
|
75
|
+
return nHeight
|
|
76
|
+
}
|
|
77
|
+
return nHeight + objChild.getBoundingClientRect().height
|
|
78
|
+
},
|
|
79
|
+
0
|
|
80
|
+
)
|
|
81
|
+
return nSectionChromeHeight + nGridColumnChromeHeight
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function fnMeasureGridHeight({
|
|
85
|
+
objSection,
|
|
86
|
+
objContainer,
|
|
87
|
+
objGridRegion,
|
|
88
|
+
objHeightSlot,
|
|
89
|
+
objController,
|
|
90
|
+
objHeight,
|
|
91
|
+
nRowCount,
|
|
92
|
+
}: {
|
|
93
|
+
objSection: HTMLElement
|
|
94
|
+
objContainer: HTMLDivElement
|
|
95
|
+
objGridRegion: HTMLElement
|
|
96
|
+
objHeightSlot: HTMLElement
|
|
97
|
+
objController: IAdaptiveHeightController
|
|
98
|
+
objHeight: TableHeight
|
|
99
|
+
nRowCount: number
|
|
100
|
+
}) {
|
|
101
|
+
const objInstance = objController.instance
|
|
102
|
+
if (!objInstance || objInstance.isDestroyed) return null
|
|
103
|
+
|
|
104
|
+
const nAvailableHeight = Math.max(
|
|
105
|
+
1,
|
|
106
|
+
objHeightSlot.clientHeight - fnReadChromeHeight(objSection, objGridRegion)
|
|
107
|
+
)
|
|
108
|
+
const objHolder = objContainer.querySelector<HTMLElement>(
|
|
109
|
+
'.handsontable.ht_master .wtHolder'
|
|
110
|
+
)
|
|
111
|
+
const nHeaderHeight =
|
|
112
|
+
objContainer
|
|
113
|
+
.querySelector<HTMLElement>('.handsontable.ht_master thead')
|
|
114
|
+
?.getBoundingClientRect().height ?? 0
|
|
115
|
+
const nHorizontalScrollbarHeight = objHolder
|
|
116
|
+
? Math.max(0, objHolder.offsetHeight - objHolder.clientHeight)
|
|
117
|
+
: 0
|
|
118
|
+
const nContentHeight = measureTableGridContentHeight({
|
|
119
|
+
instance: objInstance,
|
|
120
|
+
rowCount: nRowCount,
|
|
121
|
+
headerHeight: nHeaderHeight,
|
|
122
|
+
horizontalScrollbarHeight: nHorizontalScrollbarHeight,
|
|
123
|
+
availableHeight: nAvailableHeight,
|
|
124
|
+
})
|
|
125
|
+
return resolveTableGridHeight({
|
|
126
|
+
height: objHeight,
|
|
127
|
+
contentHeight: nContentHeight,
|
|
128
|
+
availableHeight: nAvailableHeight,
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** 将统一高度策略映射为 React/Handsontable 的响应式像素高度。 */
|
|
133
|
+
export function useTableAdaptiveHeight({
|
|
134
|
+
objSectionRef,
|
|
135
|
+
objContainerRef,
|
|
136
|
+
objController,
|
|
137
|
+
objHeight,
|
|
138
|
+
nRowCount,
|
|
139
|
+
bWaitForFirstStableHeight = false,
|
|
140
|
+
bCanReveal = true,
|
|
141
|
+
bLayoutTransitioning = false,
|
|
142
|
+
fnSetGridHeight,
|
|
143
|
+
}: IUseTableAdaptiveHeightOptions) {
|
|
144
|
+
const [objMeasuredHeight, fnSetMeasuredHeight] = useState<TableHeight>()
|
|
145
|
+
|
|
146
|
+
const fnSyncHeight = useCallback(() => {
|
|
147
|
+
const objSection = objSectionRef.current
|
|
148
|
+
const objContainer = objContainerRef.current
|
|
149
|
+
const objGridRegion = objContainer?.parentElement
|
|
150
|
+
const objHeightSlot = objSection?.parentElement
|
|
151
|
+
if (!objSection || !objContainer || !objGridRegion || !objHeightSlot) return
|
|
152
|
+
|
|
153
|
+
const nNextHeight = fnMeasureGridHeight({
|
|
154
|
+
objSection,
|
|
155
|
+
objContainer,
|
|
156
|
+
objGridRegion,
|
|
157
|
+
objHeightSlot,
|
|
158
|
+
objController,
|
|
159
|
+
objHeight,
|
|
160
|
+
nRowCount,
|
|
161
|
+
})
|
|
162
|
+
if (nNextHeight === null) return
|
|
163
|
+
fnSetGridHeight((nCurrentHeight) =>
|
|
164
|
+
Math.abs(nCurrentHeight - nNextHeight) < nHeightTolerance
|
|
165
|
+
? nCurrentHeight
|
|
166
|
+
: nNextHeight
|
|
167
|
+
)
|
|
168
|
+
if (bCanReveal) fnSetMeasuredHeight(objHeight)
|
|
169
|
+
}, [
|
|
170
|
+
bCanReveal,
|
|
171
|
+
fnSetGridHeight,
|
|
172
|
+
nRowCount,
|
|
173
|
+
objContainerRef,
|
|
174
|
+
objController,
|
|
175
|
+
objHeight,
|
|
176
|
+
objSectionRef,
|
|
177
|
+
])
|
|
178
|
+
const fnSyncHeightRef = useRef(fnSyncHeight)
|
|
179
|
+
const objLayoutSchedulerRef = useRef<
|
|
180
|
+
ReturnType<typeof createTableLayoutScheduler> | undefined
|
|
181
|
+
>(undefined)
|
|
182
|
+
const objLayoutTransitioningRef = useRef(bLayoutTransitioning)
|
|
183
|
+
useLayoutEffect(() => {
|
|
184
|
+
fnSyncHeightRef.current = fnSyncHeight
|
|
185
|
+
objLayoutTransitioningRef.current = bLayoutTransitioning
|
|
186
|
+
}, [fnSyncHeight, bLayoutTransitioning])
|
|
187
|
+
objLayoutSchedulerRef.current ??= createTableLayoutScheduler({
|
|
188
|
+
onSettled: () => fnSyncHeightRef.current(),
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
const fnScheduleHeightSync = useCallback(() => {
|
|
192
|
+
if (objLayoutTransitioningRef.current) return
|
|
193
|
+
objLayoutSchedulerRef.current?.scheduleSettled()
|
|
194
|
+
}, [])
|
|
195
|
+
|
|
196
|
+
useLayoutEffect(() => {
|
|
197
|
+
if (bLayoutTransitioning) {
|
|
198
|
+
objLayoutSchedulerRef.current?.cancel()
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
fnScheduleHeightSync()
|
|
202
|
+
}, [bLayoutTransitioning, fnScheduleHeightSync])
|
|
203
|
+
|
|
204
|
+
useLayoutEffect(() => {
|
|
205
|
+
fnScheduleHeightSync()
|
|
206
|
+
}, [fnScheduleHeightSync, fnSyncHeight])
|
|
207
|
+
|
|
208
|
+
useLayoutEffect(() => {
|
|
209
|
+
const objSection = objSectionRef.current
|
|
210
|
+
const objContainer = objContainerRef.current
|
|
211
|
+
const objGridRegion = objContainer?.parentElement
|
|
212
|
+
const objHeightSlot = objSection?.parentElement
|
|
213
|
+
if (!objSection || !objContainer || !objGridRegion || !objHeightSlot) return
|
|
214
|
+
|
|
215
|
+
const fnUnsubscribeLayout =
|
|
216
|
+
objController.subscribeGridLayout(fnScheduleHeightSync)
|
|
217
|
+
const objObserver = new ResizeObserver(fnScheduleHeightSync)
|
|
218
|
+
objObserver.observe(objHeightSlot)
|
|
219
|
+
Array.from(objSection.children).forEach((objChild) => {
|
|
220
|
+
if (objChild instanceof HTMLElement && objChild !== objGridRegion) {
|
|
221
|
+
objObserver.observe(objChild)
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
fnScheduleHeightSync()
|
|
225
|
+
|
|
226
|
+
return () => {
|
|
227
|
+
objLayoutSchedulerRef.current?.cancel()
|
|
228
|
+
fnUnsubscribeLayout()
|
|
229
|
+
objObserver.disconnect()
|
|
230
|
+
}
|
|
231
|
+
}, [objContainerRef, objController, objSectionRef, fnScheduleHeightSync])
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
bHeightReady:
|
|
235
|
+
!bWaitForFirstStableHeight ||
|
|
236
|
+
(bCanReveal && Object.is(objMeasuredHeight, objHeight)),
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { TABLE_DEFAULT_ROW_KEY } from '@/components/AppTable/engine/config/constants'
|
|
3
|
+
import type { TablePreferenceUpdater } from '@/components/AppTable/engine/preference/preference'
|
|
4
|
+
import type { TablePreference } from '@/components/AppTable/engine/preference/types'
|
|
5
|
+
import { getTableRowValue } from '@/components/AppTable/engine/shared/row'
|
|
6
|
+
import type { TableRow } from '@/components/AppTable/engine/shared/types'
|
|
7
|
+
import type { TableController } from '@/components/AppTable/engine/table/controller/TableController'
|
|
8
|
+
import type { TableSnapshot } from '@/components/AppTable/engine/table/controller/types'
|
|
9
|
+
import type {
|
|
10
|
+
ResolvedTableComponentProps,
|
|
11
|
+
TableBottomPanelConfig,
|
|
12
|
+
TableRightPanelConfig,
|
|
13
|
+
} from '../../config'
|
|
14
|
+
import { useResizablePanel } from './useResizablePanel'
|
|
15
|
+
|
|
16
|
+
const TABLE_BOTTOM_PANEL_DEFAULTS = {
|
|
17
|
+
nHeight: 280,
|
|
18
|
+
nMinHeight: 100,
|
|
19
|
+
nMaxHeight: 600,
|
|
20
|
+
}
|
|
21
|
+
const TABLE_RIGHT_PANEL_DEFAULTS = {
|
|
22
|
+
nWidth: 360,
|
|
23
|
+
nMinWidth: 240,
|
|
24
|
+
nMaxWidth: 720,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function usePanelOpen(
|
|
28
|
+
objConfig:
|
|
29
|
+
| false
|
|
30
|
+
| Pick<
|
|
31
|
+
TableBottomPanelConfig | TableRightPanelConfig,
|
|
32
|
+
'defaultOpen' | 'open' | 'onOpenChange'
|
|
33
|
+
>
|
|
34
|
+
| undefined
|
|
35
|
+
) {
|
|
36
|
+
const [bInternalOpen, fnSetInternalOpen] = useState(() =>
|
|
37
|
+
Boolean(objConfig && objConfig.defaultOpen)
|
|
38
|
+
)
|
|
39
|
+
const bControlled = Boolean(objConfig && typeof objConfig.open === 'boolean')
|
|
40
|
+
const bOpen = Boolean(
|
|
41
|
+
objConfig && (bControlled ? objConfig.open : bInternalOpen)
|
|
42
|
+
)
|
|
43
|
+
const fnSetOpen = useCallback(
|
|
44
|
+
(bNextOpen: boolean) => {
|
|
45
|
+
if (!objConfig) return
|
|
46
|
+
if (!bControlled) fnSetInternalOpen(bNextOpen)
|
|
47
|
+
objConfig.onOpenChange?.(bNextOpen)
|
|
48
|
+
},
|
|
49
|
+
[bControlled, objConfig]
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (objConfig !== false) return
|
|
54
|
+
fnSetInternalOpen(false)
|
|
55
|
+
}, [objConfig])
|
|
56
|
+
|
|
57
|
+
return { bOpen, fnSetOpen }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface IUseTablePanelsOptions<T extends TableRow> {
|
|
61
|
+
objController: TableController<T>
|
|
62
|
+
objSnapshot: TableSnapshot<T>
|
|
63
|
+
objProps: ResolvedTableComponentProps<T>
|
|
64
|
+
objPreference: TablePreference
|
|
65
|
+
fnUpdatePreference: (updater: TablePreferenceUpdater) => Promise<unknown>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** React 底部、右侧和详情面板共享状态与尺寸持久化协调器。 */
|
|
69
|
+
export function useTablePanels<T extends TableRow>({
|
|
70
|
+
objController,
|
|
71
|
+
objSnapshot,
|
|
72
|
+
objProps,
|
|
73
|
+
objPreference,
|
|
74
|
+
fnUpdatePreference,
|
|
75
|
+
}: IUseTablePanelsOptions<T>) {
|
|
76
|
+
const objBottomConfig = objProps.bottomPanel
|
|
77
|
+
const objRightConfig = objProps.rightPanel
|
|
78
|
+
const objRowDetailConfig = objProps.rowDetailPanel
|
|
79
|
+
const strRowDetailPlacement =
|
|
80
|
+
(objRowDetailConfig && objRowDetailConfig.placement) || 'bottom'
|
|
81
|
+
const objDetailOpenConfig = useMemo(
|
|
82
|
+
() => (objRowDetailConfig ? {} : undefined),
|
|
83
|
+
[objRowDetailConfig]
|
|
84
|
+
)
|
|
85
|
+
const objBottomOpen = usePanelOpen(objBottomConfig || objDetailOpenConfig)
|
|
86
|
+
const objRightOpen = usePanelOpen(objRightConfig || objDetailOpenConfig)
|
|
87
|
+
const bBottomOpen = objBottomOpen.bOpen
|
|
88
|
+
const bRightOpen = objRightOpen.bOpen
|
|
89
|
+
const fnSetBottomOpen = objBottomOpen.fnSetOpen
|
|
90
|
+
const fnSetRightOpen = objRightOpen.fnSetOpen
|
|
91
|
+
const [objInternalCurrentRow, fnSetInternalCurrentRow] = useState<T>()
|
|
92
|
+
const bCurrentRowControlled = Boolean(
|
|
93
|
+
objRowDetailConfig &&
|
|
94
|
+
Object.prototype.hasOwnProperty.call(objRowDetailConfig, 'activeRow')
|
|
95
|
+
)
|
|
96
|
+
const objCurrentRow = bCurrentRowControlled
|
|
97
|
+
? (objRowDetailConfig && objRowDetailConfig.activeRow) || undefined
|
|
98
|
+
: objInternalCurrentRow
|
|
99
|
+
const fnSetCurrentRow = useCallback(
|
|
100
|
+
(objRow: T | undefined) => {
|
|
101
|
+
if (!bCurrentRowControlled) fnSetInternalCurrentRow(objRow)
|
|
102
|
+
if (objRowDetailConfig) {
|
|
103
|
+
objRowDetailConfig.onActiveRowChange?.(objRow)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
[bCurrentRowControlled, objRowDetailConfig]
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
const fnGetRowKey = useCallback(
|
|
110
|
+
(objRow: T) =>
|
|
111
|
+
getTableRowValue(
|
|
112
|
+
objRow,
|
|
113
|
+
String(objProps.rowKey ?? TABLE_DEFAULT_ROW_KEY)
|
|
114
|
+
),
|
|
115
|
+
[objProps.rowKey]
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!objCurrentRow) return
|
|
120
|
+
const objCurrentKey = fnGetRowKey(objCurrentRow)
|
|
121
|
+
const objNextRow = objSnapshot.rows.find((objRow) =>
|
|
122
|
+
Object.is(fnGetRowKey(objRow), objCurrentKey)
|
|
123
|
+
)
|
|
124
|
+
if (objNextRow) {
|
|
125
|
+
if (objNextRow !== objCurrentRow) fnSetCurrentRow(objNextRow)
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
fnSetCurrentRow(undefined)
|
|
129
|
+
if (strRowDetailPlacement === 'right') fnSetRightOpen(false)
|
|
130
|
+
else fnSetBottomOpen(false)
|
|
131
|
+
}, [
|
|
132
|
+
fnGetRowKey,
|
|
133
|
+
fnSetCurrentRow,
|
|
134
|
+
objCurrentRow,
|
|
135
|
+
objSnapshot.rows,
|
|
136
|
+
strRowDetailPlacement,
|
|
137
|
+
fnSetBottomOpen,
|
|
138
|
+
fnSetRightOpen,
|
|
139
|
+
])
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (objRowDetailConfig !== false) return
|
|
143
|
+
fnSetCurrentRow(undefined)
|
|
144
|
+
fnSetBottomOpen(false)
|
|
145
|
+
fnSetRightOpen(false)
|
|
146
|
+
}, [fnSetBottomOpen, fnSetCurrentRow, fnSetRightOpen, objRowDetailConfig])
|
|
147
|
+
|
|
148
|
+
const objPreviousControlledDetailRef = useRef<{
|
|
149
|
+
bActive: boolean
|
|
150
|
+
objRowKey?: unknown
|
|
151
|
+
}>({ bActive: false })
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
const bActive = bCurrentRowControlled && Boolean(objCurrentRow)
|
|
154
|
+
const objRowKey = objCurrentRow
|
|
155
|
+
? (fnGetRowKey(objCurrentRow) ?? objCurrentRow)
|
|
156
|
+
: undefined
|
|
157
|
+
const objPrevious = objPreviousControlledDetailRef.current
|
|
158
|
+
objPreviousControlledDetailRef.current = { bActive, objRowKey }
|
|
159
|
+
if (
|
|
160
|
+
!bActive ||
|
|
161
|
+
(objPrevious.bActive && Object.is(objPrevious.objRowKey, objRowKey))
|
|
162
|
+
) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
if (strRowDetailPlacement === 'right') {
|
|
166
|
+
fnSetRightOpen(true)
|
|
167
|
+
fnSetBottomOpen(false)
|
|
168
|
+
} else {
|
|
169
|
+
fnSetBottomOpen(true)
|
|
170
|
+
fnSetRightOpen(false)
|
|
171
|
+
}
|
|
172
|
+
}, [
|
|
173
|
+
bCurrentRowControlled,
|
|
174
|
+
fnGetRowKey,
|
|
175
|
+
fnSetBottomOpen,
|
|
176
|
+
fnSetRightOpen,
|
|
177
|
+
objCurrentRow,
|
|
178
|
+
strRowDetailPlacement,
|
|
179
|
+
])
|
|
180
|
+
|
|
181
|
+
const strPreviousPlacementRef = useRef(strRowDetailPlacement)
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
const strPreviousPlacement = strPreviousPlacementRef.current
|
|
184
|
+
strPreviousPlacementRef.current = strRowDetailPlacement
|
|
185
|
+
if (!objCurrentRow || strPreviousPlacement === strRowDetailPlacement) return
|
|
186
|
+
const bWasOpen = strPreviousPlacement === 'right' ? bRightOpen : bBottomOpen
|
|
187
|
+
if (!bWasOpen) return
|
|
188
|
+
if (strRowDetailPlacement === 'right') {
|
|
189
|
+
fnSetBottomOpen(false)
|
|
190
|
+
fnSetRightOpen(true)
|
|
191
|
+
} else {
|
|
192
|
+
fnSetRightOpen(false)
|
|
193
|
+
fnSetBottomOpen(true)
|
|
194
|
+
}
|
|
195
|
+
objController.refreshDimensions()
|
|
196
|
+
}, [
|
|
197
|
+
bBottomOpen,
|
|
198
|
+
bRightOpen,
|
|
199
|
+
fnSetBottomOpen,
|
|
200
|
+
fnSetRightOpen,
|
|
201
|
+
objController,
|
|
202
|
+
objCurrentRow,
|
|
203
|
+
strRowDetailPlacement,
|
|
204
|
+
])
|
|
205
|
+
|
|
206
|
+
const objBottomResize = useResizablePanel({
|
|
207
|
+
strAxis: 'vertical',
|
|
208
|
+
objInitialSize: objPreference.bottomHeight,
|
|
209
|
+
nDefaultSize:
|
|
210
|
+
objBottomConfig && typeof objBottomConfig.defaultHeight === 'number'
|
|
211
|
+
? objBottomConfig.defaultHeight
|
|
212
|
+
: TABLE_BOTTOM_PANEL_DEFAULTS.nHeight,
|
|
213
|
+
nMinSize:
|
|
214
|
+
objBottomConfig && typeof objBottomConfig.minHeight === 'number'
|
|
215
|
+
? objBottomConfig.minHeight
|
|
216
|
+
: TABLE_BOTTOM_PANEL_DEFAULTS.nMinHeight,
|
|
217
|
+
nMaxSize:
|
|
218
|
+
objBottomConfig && typeof objBottomConfig.maxHeight === 'number'
|
|
219
|
+
? objBottomConfig.maxHeight
|
|
220
|
+
: TABLE_BOTTOM_PANEL_DEFAULTS.nMaxHeight,
|
|
221
|
+
bDisabled: Boolean(objBottomConfig && objBottomConfig.resizable === false),
|
|
222
|
+
fnOnResize: () => objController.refreshDimensions(),
|
|
223
|
+
fnOnResizeEnd: (nHeight) => {
|
|
224
|
+
void fnUpdatePreference((objCurrent) => ({
|
|
225
|
+
...objCurrent,
|
|
226
|
+
bottomHeight: nHeight,
|
|
227
|
+
}))
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
const objRightResize = useResizablePanel({
|
|
231
|
+
strAxis: 'horizontal',
|
|
232
|
+
strEdge: 'start',
|
|
233
|
+
objInitialSize: objPreference.rightWidth,
|
|
234
|
+
nDefaultSize:
|
|
235
|
+
objRightConfig && typeof objRightConfig.width === 'number'
|
|
236
|
+
? objRightConfig.width
|
|
237
|
+
: TABLE_RIGHT_PANEL_DEFAULTS.nWidth,
|
|
238
|
+
nMinSize:
|
|
239
|
+
objRightConfig && typeof objRightConfig.minWidth === 'number'
|
|
240
|
+
? objRightConfig.minWidth
|
|
241
|
+
: TABLE_RIGHT_PANEL_DEFAULTS.nMinWidth,
|
|
242
|
+
nMaxSize:
|
|
243
|
+
objRightConfig && typeof objRightConfig.maxWidth === 'number'
|
|
244
|
+
? objRightConfig.maxWidth
|
|
245
|
+
: TABLE_RIGHT_PANEL_DEFAULTS.nMaxWidth,
|
|
246
|
+
bDisabled: Boolean(objRightConfig && objRightConfig.resizable === false),
|
|
247
|
+
fnGetDirection: () =>
|
|
248
|
+
document.documentElement.dir === 'rtl' ? 'rtl' : 'ltr',
|
|
249
|
+
fnOnResize: () => objController.refreshDimensions(),
|
|
250
|
+
fnOnResizeEnd: (nWidth) => {
|
|
251
|
+
void fnUpdatePreference((objCurrent) => ({
|
|
252
|
+
...objCurrent,
|
|
253
|
+
rightWidth: nWidth,
|
|
254
|
+
}))
|
|
255
|
+
},
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
const fnOpenRowDetailPanel = useCallback(
|
|
259
|
+
(objRow?: T) => {
|
|
260
|
+
if (!objRowDetailConfig) return
|
|
261
|
+
const objNextRow = objRow ?? objCurrentRow
|
|
262
|
+
if (!objNextRow) return
|
|
263
|
+
fnSetCurrentRow(objNextRow)
|
|
264
|
+
if (strRowDetailPlacement === 'right') {
|
|
265
|
+
fnSetBottomOpen(false)
|
|
266
|
+
fnSetRightOpen(true)
|
|
267
|
+
} else {
|
|
268
|
+
fnSetRightOpen(false)
|
|
269
|
+
fnSetBottomOpen(true)
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
[
|
|
273
|
+
objCurrentRow,
|
|
274
|
+
objRowDetailConfig,
|
|
275
|
+
strRowDetailPlacement,
|
|
276
|
+
fnSetCurrentRow,
|
|
277
|
+
fnSetBottomOpen,
|
|
278
|
+
fnSetRightOpen,
|
|
279
|
+
]
|
|
280
|
+
)
|
|
281
|
+
const fnCloseRowDetailPanel = useCallback(() => {
|
|
282
|
+
fnSetCurrentRow(undefined)
|
|
283
|
+
if (strRowDetailPlacement === 'right') fnSetRightOpen(false)
|
|
284
|
+
else fnSetBottomOpen(false)
|
|
285
|
+
}, [fnSetBottomOpen, fnSetCurrentRow, fnSetRightOpen, strRowDetailPlacement])
|
|
286
|
+
const fnCollapseOnQuery = useCallback(() => {
|
|
287
|
+
if (!objBottomConfig || objBottomConfig.collapseOnQuery !== false) {
|
|
288
|
+
fnSetBottomOpen(false)
|
|
289
|
+
}
|
|
290
|
+
if (!objRightConfig || objRightConfig.collapseOnQuery !== false) {
|
|
291
|
+
fnSetRightOpen(false)
|
|
292
|
+
}
|
|
293
|
+
}, [fnSetBottomOpen, fnSetRightOpen, objBottomConfig, objRightConfig])
|
|
294
|
+
|
|
295
|
+
const bBottomUsesDetail = Boolean(
|
|
296
|
+
objCurrentRow && objRowDetailConfig && strRowDetailPlacement === 'bottom'
|
|
297
|
+
)
|
|
298
|
+
const bRightUsesDetail = Boolean(
|
|
299
|
+
objCurrentRow && objRowDetailConfig && strRowDetailPlacement === 'right'
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
objCurrentRow,
|
|
304
|
+
bBottomOpen:
|
|
305
|
+
bBottomOpen &&
|
|
306
|
+
Boolean(
|
|
307
|
+
(objBottomConfig && objBottomConfig.component) || bBottomUsesDetail
|
|
308
|
+
),
|
|
309
|
+
bRightOpen:
|
|
310
|
+
bRightOpen &&
|
|
311
|
+
Boolean((objRightConfig && objRightConfig.component) || bRightUsesDetail),
|
|
312
|
+
bBottomUsesDetail,
|
|
313
|
+
bRightUsesDetail,
|
|
314
|
+
objBottomResize,
|
|
315
|
+
objRightResize,
|
|
316
|
+
objRightWidth:
|
|
317
|
+
objPreference.rightWidth === undefined &&
|
|
318
|
+
!objRightResize.bResizing &&
|
|
319
|
+
objRightConfig &&
|
|
320
|
+
typeof objRightConfig.width === 'string'
|
|
321
|
+
? objRightConfig.width
|
|
322
|
+
: objRightResize.nSize,
|
|
323
|
+
fnCloseBottomPanel: () => fnSetBottomOpen(false),
|
|
324
|
+
fnCloseRightPanel: () => fnSetRightOpen(false),
|
|
325
|
+
fnCloseRowDetailPanel,
|
|
326
|
+
fnOpenRowDetailPanel,
|
|
327
|
+
fnCollapseOnQuery,
|
|
328
|
+
}
|
|
329
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, type RefObject } from 'react'
|
|
2
|
+
import type { TablePreferenceUpdater } from '@/components/AppTable/engine/preference/preference'
|
|
3
|
+
import {
|
|
4
|
+
createTableThemeController,
|
|
5
|
+
type TableDensity,
|
|
6
|
+
} from '@/components/AppTable/engine/shared/theme'
|
|
7
|
+
import type { TableRow } from '@/components/AppTable/engine/shared/types'
|
|
8
|
+
import type { TableController } from '@/components/AppTable/engine/table/controller/TableController'
|
|
9
|
+
import type { ResolvedTableComponentProps } from '../../config'
|
|
10
|
+
|
|
11
|
+
interface IUseTableThemeOptions<T extends TableRow> {
|
|
12
|
+
strTableKey: string
|
|
13
|
+
objProps: ResolvedTableComponentProps<T>
|
|
14
|
+
objController: TableController<T>
|
|
15
|
+
objContainerRef: RefObject<HTMLDivElement | null>
|
|
16
|
+
fnReportError: (objError: unknown) => void
|
|
17
|
+
strPreferredDensity: TableDensity
|
|
18
|
+
fnUpdatePreference: (updater: TablePreferenceUpdater) => Promise<unknown>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useTableTheme<T extends TableRow>({
|
|
22
|
+
strTableKey,
|
|
23
|
+
objProps,
|
|
24
|
+
objController,
|
|
25
|
+
objContainerRef,
|
|
26
|
+
fnReportError,
|
|
27
|
+
strPreferredDensity,
|
|
28
|
+
fnUpdatePreference,
|
|
29
|
+
}: IUseTableThemeOptions<T>) {
|
|
30
|
+
const objSectionRef = useRef<HTMLElement>(null)
|
|
31
|
+
const [strDensity, fnSetDensity] = useState(strPreferredDensity)
|
|
32
|
+
const [objThemeController] = useState(() =>
|
|
33
|
+
createTableThemeController({
|
|
34
|
+
tableKey: strTableKey,
|
|
35
|
+
theme: objProps.theme,
|
|
36
|
+
density: strPreferredDensity,
|
|
37
|
+
dark:
|
|
38
|
+
typeof document !== 'undefined' &&
|
|
39
|
+
document.documentElement.classList.contains('dark'),
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (strDensity === strPreferredDensity) return
|
|
45
|
+
objThemeController.setDensity(strPreferredDensity)
|
|
46
|
+
fnSetDensity(strPreferredDensity)
|
|
47
|
+
objController.render()
|
|
48
|
+
}, [objController, objThemeController, strDensity, strPreferredDensity])
|
|
49
|
+
|
|
50
|
+
const fnSyncThemeTokens = useCallback(() => {
|
|
51
|
+
const objGrid =
|
|
52
|
+
objContainerRef.current?.querySelector<HTMLElement>('.handsontable')
|
|
53
|
+
const objHost = objSectionRef.current
|
|
54
|
+
if (!objGrid || !objHost) return
|
|
55
|
+
const strToken = getComputedStyle(objGrid)
|
|
56
|
+
.getPropertyValue('--ht-accent-color')
|
|
57
|
+
.trim()
|
|
58
|
+
if (!strToken) {
|
|
59
|
+
objHost.style.removeProperty('--table-component-primary')
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
const objProbe = document.createElement('span')
|
|
63
|
+
objProbe.style.color = 'var(--ht-accent-color)'
|
|
64
|
+
objProbe.style.position = 'absolute'
|
|
65
|
+
objProbe.style.visibility = 'hidden'
|
|
66
|
+
objProbe.style.pointerEvents = 'none'
|
|
67
|
+
objGrid.append(objProbe)
|
|
68
|
+
const strAccent = getComputedStyle(objProbe).color.trim()
|
|
69
|
+
objProbe.remove()
|
|
70
|
+
if (strAccent) {
|
|
71
|
+
objHost.style.setProperty('--table-component-primary', strAccent)
|
|
72
|
+
}
|
|
73
|
+
}, [objContainerRef])
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const objObserver = new MutationObserver(() => {
|
|
77
|
+
objThemeController.setDarkMode(
|
|
78
|
+
document.documentElement.classList.contains('dark')
|
|
79
|
+
)
|
|
80
|
+
objController.render()
|
|
81
|
+
window.requestAnimationFrame(fnSyncThemeTokens)
|
|
82
|
+
})
|
|
83
|
+
objObserver.observe(document.documentElement, {
|
|
84
|
+
attributes: true,
|
|
85
|
+
attributeFilter: ['class'],
|
|
86
|
+
})
|
|
87
|
+
return () => objObserver.disconnect()
|
|
88
|
+
}, [fnSyncThemeTokens, objController, objThemeController])
|
|
89
|
+
|
|
90
|
+
const fnChangeDensity = useCallback(
|
|
91
|
+
(strNextDensity: TableDensity) => {
|
|
92
|
+
if (strNextDensity === strDensity) return
|
|
93
|
+
try {
|
|
94
|
+
objThemeController.setDensity(strNextDensity)
|
|
95
|
+
fnSetDensity(strNextDensity)
|
|
96
|
+
void fnUpdatePreference((objCurrent) => ({
|
|
97
|
+
...objCurrent,
|
|
98
|
+
density: strNextDensity,
|
|
99
|
+
}))
|
|
100
|
+
objController.render()
|
|
101
|
+
window.requestAnimationFrame(fnSyncThemeTokens)
|
|
102
|
+
} catch (objError) {
|
|
103
|
+
fnReportError(objError)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
fnReportError,
|
|
108
|
+
fnSyncThemeTokens,
|
|
109
|
+
fnUpdatePreference,
|
|
110
|
+
objController,
|
|
111
|
+
objThemeController,
|
|
112
|
+
strDensity,
|
|
113
|
+
]
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
objSectionRef,
|
|
118
|
+
objThemeController,
|
|
119
|
+
strDensity,
|
|
120
|
+
fnSyncThemeTokens,
|
|
121
|
+
fnChangeDensity,
|
|
122
|
+
}
|
|
123
|
+
}
|