@antelopejs/dms 0.20.8-next.940.gfa78ca1 → 0.20.8-next.941.g5ff1751

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 (69) hide show
  1. package/frontend-vue/eslint-globals.generated.mjs +25 -25
  2. package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +5 -3
  3. package/frontend-vue/layers/dms-core/app/build/utils/dataTypeValue.ts +49 -0
  4. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +23 -11
  5. package/frontend-vue/layers/dms-core/app/entries/utils/dataTypeValue.ts +1 -0
  6. package/frontend-vue/layers/dms-core/app/types/confirm-dialog.ts +2 -2
  7. package/frontend-vue/layers/dms-core/app/types/data-type.ts +31 -0
  8. package/frontend-vue/layers/dms-core/app/types/live.ts +3 -3
  9. package/frontend-vue/layers/dms-core/app/types/watch.ts +10 -1
  10. package/frontend-vue/layers/dms-core/app/utils/url-interpolation.ts +3 -4
  11. package/frontend-vue/layers/dms-ui/app/build/components/form/FormFieldControl.vue +2 -1
  12. package/frontend-vue/layers/dms-ui/app/build/components/form/FormFieldNotes.vue +2 -1
  13. package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +3 -2
  14. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardRowActions.vue +3 -2
  15. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +3 -2
  16. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -1
  17. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +7 -4
  18. package/frontend-vue/layers/dms-ui/app/build/composables/actions/bulkSelection.ts +2 -1
  19. package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowComponentOptions.ts +3 -5
  20. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +15 -14
  21. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +3 -2
  22. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +1 -1
  23. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultLinkTypes.ts +2 -1
  24. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +10 -4
  25. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +27 -19
  26. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +3 -2
  27. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +3 -2
  28. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +6 -8
  29. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/registerFieldTypes.ts +2 -1
  30. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationBadges.ts +9 -5
  31. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationFilter.ts +7 -6
  32. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +3 -1
  33. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +18 -15
  34. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +4 -3
  35. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -5
  36. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +2 -4
  37. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +18 -13
  38. package/frontend-vue/layers/dms-ui/app/build/composables/form/formEntryContext.ts +2 -3
  39. package/frontend-vue/layers/dms-ui/app/build/composables/form/keyValueRows.ts +15 -12
  40. package/frontend-vue/layers/dms-ui/app/build/composables/form/repeaterTable.ts +4 -3
  41. package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +36 -58
  42. package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +17 -18
  43. package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +8 -5
  44. package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
  45. package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/formatFilterValue.ts +6 -5
  46. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +2 -1
  47. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +3 -3
  48. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableListData.ts +6 -7
  49. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +12 -11
  50. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +4 -2
  51. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/compareValues.ts +9 -5
  52. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +13 -6
  53. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/pinnedRows.ts +3 -2
  54. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/quickFilters.ts +7 -6
  55. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +2 -1
  56. package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +14 -0
  57. package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +12 -4
  58. package/frontend-vue/layers/dms-ui/app/components/form/components/DisplayValue.vue +17 -2
  59. package/frontend-vue/layers/dms-ui/app/components/form/components/InputRelation.vue +6 -3
  60. package/frontend-vue/layers/dms-ui/app/components/form/components/KeyValue.vue +2 -3
  61. package/frontend-vue/layers/dms-ui/app/components/table-view/CascaderPath.vue +3 -2
  62. package/frontend-vue/layers/dms-ui/app/composables/form/types/field-saved.ts +2 -5
  63. package/frontend-vue/layers/dms-ui/app/composables/form/types/field.ts +2 -1
  64. package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +1 -5
  65. package/frontend-vue/layers/dms-ui/app/composables/form/types/value.ts +6 -9
  66. package/frontend-vue/layers/dms-ui/app/composables/table-view/kanban.ts +5 -3
  67. package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useFormDirty.ts +6 -2
  68. package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +2 -1
  69. package/package.json +2 -2
@@ -29,8 +29,8 @@ ColorModePreference ColorValue CommandPaletteAssistant
29
29
  CommandPaletteAssistantAnswerProps CommandPaletteAssistantSuggestion
30
30
  CommandPaletteSource ComparisonContext ComparisonStyle ComponentChild
31
31
  ComponentEventData ComponentId ComponentInfo ComponentOptionsData
32
- ComponentOrNoInput ComponentShortcuts ComposableText ComposedText
33
- ComposedTextContext ComposedTextCountParam ComposedTextDateFormat
32
+ ComponentOrNoInput ComponentShortcuts ComponentWatchState ComposableText
33
+ ComposedText ComposedTextContext ComposedTextCountParam ComposedTextDateFormat
34
34
  ComposedTextDateParam ComposedTextMoneyParam ComposedTextNumberFormat
35
35
  ComposedTextNumberParam ComposedTextParam ComposedTextParamType
36
36
  ComposedTextRelativeDateParam ComposedTextTranslate ComposedTextTypedParam
