@antelopejs/dms 0.20.8-next.943.g59ea329 → 0.20.8-next.945.ge4702b6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/frontend-vue/eslint-globals.generated.mjs +25 -25
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +37 -54
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +11 -23
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +2 -4
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +4 -8
- package/frontend-vue/layers/dms-core/app/types/confirm-dialog.ts +2 -2
- package/frontend-vue/layers/dms-core/app/types/data-type.ts +0 -31
- package/frontend-vue/layers/dms-core/app/types/live.ts +3 -3
- package/frontend-vue/layers/dms-core/app/types/page.ts +6 -12
- package/frontend-vue/layers/dms-core/app/types/watch.ts +1 -10
- package/frontend-vue/layers/dms-core/app/utils/query-validation.ts +1 -3
- package/frontend-vue/layers/dms-core/app/utils/url-interpolation.ts +4 -3
- package/frontend-vue/layers/dms-layout/app/custom-pages/modules.vue +5 -1
- package/frontend-vue/layers/dms-ui/app/build/components/form/FormFieldControl.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/build/components/form/FormFieldNotes.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +12 -7
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +2 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardRowActions.vue +2 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +2 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +4 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/bulkSelection.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowComponentOptions.ts +5 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +6 -76
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +14 -15
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +2 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultLinkTypes.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +4 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +19 -27
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +2 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +2 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/registerFieldTypes.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationBadges.ts +5 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationFilter.ts +6 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +1 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +15 -18
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +13 -18
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formEntryContext.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/keyValueRows.ts +12 -15
- package/frontend-vue/layers/dms-ui/app/build/composables/form/repeaterTable.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +58 -36
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +18 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +5 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/period/usePeriodLocation.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +2 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/formatFilterValue.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewFilters.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewSorting.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewViews.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableListData.ts +7 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +9 -19
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +11 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViews.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +2 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/compareValues.ts +5 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +6 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/pinnedRows.ts +2 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/quickFilters.ts +6 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +0 -14
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +67 -7
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -12
- package/frontend-vue/layers/dms-ui/app/components/form/components/DisplayValue.vue +2 -17
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRelation.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRepeater.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/KeyValue.vue +4 -4
- package/frontend-vue/layers/dms-ui/app/components/table-view/CascaderPath.vue +2 -3
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +1 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexAnnotations.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexPlotOptions.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/field-saved.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/types/field.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/value.ts +9 -6
- package/frontend-vue/layers/dms-ui/app/composables/table-view/kanban.ts +3 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useFormDirty.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/entries/components/sortable/SortableList.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +1 -2
- package/package.json +3 -3
- package/frontend-vue/layers/dms-core/app/build/utils/dataTypeValue.ts +0 -49
- package/frontend-vue/layers/dms-core/app/entries/utils/dataTypeValue.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/sortableGroup.ts +0 -24
|
@@ -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
|
|
33
|
-
|
|
32
|
+
ComponentOrNoInput ComponentShortcuts ComposableText ComposedText
|
|
33
|
+
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
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
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,29 +1,23 @@
|
|
|
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";
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* @internal
|
|
9
7
|
* The state of a table view that the server render reads to list and draw
|
|
10
|
-
* the right rows
|
|
8
|
+
* the right rows: kept in the preferences cookie, compactly.
|
|
11
9
|
*/
|
|
12
|
-
export
|
|
13
|
-
sorting
|
|
14
|
-
columnFilters
|
|
15
|
-
columnVisibility
|
|
16
|
-
pagination
|
|
17
|
-
paginationScope
|
|
18
|
-
activeTab
|
|
19
|
-
viewMode
|
|
20
|
-
activeView
|
|
21
|
-
linkScope
|
|
22
|
-
shownLink
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** @internal A server field, kept in the preferences cookie, compactly. */
|
|
26
|
-
export type ServerTableField = keyof ServerTableFieldValues;
|
|
10
|
+
export type ServerTableField =
|
|
11
|
+
| "sorting"
|
|
12
|
+
| "columnFilters"
|
|
13
|
+
| "columnVisibility"
|
|
14
|
+
| "pagination"
|
|
15
|
+
| "paginationScope"
|
|
16
|
+
| "activeTab"
|
|
17
|
+
| "viewMode"
|
|
18
|
+
| "activeView"
|
|
19
|
+
| "linkScope"
|
|
20
|
+
| "shownLink";
|
|
27
21
|
|
|
28
22
|
/**
|
|
29
23
|
* @internal
|
|
@@ -105,10 +99,10 @@ interface SortEntry {
|
|
|
105
99
|
|
|
106
100
|
interface FilterEntry {
|
|
107
101
|
accessorKey: string;
|
|
108
|
-
value?:
|
|
102
|
+
value?: unknown;
|
|
109
103
|
mode: string;
|
|
110
104
|
pinned?: boolean;
|
|
111
|
-
initialValue?:
|
|
105
|
+
initialValue?: unknown;
|
|
112
106
|
}
|
|
113
107
|
|
|
114
108
|
interface PaginationEntry {
|
|
@@ -122,14 +116,16 @@ interface PaginationEntry {
|
|
|
122
116
|
* form. `encode` gets the field's default so that it can keep only what
|
|
123
117
|
* differs from it; a value whose form equals the default's is not written.
|
|
124
118
|
*/
|
|
125
|
-
export interface ServerFieldCodec
|
|
119
|
+
export interface ServerFieldCodec {
|
|
126
120
|
key: string;
|
|
127
121
|
encode: (
|
|
128
122
|
value: PreferencesTree[string],
|
|
129
123
|
defaultValue: PreferencesTree[string],
|
|
130
124
|
) => PreferencesTree[string];
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
decode: (
|
|
126
|
+
stored: PreferencesTree[string],
|
|
127
|
+
defaultValue: PreferencesTree[string],
|
|
128
|
+
) => PreferencesTree[string];
|
|
133
129
|
}
|
|
134
130
|
|
|
135
131
|
const encodeSorting: ServerFieldCodec["encode"] = (value) => {
|
|
@@ -174,7 +170,7 @@ const decodeFilters = (
|
|
|
174
170
|
if (!Array.isArray(stored)) throw new TypeError("columnFilters");
|
|
175
171
|
return stored.map(([accessorKey, value, mode]: unknown[]) => ({
|
|
176
172
|
accessorKey: String(accessorKey),
|
|
177
|
-
value
|
|
173
|
+
value,
|
|
178
174
|
mode: isString(mode) ? mode : DEFAULT_FILTER_MODE,
|
|
179
175
|
}));
|
|
180
176
|
};
|
|
@@ -192,15 +188,13 @@ const encodeVisibility: ServerFieldCodec["encode"] = (value, defaultValue) => {
|
|
|
192
188
|
);
|
|
193
189
|
};
|
|
194
190
|
|
|
195
|
-
const decodeVisibility: ServerFieldCodec
|
|
196
|
-
ServerTableFieldValues["columnVisibility"]
|
|
197
|
-
>["decode"] = (stored, defaultValue) => {
|
|
191
|
+
const decodeVisibility: ServerFieldCodec["decode"] = (stored, defaultValue) => {
|
|
198
192
|
if (!Array.isArray(stored)) throw new TypeError("columnVisibility");
|
|
199
|
-
const changes = stored.map((token: string)
|
|
193
|
+
const changes = stored.map((token: string) => [
|
|
200
194
|
token.slice(1),
|
|
201
195
|
token.startsWith(SHOWN_PREFIX),
|
|
202
196
|
]);
|
|
203
|
-
return { ...defaultValue, ...Object.fromEntries(changes) };
|
|
197
|
+
return { ...visibilityOf(defaultValue), ...Object.fromEntries(changes) };
|
|
204
198
|
};
|
|
205
199
|
|
|
206
200
|
const isPaginationEntry = (value: unknown): value is PaginationEntry =>
|
|
@@ -225,27 +219,19 @@ const decodePagination = (
|
|
|
225
219
|
return { pageIndex, pageSize };
|
|
226
220
|
};
|
|
227
221
|
|
|
228
|
-
const
|
|
222
|
+
const plainField = (key: string): ServerFieldCodec => ({
|
|
229
223
|
key,
|
|
230
224
|
encode: (value) => value,
|
|
231
|
-
decode: (stored) =>
|
|
232
|
-
if (!isString(stored)) throw new TypeError(key);
|
|
233
|
-
return stored;
|
|
234
|
-
},
|
|
225
|
+
decode: (stored) => stored,
|
|
235
226
|
});
|
|
236
227
|
|
|
237
|
-
/** @internal The codec of each server field, reading back its own value. */
|
|
238
|
-
export type ServerTableFieldCodecs = {
|
|
239
|
-
[F in ServerTableField]: ServerFieldCodec<ServerTableFieldValues[F]>;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
228
|
/**
|
|
243
229
|
* @internal
|
|
244
230
|
* The server fields, each with its one-letter key and compact form: a sort is
|
|
245
231
|
* `"-name"`, a filter `["status", "open"]`, a hidden column `"-email"`, a
|
|
246
232
|
* page size `50`.
|
|
247
233
|
*/
|
|
248
|
-
export const SERVER_TABLE_FIELDS:
|
|
234
|
+
export const SERVER_TABLE_FIELDS: Record<ServerTableField, ServerFieldCodec> = {
|
|
249
235
|
sorting: { key: "s", encode: encodeSorting, decode: decodeSorting },
|
|
250
236
|
columnFilters: { key: "f", encode: encodeFilters, decode: decodeFilters },
|
|
251
237
|
columnVisibility: {
|
|
@@ -254,12 +240,12 @@ export const SERVER_TABLE_FIELDS: ServerTableFieldCodecs = {
|
|
|
254
240
|
decode: decodeVisibility,
|
|
255
241
|
},
|
|
256
242
|
pagination: { key: "p", encode: encodePagination, decode: decodePagination },
|
|
257
|
-
paginationScope:
|
|
258
|
-
activeTab:
|
|
259
|
-
viewMode:
|
|
260
|
-
activeView:
|
|
261
|
-
linkScope:
|
|
262
|
-
shownLink:
|
|
243
|
+
paginationScope: plainField("q"),
|
|
244
|
+
activeTab: plainField("t"),
|
|
245
|
+
viewMode: plainField("d"),
|
|
246
|
+
activeView: plainField("w"),
|
|
247
|
+
linkScope: plainField("l"),
|
|
248
|
+
shownLink: plainField("k"),
|
|
263
249
|
};
|
|
264
250
|
|
|
265
251
|
/** @internal Whether `field` is kept in the cookie. */
|
|
@@ -288,19 +274,16 @@ export const encodeServerField = (
|
|
|
288
274
|
};
|
|
289
275
|
|
|
290
276
|
/** @internal The value `entry` keeps for `field`, else `defaultValue`. */
|
|
291
|
-
export const decodeServerField = <
|
|
292
|
-
|
|
293
|
-
D extends ServerTableFieldValues[F] | undefined,
|
|
294
|
-
>(
|
|
295
|
-
field: F,
|
|
277
|
+
export const decodeServerField = <T>(
|
|
278
|
+
field: ServerTableField,
|
|
296
279
|
entry: CompactTableEntry | undefined,
|
|
297
|
-
defaultValue:
|
|
298
|
-
):
|
|
280
|
+
defaultValue: T,
|
|
281
|
+
): T => {
|
|
299
282
|
const codec = SERVER_TABLE_FIELDS[field];
|
|
300
283
|
const stored = entry?.[codec.key];
|
|
301
284
|
if (stored === undefined) return defaultValue;
|
|
302
285
|
try {
|
|
303
|
-
return codec.decode(stored, defaultValue);
|
|
286
|
+
return codec.decode(stored, defaultValue) as T;
|
|
304
287
|
} catch {
|
|
305
288
|
return defaultValue;
|
|
306
289
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { Component
|
|
2
|
-
import type {
|
|
3
|
-
DataTypeOptions,
|
|
4
|
-
DataTypeRow,
|
|
5
|
-
DataTypeValue,
|
|
6
|
-
} from "../../types/data-type";
|
|
1
|
+
import type { Component } from "vue";
|
|
7
2
|
|
|
8
3
|
export type RecordWithDefault<T> = Record<string, T> & { default: T };
|
|
9
4
|
|
|
10
5
|
/**
|
|
11
|
-
* Turns a value into its display
|
|
12
|
-
* as its text. `row` is the whole listed row when the value
|
|
6
|
+
* Turns a value into its display. `row` is the whole listed row when the value
|
|
13
7
|
* is drawn in a table (cell, detail band), so a formatter can compose sibling
|
|
14
8
|
* fields; it is absent elsewhere (forms, filters) and must be optional.
|
|
15
9
|
*
|
|
@@ -18,21 +12,18 @@ export type RecordWithDefault<T> = Record<string, T> & { default: T };
|
|
|
18
12
|
* null/undefined value), and one per compare mode for filter chips.
|
|
19
13
|
*/
|
|
20
14
|
export type DataTypeFormatter = (
|
|
21
|
-
value:
|
|
15
|
+
value: unknown,
|
|
22
16
|
locale: string,
|
|
23
|
-
options?:
|
|
24
|
-
row?:
|
|
25
|
-
) =>
|
|
17
|
+
options?: unknown,
|
|
18
|
+
row?: Record<string, unknown>,
|
|
19
|
+
) => unknown;
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* Reshapes a server value into its form-state representation.
|
|
29
23
|
* Must be idempotent: form reset re-applies the mapper to values that
|
|
30
24
|
* may already be mapped (e.g. restored from a submit-success snapshot).
|
|
31
25
|
*/
|
|
32
|
-
export type BeforeStateMapper = (
|
|
33
|
-
value: DataTypeValue,
|
|
34
|
-
options?: DataTypeOptions,
|
|
35
|
-
) => DataTypeValue;
|
|
26
|
+
export type BeforeStateMapper = (value: unknown, options?: unknown) => unknown;
|
|
36
27
|
|
|
37
28
|
/**
|
|
38
29
|
* Whether two values of a data type are the same value, whatever shape each
|
|
@@ -40,9 +31,9 @@ export type BeforeStateMapper = (
|
|
|
40
31
|
* its control holds through it, to tell an edited field from an untouched one.
|
|
41
32
|
*/
|
|
42
33
|
export type DataTypeValueComparer = (
|
|
43
|
-
left:
|
|
44
|
-
right:
|
|
45
|
-
options?:
|
|
34
|
+
left: unknown,
|
|
35
|
+
right: unknown,
|
|
36
|
+
options?: unknown,
|
|
46
37
|
) => boolean;
|
|
47
38
|
|
|
48
39
|
/**
|
|
@@ -51,10 +42,7 @@ export type DataTypeValueComparer = (
|
|
|
51
42
|
* input refuses `"0"`, a date range wants its two days. The filter itself
|
|
52
43
|
* keeps its text, so the query is unchanged.
|
|
53
44
|
*/
|
|
54
|
-
export type DataTypeFilterEditorValue = (
|
|
55
|
-
text: string,
|
|
56
|
-
mode: string,
|
|
57
|
-
) => DataTypeValue;
|
|
45
|
+
export type DataTypeFilterEditorValue = (text: string, mode: string) => unknown;
|
|
58
46
|
|
|
59
47
|
/**
|
|
60
48
|
* Where the rows a value names are read: the `select` route of the table a
|
|
@@ -9,7 +9,7 @@ import type { JsonValue } from "../../types/json";
|
|
|
9
9
|
*/
|
|
10
10
|
export type SseEventHandler = (
|
|
11
11
|
eventName: string,
|
|
12
|
-
data:
|
|
12
|
+
data: unknown,
|
|
13
13
|
id: string | null,
|
|
14
14
|
) => void;
|
|
15
15
|
|
|
@@ -95,7 +95,7 @@ function parseFrame(frame: string): ParsedFrame | null {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
function decodeData(data: string):
|
|
98
|
+
function decodeData(data: string): JsonValue {
|
|
99
99
|
try {
|
|
100
100
|
const parsed: unknown = JSON.parse(data);
|
|
101
101
|
return isJsonValue(parsed) ? parsed : data;
|
|
@@ -160,16 +160,14 @@ const isSnapshotEntry = (
|
|
|
160
160
|
const isSnapshotEvent = (
|
|
161
161
|
eventName: string,
|
|
162
162
|
data: RealtimeFrameData,
|
|
163
|
-
): data is
|
|
163
|
+
): data is RealtimeSnapshotEvent =>
|
|
164
164
|
eventName === SNAPSHOT_EVENT &&
|
|
165
165
|
isRecord(data) &&
|
|
166
166
|
isString(data.topic) &&
|
|
167
167
|
Array.isArray(data.entries) &&
|
|
168
168
|
data.entries.every(isSnapshotEntry);
|
|
169
169
|
|
|
170
|
-
const isRealtimeEvent = (
|
|
171
|
-
data: RealtimeFrameData,
|
|
172
|
-
): data is RealtimeFrameData & RealtimeEvent =>
|
|
170
|
+
const isRealtimeEvent = (data: RealtimeFrameData): data is RealtimeEvent =>
|
|
173
171
|
!!data &&
|
|
174
172
|
isObject(data) &&
|
|
175
173
|
isString(data.topic) &&
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "../../build/composables/user/preferencesCookie";
|
|
12
12
|
import { clearLocalTableEntries } from "../../build/composables/user/tablePreferences";
|
|
13
13
|
import { isString } from "../../utils/type-check";
|
|
14
|
-
import { isJsonObject
|
|
14
|
+
import { isJsonObject } from "../../build/utils/json";
|
|
15
15
|
import type { JsonValue } from "../../types/json";
|
|
16
16
|
|
|
17
17
|
export interface UserPreferences extends PreferencesTree {}
|
|
@@ -67,13 +67,9 @@ export const usePreferences = () => {
|
|
|
67
67
|
return true;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
* The JSON kept at `keyPath`, `undefined` when there is none. The cookie is
|
|
72
|
-
* the browser's to change, so parse the value into the shape you keep.
|
|
73
|
-
*/
|
|
74
|
-
const getPreference = (keyPath: string): JsonValue | undefined => {
|
|
70
|
+
const getPreference = <T = unknown>(keyPath: string, defaultValue?: T): T => {
|
|
75
71
|
const value = readAt(tree.value, keyPath.split("."));
|
|
76
|
-
return
|
|
72
|
+
return (value === undefined ? defaultValue : value) as T;
|
|
77
73
|
};
|
|
78
74
|
|
|
79
75
|
const setPreference = (
|
|
@@ -102,7 +98,7 @@ export const usePreferences = () => {
|
|
|
102
98
|
keyPath: string,
|
|
103
99
|
value: Partial<T>,
|
|
104
100
|
): void => {
|
|
105
|
-
const current = getPreference(keyPath);
|
|
101
|
+
const current = getPreference<JsonValue | undefined>(keyPath);
|
|
106
102
|
const merged = isJsonObject(current)
|
|
107
103
|
? { ...current, ...value }
|
|
108
104
|
: { ...value };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nTranslate } from "../composables/translation/useTranslation";
|
|
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?:
|
|
76
|
+
params?: Parameters<I18nTranslate>[1];
|
|
77
77
|
icon?: string;
|
|
78
78
|
color?: ConfirmDialogColor;
|
|
79
79
|
confirmLabel?: string;
|
|
@@ -1,34 +1,3 @@
|
|
|
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
|
-
|
|
32
1
|
export type ComponentOrNoInput =
|
|
33
2
|
| ComponentInfo<ComponentOptionsData>
|
|
34
3
|
| "noInput";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { DataTypeRow } from "./data-type";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Mirror of `PageLivePeriod` from `@antelopejs/interface-dms/page`: whole
|
|
5
3
|
* minutes, hours or days (`"30m"`, `"24h"`, `"7d"`).
|
|
@@ -36,7 +34,9 @@ export type PageLiveNoteTone = "neutral" | "warning" | "error";
|
|
|
36
34
|
*/
|
|
37
35
|
export interface PageLiveNote {
|
|
38
36
|
text: string;
|
|
39
|
-
params?:
|
|
37
|
+
params?: Parameters<
|
|
38
|
+
import("#dms-core/app/composables/translation/useTranslation").I18nTranslate
|
|
39
|
+
>[1];
|
|
40
40
|
tone?: PageLiveNoteTone;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -189,18 +189,11 @@ export interface QuickActionsPayload {
|
|
|
189
189
|
actions: Record<string, QuickActionInfo>;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
* The metadata a child carries in its parent's layout, which its parent's
|
|
194
|
-
* block type declares: the columns it spans in a `GridRow`.
|
|
195
|
-
*/
|
|
196
|
-
interface ComponentChildPlacement {
|
|
197
|
-
slot?: string;
|
|
198
|
-
colSpan?: number;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface ComponentChild<T = object> extends ComponentChildPlacement {
|
|
192
|
+
export interface ComponentChild<T = object> {
|
|
202
193
|
id: string;
|
|
203
194
|
component: ComponentInfo<T>;
|
|
195
|
+
slot?: string;
|
|
196
|
+
[key: string]: unknown;
|
|
204
197
|
}
|
|
205
198
|
|
|
206
199
|
export interface ComponentInfo<T = object> {
|
|
@@ -209,13 +202,14 @@ export interface ComponentInfo<T = object> {
|
|
|
209
202
|
children?: ComponentChild<T>[];
|
|
210
203
|
}
|
|
211
204
|
|
|
212
|
-
export interface ResolvedComponentInfo<T = object>
|
|
213
|
-
extends ComponentChildPlacement {
|
|
205
|
+
export interface ResolvedComponentInfo<T = object> {
|
|
214
206
|
id: string;
|
|
215
207
|
options?: T;
|
|
216
208
|
component: unknown;
|
|
217
209
|
componentName?: string;
|
|
218
210
|
children: ResolvedComponentInfo[];
|
|
211
|
+
slot?: string;
|
|
212
|
+
[key: string]: ComponentChild<T>[string];
|
|
219
213
|
}
|
|
220
214
|
|
|
221
215
|
export interface PageLayout {
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import type { Ref } from "vue";
|
|
2
2
|
import type { ComponentEventData } from "./component";
|
|
3
|
-
import type { DataTypeValue } from "./data-type";
|
|
4
3
|
|
|
5
4
|
export const ComponentId = {
|
|
6
5
|
SELF: "$component:self",
|
|
7
6
|
} as const;
|
|
8
7
|
|
|
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
|
-
|
|
17
8
|
export type WatchActionFunction = (
|
|
18
9
|
action: WatchAction,
|
|
19
10
|
eventData: ComponentEventData,
|
|
20
|
-
componentState: Ref<
|
|
11
|
+
componentState: Ref<Record<string, unknown>>,
|
|
21
12
|
) => void;
|
|
22
13
|
|
|
23
14
|
export interface WatchActionCondition {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { LocationQuery } from "#dms/frontend-module";
|
|
2
|
-
|
|
3
1
|
export function validateRequiredQueryParams(
|
|
4
2
|
requiredParams: string[] | undefined,
|
|
5
3
|
queryParams: ValidationRouteContext["query"],
|
|
@@ -15,7 +13,7 @@ export function validateRequiredQueryParams(
|
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export interface ValidationRouteContext {
|
|
18
|
-
query:
|
|
16
|
+
query: Record<string, unknown>;
|
|
19
17
|
params: ValidationRouteContext["query"];
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DataTypeFormatter } from "../composables/data-types/useDataType";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { get } from "@nuxt/ui/runtime/utils/index.js";
|
|
3
4
|
|
|
4
5
|
const ROW_TOKEN = /\{\{\s*row\.([^{}\s]+)\s*\}\}/g;
|
|
5
6
|
|
|
@@ -28,9 +29,9 @@ const rowValue = (
|
|
|
28
29
|
data: NonNullable<Parameters<DataTypeFormatter>[3]>,
|
|
29
30
|
key: string,
|
|
30
31
|
): string => {
|
|
31
|
-
const field =
|
|
32
|
+
const field: unknown = get(data, key);
|
|
32
33
|
const value = Array.isArray(field) ? field.map(scalarOf) : scalarOf(field);
|
|
33
|
-
return value === undefined || value === null ? "" :
|
|
34
|
+
return value === undefined || value === null ? "" : String(value);
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
const ENCODED_COLON = /%3A/gi;
|
|
@@ -8,6 +8,7 @@ import DmsSegmentedControl from "#dms-ui/app/components/segmented/SegmentedContr
|
|
|
8
8
|
import DmsStatGroup, {
|
|
9
9
|
type StatGroupItem,
|
|
10
10
|
} from "#dms-ui/app/components/stat-group/StatGroup.vue";
|
|
11
|
+
import type { JsonValue } from "#dms-core/app/types/json";
|
|
11
12
|
import type { Tone } from "#dms-core/app/types/tone";
|
|
12
13
|
import { useKeyboardPlatform } from "#dms-ui/app/composables/global/keyboardPlatform";
|
|
13
14
|
import DmsChipGroup from "#dms-ui/app/entries/components/form/ChipGroup";
|
|
@@ -144,7 +145,10 @@ const category = ref<string>(MODULE_CATEGORY_ALL);
|
|
|
144
145
|
const SORT_MODE_PREFERENCE_KEY = "modulesPage.sort";
|
|
145
146
|
const { getPreference, setPreference } = usePreferences();
|
|
146
147
|
const sortMode = computed<ModuleSortMode>({
|
|
147
|
-
get: () =>
|
|
148
|
+
get: () =>
|
|
149
|
+
parseModuleSortMode(
|
|
150
|
+
getPreference<JsonValue | undefined>(SORT_MODE_PREFERENCE_KEY),
|
|
151
|
+
),
|
|
148
152
|
set: (mode) => setPreference(SORT_MODE_PREFERENCE_KEY, mode),
|
|
149
153
|
});
|
|
150
154
|
|
|
@@ -13,7 +13,6 @@ 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";
|
|
17
16
|
import { useDeclaredFieldProps } from "../../composables/form/fieldComponentProps";
|
|
18
17
|
|
|
19
18
|
interface FormFieldControlProps {
|
|
@@ -59,7 +58,7 @@ const hasError = computed(() => {
|
|
|
59
58
|
const { getDataType } = useDataTypes();
|
|
60
59
|
const readonlyValue = computed(() =>
|
|
61
60
|
readonlyFieldValue(
|
|
62
|
-
|
|
61
|
+
state.value[props.field.id],
|
|
63
62
|
initialValues.value?.[props.field.id],
|
|
64
63
|
props.field.type ? getDataType(props.field.type) : undefined,
|
|
65
64
|
props.field.component.options,
|
|
@@ -4,7 +4,6 @@ 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,
|
|
8
7
|
isEmptyFormValue,
|
|
9
8
|
sameFormValue,
|
|
10
9
|
} from "../../composables/unsaved-changes/formValue";
|
|
@@ -19,7 +18,7 @@ const context = inject(FORM_ENTRY_CONTEXT_KEY)!;
|
|
|
19
18
|
const { t, locale } = useI18n();
|
|
20
19
|
const { getDataType } = useDataTypes();
|
|
21
20
|
|
|
22
|
-
const value = computed(() =>
|
|
21
|
+
const value = computed(() => context.state.value[props.field.id]);
|
|
23
22
|
const baseline = computed(() => context.baselineValue(props.field.id));
|
|
24
23
|
const defaultValue = computed(() => props.field.defaultValue);
|
|
25
24
|
|