@lowdefy/blocks-antd 5.0.0 → 5.2.0
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/dist/blocks/AutoComplete/AutoComplete.js +6 -0
- package/dist/blocks/AutoComplete/meta.js +1 -0
- package/dist/blocks/Calendar/Calendar.js +60 -18
- package/dist/blocks/Calendar/meta.js +1 -1
- package/dist/blocks/ControlledList/ControlledList.js +40 -15
- package/dist/blocks/ControlledList/meta.js +6 -2
- package/dist/blocks/ControlledList/style.module.css +35 -0
- package/dist/blocks/Drawer/Drawer.js +2 -0
- package/dist/blocks/Drawer/meta.js +2 -1
- package/dist/blocks/DropdownButton/DropdownButton.js +13 -5
- package/dist/blocks/DropdownButton/meta.js +3 -3
- package/dist/blocks/Menu/Menu.js +6 -3
- package/dist/blocks/MobileMenu/MobileMenu.js +16 -3
- package/dist/blocks/MobileMenu/meta.js +32 -1
- package/dist/blocks/MultipleSelector/MultipleSelector.js +9 -2
- package/dist/blocks/MultipleSelector/meta.js +1 -0
- package/dist/blocks/PageSidebarLayout/PageSidebarLayout.js +517 -0
- package/dist/blocks/PageSidebarLayout/e2e.js +34 -0
- package/dist/blocks/PageSidebarLayout/meta.js +526 -0
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +39 -6
- package/dist/blocks/PageSiderMenu/meta.js +10 -0
- package/dist/blocks/Selector/Selector.js +6 -0
- package/dist/blocks/Selector/meta.js +1 -0
- package/dist/blocks/Sider/Sider.js +10 -0
- package/dist/blocks/headerActions.js +131 -28
- package/dist/blocks.js +1 -0
- package/dist/metas.js +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React, { useState, useEffect } from 'react';
|
|
16
|
+
import { ConfigProvider } from 'antd';
|
|
17
|
+
import { get, mergeObjects, type } from '@lowdefy/helpers';
|
|
18
|
+
import { withBlockDefaults } from '@lowdefy/block-utils';
|
|
19
|
+
import Breadcrumb from '../Breadcrumb/Breadcrumb.js';
|
|
20
|
+
import Button from '../Button/Button.js';
|
|
21
|
+
import Content from '../Content/Content.js';
|
|
22
|
+
import Footer from '../Footer/Footer.js';
|
|
23
|
+
import Header from '../Header/Header.js';
|
|
24
|
+
import Layout from '../Layout/Layout.js';
|
|
25
|
+
import Menu from '../Menu/Menu.js';
|
|
26
|
+
import MobileMenu from '../MobileMenu/MobileMenu.js';
|
|
27
|
+
import Sider from '../Sider/Sider.js';
|
|
28
|
+
import { getDarkMode, renderHeaderActions, registerDarkModeMethod } from '../headerActions.js';
|
|
29
|
+
function getInitialSiderState({ properties }) {
|
|
30
|
+
const storageKey = `lf-${properties.siderStorageKey ?? 'sider'}-open`;
|
|
31
|
+
try {
|
|
32
|
+
const stored = localStorage.getItem(storageKey);
|
|
33
|
+
if (stored === 'true') return true;
|
|
34
|
+
if (stored === 'false') return false;
|
|
35
|
+
} catch {
|
|
36
|
+
// localStorage unavailable (SSR, privacy mode)
|
|
37
|
+
}
|
|
38
|
+
return !properties.sider?.initialCollapsed;
|
|
39
|
+
}
|
|
40
|
+
function writeSiderState({ properties, open }) {
|
|
41
|
+
const storageKey = `lf-${properties.siderStorageKey ?? 'sider'}-open`;
|
|
42
|
+
try {
|
|
43
|
+
localStorage.setItem(storageKey, String(open));
|
|
44
|
+
} catch {
|
|
45
|
+
// localStorage unavailable
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const PageSidebarLayout = ({ basePath, blockId, classNames = {}, components: { Icon, Link, ShortcutBadge }, events, content, menus, methods, pageId, properties, styles = {} })=>{
|
|
49
|
+
const [openSiderState, setSiderOpen] = useState(()=>getInitialSiderState({
|
|
50
|
+
properties
|
|
51
|
+
}));
|
|
52
|
+
// Re-read localStorage on mount: during SSR localStorage is unavailable, so
|
|
53
|
+
// the lazy initializer falls back to properties.sider.initialCollapsed. Once
|
|
54
|
+
// hydrated we pick up the stored value so a reload restores the state the
|
|
55
|
+
// user actually left the sider in. Sider has its own internal state, so we
|
|
56
|
+
// also push the restored value through the registered sync method once it's
|
|
57
|
+
// available.
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
setSiderOpen(getInitialSiderState({
|
|
60
|
+
properties
|
|
61
|
+
}));
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
}, []);
|
|
64
|
+
useEffect(()=>{
|
|
65
|
+
registerDarkModeMethod(methods);
|
|
66
|
+
methods.registerMethod('toggleSiderOpen', ()=>{
|
|
67
|
+
const next = !openSiderState;
|
|
68
|
+
methods._toggleSiderOpen({
|
|
69
|
+
open: next
|
|
70
|
+
});
|
|
71
|
+
setSiderOpen(next);
|
|
72
|
+
writeSiderState({
|
|
73
|
+
properties,
|
|
74
|
+
open: next
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
methods.registerMethod('setSiderOpen', ({ open })=>{
|
|
78
|
+
methods._toggleSiderOpen({
|
|
79
|
+
open
|
|
80
|
+
});
|
|
81
|
+
setSiderOpen(open);
|
|
82
|
+
writeSiderState({
|
|
83
|
+
properties,
|
|
84
|
+
open
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
const layout = /*#__PURE__*/ React.createElement(Layout, {
|
|
89
|
+
blockId: blockId,
|
|
90
|
+
components: {
|
|
91
|
+
Icon,
|
|
92
|
+
Link,
|
|
93
|
+
ShortcutBadge
|
|
94
|
+
},
|
|
95
|
+
events: events,
|
|
96
|
+
properties: {
|
|
97
|
+
hasSider: true
|
|
98
|
+
},
|
|
99
|
+
styles: {
|
|
100
|
+
element: mergeObjects([
|
|
101
|
+
{
|
|
102
|
+
minHeight: '100vh'
|
|
103
|
+
},
|
|
104
|
+
styles.element
|
|
105
|
+
])
|
|
106
|
+
},
|
|
107
|
+
content: {
|
|
108
|
+
content: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Sider, {
|
|
109
|
+
blockId: `${blockId}_sider`,
|
|
110
|
+
components: {
|
|
111
|
+
Icon,
|
|
112
|
+
Link,
|
|
113
|
+
ShortcutBadge
|
|
114
|
+
},
|
|
115
|
+
events: events,
|
|
116
|
+
methods: methods,
|
|
117
|
+
properties: mergeObjects([
|
|
118
|
+
properties.sider,
|
|
119
|
+
{
|
|
120
|
+
initialCollapsed: !openSiderState
|
|
121
|
+
}
|
|
122
|
+
]),
|
|
123
|
+
classNames: {
|
|
124
|
+
element: `${classNames.sider ?? 'hidden lg:block'} hide-on-print`
|
|
125
|
+
},
|
|
126
|
+
styles: {
|
|
127
|
+
element: mergeObjects([
|
|
128
|
+
{
|
|
129
|
+
borderInlineEnd: '1px solid var(--ant-color-border)',
|
|
130
|
+
position: 'sticky',
|
|
131
|
+
top: 0,
|
|
132
|
+
height: '100vh',
|
|
133
|
+
alignSelf: 'flex-start'
|
|
134
|
+
},
|
|
135
|
+
styles.sider
|
|
136
|
+
])
|
|
137
|
+
},
|
|
138
|
+
rename: {
|
|
139
|
+
methods: {
|
|
140
|
+
toggleOpen: '_toggleSiderOpen',
|
|
141
|
+
setOpen: '_setSiderOpen'
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
content: {
|
|
145
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
146
|
+
style: {
|
|
147
|
+
display: 'flex',
|
|
148
|
+
height: '100%',
|
|
149
|
+
flexDirection: 'column'
|
|
150
|
+
}
|
|
151
|
+
}, !(get(properties, 'sider.hideToggleButton') ?? false) && /*#__PURE__*/ React.createElement(Button, {
|
|
152
|
+
blockId: `${blockId}_toggle_sider`,
|
|
153
|
+
components: {
|
|
154
|
+
Icon,
|
|
155
|
+
Link,
|
|
156
|
+
ShortcutBadge
|
|
157
|
+
},
|
|
158
|
+
classNames: {
|
|
159
|
+
element: classNames.toggleButton
|
|
160
|
+
},
|
|
161
|
+
events: events,
|
|
162
|
+
properties: {
|
|
163
|
+
hideTitle: true,
|
|
164
|
+
type: 'link',
|
|
165
|
+
block: true,
|
|
166
|
+
icon: {
|
|
167
|
+
name: openSiderState ? 'AiOutlineMenuFold' : 'AiOutlineMenuUnfold'
|
|
168
|
+
},
|
|
169
|
+
...properties.toggleSiderButton ?? {}
|
|
170
|
+
},
|
|
171
|
+
styles: {
|
|
172
|
+
element: styles.toggleButton
|
|
173
|
+
},
|
|
174
|
+
methods: methods,
|
|
175
|
+
onClick: ()=>{
|
|
176
|
+
methods.toggleSiderOpen();
|
|
177
|
+
// Providing onClick bypasses Button's default
|
|
178
|
+
// trigger-renamed-event path, so fire onToggleSider
|
|
179
|
+
// explicitly for the page-level event handler.
|
|
180
|
+
methods.triggerEvent({
|
|
181
|
+
name: 'onToggleSider'
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
rename: {
|
|
185
|
+
events: {
|
|
186
|
+
onClick: 'onToggleSider'
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}), /*#__PURE__*/ React.createElement(Menu, {
|
|
190
|
+
blockId: `${blockId}_menu`,
|
|
191
|
+
components: {
|
|
192
|
+
Icon,
|
|
193
|
+
Link,
|
|
194
|
+
ShortcutBadge
|
|
195
|
+
},
|
|
196
|
+
basePath: basePath,
|
|
197
|
+
classNames: {
|
|
198
|
+
element: classNames.menu ?? 'hidden lg:block'
|
|
199
|
+
},
|
|
200
|
+
events: events,
|
|
201
|
+
methods: methods,
|
|
202
|
+
menus: menus,
|
|
203
|
+
pageId: pageId,
|
|
204
|
+
properties: mergeObjects([
|
|
205
|
+
{
|
|
206
|
+
mode: 'inline',
|
|
207
|
+
collapsed: !openSiderState
|
|
208
|
+
},
|
|
209
|
+
properties.menu,
|
|
210
|
+
properties.menuLg
|
|
211
|
+
]),
|
|
212
|
+
styles: {
|
|
213
|
+
element: styles.menu
|
|
214
|
+
},
|
|
215
|
+
rename: {
|
|
216
|
+
events: {
|
|
217
|
+
onClick: 'onMenuItemClick',
|
|
218
|
+
onSelect: 'onMenuItemSelect',
|
|
219
|
+
onToggleMenuGroup: 'onToggleMenuGroup'
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}), openSiderState && content.siderOpen && /*#__PURE__*/ React.createElement("div", {
|
|
223
|
+
style: {
|
|
224
|
+
flex: '0 0 auto'
|
|
225
|
+
}
|
|
226
|
+
}, content.siderOpen()), !openSiderState && content.siderClosed && /*#__PURE__*/ React.createElement("div", {
|
|
227
|
+
style: {
|
|
228
|
+
flex: '0 0 auto'
|
|
229
|
+
}
|
|
230
|
+
}, content.siderClosed()), /*#__PURE__*/ React.createElement("div", {
|
|
231
|
+
style: {
|
|
232
|
+
flex: '1 0 auto'
|
|
233
|
+
}
|
|
234
|
+
}), /*#__PURE__*/ React.createElement("div", {
|
|
235
|
+
style: {
|
|
236
|
+
position: 'sticky',
|
|
237
|
+
bottom: 0,
|
|
238
|
+
background: 'linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--ant-color-bg-container) 85%, transparent) 32px, color-mix(in srgb, var(--ant-color-bg-container) 95%, transparent) 100%)',
|
|
239
|
+
padding: '40px 8px 8px',
|
|
240
|
+
display: 'flex',
|
|
241
|
+
flexDirection: 'column',
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
gap: 8
|
|
244
|
+
}
|
|
245
|
+
}, renderHeaderActions({
|
|
246
|
+
blockId,
|
|
247
|
+
classNames: {
|
|
248
|
+
...classNames,
|
|
249
|
+
headerActions: classNames.headerActions ?? (openSiderState ? 'flex flex-col items-stretch gap-1 w-full' : 'flex flex-col items-center gap-4 py-4')
|
|
250
|
+
},
|
|
251
|
+
styles,
|
|
252
|
+
properties,
|
|
253
|
+
methods,
|
|
254
|
+
events,
|
|
255
|
+
components: {
|
|
256
|
+
Icon,
|
|
257
|
+
Link,
|
|
258
|
+
ShortcutBadge
|
|
259
|
+
},
|
|
260
|
+
iconsColor: properties.iconsColor,
|
|
261
|
+
expanded: openSiderState
|
|
262
|
+
}), /*#__PURE__*/ React.createElement(Link, {
|
|
263
|
+
home: true
|
|
264
|
+
}, /*#__PURE__*/ React.createElement("img", {
|
|
265
|
+
src: openSiderState ? properties.logo?.src ?? `${basePath}/logo-${getDarkMode() ? 'dark' : 'light'}-theme.png` : properties.logo?.srcMobile ?? properties.logo?.src ?? `${basePath}/logo-square-${getDarkMode() ? 'dark' : 'light'}-theme.png`,
|
|
266
|
+
alt: properties.logo?.alt ?? 'Lowdefy',
|
|
267
|
+
className: classNames.logo,
|
|
268
|
+
style: mergeObjects([
|
|
269
|
+
{
|
|
270
|
+
maxHeight: 32
|
|
271
|
+
},
|
|
272
|
+
properties.logo?.style,
|
|
273
|
+
styles.logo
|
|
274
|
+
])
|
|
275
|
+
}))))
|
|
276
|
+
}
|
|
277
|
+
}), /*#__PURE__*/ React.createElement(Layout, {
|
|
278
|
+
blockId: `${blockId}_content_layout`,
|
|
279
|
+
components: {
|
|
280
|
+
Icon,
|
|
281
|
+
Link,
|
|
282
|
+
ShortcutBadge
|
|
283
|
+
},
|
|
284
|
+
events: events,
|
|
285
|
+
content: {
|
|
286
|
+
content: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
287
|
+
className: `${classNames.mobileHeader ?? 'block lg:hidden'} hide-on-print`
|
|
288
|
+
}, /*#__PURE__*/ React.createElement(Header, {
|
|
289
|
+
blockId: `${blockId}_mobile_header`,
|
|
290
|
+
components: {
|
|
291
|
+
Icon,
|
|
292
|
+
Link,
|
|
293
|
+
ShortcutBadge
|
|
294
|
+
},
|
|
295
|
+
events: events,
|
|
296
|
+
properties: {},
|
|
297
|
+
styles: {
|
|
298
|
+
element: mergeObjects([
|
|
299
|
+
{
|
|
300
|
+
alignItems: 'center'
|
|
301
|
+
},
|
|
302
|
+
styles.mobileHeader
|
|
303
|
+
])
|
|
304
|
+
},
|
|
305
|
+
content: {
|
|
306
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
307
|
+
style: {
|
|
308
|
+
display: 'flex',
|
|
309
|
+
alignItems: 'center',
|
|
310
|
+
width: '100%'
|
|
311
|
+
}
|
|
312
|
+
}, /*#__PURE__*/ React.createElement(Link, {
|
|
313
|
+
home: true
|
|
314
|
+
}, /*#__PURE__*/ React.createElement("img", {
|
|
315
|
+
src: properties.logo?.srcMobile ?? properties.logo?.src ?? `${basePath}/logo-square-${getDarkMode() ? 'dark' : 'light'}-theme.png`,
|
|
316
|
+
alt: properties.logo?.alt ?? 'Lowdefy',
|
|
317
|
+
className: classNames.logo,
|
|
318
|
+
style: mergeObjects([
|
|
319
|
+
{
|
|
320
|
+
width: 32,
|
|
321
|
+
marginRight: 12
|
|
322
|
+
},
|
|
323
|
+
properties.logo?.style,
|
|
324
|
+
styles.logo
|
|
325
|
+
])
|
|
326
|
+
})), /*#__PURE__*/ React.createElement("div", {
|
|
327
|
+
style: {
|
|
328
|
+
flex: '1 0 auto'
|
|
329
|
+
}
|
|
330
|
+
}, content.mobileExtra && content.mobileExtra()), renderHeaderActions({
|
|
331
|
+
blockId,
|
|
332
|
+
classNames,
|
|
333
|
+
styles,
|
|
334
|
+
properties,
|
|
335
|
+
methods,
|
|
336
|
+
events,
|
|
337
|
+
components: {
|
|
338
|
+
Icon,
|
|
339
|
+
Link,
|
|
340
|
+
ShortcutBadge
|
|
341
|
+
},
|
|
342
|
+
iconsColor: properties.iconsColor
|
|
343
|
+
}), /*#__PURE__*/ React.createElement(MobileMenu, {
|
|
344
|
+
classNames: {
|
|
345
|
+
element: classNames.mobileMenu ?? 'flex lg:hidden shrink pl-4'
|
|
346
|
+
},
|
|
347
|
+
styles: {
|
|
348
|
+
element: styles.mobileMenu
|
|
349
|
+
},
|
|
350
|
+
blockId: `${blockId}_mobile_menu`,
|
|
351
|
+
components: {
|
|
352
|
+
Icon,
|
|
353
|
+
Link,
|
|
354
|
+
ShortcutBadge
|
|
355
|
+
},
|
|
356
|
+
basePath: basePath,
|
|
357
|
+
events: events,
|
|
358
|
+
methods: methods,
|
|
359
|
+
menus: menus,
|
|
360
|
+
pageId: pageId,
|
|
361
|
+
properties: mergeObjects([
|
|
362
|
+
{
|
|
363
|
+
mode: 'inline',
|
|
364
|
+
logo: properties.logo,
|
|
365
|
+
drawer: {
|
|
366
|
+
width: '100%',
|
|
367
|
+
placement: 'right'
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
properties.menu,
|
|
371
|
+
properties.menuMd
|
|
372
|
+
]),
|
|
373
|
+
content: {
|
|
374
|
+
drawerContent: content.mobileDrawerContent,
|
|
375
|
+
drawerFooter: content.mobileDrawerFooter
|
|
376
|
+
},
|
|
377
|
+
rename: {
|
|
378
|
+
methods: {
|
|
379
|
+
toggleOpen: 'toggleMobileMenuOpen',
|
|
380
|
+
setOpen: 'setMobileMenuOpen'
|
|
381
|
+
},
|
|
382
|
+
events: {
|
|
383
|
+
onClose: 'onMobileMenuClose',
|
|
384
|
+
onOpen: 'onMobileMenuOpen'
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}))
|
|
388
|
+
}
|
|
389
|
+
})), content.header && /*#__PURE__*/ React.createElement(Header, {
|
|
390
|
+
blockId: `${blockId}_header`,
|
|
391
|
+
components: {
|
|
392
|
+
Icon,
|
|
393
|
+
Link,
|
|
394
|
+
ShortcutBadge
|
|
395
|
+
},
|
|
396
|
+
classNames: {
|
|
397
|
+
element: `${classNames.header ?? ''} hide-on-print`
|
|
398
|
+
},
|
|
399
|
+
events: events,
|
|
400
|
+
properties: properties.header ?? {},
|
|
401
|
+
styles: {
|
|
402
|
+
element: mergeObjects([
|
|
403
|
+
{
|
|
404
|
+
display: 'flex',
|
|
405
|
+
alignItems: 'center'
|
|
406
|
+
},
|
|
407
|
+
styles.header
|
|
408
|
+
])
|
|
409
|
+
},
|
|
410
|
+
content: {
|
|
411
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
412
|
+
style: mergeObjects([
|
|
413
|
+
{
|
|
414
|
+
display: 'flex',
|
|
415
|
+
flex: '1 0 auto',
|
|
416
|
+
alignItems: 'center'
|
|
417
|
+
},
|
|
418
|
+
properties.header?.contentStyle
|
|
419
|
+
])
|
|
420
|
+
}, content.header())
|
|
421
|
+
}
|
|
422
|
+
}), /*#__PURE__*/ React.createElement(Content, {
|
|
423
|
+
blockId: `${blockId}_content`,
|
|
424
|
+
components: {
|
|
425
|
+
Icon,
|
|
426
|
+
Link,
|
|
427
|
+
ShortcutBadge
|
|
428
|
+
},
|
|
429
|
+
classNames: {
|
|
430
|
+
element: classNames.content
|
|
431
|
+
},
|
|
432
|
+
events: events,
|
|
433
|
+
properties: properties.content ?? {},
|
|
434
|
+
styles: {
|
|
435
|
+
element: mergeObjects([
|
|
436
|
+
{
|
|
437
|
+
padding: '0 40px 40px 40px',
|
|
438
|
+
minWidth: 0
|
|
439
|
+
},
|
|
440
|
+
styles.content
|
|
441
|
+
])
|
|
442
|
+
},
|
|
443
|
+
content: {
|
|
444
|
+
content: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, !type.isNone(properties.breadcrumb) ? /*#__PURE__*/ React.createElement(Breadcrumb, {
|
|
445
|
+
blockId: `${blockId}_breadcrumb`,
|
|
446
|
+
basePath: basePath,
|
|
447
|
+
components: {
|
|
448
|
+
Icon,
|
|
449
|
+
Link,
|
|
450
|
+
ShortcutBadge
|
|
451
|
+
},
|
|
452
|
+
classNames: {
|
|
453
|
+
element: classNames.breadcrumb
|
|
454
|
+
},
|
|
455
|
+
events: events,
|
|
456
|
+
methods: methods,
|
|
457
|
+
properties: properties.breadcrumb,
|
|
458
|
+
styles: {
|
|
459
|
+
element: mergeObjects([
|
|
460
|
+
{
|
|
461
|
+
margin: '16px 0'
|
|
462
|
+
},
|
|
463
|
+
styles.breadcrumb
|
|
464
|
+
])
|
|
465
|
+
},
|
|
466
|
+
rename: {
|
|
467
|
+
events: {
|
|
468
|
+
onClick: 'onBreadcrumbClick'
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}) : /*#__PURE__*/ React.createElement("div", {
|
|
472
|
+
className: "py-1.5 sm:py-1.5 md:py-2.5 lg:py-5"
|
|
473
|
+
}), content.content && content.content())
|
|
474
|
+
}
|
|
475
|
+
}), content.footer && /*#__PURE__*/ React.createElement(Footer, {
|
|
476
|
+
blockId: `${blockId}_footer`,
|
|
477
|
+
components: {
|
|
478
|
+
Icon,
|
|
479
|
+
Link,
|
|
480
|
+
ShortcutBadge
|
|
481
|
+
},
|
|
482
|
+
classNames: {
|
|
483
|
+
element: classNames.footer
|
|
484
|
+
},
|
|
485
|
+
events: events,
|
|
486
|
+
properties: properties.footer,
|
|
487
|
+
styles: {
|
|
488
|
+
element: mergeObjects([
|
|
489
|
+
properties.footer?.style,
|
|
490
|
+
styles.footer
|
|
491
|
+
])
|
|
492
|
+
},
|
|
493
|
+
content: {
|
|
494
|
+
content: ()=>content.footer()
|
|
495
|
+
}
|
|
496
|
+
}))
|
|
497
|
+
}
|
|
498
|
+
}))
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
return layout;
|
|
502
|
+
};
|
|
503
|
+
function PageSidebarLayoutWithTheme(props) {
|
|
504
|
+
const { theme, ...restProperties } = props.properties;
|
|
505
|
+
if (!type.isObject(theme)) {
|
|
506
|
+
return /*#__PURE__*/ React.createElement(PageSidebarLayout, props);
|
|
507
|
+
}
|
|
508
|
+
return /*#__PURE__*/ React.createElement(ConfigProvider, {
|
|
509
|
+
theme: {
|
|
510
|
+
token: theme
|
|
511
|
+
}
|
|
512
|
+
}, /*#__PURE__*/ React.createElement(PageSidebarLayout, {
|
|
513
|
+
...props,
|
|
514
|
+
properties: restProperties
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
export default withBlockDefaults(PageSidebarLayoutWithTheme);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { createBlockHelper, escapeId } from '@lowdefy/e2e-utils';
|
|
16
|
+
import { expect } from '@playwright/test';
|
|
17
|
+
const locator = (page, blockId)=>page.locator(`#bl-${escapeId(blockId)}`);
|
|
18
|
+
export default createBlockHelper({
|
|
19
|
+
locator,
|
|
20
|
+
do: {
|
|
21
|
+
clickMenuItem: (page, blockId, text)=>locator(page, blockId).locator('.ant-menu-item').filter({
|
|
22
|
+
hasText: text
|
|
23
|
+
}).click(),
|
|
24
|
+
clickLogo: (page, blockId)=>locator(page, blockId).locator('img').first().click()
|
|
25
|
+
},
|
|
26
|
+
expect: {
|
|
27
|
+
menuItemActive: (page, blockId, text)=>expect(locator(page, blockId).locator('.ant-menu-item-selected').filter({
|
|
28
|
+
hasText: text
|
|
29
|
+
})).toBeVisible(),
|
|
30
|
+
menuItemVisible: (page, blockId, text)=>expect(locator(page, blockId).locator('.ant-menu-item').filter({
|
|
31
|
+
hasText: text
|
|
32
|
+
})).toBeVisible()
|
|
33
|
+
}
|
|
34
|
+
});
|