Skip to content

Commit fa00ea0

Browse files
Merge pull request #241 from terminusdb/recentBranch
Recent branch
2 parents ffa5072 + 7085a34 commit fa00ea0

File tree

14 files changed

+54
-112
lines changed

14 files changed

+54
-112
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/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: 16 additions & 14 deletions
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

@@ -113,7 +114,7 @@ const AddCoordinatesPerPolygon = ({ polygonCount, setPolygon, polygon, data, set
113114
for(let count = 0; count < polygonCount; count ++) {
114115
let countID = `Polygon__${count}`
115116
polygonArray.push(
116-
<Card className="bg-secondary" key={`Polygon__${count}`}>
117+
<Card className="bg-secondary w-100 mb-3" key={`Polygon__${count}`}>
117118
<Card.Body>
118119
<Card.Text className="text-muted fst-italic">{`Polygon number - ${count+1}`}</Card.Text>
119120
{coordinatesPerPolygon.hasOwnProperty(countID) && <DisplayCoordinatesLatLng
@@ -160,24 +161,25 @@ export const NestedMultiPolygonArrayFieldTemplate = (args, props, property, id)
160161
setData(arr => [...arr, []])
161162
}
162163

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

165-
return <Stack gap={3} className="mb-3">
166-
<Stack>
165+
return <Stack gap={3} direction="horizontal" className="mb-3">
166+
<Stack className="col-md-2">
167167
<TDBLabel name={props.name}
168168
required={props.required}
169169
className="tdb__label__width"
170170
id={id}/>
171171
<small className="text-muted fst-italic">Click here to add a new Polygon</small>
172172
</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>
173+
<Stack className="p-3">
174+
<AddCoordinatesPerPolygon polygonCount={polygonCount}
175+
onChangeHandler={props.onChange}
176+
data={data}
177+
setData={setData}
178+
setPolygon={setPolygon}
179+
polygon={polygon}/>
180+
<Button className="btn btn-sm bg-light text-dark" onClick={addPolygon}>
181+
<BiPlus className="mr-1"/>Add Polygon
182+
</Button>
183+
</Stack>
182184
</Stack>
183185
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ 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

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: 1 addition & 4 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"
@@ -459,7 +456,7 @@ export function displayMultiPolygonEditDocument(args, props, property, id) {
459456

460457
export function displayNestedMultiPolygonEditDocument (args, props, property, id) {
461458
//return geoTemplate.NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
462-
return NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
459+
return NestedMultiPolygonArrayFieldTemplate(args, props, property, id)
463460
}
464461

465462

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/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

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])) {

0 commit comments

Comments
 (0)