@antcde/component-library 0.1.33-rc.2 → 0.1.34
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/dist/build/uno.js +0 -2
- package/dist/build/uno.shortcuts.js +2 -2
- package/dist/index.js +28342 -28347
- package/dist/types/components/AntTourZone/index.vue.d.ts +1 -1
- package/dist/types/components/BaseAppCardSkeleton.vue.d.ts +1 -1
- package/dist/types/components/BaseLimitedButton.vue.d.ts +1 -1
- package/dist/types/components/FilePreviewContent/usePreviewDetails.d.ts +1 -1
- package/dist/types/components/ScriptTrigger/context.d.ts +2 -2
- package/dist/types/components/StackedLabels/index.vue.d.ts +1 -1
- package/dist/types/components/TasksFlow/composables/useFlowEdgeConditionState.d.ts +1 -1
- package/dist/types/components/TasksFlow/composables/useTaskFlow.d.ts +1 -1
- package/dist/types/index.d.ts +45 -2
- package/lib/ForgeViewer/ForgeViewer.vue +43 -0
- package/lib/ForgeViewer/index.ts +4 -0
- package/lib/ForgeViewer/lang/translations/de.json +6 -0
- package/lib/ForgeViewer/lang/translations/en.json +6 -0
- package/lib/ForgeViewer/lang/translations/nl.json +6 -0
- package/lib/ForgeViewer/useForgeViewer.ts +401 -0
- package/lib/GisViewer/GisViewer.vue +67 -0
- package/lib/GisViewer/GisViewerAppBar.vue +34 -0
- package/lib/GisViewer/index.ts +3 -0
- package/lib/GisViewer/useGisViewer.ts +415 -0
- package/lib/build/uno.shortcuts.ts +2 -2
- package/lib/build/uno.ts +0 -2
- package/lib/build/vuetify.ts +1 -4
- package/package.json +17 -6
- package/dist/types/deprecated.d.ts +0 -974
- package/lib/build/fonts.css +0 -26
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ApplicationProps } from './useGisViewer'
|
|
3
|
+
import { watch } from 'vue'
|
|
4
|
+
import GisViewerAppBar from './GisViewerAppBar.vue'
|
|
5
|
+
import { useGisViewer } from './useGisViewer'
|
|
6
|
+
|
|
7
|
+
const { client, widgets, drawings, toolbar = true } = defineProps<ApplicationProps & { toolbar?: boolean }>()
|
|
8
|
+
const {
|
|
9
|
+
clearSketch,
|
|
10
|
+
drawDrawings,
|
|
11
|
+
getSketch,
|
|
12
|
+
loadSketchGraphics,
|
|
13
|
+
setSketchColor,
|
|
14
|
+
toggleWidget,
|
|
15
|
+
} = useGisViewer({ client, widgets }, 'gisViewer')
|
|
16
|
+
|
|
17
|
+
defineExpose({
|
|
18
|
+
getSketch,
|
|
19
|
+
clearSketch,
|
|
20
|
+
setSketchColor,
|
|
21
|
+
toggleWidget,
|
|
22
|
+
loadSketchGraphics,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
watch(() => drawings, (newDrawings) => {
|
|
26
|
+
if (newDrawings && Object.keys(newDrawings).length > 0) {
|
|
27
|
+
// Iterate over each key-value pair in the newDrawings object
|
|
28
|
+
Object.entries(newDrawings).forEach(([sbscode, drawingsArray]) => {
|
|
29
|
+
if (Array.isArray(drawingsArray)) {
|
|
30
|
+
// Call drawDrawings for each sbscode and its corresponding array of drawings
|
|
31
|
+
drawDrawings(sbscode, drawingsArray)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}, { deep: true })
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<GisViewerAppBar v-if="toolbar">
|
|
40
|
+
<template v-if="$slots['toolbar-left']" #toolbar-left>
|
|
41
|
+
<slot name="toolbar-left" />
|
|
42
|
+
</template>
|
|
43
|
+
<template v-if="$slots['toolbar-right']" #toolbar-right>
|
|
44
|
+
<slot name="toolbar-right" />
|
|
45
|
+
</template>
|
|
46
|
+
</GisViewerAppBar>
|
|
47
|
+
<div :class="`w-full gis-wrapper bg-grey-lighten-3 position-relative ${toolbar ? 'toolbar' : ''}`">
|
|
48
|
+
<div id="gisViewer" />
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style lang="scss">
|
|
53
|
+
.gis-wrapper {
|
|
54
|
+
margin-top: 0;
|
|
55
|
+
height: 100vh;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
|
|
58
|
+
&.toolbar {
|
|
59
|
+
margin-top: 64px;
|
|
60
|
+
height: calc(100vh - 64px);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#gisViewer {
|
|
65
|
+
height: 100%;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Project } from './useGisViewer'
|
|
3
|
+
|
|
4
|
+
interface GisViewerAppbarProps {
|
|
5
|
+
project?: Project
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { project } = defineProps<GisViewerAppbarProps>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<v-app-bar color="grey-lighten-3" dark dense flat position-relative>
|
|
13
|
+
<v-app-bar-title>
|
|
14
|
+
<div class="d-flex justify-space-between">
|
|
15
|
+
<div>
|
|
16
|
+
{{ project?.name || 'Timeline planner' }}
|
|
17
|
+
<slot name="toolbar-left">
|
|
18
|
+
<v-btn @click="() => {}">
|
|
19
|
+
AppBar
|
|
20
|
+
<v-icon> mdi-alert</v-icon>
|
|
21
|
+
</v-btn>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
<div>
|
|
25
|
+
<slot name="toolbar-right">
|
|
26
|
+
<v-btn @click="() => {}">
|
|
27
|
+
<v-icon> mdi-alert</v-icon>
|
|
28
|
+
</v-btn>
|
|
29
|
+
</slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</v-app-bar-title>
|
|
33
|
+
</v-app-bar>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import type { TableRecords } from '@antcde/connect-ts'
|
|
2
|
+
import type { UseCommsClient } from '@antcde/vue-utils'
|
|
3
|
+
import Graphic from '@arcgis/core/Graphic'
|
|
4
|
+
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer'
|
|
5
|
+
import Map from '@arcgis/core/Map'
|
|
6
|
+
import SimpleFillSymbol from '@arcgis/core/symbols/SimpleFillSymbol'
|
|
7
|
+
import SimpleLineSymbol from '@arcgis/core/symbols/SimpleLineSymbol'
|
|
8
|
+
import MapView from '@arcgis/core/views/MapView'
|
|
9
|
+
import LayerList from '@arcgis/core/widgets/LayerList'
|
|
10
|
+
import SketchWidget from '@arcgis/core/widgets/Sketch'
|
|
11
|
+
import { onUnmounted, ref, shallowRef, watch } from 'vue'
|
|
12
|
+
|
|
13
|
+
export interface Project {
|
|
14
|
+
id: string
|
|
15
|
+
name: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ApplicationProps {
|
|
19
|
+
client: UseCommsClient
|
|
20
|
+
widgets?: object
|
|
21
|
+
drawings?: object
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GisComposable {
|
|
25
|
+
map: any
|
|
26
|
+
view: any
|
|
27
|
+
featureLayerView: any
|
|
28
|
+
sketchLayer: any
|
|
29
|
+
widgets: any
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ZOOM = 12
|
|
33
|
+
const BASEMAP = 'topo-vector'
|
|
34
|
+
|
|
35
|
+
export const GIS_VIEWER_WIDGETS = {
|
|
36
|
+
HOME: 'home',
|
|
37
|
+
LAYER_LIST: 'layerList',
|
|
38
|
+
SEARCH: 'search',
|
|
39
|
+
ZOOM: 'zoom',
|
|
40
|
+
BASEMAP_TOGGLE: 'basemapToggle',
|
|
41
|
+
BASEMAP_GALLERY: 'basemapGallery',
|
|
42
|
+
MEASUREMENT: 'measurement',
|
|
43
|
+
SKETCH: 'sketch',
|
|
44
|
+
RFI: 'rfi',
|
|
45
|
+
} as const
|
|
46
|
+
|
|
47
|
+
type WidgetType = typeof GIS_VIEWER_WIDGETS[keyof typeof GIS_VIEWER_WIDGETS]
|
|
48
|
+
|
|
49
|
+
export function useGisViewer({ client, widgets = {} }: ApplicationProps, containerValue: string) {
|
|
50
|
+
const container = ref(containerValue)
|
|
51
|
+
const gisViewer = shallowRef<GisComposable>({
|
|
52
|
+
map: null,
|
|
53
|
+
view: null,
|
|
54
|
+
featureLayerView: null,
|
|
55
|
+
sketchLayer: null,
|
|
56
|
+
widgets: {},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const { connect: antConnect, context } = client
|
|
60
|
+
|
|
61
|
+
// Fetch records for the project
|
|
62
|
+
const fetchMapProperties = async (projectId: string): Promise<TableRecords | null> => {
|
|
63
|
+
try {
|
|
64
|
+
return await antConnect.tables.queryTables(createTableQueryPayload(projectId)) as TableRecords
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('Error fetching records:', error)
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const clearSketch = () => {
|
|
73
|
+
if (gisViewer.value?.sketchLayer) {
|
|
74
|
+
// Clear existing drawings in the layer
|
|
75
|
+
gisViewer.value?.sketchLayer.removeAll()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const getSketch = () => {
|
|
80
|
+
const items = gisViewer.value?.sketchLayer?.graphics?.items || []
|
|
81
|
+
return items.map((i: any) => ({
|
|
82
|
+
symbol: {
|
|
83
|
+
type: i.symbol.type,
|
|
84
|
+
size: i.symbol.size,
|
|
85
|
+
style: i.symbol.style,
|
|
86
|
+
color: i.symbol.color.toRgba(),
|
|
87
|
+
width: i.symbol.width,
|
|
88
|
+
outline: i.symbol.outline
|
|
89
|
+
? {
|
|
90
|
+
type: i.symbol.outline.type,
|
|
91
|
+
color: i.symbol.outline.color.toRgba(),
|
|
92
|
+
width: i.symbol.outline.width,
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
},
|
|
96
|
+
geometry: {
|
|
97
|
+
spatialReference: i.geometry.spatialReference,
|
|
98
|
+
type: i.geometry.type,
|
|
99
|
+
paths: i.geometry.paths,
|
|
100
|
+
rings: i.geometry.rings,
|
|
101
|
+
latitude: i.geometry.latitude,
|
|
102
|
+
longitude: i.geometry.longitude,
|
|
103
|
+
},
|
|
104
|
+
}))
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const addSketchLayer = (sketchWidget: any) => {
|
|
108
|
+
const layer = new GraphicsLayer({ title: 'Sketch' })
|
|
109
|
+
gisViewer.value.map.add(layer)
|
|
110
|
+
sketchWidget.layer = layer
|
|
111
|
+
gisViewer.value.sketchLayer = layer
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const removeSketchLayer = (sketchWidget: any) => {
|
|
115
|
+
sketchWidget.layer = undefined
|
|
116
|
+
gisViewer.value.sketchLayer.destroy()
|
|
117
|
+
gisViewer.value.map.remove(gisViewer.value.sketchLayer)
|
|
118
|
+
gisViewer.value.sketchLayer = null
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const toggleWidget = (widget: WidgetType, state: boolean) => {
|
|
122
|
+
if (widget && gisViewer.value) {
|
|
123
|
+
const widgetTarget = gisViewer.value.widgets[widget]
|
|
124
|
+
widgetTarget.visible = state
|
|
125
|
+
if (widget === GIS_VIEWER_WIDGETS.SKETCH) {
|
|
126
|
+
if (state) {
|
|
127
|
+
addSketchLayer(widgetTarget)
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
removeSketchLayer(widgetTarget)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const setSketchColor = (rgbColor: { r: number, g: number, b: number }) => {
|
|
137
|
+
if (!rgbColor) {
|
|
138
|
+
throw new Error('Color not available')
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const { r, g, b } = rgbColor
|
|
142
|
+
const items = gisViewer.value?.sketchLayer?.graphics?.items || []
|
|
143
|
+
items.forEach((i: any) => {
|
|
144
|
+
if (i?.symbol?.type === 'simple-line') {
|
|
145
|
+
i.symbol.color = [r, g, b, 0.9]
|
|
146
|
+
}
|
|
147
|
+
else if (i?.symbol?.type === 'simple-fill') {
|
|
148
|
+
i.symbol.color = [r, g, b, 0.4]
|
|
149
|
+
i.symbol.outline.color = [r, g, b, 0.9]
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
const widgetViewModel = gisViewer.value?.widgets?.sketch?.viewModel
|
|
154
|
+
if (widgetViewModel) {
|
|
155
|
+
widgetViewModel.polylineSymbol = {
|
|
156
|
+
type: 'simple-line',
|
|
157
|
+
color: [r, g, b, 1],
|
|
158
|
+
width: 2,
|
|
159
|
+
style: 'solid',
|
|
160
|
+
}
|
|
161
|
+
widgetViewModel.polygonSymbol = {
|
|
162
|
+
type: 'simple-fill',
|
|
163
|
+
color: [r, g, b, 0.4],
|
|
164
|
+
outline: {
|
|
165
|
+
color: [r, g, b, 0.9],
|
|
166
|
+
width: 2,
|
|
167
|
+
},
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// To force rerender LayerView on color change
|
|
172
|
+
const graphic = gisViewer.value?.sketchLayer?.graphics?.items[0]?.clone()
|
|
173
|
+
if (graphic) {
|
|
174
|
+
gisViewer.value?.sketchLayer.add(graphic)
|
|
175
|
+
gisViewer.value?.sketchLayer.remove(graphic)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const drawDrawings = (title: string, drawings: any) => {
|
|
180
|
+
const map = gisViewer.value.map // Assuming your map instance is accessible through gisViewer
|
|
181
|
+
if (!map) {
|
|
182
|
+
console.error('Map not initialized')
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Check if a layer with the same title already exists
|
|
187
|
+
let existingLayer = map.layers.find((layer: any) => layer.title === title) as GraphicsLayer | undefined
|
|
188
|
+
|
|
189
|
+
if (existingLayer) {
|
|
190
|
+
// Clear existing drawings in the layer
|
|
191
|
+
existingLayer.removeAll()
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
map.layers.destroyAll()
|
|
195
|
+
// Create a new GraphicsLayer if one does not already exist
|
|
196
|
+
existingLayer = new GraphicsLayer({ title })
|
|
197
|
+
map.add(existingLayer)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Iterate over the drawings array and create Graphics for each one
|
|
201
|
+
drawings.forEach((drawing: any) => {
|
|
202
|
+
const graphic = new Graphic({
|
|
203
|
+
geometry: drawing.geometry, // Use the geometry from the drawing
|
|
204
|
+
symbol: drawing.symbol, // Use the symbol from the drawing
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
// Add the graphic to the existing (or newly created) graphicsLayer
|
|
208
|
+
existingLayer.add(graphic)
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const loadSketchGraphics = (drawings: any[]) => {
|
|
213
|
+
if (gisViewer.value.sketchLayer) {
|
|
214
|
+
clearSketch()
|
|
215
|
+
drawings.forEach((drawing: any) => {
|
|
216
|
+
const graphic = new Graphic({
|
|
217
|
+
geometry: drawing.geometry, // Use the geometry from the drawing
|
|
218
|
+
symbol: drawing.symbol, // Use the symbol from the drawing
|
|
219
|
+
})
|
|
220
|
+
gisViewer.value?.sketchLayer.add(graphic)
|
|
221
|
+
})
|
|
222
|
+
const graphics = gisViewer.value.sketchLayer.graphics.items
|
|
223
|
+
if (graphics.length > 0) {
|
|
224
|
+
const lastGraphic = graphics[graphics.length - 1]
|
|
225
|
+
if (lastGraphic.geometry) {
|
|
226
|
+
const zoom = gisViewer.value?.view?.zoom
|
|
227
|
+
// Get the center of the graphic's geometry (or use its centroid if it's not a point)
|
|
228
|
+
const targetGeometry = lastGraphic.geometry
|
|
229
|
+
const targetPoint = targetGeometry.type === 'point' ? targetGeometry : targetGeometry.extent.center
|
|
230
|
+
|
|
231
|
+
const screenPoint = gisViewer.value?.view.toScreen(targetPoint)
|
|
232
|
+
|
|
233
|
+
const offsetScreenPoint = {
|
|
234
|
+
x: screenPoint.x,
|
|
235
|
+
y: screenPoint.y + 250, // Scroll 250 pixels up to show graphic above the planner
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Convert the offset screen coordinates back to map coordinates
|
|
239
|
+
const offsetMapPoint = gisViewer.value?.view.toMap(offsetScreenPoint)
|
|
240
|
+
|
|
241
|
+
// Use goTo with the offset map point as the new center
|
|
242
|
+
gisViewer.value?.view.goTo({
|
|
243
|
+
center: offsetMapPoint,
|
|
244
|
+
zoom: zoom || ZOOM,
|
|
245
|
+
}).catch((error: any) => {
|
|
246
|
+
console.error('Error going to the offset point:', error)
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
console.warn('No graphics available in the sketch layer.')
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const initializeViewer = async (containerId: string, mapProperties: any) => {
|
|
257
|
+
const { basemap, zoom, center, ground, basemap_opacity, ground_opacity } = mapProperties
|
|
258
|
+
|
|
259
|
+
// Create a new map with the basemap from the recordsResponse
|
|
260
|
+
const map = new Map({
|
|
261
|
+
basemap: basemap || BASEMAP, // Use the response basemap, or fallback to default
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
// Set basemap opacity
|
|
265
|
+
if (basemap_opacity !== undefined) {
|
|
266
|
+
map.layers.forEach((layer) => {
|
|
267
|
+
// FIXME: strange value that we have no in types
|
|
268
|
+
// @ts-expect-error strange value that we have no in types
|
|
269
|
+
if (layer.type === 'basemap') {
|
|
270
|
+
layer.opacity = basemap_opacity // Set the opacity of the basemap
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Set ground (elevation layer)
|
|
276
|
+
if (ground) {
|
|
277
|
+
map.ground = {
|
|
278
|
+
// @ts-expect-error JS stuff
|
|
279
|
+
layers: [{ id: 'world-elevation', opacity: ground_opacity || 1 }],
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
gisViewer.value.map = map
|
|
284
|
+
|
|
285
|
+
// Convert the center from string format "[longitude, latitude]" to an array
|
|
286
|
+
const parsedCenter = center ? JSON.parse(center) : [-118.805, 34.027] // Default center if none provided
|
|
287
|
+
|
|
288
|
+
// Create a new MapView with the map, center, and zoom from the recordsResponse
|
|
289
|
+
const view = new MapView({
|
|
290
|
+
map,
|
|
291
|
+
container: containerId,
|
|
292
|
+
center: parsedCenter, // Use the center from the response
|
|
293
|
+
zoom: zoom || ZOOM, // Use the zoom level from the response, or fallback to default
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
gisViewer.value.view = view
|
|
297
|
+
|
|
298
|
+
const loadWidgets = (gisViewer: GisComposable, view: MapView, widgets: object) => {
|
|
299
|
+
Object.entries(widgets).forEach(([key, enabled]) => {
|
|
300
|
+
if (!enabled)
|
|
301
|
+
return
|
|
302
|
+
|
|
303
|
+
switch (key) {
|
|
304
|
+
case GIS_VIEWER_WIDGETS.LAYER_LIST: {
|
|
305
|
+
const layerList = new LayerList({ view })
|
|
306
|
+
gisViewer.widgets[GIS_VIEWER_WIDGETS.LAYER_LIST] = layerList
|
|
307
|
+
view.ui.add(layerList, 'top-right')
|
|
308
|
+
break
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
case GIS_VIEWER_WIDGETS.SKETCH: {
|
|
312
|
+
const sketchWidget = new SketchWidget({
|
|
313
|
+
view,
|
|
314
|
+
visible: false,
|
|
315
|
+
creationMode: 'update',
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
sketchWidget.viewModel.polylineSymbol = new SimpleLineSymbol({
|
|
319
|
+
type: 'simple-line',
|
|
320
|
+
color: [0, 0, 0, 1],
|
|
321
|
+
width: 2,
|
|
322
|
+
style: 'solid',
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
sketchWidget.viewModel.polygonSymbol = new SimpleFillSymbol({
|
|
326
|
+
type: 'simple-fill',
|
|
327
|
+
color: [0, 0, 0, 0.4],
|
|
328
|
+
outline: {
|
|
329
|
+
color: [0, 0, 0, 0.9],
|
|
330
|
+
width: 2,
|
|
331
|
+
},
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
gisViewer.widgets[GIS_VIEWER_WIDGETS.SKETCH] = sketchWidget
|
|
335
|
+
view.ui.add(sketchWidget, {
|
|
336
|
+
position: 'top-left',
|
|
337
|
+
index: 0,
|
|
338
|
+
})
|
|
339
|
+
break
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Add more widgets as needed
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Load widgets based on the provided config
|
|
348
|
+
await view.when(() => {
|
|
349
|
+
loadWidgets(gisViewer.value, view, widgets)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
// Clean up the view and its resources on unmount
|
|
353
|
+
onUnmounted(() => {
|
|
354
|
+
if (view) {
|
|
355
|
+
view.destroy()
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const records = ref<TableRecords | null>(null)
|
|
361
|
+
|
|
362
|
+
watch(
|
|
363
|
+
() => context.value.project?.id,
|
|
364
|
+
async projectId => projectId && (records.value = await fetchMapProperties(projectId)),
|
|
365
|
+
{ immediate: true },
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
watch(
|
|
369
|
+
() => [records.value, container.value] as const,
|
|
370
|
+
async ([records, newContainer]) => {
|
|
371
|
+
if (!newContainer)
|
|
372
|
+
return
|
|
373
|
+
|
|
374
|
+
if (records?.properties?.records && records?.properties?.records?.length > 0) {
|
|
375
|
+
const mapProperties = records?.properties.records[0] // Extract map properties
|
|
376
|
+
|
|
377
|
+
// Initialize the viewer with map properties
|
|
378
|
+
await initializeViewer(newContainer, mapProperties)
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
{ immediate: true },
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
return {
|
|
385
|
+
toggleWidget,
|
|
386
|
+
drawDrawings,
|
|
387
|
+
getSketch,
|
|
388
|
+
clearSketch,
|
|
389
|
+
setSketchColor,
|
|
390
|
+
loadSketchGraphics,
|
|
391
|
+
gisViewer,
|
|
392
|
+
container,
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function createTableQueryPayload(projectId: string) {
|
|
397
|
+
return {
|
|
398
|
+
tables: [
|
|
399
|
+
{
|
|
400
|
+
name: 'CFFA_GIS_PROPERTIES',
|
|
401
|
+
project: projectId,
|
|
402
|
+
as: 'properties',
|
|
403
|
+
columns: [
|
|
404
|
+
'token',
|
|
405
|
+
'basemap',
|
|
406
|
+
'basemap_opacity',
|
|
407
|
+
'ground',
|
|
408
|
+
'ground_opacity',
|
|
409
|
+
'zoom',
|
|
410
|
+
'center',
|
|
411
|
+
].map(name => ({ name })),
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
}
|
|
415
|
+
}
|
|
@@ -125,7 +125,7 @@ export const antShortcuts: [string, string][] = [
|
|
|
125
125
|
['ant-install-another-btn', 'w-full mt-1.5 mb-1 h-[30px] bg-transparent border border-dashed border-ant text-muted [font-family:inherit] text-[12px] font-medium rounded-lg cursor-pointer inline-flex items-center justify-center gap-1 hover:bg-ant-hover'],
|
|
126
126
|
|
|
127
127
|
// Small metadata chip.
|
|
128
|
-
['ant-cat-chip', 'h-[22px] px-2 inline-flex items-center rounded-
|
|
128
|
+
['ant-cat-chip', 'h-[22px] px-2 inline-flex items-center rounded-md bg-ant-inset text-[11px] font-medium text-muted whitespace-nowrap cursor-pointer hover:bg-ant-hover'],
|
|
129
129
|
|
|
130
130
|
['ant-icon-button', 'inline-flex items-center justify-center w-7 h-7 rounded-lg bg-transparent border-0 text-muted cursor-pointer hover:bg-ant-hover hover:text-body'],
|
|
131
131
|
|
|
@@ -223,7 +223,7 @@ export const antShortcuts: [string, string][] = [
|
|
|
223
223
|
// Tiny uppercase tag for a fact about a row — "CUSTOM PATH", "TABLE". Inset
|
|
224
224
|
// rather than tinted: it qualifies the row it sits in, it does not report a state,
|
|
225
225
|
// so it must not read as a status pill.
|
|
226
|
-
['ant-tag-inset', 'text-[10px] font-semibold tracking-[0.03em] uppercase px-1.5 py-0.5 rounded
|
|
226
|
+
['ant-tag-inset', 'text-[10px] font-semibold tracking-[0.03em] uppercase px-1.5 py-0.5 rounded bg-ant-inset text-muted'],
|
|
227
227
|
|
|
228
228
|
// The chooser's radio. 18px, and the SELECTED one is FILLED with a white dot in
|
|
229
229
|
// it — not an outline with a coloured dot, which is the weaker treatment this
|
package/lib/build/uno.ts
CHANGED
|
@@ -145,8 +145,6 @@ export function createAntUnoConfig(overrides: Partial<UserConfig> = {}): UserCon
|
|
|
145
145
|
colors: { ...antColors, ...(overrideTheme?.colors ?? {}) },
|
|
146
146
|
breakpoints: { ...vuetifyBreakpoints, ...(overrideTheme?.breakpoints ?? {}) },
|
|
147
147
|
radius: { sm: '2px', xl: '24px', ...(overrideTheme?.radius ?? {}) },
|
|
148
|
-
// Follows Vuetify's font variable (set in fonts.css), so `font-sans` stays Inter.
|
|
149
|
-
font: { sans: 'var(--v-font-body)', ...(overrideTheme?.font ?? {}) },
|
|
150
148
|
},
|
|
151
149
|
presets: presets ?? [
|
|
152
150
|
presetRemToPx,
|
package/lib/build/vuetify.ts
CHANGED
|
@@ -8,8 +8,6 @@ import 'vuetify/styles'
|
|
|
8
8
|
import 'virtual:uno.css'
|
|
9
9
|
// CSS patches for Vuetify quirks not expressible via theme/defaults.
|
|
10
10
|
import './vuetify-overrides.css'
|
|
11
|
-
// Inter + `--v-font-body`, so every app gets the platform font.
|
|
12
|
-
import './fonts.css'
|
|
13
11
|
|
|
14
12
|
/** ANT platform light theme colors — exported for apps that need to reference them in `themes` overrides (e.g. when adding a dark theme). */
|
|
15
13
|
export const ANT_COLORS = {
|
|
@@ -122,9 +120,8 @@ export const ANT_DEFAULTS: VuetifyOptions['defaults'] = {
|
|
|
122
120
|
VBtnGroup: {
|
|
123
121
|
rounded: 'xl',
|
|
124
122
|
},
|
|
125
|
-
// Chips are pills, like every badge in the shell; `xl` (24px) read as squarer on tall chips.
|
|
126
123
|
VChip: {
|
|
127
|
-
rounded: '
|
|
124
|
+
rounded: 'xl',
|
|
128
125
|
},
|
|
129
126
|
// Form fields use `lg` (8px) — closest Vuetify scale to the 10px target shared
|
|
130
127
|
// with the storefront mockups. `xl` (24px) is reserved for cards/buttons/chips
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/component-library",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.34",
|
|
5
5
|
"description": "Helper to use ant components in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"exports": {
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"import": "./lib/build/vuetify.ts"
|
|
28
28
|
},
|
|
29
29
|
"./build/layer-order.css": "./lib/build/layer-order.css",
|
|
30
|
-
"./build/fonts.css": "./lib/build/fonts.css",
|
|
31
30
|
"./test": {
|
|
32
31
|
"import": "./lib/test/index.ts"
|
|
33
32
|
},
|
|
@@ -54,12 +53,24 @@
|
|
|
54
53
|
"./test/createTestRouter": {
|
|
55
54
|
"import": "./lib/test/createTestRouter.ts"
|
|
56
55
|
},
|
|
56
|
+
"./lib/ForgeViewer": {
|
|
57
|
+
"import": "./lib/ForgeViewer/index.ts"
|
|
58
|
+
},
|
|
59
|
+
"./lib/ForgeViewer/*": {
|
|
60
|
+
"import": "./lib/ForgeViewer/*"
|
|
61
|
+
},
|
|
57
62
|
"./lib/PdfViewer": {
|
|
58
63
|
"import": "./lib/PdfViewer/index.ts"
|
|
59
64
|
},
|
|
60
65
|
"./lib/PdfViewer/*": {
|
|
61
66
|
"import": "./lib/PdfViewer/*"
|
|
62
67
|
},
|
|
68
|
+
"./lib/GisViewer": {
|
|
69
|
+
"import": "./lib/GisViewer/index.ts"
|
|
70
|
+
},
|
|
71
|
+
"./lib/GisViewer/*": {
|
|
72
|
+
"import": "./lib/GisViewer/*"
|
|
73
|
+
},
|
|
63
74
|
"./lib/TableViewer": {
|
|
64
75
|
"import": "./lib/TableViewer/index.ts"
|
|
65
76
|
},
|
|
@@ -99,7 +110,7 @@
|
|
|
99
110
|
"build:safelist": "vite-node lib/build/genSafelist.mjs"
|
|
100
111
|
},
|
|
101
112
|
"peerDependencies": {
|
|
102
|
-
"@antcde/connect-ts": ">=0.
|
|
113
|
+
"@antcde/connect-ts": ">=0.4.0",
|
|
103
114
|
"@antcde/vue-utils": ">=0.2.0",
|
|
104
115
|
"@iconify/vue": ">=5.0.0",
|
|
105
116
|
"@intlify/unplugin-vue-i18n": ">=11.0.0",
|
|
@@ -179,7 +190,7 @@
|
|
|
179
190
|
}
|
|
180
191
|
},
|
|
181
192
|
"dependencies": {
|
|
182
|
-
"@
|
|
193
|
+
"@arcgis/core": "^4.34.8",
|
|
183
194
|
"@mdi/font": "^7.4.47",
|
|
184
195
|
"@tiptap/extension-link": "^3.31.3",
|
|
185
196
|
"@tiptap/extension-mention": "^3.31.3",
|
|
@@ -197,8 +208,8 @@
|
|
|
197
208
|
"vue-i18n": "^11.4.12"
|
|
198
209
|
},
|
|
199
210
|
"devDependencies": {
|
|
200
|
-
"@antcde/connect-ts": "0.4.
|
|
201
|
-
"@antcde/vue-utils": "0.2.
|
|
211
|
+
"@antcde/connect-ts": "0.4.36",
|
|
212
|
+
"@antcde/vue-utils": "0.2.31",
|
|
202
213
|
"@iconify-json/mdi": "^1.2.3",
|
|
203
214
|
"@iconify/vue": "^5.0.3",
|
|
204
215
|
"@intlify/unplugin-vue-i18n": "^11.2.5",
|