@saltcorn/sbadmin2 0.8.5-beta.4 → 0.8.5-beta.5

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.
Files changed (2) hide show
  1. package/index.js +73 -64
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -39,16 +39,20 @@ const { isNode } = require("@saltcorn/data/utils");
39
39
  const subItem = (currentUrl) => (item) =>
40
40
  item.link
41
41
  ? a(
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
- )
42
+ {
43
+ class: [
44
+ "collapse-item",
45
+ active(currentUrl, item) && "active",
46
+ item.class,
47
+ ],
48
+ href: text(item.link),
49
+ },
50
+ item.icon ? i({ class: `fa-fw mr-05 ${item.icon}` }) : "",
51
+ item.label
52
+ )
49
53
  : item.type === "Separator"
50
- ? hr({ class: "sidebar-divider my-0" })
51
- : h6({ class: "collapse-header" }, item.label);
54
+ ? hr({ class: "sidebar-divider my-0" })
55
+ : h6({ class: "collapse-header" }, item.label);
52
56
 
53
57
  /**
54
58
  * @param {object} item
@@ -93,62 +97,66 @@ const sideBarItem = (currentUrl) => (item) => {
93
97
  { class: ["nav-item", is_active && "active"] },
94
98
  item.subitems
95
99
  ? [
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
- },
100
+ a(
101
+ {
102
+ class: [
103
+ "nav-link",
104
+ !is_active && "collapsed",
105
+ item.isUser && "user-nav-section-with-span",
106
+ ],
107
+ href: "#",
108
+ "data-bs-toggle": "collapse",
109
+ "data-bs-target": `#collapse${labelToId(item)}`,
110
+ "aria-expanded": "true",
111
+ "aria-controls": `collapse${labelToId(item)}`,
112
+ },
113
+ item.icon ? i({ class: `fa-fw ${item.icon}` }) : "",
114
+ span(text(item.label))
115
+ ),
114
116
  div(
115
- { class: "bg-white py-2 collapse-inner rounded" },
116
- item.subitems.map(subItem(currentUrl))
117
- )
118
- ),
119
- ]
117
+ {
118
+ id: `collapse${labelToId(item)}`,
119
+ class: ["collapse", is_active && "show"],
120
+ "data-parent": "#accordionSidebar",
121
+ },
122
+ div(
123
+ { class: "bg-white py-2 collapse-inner rounded" },
124
+ item.subitems.map(subItem(currentUrl))
125
+ )
126
+ ),
127
+ ]
120
128
  : item.link
121
- ? a(
129
+ ? a(
122
130
  { class: "nav-link", href: text(item.link) },
123
131
  item.icon ? i({ class: `fa-fw ${item.icon}` }) : "",
124
132
  span(text(item.label))
125
133
  )
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" },
134
+ : item.type === "Search"
135
+ ? form(
136
+ { action: "/search", class: "menusearch ms-2 me-3", method: "get" },
137
+ div(
138
+ { class: "input-group search-bar" },
131
139
 
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
- }),
140
+ input({
141
+ type: "search",
142
+ class: "form-control search-bar pl-2p5",
143
+ placeholder: item.label,
144
+ id: "inputq",
145
+ name: "q",
146
+ "aria-label": "Search",
147
+ "aria-describedby": "button-search-submit",
148
+ }),
141
149
 
142
- button(
143
- {
144
- class: "btn btn-outline-secondary search-bar",
145
- type: "submit",
146
- },
147
- i({ class: "fas fa-search" })
148
- )
150
+ button(
151
+ {
152
+ class: "btn btn-outline-secondary search-bar",
153
+ type: "submit",
154
+ },
155
+ i({ class: "fas fa-search" })
149
156
  )
150
157
  )
151
- : span({ class: "nav-link" }, text(item.label))
158
+ )
159
+ : span({ class: "nav-link" }, text(item.label))
152
160
  );
153
161
  };
154
162
 
@@ -159,8 +167,8 @@ const sideBarItem = (currentUrl) => (item) => {
159
167
  const sideBarSection = (currentUrl) => (section) =>
160
168
  [
161
169
  section.section &&
162
- hr({ class: "sidebar-divider" }) +
163
- div({ class: "sidebar-heading" }, section.section),
170
+ hr({ class: "sidebar-divider" }) +
171
+ div({ class: "sidebar-heading" }, section.section),
164
172
  section.items.map(sideBarItem(currentUrl)).join(""),
165
173
  ];
166
174
 
@@ -183,10 +191,10 @@ const sidebar = (brand, sections, currentUrl) =>
183
191
  href: "/",
184
192
  },
185
193
  brand.logo &&
186
- div(
187
- { class: "sidebar-brand-icon" },
188
- img({ src: brand.logo, width: "35", height: "35", alt: "Logo" })
189
- ),
194
+ div(
195
+ { class: "sidebar-brand-icon" },
196
+ img({ src: brand.logo, width: "35", height: "35", alt: "Logo" })
197
+ ),
190
198
  div({ class: "sidebar-brand-text mx-3" }, brand.name)
191
199
  ),
192
200
  sections.map(sideBarSection(currentUrl)),
@@ -196,7 +204,7 @@ const sidebar = (brand, sections, currentUrl) =>
196
204
  button({
197
205
  class: "rounded-circle border-0",
198
206
  "data-sidebar-toggler": true,
199
- id: "sidebarToggle"
207
+ id: "sidebarToggle",
200
208
  })
201
209
  )
202
210
  );
@@ -340,7 +348,7 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
340
348
  `<!doctype html>
341
349
  <html lang="en">
342
350
  <head>
343
- ${!isNode() ? `<base href="http://localhost">` : ""}
351
+ ${!isNode() ? `<base href="http://localhost">` : ""}
344
352
  <!-- Required meta tags -->
345
353
  <meta charset="utf-8">
346
354
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -355,7 +363,8 @@ const wrapIt = (headers, title, bodyAttr, rest) =>
355
363
  </head>
356
364
  <body ${bodyAttr}>
357
365
  ${rest}
358
- <script src="${safeSlash()}static_assets/${db.connectObj.version_tag
366
+ <script src="${safeSlash()}static_assets/${
367
+ db.connectObj.version_tag
359
368
  }/jquery-3.6.0.min.js"></script>
360
369
  <script src="${safeSlash()}plugins/pubdeps/sbadmin2/startbootstrap-sb-admin-2-bs5/4.1.5-beta.5/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
361
370
  <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.8.5-beta.4",
3
+ "version": "0.8.5-beta.5",
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.8.5-beta.4",
13
- "@saltcorn/markup": "0.8.5-beta.4",
12
+ "@saltcorn/data": "0.8.5-beta.5",
13
+ "@saltcorn/markup": "0.8.5-beta.5",
14
14
  "startbootstrap-sb-admin-2-bs5": "^4.1.5-beta.8"
15
15
  },
16
16
  "author": "Tom Nielsen",