Skip to content

Commit 7085a34

Browse files
committed
multipolygon fixes
1 parent 2be9ff1 commit 7085a34

File tree

11 files changed

+31
-95
lines changed

11 files changed

+31
-95
lines changed

packages/tdb-documents-ui/src/addGeoJSONLayout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export function addGeoJSONLayout (layout, documentFrame, property) {
3434
}
3535
else if (util.isMultiPolygonType(field) && util.isMultiPolygon(documentFrame)) {
3636
layout["items"]= {
37-
"type": CONST.ARRAY_TYPE,
37+
"type": CONST.ARRAY_TYPE/*,
3838
"items": {
3939
"type": CONST.ARRAY_TYPE,
4040
"items": { type: CONST.STRING_TYPE },
4141
"minItems": CONST.POINT_MIN_ITEMS
42-
}
42+
}*/
4343
}
4444
}
4545
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const DisplayCoordinatesLatLng = ({ coordinatesPerPolygon, polygonID, polygonInd
3535
}
3636
//temp[polygonIndex][coordinateIndex]=coord
3737
temp[polygonIndex][coordinateIndex]=coord
38-
if(onChangeHandler) onChangeHandler([data], CONST.COORDINATES_FIELD)
38+
//if(onChangeHandler) onChangeHandler([data], CONST.COORDINATES_FIELD)
39+
if(onChangeHandler) onChangeHandler([data])
3940
setData(data)
4041
}
4142

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

Lines changed: 3 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 PolygonArrayFieldTemplate(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) {
@@ -646,7 +646,7 @@ export const NestedMultiPolygonArrayFieldTemplate = (args, props, property) => {
646646
comment={documentation.comment}
647647
id={`root_Set_${label}`}/>
648648

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

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

packages/tdb-documents-ui/src/css/terminusdb__styles.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
/** tdb input */
3030
.tdb__doc__input {
31-
color: var(--input-color);
31+
color: var(--input-color) !important;
3232
background-color: transparent;
3333
border: var(--input-border) !important;
3434
display: block;
@@ -40,6 +40,19 @@
4040
background-clip: padding-box;
4141
}
4242

43+
/** remove spinners from input of number type*/
44+
/* Chrome, Safari, Edge, Opera */
45+
input::-webkit-outer-spin-button,
46+
input::-webkit-inner-spin-button {
47+
-webkit-appearance: none;
48+
margin: 0;
49+
}
50+
51+
/* Firefox */
52+
input[type=number] {
53+
-moz-appearance: textfield;
54+
}
55+
4356
/** all property labels */
4457
label.control-label {
4558
text-align:left;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ import { TDBSubDocument, populateSubDocumentData } from "../widgets/subDocumentW
99
import { TDBDocument } from "../widgets/documentWidget"
1010
import { TDBJSON } from "../widgets/JSONWidget"
1111
import * as CONST from "../constants"
12-
import { TDBPointDocuments } from "../widgets/pointGeoJSONWidget"
13-
import { TDBLineStringDocuments } from "../widgets/lineStringGeoJSONWidget"
1412
import { TDBGeoCollectionDocuments } from "../mapComponents/geoCollectionWidget"
1513
import { TDBFeatureCollectionDocuments } from "../mapComponents/featureCollectionWidget"
16-
import { TDBPolygonDocuments } from "../widgets/polygonGeoJSONWidget"
1714
import { TDBBBoxDocuments } from "../widgets/bboxGeoJSONWidget"
1815
import { extractPropertyDocumentation } from "./widgetHelper"
1916
import { TDBRDFLanguage } from "../widgets/rdfLanguageWidget"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ export const typeHelper = (documentFrame, property, fullFrame, isArray) => {
4848
}
4949
else if (util.isPointType(field) ||
5050
util.isLineStringType(field) ||
51-
util.isPolygonType(field)||
52-
util.isMultiPolygonType(field)) {
51+
util.isPolygonType(field)) {
5352
// GEO JSON Types
5453
return CONST.ARRAY_TYPE
5554
}
55+
else if(util.isMultiPolygonType(field)){
56+
return CONST.ARRAY_TYPE
57+
}
5658
else if(util.isSysUnitDataType(field)) {
5759
return CONST.ARRAY_TYPE
5860
}

packages/tdb-documents-ui/src/mandatoryFrames.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function makeMandatoryFrames (args, property) {
3131
}
3232

3333
if(util.isInherritedFromGeoJSONTypes(documentFrame)) {
34+
// for multi polyfon logic works differently
3435
addGeoJSONLayout(layout, documentFrame, property)
3536
}
3637
if(util.isSysUnitDataType(documentFrame[property])) {

packages/tdb-documents-ui/src/tests/constants/geoJSON.datatypes.constants.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,13 @@ export const LINE_STRING_EDIT_CONFIG = {
467467
export const MULTI_POLYGON_DATA_TYPE_CREATE_DATA = {
468468
"@type": "MultiPolygon",
469469
"bbox": ["49.505", "-2.09", "53.505", "2.09"],
470-
"coordinates": [
470+
"coordinates": [[
471471
[
472472
["51.515", "-0.09"],
473473
["51.52", "-0.1"],
474474
["51.52", "-0.12"]
475475
]
476-
],
476+
]],
477477
"type": "MultiPolygon"
478478
}
479479

@@ -530,18 +530,9 @@ export const SUBDOCUMENT_LINE_STRING_EDIT_DATA ={
530530
"geometry_location": {
531531
"@type": "LineString_NOBBBOX",
532532
"coordinates": [
533-
[
534-
"1111",
535-
"1111"
536-
],
537-
[
538-
"22",
539-
"22"
540-
],
541-
[
542-
"33",
543-
"33"
544-
]
533+
["1111", "1111"],
534+
[ "22", "22" ],
535+
[ "33", "33" ]
545536
],
546537
"type": "LineString"
547538
}

packages/tdb-documents-ui/src/widgets/lineStringGeoJSONWidget.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/tdb-documents-ui/src/widgets/pointGeoJSONWidget.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)