Skip to content

Commit

Permalink
增加对 rollup 的处理
Browse files Browse the repository at this point in the history
  • Loading branch information
driekey committed Jan 31, 2024
1 parent 1c7cc48 commit f49525e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 39 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
> 将数据库中对应的主键的属性展示出来

只是简单的将元数据展示出来
只是简单的将元数据展示出来, 暂不涉及写入

> 注意!: 该挂件没有任何判断异常的东西, 所以在给一个文档添加该挂件时得确保这个文档真的可以读取到数据库内容
Expand Down
58 changes: 29 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,53 @@
<style>
body {
margin: 0;
position: relative;
}
.metadata-container {
display: table;
width: calc(150%);
}

.key-value-pair {
margin-bottom: 10px;
display: table-row;
}

.key {
float: left;
margin-right: 10px;
display: table-cell;
font-weight: bold;
width: 200px;
}

.value-single-line:hover,
.value-multiple:hover,
.key:hover {
background-color: lightgrey;
border-radius: 10px;
}
position: relative;
width: calc(18%);

.value,
.value-multiple,
.value-single-line {
overflow: hidden;
width: 600px;
padding: calc(0.25%) calc(1%);
vertical-align: top;
}

.key,
.value-multiple,
.value-single-line {
padding-left: 10px;
.value {
position: relative;
display: inline-block;
width: calc(70%);
margin-left: calc(1%);
padding: calc(0.25%) calc(1%);
}

.value-multiple .value {
display: block;
margin-bottom: 6px;
.value:hover,
.key:hover {
background-color: lightgrey;
border-radius: 10px;
}

.value-single-line .value {
display: inline;
margin-right: 10px;
.line {
margin: 0;
position: absolute;
}
</style>
</head>

<body>
<div class="metadata-container"/>
<div class="metadata-container">
<div class="line">
|
</div>
</div>

</body>

Expand Down
20 changes: 13 additions & 7 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,18 @@ function createKey(data) {

function createValue(mod, data) {
let value = createDiv();
if (mod === 1) {
value.className = "value-single-line";
} else if (mod === 2) {
value.className = "value-multiple";
}
value.className = "value";


if (Array.isArray(data)) {
data.forEach(v => {
let val = createDiv();
val.className = "value";
val.innerHTML = v;

value.appendChild(val);
})
} else {
let val = createDiv();
val.className = "value";
val.innerHTML = data;

value.appendChild(val);
Expand Down Expand Up @@ -118,6 +112,18 @@ function createData(name, type, val) {
value = createValue(2, val.contents)
}
break;
case "rollup": {
if (checkContents(val.contents)) {
return null;
}
let asset = val.contents.map(e => {
console.log(e)
let type = e.type;
return `${e[type].content}%`;
});
value = createValue(2, asset)
}
break;
default:
if (checkContents(val.contents)) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let meta = document.getElementsByClassName("metadata-container")[0];
})();

function processingData(data) {
data.forEach(e => {
data.forEach(e => {
let key = e.key.name;
let type = e.values[0].type
if (type === 'select') type = 'mSelect'
Expand Down

0 comments on commit f49525e

Please sign in to comment.