@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.
- package/CHANGELOG.md +21 -0
- package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +1 -0
- package/dist/mcp/page-verify/index.js +1 -0
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/redact-report.d.ts +2 -0
- package/dist/mcp/page-verify/redact-report.js +120 -0
- package/dist/mcp/page-verify/redact-report.js.map +1 -0
- package/dist/mcp/page-verify/render.js +4 -1
- package/dist/mcp/page-verify/render.js.map +1 -1
- package/dist/mcp/redact.d.ts +87 -0
- package/dist/mcp/redact.js +139 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/tools/builder-compose.js +11 -2
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-project.js +56 -23
- package/dist/mcp/tools/builder-project.js.map +1 -1
- package/dist/mcp/tools/builder-queries.js +41 -4
- package/dist/mcp/tools/builder-queries.js.map +1 -1
- package/dist/mcp/tools/builder-shared.d.ts +3 -1
- package/dist/mcp/tools/builder-shared.js +5 -0
- package/dist/mcp/tools/builder-shared.js.map +1 -1
- package/dist/mcp/tools/database.js +3 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/page-verify.js +3 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/frontend-vue/eslint-globals.generated.mjs +259 -942
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
- package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
- package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
- package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
- package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
- package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
- package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
- package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
- package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
- package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
- package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
- package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
- package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
- package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
- package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
- package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
- package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
- package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
- package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
- package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
- package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
- package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
- package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
- package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
- package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
- package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
- package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
- package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
- package/frontend-vue/package.json +2 -1
- package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
- package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
- package/frontend-vue/scripts/check-dms-components.mjs +152 -246
- package/frontend-vue/scripts/check-invariants.mjs +100 -42
- package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
- package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
- package/frontend-vue/scripts/dms-components-script.mjs +375 -0
- package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
- package/frontend-vue/scripts/jsconfig.json +10 -0
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
- package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
- package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
- package/frontend-vue/scripts/test-dms-components.mjs +51 -2
- package/package.json +1 -1
- package/frontend-vue/eslint-test-quality.mjs +0 -62
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isBigint,
|
|
4
|
+
isBoolean,
|
|
5
|
+
isFunction,
|
|
6
|
+
isNull,
|
|
7
|
+
isNumber,
|
|
8
|
+
isObject,
|
|
9
|
+
isString,
|
|
10
|
+
isSymbol,
|
|
11
|
+
isUndefined,
|
|
12
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
3
13
|
import {
|
|
4
14
|
computed,
|
|
5
15
|
defineAsyncComponent,
|
|
@@ -13,12 +23,13 @@ import {
|
|
|
13
23
|
type Component,
|
|
14
24
|
} from "vue";
|
|
15
25
|
import type { VueApexChartsComponentMethods } from "vue3-apexcharts";
|
|
26
|
+
import type { RawOptionSection } from "../../build/composables/chart/apexRawOptions";
|
|
16
27
|
import { ensureApexLocale } from "../../composables/chart/apexLocales";
|
|
17
28
|
|
|
18
29
|
interface Props {
|
|
19
30
|
apexType: string;
|
|
20
31
|
height: number | string;
|
|
21
|
-
options:
|
|
32
|
+
options: RawOptionSection;
|
|
22
33
|
series: unknown;
|
|
23
34
|
}
|
|
24
35
|
|
|
@@ -78,6 +89,42 @@ onBeforeUnmount(() => {
|
|
|
78
89
|
hostResizes?.disconnect();
|
|
79
90
|
});
|
|
80
91
|
|
|
92
|
+
type ApexFunction = typeof isFunction extends (
|
|
93
|
+
value: unknown,
|
|
94
|
+
) => value is infer F
|
|
95
|
+
? F
|
|
96
|
+
: never;
|
|
97
|
+
|
|
98
|
+
/** A value Apex is handed: its options and series, formatters and dates included. */
|
|
99
|
+
type ApexInput =
|
|
100
|
+
| string
|
|
101
|
+
| number
|
|
102
|
+
| boolean
|
|
103
|
+
| bigint
|
|
104
|
+
| symbol
|
|
105
|
+
| null
|
|
106
|
+
| undefined
|
|
107
|
+
| Date
|
|
108
|
+
| ApexFunction
|
|
109
|
+
| ApexInput[]
|
|
110
|
+
| { [key: string]: ApexInput };
|
|
111
|
+
|
|
112
|
+
function isApexLeaf(
|
|
113
|
+
value: unknown,
|
|
114
|
+
): value is Exclude<ApexInput, ApexInput[] | { [key: string]: ApexInput }> {
|
|
115
|
+
return (
|
|
116
|
+
isString(value) ||
|
|
117
|
+
isNumber(value) ||
|
|
118
|
+
isBoolean(value) ||
|
|
119
|
+
isBigint(value) ||
|
|
120
|
+
isSymbol(value) ||
|
|
121
|
+
isNull(value) ||
|
|
122
|
+
isUndefined(value) ||
|
|
123
|
+
isFunction(value) ||
|
|
124
|
+
value instanceof Date
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
81
128
|
/**
|
|
82
129
|
* A plain, non-reactive copy of a value handed to Apex. Apex writes into the
|
|
83
130
|
* series and options it is given, and the wrapper deep-watches its `series`
|
|
@@ -87,23 +134,24 @@ onBeforeUnmount(() => {
|
|
|
87
134
|
* deep watcher only reacts to a new series, breaks that loop. Functions
|
|
88
135
|
* (formatters, event handlers) and dates are kept as they are.
|
|
89
136
|
*/
|
|
90
|
-
function toApexInput
|
|
137
|
+
function toApexInput(value: unknown): ApexInput {
|
|
91
138
|
const raw = toRaw(value);
|
|
139
|
+
if (isApexLeaf(raw)) return raw;
|
|
92
140
|
if (Array.isArray(raw)) {
|
|
93
|
-
return raw.map((entry) => toApexInput(entry))
|
|
141
|
+
return raw.map((entry) => toApexInput(entry));
|
|
94
142
|
}
|
|
95
|
-
|
|
96
|
-
|
|
143
|
+
const copy: { [key: string]: ApexInput } = {};
|
|
144
|
+
if (isObject(raw)) {
|
|
97
145
|
for (const [key, entry] of Object.entries(raw)) {
|
|
98
146
|
copy[key] = toApexInput(entry);
|
|
99
147
|
}
|
|
100
|
-
return copy as T;
|
|
101
148
|
}
|
|
102
|
-
return
|
|
149
|
+
return copy;
|
|
103
150
|
}
|
|
104
151
|
|
|
105
|
-
function rawApexInput
|
|
106
|
-
|
|
152
|
+
function rawApexInput(value: unknown): ApexInput {
|
|
153
|
+
const copy = toApexInput(value);
|
|
154
|
+
return isObject(copy) ? markRaw(copy) : copy;
|
|
107
155
|
}
|
|
108
156
|
|
|
109
157
|
const apexSeries = computed(() => rawApexInput(props.series ?? []));
|
|
@@ -117,7 +165,7 @@ const apexSeries = computed(() => rawApexInput(props.series ?? []));
|
|
|
117
165
|
* so for as long as the page is open, and a screenshot taken mid-redraw
|
|
118
166
|
* shows the ring off centre. The host redraws on width changes instead.
|
|
119
167
|
*/
|
|
120
|
-
function apexOptions(options: Props["options"]):
|
|
168
|
+
function apexOptions(options: Props["options"]): ApexInput {
|
|
121
169
|
const chart = isObject(options.chart) ? options.chart : {};
|
|
122
170
|
return rawApexInput({
|
|
123
171
|
...options,
|
|
@@ -125,7 +173,7 @@ function apexOptions(options: Props["options"]): Props["options"] {
|
|
|
125
173
|
});
|
|
126
174
|
}
|
|
127
175
|
|
|
128
|
-
const pinnedOptions = shallowRef<
|
|
176
|
+
const pinnedOptions = shallowRef<ApexInput>(apexOptions(props.options));
|
|
129
177
|
|
|
130
178
|
function pushOptionsWithoutGroupBroadcast(
|
|
131
179
|
instance: ApexChartInstance,
|
|
@@ -142,7 +190,8 @@ function pushOptionsWithoutGroupBroadcast(
|
|
|
142
190
|
}
|
|
143
191
|
|
|
144
192
|
function axisTypeOf(options: Props["options"]) {
|
|
145
|
-
|
|
193
|
+
const xaxis = options.xaxis;
|
|
194
|
+
return isObject(xaxis) && !isNull(xaxis) ? xaxis.type : undefined;
|
|
146
195
|
}
|
|
147
196
|
|
|
148
197
|
/**
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, inject, ref, watch } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
isNull,
|
|
5
|
+
isObject,
|
|
6
|
+
isString,
|
|
7
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
3
8
|
import DmsEmptyState from "../empty-state/EmptyState.vue";
|
|
4
9
|
import DmsChartSkeleton from "../../build/components/chart/internal/ChartSkeleton.vue";
|
|
5
10
|
import {
|
|
@@ -137,14 +142,18 @@ function localized(series: ChartSeries[]): ChartSeries[] {
|
|
|
137
142
|
const staticSeries = computed<ChartSeries[]>(() => {
|
|
138
143
|
if (isCircular.value) return [];
|
|
139
144
|
if (!props.staticDataset) return [];
|
|
140
|
-
|
|
145
|
+
const dataset: Array<ChartSeries | DonutRecord> = props.staticDataset;
|
|
146
|
+
return localized(
|
|
147
|
+
dataset.flatMap((entry) => ("data" in entry ? [entry] : [])),
|
|
148
|
+
);
|
|
141
149
|
});
|
|
142
150
|
|
|
143
151
|
const staticDonut = computed<DonutRecord[]>(() => {
|
|
144
152
|
if (!isCircular.value) return [];
|
|
145
153
|
if (!props.staticDataset) return [];
|
|
154
|
+
const dataset: Array<ChartSeries | DonutRecord> = props.staticDataset;
|
|
146
155
|
return localizeDonutRecords(
|
|
147
|
-
|
|
156
|
+
dataset.flatMap((entry) => ("data" in entry ? [] : [entry])),
|
|
148
157
|
processI18n,
|
|
149
158
|
);
|
|
150
159
|
});
|
|
@@ -200,6 +209,12 @@ function buildCircularClickPayload(opts: {
|
|
|
200
209
|
};
|
|
201
210
|
}
|
|
202
211
|
|
|
212
|
+
/** The `label` a series point carries, which the click payload names it by. */
|
|
213
|
+
function pointLabel(point: ChartSeries["data"][number] | undefined) {
|
|
214
|
+
if (!isObject(point) || isNull(point)) return undefined;
|
|
215
|
+
return isString(point.label) ? point.label : undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
203
218
|
function buildXyClickPayload(opts: {
|
|
204
219
|
dataPointIndex: number;
|
|
205
220
|
seriesIndex: number;
|
|
@@ -211,10 +226,7 @@ function buildXyClickPayload(opts: {
|
|
|
211
226
|
);
|
|
212
227
|
const point = series?.data[dataPointIndex];
|
|
213
228
|
const pointValue = readPointValue(point);
|
|
214
|
-
const label =
|
|
215
|
-
typeof point === "object" && point !== null && "label" in point
|
|
216
|
-
? point.label
|
|
217
|
-
: undefined;
|
|
229
|
+
const label = pointLabel(point);
|
|
218
230
|
return {
|
|
219
231
|
dataPointIndex,
|
|
220
232
|
seriesIndex: opts.seriesIndex,
|
|
@@ -54,12 +54,16 @@ const LINE_HEIGHT_PX = 19;
|
|
|
54
54
|
|
|
55
55
|
const CODE_PADDING_PX = 16;
|
|
56
56
|
|
|
57
|
-
const WRAP_CLASSES
|
|
57
|
+
const WRAP_CLASSES = {
|
|
58
58
|
false: "whitespace-pre",
|
|
59
59
|
true: "break-words whitespace-pre-wrap",
|
|
60
60
|
anywhere: "whitespace-pre-wrap [overflow-wrap:anywhere]",
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
function isWrapKey(key: string): key is keyof typeof WRAP_CLASSES {
|
|
64
|
+
return Object.hasOwn(WRAP_CLASSES, key);
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
const highlight = shallowRef<CodeHighlighter | null>(null);
|
|
64
68
|
|
|
65
69
|
const language = computed(() => resolveCodeLanguage(props.language));
|
|
@@ -71,9 +75,10 @@ const hasHead = computed(
|
|
|
71
75
|
(!!props.title || props.copy || language.value !== PLAIN_CODE_LANGUAGE),
|
|
72
76
|
);
|
|
73
77
|
const hasFloatingCopy = computed(() => isHeadless.value && props.copy);
|
|
74
|
-
const wrapClass = computed(
|
|
75
|
-
|
|
76
|
-
);
|
|
78
|
+
const wrapClass = computed(() => {
|
|
79
|
+
const key = String(props.wrap);
|
|
80
|
+
return isWrapKey(key) ? WRAP_CLASSES[key] : undefined;
|
|
81
|
+
});
|
|
77
82
|
const tokens = computed<CodeToken[]>(() =>
|
|
78
83
|
highlight.value ? highlight.value(props.code) : [{ text: props.code }],
|
|
79
84
|
);
|
|
@@ -211,11 +211,12 @@ const modalContent = computed(() =>
|
|
|
211
211
|
props.initialFocus
|
|
212
212
|
? {
|
|
213
213
|
onOpenAutoFocus: (event: Event) => {
|
|
214
|
-
const button =
|
|
215
|
-
event.target
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
const button =
|
|
215
|
+
event.target instanceof Element
|
|
216
|
+
? event.target.querySelector<HTMLElement>(
|
|
217
|
+
`[data-confirm-action="${props.initialFocus}"]`,
|
|
218
|
+
)
|
|
219
|
+
: null;
|
|
219
220
|
if (!button) return;
|
|
220
221
|
event.preventDefault();
|
|
221
222
|
button.focus();
|
|
@@ -244,7 +245,9 @@ const isPartialOutcome = (
|
|
|
244
245
|
): value is ConfirmPartialOutcome =>
|
|
245
246
|
isObject(value) && value !== null && "partial" in value;
|
|
246
247
|
|
|
247
|
-
function resolveConfirmationFailure(
|
|
248
|
+
function resolveConfirmationFailure(
|
|
249
|
+
error: Parameters<ApiErrorPresenter["resolveError"]>[0],
|
|
250
|
+
): ApiErrorNotice | null {
|
|
248
251
|
const action = error instanceof ConfirmActionError ? error : undefined;
|
|
249
252
|
return resolveError(error, {
|
|
250
253
|
fallbackKey: action?.message ?? "dms.action_error.generic",
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Background } from "@vue-flow/background";
|
|
3
3
|
import { ControlButton, Controls } from "@vue-flow/controls";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
type Edge,
|
|
6
|
+
type GraphEdge,
|
|
7
|
+
type GraphNode,
|
|
8
|
+
type Node,
|
|
9
|
+
Panel,
|
|
10
|
+
PanelPosition,
|
|
11
|
+
useVueFlow,
|
|
12
|
+
VueFlow,
|
|
13
|
+
} from "@vue-flow/core";
|
|
5
14
|
import { MiniMap } from "@vue-flow/minimap";
|
|
6
15
|
import type { Component } from "vue";
|
|
7
16
|
import { computed, useId, useSlots } from "vue";
|
|
17
|
+
import { isString } from "#dms-core/app/utils/type-check";
|
|
8
18
|
|
|
9
19
|
const DMS_GRID_GAP = 24;
|
|
10
20
|
const DMS_GRID_DOT_SIZE = 1.2;
|
|
@@ -27,23 +37,11 @@ const PANEL_POSITIONS: readonly PanelPosition[] = [
|
|
|
27
37
|
type GridVariant = "dots" | "lines";
|
|
28
38
|
type DeleteKeyCode = string | string[] | null;
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type?: string;
|
|
33
|
-
position: { x: number; y: number };
|
|
34
|
-
data?: Record<string, unknown>;
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
40
|
+
/** A node handed to VueFlow, which may open selected. */
|
|
41
|
+
type FlowNode = Node & Partial<Pick<GraphNode, "selected">>;
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
source: string;
|
|
41
|
-
target: string;
|
|
42
|
-
sourceHandle?: string | null;
|
|
43
|
-
targetHandle?: string | null;
|
|
44
|
-
type?: string;
|
|
45
|
-
[key: string]: unknown;
|
|
46
|
-
}
|
|
43
|
+
/** An edge handed to VueFlow, which may open selected. */
|
|
44
|
+
type FlowEdge = Edge & Partial<Pick<GraphEdge, "selected">>;
|
|
47
45
|
|
|
48
46
|
interface DeleteAffordance {
|
|
49
47
|
id: string;
|
|
@@ -150,7 +148,7 @@ const deleteKeys = computed<Set<string>>(() => {
|
|
|
150
148
|
? DEFAULT_DELETE_KEYS
|
|
151
149
|
: props.deleteKeyCode;
|
|
152
150
|
if (code === null) return new Set();
|
|
153
|
-
return new Set(
|
|
151
|
+
return new Set(isString(code) ? [code] : code);
|
|
154
152
|
});
|
|
155
153
|
|
|
156
154
|
const resolvedDeleteKeyCode = computed<DeleteKeyCode | undefined>(() =>
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { pageLink } from "../../build/composables/page/pageUrlValues";
|
|
3
3
|
import type { FormProps } from "../../composables/form/types/props";
|
|
4
|
-
import type {
|
|
5
|
-
FormData,
|
|
6
|
-
FormFieldValue,
|
|
7
|
-
} from "../../composables/form/types/value";
|
|
8
4
|
import type { FormField } from "../../composables/form/types/field";
|
|
9
5
|
import {
|
|
10
6
|
cloneFormValue,
|
|
@@ -258,7 +254,7 @@ const instantSave = isInstant
|
|
|
258
254
|
fields: allFields,
|
|
259
255
|
isTouched: () => isTouched,
|
|
260
256
|
isFieldValid,
|
|
261
|
-
submit: (changes) => submitChanges(changes
|
|
257
|
+
submit: (changes) => submitChanges(changes),
|
|
262
258
|
onRefused: reportSubmitError,
|
|
263
259
|
})
|
|
264
260
|
: undefined;
|
|
@@ -329,16 +325,15 @@ provide(FORM_CONTENT_LANGUAGE_KEY, "*");
|
|
|
329
325
|
allFields.value.forEach((field) => {
|
|
330
326
|
if (field.defaultValue === undefined) return;
|
|
331
327
|
state.value[field.id] = cloneFormValue(field.defaultValue);
|
|
332
|
-
initialValues.value[field.id] =
|
|
333
|
-
field.defaultValue
|
|
334
|
-
) as FormFieldValue;
|
|
328
|
+
initialValues.value[field.id] =
|
|
329
|
+
cloneFormValue(field.defaultValue) ?? field.defaultValue;
|
|
335
330
|
});
|
|
336
331
|
|
|
337
332
|
for (const [id, value] of Object.entries(
|
|
338
333
|
fieldValuesOfSubmitDefaults(allFields.value, effectiveSubmitDefaults.value),
|
|
339
334
|
)) {
|
|
340
335
|
state.value[id] = cloneFormValue(value);
|
|
341
|
-
initialValues.value[id] = cloneFormValue(value)
|
|
336
|
+
initialValues.value[id] = cloneFormValue(value) ?? value;
|
|
342
337
|
}
|
|
343
338
|
|
|
344
339
|
let recordLoad: FormRecordLoad | undefined;
|
|
@@ -31,7 +31,7 @@ const isExpanded = ref(false);
|
|
|
31
31
|
function withAllLocales(current: Record<string, string>) {
|
|
32
32
|
const updated = { ...current };
|
|
33
33
|
locales.value.forEach((lang) => {
|
|
34
|
-
if (!(lang.code
|
|
34
|
+
if (!Object.hasOwn(updated, lang.code)) {
|
|
35
35
|
updated[lang.code] = "";
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -45,7 +45,7 @@ watch(
|
|
|
45
45
|
fieldValue.value = withAllLocales({});
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (locales.value.some((lang) => !(lang.code
|
|
48
|
+
if (locales.value.some((lang) => !Object.hasOwn(value, lang.code))) {
|
|
49
49
|
fieldValue.value = withAllLocales(value);
|
|
50
50
|
}
|
|
51
51
|
},
|
|
@@ -226,8 +226,8 @@ const mapCountryData = (item: Record<string, string>) => {
|
|
|
226
226
|
const valueKey = props.keyMapping?.value || "value";
|
|
227
227
|
|
|
228
228
|
return {
|
|
229
|
-
label: item[labelKey],
|
|
230
|
-
value: item[valueKey],
|
|
229
|
+
label: Object.hasOwn(item, labelKey) ? item[labelKey] : undefined,
|
|
230
|
+
value: Object.hasOwn(item, valueKey) ? item[valueKey] : undefined,
|
|
231
231
|
};
|
|
232
232
|
};
|
|
233
233
|
|
|
@@ -296,14 +296,11 @@ const onDrop = (event: DragEvent) => {
|
|
|
296
296
|
addFiles(event.dataTransfer?.files ?? null);
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
const isEditableTarget = (target: EventTarget | null): boolean =>
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
Boolean(element?.isContentEditable)
|
|
305
|
-
);
|
|
306
|
-
};
|
|
299
|
+
const isEditableTarget = (target: EventTarget | null): boolean =>
|
|
300
|
+
target instanceof HTMLElement &&
|
|
301
|
+
(target.tagName === "INPUT" ||
|
|
302
|
+
target.tagName === "TEXTAREA" ||
|
|
303
|
+
target.isContentEditable);
|
|
307
304
|
|
|
308
305
|
const onPaste = (event: ClipboardEvent) => {
|
|
309
306
|
if (isEditableTarget(event.target)) return;
|
|
@@ -4,6 +4,7 @@ import { useEditor, EditorContent } from "@tiptap/vue-3";
|
|
|
4
4
|
import TiptapStarterKit from "@tiptap/starter-kit";
|
|
5
5
|
import TextAlign from "@tiptap/extension-text-align";
|
|
6
6
|
import { useFormField } from "@nuxt/ui/composables/useFormField";
|
|
7
|
+
import { isString } from "#dms-core/app/utils/type-check";
|
|
7
8
|
import { FIELD_SURFACE_INVALID_CLASS } from "../../../build/utils/fieldTrigger";
|
|
8
9
|
|
|
9
10
|
interface RichTextProps {
|
|
@@ -94,12 +95,12 @@ const linkUrl = ref("");
|
|
|
94
95
|
const showLinkInput = ref(false);
|
|
95
96
|
|
|
96
97
|
function handleLink() {
|
|
97
|
-
const previousUrl = unref(editor)?.getAttributes("link").href;
|
|
98
|
+
const previousUrl: unknown = unref(editor)?.getAttributes("link").href;
|
|
98
99
|
if (unref(editor)?.state.selection.empty) {
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
linkUrl.value = previousUrl
|
|
103
|
+
linkUrl.value = isString(previousUrl) ? previousUrl : "";
|
|
103
104
|
showLinkInput.value = true;
|
|
104
105
|
}
|
|
105
106
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { VNode } from "vue";
|
|
3
|
+
|
|
2
4
|
interface MdItem {
|
|
3
5
|
value: string | number;
|
|
4
6
|
label: string;
|
|
@@ -14,7 +16,7 @@ defineProps<{
|
|
|
14
16
|
const selected = defineModel<string | number>();
|
|
15
17
|
|
|
16
18
|
defineSlots<{
|
|
17
|
-
default?: (props: { selected: string | number | undefined }) =>
|
|
19
|
+
default?: (props: { selected: string | number | undefined }) => VNode[];
|
|
18
20
|
}>();
|
|
19
21
|
</script>
|
|
20
22
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
limitCalendarRange,
|
|
14
14
|
rangeToCalendar,
|
|
15
15
|
} from "../../build/composables/period/periodDisplay";
|
|
16
|
+
import { toCalendarDay } from "../../build/utils/calendarDay";
|
|
16
17
|
import { CUSTOM_PRESET } from "./periodSelectorPresentation";
|
|
17
18
|
|
|
18
19
|
export function usePeriodSelectorInteraction(
|
|
@@ -61,16 +62,16 @@ export function usePeriodSelectorInteraction(
|
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
64
|
function updateStart(value: DateValue | null | undefined) {
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
const start = toCalendarDay(value);
|
|
66
|
+
if (!start) return;
|
|
66
67
|
const end = draftCalendar.value.end;
|
|
67
68
|
selectCalendarRange(
|
|
68
69
|
start.compare(end) > 0 ? { start, end: start } : { start, end },
|
|
69
70
|
);
|
|
70
71
|
}
|
|
71
72
|
function updateEnd(value: DateValue | null | undefined) {
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
const end = toCalendarDay(value);
|
|
74
|
+
if (!end) return;
|
|
74
75
|
const start = draftCalendar.value.start;
|
|
75
76
|
selectCalendarRange(
|
|
76
77
|
end.compare(start) < 0 ? { start: end, end } : { start, end },
|
|
@@ -88,9 +89,10 @@ export function usePeriodSelectorInteraction(
|
|
|
88
89
|
});
|
|
89
90
|
function onSegmentedClick(event: MouseEvent) {
|
|
90
91
|
if (period.preset.value !== CUSTOM_PRESET) return;
|
|
91
|
-
const segment =
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
const segment =
|
|
93
|
+
event.target instanceof Element
|
|
94
|
+
? event.target.closest("[role='radio']")
|
|
95
|
+
: null;
|
|
94
96
|
if (segment?.getAttribute("aria-checked") === "true") openCustom();
|
|
95
97
|
}
|
|
96
98
|
return {
|
|
@@ -298,7 +298,7 @@ const awaitNewerMoves = async (itemId: string, current: Promise<void>) => {
|
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
const notifyMoveError = (error:
|
|
301
|
+
const notifyMoveError = (error: Parameters<typeof presentError>[0]) => {
|
|
302
302
|
presentError(
|
|
303
303
|
error,
|
|
304
304
|
tableWriteErrorOptions(
|
|
@@ -350,11 +350,16 @@ const onColumnChange = async (
|
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
352
|
|
|
353
|
-
const customCardProps = (item: T, groupValue: string) =>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
const customCardProps = (item: T, groupValue: string) => {
|
|
354
|
+
const cardProps = props.cardContext
|
|
355
|
+
? buildCardProps(item, props.cardContext)
|
|
356
|
+
: undefined;
|
|
357
|
+
return {
|
|
358
|
+
...props.cardComponent?.options,
|
|
359
|
+
...cardProps,
|
|
360
|
+
groupValue,
|
|
361
|
+
};
|
|
362
|
+
};
|
|
358
363
|
|
|
359
364
|
const customCardComponent = computed(() => {
|
|
360
365
|
const componentName = props.cardComponent?.componentName;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Data">
|
|
2
2
|
import { get } from "@nuxt/ui/runtime/utils/index.js";
|
|
3
|
+
import type { ComponentChild, ComponentInfo } from "#dms-core/app/types/page";
|
|
4
|
+
import {
|
|
5
|
+
isBoolean,
|
|
6
|
+
isObject,
|
|
7
|
+
isString,
|
|
8
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
3
9
|
import KanbanBoard from "./KanbanBoard.vue";
|
|
4
10
|
import type { Data } from "../../build/components/table/TableRoot.vue";
|
|
5
11
|
import type {
|
|
@@ -17,9 +23,40 @@ interface KanbanDisplayOptions {
|
|
|
17
23
|
columnMaxHeight?: string;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
const
|
|
21
|
-
()
|
|
22
|
-
|
|
26
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
27
|
+
isObject(value) && value !== null && !Array.isArray(value);
|
|
28
|
+
|
|
29
|
+
const isComponentInfo = (value: unknown): value is ComponentInfo =>
|
|
30
|
+
isRecord(value) &&
|
|
31
|
+
(value.componentName === undefined || isString(value.componentName)) &&
|
|
32
|
+
(value.options === undefined || isRecord(value.options)) &&
|
|
33
|
+
(value.children === undefined ||
|
|
34
|
+
(Array.isArray(value.children) && value.children.every(isComponentChild)));
|
|
35
|
+
|
|
36
|
+
const isComponentChild = (value: unknown): value is ComponentChild =>
|
|
37
|
+
isRecord(value) &&
|
|
38
|
+
isString(value.id) &&
|
|
39
|
+
isComponentInfo(value.component) &&
|
|
40
|
+
(value.slot === undefined || isString(value.slot));
|
|
41
|
+
|
|
42
|
+
const isCardConfig = (value: unknown): value is TableViewCardConfig =>
|
|
43
|
+
isRecord(value) &&
|
|
44
|
+
(value.fields === undefined ||
|
|
45
|
+
(Array.isArray(value.fields) && value.fields.every(isString))) &&
|
|
46
|
+
(value.component === undefined || isComponentInfo(value.component)) &&
|
|
47
|
+
(value.minWidth === undefined || isString(value.minWidth)) &&
|
|
48
|
+
(value.skeletonHeight === undefined || isString(value.skeletonHeight));
|
|
49
|
+
|
|
50
|
+
const options = computed((): KanbanDisplayOptions => {
|
|
51
|
+
const { groupByField, card, draggable, columnMaxHeight } =
|
|
52
|
+
props.context.options ?? {};
|
|
53
|
+
return {
|
|
54
|
+
groupByField: isString(groupByField) ? groupByField : undefined,
|
|
55
|
+
card: isCardConfig(card) ? card : undefined,
|
|
56
|
+
draggable: isBoolean(draggable) ? draggable : undefined,
|
|
57
|
+
columnMaxHeight: isString(columnMaxHeight) ? columnMaxHeight : undefined,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
23
60
|
|
|
24
61
|
const bridge = inject(KANBAN_DISPLAY_BRIDGE_KEY, undefined);
|
|
25
62
|
const fallbackGroupBy = ref(options.value.groupByField ?? "");
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isString,
|
|
3
|
+
isNumber,
|
|
4
|
+
isObject,
|
|
5
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
2
6
|
import type { ChartSeries } from "./types";
|
|
3
7
|
import type { UseApexChartInput } from "./useApexChart.types";
|
|
4
8
|
|
|
@@ -122,7 +126,7 @@ function calendarDayOf(
|
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
function pointX(point: ChartSeries["data"][number]) {
|
|
125
|
-
return
|
|
129
|
+
return isNumber(point) || !point ? undefined : point.x;
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
/** Each series' days, in order, or `null` when a point is not a day. */
|
|
@@ -256,9 +260,9 @@ export function toBucketSeries(
|
|
|
256
260
|
...entry,
|
|
257
261
|
data: buckets.keys.map((key, position) => {
|
|
258
262
|
const point = entry.data[buckets.sourceIndexes[seriesIndex]![position]!];
|
|
259
|
-
return
|
|
260
|
-
? {
|
|
261
|
-
: { x: key
|
|
263
|
+
return isNumber(point) || !isObject(point)
|
|
264
|
+
? { x: key, y: null }
|
|
265
|
+
: { ...point, x: key };
|
|
262
266
|
}),
|
|
263
267
|
}));
|
|
264
268
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isNull,
|
|
3
|
+
isNumber,
|
|
4
|
+
isObject,
|
|
5
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
2
6
|
import type { ChartType } from "./types";
|
|
3
7
|
|
|
4
8
|
export const CHART_EVENT_NAMES = {
|
|
@@ -37,8 +41,7 @@ export function readPointValue(
|
|
|
37
41
|
point: Parameters<typeof isNumber>[0],
|
|
38
42
|
): ClickPointValue {
|
|
39
43
|
if (isNumber(point)) return { value: point };
|
|
40
|
-
const y = (point
|
|
41
|
-
?.y;
|
|
44
|
+
const y = isObject(point) && !isNull(point) ? point.y : undefined;
|
|
42
45
|
if (Array.isArray(y)) return { value: null, values: y };
|
|
43
46
|
return { value: isNumber(y) ? y : null };
|
|
44
47
|
}
|
|
@@ -17,7 +17,7 @@ function parseHex(color: string): RgbColor | null {
|
|
|
17
17
|
const digits = color.slice(1);
|
|
18
18
|
const long =
|
|
19
19
|
digits.length === HEX_SHORT_LENGTH
|
|
20
|
-
?
|
|
20
|
+
? Array.from(digits, (digit) => digit + digit).join("")
|
|
21
21
|
: digits;
|
|
22
22
|
if (long.length !== HEX_LONG_LENGTH) return null;
|
|
23
23
|
const value = Number.parseInt(long, HEX_RADIX);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isNull,
|
|
3
|
+
isObject,
|
|
4
|
+
isString,
|
|
5
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
2
6
|
import type { ChartSeries, DonutRecord } from "./types";
|
|
3
7
|
|
|
4
8
|
/** Writes one display string in the reader's language (`processI18n`). */
|
|
@@ -6,6 +10,13 @@ export type ChartTextTranslate = (text: string) => string;
|
|
|
6
10
|
|
|
7
11
|
type ChartSeriesEntry = ChartSeries["data"][number];
|
|
8
12
|
|
|
13
|
+
/** Whether a point is one of the object shapes, which carry an `x` and maybe a `label`. */
|
|
14
|
+
function isPointObject(
|
|
15
|
+
point: ChartSeriesEntry,
|
|
16
|
+
): point is Exclude<ChartSeriesEntry, number> {
|
|
17
|
+
return isObject(point) && !isNull(point);
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
function translateText<T extends string | number | Date | undefined>(
|
|
10
21
|
value: T,
|
|
11
22
|
translate: ChartTextTranslate,
|
|
@@ -22,7 +33,7 @@ function localizePoint(
|
|
|
22
33
|
point: ChartSeriesEntry,
|
|
23
34
|
translate: ChartTextTranslate,
|
|
24
35
|
): ChartSeriesEntry {
|
|
25
|
-
if (
|
|
36
|
+
if (!isPointObject(point)) return point;
|
|
26
37
|
const localized: typeof point & { label?: string } = { ...point };
|
|
27
38
|
if ("x" in point) localized.x = translateText(point.x, translate);
|
|
28
39
|
if ("label" in point) localized.label = translateText(point.label, translate);
|