@itrocks/list 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/feed.html +20 -0
- package/cjs/list.html +2 -9
- package/cjs/list.js +9 -3
- package/list.css +36 -22
- package/package.json +1 -1
package/cjs/feed.html
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head><title>list feed</title></head>
|
|
4
|
+
<body>
|
|
5
|
+
<table class="objects">
|
|
6
|
+
<!--BEGIN-->
|
|
7
|
+
|
|
8
|
+
<!--objects-->
|
|
9
|
+
<tr>
|
|
10
|
+
<th class="select"><input name="id" type="checkbox" value="{id}"></th>
|
|
11
|
+
<!--%listProperties-->
|
|
12
|
+
<td>{outputOptionalContainer}</td>
|
|
13
|
+
<!--end-->
|
|
14
|
+
</tr>
|
|
15
|
+
<!--end-->
|
|
16
|
+
|
|
17
|
+
<!--END-->
|
|
18
|
+
</table>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
package/cjs/list.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</header>
|
|
27
27
|
<form action="app://(type.@route)" autocomplete="off" method="post" target="main">
|
|
28
28
|
<table class="objects">
|
|
29
|
-
|
|
29
|
+
<thead>
|
|
30
30
|
<tr class="properties">
|
|
31
31
|
<th class="select" data-fix><input name="select" type="checkbox" value="all"></th>
|
|
32
32
|
<!--type.%listProperties-->
|
|
@@ -35,14 +35,7 @@
|
|
|
35
35
|
</tr>
|
|
36
36
|
</thead>
|
|
37
37
|
<tbody>
|
|
38
|
-
|
|
39
|
-
<tr>
|
|
40
|
-
<th class="select"><input name="id" type="checkbox" value="{id}"></th>
|
|
41
|
-
<!--%listProperties-->
|
|
42
|
-
<td>{outputOptionalContainer}</td>
|
|
43
|
-
<!--end-->
|
|
44
|
-
</tr>
|
|
45
|
-
<!--end-->
|
|
38
|
+
{./feed.html}
|
|
46
39
|
</tbody>
|
|
47
40
|
</table>
|
|
48
41
|
<footer>
|
package/cjs/list.js
CHANGED
|
@@ -62,13 +62,19 @@ let List = (() => {
|
|
|
62
62
|
async html(request) {
|
|
63
63
|
const header = request.request.headers['xhr-info'];
|
|
64
64
|
const xhrInfo = header ? JSON.parse(header) : {};
|
|
65
|
-
const limit =
|
|
65
|
+
const limit = xhrInfo.targetHeight
|
|
66
|
+
? Math.ceil(xhrInfo.targetHeight / this.lineHeight)
|
|
67
|
+
: +(request.request.headers['xhr-visible-rows'] ?? 50);
|
|
68
|
+
const offset = request.request.data.offset;
|
|
66
69
|
const type = request.type;
|
|
70
|
+
const objects = await (0, storage_1.dataSource)().readAll(type, [new storage_2.Limit(limit, +offset), storage_3.Sort]);
|
|
71
|
+
if (offset !== undefined) {
|
|
72
|
+
return this.htmlTemplateResponse({ objects, type }, request, __dirname + '/feed.html');
|
|
73
|
+
}
|
|
67
74
|
const count = await (0, storage_1.dataSource)().count(type);
|
|
68
|
-
const
|
|
75
|
+
const route = (0, route_2.routeOf)(this);
|
|
69
76
|
const generalActions = [];
|
|
70
77
|
const selectionActions = [];
|
|
71
|
-
const route = (0, route_2.routeOf)(this);
|
|
72
78
|
for (const action of (0, action_2.getActions)(type, route.slice(route.lastIndexOf('/') + 1))) {
|
|
73
79
|
const actions = (action.need === 'object') ? selectionActions : generalActions;
|
|
74
80
|
actions.push(action);
|
package/list.css
CHANGED
|
@@ -9,48 +9,62 @@ main > article[data-action=list] > form {
|
|
|
9
9
|
grid-template-areas: "table" "footer";
|
|
10
10
|
grid-template-rows: 1fr min-content;
|
|
11
11
|
}
|
|
12
|
-
main > article[data-action=list] > form >
|
|
12
|
+
main > article[data-action=list] > form > footer {
|
|
13
|
+
grid-area: footer;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
main > article[data-action=list] > form > table.objects > tbody > tr > :not(:first-child) {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
table.objects {
|
|
13
21
|
border-collapse: collapse;
|
|
14
22
|
display: block;
|
|
15
23
|
grid-area: table;
|
|
16
24
|
margin-bottom: -1px;
|
|
17
25
|
overflow-y: auto;
|
|
18
26
|
}
|
|
19
|
-
|
|
27
|
+
table.objects th {
|
|
28
|
+
background: #f8f8f8;
|
|
29
|
+
}
|
|
30
|
+
table.objects tr td, table.objects tr th {
|
|
20
31
|
border-bottom: 1px solid #d8d8d8;
|
|
21
32
|
border-spacing: 0;
|
|
22
33
|
padding: 0.6em;
|
|
23
34
|
}
|
|
24
|
-
|
|
35
|
+
table.objects tr td:last-child, table.objects tr th:last-child {
|
|
25
36
|
border-right: 1px solid #d8d8d8;
|
|
26
37
|
}
|
|
27
|
-
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
}
|
|
30
|
-
main > article[data-action=list] > form > table > thead > tr > * {
|
|
31
|
-
background: #f8f8f8;
|
|
32
|
-
}
|
|
33
|
-
main > article[data-action=list] > form > table > thead > .properties > .select > input[name=select] {
|
|
38
|
+
table.objects tr.properties > .select > input[name=select] {
|
|
34
39
|
display: none;
|
|
35
40
|
}
|
|
36
|
-
|
|
37
|
-
background: #f8f8f8;
|
|
38
|
-
}
|
|
39
|
-
main > article[data-action=list] > form > table > tbody > tr:nth-child(odd) > * {
|
|
40
|
-
background: white;
|
|
41
|
-
}
|
|
42
|
-
main > article[data-action=list] > form > table > tbody > tr > td > ul {
|
|
41
|
+
table.objects > tbody > tr > td > ul {
|
|
43
42
|
display: block;
|
|
44
43
|
margin: 0;
|
|
45
44
|
padding: 0;
|
|
46
45
|
}
|
|
47
|
-
|
|
46
|
+
table.objects > tbody > tr > td > ul > li {
|
|
48
47
|
display: inline-block;
|
|
49
48
|
}
|
|
50
|
-
|
|
49
|
+
table.objects > tbody > tr > td > ul > li:not(:first-child):before {
|
|
51
50
|
content: ", ";
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
table.objects > tbody:first-child > tr:nth-child(even) > td {
|
|
53
|
+
background: white;
|
|
54
|
+
}
|
|
55
|
+
table.objects > tbody:first-child > tr:nth-child(odd) > td {
|
|
56
|
+
background: #f8f8f8;
|
|
57
|
+
}
|
|
58
|
+
table.objects > thead + tbody > tr:nth-child(even) > td {
|
|
59
|
+
background: #f8f8f8;
|
|
60
|
+
}
|
|
61
|
+
table.objects > thead + tbody > tr:nth-child(odd) > td {
|
|
62
|
+
background: white;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:not(article, article > form) > table.objects td, :not(article, article > form) > table.objects th {
|
|
66
|
+
border-top: 1px solid #d8d8d8;
|
|
67
|
+
}
|
|
68
|
+
:not(article, article > form) > table.objects td:first-child, :not(article, article > form) > table.objects th:first-child {
|
|
69
|
+
border-left: 1px solid #d8d8d8;
|
|
56
70
|
}
|
package/package.json
CHANGED