@@ -45,29 +45,29 @@ CustomButton CustomButtonVariant CustomRowAction CustomRowActionBulk
45
45
  CustomRowActionBulkOptions DEFAULT_CASCADER_KEY_MAPPING DEFAULT_COMPARISONS
46
46
  DEFAULT_KEYBOARD_PLATFORM DEFAULT_PAGE_HEADER_ACTIONS_ORDER DEFAULT_PAGE_ICON
47
47
  DEFAULT_PRESETS DEFAULT_TABLE_SEARCH_SHORTCUT Data DataType DataTypeConfig
48
- DataTypeFilterEditorValue DataTypeFormatter DataTypeSelectSource
49
- DataTypeValueComparer DateFormatPreference DatetimeBuckets
50
- DefaultComponentProps DevReload DmsMenuItem DonutRecord DownloadActionTarget
51
- DrawerDirection DrawerInstance DrawerOptions DrawerPatch DrawerRowHeader
52
- DrawerTargetOptions DurationFormatOptions DurationPrecision
53
- ENDPOINT_MODULES_LISTING ENDPOINT_STORE_LISTING END_OF_DAY_HOURS
54
- END_OF_DAY_MINUTES END_OF_DAY_MS END_OF_DAY_SECONDS EnclosingForm EventError
55
- Events ExportJobStatusResponse ExportJobTicket FIELD_KEY FIELD_OPERATORS
56
- FORM_CONTENT_LANGUAGE_KEY FORM_FIELD_LOADING_KEY FORM_FIELD_SAVED_KEY
57
- FORM_VALIDATOR_KEY FROM_ACCOUNTS_QUERY FavoritePage FavoritePageMetadata
58
- FavoritePageSource FavoriteRouteResolver FeedCounts FieldCondition
59
- FieldControl FieldEqualsRule FieldErrorAria FieldErrorCode
60
- FieldErrorResolution FieldGroup FieldInRule FieldNotEqualsRule FieldNotInRule
61
- FieldOperatorKey FieldRule FieldValueComparer FileConstraintViolation
62
- FileFieldConstraints FoldedCrumbs FooterLink FormData FormEvents
63
- FormFetchResponse FormField FormFieldBadge FormFieldLink FormFieldOrGroup
64
- FormFieldReadonly FormFieldValue FormFunctions FormProps FormSection
65
- FormSectionNav FormServerFieldError FormSubmitResponse FormValidator
66
- FormattedValueParts FrontendBreak FrontendRequirement FrontendVersionSource
67
- GROUPED_DISPLAY_ID HTTP_BAD_REQUEST HTTP_FORBIDDEN HTTP_INTERNAL_SERVER_ERROR
68
- HTTP_NOT_FOUND HTTP_PRECONDITION_FAILED HTTP_UNAUTHORIZED
69
- HandleApiErrorOptions HeaderAction HttpMethod I18nTranslate INVALID_REQUEST
70
- ImageItemValue ImageResizeBounds InputNumberAdjustment
48
+ DataTypeFilterEditorValue DataTypeFormatter DataTypeList DataTypeOptions
49
+ DataTypeRow DataTypeSelectSource DataTypeValue DataTypeValueComparer
50
+ DateFormatPreference DatetimeBuckets DefaultComponentProps DevReload
51
+ DmsMenuItem DonutRecord DownloadActionTarget DrawerDirection DrawerInstance
52
+ DrawerOptions DrawerPatch DrawerRowHeader DrawerTargetOptions
53
+ DurationFormatOptions DurationPrecision ENDPOINT_MODULES_LISTING
54
+ ENDPOINT_STORE_LISTING END_OF_DAY_HOURS END_OF_DAY_MINUTES END_OF_DAY_MS
55
+ END_OF_DAY_SECONDS EnclosingForm EventError Events ExportJobStatusResponse
56
+ ExportJobTicket FIELD_KEY FIELD_OPERATORS FORM_CONTENT_LANGUAGE_KEY
57
+ FORM_FIELD_LOADING_KEY FORM_FIELD_SAVED_KEY FORM_VALIDATOR_KEY
58
+ FROM_ACCOUNTS_QUERY FavoritePage FavoritePageMetadata FavoritePageSource
59
+ FavoriteRouteResolver FeedCounts FieldCondition FieldControl FieldEqualsRule
60
+ FieldErrorAria FieldErrorCode FieldErrorResolution FieldGroup FieldInRule
61
+ FieldNotEqualsRule FieldNotInRule FieldOperatorKey FieldRule
62
+ FieldValueComparer FileConstraintViolation FileFieldConstraints FoldedCrumbs
63
+ FooterLink FormData FormEvents FormFetchResponse FormField FormFieldBadge
64
+ FormFieldLink FormFieldOrGroup FormFieldReadonly FormFieldValue FormFunctions
65
+ FormProps FormSection FormSectionNav FormServerFieldError FormSubmitResponse
66
+ FormValidator FormattedValueParts FrontendBreak FrontendRequirement
67
+ FrontendVersionSource GROUPED_DISPLAY_ID HTTP_BAD_REQUEST HTTP_FORBIDDEN
68
+ HTTP_INTERNAL_SERVER_ERROR HTTP_NOT_FOUND HTTP_PRECONDITION_FAILED
69
+ HTTP_UNAUTHORIZED HandleApiErrorOptions HeaderAction HttpMethod I18nTranslate
70
+ INVALID_REQUEST ImageItemValue ImageResizeBounds InputNumberAdjustment
71
71
  InputNumberAdjustmentReason InterfaceImplementation InterfaceScale
