@saltcorn/sbadmin2 0.6.1-beta.3 → 0.6.2-beta.2
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 +30 -28
- package/package.json +12 -5
package/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const {
|
|
|
30
30
|
const db = require("@saltcorn/data/db");
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @param {string} currentUrl
|
|
33
|
+
* @param {string} currentUrl
|
|
34
34
|
* @returns {function}
|
|
35
35
|
*/
|
|
36
36
|
const subItem = (currentUrl) => (item) =>
|
|
@@ -46,14 +46,14 @@ const subItem = (currentUrl) => (item) =>
|
|
|
46
46
|
: h6({ class: "collapse-header" }, item.label);
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* @param {object} item
|
|
49
|
+
* @param {object} item
|
|
50
50
|
* @returns {string}
|
|
51
51
|
*/
|
|
52
52
|
const labelToId = (item) => text(item.label.replace(" ", ""));
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* @param {object} x
|
|
56
|
-
* @param {object} s
|
|
55
|
+
* @param {object} x
|
|
56
|
+
* @param {object} s
|
|
57
57
|
* @returns {object}
|
|
58
58
|
*/
|
|
59
59
|
const logit = (x, s) => {
|
|
@@ -63,8 +63,8 @@ const logit = (x, s) => {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* @param {string} currentUrl
|
|
67
|
-
* @param {object} item
|
|
66
|
+
* @param {string} currentUrl
|
|
67
|
+
* @param {object} item
|
|
68
68
|
* @returns {boolean}
|
|
69
69
|
*/
|
|
70
70
|
const active = (currentUrl, item) =>
|
|
@@ -78,7 +78,7 @@ const active = (currentUrl, item) =>
|
|
|
78
78
|
));
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @param {string} currentUrl
|
|
81
|
+
* @param {string} currentUrl
|
|
82
82
|
* @returns {function}
|
|
83
83
|
*/
|
|
84
84
|
const sideBarItem = (currentUrl) => (item) => {
|
|
@@ -122,7 +122,7 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
* @param {string} currentUrl
|
|
125
|
+
* @param {string} currentUrl
|
|
126
126
|
* @returns {function}
|
|
127
127
|
*/
|
|
128
128
|
const sideBarSection = (currentUrl) => (section) => [
|
|
@@ -133,9 +133,9 @@ const sideBarSection = (currentUrl) => (section) => [
|
|
|
133
133
|
];
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* @param {object} brand
|
|
137
|
-
* @param {string[]} sections
|
|
138
|
-
* @param {string} currentUrl
|
|
136
|
+
* @param {object} brand
|
|
137
|
+
* @param {string[]} sections
|
|
138
|
+
* @param {string} currentUrl
|
|
139
139
|
* @returns {ul}
|
|
140
140
|
*/
|
|
141
141
|
const sidebar = (brand, sections, currentUrl) =>
|
|
@@ -171,7 +171,7 @@ const sidebar = (brand, sections, currentUrl) =>
|
|
|
171
171
|
*/
|
|
172
172
|
const blockDispatch = {
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
174
|
+
*
|
|
175
175
|
* @param {object} opts
|
|
176
176
|
* @param {string} opts.title
|
|
177
177
|
* @param {string} opts.blurb
|
|
@@ -183,7 +183,7 @@ const blockDispatch = {
|
|
|
183
183
|
blurb && p({ class: "mb-0 text-gray-800" }, blurb)
|
|
184
184
|
),
|
|
185
185
|
/**
|
|
186
|
-
* @param {object} opts
|
|
186
|
+
* @param {object} opts
|
|
187
187
|
* @param {string} opts.contents
|
|
188
188
|
* @returns {div}
|
|
189
189
|
*/
|
|
@@ -233,9 +233,9 @@ const blockDispatch = {
|
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
|
-
* @param {string} title
|
|
237
|
-
* @param {string|object} body
|
|
238
|
-
* @param {*} role
|
|
236
|
+
* @param {string} title
|
|
237
|
+
* @param {string|object} body
|
|
238
|
+
* @param {*} role
|
|
239
239
|
* @returns {string}
|
|
240
240
|
*/
|
|
241
241
|
const renderBody = (title, body, role) =>
|
|
@@ -246,10 +246,10 @@ const renderBody = (title, body, role) =>
|
|
|
246
246
|
typeof body === "string" ? { type: "card", title, contents: body } : body,
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
/**
|
|
250
|
+
* @param {object} authLinks
|
|
251
|
+
* @returns {hr|a}
|
|
252
|
+
*/
|
|
253
253
|
const renderAuthLinks = (authLinks) => {
|
|
254
254
|
var links = [];
|
|
255
255
|
if (authLinks.login)
|
|
@@ -276,7 +276,7 @@ const renderAuthLinks = (authLinks) => {
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
/**
|
|
279
|
-
* @param {Form} form
|
|
279
|
+
* @param {Form} form
|
|
280
280
|
* @returns {Form}
|
|
281
281
|
*/
|
|
282
282
|
const formModify = (form) => {
|
|
@@ -286,10 +286,10 @@ const formModify = (form) => {
|
|
|
286
286
|
};
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
|
-
* @param {*} headers
|
|
290
|
-
* @param {string} title
|
|
291
|
-
* @param {string} bodyAttr
|
|
292
|
-
* @param {string} rest
|
|
289
|
+
* @param {*} headers
|
|
290
|
+
* @param {string} title
|
|
291
|
+
* @param {string} bodyAttr
|
|
292
|
+
* @param {string} rest
|
|
293
293
|
* @returns {string}
|
|
294
294
|
*/
|
|
295
295
|
const wrapIt = (headers, title, bodyAttr, rest) =>
|
|
@@ -321,7 +321,7 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
|
|
|
321
321
|
</html>`;
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
|
-
* @param {object} opts
|
|
324
|
+
* @param {object} opts
|
|
325
325
|
* @param {string} opts.title
|
|
326
326
|
* @param {object[]} opts.alerts
|
|
327
327
|
* @param {object} opts.form
|
|
@@ -339,11 +339,12 @@ const authWrap = ({
|
|
|
339
339
|
headers,
|
|
340
340
|
csrfToken,
|
|
341
341
|
authLinks,
|
|
342
|
+
bodyClass,
|
|
342
343
|
}) =>
|
|
343
344
|
wrapIt(
|
|
344
345
|
headers,
|
|
345
346
|
title,
|
|
346
|
-
|
|
347
|
+
`class="bg-gradient-primary ${bodyClass || ""}"`,
|
|
347
348
|
`<div class="container">
|
|
348
349
|
<div class="row justify-content-center">
|
|
349
350
|
<div class="col-xl-10 col-lg-12 col-md-9">
|
|
@@ -390,11 +391,12 @@ const wrap = ({
|
|
|
390
391
|
body,
|
|
391
392
|
headers,
|
|
392
393
|
role,
|
|
394
|
+
bodyClass,
|
|
393
395
|
}) =>
|
|
394
396
|
wrapIt(
|
|
395
397
|
headers,
|
|
396
398
|
title,
|
|
397
|
-
|
|
399
|
+
`id="page-top" class="${bodyClass || ""}"`,
|
|
398
400
|
`<div id="wrapper">
|
|
399
401
|
${sidebar(brand, menu, currentUrl)}
|
|
400
402
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/sbadmin2",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-beta.2",
|
|
4
4
|
"description": "SB Admin 2 layout plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "jest"
|
|
7
|
+
"test": "jest",
|
|
8
|
+
"tsc": "echo \"Error: no TypeScript support yet\"",
|
|
9
|
+
"clean": "echo \"Error: no TypeScript support yet\""
|
|
8
10
|
},
|
|
9
11
|
"dependencies": {
|
|
10
|
-
"@saltcorn/data": "0.6.
|
|
11
|
-
"@saltcorn/markup": "0.6.
|
|
12
|
+
"@saltcorn/data": "0.6.2-beta.2",
|
|
13
|
+
"@saltcorn/markup": "0.6.2-beta.2",
|
|
12
14
|
"startbootstrap-sb-admin-2": "^4.1.4"
|
|
13
15
|
},
|
|
14
16
|
"author": "Tom Nielsen",
|
|
@@ -18,7 +20,12 @@
|
|
|
18
20
|
},
|
|
19
21
|
"repository": "github:saltcorn/saltcorn",
|
|
20
22
|
"jest": {
|
|
21
|
-
"testEnvironment": "node"
|
|
23
|
+
"testEnvironment": "node",
|
|
24
|
+
"moduleNameMapper": {
|
|
25
|
+
"@saltcorn/sqlite/(.*)": "@saltcorn/sqlite/dist/$1",
|
|
26
|
+
"@saltcorn/db-common/(.*)": "@saltcorn/db-common/dist/$1",
|
|
27
|
+
"@saltcorn/data/(.*)": "@saltcorn/data/dist/$1"
|
|
28
|
+
}
|
|
22
29
|
},
|
|
23
30
|
"publishConfig": {
|
|
24
31
|
"access": "public"
|