Skip to content

Commit 5125a14

Browse files
Parameters, properties, methods, indices, xDatas and queries display
1 parent f9f473f commit 5125a14

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cache-visual-editor",
33
"printableName": "Cache Visual Editor",
4-
"version": "0.1.1",
4+
"version": "0.2.0",
55
"description": "Visual class editor for InterSystems Caché",
66
"main": "index.js",
77
"keywords": [

source/client/js/classEditor/card.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,35 @@ function block (className, element = "div") {
66
return el;
77
}
88

9-
function getContainer (prop) {
9+
function getPropertyBlock (prop) {
1010
let item = block(`item`),
1111
icon = block(`icon public`),
12-
text = block(`label`, `span`);
12+
text = block(`label`, `span`),
13+
type = prop["Type"] || prop["ReturnType"] || prop["MimeType"] || "";
1314
item.appendChild(icon);
14-
text.textContent = `${ prop["Name"] }: ${ prop["Type"] }`;
15+
text.textContent = `${ prop["Name"] }${ type ? ": " + type : "" }`;
1516
item.appendChild(text);
1617
return item;
1718
}
1819

20+
function getBlock (key, data) {
21+
22+
let section = block(`section`), body, header;
23+
for (let prop in data[key]) {
24+
header = block(`header`);
25+
header.textContent = key;
26+
body = block(`body`);
27+
section.appendChild(header);
28+
section.appendChild(body);
29+
break;
30+
}
31+
for (let prop in data[key]) {
32+
section.appendChild(getPropertyBlock(data[key][prop]));
33+
}
34+
return section;
35+
36+
}
37+
1938
/**
2039
* This function returns card element that may be applied to the grid.
2140
* @param {*} data
@@ -32,20 +51,12 @@ export function getCardElement (data) {
3251
head.appendChild(header);
3352
card.appendChild(head);
3453

35-
let section, body;
36-
for (let prop in data["Properties"]) {
37-
section = block(`section`);
38-
header = block(`header`);
39-
header.textContent = "Properties";
40-
body = block(`body`);
41-
section.appendChild(header);
42-
section.appendChild(body);
43-
card.appendChild(section);
44-
break;
45-
}
46-
for (let prop in data["Properties"]) {
47-
section.appendChild(getContainer(data["Properties"][prop]));
48-
}
54+
card.appendChild(getBlock("Parameters", data));
55+
card.appendChild(getBlock("Properties", data));
56+
card.appendChild(getBlock("Indices", data));
57+
card.appendChild(getBlock("Methods", data));
58+
card.appendChild(getBlock("Queries", data));
59+
card.appendChild(getBlock("XDatas", data));
4960

5061
if (data["_type"] === "package") {
5162
card.addEventListener("click", () => {

0 commit comments

Comments
 (0)