@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.
Files changed (367) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -1
  3. package/dist/config/internal/state.d.ts +5 -3
  4. package/dist/config/internal/state.js +9 -1
  5. package/dist/config/internal/state.js.map +1 -1
  6. package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
  7. package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
  8. package/dist/implementations/dms-builder/engine/connection-targets.d.ts +2 -0
  9. package/dist/implementations/dms-builder/engine/connection-targets.js +276 -0
  10. package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -0
  11. package/dist/implementations/dms-builder/engine/dms-database.d.ts +1 -0
  12. package/dist/implementations/dms-builder/engine/dms-database.js +1 -0
  13. package/dist/implementations/dms-builder/engine/dms-database.js.map +1 -1
  14. package/dist/implementations/dms-builder/engine/driver-packages.js +16 -4
  15. package/dist/implementations/dms-builder/engine/driver-packages.js.map +1 -1
  16. package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
  17. package/dist/implementations/dms-builder/engine/index.js +1 -0
  18. package/dist/implementations/dms-builder/engine/index.js.map +1 -1
  19. package/dist/implementations/dms-builder/engine/theme-scaffold.js +1 -1
  20. package/dist/implementations/dms-html-render/index.js +5 -2
  21. package/dist/implementations/dms-html-render/index.js.map +1 -1
  22. package/dist/mcp/page-verify/index.d.ts +1 -0
  23. package/dist/mcp/page-verify/index.js +1 -0
  24. package/dist/mcp/page-verify/index.js.map +1 -1
  25. package/dist/mcp/page-verify/redact-report.d.ts +2 -0
  26. package/dist/mcp/page-verify/redact-report.js +120 -0
  27. package/dist/mcp/page-verify/redact-report.js.map +1 -0
  28. package/dist/mcp/page-verify/render.js +4 -1
  29. package/dist/mcp/page-verify/render.js.map +1 -1
  30. package/dist/mcp/redact.d.ts +87 -0
  31. package/dist/mcp/redact.js +139 -0
  32. package/dist/mcp/redact.js.map +1 -0
  33. package/dist/mcp/tools/builder-compose.js +11 -2
  34. package/dist/mcp/tools/builder-compose.js.map +1 -1
  35. package/dist/mcp/tools/builder-project.js +59 -26
  36. package/dist/mcp/tools/builder-project.js.map +1 -1
  37. package/dist/mcp/tools/builder-queries.js +41 -4
  38. package/dist/mcp/tools/builder-queries.js.map +1 -1
  39. package/dist/mcp/tools/builder-shared.d.ts +3 -1
  40. package/dist/mcp/tools/builder-shared.js +5 -0
  41. package/dist/mcp/tools/builder-shared.js.map +1 -1
  42. package/dist/mcp/tools/database.js +3 -2
  43. package/dist/mcp/tools/database.js.map +1 -1
  44. package/dist/mcp/tools/page-verify.js +3 -2
  45. package/dist/mcp/tools/page-verify.js.map +1 -1
  46. package/frontend-vue/dms.frontend.ts +6 -2
  47. package/frontend-vue/eslint-globals.generated.mjs +259 -942
  48. package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +5 -3
  49. package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +6 -4
  50. package/frontend-vue/layers/dms-auth/app/composables/usePostLoginRedirect.ts +3 -2
  51. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +1 -1
  52. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +1 -1
  53. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +12 -4
  54. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +1 -1
  55. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +12 -6
  56. package/frontend-vue/layers/dms-auth/app/middleware/auth.ts +4 -2
  57. package/frontend-vue/layers/dms-auth/server/oauth.ts +13 -7
  58. package/frontend-vue/layers/dms-auth/server/session.ts +37 -6
  59. package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
  60. package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
  61. package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
  62. package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
  63. package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
  64. package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
  65. package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
  66. package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
  67. package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
  68. package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
  69. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
  70. package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
  71. package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
  72. package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
  73. package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
  74. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
  75. package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
  76. package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
  77. package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
  78. package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
  79. package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
  80. package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
  81. package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
  82. package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
  83. package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
  84. package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
  85. package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
  86. package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
  87. package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
  88. package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
  89. package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
  90. package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
  91. package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
  92. package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
  93. package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
  94. package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
  95. package/frontend-vue/layers/dms-layout/app/build/branding/BrandingColorPair.vue +5 -2
  96. package/frontend-vue/layers/dms-layout/app/build/branding/device-draft.ts +2 -1
  97. package/frontend-vue/layers/dms-layout/app/build/branding/logos.ts +11 -13
  98. package/frontend-vue/layers/dms-layout/app/build/branding/model.ts +6 -2
  99. package/frontend-vue/layers/dms-layout/app/build/branding/preview-style.ts +12 -10
  100. package/frontend-vue/layers/dms-layout/app/build/branding/raster.ts +7 -4
  101. package/frontend-vue/layers/dms-layout/app/build/branding/useBrandingEditor.ts +59 -31
  102. package/frontend-vue/layers/dms-layout/app/build/branding/values.ts +2 -1
  103. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +1 -1
  104. package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +37 -24
  105. package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -4
  106. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfileSummaryRow.vue +2 -2
  107. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +35 -10
  108. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/theme/CssVariablesList.vue +2 -2
  109. package/frontend-vue/layers/dms-layout/app/build/composables/dev-reload/useDevReloadHolder.ts +4 -4
  110. package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +26 -4
  111. package/frontend-vue/layers/dms-layout/app/build/composables/security/useSessionHandoff.ts +3 -6
  112. package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +16 -12
  113. package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +12 -9
  114. package/frontend-vue/layers/dms-layout/app/build/mockup/header-action.ts +2 -2
  115. package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +13 -6
  116. package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +81 -0
  117. package/frontend-vue/layers/dms-layout/app/build/utils/submittedUrl.ts +14 -0
  118. package/frontend-vue/layers/dms-layout/app/components/AppWidgetsDock.vue +3 -1
  119. package/frontend-vue/layers/dms-layout/app/composables/general/useSystemState.ts +4 -5
  120. package/frontend-vue/layers/dms-layout/app/composables/layout/useServedHeaderActions.ts +7 -5
  121. package/frontend-vue/layers/dms-layout/app/composables/notification/useNotifications.ts +2 -2
  122. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +1 -1
  123. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +3 -3
  124. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +2 -2
  125. package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +17 -4
  126. package/frontend-vue/layers/dms-layout/app/composables/page/usePageComponentPreload.ts +15 -7
  127. package/frontend-vue/layers/dms-layout/app/composables/page/usePageRecordDeletion.ts +2 -2
  128. package/frontend-vue/layers/dms-layout/app/composables/profile/useUserLanguage.ts +3 -2
  129. package/frontend-vue/layers/dms-layout/app/composables/useCommandPaletteSources.ts +20 -2
  130. package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -1
  131. package/frontend-vue/layers/dms-layout/app/custom-pages/settings/shortcuts.vue +4 -1
  132. package/frontend-vue/layers/dms-layout/app/pages/[...slug].vue +13 -5
  133. package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +8 -8
  134. package/frontend-vue/layers/dms-layout/app/plugins/dms-dev-reload.client.ts +1 -1
  135. package/frontend-vue/layers/dms-layout/app/plugins/dms-mcp-navigate.client.ts +4 -2
  136. package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +3 -3
  137. package/frontend-vue/layers/dms-layout/app/plugins/notification-stream.client.ts +47 -40
  138. package/frontend-vue/layers/dms-layout/app/plugins/permission-preview.client.ts +2 -2
  139. package/frontend-vue/layers/dms-layout/app/plugins/profile-sync.client.ts +3 -10
  140. package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +2 -2
  141. package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +3 -2
  142. package/frontend-vue/layers/dms-layout/server/html-render.ts +5 -1
  143. package/frontend-vue/layers/dms-layout/server/render-token.ts +3 -2
  144. package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +1 -1
  145. package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -1
  146. package/frontend-vue/layers/dms-onboarding/app/custom-pages/onboarding.vue +2 -1
  147. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
  148. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
  149. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
  150. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
  151. package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
  152. package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
  153. package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
  154. package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
  155. package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
  156. package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
  157. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
  158. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
  159. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
  160. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
  161. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
  162. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
  163. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
  164. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
  165. package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
  166. package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
  167. package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
  168. package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
  169. package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
  170. package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
  171. package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
  172. package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
  173. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
  174. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
  175. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
  176. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
  177. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
  178. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetActions.ts +24 -17
  179. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetConfirmation.ts +53 -30
  180. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +2 -2
  181. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -2
  182. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +8 -4
  183. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetTypes.ts +1 -1
  184. package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowNavigation.ts +3 -2
  185. package/frontend-vue/layers/dms-ui/app/build/composables/actions/useActionTargets.ts +9 -2
  186. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +156 -99
  187. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +2 -2
  188. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +194 -161
  189. package/frontend-vue/layers/dms-ui/app/build/composables/blocks/blockDataState.ts +2 -1
  190. package/frontend-vue/layers/dms-ui/app/build/composables/blocks/useGuard.ts +38 -11
  191. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +34 -5
  192. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexSeriesStyle.ts +32 -3
  193. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexTheme.ts +13 -6
  194. package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +8 -3
  195. package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
  196. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +23 -1
  197. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultChoiceTypes.ts +11 -11
  198. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +7 -1
  199. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +22 -8
  200. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +5 -5
  201. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +10 -9
  202. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +8 -8
  203. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +12 -6
  204. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +4 -6
  205. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +2 -2
  206. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +10 -5
  207. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +21 -3
  208. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -4
  209. package/frontend-vue/layers/dms-ui/app/build/composables/detach.ts +9 -0
  210. package/frontend-vue/layers/dms-ui/app/build/composables/files/useFileMetadata.ts +1 -1
  211. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +38 -14
  212. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +6 -8
  213. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +19 -2
  214. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentCancel.ts +2 -1
  215. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentErrors.ts +3 -2
  216. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentRealtime.ts +28 -8
  217. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentValidation.ts +5 -6
  218. package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +15 -7
  219. package/frontend-vue/layers/dms-ui/app/build/composables/form/formValidation.ts +12 -3
  220. package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -8
  221. package/frontend-vue/layers/dms-ui/app/build/composables/form/stringSet.ts +6 -0
  222. package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +60 -16
  223. package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +5 -4
  224. package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +13 -9
  225. package/frontend-vue/layers/dms-ui/app/build/composables/layout/rowSidePanel.ts +2 -1
  226. package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +1 -1
  227. package/frontend-vue/layers/dms-ui/app/build/composables/live/liveCadence.ts +2 -2
  228. package/frontend-vue/layers/dms-ui/app/build/composables/live/missedTally.ts +8 -6
  229. package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +2 -2
  230. package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +3 -3
  231. package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +1 -1
  232. package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +42 -14
  233. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +63 -46
  234. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -2
  235. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnStructure.ts +2 -2
  236. package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
  237. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTable.ts +4 -2
  238. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +71 -9
  239. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableStates.ts +6 -4
  240. package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/rowId.ts +15 -0
  241. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/registerDefaultFunctions.ts +21 -7
  242. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +3 -3
  243. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionContainers.ts +1 -17
  244. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionNavigation.ts +12 -7
  245. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +25 -4
  246. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +8 -5
  247. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewCounts.ts +4 -5
  248. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplayContext.ts +2 -1
  249. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +18 -14
  250. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewEvents.ts +4 -3
  251. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +2 -2
  252. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +4 -1
  253. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewLive.ts +4 -1
  254. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickActions.ts +4 -3
  255. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickFilters.ts +4 -2
  256. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +9 -7
  257. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +4 -4
  258. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useCardFields.ts +1 -1
  259. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -3
  260. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +7 -7
  261. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +2 -1
  262. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useReorderHandles.ts +9 -2
  263. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +4 -2
  264. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +2 -6
  265. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +19 -12
  266. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +6 -3
  267. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableReorder.ts +7 -7
  268. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +4 -2
  269. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +6 -5
  270. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/bulkActions.ts +3 -1
  271. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +14 -12
  272. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +38 -0
  273. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/expandedRows.ts +4 -2
  274. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +12 -10
  275. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/reorder.ts +6 -5
  276. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts +38 -9
  277. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableCounts.ts +8 -3
  278. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +14 -11
  279. package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +22 -12
  280. package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/registry.ts +27 -6
  281. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
  282. package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
  283. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
  284. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
  285. package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
  286. package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
  287. package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
  288. package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
  289. package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
  290. package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
  291. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
  292. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
  293. package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
  294. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
  295. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
  296. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
  297. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
  298. package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
  299. package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
  300. package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
  301. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
  302. package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
  303. package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
  304. package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
  305. package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
  306. package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
  307. package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
  308. package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
  309. package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
  310. package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
  311. package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
  312. package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
  313. package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
  314. package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
  315. package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
  316. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
  317. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
  318. package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
  319. package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
  320. package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
  321. package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
  322. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
  323. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
  324. package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
  325. package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
  326. package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
  327. package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
  328. package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
  329. package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
  330. package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
  331. package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
  332. package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
  333. package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
  334. package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
  335. package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
  336. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
  337. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
  338. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
  339. package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
  340. package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
  341. package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
  342. package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
  343. package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
  344. package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
  345. package/frontend-vue/lazy-plugin.ts +1 -1
  346. package/frontend-vue/package.json +5 -4
  347. package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
  348. package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
  349. package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
  350. package/frontend-vue/scripts/check-dms-components.mjs +152 -246
  351. package/frontend-vue/scripts/check-invariants.mjs +100 -42
  352. package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
  353. package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
  354. package/frontend-vue/scripts/dms-components-script.mjs +375 -0
  355. package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
  356. package/frontend-vue/scripts/jsconfig.json +10 -0
  357. package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
  358. package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
  359. package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
  360. package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
  361. package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
  362. package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
  363. package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
  364. package/frontend-vue/scripts/test-dms-components.mjs +70 -5
  365. package/frontend-vue/server/request-body.ts +29 -5
  366. package/package.json +5 -3
  367. package/frontend-vue/eslint-test-quality.mjs +0 -62