72
72
  JsonPrimitive JsonValue KANBAN_DISPLAY_BRIDGE_KEY KANBAN_DISPLAY_ID
73
73
  KEYBOARD_KEY_LABELS KEYBOARD_PLATFORM_COOKIE KanbanColumnDef KanbanConfig
@@ -1,6 +1,8 @@
1
1
  import { isRecord } from "../../utils/record";
2
2
  import { isBranch, type PreferencesTree } from "./preferencesCookie";
3
3
  import { isNumber, isString } from "../../../utils/type-check";
4
+ import { isJsonValue } from "../../utils/json";
5
+ import type { DataTypeValue } from "../../../types/data-type";
4
6
 
5
7
  /**
6
8
  * @internal
@@ -103,10 +105,10 @@ interface SortEntry {
103
105
 
104
106
  interface FilterEntry {
105
107
  accessorKey: string;
106
- value?: unknown;
108
+ value?: DataTypeValue;
107
109
  mode: string;
108
110
  pinned?: boolean;
109
- initialValue?: unknown;
111
+ initialValue?: DataTypeValue;
110
112
  }
111
113
 
112
114
  interface PaginationEntry {
@@ -172,7 +174,7 @@ const decodeFilters = (
172
174
  if (!Array.isArray(stored)) throw new TypeError("columnFilters");
173
175
  return stored.map(([accessorKey, value, mode]: unknown[]) => ({
174
176
  accessorKey: String(accessorKey),
175
- value,
177
+ value: isJsonValue(value) ? value : undefined,
176
178
  mode: isString(mode) ? mode : DEFAULT_FILTER_MODE,
177
179
  }));
178
180
  };
@@ -0,0 +1,49 @@
1
+ import type { DataTypeRow, DataTypeValue } from "../../types/data-type";
2
+ import { isString } from "../../utils/type-check";
3
+
4
+ /** Whether a value is a row: an object that is neither a list nor a date. */
5
+ export function isDataTypeRow(value: DataTypeValue): value is DataTypeRow {
6
+ return (
7
+ typeof value === "object" &&
8
+ value !== null &&
9
+ !Array.isArray(value) &&
10
+ !(value instanceof Date)
11
+ );
12
+ }
13
+
14
+ /**
15
+ * The text of a value: a row, or a list that holds one, as its JSON; a list
16
+ * of anything else item by item, the way `String` joins it; a date or a
17
+ * primitive the way `String` writes it.
18
+ */
19
+ export function textOf(value: DataTypeValue): string {
20
+ if (Array.isArray(value)) {
21
+ if (value.some(isDataTypeRow)) return JSON.stringify(value);
22
+ return value
23
+ .map((item) => (item === null || item === undefined ? "" : textOf(item)))
24
+ .join(",");
25
+ }
26
+ return isDataTypeRow(value) ? JSON.stringify(value) : String(value);
27
+ }
28
+
29
+ /**
30
+ * The value a row holds at a dotted path (`customer.name`, `lines.0.total`,
31
+ * `tags.length`), or `undefined` once the path leaves the row. A numeric step
32
+ * reads the item of a list or the character of a text, or the member of a row
33
+ * under that number; `length` reads the length of a list or a text.
34
+ */
35
+ export function readFieldPath(
36
+ row: DataTypeRow | undefined,
37
+ path: string,
38
+ ): DataTypeValue {
39
+ let value: DataTypeValue = row;
40
+ for (const step of path.split(".")) {
41
+ const index = Number(step);
42
+ if (Array.isArray(value) || isString(value))
43
+ value = step === "length" ? value.length : value[index];
44
+ else if (isDataTypeRow(value))
45
+ value = value[Number.isNaN(index) ? step : String(index)];
46
+ else return undefined;
47
+ }
48
+ return value;
49
+ }
@@ -1,9 +1,15 @@
1
- import type { Component } from "vue";
1
+ import type { Component, VNodeChild } from "vue";
2
+ import type {
3
+ DataTypeOptions,
4
+ DataTypeRow,
5
+ DataTypeValue,
6
+ } from "../../types/data-type";
2
7
 
3
8
  export type RecordWithDefault<T> = Record<string, T> & { default: T };
4
9
 
