Skip to content

Commit

Permalink
Merge pull request #1 from abhilash-aot/leaflet-skeleton
Browse files Browse the repository at this point in the history
fixed Unknown Component Render issue
  • Loading branch information
RyanBirtch-aot authored Jun 4, 2024
2 parents 00b4953 + 183e48d commit a236b63
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 48 deletions.
2 changes: 1 addition & 1 deletion app/frontend/src/components/designer/FormDesigner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default {
simplefile: this.form.userType !== this.ID_MODE.PUBLIC,
bcaddress: true,
simplebcaddress: true,
MapComponent: true,
map: true,
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@bcgov/smk": "^1.2.1",
"autocompleter": "^7.0.1",
"formiojs": "^4.14.6",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"native-promise-only": "^0.8.1",
"path-browserify": "^1.0.1",
Expand Down
88 changes: 43 additions & 45 deletions components/src/components/Map/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,53 @@ import { Components } from 'formiojs';
const FieldComponent = (Components as any).components.field;
// import MapService from './services/MapService';

const CENTER = [48.41939025932759,-123.37029576301576]
const CENTER = [48.41939025932759, -123.37029576301576];

class Component extends (FieldComponent as any) {
static schema(...extend) {
return FieldComponent.schema({
type: 'map',
label: 'Map',
key: 'map',
input: true,
...extend,
});
}
static get builderInfo() {
return {
title: 'Map',
group: 'basic',
icon: 'map',
weight: 70,
schema: Component.schema(),
};
}
render() {
return super.render(
`
export default class Component extends (FieldComponent as any) {
static schema(...extend) {
return FieldComponent.schema({
type: 'map',
label: 'Map',
key: 'map',
input: true,
...extend,
});
}
static get builderInfo() {
return {
title: 'Map',
group: 'basic',
icon: 'map',
weight: 70,
schema: Component.schema(),
};
}

render() {
return super.render(
`
<div id="mapContainer" style="height:400px; z-index:1;"></div>
`
)
}
attach(element) {
const superAttach = super.attach(element);
this.loadMap();
return superAttach
}
loadMap() {
const mapContainer = document.getElementById("mapContainer");
const form = document.getElementsByClassName("formio")
const drawOptions = {
circlemarker:false,
polygon: false,
polyline: false,
rectangle:false
}
// MapService({mapContainer, drawOptions, center:CENTER, form})

}

);
}
attach(element) {
const superAttach = super.attach(element);
this.loadMap();
return superAttach;
}
loadMap() {
const mapContainer = document.getElementById('mapContainer');
const form = document.getElementsByClassName('formio');
const drawOptions = {
circlemarker: false,
polygon: false,
polyline: false,
rectangle: false,
};
// MapService({mapContainer, drawOptions, center:CENTER, form})
}
}

// Components.addComponent('map', MapComponent);
export default Component;
export {};
4 changes: 2 additions & 2 deletions components/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import simplesignatureadvanced from './SimpleSignatureAdvanced/Component';
import simplebuttonadvanced from './SimpleButtonAdvanced/Component';
import bcaddress from './BCAddress/Component';
import simplebcaddress from './SimpleBCAddress/Component';
import MapComponent from './Map/Component';
import map from './Map/Component';

export default {
orgbook,
Expand Down Expand Up @@ -95,5 +95,5 @@ export default {
simplebuttonadvanced,
bcaddress,
simplebcaddress,
MapComponent,
map,
};

0 comments on commit a236b63

Please sign in to comment.