Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const DateValueRequiredSchema = DateValueSchema.safeExtend({

const baseYearValidator = z
.string()
.transform((val) => (val === '' ? null : parseInt(val, 10)))
.transform((val: string) => (val === '' ? null : parseInt(val, 10)))
.pipe(z.number().int().min(1900).max(2100));

export const YearValueSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { GeoJSONFeatureCollectionValue } from '@/bcgov_arches_common/datatypes/geojson-feature-collection/types.ts';

export const blankGeoJSONValue = function (): GeoJSONFeatureCollectionValue {
return {
display_value: '',
node_value: null,
details: [] as never[],
} satisfies GeoJSONFeatureCollectionValue;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EDIT, VIEW } from '@/arches_component_lab/widgets/constants.ts';
import type { WidgetMode } from '@/arches_component_lab/widgets/types.ts';

import type { GeoJSONFeatureCollectionValue } from '@/bcgov_arches_common/datatypes/geojson-feature-collection/types.ts';
import { blankGeoJSONValue } from '@/bcrhp/utils.ts';
import { blankGeoJSONValue } from '@/bcgov_arches_common/datatypes/geojson-feature-collection/utils.ts';

const props = defineProps<{
mode: WidgetMode;
Expand All @@ -29,20 +29,23 @@ function updateGeometries(newValue: GeoJSONFeatureCollectionValue) {
emit('update:value', newValue);
}

const concatenatedAliasedNodeData = computed(() => {
return {
...aliasedNodeDataFromFiles.value,
node_value: {
...aliasedNodeDataFromFiles.value?.node_value,
type: 'FeatureCollection',
// Combine features from both sources
features: [
...(aliasedNodeDataFromFiles.value?.node_value?.features || []),
...(props.aliasedNodeData?.node_value?.features || []),
],
},
};
});
const concatenatedAliasedNodeData = computed<GeoJSONFeatureCollectionValue>(
() => {
return {
...aliasedNodeDataFromFiles.value,
node_value: {
...aliasedNodeDataFromFiles.value?.node_value,
type: 'FeatureCollection',
// Combine features from both sources
features: [
...(aliasedNodeDataFromFiles.value?.node_value?.features ||
[]),
...(props.aliasedNodeData?.node_value?.features || []),
],
},
};
},
);
</script>

<template>
Expand Down