5
10
  /**
6
- * Turns a value into its display. `row` is the whole listed row when the value
11
+ * Turns a value into its display, or returns a value that needs none, drawn
12
+ * as its text. `row` is the whole listed row when the value
7
13
  * is drawn in a table (cell, detail band), so a formatter can compose sibling
8
14
  * fields; it is absent elsewhere (forms, filters) and must be optional.
9
15
  *
@@ -12,18 +18,21 @@ export type RecordWithDefault<T> = Record<string, T> & { default: T };
12
18
  * null/undefined value), and one per compare mode for filter chips.
13
19
  */
14
20
  export type DataTypeFormatter = (
15
- value: unknown,
21
+ value: DataTypeValue,
16
22
  locale: string,
17
- options?: unknown,
18
- row?: Record<string, unknown>,
19
- ) => unknown;
23
+ options?: DataTypeOptions,
24
+ row?: DataTypeRow,
25
+ ) => VNodeChild | DataTypeValue;
20
26
 
21
27
  /**
22
28
  * Reshapes a server value into its form-state representation.
23
29
  * Must be idempotent: form reset re-applies the mapper to values that
24
30
  * may already be mapped (e.g. restored from a submit-success snapshot).
25
31
  */
26
- export type BeforeStateMapper = (value: unknown, options?: unknown) => unknown;
32
+ export type BeforeStateMapper = (
33
+ value: DataTypeValue,
34
+ options?: DataTypeOptions,
35
+ ) => DataTypeValue;
27
36
 
28
37
  /**
29
38
  * Whether two values of a data type are the same value, whatever shape each
@@ -31,9 +40,9 @@ export type BeforeStateMapper = (value: unknown, options?: unknown) => unknown;
31
40
  * its control holds through it, to tell an edited field from an untouched one.
32
41
  */
33
42
  export type DataTypeValueComparer = (
34
- left: unknown,
35
- right: unknown,
36
- options?: unknown,
43
+ left: DataTypeValue,
44
+ right: DataTypeValue,
45
+ options?: DataTypeOptions,
37
46
  ) => boolean;
38
47
 
39
48
  /**
@@ -42,7 +51,10 @@ export type DataTypeValueComparer = (
42
51
  * input refuses `"0"`, a date range wants its two days. The filter itself
43
52
  * keeps its text, so the query is unchanged.
44
53
  */
45
- export type DataTypeFilterEditorValue = (text: string, mode: string) => unknown;
54
+ export type DataTypeFilterEditorValue = (
55
+ text: string,
56
+ mode: string,
57
+ ) => DataTypeValue;
46
58
 
47
59
  /**
48
60
  * Where the rows a value names are read: the `select` route of the table a
@@ -0,0 +1 @@
1
+ export * from "../../build/utils/dataTypeValue";
@@ -1,4 +1,4 @@
1
- import type { I18nTranslate } from "../composables/translation/useTranslation";
1
+ import type { DataTypeRow } from "./data-type";
2
2
 
3
3
  /** One dependent a confirmed action affects, listed in its dialog. */
