Skip to content

Commit 2be9ff1

Browse files
committed
fixing layout for multipolygon
1 parent ffa5072 commit 2be9ff1

File tree

6 files changed

+29
-23
lines changed

6 files changed

+29
-23
lines changed

packages/tdb-documents-ui/diff/src/Output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const Output = () => {
6262
"@id": "People/1",
6363
"@type": "People",
6464
"desc": [
65-
"In 2015, the character was selected by Empire magazine as the 50th greatest movie character of all time.[2] On their list of the 100 Greatest Fictional Characters, Fandomania.com ranked the character at number 14.[3]\n\nIn his younger years, Luke used to be called Lukey and it annoyed him very much.\n\n54 43 That's My Number.",
65+
"KITTY In 2015, the character was selected by Empire magazine as the 50th greatest movie character of all time.[2] On their list of the 100 Greatest Fictional Characters, Fandomania.com ranked the character at number 14.[3]\n\nIn his younger years, Luke used to be called Lukey and it annoyed him very much.\n\n54 43 That's My Number.",
6666
"Luke Skywalker is a fictional character and the main protagonist of the original film trilogy of the Star Wars franchise created by George Lucas. The character, portrayed by Mark Hamill, is an important figure in the Rebel Alliance's struggle against the Galactic Empire. He is the twin brother of Rebellion leader Princess Leia Organa of Alderaan, a friend and brother-in-law of smuggler Han Solo, an apprentice to Jedi Masters Obi-Wan \"Ben\" Kenobi and Yoda, the son of fallen Jedi Anakin Skywalker (Darth Vader) and Queen of Naboo/Republic Senator Padmé Amidala and maternal uncle of Kylo Ren / Ben Solo. The now non-canon Star Wars expanded universe depicts him as a powerful Jedi Master, husband of Mara Jade, the father of Ben Skywalker and maternal uncle of Jaina, Jacen and Anakin Solo.\n\nHappy go lucky."
6767
],
6868
"vehicle": [

packages/tdb-documents-ui/geoJSONPlayground/src/frames.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const GEO_JSON_FRAMES = {
1717
"@subdocument": []
1818
}
1919
},
20-
"Location": {
20+
"Location": {
2121
"@key": {
2222
"@type": "Random"
2323
},

packages/tdb-documents-ui/src/arrayHelpers/NestedMultiPolygonTemplate.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const AddCoordinatesPerPolygon = ({ polygonCount, setPolygon, polygon, data, set
113113
for(let count = 0; count < polygonCount; count ++) {
114114
let countID = `Polygon__${count}`
115115
polygonArray.push(
116-
<Card className="bg-secondary" key={`Polygon__${count}`}>
116+
<Card className="bg-secondary w-100 mb-3" key={`Polygon__${count}`}>
117117
<Card.Body>
118118
<Card.Text className="text-muted fst-italic">{`Polygon number - ${count+1}`}</Card.Text>
119119
{coordinatesPerPolygon.hasOwnProperty(countID) && <DisplayCoordinatesLatLng
@@ -160,24 +160,25 @@ export const NestedMultiPolygonArrayFieldTemplate = (args, props, property, id)
160160
setData(arr => [...arr, []])
161161
}
162162

163-
console.log("data", data)
164163

165-
return <Stack gap={3} className="mb-3">
166-
<Stack>
164+
return <Stack gap={3} direction="horizontal" className="mb-3">
165+
<Stack className="col-md-2">
167166
<TDBLabel name={props.name}
168167
required={props.required}
169168
className="tdb__label__width"
170169
id={id}/>
171170
<small className="text-muted fst-italic">Click here to add a new Polygon</small>
172171
</Stack>
173-
<AddCoordinatesPerPolygon polygonCount={polygonCount}
174-
onChangeHandler={props.onChange}
175-
data={data}
176-
setData={setData}
177-
setPolygon={setPolygon}
178-
polygon={polygon}/>
179-
<Button className="btn btn-sm bg-light text-dark" onClick={addPolygon}>
180-
<BiPlus className="mr-1"/>Add Polygon
181-
</Button>
172+
<Stack className="p-3">
173+
<AddCoordinatesPerPolygon polygonCount={polygonCount}
174+
onChangeHandler={props.onChange}
175+
data={data}
176+
setData={setData}
177+
setPolygon={setPolygon}
178+
polygon={polygon}/>
179+
<Button className="btn btn-sm bg-light text-dark" onClick={addPolygon}>
180+
<BiPlus className="mr-1"/>Add Polygon
181+
</Button>
182+
</Stack>
182183
</Stack>
183184
}

packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export function PolygonArrayFieldTemplate(props) {
291291
}
292292

293293
// DISPLAY ADD POLYGON ARRAY TEMPLATE (MULTIPOLYGON)
294-
export function MultiPolygonArrayFieldTemplate(props) {
294+
/*export function MultiPolygonArrayFieldTemplate(props) {
295295
let variant="secondary"
296296
let label=props.title
297297
@@ -312,7 +312,7 @@ export function MultiPolygonArrayFieldTemplate(props) {
312312
<small className="text-muted fst-italics">{`Click here to add another Polygon`}</small>
313313
<AddButton props={props} label={CONST.POLYGON}/>
314314
</div>
315-
}
315+
}*/
316316

317317
// BINDING BOX
318318
export function BBoxFieldTemplate(args, props, property) {
@@ -642,10 +642,11 @@ export const NestedMultiPolygonArrayFieldTemplate = (args, props, property) => {
642642
<TDBLabel name={label}
643643
hideFieldLabel={props.hideFieldLabel}
644644
required={props.required}
645+
className="tdb__label__width"
645646
comment={documentation.comment}
646647
id={`root_Set_${label}`}/>
647648

648-
<Stack gap={2}>
649+
<Stack gap={2} className="test">
649650

650651
<small className="fst-italic text-muted">Click here to add another Polygon</small>
651652

packages/tdb-documents-ui/src/helpers/displayHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export function displayMultiPolygonEditDocument(args, props, property, id) {
459459

460460
export function displayNestedMultiPolygonEditDocument (args, props, property, id) {
461461
//return geoTemplate.NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
462-
return NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
462+
return NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
463463
}
464464

465465

packages/tdb-documents-ui/src/helpers/widgetHelper.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,23 @@ export function getMultiPolygonUIDisplay (args, property) {
244244
return { "ui:field": displayGeoJSONView }
245245
}
246246

247-
function coordinatesArrayTemplate(props) {
248-
return display.displayMultiPolygonEditDocument(args, props, property)
247+
function displayMultiPolygonEdit(props) {
248+
//return display.displayMultiPolygonEditDocument(args, props, property)
249+
let id = props.idSchema["$id"]
250+
return display.displayNestedMultiPolygonEditDocument(args, props, property, id)
249251
}
252+
253+
return { "ui:field": displayMultiPolygonEdit }
250254

251-
return {
255+
/*return {
252256
"ui:ArrayFieldTemplate": geoTemplate.MultiPolygonArrayFieldTemplate,
253257
"items": {
254258
"ui:ArrayFieldTemplate": coordinatesArrayTemplate,
255259
"items": {
256260
"ui:options": CONST.UI_HIDDEN_ARRAY_OPTIONS
257261
}
258262
}
259-
}
263+
}*/
260264

261265
}
262266

0 commit comments

Comments
 (0)