@benpley/wappler-responsive-sidebar 1.0.1 → 1.0.3
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/README.md +18 -1
- package/app_connect/components.hjson +2 -8
- package/includes/responsive-sidebar.js +16 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Then add the extension through Wappler's Extension Manager.
|
|
|
35
35
|
|
|
36
36
|
1. Download the extension files
|
|
37
37
|
2. Copy the `wappler-responsive-sidebar` folder to your Wappler extensions directory:
|
|
38
|
-
- **Windows**: `C
|
|
38
|
+
- **Windows**: `C:\\Users\\[YourUsername]\\AppData\\Local\\Wappler\\extensions\\`
|
|
39
39
|
- **macOS**: `~/Library/Application Support/Wappler/extensions/`
|
|
40
40
|
- **Linux**: `~/.config/Wappler/extensions/`
|
|
41
41
|
3. Restart Wappler
|
|
@@ -120,6 +120,13 @@ All properties support App Connect data binding:
|
|
|
120
120
|
dmx-bind:brand-url="appData.homeUrl">
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
### Data Binding Scope Note
|
|
124
|
+
|
|
125
|
+
This component is a layout/container component, not a data source. In recent versions, component data exposure was removed to avoid invalid scoped picker paths such as `sidebar1.someDataSource...`.
|
|
126
|
+
|
|
127
|
+
- ✅ Use direct data source ids in bindings (for example: `serverconnect1.data.items`)
|
|
128
|
+
- ❌ Avoid prefixed bindings through the sidebar id (for example: `sidebar1.serverconnect1.data.items`)
|
|
129
|
+
|
|
123
130
|
## Actions
|
|
124
131
|
|
|
125
132
|
The component provides the following actions for dynamic updates:
|
|
@@ -339,6 +346,16 @@ For issues or questions:
|
|
|
339
346
|
|
|
340
347
|
## Changelog
|
|
341
348
|
|
|
349
|
+
### Version 1.0.3
|
|
350
|
+
- Fixed data picker/scoping confusion for nested bindings inside the sidebar layout.
|
|
351
|
+
- Removed App Connect data-source exposure from the component definition (`dataScheme`, `outputType`, `dataPick`).
|
|
352
|
+
- Removed unnecessary wrapper reactive data state (`initialData` and internal `set(...)` calls) from the component script.
|
|
353
|
+
- Clarified recommended binding usage in documentation (use direct data source ids).
|
|
354
|
+
|
|
355
|
+
### Version 1.0.2
|
|
356
|
+
- Added Bootstrap 5 Navigation component integration for automatic active link highlighting
|
|
357
|
+
- Enhanced components.hjson to include dmxBootstrap5Navigation.js dependency
|
|
358
|
+
|
|
342
359
|
### Version 1.0.1
|
|
343
360
|
- Added active navigation link styling (.active class support) to CSS
|
|
344
361
|
|
|
@@ -12,13 +12,6 @@
|
|
|
12
12
|
template: '<responsive-sidebar id="@@id@@" brand-text="Brand" brand-url="/" sidebar-title="Navigation">\n <!-- Brand Logo/Content (optional) -->\n <div slot="brand">\n <span>Your Logo</span>\n </div>\n\n <!-- Header Right Content (optional) -->\n <div slot="header-right">\n <button class="btn btn-primary">Login</button>\n </div>\n\n <!-- Sidebar Menu -->\n <div slot="menu">\n <ul class="list-unstyled">\n <!-- Dashboard Link -->\n <li><a href="/" class="d-block p-2 text-decoration-none">Dashboard</a></li>\n \n <!-- Products Section -->\n <li class="text-uppercase small fw-bold text-muted px-2 mt-3 mb-2">Products</li>\n <li><a href="/products" class="d-block p-2 text-decoration-none">All Products</a></li>\n <li><a href="/products/add" class="d-block p-2 text-decoration-none">Add Product</a></li>\n <li><a href="/products/categories" class="d-block p-2 text-decoration-none">Categories</a></li>\n \n <!-- Employees Section -->\n <li class="text-uppercase small fw-bold text-muted px-2 mt-3 mb-2">Employees</li>\n <li><a href="/employees" class="d-block p-2 text-decoration-none">All Employees</a></li>\n <li><a href="/employees/add" class="d-block p-2 text-decoration-none">Add Employee</a></li>\n <li><a href="/employees/departments" class="d-block p-2 text-decoration-none">Departments</a></li>\n \n <!-- Reports Section -->\n <li class="text-uppercase small fw-bold text-muted px-2 mt-3 mb-2">Reports</li>\n <li><a href="/reports/sales" class="d-block p-2 text-decoration-none">Sales Reports</a></li>\n <li><a href="/reports/analytics" class="d-block p-2 text-decoration-none">Analytics</a></li>\n </ul>\n </div>\n\n <!-- Sidebar Footer (optional) -->\n <div slot="footer">\n © 2026 Your Company\n </div>\n\n <!-- Main Content Area -->\n <div slot="main">\n <%- await include(content, locals); %>\n </div>\n</responsive-sidebar>',
|
|
13
13
|
baseName: 'sidebar',
|
|
14
14
|
help: 'A complete responsive sidebar layout with header, collapsible navigation, and main content area. Customize styles by editing css/responsive-sidebar.css in your project.',
|
|
15
|
-
dataScheme: [
|
|
16
|
-
{name: 'brandText', type: 'text'},
|
|
17
|
-
{name: 'brandUrl', type: 'text'},
|
|
18
|
-
{name: 'sidebarTitle', type: 'text'}
|
|
19
|
-
],
|
|
20
|
-
outputType: 'object',
|
|
21
|
-
dataPick: true,
|
|
22
15
|
properties: [
|
|
23
16
|
{
|
|
24
17
|
group: 'Responsive Sidebar Properties',
|
|
@@ -100,7 +93,8 @@
|
|
|
100
93
|
],
|
|
101
94
|
linkFiles: [
|
|
102
95
|
{src: 'css/responsive-sidebar.css', type: 'css'},
|
|
103
|
-
{src: 'js/responsive-sidebar.js', type: 'js', defer: true}
|
|
96
|
+
{src: 'js/responsive-sidebar.js', type: 'js', defer: true},
|
|
97
|
+
{src: 'dmxAppConnect/dmxBootstrap5Navigation/dmxBootstrap5Navigation.js', type: 'js', defer: true}
|
|
104
98
|
],
|
|
105
99
|
cssOrder: [],
|
|
106
100
|
jsOrder: []
|
|
@@ -33,25 +33,25 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
33
33
|
// Create the header structure
|
|
34
34
|
const header = document.createElement('header');
|
|
35
35
|
header.className = 'navbar navbar-expand-lg bd-navbar sticky-top bg-body-secondary';
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
const nav = document.createElement('nav');
|
|
38
38
|
nav.className = 'container-fluid';
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
// Left side: toggler + brand
|
|
41
41
|
const leftDiv = document.createElement('div');
|
|
42
42
|
leftDiv.className = 'd-flex align-items-center';
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const togglerBtn = document.createElement('button');
|
|
45
45
|
togglerBtn.className = 'navbar-toggler';
|
|
46
46
|
togglerBtn.type = 'button';
|
|
47
47
|
togglerBtn.setAttribute('data-bs-toggle', 'offcanvas');
|
|
48
48
|
togglerBtn.setAttribute('data-bs-target', '#bdSidebar');
|
|
49
49
|
togglerBtn.innerHTML = '<span class="navbar-toggler-icon"></span>';
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
const brandLink = document.createElement('a');
|
|
52
52
|
brandLink.className = 'navbar-brand ps-1 mb-0';
|
|
53
53
|
brandLink.href = brandUrl;
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
// Use brand slot if provided, otherwise fallback to attribute
|
|
56
56
|
if (brandContent) {
|
|
57
57
|
while (brandContent.firstChild) {
|
|
@@ -61,11 +61,11 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
61
61
|
const brandText = this.getAttribute('brand-text') || 'Brand';
|
|
62
62
|
brandLink.textContent = brandText;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
leftDiv.appendChild(togglerBtn);
|
|
66
66
|
leftDiv.appendChild(brandLink);
|
|
67
67
|
nav.appendChild(leftDiv);
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
// Right side: custom content slot
|
|
70
70
|
if (headerRightContent) {
|
|
71
71
|
const rightDiv = document.createElement('div');
|
|
@@ -75,7 +75,7 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
75
75
|
}
|
|
76
76
|
nav.appendChild(rightDiv);
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
header.appendChild(nav);
|
|
80
80
|
|
|
81
81
|
// Create bd-layout container
|
|
@@ -85,7 +85,7 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
85
85
|
// Create sidebar
|
|
86
86
|
const sidebar = document.createElement('aside');
|
|
87
87
|
sidebar.className = 'bd-sidebar';
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
const offcanvas = document.createElement('div');
|
|
90
90
|
offcanvas.className = 'offcanvas-lg offcanvas-start bg-body-secondary';
|
|
91
91
|
offcanvas.tabIndex = -1;
|
|
@@ -106,7 +106,7 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
106
106
|
sidebarNav.className = 'bd-links w-100 p-3 ps-lg-3';
|
|
107
107
|
sidebarNav.id = 'bd-docs-nav';
|
|
108
108
|
sidebarNav.setAttribute('aria-label', 'Sidebar navigation');
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
// Move menu content into nav (preserve DOM nodes)
|
|
111
111
|
if (menuContent) {
|
|
112
112
|
while (menuContent.firstChild) {
|
|
@@ -133,7 +133,7 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
133
133
|
// Create main content area
|
|
134
134
|
const main = document.createElement('main');
|
|
135
135
|
main.className = 'bd-main my-3 order-1';
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
// Move main content (preserve DOM nodes and App Connect components)
|
|
138
138
|
if (mainContent) {
|
|
139
139
|
while (mainContent.firstChild) {
|
|
@@ -149,7 +149,7 @@ class ResponsiveSidebar extends HTMLElement {
|
|
|
149
149
|
this.innerHTML = '';
|
|
150
150
|
this.appendChild(header);
|
|
151
151
|
this.appendChild(layout);
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
// Dispatch a custom event when rendering is complete
|
|
154
154
|
this.dispatchEvent(new CustomEvent('rendered', { bubbles: true }));
|
|
155
155
|
}
|
|
@@ -189,12 +189,6 @@ customElements.define('responsive-sidebar', ResponsiveSidebar);
|
|
|
189
189
|
|
|
190
190
|
// Now wrap it as a Wappler component for better IDE integration
|
|
191
191
|
dmx.Component('responsive-sidebar', {
|
|
192
|
-
initialData: {
|
|
193
|
-
brandText: null,
|
|
194
|
-
brandUrl: null,
|
|
195
|
-
sidebarTitle: null
|
|
196
|
-
},
|
|
197
|
-
|
|
198
192
|
attributes: {
|
|
199
193
|
brandText: {
|
|
200
194
|
type: String,
|
|
@@ -213,19 +207,16 @@ dmx.Component('responsive-sidebar', {
|
|
|
213
207
|
methods: {
|
|
214
208
|
setBrandText: function (text) {
|
|
215
209
|
this.$node.setBrandText(text);
|
|
216
|
-
this.set('brandText', text);
|
|
217
210
|
this.dispatchEvent('updated');
|
|
218
211
|
},
|
|
219
|
-
|
|
212
|
+
|
|
220
213
|
setBrandUrl: function (url) {
|
|
221
214
|
this.$node.setBrandUrl(url);
|
|
222
|
-
this.set('brandUrl', url);
|
|
223
215
|
this.dispatchEvent('updated');
|
|
224
216
|
},
|
|
225
|
-
|
|
217
|
+
|
|
226
218
|
setSidebarTitle: function (title) {
|
|
227
219
|
this.$node.setSidebarTitle(title);
|
|
228
|
-
this.set('sidebarTitle', title);
|
|
229
220
|
this.dispatchEvent('updated');
|
|
230
221
|
}
|
|
231
222
|
},
|
|
@@ -236,29 +227,10 @@ dmx.Component('responsive-sidebar', {
|
|
|
236
227
|
},
|
|
237
228
|
|
|
238
229
|
render: function () {
|
|
239
|
-
//
|
|
240
|
-
if (this.props.brandText) {
|
|
241
|
-
this.set('brandText', this.props.brandText);
|
|
242
|
-
}
|
|
243
|
-
if (this.props.brandUrl) {
|
|
244
|
-
this.set('brandUrl', this.props.brandUrl);
|
|
245
|
-
}
|
|
246
|
-
if (this.props.sidebarTitle) {
|
|
247
|
-
this.set('sidebarTitle', this.props.sidebarTitle);
|
|
248
|
-
}
|
|
230
|
+
// Web Component handles rendering and attributes.
|
|
249
231
|
},
|
|
250
232
|
|
|
251
233
|
update: function (props, fields) {
|
|
252
|
-
// The Web Component handles attribute changes automatically
|
|
253
|
-
// Just update our internal data
|
|
254
|
-
if (fields.has('brandText')) {
|
|
255
|
-
this.set('brandText', this.props.brandText);
|
|
256
|
-
}
|
|
257
|
-
if (fields.has('brandUrl')) {
|
|
258
|
-
this.set('brandUrl', this.props.brandUrl);
|
|
259
|
-
}
|
|
260
|
-
if (fields.has('sidebarTitle')) {
|
|
261
|
-
this.set('sidebarTitle', this.props.sidebarTitle);
|
|
262
|
-
}
|
|
234
|
+
// The Web Component handles attribute changes automatically.
|
|
263
235
|
}
|
|
264
236
|
});
|