From 518b568c1cbabf4ada6976fb5b630419b0c5376f Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Tue, 24 Sep 2024 22:20:59 +0000 Subject: [PATCH 1/3] added reorganization to settings page --- components/src/components/Map/Component.ts | 4 +- .../Map/editForm/Component.edit.data.ts | 73 +++++++++++-------- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/components/src/components/Map/Component.ts b/components/src/components/Map/Component.ts index bc92c7f8f..e49266f78 100644 --- a/components/src/components/Map/Component.ts +++ b/components/src/components/Map/Component.ts @@ -75,7 +75,7 @@ export default class Component extends (FieldComponent as any) { const { numPoints, defaultZoom, - readOnlyMap, + allowSubmissions, center, defaultValue, myLocation, @@ -97,7 +97,7 @@ export default class Component extends (FieldComponent as any) { form, numPoints, defaultZoom, - readOnlyMap, + readOnlyMap: !allowSubmissions, // if allow submissions, read only is false defaultValue, onDrawnItemsChange: this.saveDrawnItems.bind(this), viewMode, diff --git a/components/src/components/Map/editForm/Component.edit.data.ts b/components/src/components/Map/editForm/Component.edit.data.ts index 29d343100..e72e1f1e5 100644 --- a/components/src/components/Map/editForm/Component.edit.data.ts +++ b/components/src/components/Map/editForm/Component.edit.data.ts @@ -3,6 +3,14 @@ export default { label: 'Data', weight: 20, components: [ + { + html: '

Default Values

', + key: 'simplecontent1', + type: 'simplecontent', + input: false, + tableView: false, + label: 'Text/Images', + }, { type: 'map', label: 'Default Value', @@ -13,32 +21,6 @@ export default { 'This will be the value for this field, before user interaction.', input: true, }, - { - label: 'Marker Type ', - values: [ - { - label: 'Add a point marker (drop a pin)', - value: 'marker', - }, - { - label: - 'Add circular area of interest through a point and custom radius', - value: 'circle', - }, - ], - defaultValue: 'marker', - key: 'markerType', - type: 'simpleradios', - input: true, - }, - { - label: 'How many Markers per Submission?', - key: 'numPoints', - type: 'simplenumber', - defaultValue: 1, - input: true, - }, - { label: 'Default Zoom Level', description: @@ -64,18 +46,51 @@ export default { tableView: false, markerType: 'marker', defaultZoom: 5, - readOnlyMap: false, + allowSubmissions: true, description: 'Please select the desired default center using a single marker', }, { - label: 'Read Only Map', + html: '

Submitter Options

', + key: 'simplecontent1', + type: 'simplecontent', + input: false, + tableView: false, + label: 'Text/Images', + }, + { + label: 'Allow submitters to add input on the map', description: 'This allows for the user to view and scroll the map, but not add any input', - key: 'readOnlyMap', + key: 'allowSubmissions', type: 'simplecheckbox', input: true, }, + { + label: 'Marker Type ', + values: [ + { + label: 'Add a point marker (drop a pin)', + value: 'marker', + }, + { + label: + 'Add circular area of interest through a point and custom radius', + value: 'circle', + }, + ], + defaultValue: 'marker', + key: 'markerType', + type: 'simpleradios', + input: true, + }, + { + label: 'How many Markers per Submission?', + key: 'numPoints', + type: 'simplenumber', + defaultValue: 1, + input: true, + }, { label: 'Submitter "My Location" button', description: From 03d20e4b0358d9ae0ba6eed620259a34f58b1962 Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Thu, 26 Sep 2024 20:35:47 +0000 Subject: [PATCH 2/3] Added multiple marker type options, default to add input map --- components/src/components/Map/Component.ts | 10 ++++++++-- .../src/components/Map/editForm/Component.edit.data.ts | 9 +++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/src/components/Map/Component.ts b/components/src/components/Map/Component.ts index e49266f78..4644c3f94 100644 --- a/components/src/components/Map/Component.ts +++ b/components/src/components/Map/Component.ts @@ -55,6 +55,7 @@ export default class Component extends (FieldComponent as any) { loadMap() { const mapContainer = document.getElementById(`map-${this.componentID}`); const form = document.getElementsByClassName('formio'); + const drawOptions = { marker: false, circlemarker: false, @@ -63,13 +64,18 @@ export default class Component extends (FieldComponent as any) { circle: false, rectangle: null, }; + // set marker type from user choice + if (this.component.markerType) { + for (const [key, value] of Object.entries(this.component.markerType)) { + drawOptions[key] = value; + } + } // Set drawing options based on markerType - if (this.component.markerType === 'rectangle') { + if (this.component?.markerType?.rectangle) { drawOptions.rectangle = { showArea: false }; // fixes a bug in Leaflet.Draw } else { drawOptions.rectangle = false; - drawOptions[this.component.markerType] = true; // set marker type from user choice } const { diff --git a/components/src/components/Map/editForm/Component.edit.data.ts b/components/src/components/Map/editForm/Component.edit.data.ts index e72e1f1e5..5ef215b42 100644 --- a/components/src/components/Map/editForm/Component.edit.data.ts +++ b/components/src/components/Map/editForm/Component.edit.data.ts @@ -44,7 +44,7 @@ export default { label: 'Default Center', numPoints: 1, tableView: false, - markerType: 'marker', + markerType: { marker: true }, defaultZoom: 5, allowSubmissions: true, description: @@ -81,7 +81,7 @@ export default { ], defaultValue: 'marker', key: 'markerType', - type: 'simpleradios', + type: 'simplecheckboxes', input: true, }, { @@ -92,12 +92,13 @@ export default { input: true, }, { - label: 'Submitter "My Location" button', + label: 'Enable Submitter "My Location" button', description: 'This allows for the user to center the map on their location.', key: 'myLocation', - type: 'simplecheckbox', + type: 'simplecheckboxadvanced', input: true, + defaultValue: true, }, ], }; From 34d08675672815e71edbeb3dc96a8e29ad49ea22 Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Thu, 26 Sep 2024 21:13:28 +0000 Subject: [PATCH 3/3] Added default interactivity --- components/src/components/Map/editForm/Component.edit.data.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/components/src/components/Map/editForm/Component.edit.data.ts b/components/src/components/Map/editForm/Component.edit.data.ts index 171ecf627..5a0d9e456 100644 --- a/components/src/components/Map/editForm/Component.edit.data.ts +++ b/components/src/components/Map/editForm/Component.edit.data.ts @@ -72,6 +72,7 @@ export default { 'This allows for the user to view and scroll the map, but not add any input', key: 'allowSubmissions', type: 'simplecheckbox', + defaultValue: true, input: true, }, {