4
4
  export interface ConfirmDialogImpact {
@@ -73,7 +73,7 @@ export interface ConfirmDialogSecondaryAction {
73
73
  export interface ConfirmDialog {
74
74
  title: string;
75
75
  description?: string;
76
- params?: Parameters<I18nTranslate>[1];
76
+ params?: DataTypeRow;
77
77
  icon?: string;
78
78
  color?: ConfirmDialogColor;
79
79
  confirmLabel?: string;
@@ -1,3 +1,34 @@
1
+ import type { JsonPrimitive, JsonValue } from "./json";
2
+
3
+ /**
4
+ * A value of a field, as a row, a form or a filter holds it: JSON as the
5
+ * server sends it, a date a control writes, `undefined` when unset. A
6
+ * relation holds its row.
7
+ */
8
+ export type DataTypeValue =
9
+ | JsonPrimitive
10
+ | Date
11
+ | undefined
12
+ | DataTypeList
13
+ | DataTypeRow;
14
+
15
+ /** A list of values, as a multiple field holds them. */
16
+ export interface DataTypeList extends Array<DataTypeValue> {}
17
+
18
+ /** A row of a table, or any record of field values, by field id. */
19
+ export interface DataTypeRow {
20
+ [field: string]: DataTypeValue;
21
+ }
22
+
23
+ /**
24
+ * The options a data type reads: its control's component options as the page
25
+ * declares them, or the ones a caller composes, an option left unset when
26
+ * absent.
27
+ */
28
+ export interface DataTypeOptions {
29
+ readonly [option: string]: JsonValue | undefined;
30
+ }
31
+
1
32
  export type ComponentOrNoInput =
2
33
  | ComponentInfo<ComponentOptionsData>
3
34
  | "noInput";
@@ -1,3 +1,5 @@
1
+ import type { DataTypeRow } from "./data-type";
2
+
1
3
  /**
2
4
  * Mirror of `PageLivePeriod` from `@antelopejs/interface-dms/page`: whole
3
5
  * minutes, hours or days (`"30m"`, `"24h"`, `"7d"`).
@@ -34,9 +36,7 @@ export type PageLiveNoteTone = "neutral" | "warning" | "error";
34
36
  */
35
37
  export interface PageLiveNote {
36
38
  text: string;
37
- params?: Parameters<
38
- import("#dms-core/app/composables/translation/useTranslation").I18nTranslate
39
- >[1];
39
+ params?: DataTypeRow;
40
40
  tone?: PageLiveNoteTone;
41
41
  }
42
42
 
@@ -1,14 +1,23 @@
1
1
  import type { Ref } from "vue";
2
2
  import type { ComponentEventData } from "./component";
3
+ import type { DataTypeValue } from "./data-type";
3
4
 
4
5
  export const ComponentId = {
5
6
  SELF: "$component:self",
6
7
  } as const;
7
8
 
9
+ /**
10
+ * What a component's watch actions write into its state: a field's value, or
11
+ * a set of field ids (the fields a form disables, hides or requires).
12
+ */
13
+ export interface ComponentWatchState {
14
+ [key: string]: DataTypeValue | Set<string>;
15
+ }
16
+
8
17
  export type WatchActionFunction = (
9
18
  action: WatchAction,
10
19
  eventData: ComponentEventData,
11
- componentState: Ref<Record<string, unknown>>,
20
+ componentState: Ref<ComponentWatchState>,
12
21
  ) => void;
13
22
 
14
23
  export interface WatchActionCondition {
@@ -1,6 +1,5 @@
1
1
  import type { DataTypeFormatter } from "../composables/data-types/useDataType";
2
-
3
- import { get } from "@nuxt/ui/runtime/utils/index.js";
2
+ import { readFieldPath, textOf } from "../build/utils/dataTypeValue";
4
3
 
5
4
  const ROW_TOKEN = /\{\{\s*row\.([^{}\s]+)\s*\}\}/g;
6
5
 
@@ -29,9 +28,9 @@ const rowValue = (
29
28
  data: NonNullable<Parameters<DataTypeFormatter>[3]>,
30
29
  key: string,
31
30
  ): string => {
32
- const field: unknown = get(data, key);
31
+ const field = readFieldPath(data, key);
33
32
  const value = Array.isArray(field) ? field.map(scalarOf) : scalarOf(field);
34
- return value === undefined || value === null ? "" : String(value);
33
+ return value === undefined || value === null ? "" : textOf(value);
35
34
  };
36
35
 
37
36
  const ENCODED_COLON = /%3A/gi;
@@ -13,6 +13,7 @@ import { formErrorsInjectionKey } from "@nuxt/ui/composables/useFormField";
13
13
  import DmsFormErrorText from "./FormErrorText.vue";
14
14
  import DmsFormFieldNotes from "./FormFieldNotes.vue";
15
15
  import { readonlyFieldValue } from "../../composables/form/readonlyValue";
16
+ import { fieldValueOf } from "../../composables/unsaved-changes/formValue";
16
17
  import { useDeclaredFieldProps } from "../../composables/form/fieldComponentProps";
17
18
 
18
19
  interface FormFieldControlProps {
@@ -58,7 +59,7 @@ const hasError = computed(() => {
58
59
  const { getDataType } = useDataTypes();
59
60
  const readonlyValue = computed(() =>
60
61
  readonlyFieldValue(
61
- state.value[props.field.id],
62
+ fieldValueOf(state.value, props.field.id),
62
63
  initialValues.value?.[props.field.id],
63
64
  props.field.type ? getDataType(props.field.type) : undefined,
64
65
  props.field.component.options,
@@ -4,6 +4,7 @@ import { isString, isNumber } from "#dms-core/app/utils/type-check";
4
4
  import type { DataTypeFormatter } from "#dms-core/app/composables/data-types/useDataType";
5
5
  import type { FormField } from "../../../composables/form/types/field";
6
6
  import {
7
+ fieldValueOf,
7
8
  isEmptyFormValue,
8
9
  sameFormValue,
9
10
  } from "../../composables/unsaved-changes/formValue";
@@ -18,7 +19,7 @@ const context = inject(FORM_ENTRY_CONTEXT_KEY)!;
18
19
  const { t, locale } = useI18n();
19
20
  const { getDataType } = useDataTypes();
20
21
 
21
- const value = computed(() => context.state.value[props.field.id]);
22
+ const value = computed(() => fieldValueOf(context.state.value, props.field.id));
22
23
  const baseline = computed(() => context.baselineValue(props.field.id));
23
24
  const defaultValue = computed(() => props.field.defaultValue);
24
25
 
@@ -27,6 +27,7 @@ import type {
27
27
  FormPageUrls,
28
28
  } from "../../composables/table-view/useTableViewConfig";
29
29
  import type { CustomRowAction } from "../../../types/row-action";
30
+ import type { DataTypeValue } from "#dms-core/app/types/data-type";
30
31
  import type { TableViewRowClick } from "../../utils/rowClickTrigger";
31
32
  import type { RowActionConfig } from "#dms-core/app/types/row-action";
32
33
  import type { TableTabItem } from "./TableTabs.vue";
@@ -316,10 +317,10 @@ export interface TableEmits<T> {
316
317
 
317
318
  export interface TableFilter {
318
319
  accessorKey: string;
319
- value?: unknown;
320
+ value?: DataTypeValue;
320
321
  mode: string;
321
322
  pinned?: boolean;
322
- initialValue?: unknown;
323
+ initialValue?: DataTypeValue;
323
324
  }
324
325
 
325
326
  /** A filter the page URL applies and shows (see `TableProps.urlFilters`). */
@@ -1,4 +1,5 @@
1
- <script setup lang="ts" generic="T extends Record<string, unknown>">
1
+ <script setup lang="ts" generic="T extends DataTypeRow">
2
+ import type { DataTypeRow } from "#dms-core/app/types/data-type";
2
3
  import { computed } from "vue";
3
4
  import { FlexRender, type Table } from "@tanstack/vue-table";
4
5
  import { ACTIONS_COLUMN_ID } from "../../composables/table/constants";
@@ -9,7 +10,7 @@ import { ACTIONS_COLUMN_ID } from "../../composables/table/constants";
9
10
  * rules and confirmations, as the row does in the grid. Nothing is drawn
10
11
  * outside a table (no TanStack instance) or for a table with no row action.
11
12
  */
12
- export interface CardRowActionsProps<T extends Record<string, unknown>> {
13
+ export interface CardRowActionsProps<T extends DataTypeRow> {
13
14
  table?: Table<T>;
14
15
  rowId: string;
15
16
  }
@@ -1,4 +1,5 @@
1
- <script setup lang="ts" generic="T extends Record<string, unknown>">
1
+ <script setup lang="ts" generic="T extends DataTypeRow">
2
+ import type { DataTypeRow } from "#dms-core/app/types/data-type";
2
3
  import { defineComponent, markRaw, type Component } from "vue";
3
4
  import { get } from "@nuxt/ui/runtime/utils/index.js";
4
5
  import { isObject, isString } from "#dms-core/app/utils/type-check";
@@ -29,7 +30,7 @@ import {
29
30
  } from "../../composables/table-view/useReorderHandles";
30
31
  import { useCardFields } from "../../composables/table-view/useCardFields";
31
32
 
32
- export interface CardsDisplayProps<T extends Record<string, unknown>> {
33
+ export interface CardsDisplayProps<T extends DataTypeRow> {
33
34
  context: TableViewDisplayContext<T>;
34
35
  }
35
36
 
@@ -4,6 +4,7 @@ import type { ConfirmValues } from "../../../composables/confirm/types";
4
4
  import type { ActionTargetsConfig } from "./useActionTargets";
5
5
  import type { BulkSelection } from "./bulkSelection";
6
6
  import { resolveResponseToast } from "../../utils/responseWarning";
7
+ import { textOf } from "#dms-core/app/entries/utils/dataTypeValue";
7
8
  import { resolveConfirmText } from "../confirm/confirmDialogTexts";
8
9
  import { readBulkCount } from "../table-view/utils/bulkActions";
9
10
  import { type DownloadFetch, saveDownload } from "../../utils/fileDownload";
@@ -98,7 +99,7 @@ export function createActionRequests(
98
99
  ...(Object.keys(body).length > 0 ? { body } : undefined),
99
100
  });
100
101
  if (target.copy)
101
- await copyToClipboard(String(response?.[target.copy] ?? ""));
102
+ await copyToClipboard(textOf(response?.[target.copy] ?? ""));
102
103
  const toastParams = selection
103
104
  ? { ...rowData, count: readBulkCount(response) ?? selection.count }
104
105
  : (rowData ?? {});
@@ -1,6 +1,7 @@
1
1
  import { get } from "@nuxt/ui/runtime/utils/index.js";
2
2
  import type { Component } from "vue";
3
3
  import { isString } from "#dms-core/app/utils/type-check";
4
+ import { readFieldPath } from "#dms-core/app/entries/utils/dataTypeValue";
4
5
  import type { ActionTarget } from "../../../composables/table-view/types/action-target";
5
6
  import type { ActionTargetsConfig } from "./useActionTargets";
6
7
  import type { RowTarget, SidePanelTarget } from "./actionTargetTypes";
@@ -12,6 +13,7 @@ import {
12
13
  type WrittenRecord,
13
14
  } from "../table-view/utils/recordLink";
14
15
  import { fillRowChildren, fillRowOptions } from "./rowComponentOptions";
16
+ import { isJsonObject } from "../../utils/json";
15
17
  import { resolveComponentChildren } from "../../../utils/componentTree";
16
18
  import TargetComponentTree from "../../components/containers/TargetComponentTree.vue";
17
19
  import { resolveConfirmText } from "../confirm/confirmDialogTexts";
@@ -87,7 +89,10 @@ export function createTargetRows(config: ActionTargetsConfig) {
87
89
  const id = rowIdOf(row);
88
90
  const tokens = row && id !== undefined ? { ...row, id } : row;
89
91
  const declared = component?.options ?? {};
90
- const options = tokens ? fillRowOptions(declared, tokens) : declared;
92
+ const options =
93
+ tokens && isJsonObject(declared)
94
+ ? fillRowOptions(declared, tokens)
95
+ : declared;
91
96
  const children = component?.children;
92
97
  if (!component?.componentName || !children?.length) return options;
93
98
  const targetTree: ResolvedComponentInfo = {
@@ -105,9 +110,7 @@ export function createTargetRows(config: ActionTargetsConfig) {
105
110
  return (row?: Data): void => recordId(rowIdOf(row));
106
111
  };
107
112
  const rowUrlParams = (rowData?: Data) => {
108
- const id: unknown = rowData
109
- ? get(rowData, config.rowIdKey ?? DEFAULT_ROW_ID_KEY)
110
- : undefined;
113
+ const id = readFieldPath(rowData, config.rowIdKey ?? DEFAULT_ROW_ID_KEY);
111
114
  return id === undefined || id === null ? undefined : { id };
112
115
  };
113
116
  return {
@@ -2,6 +2,7 @@ import type { ActionTarget } from "../../../composables/table-view/types/action-
2
2
  import type { CustomRowAction } from "../../../types/row-action";
3
3
  import { namesRowField } from "#dms-core/app/utils/url-interpolation";
4
4
  import { isObject } from "#dms-core/app/utils/type-check";
5
+ import { textOf } from "#dms-core/app/entries/utils/dataTypeValue";
5
6
  import { dropRowTokens } from "../../utils/urlVariables";
6
7
 
7
8
  /** Query flag of a bulk request covering every matching row. */
@@ -29,7 +30,7 @@ export function bulkSelectionQuery(selection: BulkSelection) {
29
30
  };
30
31
  for (const [key, value] of Object.entries(selection.matching ?? {})) {
31
32
  if (value !== undefined && value !== null && value !== "") {
32
- query[key] = String(value);
33
+ query[key] = textOf(value);
33
34
  }
34
35
  }
35
36
  return query;
@@ -4,6 +4,7 @@ import {
4
4
  namesRowField,
5
5
  } from "#dms-core/app/utils/url-interpolation";
6
6
  import { isString } from "#dms-core/app/utils/type-check";
7
+ import { isJsonObject } from "../../utils/json";
7
8
 
8
9
  type Options = NonNullable<ComponentInfo<Data>["options"]>;
9
10
  type OptionValue = Options[string];
@@ -40,10 +41,7 @@ function fillValue(value: OptionValue, key: string, row: Options): OptionValue {
40
41
  * read through the table's `rowIdKey`. Filled anew for each row shown; a
41
42
  * nested table's row actions keep theirs for their own rows.
42
43
  */
43
- export function fillRowOptions(
44
- options: NonNullable<ComponentInfo["options"]>,
45
- row: Options,
46
- ): Options {
44
+ export function fillRowOptions(options: Options, row: Options): Options {
47
45
  return Object.fromEntries(
48
46
  Object.entries(options).map(([key, value]) => [
49
47
  key,
@@ -65,7 +63,7 @@ export function fillRowChildren(
65
63
  ...child,
66
64
  component: {
67
65
  ...child.component,
68
- options: child.component.options
66
+ options: isJsonObject(child.component.options)
69
67
  ? fillRowOptions(child.component.options, row)
70
68
  : child.component.options,
71
69
  children: child.component.children
@@ -1,11 +1,10 @@
1
- import { get } from "@nuxt/ui/runtime/utils/index.js";
2
1
  import type { DataTypeFormatter } from "#dms-core/app/composables/data-types/useDataType";
3
2
  import {
4
- isBoolean,
5
- isNumber,
6
- isObject,
7
- isString,
8
- } from "#dms-core/app/utils/type-check";
3
+ isDataTypeRow,
4
+ readFieldPath,
5
+ textOf,
6
+ } from "#dms-core/app/entries/utils/dataTypeValue";
7
+ import { isBoolean, isNumber, isString } from "#dms-core/app/utils/type-check";
9
8
  import { isVNode, type VNodeChild } from "vue";
10
9
  import type { BlockText } from "../../../../../dms-core/app/types/composed-text";
11
10
  import {
@@ -18,7 +17,9 @@ import { DMS_TONE_TEXT, isDmsTone } from "../../utils/tone";
18
17
  export type Row = Parameters<DataTypeFormatter>[3];
19
18
 
20
19
  /** What Vue draws for `value` as a child: text for anything but a node, a list or an atom. */
21
- export function childOf(value: Parameters<DataTypeFormatter>[0]): VNodeChild {
20
+ export function childOf(
21
+ value: Parameters<DataTypeFormatter>[0] | ReturnType<DataTypeFormatter>,
22
+ ): VNodeChild {
22
23
  if (Array.isArray(value)) return value.map(childOf);
23
24
  if (
24
25
  value === null ||
@@ -30,13 +31,13 @@ export function childOf(value: Parameters<DataTypeFormatter>[0]): VNodeChild {
30
31
  ) {
31
32
  return value;
32
33
  }
33
- return String(value);
34
+ return textOf(value);
34
35
  }
35
36
 
36
37
  export const readRowField = (
37
38
  row: Row,
38
39
  field: string | undefined,
39
- ): NonNullable<Row>[string] => (field && row ? get(row, field) : undefined);
40
+ ): NonNullable<Row>[string] => (field ? readFieldPath(row, field) : undefined);
40
41
 
41
42
  /**
42
43
  * The `Tone` a row field holds (`toneField` of a display), or nothing when the
@@ -65,7 +66,7 @@ export const stringOf = (
65
66
  ): string | undefined =>
66
67
  value === null || value === undefined || value === ""
67
68
  ? undefined
68
- : String(value);
69
+ : textOf(value);
69
70
 
70
71
  /** Truthy the way a status reads it: a non-empty list, a set flag. */
71
72
  export const isSet = (value: Parameters<DataTypeFormatter>[0]): boolean => {
@@ -122,10 +123,10 @@ export interface SublineReading {
122
123
 
123
124
  const isCellSubline = (
124
125
  value: Parameters<DataTypeFormatter>[0],
125
- ): value is CellSubline =>
126
- isObject(value) &&
127
- value !== null &&
128
- "text" in value &&
126
+ ): value is NonNullable<Row> & CellSubline =>
127
+ isDataTypeRow(value) &&
128
+ (isString(value.text) || isComposedText(value.text)) &&
129
+ (value.tone === undefined || isString(value.tone)) &&
129
130
  !isComposedText(value);
130
131
 
131
132
  const toSubline = (text: string, tone?: string): ResolvedSubline | undefined =>
@@ -1,5 +1,6 @@
1
1
  import type { DataTypeFormatter } from "#dms-core/app/composables/data-types/useDataType";
2
2
  import { isNumber, isString } from "#dms-core/app/utils/type-check";
3
+ import { textOf } from "#dms-core/app/entries/utils/dataTypeValue";
3
4
  import { readRowField, type Row, toneClass } from "./cellHelpers";
4
5
  import {
5
6
  firstNameOf,
@@ -49,7 +50,7 @@ const NOW_DOT_CLASS =
49
50
  const dateOf = (value: CellValue): Date =>
50
51
  isString(value) || isNumber(value) || value instanceof Date
51
52
  ? new Date(value)
52
- : new Date(String(value));
53
+ : new Date(textOf(value));
53
54
 
54
55
  /**
55
56
  * `relative_date`: a date as the distance to now, with an "active now"
@@ -64,7 +65,7 @@ export function renderRelativeDate(
64
65
  const { processI18n } = getAppTranslation();
65
66
  const opts: RelativeDateOptions = options ?? {};
66
67
  const date = dateOf(value);
67
- if (Number.isNaN(date.getTime())) return String(value);
68
+ if (Number.isNaN(date.getTime())) return textOf(value);
68
69
 
69
70
  const now = serverRenderNow() ?? Date.now();
70
71
  const deltaMs = date.getTime() - now;
@@ -61,7 +61,7 @@ interface AvatarFile {
61
61
  alt?: string;
62
62
  }
63
63
 
64
- const isAvatarFile = (value: CellValue): value is AvatarFile =>
64
+ const isAvatarFile = (value: CellValue): value is CellValue & AvatarFile =>
65
65
  isObject(value) &&
66
66
  value !== null &&
67
67
  isString(value.key) &&
@@ -3,6 +3,7 @@ import type {
3
3
  DataTypeFormatter,
4
4
  } from "#dms-core/app/composables/data-types/useDataType";
5
5
  import { isString } from "#dms-core/app/utils/type-check";
6
+ import { textOf } from "#dms-core/app/entries/utils/dataTypeValue";
6
7
  import UAvatar from "@nuxt/ui/components/Avatar.vue";
7
8
  import UIcon from "@nuxt/ui/runtime/vue/components/Icon.vue";
8
9
  import ULink from "@nuxt/ui/components/Link.vue";
@@ -27,7 +28,7 @@ interface LinkRendererOptions {
27
28
 
28
29
  function createLinkRenderer(options: LinkRendererOptions) {
29
30
  return (value: CellValue, _locale: string) => {
30
- if (!value || !isString(value)) return String(value);
31
+ if (!value || !isString(value)) return textOf(value);
31
32
 
32
33
  const href = options.hrefPrefix ? `${options.hrefPrefix}${value}` : value;
33
34