@saltcorn/sbadmin2 0.7.4 → 0.8.0-beta.1
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/index.js +68 -64
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -39,16 +39,16 @@ const { isNode } = require("@saltcorn/data/utils");
|
|
|
39
39
|
const subItem = (currentUrl) => (item) =>
|
|
40
40
|
item.link
|
|
41
41
|
? a(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
{
|
|
43
|
+
class: ["collapse-item", active(currentUrl, item) && "active"],
|
|
44
|
+
href: text(item.link),
|
|
45
|
+
},
|
|
46
|
+
item.icon ? i({ class: `fa-fw mr-05 ${item.icon}` }) : "",
|
|
47
|
+
item.label
|
|
48
|
+
)
|
|
49
49
|
: item.type === "Separator"
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
? hr({ class: "sidebar-divider my-0" })
|
|
51
|
+
: h6({ class: "collapse-header" }, item.label);
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* @param {object} item
|
|
@@ -93,62 +93,62 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
93
93
|
{ class: ["nav-item", is_active && "active"] },
|
|
94
94
|
item.subitems
|
|
95
95
|
? [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
a(
|
|
97
|
+
{
|
|
98
|
+
class: ["nav-link", !is_active && "collapsed"],
|
|
99
|
+
href: "#",
|
|
100
|
+
"data-bs-toggle": "collapse",
|
|
101
|
+
"data-bs-target": `#collapse${labelToId(item)}`,
|
|
102
|
+
"aria-expanded": "true",
|
|
103
|
+
"aria-controls": `collapse${labelToId(item)}`,
|
|
104
|
+
},
|
|
105
|
+
item.icon ? i({ class: `fa-fw ${item.icon}` }) : "",
|
|
106
|
+
span(text(item.label))
|
|
107
|
+
),
|
|
108
|
+
div(
|
|
109
|
+
{
|
|
110
|
+
id: `collapse${labelToId(item)}`,
|
|
111
|
+
class: ["collapse", is_active && "show"],
|
|
112
|
+
"data-parent": "#accordionSidebar",
|
|
113
|
+
},
|
|
108
114
|
div(
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
div(
|
|
115
|
-
{ class: "bg-white py-2 collapse-inner rounded" },
|
|
116
|
-
item.subitems.map(subItem(currentUrl))
|
|
117
|
-
)
|
|
118
|
-
),
|
|
119
|
-
]
|
|
115
|
+
{ class: "bg-white py-2 collapse-inner rounded" },
|
|
116
|
+
item.subitems.map(subItem(currentUrl))
|
|
117
|
+
)
|
|
118
|
+
),
|
|
119
|
+
]
|
|
120
120
|
: item.link
|
|
121
|
-
|
|
121
|
+
? a(
|
|
122
122
|
{ class: "nav-link", href: text(item.link) },
|
|
123
123
|
item.icon ? i({ class: `fa-fw ${item.icon}` }) : "",
|
|
124
124
|
span(text(item.label))
|
|
125
125
|
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
: item.type === "Search"
|
|
127
|
+
? form(
|
|
128
|
+
{ action: "/search", class: "menusearch ms-2 me-3", method: "get" },
|
|
129
|
+
div(
|
|
130
|
+
{ class: "input-group search-bar" },
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
input({
|
|
133
|
+
type: "search",
|
|
134
|
+
class: "form-control search-bar pl-2p5",
|
|
135
|
+
placeholder: item.label,
|
|
136
|
+
id: "inputq",
|
|
137
|
+
name: "q",
|
|
138
|
+
"aria-label": "Search",
|
|
139
|
+
"aria-describedby": "button-search-submit",
|
|
140
|
+
}),
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
button(
|
|
143
|
+
{
|
|
144
|
+
class: "btn btn-outline-secondary search-bar",
|
|
145
|
+
type: "submit",
|
|
146
|
+
},
|
|
147
|
+
i({ class: "fas fa-search" })
|
|
148
|
+
)
|
|
148
149
|
)
|
|
149
150
|
)
|
|
150
|
-
|
|
151
|
-
: span({ class: "nav-link" }, text(item.label))
|
|
151
|
+
: span({ class: "nav-link" }, text(item.label))
|
|
152
152
|
);
|
|
153
153
|
};
|
|
154
154
|
|
|
@@ -159,8 +159,8 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
159
159
|
const sideBarSection = (currentUrl) => (section) =>
|
|
160
160
|
[
|
|
161
161
|
section.section &&
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
hr({ class: "sidebar-divider" }) +
|
|
163
|
+
div({ class: "sidebar-heading" }, section.section),
|
|
164
164
|
section.items.map(sideBarItem(currentUrl)).join(""),
|
|
165
165
|
];
|
|
166
166
|
|
|
@@ -183,17 +183,21 @@ const sidebar = (brand, sections, currentUrl) =>
|
|
|
183
183
|
href: "/",
|
|
184
184
|
},
|
|
185
185
|
brand.logo &&
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
div(
|
|
187
|
+
{ class: "sidebar-brand-icon" },
|
|
188
|
+
img({ src: brand.logo, width: "35", height: "35", alt: "Logo" })
|
|
189
|
+
),
|
|
190
190
|
div({ class: "sidebar-brand-text mx-3" }, brand.name)
|
|
191
191
|
),
|
|
192
192
|
sections.map(sideBarSection(currentUrl)),
|
|
193
193
|
hr({ class: "sidebar-divider d-none d-md-block" }),
|
|
194
194
|
div(
|
|
195
195
|
{ class: "text-center d-none d-md-inline" },
|
|
196
|
-
button({
|
|
196
|
+
button({
|
|
197
|
+
class: "rounded-circle border-0",
|
|
198
|
+
"data-sidebar-toggler": true,
|
|
199
|
+
id: "sidebarToggle"
|
|
200
|
+
})
|
|
197
201
|
)
|
|
198
202
|
);
|
|
199
203
|
|
|
@@ -335,6 +339,7 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
|
|
|
335
339
|
`<!doctype html>
|
|
336
340
|
<html lang="en">
|
|
337
341
|
<head>
|
|
342
|
+
${!isNode() ? `<base href="http://localhost">` : ""}
|
|
338
343
|
<!-- Required meta tags -->
|
|
339
344
|
<meta charset="utf-8">
|
|
340
345
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
@@ -349,8 +354,7 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
|
|
|
349
354
|
</head>
|
|
350
355
|
<body ${bodyAttr}>
|
|
351
356
|
${rest}
|
|
352
|
-
<script src="${safeSlash()}static_assets/${
|
|
353
|
-
db.connectObj.version_tag
|
|
357
|
+
<script src="${safeSlash()}static_assets/${db.connectObj.version_tag
|
|
354
358
|
}/jquery-3.6.0.min.js"></script>
|
|
355
359
|
<script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
356
360
|
<script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/jquery-easing/jquery.easing.min.js"></script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/sbadmin2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.1",
|
|
4
4
|
"description": "SB Admin 2 layout plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"clean": "echo \"Error: no TypeScript support yet\""
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@saltcorn/data": "0.
|
|
13
|
-
"@saltcorn/markup": "0.
|
|
12
|
+
"@saltcorn/data": "0.8.0-beta.1",
|
|
13
|
+
"@saltcorn/markup": "0.8.0-beta.1",
|
|
14
14
|
"startbootstrap-sb-admin-2-bs5": "^4.1.5-beta.8"
|
|
15
15
|
},
|
|
16
16
|
"author": "Tom Nielsen",
|