blob: f3dc447558255b723fc0e1766301634c4b04639f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import * as React from 'react';
import { ViewBoxBaseComponent } from '../../DocComponent';
import { FieldView, FieldViewProps } from '../FieldView';
import { MapBoxContainer } from '../MapboxMapBox/MapboxContainer';
import { Docs } from '../../../documents/Documents';
import { DocumentType } from '../../../documents/DocumentTypes';
/**
* Map Pushpin doc class
*/
export class MapPushpinBox extends ViewBoxBaseComponent<FieldViewProps>() {
public static LayoutString(fieldKey: string) {
return FieldView.LayoutString(MapPushpinBox, fieldKey);
}
componentDidMount() {
this.mapBoxView.addPushpin(this.Document);
}
componentWillUnmount() {
this.mapBoxView.deletePushpin(this.Document);
}
get mapBoxView() {
return this.DocumentView?.()?.containerViewPath?.().lastElement()?.ComponentView as MapBoxContainer;
}
get mapBox() {
return this.DocumentView?.().containerViewPath?.().lastElement()?.Document;
}
render() {
return <div />;
}
}
Docs.Prototypes.TemplateMap.set(DocumentType.PUSHPIN, {
layout: { view: MapPushpinBox, dataField: 'data' },
options: { acl: '' },
});
|