@@ -2,6 +2,7 @@ import { h, type VNodeChild } from "vue";
2
2
  import { get } from "@nuxt/ui/runtime/utils/index.js";
3
3
  import type { DataTypeFormatter } from "#dms-core/app/composables/data-types/useDataType";
4
4
  import { isNumber, isString } from "#dms-core/app/utils/type-check";
5
+ import { childOf } from "./cellHelpers";
5
6
 
6
7
  /**
7
8
  * A data type a column borrows for its cells only: the column keeps its own
@@ -45,7 +46,7 @@ function renderEmptyFallback(
45
46
  isNumeric: boolean,
46
47
  ): VNodeChild {
47
48
  const fallback =
48
- (options?.fallback as string) ??
49
+ childOf(options?.fallback) ??
49
50
  (surface === "detail" ? DETAIL_FALLBACK : DEFAULT_FALLBACK);
50
51
  return isNumeric
51
52
  ? h("span", { class: NUMERIC_EMPTY_CELL_CLASS }, fallback)
@@ -93,7 +94,7 @@ export function useColumnValueRenderer() {
93
94
 
94
95
  if (value === null || value === undefined) {
95
96
  if (formatter?.empty) {
96
- return formatter.empty(value, locale.value, options, row) as VNodeChild;
97
+ return childOf(formatter.empty(value, locale.value, options, row));
97
98
  }
98
99
  return renderEmptyFallback(options, surface, isNumeric);
99
100
  }
@@ -105,7 +106,7 @@ export function useColumnValueRenderer() {
105
106
  : value;
106
107
 
107
108
  if (!isString(formatted) && !isNumber(formatted)) {
108
- return formatted as VNodeChild;
109
+ return childOf(formatted);
109
110
  }
110
111
  if (isNumeric) {
111
112
  const numericClass =
@@ -125,7 +126,8 @@ export function useColumnValueRenderer() {
125
126
  surface: ColumnValueSurface = "cell",
126
127
  ): VNodeChild => {
127
128
  const key = column.accessorKey ?? column.id;
128
- const value = key === undefined ? undefined : get(row, String(key));
129
+ const value: unknown =
130
+ key === undefined ? undefined : get(row, String(key));
129
131
  return renderValue(column, value, row, surface);
130
132
  };
131
133
 
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Starts work nobody waits for. A rejection still surfaces as an unhandled
3
+ * rejection, the way it does for a promise left unawaited.
4
+ */
5
+ export const detach = (pending: Promise<unknown>): void => {
6
+ pending.catch((error: unknown) => {
7
+ throw error;
8
+ });
9
+ };
@@ -59,7 +59,7 @@ export function useFileMetadata(storage?: string) {
59
59
  key,
60
60
  setTimeout(() => {
61
61
  timers.delete(key);
62
- void read();
62
+ read().catch(() => undefined);
63
63
  }, delay),
64
64
  );
