@antelopejs/dms 0.20.2 → 0.20.4
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/CHANGELOG.md +49 -0
- package/README.md +1 -1
- package/dist/config/internal/state.d.ts +5 -3
- package/dist/config/internal/state.js +9 -1
- package/dist/config/internal/state.js.map +1 -1
- package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/implementations/dms-builder/engine/connection-targets.d.ts +2 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js +276 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js.map +1 -1
- package/dist/implementations/dms-builder/engine/driver-packages.js +16 -4
- package/dist/implementations/dms-builder/engine/driver-packages.js.map +1 -1
- package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/index.js +1 -0
- package/dist/implementations/dms-builder/engine/index.js.map +1 -1
- package/dist/implementations/dms-builder/engine/theme-scaffold.js +1 -1
- package/dist/implementations/dms-html-render/index.js +5 -2
- package/dist/implementations/dms-html-render/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +1 -0
- package/dist/mcp/page-verify/index.js +1 -0
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/redact-report.d.ts +2 -0
- package/dist/mcp/page-verify/redact-report.js +120 -0
- package/dist/mcp/page-verify/redact-report.js.map +1 -0
- package/dist/mcp/page-verify/render.js +4 -1
- package/dist/mcp/page-verify/render.js.map +1 -1
- package/dist/mcp/redact.d.ts +87 -0
- package/dist/mcp/redact.js +139 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/tools/builder-compose.js +11 -2
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-project.js +59 -26
- package/dist/mcp/tools/builder-project.js.map +1 -1
- package/dist/mcp/tools/builder-queries.js +41 -4
- package/dist/mcp/tools/builder-queries.js.map +1 -1
- package/dist/mcp/tools/builder-shared.d.ts +3 -1
- package/dist/mcp/tools/builder-shared.js +5 -0
- package/dist/mcp/tools/builder-shared.js.map +1 -1
- package/dist/mcp/tools/database.js +3 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/page-verify.js +3 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/frontend-vue/dms.frontend.ts +6 -2
- package/frontend-vue/eslint-globals.generated.mjs +259 -942
- package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +5 -3
- package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +6 -4
- package/frontend-vue/layers/dms-auth/app/composables/usePostLoginRedirect.ts +3 -2
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +12 -4
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +12 -6
- package/frontend-vue/layers/dms-auth/app/middleware/auth.ts +4 -2
- package/frontend-vue/layers/dms-auth/server/oauth.ts +13 -7
- package/frontend-vue/layers/dms-auth/server/session.ts +37 -6
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
- package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
- package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
- package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
- package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
- package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
- package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
- package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
- package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
- package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
- package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
- package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
- package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
- package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
- package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
- package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
- package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
- package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
- package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
- package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
- package/frontend-vue/layers/dms-layout/app/build/branding/BrandingColorPair.vue +5 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/device-draft.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/branding/logos.ts +11 -13
- package/frontend-vue/layers/dms-layout/app/build/branding/model.ts +6 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/preview-style.ts +12 -10
- package/frontend-vue/layers/dms-layout/app/build/branding/raster.ts +7 -4
- package/frontend-vue/layers/dms-layout/app/build/branding/useBrandingEditor.ts +59 -31
- package/frontend-vue/layers/dms-layout/app/build/branding/values.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +1 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +37 -24
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfileSummaryRow.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +35 -10
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/theme/CssVariablesList.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/composables/dev-reload/useDevReloadHolder.ts +4 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +26 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/security/useSessionHandoff.ts +3 -6
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +16 -12
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +12 -9
- package/frontend-vue/layers/dms-layout/app/build/mockup/header-action.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +13 -6
- package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +81 -0
- package/frontend-vue/layers/dms-layout/app/build/utils/submittedUrl.ts +14 -0
- package/frontend-vue/layers/dms-layout/app/components/AppWidgetsDock.vue +3 -1
- package/frontend-vue/layers/dms-layout/app/composables/general/useSystemState.ts +4 -5
- package/frontend-vue/layers/dms-layout/app/composables/layout/useServedHeaderActions.ts +7 -5
- package/frontend-vue/layers/dms-layout/app/composables/notification/useNotifications.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +17 -4
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageComponentPreload.ts +15 -7
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageRecordDeletion.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/profile/useUserLanguage.ts +3 -2
- package/frontend-vue/layers/dms-layout/app/composables/useCommandPaletteSources.ts +20 -2
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -1
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/shortcuts.vue +4 -1
- package/frontend-vue/layers/dms-layout/app/pages/[...slug].vue +13 -5
- package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +8 -8
- package/frontend-vue/layers/dms-layout/app/plugins/dms-dev-reload.client.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/plugins/dms-mcp-navigate.client.ts +4 -2
- package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/plugins/notification-stream.client.ts +47 -40
- package/frontend-vue/layers/dms-layout/app/plugins/permission-preview.client.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/plugins/profile-sync.client.ts +3 -10
- package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +3 -2
- package/frontend-vue/layers/dms-layout/server/html-render.ts +5 -1
- package/frontend-vue/layers/dms-layout/server/render-token.ts +3 -2
- package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/custom-pages/onboarding.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
- package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetActions.ts +24 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetConfirmation.ts +53 -30
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetTypes.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowNavigation.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/useActionTargets.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +156 -99
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +194 -161
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/blockDataState.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/useGuard.ts +38 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +34 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexSeriesStyle.ts +32 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexTheme.ts +13 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +23 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultChoiceTypes.ts +11 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +7 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +22 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +5 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +10 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +8 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +12 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +4 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +10 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +21 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/detach.ts +9 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/files/useFileMetadata.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +38 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +6 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +19 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentCancel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentErrors.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentRealtime.ts +28 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentValidation.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +15 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formValidation.ts +12 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/stringSet.ts +6 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +60 -16
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +5 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +13 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/layout/rowSidePanel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/liveCadence.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/missedTally.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +42 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +63 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnStructure.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTable.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +71 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableStates.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/rowId.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/registerDefaultFunctions.ts +21 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionContainers.ts +1 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionNavigation.ts +12 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +25 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewCounts.ts +4 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplayContext.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +18 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewEvents.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewLive.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickActions.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickFilters.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useCardFields.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useReorderHandles.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +19 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableReorder.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/bulkActions.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +14 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +38 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/expandedRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +12 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/reorder.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts +38 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableCounts.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +14 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +22 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/registry.ts +27 -6
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
- package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
- package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
- package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
- package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
- package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
- package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
- package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
- package/frontend-vue/lazy-plugin.ts +1 -1
- package/frontend-vue/package.json +5 -4
- package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
- package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
- package/frontend-vue/scripts/check-dms-components.mjs +152 -246
- package/frontend-vue/scripts/check-invariants.mjs +100 -42
- package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
- package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
- package/frontend-vue/scripts/dms-components-script.mjs +375 -0
- package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
- package/frontend-vue/scripts/jsconfig.json +10 -0
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
- package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
- package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
- package/frontend-vue/scripts/test-dms-components.mjs +70 -5
- package/frontend-vue/server/request-body.ts +29 -5
- package/package.json +5 -3
- package/frontend-vue/eslint-test-quality.mjs +0 -62
package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts
CHANGED
|
@@ -175,21 +175,48 @@ export const sortDirectionLabelKey = (
|
|
|
175
175
|
desc: boolean,
|
|
176
176
|
): string => `dms.sort.direction.${kind}.${desc ? "desc" : "asc"}`;
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
interface FailureFields {
|
|
179
|
+
response?: unknown;
|
|
180
|
+
statusCode?: unknown;
|
|
181
|
+
status?: unknown;
|
|
182
|
+
data?: unknown;
|
|
183
|
+
statusMessage?: unknown;
|
|
184
|
+
message?: unknown;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
interface ResponseFields {
|
|
188
|
+
status?: unknown;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface BodyFields {
|
|
192
|
+
message?: unknown;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const isFailureFields = (
|
|
196
|
+
value: Parameters<typeof hasObjectType>[0],
|
|
197
|
+
): value is FailureFields => hasObjectType(value) && value !== null;
|
|
198
|
+
|
|
199
|
+
const isResponseFields = (
|
|
200
|
+
value: Parameters<typeof hasObjectType>[0],
|
|
201
|
+
): value is ResponseFields => hasObjectType(value) && value !== null;
|
|
202
|
+
|
|
203
|
+
const isBodyFields = (
|
|
204
|
+
value: Parameters<typeof hasObjectType>[0],
|
|
205
|
+
): value is BodyFields => hasObjectType(value) && value !== null;
|
|
181
206
|
|
|
182
|
-
const statusOf = (error:
|
|
183
|
-
const response =
|
|
207
|
+
const statusOf = (error: FailureFields): number | undefined => {
|
|
208
|
+
const response = isResponseFields(error.response)
|
|
209
|
+
? error.response
|
|
210
|
+
: undefined;
|
|
184
211
|
const status = error.statusCode ?? error.status ?? response?.status;
|
|
185
212
|
return isNumber(status) ? status : undefined;
|
|
186
213
|
};
|
|
187
214
|
|
|
188
|
-
const messagesOf = (error:
|
|
215
|
+
const messagesOf = (error: FailureFields): string[] => {
|
|
189
216
|
const { data } = error;
|
|
190
217
|
return [
|
|
191
218
|
isString(data) ? data : undefined,
|
|
192
|
-
|
|
219
|
+
isBodyFields(data) && isString(data.message) ? data.message : undefined,
|
|
193
220
|
isString(error.statusMessage) ? error.statusMessage : undefined,
|
|
194
221
|
isString(error.message) ? error.message : undefined,
|
|
195
222
|
].filter((message): message is string => !!message);
|
|
@@ -200,8 +227,10 @@ const messagesOf = (error: Record<string, unknown>): string[] => {
|
|
|
200
227
|
* not sortable.`): a sort the route never accepted, or a column whose
|
|
201
228
|
* `@Sortable()` was removed since the page was loaded.
|
|
202
229
|
*/
|
|
203
|
-
export const isUnsortableFieldError = (
|
|
204
|
-
|
|
230
|
+
export const isUnsortableFieldError = (
|
|
231
|
+
error: Parameters<typeof hasObjectType>[0],
|
|
232
|
+
): boolean => {
|
|
233
|
+
if (!isFailureFields(error)) return false;
|
|
205
234
|
const status = statusOf(error);
|
|
206
235
|
if (status !== undefined && status !== HTTP_BAD_REQUEST) return false;
|
|
207
236
|
return messagesOf(error).some((message) =>
|
|
@@ -112,6 +112,11 @@ export const navBadgeCount = (
|
|
|
112
112
|
counts: Record<string, number> | null | undefined,
|
|
113
113
|
tabId: string,
|
|
114
114
|
isNarrowed: boolean,
|
|
115
|
-
): number | undefined =>
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
): number | undefined => {
|
|
116
|
+
const countOf = (id: string): number | undefined =>
|
|
117
|
+
counts && Object.hasOwn(counts, id) ? counts[id] : undefined;
|
|
118
|
+
return (
|
|
119
|
+
countOf(`${NAV_BADGE_COUNT_ID_PREFIX}${tabId}`) ??
|
|
120
|
+
(isNarrowed ? undefined : countOf(tabId))
|
|
121
|
+
);
|
|
122
|
+
};
|
|
@@ -41,7 +41,7 @@ const buildFiltersQuery = (filters: TableFilter[]): Record<string, string> => {
|
|
|
41
41
|
return filters
|
|
42
42
|
.filter(isFilterEffective)
|
|
43
43
|
.reduce<Record<string, string>>((acc, val) => {
|
|
44
|
-
acc[`filter_${val.accessorKey}`] = `${val.mode}:${val.value}`;
|
|
44
|
+
acc[`filter_${val.accessorKey}`] = `${val.mode}:${String(val.value)}`;
|
|
45
45
|
return acc;
|
|
46
46
|
}, {});
|
|
47
47
|
};
|
|
@@ -56,16 +56,19 @@ const buildFiltersQuery = (filters: TableFilter[]): Record<string, string> => {
|
|
|
56
56
|
const combineFilters = (
|
|
57
57
|
hidden: Record<string, string>,
|
|
58
58
|
column: Record<string, string>,
|
|
59
|
-
)
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
) => {
|
|
60
|
+
const layered = Object.entries(column).map(
|
|
61
|
+
([key, value]): [string, string | string[]] => {
|
|
62
|
+
const hiddenValue = Object.hasOwn(hidden, key) ? hidden[key] : undefined;
|
|
63
|
+
return [
|
|
64
|
+
key,
|
|
65
|
+
hiddenValue === undefined || hiddenValue === value
|
|
66
|
+
? value
|
|
67
|
+
: [hiddenValue, value],
|
|
68
|
+
];
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
return { ...hidden, ...Object.fromEntries(layered) };
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
export const buildTableQuery = (config: QueryConfig): TableQueryParams => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BeforeStateMapper } from "#dms-core/app/composables/data-types/useDataType";
|
|
1
2
|
import {
|
|
2
3
|
isObject,
|
|
3
4
|
isNumber,
|
|
@@ -8,14 +9,17 @@ import {
|
|
|
8
9
|
* saved). Typing a value then putting the original back makes it clean again.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
type
|
|
12
|
+
/** What a form field holds: the value a data type's mapper takes. */
|
|
13
|
+
type FormValue = Parameters<BeforeStateMapper>[0];
|
|
14
|
+
|
|
15
|
+
type PlainObject = Record<string, FormValue>;
|
|
12
16
|
|
|
13
17
|
/** Whether a value is a plain object (not a list, a date, a file or an instance). */
|
|
14
|
-
export function isPlainObject(value:
|
|
18
|
+
export function isPlainObject(value: FormValue): value is PlainObject {
|
|
15
19
|
if (!isObject(value) || value === null) return false;
|
|
16
20
|
if (Array.isArray(value) || value instanceof Date) return false;
|
|
17
21
|
if (typeof Blob !== "undefined" && value instanceof Blob) return false;
|
|
18
|
-
const prototype = Object.getPrototypeOf(value);
|
|
22
|
+
const prototype: unknown = Object.getPrototypeOf(value);
|
|
19
23
|
return prototype === Object.prototype || prototype === null;
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -25,7 +29,7 @@ export function isPlainObject(value: unknown): value is PlainObject {
|
|
|
25
29
|
* filled). A control that empties itself to `""`, `null`, `[]` or `false`
|
|
26
30
|
* leaves its field as clean as one never touched.
|
|
27
31
|
*/
|
|
28
|
-
export function isEmptyFormValue(value:
|
|
32
|
+
export function isEmptyFormValue(value: FormValue): boolean {
|
|
29
33
|
if (value === undefined || value === null) return true;
|
|
30
34
|
if (value === "" || value === false) return true;
|
|
31
35
|
if (isNumber(value)) return Number.isNaN(value);
|
|
@@ -40,7 +44,7 @@ export function isEmptyFormValue(value: unknown): boolean {
|
|
|
40
44
|
* by item (order counts), objects key by key (whatever their order), dates by
|
|
41
45
|
* their time; any two empty values are the same (see {@link isEmptyFormValue}).
|
|
42
46
|
*/
|
|
43
|
-
export function sameFormValue(left:
|
|
47
|
+
export function sameFormValue(left: FormValue, right: FormValue): boolean {
|
|
44
48
|
if (Object.is(left, right)) return true;
|
|
45
49
|
const isLeftEmpty = isEmptyFormValue(left);
|
|
46
50
|
const isRightEmpty = isEmptyFormValue(right);
|
|
@@ -72,30 +76,36 @@ export function sameFormValue(left: unknown, right: unknown): boolean {
|
|
|
72
76
|
* reach it: lists, plain objects and dates are copied; files and other
|
|
73
77
|
* instances are kept as they are (compared by identity).
|
|
74
78
|
*/
|
|
75
|
-
export function snapshotFormValue<T>(value: T): T
|
|
79
|
+
export function snapshotFormValue<T>(value: T): T;
|
|
80
|
+
export function snapshotFormValue(value: FormValue): FormValue {
|
|
76
81
|
if (Array.isArray(value)) {
|
|
77
|
-
|
|
82
|
+
const items: FormValue[] = value;
|
|
83
|
+
return items.map((item) => snapshotFormValue(item));
|
|
78
84
|
}
|
|
79
|
-
if (value instanceof Date) return new Date(value.getTime())
|
|
85
|
+
if (value instanceof Date) return new Date(value.getTime());
|
|
80
86
|
if (isPlainObject(value)) {
|
|
81
87
|
return Object.fromEntries(
|
|
82
88
|
Object.entries(value).map(([key, part]) => [
|
|
83
89
|
key,
|
|
84
90
|
snapshotFormValue(part),
|
|
85
91
|
]),
|
|
86
|
-
)
|
|
92
|
+
);
|
|
87
93
|
}
|
|
88
94
|
return value;
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
/** The keys whose value differs between the current values and the baseline. */
|
|
92
98
|
export function changedFormKeys(
|
|
93
|
-
current: Readonly<
|
|
94
|
-
baseline: Readonly<
|
|
99
|
+
current: Readonly<PlainObject>,
|
|
100
|
+
baseline: Readonly<PlainObject>,
|
|
95
101
|
keys: Iterable<string> = new Set([
|
|
96
102
|
...Object.keys(current),
|
|
97
103
|
...Object.keys(baseline),
|
|
98
104
|
]),
|
|
99
105
|
): string[] {
|
|
100
|
-
|
|
106
|
+
const read = (table: Readonly<PlainObject>, key: string): FormValue =>
|
|
107
|
+
Object.hasOwn(table, key) ? table[key] : undefined;
|
|
108
|
+
return [...keys].filter(
|
|
109
|
+
(key) => !sameFormValue(read(current, key), read(baseline, key)),
|
|
110
|
+
);
|
|
101
111
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isFunction } from "#dms-core/app/utils/type-check";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Every form holding unsaved changes, wherever it is (a page, a drawer, a
|
|
3
5
|
* modal, a settings panel), and the one confirmation asked before leaving
|
|
@@ -142,6 +144,28 @@ let revisit: BrowserLeaveGuardsOptions["revisit"] = (href) => {
|
|
|
142
144
|
|
|
143
145
|
let isTraversing = false;
|
|
144
146
|
|
|
147
|
+
const isNavigationLike = (value: unknown): value is NavigationLike =>
|
|
148
|
+
value instanceof EventTarget &&
|
|
149
|
+
"traverseTo" in value &&
|
|
150
|
+
isFunction(value.traverseTo);
|
|
151
|
+
|
|
152
|
+
const navigationOf = (target: Window): NavigationLike | undefined => {
|
|
153
|
+
const navigation: unknown =
|
|
154
|
+
"navigation" in target ? target.navigation : undefined;
|
|
155
|
+
return isNavigationLike(navigation) ? navigation : undefined;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** Asks the one confirmation and runs `onLeave` once the user chose to leave. */
|
|
159
|
+
function leaveOnConfirm(onLeave: () => void): void {
|
|
160
|
+
confirmLeave()
|
|
161
|
+
.then((shouldLeave) => {
|
|
162
|
+
if (shouldLeave) onLeave();
|
|
163
|
+
})
|
|
164
|
+
.catch((error: unknown) => {
|
|
165
|
+
throw error;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
145
169
|
/**
|
|
146
170
|
* Whether a router visit leaves the page holding unsaved changes: a page
|
|
147
171
|
* visit to another path. A prefetch on hover, a background refresh of the
|
|
@@ -178,9 +202,7 @@ export function installBrowserLeaveGuards(
|
|
|
178
202
|
if (!hasUnsavedChanges()) return;
|
|
179
203
|
event.preventDefault();
|
|
180
204
|
const { pathname, search, hash } = visit.url;
|
|
181
|
-
|
|
182
|
-
if (shouldLeave) revisit(`${pathname}${search}${hash}`);
|
|
183
|
-
});
|
|
205
|
+
leaveOnConfirm(() => revisit(`${pathname}${search}${hash}`));
|
|
184
206
|
});
|
|
185
207
|
|
|
186
208
|
window.addEventListener("beforeunload", (event) => {
|
|
@@ -190,7 +212,7 @@ export function installBrowserLeaveGuards(
|
|
|
190
212
|
event.returnValue = "";
|
|
191
213
|
});
|
|
192
214
|
|
|
193
|
-
const navigation = (window
|
|
215
|
+
const navigation = navigationOf(window);
|
|
194
216
|
navigation?.addEventListener("navigate", (event) => {
|
|
195
217
|
const traverse: TraverseEvent = event;
|
|
196
218
|
const destination = traverse.destination;
|
|
@@ -204,8 +226,7 @@ export function installBrowserLeaveGuards(
|
|
|
204
226
|
if (new URL(destination.url).pathname === currentPath()) return;
|
|
205
227
|
if (!hasUnsavedChanges()) return;
|
|
206
228
|
traverse.preventDefault();
|
|
207
|
-
|
|
208
|
-
if (!shouldLeave) return;
|
|
229
|
+
leaveOnConfirm(() => {
|
|
209
230
|
isTraversing = true;
|
|
210
231
|
navigation.traverseTo(destination.key);
|
|
211
232
|
});
|
|
@@ -42,7 +42,7 @@ function isOutOfSync(mockup: MockupSummary): boolean {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function statusOf(mockup: MockupSummary)
|
|
45
|
+
function statusOf(mockup: MockupSummary) {
|
|
46
46
|
if (isOutOfSync(mockup)) {
|
|
47
47
|
return { label: t("dms.mockup.status_out_of_sync"), color: "warning" };
|
|
48
48
|
}
|
|
@@ -2,9 +2,17 @@ import { isObject, isString } from "#dms-core/app/utils/type-check";
|
|
|
2
2
|
|
|
3
3
|
const FROM_PAGE_ENDPOINT = "/api/mockup/from-page";
|
|
4
4
|
|
|
5
|
+
/** What `POST /api/mockup/from-page` reads: the page, its mockup, and whether to replace a stale one. */
|
|
6
|
+
interface FromPageRequest {
|
|
7
|
+
path: string;
|
|
8
|
+
mockup: string;
|
|
9
|
+
replace?: boolean;
|
|
10
|
+
digest?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
type Fetch = (
|
|
6
14
|
url: string,
|
|
7
|
-
options: { method: "POST"; body:
|
|
15
|
+
options: { method: "POST"; body: FromPageRequest },
|
|
8
16
|
) => Promise<Parameters<typeof isObject>[0]>;
|
|
9
17
|
|
|
10
18
|
interface FromPageAnswer {
|
|
@@ -12,12 +12,19 @@ import {
|
|
|
12
12
|
isBoolean,
|
|
13
13
|
isNumber,
|
|
14
14
|
} from "../../../../dms-core/app/utils/type-check";
|
|
15
|
+
import {
|
|
16
|
+
isJsonWritable,
|
|
17
|
+
isWritableObject,
|
|
18
|
+
type JsonObject,
|
|
19
|
+
type JsonWritable,
|
|
20
|
+
type JsonWritableObject,
|
|
21
|
+
} from "./json";
|
|
15
22
|
export interface PreviewNode {
|
|
16
23
|
/** Block registry type, e.g. `KpiCard`. Wins over `componentName`. */
|
|
17
24
|
type?: string;
|
|
18
25
|
/** Component a registered block type emits, e.g. `dms-kpi-card`. */
|
|
19
26
|
componentName?: string;
|
|
20
|
-
options?:
|
|
27
|
+
options?: JsonWritableObject;
|
|
21
28
|
children?: PreviewChildNode[];
|
|
22
29
|
}
|
|
23
30
|
|
|
@@ -47,7 +54,7 @@ export interface PreviewState {
|
|
|
47
54
|
export interface PreviewBlockType {
|
|
48
55
|
componentName: string;
|
|
49
56
|
/** Options the factory sets whatever its caller passes. */
|
|
50
|
-
fixedOptions?:
|
|
57
|
+
fixedOptions?: JsonObject;
|
|
51
58
|
/** Takes a controller class: drawn only when built from a route instead. */
|
|
52
59
|
needsController?: boolean;
|
|
53
60
|
}
|
|
@@ -91,7 +98,7 @@ export interface PreviewIssue {
|
|
|
91
98
|
export interface PreviewResolvedNode {
|
|
92
99
|
id: string;
|
|
93
100
|
componentName?: string;
|
|
94
|
-
options:
|
|
101
|
+
options: JsonWritableObject;
|
|
95
102
|
children: PreviewResolvedNode[];
|
|
96
103
|
slot?: string;
|
|
97
104
|
colSpan?: number;
|
|
@@ -119,41 +126,43 @@ function isOptionalString(value: Parameters<typeof isString>[0]): boolean {
|
|
|
119
126
|
return value === undefined || isString(value);
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
function isPreviewNode(
|
|
123
|
-
|
|
129
|
+
function isPreviewNode(
|
|
130
|
+
value: JsonWritable,
|
|
131
|
+
): value is JsonWritableObject & PreviewNode {
|
|
132
|
+
if (!isWritableObject(value)) return false;
|
|
124
133
|
if (!isOptionalString(value.type)) return false;
|
|
125
134
|
if (!isOptionalString(value.componentName)) return false;
|
|
126
|
-
if (value.options !== undefined && !
|
|
135
|
+
if (value.options !== undefined && !isWritableObject(value.options))
|
|
136
|
+
return false;
|
|
127
137
|
if (value.children === undefined) return true;
|
|
128
138
|
return Array.isArray(value.children) && value.children.every(isPreviewNode);
|
|
129
139
|
}
|
|
130
140
|
|
|
131
|
-
|
|
132
|
-
export function isPreviewTree(value: unknown): value is PreviewTree {
|
|
141
|
+
function isTreeValue(value: JsonWritable): value is JsonWritable & PreviewTree {
|
|
133
142
|
return Array.isArray(value)
|
|
134
143
|
? value.every(isPreviewNode)
|
|
135
144
|
: isPreviewNode(value);
|
|
136
145
|
}
|
|
137
146
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
function isOptionalBoolean(value: Parameters<typeof isBoolean>[0]): boolean {
|
|
143
|
-
return value === undefined || isBoolean(value);
|
|
147
|
+
/** Whether `value` is JSON, and a node or a list of nodes. */
|
|
148
|
+
export function isPreviewTree(value: unknown): value is PreviewTree {
|
|
149
|
+
return isJsonWritable(value) && isTreeValue(value);
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
if (!isOptionalString(value.locale)) return false;
|
|
149
|
-
return (
|
|
150
|
-
isOptionalBoolean(value.padding) && isOptionalBoolean(value.transparent)
|
|
151
|
-
);
|
|
152
|
+
export function isPreviewTheme(value: unknown): value is PreviewTheme {
|
|
153
|
+
return PREVIEW_THEMES.some((theme) => theme === value);
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
function isPreviewState(value: unknown): value is PreviewState {
|
|
155
157
|
return (
|
|
156
|
-
|
|
158
|
+
isJsonWritable(value) &&
|
|
159
|
+
isWritableObject(value) &&
|
|
160
|
+
value.tree !== undefined &&
|
|
161
|
+
isTreeValue(value.tree) &&
|
|
162
|
+
(value.theme === undefined || isPreviewTheme(value.theme)) &&
|
|
163
|
+
(value.locale === undefined || isString(value.locale)) &&
|
|
164
|
+
(value.padding === undefined || isBoolean(value.padding)) &&
|
|
165
|
+
(value.transparent === undefined || isBoolean(value.transparent))
|
|
157
166
|
);
|
|
158
167
|
}
|
|
159
168
|
|
|
@@ -291,7 +300,7 @@ function matchBlockType(
|
|
|
291
300
|
* (`TableView.fromSource`): it reads `source.fetchUrl`, which a preview can
|
|
292
301
|
* call like any other block's URL.
|
|
293
302
|
*/
|
|
294
|
-
function readsRouteSource(options:
|
|
303
|
+
function readsRouteSource(options: JsonWritableObject): boolean {
|
|
295
304
|
const source = options[ROUTE_SOURCE_OPTION];
|
|
296
305
|
return isRecord(source) && isString(source.fetchUrl);
|
|
297
306
|
}
|
|
@@ -303,7 +312,7 @@ function readsRouteSource(options: Record<string, unknown>): boolean {
|
|
|
303
312
|
*/
|
|
304
313
|
function readsSerializedForm(
|
|
305
314
|
blockType: PreviewBlockType,
|
|
306
|
-
options:
|
|
315
|
+
options: JsonWritableObject,
|
|
307
316
|
): boolean {
|
|
308
317
|
return (
|
|
309
318
|
blockType.componentName === "dms-form-block" &&
|
|
@@ -316,7 +325,7 @@ function readsSerializedForm(
|
|
|
316
325
|
function issueFor(
|
|
317
326
|
node: PreviewNode,
|
|
318
327
|
match: MatchedBlockType | undefined,
|
|
319
|
-
options:
|
|
328
|
+
options: JsonWritableObject,
|
|
320
329
|
): PreviewIssue | undefined {
|
|
321
330
|
if (!match) {
|
|
322
331
|
return {
|
|
@@ -353,7 +362,7 @@ function clampSketchHeight(height: unknown): number {
|
|
|
353
362
|
* default instead of refusing the sketch.
|
|
354
363
|
*/
|
|
355
364
|
function parseSketch(
|
|
356
|
-
options:
|
|
365
|
+
options: JsonWritableObject | undefined,
|
|
357
366
|
): PreviewSketch | undefined {
|
|
358
367
|
if (!options || !isString(options.html)) return undefined;
|
|
359
368
|
const sketch: PreviewSketch = {
|
|
@@ -168,6 +168,10 @@ function isRecord(
|
|
|
168
168
|
return isObject(value) && value !== null && !Array.isArray(value);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
function isOptionalString(value: Parameters<typeof isString>[0]): boolean {
|
|
172
|
+
return value === undefined || isString(value);
|
|
173
|
+
}
|
|
174
|
+
|
|
171
175
|
function isNavigationItem(value: unknown): value is PreviewNavigationItem {
|
|
172
176
|
return (
|
|
173
177
|
isRecord(value) &&
|
|
@@ -232,28 +236,43 @@ function parseBlockRects(value: unknown): PreviewBlockRect[] | undefined {
|
|
|
232
236
|
return blocks.every((block) => block !== undefined) ? blocks : undefined;
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
function
|
|
236
|
-
|
|
239
|
+
function isRenderMessage(
|
|
240
|
+
value: Parameters<typeof isRecord>[0],
|
|
241
|
+
): value is PreviewRenderMessage {
|
|
242
|
+
return (
|
|
243
|
+
isRecord(value) &&
|
|
244
|
+
value.channel === PREVIEW_CHANNEL &&
|
|
245
|
+
value.type === "render" &&
|
|
246
|
+
isPreviewTree(value.tree) &&
|
|
247
|
+
(value.theme === undefined || isPreviewTheme(value.theme)) &&
|
|
248
|
+
(value.locale === undefined || isString(value.locale)) &&
|
|
249
|
+
(value.transparent === undefined || isBoolean(value.transparent)) &&
|
|
250
|
+
(value.padding === undefined || isBoolean(value.padding)) &&
|
|
251
|
+
(value.navigation === undefined || isPreviewNavigation(value.navigation))
|
|
252
|
+
);
|
|
237
253
|
}
|
|
238
254
|
|
|
239
|
-
function
|
|
240
|
-
|
|
255
|
+
function isThemeMessage(
|
|
256
|
+
value: Parameters<typeof isRecord>[0],
|
|
257
|
+
): value is PreviewThemeMessage {
|
|
258
|
+
return (
|
|
259
|
+
isRecord(value) &&
|
|
260
|
+
value.channel === PREVIEW_CHANNEL &&
|
|
261
|
+
value.type === "theme" &&
|
|
262
|
+
isPreviewTheme(value.theme)
|
|
263
|
+
);
|
|
241
264
|
}
|
|
242
265
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
(data.navigation === undefined || isPreviewNavigation(data.navigation)),
|
|
254
|
-
theme: (data) => isPreviewTheme(data.theme),
|
|
255
|
-
inspect: (data) => isBoolean(data.enabled),
|
|
256
|
-
};
|
|
266
|
+
function isInspectMessage(
|
|
267
|
+
value: Parameters<typeof isRecord>[0],
|
|
268
|
+
): value is PreviewInspectMessage {
|
|
269
|
+
return (
|
|
270
|
+
isRecord(value) &&
|
|
271
|
+
value.channel === PREVIEW_CHANNEL &&
|
|
272
|
+
value.type === "inspect" &&
|
|
273
|
+
isBoolean(value.enabled)
|
|
274
|
+
);
|
|
275
|
+
}
|
|
257
276
|
|
|
258
277
|
/**
|
|
259
278
|
* The preview message `data` is, or undefined for anything else posted to the
|
|
@@ -262,14 +281,9 @@ const INBOUND_VALIDATORS: Record<
|
|
|
262
281
|
export function parsePreviewMessage(
|
|
263
282
|
data: Parameters<typeof isRecord>[0],
|
|
264
283
|
): PreviewInboundMessage | undefined {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
isString(data.type) && Object.hasOwn(INBOUND_VALIDATORS, data.type);
|
|
268
|
-
const validate = isKnownType
|
|
269
|
-
? INBOUND_VALIDATORS[data.type as string]
|
|
284
|
+
return isRenderMessage(data) || isThemeMessage(data) || isInspectMessage(data)
|
|
285
|
+
? data
|
|
270
286
|
: undefined;
|
|
271
|
-
if (!validate?.(data)) return undefined;
|
|
272
|
-
return data as PreviewInboundMessage & typeof data;
|
|
273
287
|
}
|
|
274
288
|
|
|
275
289
|
export function previewReadyMessage(): PreviewReadyMessage {
|
|
@@ -319,9 +333,21 @@ export function previewInspectMessage(enabled: boolean): PreviewInspectMessage {
|
|
|
319
333
|
return { channel: PREVIEW_CHANNEL, type: "inspect", enabled };
|
|
320
334
|
}
|
|
321
335
|
|
|
336
|
+
/** The fields of a posted message the outbound parsers read, unchecked. */
|
|
337
|
+
interface PostedFields {
|
|
338
|
+
height?: unknown;
|
|
339
|
+
message?: unknown;
|
|
340
|
+
path?: unknown;
|
|
341
|
+
blocks?: unknown;
|
|
342
|
+
text?: unknown;
|
|
343
|
+
rect?: unknown;
|
|
344
|
+
font?: unknown;
|
|
345
|
+
id?: unknown;
|
|
346
|
+
}
|
|
347
|
+
|
|
322
348
|
const OUTBOUND_PARSERS: Record<
|
|
323
349
|
Extract<Parameters<typeof Object.hasOwn>[1], string>,
|
|
324
|
-
(data:
|
|
350
|
+
(data: PostedFields) => PreviewOutboundMessage | undefined
|
|
325
351
|
> = {
|
|
326
352
|
ready: () => previewReadyMessage(),
|
|
327
353
|
resize: ({ height }) =>
|
|
@@ -4,12 +4,15 @@ import {
|
|
|
4
4
|
ZonedDateTime,
|
|
5
5
|
toCalendarDate,
|
|
6
6
|
} from "@internationalized/date";
|
|
7
|
+
import type { isString } from "../../../../dms-core/app/utils/type-check";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* The day a calendar value falls on: a `CalendarDate` as it is, the date part
|
|
10
11
|
* of a `CalendarDateTime` or `ZonedDateTime`, and nothing for any other value.
|
|
11
12
|
*/
|
|
12
|
-
export function toCalendarDay(
|
|
13
|
+
export function toCalendarDay(
|
|
14
|
+
value: Parameters<typeof isString>[0],
|
|
15
|
+
): CalendarDate | undefined {
|
|
13
16
|
if (value instanceof CalendarDate) return value;
|
|
14
17
|
if (value instanceof CalendarDateTime || value instanceof ZonedDateTime) {
|
|
15
18
|
return toCalendarDate(value);
|
|
@@ -8,6 +8,6 @@ export function characterCountText(
|
|
|
8
8
|
value: Parameters<typeof isString>[0],
|
|
9
9
|
maxLength?: number,
|
|
10
10
|
): string {
|
|
11
|
-
const count = isString(value) ?
|
|
11
|
+
const count = isString(value) ? Array.from(value).length : 0;
|
|
12
12
|
return maxLength === undefined ? String(count) : `${count} / ${maxLength}`;
|
|
13
13
|
}
|
|
@@ -6,20 +6,18 @@ import {
|
|
|
6
6
|
QUICK_ACTION_QUERY_KEY,
|
|
7
7
|
} from "../../types/quick-actions";
|
|
8
8
|
|
|
9
|
-
type QuickActionTargetHandler = (
|
|
10
|
-
target: QuickActionTarget,
|
|
11
|
-
) => ReturnType<typeof navigateDms> | void;
|
|
9
|
+
type QuickActionTargetHandler = (target: QuickActionTarget) => Promise<void>;
|
|
12
10
|
|
|
13
11
|
const targetHandlers: Record<
|
|
14
12
|
QuickActionTarget["type"],
|
|
15
13
|
QuickActionTargetHandler
|
|
16
14
|
> = {
|
|
17
|
-
navigate: (target) => {
|
|
15
|
+
navigate: async (target) => {
|
|
18
16
|
if (target.type !== "navigate") return;
|
|
19
17
|
return navigateDms({ path: target.to, query: target.query });
|
|
20
18
|
},
|
|
21
19
|
|
|
22
|
-
openForm: (target) => {
|
|
20
|
+
openForm: async (target) => {
|
|
23
21
|
if (target.type !== "openForm") return;
|
|
24
22
|
return navigateDms({
|
|
25
23
|
path: target.to,
|
|
@@ -29,7 +27,7 @@ const targetHandlers: Record<
|
|
|
29
27
|
},
|
|
30
28
|
});
|
|
31
29
|
},
|
|
32
|
-
button: (target) => {
|
|
30
|
+
button: async (target) => {
|
|
33
31
|
if (target.type !== "button") return;
|
|
34
32
|
return navigateDms({
|
|
35
33
|
path: target.to,
|
|
@@ -40,7 +38,7 @@ const targetHandlers: Record<
|
|
|
40
38
|
},
|
|
41
39
|
});
|
|
42
40
|
},
|
|
43
|
-
event: (target) => {
|
|
41
|
+
event: async (target) => {
|
|
44
42
|
if (target.type !== "event") return;
|
|
45
43
|
if (typeof window === "undefined") return;
|
|
46
44
|
window.dispatchEvent(
|
|
@@ -53,11 +51,17 @@ const targetHandlers: Record<
|
|
|
53
51
|
* Runs the client-side behavior a quick action declares through its
|
|
54
52
|
* discriminated `target`: `navigate`, `openForm` and `button` route to the
|
|
55
53
|
* action's page, `event` dispatches a window `CustomEvent` in place for whoever
|
|
56
|
-
* listens.
|
|
54
|
+
* listens. A navigation that fails is logged, not thrown.
|
|
55
|
+
*
|
|
56
|
+
* @returns Whether a handler took the target: false for a type none handles.
|
|
57
57
|
*/
|
|
58
|
-
export function dispatchQuickActionTarget(target: QuickActionTarget):
|
|
58
|
+
export function dispatchQuickActionTarget(target: QuickActionTarget): boolean {
|
|
59
59
|
const handler = targetHandlers[target.type];
|
|
60
|
-
|
|
60
|
+
if (!handler) return false;
|
|
61
|
+
handler(target).catch((error: unknown) => {
|
|
62
|
+
console.error("[dms] Quick action target failed:", error);
|
|
63
|
+
});
|
|
64
|
+
return true;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
/**
|
|
@@ -70,5 +74,6 @@ export function findServedQuickAction(
|
|
|
70
74
|
key: string,
|
|
71
75
|
): QuickActionInfo | undefined {
|
|
72
76
|
if (!served) return undefined;
|
|
73
|
-
|
|
77
|
+
const direct = Object.hasOwn(served, key) ? served[key] : undefined;
|
|
78
|
+
return direct ?? Object.values(served).find((entry) => entry.id === key);
|
|
74
79
|
}
|