@saltcorn/sbadmin2 1.6.0-beta.1 → 1.6.0-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 +13 -13
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -40,10 +40,10 @@ const verstring = "@" + require("./package.json").version;
|
|
|
40
40
|
* @param {string} currentUrl
|
|
41
41
|
* @returns {function}
|
|
42
42
|
*/
|
|
43
|
-
const subItem = (currentUrl) => (item) =>
|
|
43
|
+
const subItem = (currentUrl, isRTL) => (item) =>
|
|
44
44
|
item.subitems
|
|
45
45
|
? div(
|
|
46
|
-
{ class:
|
|
46
|
+
{ class: `dropdown-item btn-group ${isRTL ? "dropstart" : "dropend"}` },
|
|
47
47
|
a(
|
|
48
48
|
{
|
|
49
49
|
type: "button",
|
|
@@ -55,7 +55,7 @@ const subItem = (currentUrl) => (item) =>
|
|
|
55
55
|
),
|
|
56
56
|
ul(
|
|
57
57
|
{ class: "dropdown-menu" },
|
|
58
|
-
item.subitems.map((si1) => li(subItem(currentUrl)(si1)))
|
|
58
|
+
item.subitems.map((si1) => li(subItem(currentUrl, isRTL)(si1)))
|
|
59
59
|
)
|
|
60
60
|
)
|
|
61
61
|
: item.link
|
|
@@ -71,7 +71,7 @@ const subItem = (currentUrl) => (item) =>
|
|
|
71
71
|
...(item.tooltip
|
|
72
72
|
? {
|
|
73
73
|
"data-bs-toggle": "tooltip",
|
|
74
|
-
"data-bs-placement": "right",
|
|
74
|
+
"data-bs-placement": isRTL ? "left" : "right",
|
|
75
75
|
title: item.tooltip,
|
|
76
76
|
}
|
|
77
77
|
: {}),
|
|
@@ -119,7 +119,7 @@ const active = (currentUrl, item) =>
|
|
|
119
119
|
* @param {string} currentUrl
|
|
120
120
|
* @returns {function}
|
|
121
121
|
*/
|
|
122
|
-
const sideBarItem = (currentUrl) => (item) => {
|
|
122
|
+
const sideBarItem = (currentUrl, isRTL) => (item) => {
|
|
123
123
|
const is_active = active(currentUrl, item);
|
|
124
124
|
if (item.type === "Separator") return hr({ class: "sidebar-divider my-0" });
|
|
125
125
|
return li(
|
|
@@ -140,7 +140,7 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
140
140
|
"aria-controls": `collapse${labelToId(item)}`,
|
|
141
141
|
...(item.tooltip
|
|
142
142
|
? {
|
|
143
|
-
"data-bs-placement": "right",
|
|
143
|
+
"data-bs-placement": isRTL ? "left" : "right",
|
|
144
144
|
title: item.tooltip,
|
|
145
145
|
}
|
|
146
146
|
: {}),
|
|
@@ -156,7 +156,7 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
156
156
|
},
|
|
157
157
|
div(
|
|
158
158
|
{ class: "bg-white py-2 collapse-inner rounded" },
|
|
159
|
-
item.subitems.map(subItem(currentUrl))
|
|
159
|
+
item.subitems.map(subItem(currentUrl, isRTL))
|
|
160
160
|
)
|
|
161
161
|
),
|
|
162
162
|
]
|
|
@@ -169,7 +169,7 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
169
169
|
...(item.tooltip
|
|
170
170
|
? {
|
|
171
171
|
"data-bs-toggle": "tooltip",
|
|
172
|
-
"data-bs-placement": "right",
|
|
172
|
+
"data-bs-placement": isRTL ? "left" : "right",
|
|
173
173
|
title: item.tooltip,
|
|
174
174
|
}
|
|
175
175
|
: {}),
|
|
@@ -214,11 +214,11 @@ const sideBarItem = (currentUrl) => (item) => {
|
|
|
214
214
|
* @param {string} currentUrl
|
|
215
215
|
* @returns {function}
|
|
216
216
|
*/
|
|
217
|
-
const sideBarSection = (currentUrl) => (section) => [
|
|
217
|
+
const sideBarSection = (currentUrl, isRTL) => (section) => [
|
|
218
218
|
section.section &&
|
|
219
219
|
hr({ class: "sidebar-divider" }) +
|
|
220
220
|
div({ class: "sidebar-heading" }, section.section),
|
|
221
|
-
section.items.map(sideBarItem(currentUrl)).join(""),
|
|
221
|
+
section.items.map(sideBarItem(currentUrl, isRTL)).join(""),
|
|
222
222
|
];
|
|
223
223
|
|
|
224
224
|
/**
|
|
@@ -227,7 +227,7 @@ const sideBarSection = (currentUrl) => (section) => [
|
|
|
227
227
|
* @param {string} currentUrl
|
|
228
228
|
* @returns {ul}
|
|
229
229
|
*/
|
|
230
|
-
const sidebar = (brand, sections, currentUrl) =>
|
|
230
|
+
const sidebar = (brand, sections, currentUrl, isRTL) =>
|
|
231
231
|
ul(
|
|
232
232
|
{
|
|
233
233
|
class: "navbar-nav sidebar sidebar-dark accordion d-print-none",
|
|
@@ -245,7 +245,7 @@ const sidebar = (brand, sections, currentUrl) =>
|
|
|
245
245
|
),
|
|
246
246
|
div({ class: "sidebar-brand-text mx-3" }, brand.name)
|
|
247
247
|
),
|
|
248
|
-
sections.map(sideBarSection(currentUrl)),
|
|
248
|
+
sections.map(sideBarSection(currentUrl, isRTL)),
|
|
249
249
|
hr({ class: "sidebar-divider d-none d-md-block" }),
|
|
250
250
|
div(
|
|
251
251
|
{ class: "text-center d-none d-md-inline" },
|
|
@@ -518,7 +518,7 @@ const wrap = ({
|
|
|
518
518
|
title,
|
|
519
519
|
`id="page-top" class="${bodyClass || ""}"`,
|
|
520
520
|
`<div id="wrapper">
|
|
521
|
-
${menu && menu.length > 0 ? sidebar(brand, menu, currentUrl) : ""}
|
|
521
|
+
${menu && menu.length > 0 ? sidebar(brand, menu, currentUrl, req?.isRTL) : ""}
|
|
522
522
|
|
|
523
523
|
<div id="content-wrapper" class="d-flex flex-column">
|
|
524
524
|
<div id="content">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/sbadmin2",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.2",
|
|
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": "1.6.0-beta.
|
|
13
|
-
"@saltcorn/markup": "1.6.0-beta.
|
|
12
|
+
"@saltcorn/data": "1.6.0-beta.2",
|
|
13
|
+
"@saltcorn/markup": "1.6.0-beta.2"
|
|
14
14
|
},
|
|
15
15
|
"author": "Tom Nielsen",
|
|
16
16
|
"license": "MIT",
|