Skip to content

Commit 9153848

Browse files
committed
fixing lexical key hidden bug in edit mode
1 parent 61c9dd0 commit 9153848

File tree

8 files changed

+42
-146
lines changed

8 files changed

+42
-146
lines changed

packages/tdb-dashboard/src/components/DeleteDatabaseModal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {useEffect, useState} from "react"
22
import {Modal, Button, Form} from "react-bootstrap"
33
import {deleteDataProductForm} from "./constants"
44
import {AiOutlineDelete} from "react-icons/ai"
5-
import {Loading} from "./Loading"
5+
import {Loading} from "../components/Loading"
66
import {PROGRESS_BAR_COMPONENT} from "./constants"
77
import {WOQLClientObj} from "../init-woql-client"
88
import {TERMINUS_DANGER} from "./constants"
@@ -65,12 +65,12 @@ export const DeleteDatabaseModal = ({showModal,setShowModal, dataProductDetails}
6565
}, [showModal])
6666

6767
return <Modal size="lg" className="modal-dialog-right" show={showModal} onHide={handleClose}>
68-
{loading && <Loading message={`Deleting Data Product ${dataProductDetails.label} ...`} type={PROGRESS_BAR_COMPONENT}/>}
69-
<Modal.Header>
68+
{loading && <div style={{height: "300px"}}><Loading message={`Deleting Data Product ${dataProductDetails.label} ...`}/></div>}
69+
{!loading && <><Modal.Header>
7070
<Modal.Title className="h6">{`Are you sure to delete Data Product - ${dataProductDetails.label} ?`} </Modal.Title>
7171
<Button variant="close" aria-label="Close" onClick={handleClose} />
7272
</Modal.Header>
73-
<Modal.Body className="p-5">
73+
<Modal.Body className="p-5">
7474
{reportAlert && <Alerts message={reportAlert} type={TERMINUS_DANGER}/>}
7575
<div className="d-flex align-items-center col-md-12 mb-3">
7676
<h6 className="fw-normal text-muted mb-2">Data Product ID </h6>
@@ -102,7 +102,7 @@ export const DeleteDatabaseModal = ({showModal,setShowModal, dataProductDetails}
102102
onClick={handleClick}>
103103
<AiOutlineDelete className="me-2" /> Delete
104104
</Button>
105-
</Modal.Footer>
105+
</Modal.Footer> </> }
106106
</Modal>
107107
}
108108

packages/tdb-documents-ui/src/arrayTypeFrames/arrayTypeFrames copy.js

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const POINT_TYPE_UI_LAYOUT=[
1212
classNames: "tdb__input mb-3"
1313
}
1414
]
15-
export const POINT_TYPE_LAYOUT = [ {type: "number"}, {type: "number"} ]
15+
//export const POINT_TYPE_LAYOUT = [ {type: "number"}, {type: "number"} ]
16+
export const POINT_TYPE_LAYOUT = [ {type: CONST.STRING_TYPE}, {type: CONST.STRING_TYPE} ]
1617
export const LINE_TYPE_UI_LAYOUT={
1718
"items" : POINT_TYPE_UI_LAYOUT,
1819
"classNames": "d-block tdb__input",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ export function getChoiceSubDocumentsArrayItems (frame, item, formData, mode) {
110110
//title: choice,
111111
anyOf: frame.properties[item].anyOf
112112
}
113-
114113
}
115114

116115
if(!formData) return arrayItems
117116
if(!Array.isArray(formData)) return arrayItems
118117

118+
arrayItems=[]
119+
119120
formData.map(data => {
120121
// get the choice which have been added
121122
let choice = data["@type"]

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
max-height: 20px;
1111
}
1212

13-
14-
1513
.tdb__input,
1614
.tdb__input > input,
1715
.tdb__input > select,
@@ -32,6 +30,20 @@
3230
color: #adb5bd;
3331
}
3432

33+
/** lexical key */
34+
/* disable key filed if filled */
35+
.tdb__key__field textarea,
36+
.tdb__key__field input {
37+
pointer-events: none !important;
38+
}
39+
40+
41+
/* enable key filed if empty */
42+
.tdb__key__field textarea:empty,
43+
.tdb__key__field input:empty {
44+
pointer-events: auto !important;
45+
}
46+
3547
/*
3648
ul's list-style is set to none in tdb-react-components
3749
set list-style to inital inorder to display bullets in Markdown preview

packages/tdb-documents-ui/src/dataTypeFrames/dataType.utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export function getUILayout(frame, item, uiFrame, mode, formData, documentation)
1616
let uiLayout=helper.getUIBasedOnType(frame, item, uiFrame, mode, data, documentation)
1717
// if property is lexical key then make read only
1818
if(mode !== CONST.CREATE && frame && frame.hasOwnProperty("@key") && util.checkIfKey(item, frame["@key"])) {
19-
uiLayout["ui:readonly"] = true
19+
//uiLayout["ui:readonly"] = true
20+
uiLayout["classNames"] = uiLayout["classNames"] + " tdb__key__field "
2021
}
2122
//let addedCustomUI=util.addCustomUI(item, uiFrame, uiLayout)
2223
return uiLayout

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@ const matchType ={
1212
[CONST.XDD_HTML]: CONST.STRING_TYPE,
1313

1414
[CONST.SYS_JSON_TYPE] : CONST.JSON_TYPE,
15-
[CONST.XSD_DOUBLE] : CONST.NUMBER_TYPE,
15+
/*[CONST.XSD_DOUBLE] : CONST.NUMBER_TYPE,
1616
[CONST.XSD_NONNEGATIVEINTEGER] : CONST.NUMBER_TYPE,
1717
[CONST.XSD_FLOAT] : CONST.NUMBER_TYPE,
1818
[CONST.XSD_POSITIVE_INTEGER] : CONST.NUMBER_TYPE,
1919
[CONST.XSD_DECIMAL] : CONST.NUMBER_TYPE,
20-
[CONST.XSD_INTEGER] : CONST.NUMBER_TYPE,
20+
[CONST.XSD_INTEGER] : CONST.NUMBER_TYPE,*/
21+
/** all decimals and integers are treated as strings under the hood */
22+
[CONST.XSD_DECIMAL] : CONST.STRING_TYPE,
23+
[CONST.XSD_INTEGER] : CONST.STRING_TYPE,
24+
[CONST.XSD_DOUBLE] : CONST.STRING_TYPE,
25+
[CONST.XSD_NONNEGATIVEINTEGER] : CONST.STRING_TYPE,
26+
[CONST.XSD_FLOAT] : CONST.STRING_TYPE,
27+
[CONST.XSD_POSITIVE_INTEGER] : CONST.STRING_TYPE,
28+
2129
[CONST.XSD_BOOLEAN] : CONST.BOOLEAN_TYPE,
2230

2331
[CONST.XSD_DATE_TIME] : CONST.DATE_TYPE,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ export function getUILayout (fullFrame, frame, item, uiFrame, mode, formData, do
2626
"ui:placeholder": `Select ${label} ...`,
2727
//"ui:description": getUI(),
2828
classNames: "tdb__input mb-3 mt-3"
29-
}
29+
}
30+
31+
// if property is lexical key then make read only
32+
if(mode !== CONST.CREATE && frame && frame.hasOwnProperty("@key") && util.checkIfKey(item, frame["@key"])) {
33+
//uiLayout["ui:readonly"] = true
34+
uiLayout["classNames"] = uiLayout["classNames"] + " tdb__key__field "
35+
}
3036

3137
return uiLayout
3238
}

0 commit comments

Comments
 (0)