@antelopejs/dms 0.20.3 → 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 (180) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
  3. package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
  4. package/dist/mcp/page-verify/index.d.ts +1 -0
  5. package/dist/mcp/page-verify/index.js +1 -0
  6. package/dist/mcp/page-verify/index.js.map +1 -1
  7. package/dist/mcp/page-verify/redact-report.d.ts +2 -0
  8. package/dist/mcp/page-verify/redact-report.js +120 -0
  9. package/dist/mcp/page-verify/redact-report.js.map +1 -0
  10. package/dist/mcp/page-verify/render.js +4 -1
  11. package/dist/mcp/page-verify/render.js.map +1 -1
  12. package/dist/mcp/redact.d.ts +87 -0
  13. package/dist/mcp/redact.js +139 -0
  14. package/dist/mcp/redact.js.map +1 -0
  15. package/dist/mcp/tools/builder-compose.js +11 -2
  16. package/dist/mcp/tools/builder-compose.js.map +1 -1
  17. package/dist/mcp/tools/builder-project.js +56 -23
  18. package/dist/mcp/tools/builder-project.js.map +1 -1
  19. package/dist/mcp/tools/builder-queries.js +41 -4
  20. package/dist/mcp/tools/builder-queries.js.map +1 -1
  21. package/dist/mcp/tools/builder-shared.d.ts +3 -1
  22. package/dist/mcp/tools/builder-shared.js +5 -0
  23. package/dist/mcp/tools/builder-shared.js.map +1 -1
  24. package/dist/mcp/tools/database.js +3 -2
  25. package/dist/mcp/tools/database.js.map +1 -1
  26. package/dist/mcp/tools/page-verify.js +3 -2
  27. package/dist/mcp/tools/page-verify.js.map +1 -1
  28. package/frontend-vue/eslint-globals.generated.mjs +259 -942
  29. package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
  30. package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
  31. package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
  32. package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
  33. package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
  34. package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
  35. package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
  36. package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
  37. package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
  38. package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
  39. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
  40. package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
  41. package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
  42. package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
  43. package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
  44. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
  45. package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
  46. package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
  47. package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
  48. package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
  49. package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
  50. package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
  51. package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
  52. package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
  53. package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
  54. package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
  55. package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
  56. package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
  57. package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
  58. package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
  59. package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
  60. package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
  61. package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
  62. package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
  63. package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
  64. package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
  65. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
  66. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
  67. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
  68. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
  69. package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
  70. package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
  71. package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
  72. package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
  73. package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
  74. package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
  75. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
  76. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
  77. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
  78. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
  79. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
  80. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
  81. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
  82. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
  83. package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
  84. package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
  85. package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
  86. package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
  87. package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
  88. package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
  89. package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
  90. package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
  91. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
  92. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
  93. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
  94. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
  95. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
  96. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
  97. package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
  98. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
  99. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
  100. package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
  101. package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
  102. package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
  103. package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
  104. package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
  105. package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
  106. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
  107. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
  108. package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
  109. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
  110. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
  111. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
  112. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
  113. package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
  114. package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
  115. package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
  116. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
  117. package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
  118. package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
  119. package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
  120. package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
  121. package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
  122. package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
  123. package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
  124. package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
  125. package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
  126. package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
  127. package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
  128. package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
  129. package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
  130. package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
  131. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
  132. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
  133. package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
  134. package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
  135. package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
  136. package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
  137. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
  138. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
  139. package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
  140. package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
  141. package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
  142. package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
  143. package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
  144. package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
  145. package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
  146. package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
  147. package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
  148. package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
  149. package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
  150. package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
  151. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
  152. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
  153. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
  154. package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
  155. package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
  156. package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
  157. package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
  158. package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
  159. package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
  160. package/frontend-vue/package.json +2 -1
  161. package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
  162. package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
  163. package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
  164. package/frontend-vue/scripts/check-dms-components.mjs +152 -246
  165. package/frontend-vue/scripts/check-invariants.mjs +100 -42
  166. package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
  167. package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
  168. package/frontend-vue/scripts/dms-components-script.mjs +375 -0
  169. package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
  170. package/frontend-vue/scripts/jsconfig.json +10 -0
  171. package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
  172. package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
  173. package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
  174. package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
  175. package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
  176. package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
  177. package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
  178. package/frontend-vue/scripts/test-dms-components.mjs +51 -2
  179. package/package.json +1 -1
  180. package/frontend-vue/eslint-test-quality.mjs +0 -62