65
65
  }
@@ -17,10 +17,16 @@ interface FieldControlOffer {
17
17
  routeParams: Record<string, string> | undefined;
18
18
  }
19
19
 
20
- function isComponentOptions(
21
- value: unknown,
22
- ): value is Record<string, unknown> | ((...args: never[]) => unknown) {
23
- return (isObject(value) && value !== null) || isFunction(value);
20
+ /** The members of a component that declare props: its own, those of its `extends` and of its `mixins`. */
21
+ interface ComponentDeclaration {
22
+ props?: unknown;
23
+ extends?: unknown;
24
+ mixins?: unknown;
25
+ }
26
+
27
+ function isComponentDeclaration(value: unknown): value is ComponentDeclaration {
28
+ if (!isFunction(value) && !(isObject(value) && value !== null)) return false;
29
+ return "props" in value || "extends" in value || "mixins" in value;
24
30
  }
25
31
 
26
32
  function ownPropNames(props: unknown): string[] {
@@ -28,18 +34,33 @@ function ownPropNames(props: unknown): string[] {
28
34
  return isObject(props) && props !== null ? Object.keys(props) : [];
29
35
  }
30
36
 
37
+ function declarationOf(
38
+ component: Component | ComponentDeclaration,
39
+ ): ComponentDeclaration {
40
+ return {
41
+ props: "props" in component ? component.props : undefined,
42
+ extends: "extends" in component ? component.extends : undefined,
43
+ mixins: "mixins" in component ? component.mixins : undefined,
44
+ };
45
+ }
46
+
31
47
  /**
32
48
  * The props `component` declares, those of its `extends` and `mixins`
33
49
  * included, camelized as Vue matches them.
34
50
  */
35
- function declaredProps(component: unknown, names = new Set<string>()) {
36
- if (!isComponentOptions(component)) return names;
37
- const props = "props" in component ? component.props : undefined;
38
- for (const name of ownPropNames(props)) names.add(camelize(name));
39
- if ("extends" in component) declaredProps(component.extends, names);
40
- const mixins = "mixins" in component ? component.mixins : undefined;
51
+ function declaredProps(
52
+ component: Component | ComponentDeclaration | undefined,
53
+ names = new Set<string>(),
54
+ ) {
55
+ if (!component) return names;
56
+ const declaration = declarationOf(component);
57
+ for (const name of ownPropNames(declaration.props)) names.add(camelize(name));
58
+ if (isComponentDeclaration(declaration.extends))
59
+ declaredProps(declaration.extends, names);
60
+ const { mixins } = declaration;
41
61
  if (Array.isArray(mixins))
42
- for (const mixin of mixins) declaredProps(mixin, names);
62
+ for (const mixin of mixins)
63
+ if (isComponentDeclaration(mixin)) declaredProps(mixin, names);
43
64
  return names;
44
65
  }
45
66
 
@@ -48,12 +69,15 @@ function declaredProps(component: unknown, names = new Set<string>()) {
48
69
  * component itself. A loader that fails yields nothing, and the wrapper shows
49
70
  * its own failure.
50
71
  */
51
- async function loadedComponent(component: Component): Promise<unknown> {
52
- const loader =
72
+ async function loadedComponent(
73
+ component: Component,
74
+ ): Promise<Component | ComponentDeclaration | undefined> {
75
+ const loader: unknown =
53
76
  "__asyncLoader" in component ? component.__asyncLoader : undefined;
54
77
  if (!isFunction(loader)) return component;
55
78
  try {
56
- return await loader();
79
+ const loaded = await loader();
80
+ return isComponentDeclaration(loaded) ? loaded : undefined;
57
81
  } catch {
58
82
  return undefined;
59
83
  }
@@ -1,9 +1,6 @@
1
1
  import type { Ref } from "vue";
2
2
  import type { MarkFieldSaved } from "../../../composables/form/types/field-saved";
3
- import type {
4
- FormData,
5
- FormFieldValue,
6
- } from "../../../composables/form/types/value";
3
+ import type { FormData } from "../../../composables/form/types/value";
7
4
  import { cloneFormValue } from "../../../composables/form/useForm";
8
5
  import type { UseFormDirtyReturn } from "../../../composables/unsaved-changes/useFormDirty";
9
6
  import type { InstantForm, InstantFormOptions } from "./useInstantForm";
@@ -30,10 +27,11 @@ export interface FieldSavedTargets {
30
27
  export function fieldSavedMarker(targets: FieldSavedTargets): MarkFieldSaved {
31
28
  return (id, value) => {
32
29
  if (!targets.hasField(id)) return;
33
- targets.initialValues.value = {
34
- ...targets.initialValues.value,
35
- [id]: cloneFormValue(value as FormFieldValue) as FormFieldValue,
36
- };
30
+ const saved = cloneFormValue(value);
31
+ const initialValues = { ...targets.initialValues.value };
32
+ if (saved === undefined) delete initialValues[id];
33
+ else initialValues[id] = saved;
34
+ targets.initialValues.value = initialValues;
37
35
  targets.dirty.markClean({ ...targets.dirty.baseline.value, [id]: value });
38
36
  targets.instantSave?.confirmField(id, value);
39
37
  };
@@ -1,5 +1,10 @@
1
1
  import type { WatchAction } from "#dms-core/app/types/watch";
2
- import { isString, isNumber, isBoolean, isObject } from "#dms-core/app/utils/type-check";
2
+ import {
3
+ isString,
4
+ isNumber,
5
+ isBoolean,
6
+ isObject,
7
+ } from "#dms-core/app/utils/type-check";
3
8
 
4
9
  /** What a `SetFieldValue` watch writes, and where. */
5
10
  export interface SetFieldValueParams {
@@ -10,7 +15,7 @@ export interface SetFieldValueParams {
10
15
 
11
16
  /** The own member `key` of `source`, wrapped so that an absent one stays apart from an `undefined` one. */
12
17
  function ownMember(
13
- source: object,
18
+ source: NonNullable<WatchAction["params"]>,
14
19
  key: string,
15
20
  ): { value: unknown } | undefined {
16
21
  return isObject(source) && Object.hasOwn(source, key)
@@ -69,6 +74,18 @@ export interface FieldChangePayload {
69
74
  initial?: boolean;
70
75
  }
71
76
 
77
+ /** Whether a `FieldChange` event carries a payload of the shape the form sends. */
78
+ export function isFieldChangePayload(
79
+ data: unknown,
80
+ ): data is FieldChangePayload {
81
+ return (
82
+ isObject(data) &&
83
+ data !== null &&
84
+ (data.fieldId === undefined || isString(data.fieldId)) &&
85
+ (data.initial === undefined || isBoolean(data.initial))
86
+ );
87
+ }
88
+
72
89
  /** A value to write, or nothing to write. */
73
90
  export type FieldValueWrite = { value: unknown } | undefined;
74
91
 
@@ -1,5 +1,6 @@
1
1
  import { computed, onMounted, ref } from "vue";
2
2
  import { isString } from "#dms-core/app/utils/type-check";
3
+ import { detach } from "../detach";
3
4
  import type { FormProps } from "../../../composables/form/types/props";
4
5
  import type { DmsContainerContext } from "../containers/context";
5
6
 
@@ -35,7 +36,7 @@ export function formComponentCancel(source: FormCancelSource) {
35
36
  function cancelForm(): void {
36
37
  if (source.isDirty()) source.discardChanges();
37
38
  if (source.container) {
38
- void source.container.close();
39
+ detach(source.container.close());
39
40
  return;
40
41
  }
41
42
  if (previousAppPage()) {
@@ -5,6 +5,7 @@ import type {
5
5
  useForm,
6
6
  } from "../../../composables/form/useForm";
7
7
  import { fieldErrorPattern } from "./formEntryContext";
8
+ import { detach } from "../detach";
8
9
  import {
9
10
  changedServerErrorFields,
10
11
  keptServerErrors,
@@ -60,7 +61,7 @@ export function formComponentErrors(source: FormErrorsSource) {
60
61
  });
61
62
  }
62
63
  showsErrorSummary.value = shown.length > 0;
63
- void source.focusField(target.errors[0]?.name);
64
+ detach(source.focusField(target.errors[0]?.name));
64
65
  return shown.length > 0;
65
66
  }
66
67
 
@@ -68,7 +69,7 @@ export function formComponentErrors(source: FormErrorsSource) {
68
69
  errors: Array<{ name?: string }>;
69
70
  }): void {
70
71
  showsErrorSummary.value = true;
71
- void source.focusField(event.errors[0]?.name);
72
+ detach(source.focusField(event.errors[0]?.name));
72
73
  }
73
74
 
74
75
  return {
@@ -1,4 +1,5 @@
1
1
  import { computed, onUnmounted, ref, watch } from "vue";
2
+ import { isObject, isString } from "#dms-core/app/utils/type-check";
2
3
  import type { useForm } from "../../../composables/form/useForm";
3
4
 
4
5
  const REALTIME_PRESENCE_FLAG = "_presence=1";
@@ -16,6 +17,29 @@ interface RealtimeFormContext {
16
17
  rowTopic: string;
17
18
  }
18
19
 
20
+ interface RowEvent {
21
+ type: string;
22
+ payload?: { ids?: string[] | null } | null;
23
+ actorId?: string | null;
24
+ }
25
+
26
+ const isNullish = (value: unknown): value is null | undefined =>
27
+ value === undefined || value === null;
28
+
29
+ const isRowEventPayload = (value: unknown): value is RowEvent["payload"] =>
30
+ isNullish(value) ||
31
+ (isObject(value) &&
32
+ (isNullish(value.ids) ||
33
+ (Array.isArray(value.ids) && value.ids.every(isString))));
34
+
35
+ /** Whether a realtime event has the fields a row topic's events carry. */
36
+ export const isRowEvent = (event: unknown): event is RowEvent =>
37
+ isObject(event) &&
38
+ event !== null &&
39
+ isString(event.type) &&
40
+ isRowEventPayload(event.payload) &&
41
+ (isNullish(event.actorId) || isString(event.actorId));
42
+
19
43
  interface FormRealtimeSource
20
44
  extends Pick<
21
45
  ReturnType<typeof useForm>,
@@ -98,14 +122,10 @@ export function formComponentRealtime(source: FormRealtimeSource) {
98
122
  (event) => {
99
123
  const ctx = realtimeContext.value;
100
124
  if (!ctx) return;
101
- const eventTyped = event as {
102
- type: string;
103
- payload?: { ids?: string[] };
104
- actorId?: string;
105
- };
106
- if (eventTyped.type !== REALTIME_EVENT_UPDATED) return;
107
- if (!eventTyped.payload?.ids?.includes(ctx.rowId)) return;
108
- if (eventTyped.actorId === realtimeUser.value?._id) return;
125
+ if (!isRowEvent(event)) return;
126
+ if (event.type !== REALTIME_EVENT_UPDATED) return;
127
+ if (!event.payload?.ids?.includes(ctx.rowId)) return;
128
+ if (event.actorId === realtimeUser.value?._id) return;
109
129
  showConcurrentEditBanner.value = true;
110
130
  },
111
131
  );
@@ -1,5 +1,6 @@
1
1
  import { computed, provide, reactive, toValue, watch } from "vue";
2
2
  import type { ZodErrorMap } from "zod";
3
+ import { isObject } from "#dms-core/app/utils/type-check";
3
4
  import {
4
5
  formIssueMessage,
5
6
  REQUIRED_MESSAGE,
@@ -48,10 +49,10 @@ export function formComponentValidation(source: FormValidationSource) {
48
49
  "~standard": {
49
50
  version: 1 as const,
50
51
  vendor: "dms",
51
- validate: (value: unknown) =>
52
+ validate: (value: Parameters<typeof validateFormState>[1][string]) =>
52
53
  validateFormState(
53
54
  schema,
54
- value as Parameters<typeof validateFormState>[1],
55
+ isObject(value) && value !== null ? value : {},
55
56
  {
56
57
  fields: validationFields,
57
58
  requiredMessage: source.processApiMessage(REQUIRED_MESSAGE),
@@ -101,11 +102,9 @@ export function formComponentValidation(source: FormValidationSource) {
101
102
  }
102
103
 
103
104
  /** Clears validation when a field becomes disabled or hidden. */
104
- export function watchFormComponentFieldFlags<
105
- T extends { clear: (name: string) => void },
106
- >(
105
+ export function watchFormComponentFieldFlags(
107
106
  fields: ReturnType<typeof useForm>["disabledFields"],
108
- target: () => T | null | undefined,
107
+ target: () => { clear: (name: string) => void } | null | undefined,
109
108
  ): void {
110
109
  watch(fields, (next, previous) => {
111
110
  if (!next || !target()) return;
@@ -17,9 +17,11 @@ import {
17
17
  import { apiErrorStatus } from "#dms-core/app/composables/useFieldErrors";
18
18
  import { HTTP_NOT_FOUND } from "#dms-core/app/utils/http-status";
19
19
  import { sameFormValue } from "../unsaved-changes/formValue";
20
+ import { isStringSet } from "./stringSet";
20
21
  import {
21
22
  type FieldValueComparer,
22
23
  buildValidationSchema,
24
+ cloneRecordValues,
23
25
  createBaseValidationSchema,
24
26
  createFieldValueComparer,
25
27
  flattenFields,
@@ -29,6 +31,10 @@ import {
29
31
  withConditionFields,
30
32
  } from "./useFormModel";
31
33
 
34
+ function stringSetOf(value: Parameters<typeof isStringSet>[0]) {
35
+ return isStringSet(value) ? value : undefined;
36
+ }
37
+
32
38
  function createFormState(props: FormProps) {
33
39
  const toast = useToast();
34
40
  const { $authFetch } = useAuthFetch();
@@ -95,14 +101,14 @@ function createFormState(props: FormProps) {
95
101
 
96
102
  const inactiveFields = computed(() =>
97
103
  withConditionFields(allFields.value, state.value, {
98
- disabled: state.value.disabledFields as Set<string> | undefined,
99
- hidden: state.value.hiddenFields as Set<string> | undefined,
104
+ disabled: stringSetOf(state.value.disabledFields),
105
+ hidden: stringSetOf(state.value.hiddenFields),
100
106
  }),
101
107
  );
102
108
  const disabledFields = computed(() => inactiveFields.value.disabled);
103
109
  const hiddenFields = computed(() => inactiveFields.value.hidden);
104
- const requiredFields = computed(
105
- () => state.value.requiredFields as Set<string> | undefined,
110
+ const requiredFields = computed(() =>
111
+ stringSetOf(state.value.requiredFields),
106
112
  );
107
113
 
108
114
  return {
@@ -131,7 +137,7 @@ function createFormState(props: FormProps) {
131
137
  /** @internal */
132
138
  export function createFormFields(props: FormProps) {
133
139
  const context = createFormState(props);
134
- const { presentError } = useApiErrorPresenter();
140
+ const presenter = useApiErrorPresenter();
135
141
  const {
136
142
  $authFetch,
137
143
  getDataType,
@@ -184,7 +190,7 @@ export function createFormFields(props: FormProps) {
184
190
  });
185
191
  initialValues.value = {
186
192
  ...initialValues.value,
187
- ...JSON.parse(JSON.stringify(fetchedData)),
193
+ ...cloneRecordValues(fetchedData),
188
194
  };
189
195
  return processBeforeStateMappers(
190
196
  fetchedData,
@@ -204,7 +210,9 @@ export function createFormFields(props: FormProps) {
204
210
  };
205
211
 
206
212
  const showFetchErrorToast = (error: Parameters<typeof apiErrorStatus>[0]) => {
207
- presentError(error, { fallbackKey: "dms.form.fetch_error_unknown" });
213
+ presenter.presentError(error, {
214
+ fallbackKey: "dms.form.fetch_error_unknown",
215
+ });
208
216
  };
209
217
 
210
218
  const baseSchema = createBaseValidationSchema(props.schema);
@@ -43,8 +43,10 @@ export interface FormValidationIssue {
43
43
  path: PropertyKey[];
44
44
  }
45
45
 
46
+ type StateValue = Parameters<typeof isBlankValue>[0];
47
+
46
48
  export type FormValidationResult =
47
- | { value: Record<string, unknown> }
49
+ | { value: Record<string, StateValue> }
48
50
  | { issues: FormValidationIssue[] };
49
51
 
50
52
  export interface FormValidationContext {
@@ -69,6 +71,13 @@ function issueField(issue: { path: PropertyKey[] }): PropertyKey | undefined {
69
71
  return issue.path[0];
70
72
  }
71
73
 
74
+ function ownStateValue(
75
+ state: Record<string, StateValue>,
76
+ id: string,
77
+ ): StateValue {
78
+ return Object.hasOwn(state, id) ? state[id] : undefined;
79
+ }
80
+
72
81
  /** Whether a localized value fills some language but not its fallback one. */
73
82
  function lacksFallbackLocale(
74
83
  field: FormValidationField,
@@ -135,7 +144,7 @@ function emptyValueOf(field: FormValidationField): false | null {
135
144
  */
136
145
  export async function validateFormState(
137
146
  schema: z.ZodObject<Record<string, z.ZodTypeAny>>,
138
- state: Record<string, unknown>,
147
+ state: Record<string, StateValue>,
139
148
  context: FormValidationContext,
140
149
  ): Promise<FormValidationResult> {
141
150
  const input = { ...state };
@@ -144,7 +153,7 @@ export async function validateFormState(
144
153
  const reported = context.controlErrors ?? new Map<string, string>();
145
154
 
146
155
  for (const field of context.fields) {
147
- const value = state[field.id];
156
+ const value = ownStateValue(state, field.id);
148
157
  if (reported.has(field.id)) continue;
149
158
  if (lacksFallbackLocale(field, value)) {
150
159
  missing.add(field.id);
@@ -1,5 +1,7 @@
1
+ import { cloneFormValue } from "./useFormModel";
2
+ import { isStringSet } from "./stringSet";
1
3
  import {
2
- type FieldChangePayload,
4
+ isFieldChangePayload,
3
5
  readFieldFlagParams,
4
6
  readSetFieldValueParams,
5
7
  resolveFieldValueWrite,
@@ -16,8 +18,8 @@ function createFieldSetMutator(stateKey: FieldSetStateKey, flagKey: string) {
16
18
  ) => {
17
19
  const params = readFieldFlagParams(action.params, flagKey);
18
20
  if (!params) return;
19
- const current =
20
- (componentState.value[stateKey] as Set<string>) || new Set();
21
+ const stored = componentState.value[stateKey];
22
+ const current = isStringSet(stored) ? stored : new Set<string>();
21
23
  const nextSet = new Set(current);
22
24
 
23
25
  if (params.flag) {
@@ -39,14 +41,11 @@ function setFieldValue(
39
41
  if (!params) return;
40
42
  const write = resolveFieldValueWrite(
41
43
  params,
42
- eventData.data as FieldChangePayload | undefined,
44
+ isFieldChangePayload(eventData.data) ? eventData.data : undefined,
43
45
  );
44
46
  if (!write) return;
45
47
 
46
- componentState.value[params.targetField] =
47
- write.value === undefined
48
- ? undefined
49
- : JSON.parse(JSON.stringify(write.value));
48
+ componentState.value[params.targetField] = cloneFormValue(write.value);
50
49
  }
51
50
 
52
51
  export function registerFormFunctions() {
@@ -0,0 +1,6 @@
1
+ import { isString } from "#dms-core/app/utils/type-check";
2
+
3
+ /** Whether `value` is a set of strings, such as the field ids a watch action collects. */
4
+ export function isStringSet(value: unknown): value is Set<string> {
5
+ return value instanceof Set && [...value].every(isString);
6
+ }
@@ -21,7 +21,12 @@ import type { useWatch } from "#dms-core/app/composables/watch/useWatch";
21
21
  import type { useComponentEvent } from "#dms-core/app/composables/components/useComponentEvent";
22
22
  import { resolveFieldErrors } from "#dms-core/app/composables/useFieldErrors";
23
23
  import { isBlankValue } from "#dms-core/app/composables/useFormValidation";
24
- import { isObject, isString } from "#dms-core/app/utils/type-check";
24
+ import {
25
+ isBoolean,
26
+ isNumber,
27
+ isObject,
28
+ isString,
29
+ } from "#dms-core/app/utils/type-check";
25
30
  import { isPlainObject, sameFormValue } from "../unsaved-changes/formValue";
26
31
  import { createStartingValueTracker } from "./fieldValueRule";
27
32
  import {
@@ -32,6 +37,7 @@ import {
32
37
  } from "../../utils/urlVariables";
33
38
 
34
39
  type FormState = ReturnType<typeof useWatch>["state"]["value"];
40
+ type StateValue = FormState[string];
35
41
  type ResetStateValues = Record<string, FormFieldValue | undefined>;
36
42
 
37
43
  const INTERNAL_STATE_KEYS = new Set([
@@ -40,11 +46,30 @@ const INTERNAL_STATE_KEYS = new Set([
40
46
  "requiredFields",
41
47
  ]);
42
48
 
43
- export function cloneFormValue(
44
- value: FormFieldValue | undefined,
45
- ): FormFieldValue | undefined {
49
+ function isFormFieldValue(value: unknown): value is FormFieldValue {
50
+ if (value === null || isString(value) || isNumber(value)) return true;
51
+ if (isBoolean(value)) return true;
52
+ if (Array.isArray(value)) return value.every(isFormFieldValue);
53
+ return isPlainObject(value) && Object.values(value).every(isFormFieldValue);
54
+ }
55
+
56
+ function parseClonedValue(json: string): FormFieldValue {
57
+ const parsed: unknown = JSON.parse(json);
58
+ if (!isFormFieldValue(parsed)) {
59
+ throw new TypeError("A JSON clone is not a form field value");
60
+ }
61
+ return parsed;
62
+ }
63
+
64
+ export function cloneFormValue(value: StateValue): FormFieldValue | undefined {
46
65
  if (value === undefined) return undefined;
47
- return JSON.parse(JSON.stringify(value));
66
+ return parseClonedValue(JSON.stringify(value));
67
+ }
68
+
69
+ /** The record a form loaded, cloned by value; what is not a plain record clones to none. */
70
+ export function cloneRecordValues(record: FormData): FormData {
71
+ const cloned = parseClonedValue(JSON.stringify(record));
72
+ return isPlainObject(cloned) ? { ...cloned } : {};
48
73
  }
49
74
 
50
75
  /** Whether a form has somewhere to save and an editable field, or is an action. */
@@ -59,7 +84,7 @@ export function formShowsActions(
59
84
  );
60
85
  }
61
86
 
62
- export function computeResetState(state: FormState, initialValues: FormData) {
87
+ export function computeResetState(state: FormState, initialValues: FormState) {
63
88
  const result: ResetStateValues = {};
64
89
  for (const key of Object.keys(state)) {
65
90
  if (INTERNAL_STATE_KEYS.has(key)) continue;
@@ -69,7 +94,11 @@ export function computeResetState(state: FormState, initialValues: FormData) {
69
94
  }
70
95
 
71
96
  export function snapshotFormState(state: FormState): FormData {
72
- return computeResetState(state, state as FormData) as FormData;
97
+ const snapshot: FormData = {};
98
+ for (const [key, value] of Object.entries(computeResetState(state, state))) {
99
+ if (value !== undefined) snapshot[key] = value;
100
+ }
101
+ return snapshot;
73
102
  }
74
103
 
75
104
  export function flattenFields(items: FormFieldOrGroup[]): FormField[] {
@@ -90,7 +119,9 @@ export function createBaseValidationSchema(
90
119
  /\.strict\(\)$/,
91
120
  ".passthrough()",
92
121
  );
93
- return new Function("z", `"use strict"; return (${zodCode})`)(z);
122
+ return zodObjectSchema.parse(
123
+ new Function("z", `"use strict"; return (${zodCode})`)(z),
124
+ );
94
125
  } catch {
95
126
  return z.object({});
96
127
  }
@@ -280,17 +311,30 @@ export function fieldValuesOfSubmitDefaults(
280
311
  return values;
281
312
  }
282
313
 
314
+ const zodTypeSchema = z.custom<z.ZodTypeAny>(
315
+ (value) => value instanceof z.ZodType,
316
+ );
317
+ const zodObjectSchema = z.custom<z.ZodObject<Record<string, z.ZodTypeAny>>>(
318
+ (value) => value instanceof z.ZodObject,
319
+ );
320
+
321
+ const parseZodType = (value: unknown): z.ZodTypeAny =>
322
+ zodTypeSchema.parse(value);
323
+
324
+ const parseZodTypes = (value: unknown): z.ZodTypeAny[] =>
325
+ z.array(zodTypeSchema).parse(value);
326
+
283
327
  export function makeFieldSchemaRequired(schema: z.ZodTypeAny): z.ZodTypeAny {
284
328
  if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable)
285
- return makeFieldSchemaRequired(schema.unwrap());
329
+ return makeFieldSchemaRequired(parseZodType(schema.unwrap()));
286
330
  if (schema instanceof z.ZodDefault)
287
- return makeFieldSchemaRequired(schema.removeDefault());
331
+ return makeFieldSchemaRequired(parseZodType(schema.removeDefault()));
288
332
  if (schema instanceof z.ZodUnion) {
289
- const nonNullOptions = schema.options.filter(
290
- (option: z.ZodTypeAny) => !(option instanceof z.ZodNull),
333
+ const nonNullOptions = parseZodTypes(schema.options).filter(
334
+ (option) => !(option instanceof z.ZodNull),
291
335
  );
292
336
  if (nonNullOptions.length === 1)
293
- return makeFieldSchemaRequired(nonNullOptions[0]);
337
+ return makeFieldSchemaRequired(nonNullOptions[0]!);
294
338
  return schema;
295
339
  }
296
340
  if (schema instanceof z.ZodString || schema instanceof z.ZodArray)
@@ -381,7 +425,7 @@ export function watchFieldChanges(
381
425
  ): void {
382
426
  if (!componentId) return;
383
427
  const id = componentId;
384
- const previousValuesJson: Record<string, string> = {};
428
+ const previousValuesJson = new Map<string, string>();
385
429
  const isInitial = createStartingValueTracker(isStartingValue);
386
430
  onMounted(() => {
387
431
  watch(() => state.value, sendChanges, { deep: true, immediate: true });
@@ -395,14 +439,14 @@ export function watchFieldChanges(
395
439
  } catch {
396
440
  newJson = String(newState[fieldId]);
397
441
  }
398
- if (newJson !== previousValuesJson[fieldId]) {
442
+ if (newJson !== previousValuesJson.get(fieldId)) {
399
443
  sendComponentEvent(FormEvents.FIELD_CHANGE, id, {
400
444
  fieldId,
401
445
  value: newState[fieldId],
402
446
  formValues: newState,
403
447
  initial: isInitial(fieldId, newState[fieldId]),
404
448
  });
405
- previousValuesJson[fieldId] = newJson;
449
+ previousValuesJson.set(fieldId, newJson);
406
450
  }
407
451
  }
408
452
  }