diff --git a/packages/tdb-documents-ui/diff/src/Output.js b/packages/tdb-documents-ui/diff/src/Output.js index 7679c37a..ad4a979b 100644 --- a/packages/tdb-documents-ui/diff/src/Output.js +++ b/packages/tdb-documents-ui/diff/src/Output.js @@ -62,7 +62,7 @@ export const Output = () => { "@id": "People/1", "@type": "People", "desc": [ - "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.", + "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.", "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." ], "vehicle": [ diff --git a/packages/tdb-documents-ui/geoJSONPlayground/src/frames.js b/packages/tdb-documents-ui/geoJSONPlayground/src/frames.js index ac3dd0c8..536ff538 100644 --- a/packages/tdb-documents-ui/geoJSONPlayground/src/frames.js +++ b/packages/tdb-documents-ui/geoJSONPlayground/src/frames.js @@ -17,7 +17,7 @@ export const GEO_JSON_FRAMES = { "@subdocument": [] } }, - "Location": { + "Location": { "@key": { "@type": "Random" }, diff --git a/packages/tdb-documents-ui/src/addGeoJSONLayout.js b/packages/tdb-documents-ui/src/addGeoJSONLayout.js index 0f3ab57a..4f500e76 100644 --- a/packages/tdb-documents-ui/src/addGeoJSONLayout.js +++ b/packages/tdb-documents-ui/src/addGeoJSONLayout.js @@ -34,12 +34,12 @@ export function addGeoJSONLayout (layout, documentFrame, property) { } else if (util.isMultiPolygonType(field) && util.isMultiPolygon(documentFrame)) { layout["items"]= { - "type": CONST.ARRAY_TYPE, + "type": CONST.ARRAY_TYPE/*, "items": { "type": CONST.ARRAY_TYPE, "items": { type: CONST.STRING_TYPE }, "minItems": CONST.POINT_MIN_ITEMS - } + }*/ } } } \ No newline at end of file diff --git a/packages/tdb-documents-ui/src/arrayHelpers/NestedMultiPolygonTemplate.js b/packages/tdb-documents-ui/src/arrayHelpers/NestedMultiPolygonTemplate.js index 9654fb6b..a142b4c7 100644 --- a/packages/tdb-documents-ui/src/arrayHelpers/NestedMultiPolygonTemplate.js +++ b/packages/tdb-documents-ui/src/arrayHelpers/NestedMultiPolygonTemplate.js @@ -35,7 +35,8 @@ const DisplayCoordinatesLatLng = ({ coordinatesPerPolygon, polygonID, polygonInd } //temp[polygonIndex][coordinateIndex]=coord temp[polygonIndex][coordinateIndex]=coord - if(onChangeHandler) onChangeHandler([data], CONST.COORDINATES_FIELD) + //if(onChangeHandler) onChangeHandler([data], CONST.COORDINATES_FIELD) + if(onChangeHandler) onChangeHandler([data]) setData(data) } @@ -113,7 +114,7 @@ const AddCoordinatesPerPolygon = ({ polygonCount, setPolygon, polygon, data, set for(let count = 0; count < polygonCount; count ++) { let countID = `Polygon__${count}` polygonArray.push( - + {`Polygon number - ${count+1}`} {coordinatesPerPolygon.hasOwnProperty(countID) && [...arr, []]) } - console.log("data", data) - return - + return + Click here to add a new Polygon - - + + + + } \ No newline at end of file diff --git a/packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js b/packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js index b3b1be24..5fe9a9cd 100644 --- a/packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js +++ b/packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js @@ -642,6 +642,7 @@ export const NestedMultiPolygonArrayFieldTemplate = (args, props, property) => { diff --git a/packages/tdb-documents-ui/src/css/terminusdb__styles.css b/packages/tdb-documents-ui/src/css/terminusdb__styles.css index d5773807..8648eb86 100644 --- a/packages/tdb-documents-ui/src/css/terminusdb__styles.css +++ b/packages/tdb-documents-ui/src/css/terminusdb__styles.css @@ -28,7 +28,7 @@ /** tdb input */ .tdb__doc__input { - color: var(--input-color); + color: var(--input-color) !important; background-color: transparent; border: var(--input-border) !important; display: block; @@ -40,6 +40,19 @@ background-clip: padding-box; } +/** remove spinners from input of number type*/ +/* Chrome, Safari, Edge, Opera */ +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +/* Firefox */ +input[type=number] { + -moz-appearance: textfield; +} + /** all property labels */ label.control-label { text-align:left; diff --git a/packages/tdb-documents-ui/src/helpers/displayHelper.js b/packages/tdb-documents-ui/src/helpers/displayHelper.js index 3f5965b3..825dedab 100644 --- a/packages/tdb-documents-ui/src/helpers/displayHelper.js +++ b/packages/tdb-documents-ui/src/helpers/displayHelper.js @@ -9,11 +9,8 @@ import { TDBSubDocument, populateSubDocumentData } from "../widgets/subDocumentW import { TDBDocument } from "../widgets/documentWidget" import { TDBJSON } from "../widgets/JSONWidget" import * as CONST from "../constants" -import { TDBPointDocuments } from "../widgets/pointGeoJSONWidget" -import { TDBLineStringDocuments } from "../widgets/lineStringGeoJSONWidget" import { TDBGeoCollectionDocuments } from "../mapComponents/geoCollectionWidget" import { TDBFeatureCollectionDocuments } from "../mapComponents/featureCollectionWidget" -import { TDBPolygonDocuments } from "../widgets/polygonGeoJSONWidget" import { TDBBBoxDocuments } from "../widgets/bboxGeoJSONWidget" import { extractPropertyDocumentation } from "./widgetHelper" import { TDBRDFLanguage } from "../widgets/rdfLanguageWidget" @@ -459,7 +456,7 @@ export function displayMultiPolygonEditDocument(args, props, property, id) { export function displayNestedMultiPolygonEditDocument (args, props, property, id) { //return geoTemplate.NestedMultiPolygonArrayFieldTemplate(args, props, property, id) - return NestedMultiPolygonArrayFieldTemplate(args, props, property, id) + return NestedMultiPolygonArrayFieldTemplate(args, props, property, id) } diff --git a/packages/tdb-documents-ui/src/helpers/typeHelper.js b/packages/tdb-documents-ui/src/helpers/typeHelper.js index fed171e6..a9b4e280 100644 --- a/packages/tdb-documents-ui/src/helpers/typeHelper.js +++ b/packages/tdb-documents-ui/src/helpers/typeHelper.js @@ -48,11 +48,13 @@ export const typeHelper = (documentFrame, property, fullFrame, isArray) => { } else if (util.isPointType(field) || util.isLineStringType(field) || - util.isPolygonType(field)|| - util.isMultiPolygonType(field)) { + util.isPolygonType(field)) { // GEO JSON Types return CONST.ARRAY_TYPE } + else if(util.isMultiPolygonType(field)){ + return CONST.ARRAY_TYPE + } else if(util.isSysUnitDataType(field)) { return CONST.ARRAY_TYPE } diff --git a/packages/tdb-documents-ui/src/helpers/widgetHelper.js b/packages/tdb-documents-ui/src/helpers/widgetHelper.js index 3d2d49a9..4889f8df 100644 --- a/packages/tdb-documents-ui/src/helpers/widgetHelper.js +++ b/packages/tdb-documents-ui/src/helpers/widgetHelper.js @@ -244,11 +244,15 @@ export function getMultiPolygonUIDisplay (args, property) { return { "ui:field": displayGeoJSONView } } - function coordinatesArrayTemplate(props) { - return display.displayMultiPolygonEditDocument(args, props, property) + function displayMultiPolygonEdit(props) { + //return display.displayMultiPolygonEditDocument(args, props, property) + let id = props.idSchema["$id"] + return display.displayNestedMultiPolygonEditDocument(args, props, property, id) } + + return { "ui:field": displayMultiPolygonEdit } - return { + /*return { "ui:ArrayFieldTemplate": geoTemplate.MultiPolygonArrayFieldTemplate, "items": { "ui:ArrayFieldTemplate": coordinatesArrayTemplate, @@ -256,7 +260,7 @@ export function getMultiPolygonUIDisplay (args, property) { "ui:options": CONST.UI_HIDDEN_ARRAY_OPTIONS } } - } + }*/ } diff --git a/packages/tdb-documents-ui/src/mandatoryFrames.js b/packages/tdb-documents-ui/src/mandatoryFrames.js index 98be45fc..9cf5c996 100644 --- a/packages/tdb-documents-ui/src/mandatoryFrames.js +++ b/packages/tdb-documents-ui/src/mandatoryFrames.js @@ -31,6 +31,7 @@ export function makeMandatoryFrames (args, property) { } if(util.isInherritedFromGeoJSONTypes(documentFrame)) { + // for multi polyfon logic works differently addGeoJSONLayout(layout, documentFrame, property) } if(util.isSysUnitDataType(documentFrame[property])) { diff --git a/packages/tdb-documents-ui/src/tests/constants/geoJSON.datatypes.constants.js b/packages/tdb-documents-ui/src/tests/constants/geoJSON.datatypes.constants.js index fe258308..5f9ee2e7 100644 --- a/packages/tdb-documents-ui/src/tests/constants/geoJSON.datatypes.constants.js +++ b/packages/tdb-documents-ui/src/tests/constants/geoJSON.datatypes.constants.js @@ -467,13 +467,13 @@ export const LINE_STRING_EDIT_CONFIG = { export const MULTI_POLYGON_DATA_TYPE_CREATE_DATA = { "@type": "MultiPolygon", "bbox": ["49.505", "-2.09", "53.505", "2.09"], - "coordinates": [ + "coordinates": [[ [ ["51.515", "-0.09"], ["51.52", "-0.1"], ["51.52", "-0.12"] ] - ], + ]], "type": "MultiPolygon" } @@ -530,18 +530,9 @@ export const SUBDOCUMENT_LINE_STRING_EDIT_DATA ={ "geometry_location": { "@type": "LineString_NOBBBOX", "coordinates": [ - [ - "1111", - "1111" - ], - [ - "22", - "22" - ], - [ - "33", - "33" - ] + ["1111", "1111"], + [ "22", "22" ], + [ "33", "33" ] ], "type": "LineString" } diff --git a/packages/tdb-documents-ui/src/widgets/lineStringGeoJSONWidget.js b/packages/tdb-documents-ui/src/widgets/lineStringGeoJSONWidget.js deleted file mode 100644 index 01b7423b..00000000 --- a/packages/tdb-documents-ui/src/widgets/lineStringGeoJSONWidget.js +++ /dev/null @@ -1,23 +0,0 @@ -import React, { useState, useEffect } from "react" -import Stack from "react-bootstrap/Stack" -import Card from "react-bootstrap/Card" -import { TDBLabel } from "../components/LabelComponent" -import { MapViewer } from "../mapComponents/mapViewer" -import * as CONST from "../constants" -import * as util from "../utils" - -export const TDBLineStringDocuments = ({ config }) => { - - let mapConfig = { - type: CONST.LINE_STRING_TYPE, - documents: config.formData, - bounds: config.bounds - } - - return - - - -} diff --git a/packages/tdb-documents-ui/src/widgets/pointGeoJSONWidget.js b/packages/tdb-documents-ui/src/widgets/pointGeoJSONWidget.js deleted file mode 100644 index 9d0bb1ef..00000000 --- a/packages/tdb-documents-ui/src/widgets/pointGeoJSONWidget.js +++ /dev/null @@ -1,23 +0,0 @@ -import React, { useState, useEffect } from "react" -import Stack from "react-bootstrap/Stack" -import Card from "react-bootstrap/Card" -import { TDBLabel } from "../components/LabelComponent" -import { MapViewer } from "../mapComponents/mapViewer" -import * as CONST from "../constants" -import * as util from "../utils" - -export const TDBPointDocuments = ({ config }) => { - - let mapConfig = { - type: CONST.POINT, - documents: config.formData, - bounds: config.bounds - } - - return - - - -} diff --git a/packages/tdb-documents-ui/src/widgets/polygonGeoJSONWidget.js b/packages/tdb-documents-ui/src/widgets/polygonGeoJSONWidget.js deleted file mode 100644 index 996a3eea..00000000 --- a/packages/tdb-documents-ui/src/widgets/polygonGeoJSONWidget.js +++ /dev/null @@ -1,23 +0,0 @@ -import React, { useState, useEffect } from "react" -import Stack from "react-bootstrap/Stack" -import Card from "react-bootstrap/Card" -import { TDBLabel } from "../components/LabelComponent" -import { MapViewer } from "../mapComponents/mapViewer" -import * as CONST from "../constants" -import * as util from "../utils" - -export const TDBPolygonDocuments = ({ config }) => { - - let mapConfig = { - type: CONST.POLYGON, - documents: config.formData, - bounds: config.bounds - } - - return - - - -}