@@ -139,13 +139,35 @@ function applyMixedSeriesDefs(
139
139
  }
140
140
 
141
141
  const RANGE_AREA_APEX_TYPE = "rangeArea";
142
+ const FALLBACK_APEX_TYPE = "line";
143
+
144
+ const DMS_APEX_TYPES = [
145
+ "line",
146
+ "area",
147
+ "rangeArea",
148
+ "bar",
149
+ "scatter",
150
+ "donut",
151
+ "pie",
152
+ "radar",
153
+ "radialBar",
154
+ "heatmap",
155
+ "candlestick",
156
+ ] as const satisfies ReadonlyArray<
157
+ NonNullable<NonNullable<ApexOptions["chart"]>["type"]>
158
+ >;
159
+
160
+ function isDmsApexType(
161
+ value: string,
162
+ ): value is (typeof DMS_APEX_TYPES)[number] {
163
+ return DMS_APEX_TYPES.some((type) => type === value);
164
+ }
142
165
 
143
166
  function resolveApexType(
144
167
  input: UseApexChartInput,
145
168
  ): NonNullable<NonNullable<ApexOptions["chart"]>["type"]> {
146
- const baseType = APEX_TYPE_CONFIGS[input.type].apexType as NonNullable<
147
- NonNullable<ApexOptions["chart"]>["type"]
148
- >;
169
+ const configured = APEX_TYPE_CONFIGS[input.type].apexType;
170
+ const baseType = isDmsApexType(configured) ? configured : FALLBACK_APEX_TYPE;
149
171
  if (input.type !== "mixed") return baseType;
150
172
  const hasRangeBand = input.seriesDefs?.some(
151
173
  (def) => def.type === RANGE_AREA_APEX_TYPE,
@@ -289,7 +311,8 @@ function applyDatetimeBuckets(
289
311
  options.tooltip = {
290
312
  ...tooltip,
291
313
  x: {
292
- formatter: (value: unknown) => bucketTooltip(String(value ?? "")),
314
+ formatter: (value: string | number | null | undefined) =>
315
+ bucketTooltip(String(value ?? "")),
293
316
  },
294
317
  };
295
318
  }
@@ -1,3 +1,4 @@
1
+ import type ApexCharts from "apexcharts";
1
2
  import type { ComputedRef } from "vue";
2
3
  import type { RawOptionSection } from "../../build/composables/chart/apexRawOptions";
3
4
  import type {
@@ -25,8 +26,8 @@ export interface ApexClickOpts {
25
26
  }
26
27
 
27
28
  export type ApexClickHandler = (
28
- event: unknown,
29
- ctx: unknown,
29
+ event: MouseEvent,
30
+ ctx: ApexCharts,
30
31
  opts: ApexClickOpts,
31
32
  ) => void;
32
33
 
@@ -1,4 +1,5 @@
1
1
  import { isFunction } from "../../../../dms-core/app/utils/type-check";
2
+ import type { JsonValue } from "../../../../dms-core/app/types/json";
2
3
  import {
3
4
  computed,
4
5
  getCurrentScope,
@@ -33,7 +34,7 @@ export interface UseChartFetchOptions<T> {
33
34
  fetchUrlMethod?: string;
34
35
  periodScope?: string;
35
36
  realtimeTopic?: string | string[];
36
- watchSource?: () => unknown;
37
+ watchSource?: () => JsonValue | undefined;
37
38
  staticData?: T | null | (() => T | null);
38
39
  }
39
40
 
@@ -259,9 +260,7 @@ export function useChartFetch<T>(
259
260
  function useStaticChartData<T>(
260
261
  options: UseChartFetchOptions<T>,
261
262
  ): UseChartFetchReturn<T> {
262
- const data = ref<T | null>(
263
- readStaticData(options.staticData),
264
- ) as Ref<T | null>;
263
+ const data = shallowRef<T | null>(readStaticData(options.staticData));
265
264
  if (isFunction(options.staticData))
266
265
  watch(
267
266
  () => readStaticData(options.staticData),
@@ -2,6 +2,7 @@ import type { VNodeChild } from "vue";
2
2
  import type {
3
3
  ConfirmDialog,
4
4
  ConfirmDialogColor,
5
+ ConfirmDialogField,
5
6
  ConfirmDialogImpact,
6
7
  } from "#dms-core/app/types/confirm-dialog";
7
8
 
@@ -17,7 +18,10 @@ export type ConfirmBodyRender = () => VNodeChild;
17
18
  export type ConfirmImpact = ConfirmDialogImpact;
18
19
 
19
20
  /** The values the dialog's fields hold when the user confirms. */
20
- export type ConfirmValues = Record<string, unknown>;
21
+ export type ConfirmValues = Record<
22
+ ConfirmDialogField["id"],
23
+ ConfirmDialogField["defaultValue"]
24
+ >;
21
25
 
22
26
  /**
23
27
  * A confirmation dialog as `useConfirm()` opens it: a {@link ConfirmDialog}
@@ -48,11 +48,11 @@ function openWhenMenusClosed(open: () => void): () => void {
48
48
  * the body component raw so Vue keeps it as-is, and expose the open `result`
49
49
  * promise together with a programmatic `close`.
50
50
  */
51
- export function openDynamicContainer<Result, Options extends ContainerOptions>(
51
+ export function openDynamicContainer<Result>(
52
52
  overlay: Overlay,
53
53
  container: Component,
54
54
  idPrefix: string,
55
- options: Options,
55
+ options: ContainerOptions,
56
56
  ): ContainerInstance<Result> {
57
57
  const { component, headerComponent, containerId, ...rest } = options;
58
58
  const instance = overlay.create(container, {
@@ -65,11 +65,11 @@ export function openDynamicContainer<Result, Options extends ContainerOptions>(
65
65
  });
66
66
 
67
67
  let opened = false;
68
- let resolveResult!: (value: Result) => void;
68
+ let resolveResult!: (value: Result | undefined) => void;
69
69
  let rejectResult!: Parameters<
70
- ConstructorParameters<typeof Promise<Result>>[0]
70
+ ConstructorParameters<typeof Promise<Result | undefined>>[0]
71
71
  >[1];
72
- const result = new Promise<Result>((resolve, reject) => {
72
+ const result = new Promise<Result | undefined>((resolve, reject) => {
73
73
  resolveResult = resolve;
74
74
  rejectResult = reject;
75
75
  });
@@ -88,7 +88,7 @@ export function openDynamicContainer<Result, Options extends ContainerOptions>(
88
88
  } else {
89
89
  cancelPendingOpen();
90
90
  instance.close(value);
91
- resolveResult(value as Result);
91
+ resolveResult(value);
92
92
  }
93
93
  },
94
94
  };
@@ -123,7 +123,7 @@ export interface ModalOptions extends ContainerOptions {
123
123
  * changes it in place.
124
124
  */
125
125
  export interface ContainerInstance<Result = unknown> {
126
- result: Promise<Result>;
126
+ result: Promise<Result | undefined>;
127
127
  close: (result?: Result) => void;
128
128
  /** Updates the open container: its texts, or its body's options and key. */
129
129
  patch: (options: ContainerPatch) => void;
@@ -40,10 +40,7 @@ export function useDrawer() {
40
40
  let title = options.title;
41
41
  let header: DrawerRowHeader | undefined = rowHeader;
42
42
  const headerProps = () => header && drawerRowHeaderProps(header, title);
43
- const instance = openDynamicContainer<
44
- Result,
45
- DrawerOptions & DrawerCallerContext
46
- >(overlay, DynamicDrawer, DRAWER_ID_PREFIX, {
43
+ const drawerOptions: DrawerOptions & DrawerCallerContext = {
47
44
  ...containerOptions,
48
45
 
49
46
  callerProvides: DMS_OWN_DRAWER in options ? undefined : caller?.provides,
@@ -55,7 +52,13 @@ export function useDrawer() {
55
52
  options.sizeKey ??
56
53
  options.containerId ??
57
54
  componentSizeKey(options.component),
58
- });
55
+ };
56
+ const instance = openDynamicContainer<Result>(
57
+ overlay,
58
+ DynamicDrawer,
59
+ DRAWER_ID_PREFIX,
60
+ drawerOptions,
61
+ );
59
62
  if (!rowHeader) {
60
63
  return {
61
64
  ...instance,
@@ -15,7 +15,7 @@ export function useModal() {
15
15
  function open<Result = unknown>(
16
16
  options: ModalOptions,
17
17
  ): ContainerInstance<Result> {
18
- return openDynamicContainer<Result, ModalOptions>(
18
+ return openDynamicContainer<Result>(
19
19
  overlay,
20
20
  DynamicModal,
21
21
  MODAL_ID_PREFIX,
@@ -1,4 +1,7 @@
1
+ import type { jsonSchemaToZod } from "json-schema-to-zod";
1
2
  import type { FormFieldOrGroup, FormSection, FormSectionNav } from "./field";
3
+ import type { FormSubmitResponse } from "./api";
4
+ import type { FormData } from "./value";
2
5
  import type { validateFormState } from "../../../build/composables/form/formValidation";
3
6
  import type {
4
7
  FormKind,
@@ -51,9 +54,9 @@ export interface FormProps extends FormComponentProps {
51
54
  backTo?: string;
52
55
  successMessage?: string;
53
56
  errorMessage?: string;
54
- schema?: Record<string, unknown>;
57
+ schema?: Parameters<typeof jsonSchemaToZod>[0];
55
58
  watchActions?: WatchAction[];
56
- onSuccessCallback?: (response?: unknown, data?: unknown) => void;
59
+ onSuccessCallback?: (response?: FormSubmitResponse, data?: FormData) => void;
57
60
  fieldsOrientation?: "horizontal" | "vertical";
58
61
  submitDefaults?: Record<
59
62
  string,
@@ -1,19 +1,24 @@
1
1
  import type { FormSubmitEvent } from "@nuxt/ui";
2
2
  import { nextTick } from "vue";
3
- import type { FormProps, FormSubmitResponse } from "./types";
3
+ import type { FormFetchResponse, FormProps, FormSubmitResponse } from "./types";
4
4
  import { FormEvents } from "./types/events";
5
- import type { FormData } from "./types/value";
5
+ import type { FormData, FormFieldValue } from "./types/value";
6
6
  import { isFieldGroup } from "./types/field";
7
7
  import { resolveResponseToast } from "../../build/utils/responseWarning";
8
- import {
9
- type ReplaceUrlVariablesContext,
10
- resolveLinkVariables,
11
- } from "../../build/utils/urlVariables";
8
+ import { isJsonObject } from "../../build/utils/json";
9
+ import { resolveLinkVariables } from "../../build/utils/urlVariables";
12
10
  import type { I18nTranslate } from "#dms-core/app/composables/translation/useTranslation";
13
- import { isNumber } from "#dms-core/app/utils/type-check";
11
+ import {
12
+ isNull,
13
+ isNumber,
14
+ isObject,
15
+ isString,
16
+ isUndefined,
17
+ } from "#dms-core/app/utils/type-check";
14
18
  import { isPlainObject } from "../../build/composables/unsaved-changes/formValue";
15
19
  import { createFormFields } from "../../build/composables/form/formState";
16
20
  import {
21
+ cloneFormValue,
17
22
  collectSubmitData,
18
23
  computeResetState,
19
24
  processBeforeStateMappers,
@@ -59,11 +64,37 @@ export type SubmitTarget =
59
64
  /** A toast a submit response asks for, on top of the success one. */
60
65
  interface FormSubmitNotice {
61
66
  title: string;
62
- description?: string;
67
+ description?: string | null;
63
68
  /** Toast color; info by default. */
64
- color?: string;
69
+ color?: string | null;
65
70
  /** Translation parameters; a numeric count pluralizes the text. */
66
- params?: Parameters<I18nTranslate>[1];
71
+ params?: Parameters<I18nTranslate>[1] | null;
72
+ }
73
+
74
+ function isFormSubmitNotice(value: unknown): value is FormSubmitNotice {
75
+ if (!isObject(value) || isNull(value)) return false;
76
+ const { title, description, color, params } = value;
77
+ return (
78
+ isString(title) &&
79
+ [description, color].every(
80
+ (text) => isUndefined(text) || isNull(text) || isString(text),
81
+ ) &&
82
+ (isUndefined(params) || isObject(params))
83
+ );
84
+ }
85
+
86
+ /** What a submit answers: its outcome, and the saved record's fields when the route returns them. */
87
+ type FormSubmitAnswer = FormSubmitResponse & FormFetchResponse;
88
+
89
+ /** The entries of `values` that hold a value, as JSON keeps them. */
90
+ function definedValues(
91
+ values: Record<string, FormFieldValue | undefined>,
92
+ ): FormData {
93
+ const result: FormData = {};
94
+ for (const [key, value] of Object.entries(values)) {
95
+ if (value !== undefined) result[key] = value;
96
+ }
97
+ return result;
67
98
  }
68
99
 
69
100
  /** A server error shown under its field, translated. */
@@ -92,7 +123,7 @@ function createFormNotices(
92
123
  context: ReturnType<typeof createFormFields>,
93
124
  options: UseFormOptions,
94
125
  ) {
95
- const { presentError, resolveError } = useApiErrorPresenter();
126
+ const presenter = useApiErrorPresenter();
96
127
  const {
97
128
  props,
98
129
  toast,
@@ -129,10 +160,9 @@ function createFormNotices(
129
160
  };
130
161
 
131
162
  /** Shows a server-authored notice next to the ordinary success toast. */
132
- const showSubmitNotice = (response: FormSubmitResponse | undefined) => {
133
- const notice = (response as { notice?: FormSubmitNotice } | undefined)
134
- ?.notice;
135
- if (!notice?.title) return;
163
+ const showSubmitNotice = (response: FormSubmitAnswer | undefined) => {
164
+ const notice = response?.notice;
165
+ if (!isFormSubmitNotice(notice) || !notice.title) return;
136
166
  toast.add({
137
167
  title: noticeText(notice.title, notice.params),
138
168
  description: notice.description
@@ -157,13 +187,13 @@ function createFormNotices(
157
187
  name: entry.field,
158
188
  message: entry.values?.length
159
189
  ? t("dms.field_errors.with_values", {
160
- message: resolveError(entry.message, {
190
+ message: presenter.resolveError(entry.message, {
161
191
  fallbackKey: entry.fallbackKey ?? "dms.field_errors.invalid",
162
192
  params: entry.params,
163
193
  })?.message,
164
194
  values: entry.values.join(", "),
165
195
  })
166
- : (resolveError(entry.message, {
196
+ : (presenter.resolveError(entry.message, {
167
197
  fallbackKey: entry.fallbackKey ?? "dms.field_errors.invalid",
168
198
  params: entry.params,
169
199
  })?.message ?? ""),
@@ -173,8 +203,10 @@ function createFormNotices(
173
203
  );
174
204
  };
175
205
 
176
- const showSubmitErrorToast = (error: EventError) => {
177
- presentError(error, {
206
+ const showSubmitErrorToast = (
207
+ error: Parameters<typeof presenter.presentError>[0],
208
+ ) => {
209
+ presenter.presentError(error, {
178
210
  fallbackKey: props.errorMessage || "dms.form.error_unknown",
179
211
  });
180
212
  };
@@ -182,7 +214,7 @@ function createFormNotices(
182
214
  return {
183
215
  ...context,
184
216
  options,
185
- presentError,
217
+ presenter,
186
218
  showSubmitSuccessToast,
187
219
  showSubmitNotice,
188
220
  showServerFieldErrors,
@@ -206,14 +238,14 @@ function createSavedForm(context: ReturnType<typeof createFormNotices>) {
206
238
  /** Puts every field back to the value it opened with. */
207
239
  const restoreInitialValues = (): void => {
208
240
  const restored = computeResetState(state.value, initialValues.value);
209
- Object.assign(
210
- state.value,
211
- processBeforeStateMappers(
212
- restored as FormData,
241
+ Object.assign(state.value, {
242
+ ...restored,
243
+ ...processBeforeStateMappers(
244
+ definedValues(restored),
213
245
  props.fields ?? [],
214
246
  getDataType,
215
247
  ),
216
- );
248
+ });
217
249
  };
218
250
 
219
251
  /** Marks values clean before the accepted submit emits its success event. */
@@ -248,19 +280,26 @@ function createSavedForm(context: ReturnType<typeof createFormNotices>) {
248
280
 
249
281
  /** Uses response fields as the saved record, otherwise re-reads fetchUrl. */
250
282
  const showSavedRecord = async (
251
- response: FormSubmitResponse | undefined,
283
+ response: FormSubmitAnswer | undefined,
252
284
  ): Promise<void> => {
253
285
  if (!submitSucceeded.value) return;
254
286
  const fieldIds = new Set(allFields.value.map((field) => field.id));
255
287
  const record: FormData = isPlainObject(response)
256
- ? (Object.fromEntries(
288
+ ? Object.fromEntries(
257
289
  Object.entries(response).filter(([key]) => fieldIds.has(key)),
258
- ) as FormData)
290
+ )
259
291
  : {};
260
292
  if (Object.keys(record).length === 0) return refreshSavedRecord();
261
293
  initialValues.value = {
262
294
  ...initialValues.value,
263
- ...JSON.parse(JSON.stringify(record)),
295
+ ...definedValues(
296
+ Object.fromEntries(
297
+ Object.entries(record).map(([key, value]) => [
298
+ key,
299
+ cloneFormValue(value),
300
+ ]),
301
+ ),
302
+ ),
264
303
  };
265
304
  await applyStoredRecord(
266
305
  processBeforeStateMappers(record, props.fields ?? [], getDataType),
@@ -273,7 +312,7 @@ function createSavedForm(context: ReturnType<typeof createFormNotices>) {
273
312
  function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
274
313
  const {
275
314
  props,
276
- presentError,
315
+ presenter,
277
316
  buildUrlContext,
278
317
  showSubmitSuccessToast,
279
318
  showSubmitNotice,
@@ -284,7 +323,7 @@ function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
284
323
  } = context;
285
324
 
286
325
  const handleSubmitSuccess = async (
287
- response: FormSubmitResponse | undefined,
326
+ response: FormSubmitAnswer | undefined,
288
327
  plainData: FormData,
289
328
  ) => {
290
329
  showSubmitSuccessToast(response);
@@ -293,14 +332,14 @@ function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
293
332
  if (props.redirectOnSuccess) {
294
333
  const target = resolveLinkVariables(
295
334
  props.redirectOnSuccess,
296
- buildUrlContext(response as ReplaceUrlVariablesContext["response"]),
335
+ buildUrlContext(isJsonObject(response) ? response : undefined),
297
336
  );
298
337
  await navigateDms(target);
299
338
  }
300
339
  };
301
340
 
302
341
  const showUnresolvedTargetToast = () => {
303
- presentError(null, { fallbackKey: "dms.form.error_no_target" });
342
+ presenter.presentError(null, { fallbackKey: "dms.form.error_no_target" });
304
343
  };
305
344
 
306
345
  /** Sends through submit events, marking accepted data clean before success. */
@@ -308,11 +347,11 @@ function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
308
347
  submitUrl: string,
309
348
  body: FormData,
310
349
  onAccepted?: () => void,
311
- ): Promise<FormSubmitResponse | undefined> => {
312
- let submitResponse: FormSubmitResponse | undefined;
350
+ ): Promise<FormSubmitAnswer | undefined> => {
351
+ let submitResponse: FormSubmitAnswer | undefined;
313
352
  await executeSubmit(
314
353
  () =>
315
- $authFetch<FormSubmitResponse>(submitUrl, {
354
+ $authFetch<FormSubmitAnswer>(submitUrl, {
316
355
  method: props.submitUrlMethod || "PUT",
317
356
  body,
318
357
  headers: { [CONTENT_LANGUAGE_HEADER]: "*" },
@@ -326,7 +365,7 @@ function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
326
365
  successPayload: (response) => ({ data: body, response, submitUrl }),
327
366
  errorPayload: (error) => ({
328
367
  data: body,
329
- error: (error as EventError).data || (error as EventError).message,
368
+ error: isObject(error) ? error.data || error.message : undefined,
330
369
  }),
331
370
  },
332
371
  );
@@ -338,7 +377,7 @@ function createFormSubmission(context: ReturnType<typeof createSavedForm>) {
338
377
  error: Parameters<typeof resolveFormFieldErrors>[0],
339
378
  ): void => {
340
379
  if (!showServerFieldErrors(error)) {
341
- showSubmitErrorToast(error as EventError);
380
+ showSubmitErrorToast(error);
342
381
  }
343
382
  };
344
383
 
@@ -403,7 +442,9 @@ function createFormActions(context: ReturnType<typeof createFormSubmission>) {
403
442
  };
404
443
 
405
444
  /** Saves only changed fields without success toasts, rejecting refused saves. */
406
- const submitChanges = async (changes: FormData): Promise<void> => {
445
+ const submitChanges = async (
446
+ changes: Parameters<typeof snapshotFormState>[0],
447
+ ): Promise<void> => {
407
448
  const target = resolveSubmitTarget(props.submitUrl, buildUrlContext());
408
449
  if ("missing" in target) {
409
450
  showUnresolvedTargetToast();
@@ -77,7 +77,7 @@ export function usePageLiveRefresh(
77
77
  useIdleRefresh(
78
78
  options.idleRefresh * MS_PER_SECOND,
79
79
  () => lastReadAt,
80
- gate.trigger,
80
+ () => gate.trigger(),
81
81
  );
82
82
  }
83
83
  return {
@@ -5,14 +5,21 @@ function normalizeComponentName(name: string): string {
5
5
  return name.toLowerCase().replace(/[^a-z0-9]/g, "");
6
6
  }
7
7
 
8
+ function isRegistered(
9
+ components: Record<string, Component>,
10
+ key: string,
11
+ ): boolean {
12
+ return Object.hasOwn(components, key) && !!components[key];
13
+ }
14
+
8
15
  function findRegistryKey(
9
16
  name: string,
10
17
  components: Record<string, Component>,
11
18
  ): string | undefined {
12
- if (components[name]) return name;
19
+ if (isRegistered(components, name)) return name;
13
20
 
14
21
  const pascal = capitalize(camelize(name));
15
- if (components[pascal]) return pascal;
22
+ if (isRegistered(components, pascal)) return pascal;
16
23
 
17
24
  const normalized = normalizeComponentName(name);
18
25
  for (const key of Object.keys(components)) {
@@ -90,9 +90,9 @@ export function useTab(
90
90
  const goToFirstTab = () => goToTab(0);
91
91
  const goToLastTab = () => goToTab(totalTabs.value - 1);
92
92
 
93
- const resetTabs = () => {
93
+ const resetTabs = async () => {
94
94
  activeTab.value = "0";
95
- updateUrl("0");
95
+ await updateUrl("0");
96
96
  };
97
97
 
98
98
  watch(activeTab, async (newTab, oldTab) => {
@@ -30,9 +30,9 @@ export function createTableViewShiftAShortcut<T extends Data>(
30
30
  const rowIdKey = tableProps.value.rowIdKey ?? DEFAULT_ROW_ID_KEY;
31
31
  const newSelection: RowSelectionState = {};
32
32
  data.value.results.forEach((row: T) => {
33
- const id = get(row, rowIdKey);
33
+ const id: unknown = get(row, rowIdKey);
34
34
  if (id) {
35
- newSelection[id] = true;
35
+ newSelection[String(id)] = true;
36
36
  }
37
37
  });
38
38
  rowSelect.value = { ...rowSelect.value, ...newSelection };
@@ -1,3 +1,4 @@
1
+ import type { JsonValue } from "#dms-core/app/types/json";
1
2
  import type { DrawerDirection } from "../../containers/types";
2
3
 
3
4
  /** What a side panel says on a row that is gone (backend `SidePanelNotFoundTexts`). */
@@ -84,7 +85,7 @@ export type ActionTarget =
84
85
  url: string;
85
86
  method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
86
87
  /** JSON body sent with the request. */
87
- body?: Record<string, unknown>;
88
+ body?: Record<string, JsonValue>;
88
89
  /** Field of the JSON response copied to the clipboard on success. */
89
90
  copy?: string;
90
91
  successMessage: string;
@@ -1,3 +1,5 @@
1
+ import type { JsonValue } from "#dms-core/app/types/json";
2
+
1
3
  export enum AccessMode {
2
4
  ReadOnly = 1,
3
5
  WriteOnly = 2,
@@ -20,7 +22,7 @@ export interface ReadonlyBehavior {
20
22
  export interface TableViewColumnDisplay {
21
23
  /** Id of the frontend data type drawing the cells. */
22
24
  type: string;
23
- options?: Record<string, unknown>;
25
+ options?: Record<string, JsonValue>;
24
26
  }
25
27
 
26
28
  export interface TableViewColumn {
@@ -1,4 +1,5 @@
1
1
  import type { Component } from "vue";
2
+ import type { JsonValue } from "#dms-core/app/types/json";
2
3
  import type { Table } from "@tanstack/vue-table";
3
4
  import type { TableViewColumn } from "./column";
4
5
  import type { CustomRowAction } from "../../../types/row-action";
@@ -161,6 +162,9 @@ export interface TableViewCardConfig {
161
162
  skeletonHeight?: string;
162
163
  }
163
164
 
165
+ /** A value of a display's per-instance options: the backend config's JSON, or a card config. */
166
+ type TableViewDisplayOptionValue = JsonValue | TableViewCardConfig | undefined;
167
+
164
168
  /**
165
169
  * The props a custom card component receives, the same in the `kanban` and
166
170
  * `cards` displays.
@@ -249,12 +253,12 @@ export interface TableViewDisplayContext<T = Data> {
249
253
  /** Data API location (`{location}/list`, `/get`, ...). Needed by self-managed displays. */
250
254
  location: string;
251
255
  /** Active filters/search/sort query (no limit/offset) — for self-managed fetching. */
252
- query: Record<string, unknown>;
256
+ query: Record<string, JsonValue>;
253
257
  /** Stable component/page identifiers, e.g. for per-instance fetch keys. */
254
258
  componentId?: string;
255
259
  pageId?: string;
256
260
  /** Per-instance options declared for this display in the backend config. */
257
- options?: Record<string, unknown>;
261
+ options?: Record<string, TableViewDisplayOptionValue>;
258
262
  /**
259
263
  * A self-managed display hands the rows it shows, in the order the user
260
264
  * reads them (a board: column by column), each time they change: a row
@@ -1,3 +1,5 @@
1
+ import { isObject } from "../../../../dms-core/app/utils/type-check";
2
+
1
3
  interface UseTableViewExportOptions {
2
4
  componentId?: string;
3
5
  }
@@ -26,9 +28,7 @@ export const useTableViewExport = (options: UseTableViewExportOptions = {}) => {
26
28
  runJob({
27
29
  startUrl: `${location}/export/start`,
28
30
  startMethod: "GET",
29
- startQuery: query as NonNullable<
30
- Parameters<typeof runJob>[0]["startQuery"]
31
- >,
31
+ startQuery: query,
32
32
  statusUrl: (ticket) => `${location}/export/status/${ticket.jobId}`,
33
33
  downloadUrl: (ticket) =>
34
34
  `${location}/export/download/${ticket.jobId}`,
@@ -40,8 +40,9 @@ export const useTableViewExport = (options: UseTableViewExportOptions = {}) => {
40
40
  query: queryRequest,
41
41
  ids,
42
42
  error:
43
- (error as { data?: string; message?: string })?.data ||
44
- (error as Error)?.message,
43
+ isObject(error) && error !== null
44
+ ? error.data || error.message
45
+ : undefined,
45
46
  }),
46
47
  },
47
48
  );
@@ -44,7 +44,7 @@ export interface UseUnsavedChangesReturn {
44
44
  function resolveElement(source: ElementSource): Element | null {
45
45
  if (!source) return null;
46
46
  if (source instanceof Element) return source;
47
- const element = source.$el;
47
+ const element: unknown = source.$el;
48
48
  return element instanceof Element ? element : null;
49
49
  }
50
50