@eeacms/volto-tabs-block 6.0.3 → 7.0.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/CHANGELOG.md +81 -3
- package/README.md +17 -0
- package/locales/de/LC_MESSAGES/volto.po +76 -29
- package/locales/en/LC_MESSAGES/volto.po +76 -29
- package/locales/es/LC_MESSAGES/volto.po +77 -30
- package/locales/it/LC_MESSAGES/volto.po +76 -29
- package/locales/pt_BR/LC_MESSAGES/volto.po +77 -30
- package/locales/ro/LC_MESSAGES/volto.po +76 -29
- package/locales/volto.pot +77 -30
- package/package.json +1 -1
- package/src/components/Edit.jsx +119 -102
- package/src/components/View.jsx +6 -4
- package/src/components/index.js +1 -0
- package/src/components/layoutSchema.js +3 -1
- package/src/components/schema.js +169 -70
- package/src/components/templates/accordion/Edit.jsx +28 -199
- package/src/components/templates/accordion/View.jsx +42 -64
- package/src/components/templates/accordion/index.js +1 -2
- package/src/components/templates/accordion/schema.js +33 -40
- package/src/components/templates/carousel/HorizontalView.jsx +3 -0
- package/src/components/templates/carousel/VerticalView.jsx +3 -0
- package/src/components/templates/carousel/index.js +1 -2
- package/src/components/templates/carousel/schema.js +19 -25
- package/src/components/templates/default/Edit.jsx +90 -50
- package/src/components/templates/default/View.jsx +112 -43
- package/src/components/templates/default/index.js +2 -2
- package/src/components/templates/default/schema.js +69 -77
- package/src/components/templates/horizontal-responsive/Edit.jsx +63 -46
- package/src/components/templates/horizontal-responsive/View.jsx +33 -37
- package/src/components/templates/horizontal-responsive/index.js +1 -6
- package/src/components/templates/horizontal-responsive/schema.js +6 -5
- package/src/helpers.js +14 -10
- package/src/helpers.test.js +14 -8
- package/src/index.js +34 -22
- package/src/less/carousel.less +9 -0
- package/src/less/edit.less +26 -0
- package/src/less/menu.less +118 -4
- package/src/less/menu.variables +16 -0
- package/src/less/tabs.less +53 -23
- package/src/less/tabs.variables +3 -0
- package/src/widgets/TabsWidget.jsx +158 -68
|
@@ -179,125 +179,117 @@ const messages = defineMessages({
|
|
|
179
179
|
},
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
export
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
'menuStackable',
|
|
205
|
-
'menuTabular',
|
|
206
|
-
'menuText',
|
|
207
|
-
],
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
properties: {
|
|
182
|
+
export const defaultSchemaEnhancer = ({ schema, intl }) => {
|
|
183
|
+
schema.fieldsets.splice(1, 0, {
|
|
184
|
+
id: 'menu',
|
|
185
|
+
title: intl.formatMessage(messages.Menu),
|
|
186
|
+
fields: [
|
|
187
|
+
'menuAlign',
|
|
188
|
+
'menuPosition',
|
|
189
|
+
'menuSize',
|
|
190
|
+
'menuColor',
|
|
191
|
+
'menuBorderless',
|
|
192
|
+
'menuCompact',
|
|
193
|
+
'menuFluid',
|
|
194
|
+
'menuInverted',
|
|
195
|
+
'menuPointing',
|
|
196
|
+
'menuSecondary',
|
|
197
|
+
'menuStackable',
|
|
198
|
+
'menuTabular',
|
|
199
|
+
'menuText',
|
|
200
|
+
],
|
|
201
|
+
});
|
|
202
|
+
schema.properties = {
|
|
203
|
+
...schema.properties,
|
|
211
204
|
description: {
|
|
212
|
-
title:
|
|
205
|
+
title: intl.formatMessage(messages.Description),
|
|
213
206
|
},
|
|
214
207
|
menuPosition: {
|
|
215
|
-
title:
|
|
208
|
+
title: intl.formatMessage(messages.Position),
|
|
216
209
|
choices: [
|
|
217
|
-
['top',
|
|
218
|
-
['bottom',
|
|
219
|
-
['left side',
|
|
220
|
-
['right side',
|
|
210
|
+
['top', intl.formatMessage(messages.Top)],
|
|
211
|
+
['bottom', intl.formatMessage(messages.Bottom)],
|
|
212
|
+
['left side', intl.formatMessage(messages.LeftSide)],
|
|
213
|
+
['right side', intl.formatMessage(messages.RightSide)],
|
|
221
214
|
],
|
|
222
215
|
},
|
|
223
216
|
menuAlign: {
|
|
224
|
-
title:
|
|
217
|
+
title: intl.formatMessage(messages.Alignment),
|
|
225
218
|
choices: [
|
|
226
|
-
['left',
|
|
227
|
-
['center',
|
|
228
|
-
['right',
|
|
229
|
-
['space-between',
|
|
219
|
+
['left', intl.formatMessage(messages.Left)],
|
|
220
|
+
['center', intl.formatMessage(messages.Center)],
|
|
221
|
+
['right', intl.formatMessage(messages.Right)],
|
|
222
|
+
['space-between', intl.formatMessage(messages.SpaceBetween)],
|
|
230
223
|
],
|
|
231
224
|
},
|
|
232
225
|
menuSize: {
|
|
233
|
-
title:
|
|
226
|
+
title: intl.formatMessage(messages.Size),
|
|
234
227
|
choices: [
|
|
235
|
-
['mini',
|
|
236
|
-
['tiny',
|
|
237
|
-
['small',
|
|
238
|
-
['large',
|
|
239
|
-
['huge',
|
|
240
|
-
['massive',
|
|
228
|
+
['mini', intl.formatMessage(messages.Mini)],
|
|
229
|
+
['tiny', intl.formatMessage(messages.Tiny)],
|
|
230
|
+
['small', intl.formatMessage(messages.Small)],
|
|
231
|
+
['large', intl.formatMessage(messages.Large)],
|
|
232
|
+
['huge', intl.formatMessage(messages.Huge)],
|
|
233
|
+
['massive', intl.formatMessage(messages.Massive)],
|
|
241
234
|
],
|
|
242
235
|
},
|
|
243
236
|
menuColor: {
|
|
244
|
-
title:
|
|
245
|
-
defaultValue: 'green',
|
|
237
|
+
title: intl.formatMessage(messages.Color),
|
|
246
238
|
choices: [
|
|
247
|
-
['red',
|
|
248
|
-
['orange',
|
|
249
|
-
['yellow',
|
|
250
|
-
['olive',
|
|
251
|
-
['green',
|
|
252
|
-
['teal',
|
|
253
|
-
['blue',
|
|
254
|
-
['violet',
|
|
255
|
-
['purple',
|
|
256
|
-
['pink',
|
|
257
|
-
['brown',
|
|
258
|
-
['grey',
|
|
259
|
-
['black',
|
|
239
|
+
['red', intl.formatMessage(messages.Red)],
|
|
240
|
+
['orange', intl.formatMessage(messages.Orange)],
|
|
241
|
+
['yellow', intl.formatMessage(messages.Yellow)],
|
|
242
|
+
['olive', intl.formatMessage(messages.Olive)],
|
|
243
|
+
['green', intl.formatMessage(messages.Green)],
|
|
244
|
+
['teal', intl.formatMessage(messages.Teal)],
|
|
245
|
+
['blue', intl.formatMessage(messages.Blue)],
|
|
246
|
+
['violet', intl.formatMessage(messages.Violet)],
|
|
247
|
+
['purple', intl.formatMessage(messages.Purple)],
|
|
248
|
+
['pink', intl.formatMessage(messages.Pink)],
|
|
249
|
+
['brown', intl.formatMessage(messages.Brown)],
|
|
250
|
+
['grey', intl.formatMessage(messages.Grey)],
|
|
251
|
+
['black', intl.formatMessage(messages.Black)],
|
|
260
252
|
],
|
|
261
253
|
},
|
|
262
254
|
menuBorderless: {
|
|
263
|
-
title:
|
|
255
|
+
title: intl.formatMessage(messages.MenuBorderless),
|
|
264
256
|
type: 'boolean',
|
|
265
257
|
},
|
|
266
258
|
menuCompact: {
|
|
267
|
-
title:
|
|
259
|
+
title: intl.formatMessage(messages.MenuCompact),
|
|
268
260
|
type: 'boolean',
|
|
269
|
-
defaultValue: true,
|
|
270
261
|
},
|
|
271
262
|
menuFluid: {
|
|
272
|
-
title:
|
|
263
|
+
title: intl.formatMessage(messages.MenuFluid),
|
|
273
264
|
type: 'boolean',
|
|
274
|
-
|
|
265
|
+
default: true,
|
|
275
266
|
},
|
|
276
267
|
menuInverted: {
|
|
277
|
-
title:
|
|
268
|
+
title: intl.formatMessage(messages.MenuInverted),
|
|
278
269
|
type: 'boolean',
|
|
279
270
|
},
|
|
280
271
|
menuPointing: {
|
|
281
|
-
title:
|
|
272
|
+
title: intl.formatMessage(messages.MenuPointing),
|
|
282
273
|
type: 'boolean',
|
|
274
|
+
default: true,
|
|
283
275
|
},
|
|
284
276
|
menuSecondary: {
|
|
285
|
-
title:
|
|
277
|
+
title: intl.formatMessage(messages.MenuSecondary),
|
|
286
278
|
type: 'boolean',
|
|
279
|
+
default: true,
|
|
287
280
|
},
|
|
288
281
|
menuStackable: {
|
|
289
|
-
title:
|
|
282
|
+
title: intl.formatMessage(messages.MenuStackable),
|
|
290
283
|
type: 'boolean',
|
|
291
284
|
},
|
|
292
285
|
menuTabular: {
|
|
293
|
-
title:
|
|
286
|
+
title: intl.formatMessage(messages.MenuTabular),
|
|
294
287
|
type: 'boolean',
|
|
295
288
|
},
|
|
296
289
|
menuText: {
|
|
297
|
-
title:
|
|
290
|
+
title: intl.formatMessage(messages.MenuText),
|
|
298
291
|
type: 'boolean',
|
|
299
|
-
defaultValue: true,
|
|
300
292
|
},
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
}
|
|
293
|
+
};
|
|
294
|
+
return schema;
|
|
295
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
3
|
import { compose } from 'redux';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
4
5
|
import { withRouter } from 'react-router';
|
|
5
6
|
import { v4 as uuid } from 'uuid';
|
|
6
7
|
import { isEmpty } from 'lodash';
|
|
7
8
|
import cx from 'classnames';
|
|
8
9
|
import { Menu, Tab, Container, Dropdown, Input } from 'semantic-ui-react';
|
|
9
|
-
import config from '@plone/volto/registry';
|
|
10
10
|
import { emptyBlocksForm } from '@plone/volto/helpers';
|
|
11
11
|
import { BlocksForm } from '@plone/volto/components';
|
|
12
12
|
import EditBlockWrapper from '@eeacms/volto-tabs-block/components/EditBlockWrapper';
|
|
13
|
-
import {
|
|
13
|
+
import { defaultSchemaEnhancer } from '@eeacms/volto-tabs-block/components/templates/default/schema';
|
|
14
14
|
import {
|
|
15
15
|
SimpleMarkdown,
|
|
16
16
|
getMenuPosition,
|
|
@@ -23,7 +23,9 @@ import '@eeacms/volto-tabs-block/less/menu.less';
|
|
|
23
23
|
import noop from 'lodash/noop';
|
|
24
24
|
const MenuItem = (props) => {
|
|
25
25
|
const inputRef = React.useRef(null);
|
|
26
|
+
const intl = useIntl();
|
|
26
27
|
const {
|
|
28
|
+
schema,
|
|
27
29
|
activeTab = null,
|
|
28
30
|
activeBlock = null,
|
|
29
31
|
block = null,
|
|
@@ -36,7 +38,7 @@ const MenuItem = (props) => {
|
|
|
36
38
|
tabsDescription,
|
|
37
39
|
tabsList = [],
|
|
38
40
|
tabsTitle,
|
|
39
|
-
emptyTab =
|
|
41
|
+
emptyTab = () => {},
|
|
40
42
|
setActiveBlock = noop,
|
|
41
43
|
setActiveTab = noop,
|
|
42
44
|
setEditingTab = noop,
|
|
@@ -57,7 +59,10 @@ const MenuItem = (props) => {
|
|
|
57
59
|
blocks: {
|
|
58
60
|
...tabsData.blocks,
|
|
59
61
|
[tabId]: {
|
|
60
|
-
...emptyTab(
|
|
62
|
+
...emptyTab({
|
|
63
|
+
schema: schema.properties.data.schema,
|
|
64
|
+
intl,
|
|
65
|
+
}),
|
|
61
66
|
},
|
|
62
67
|
},
|
|
63
68
|
blocks_layout: {
|
|
@@ -157,6 +162,7 @@ const MenuItem = (props) => {
|
|
|
157
162
|
};
|
|
158
163
|
|
|
159
164
|
const MenuWrapper = (props) => {
|
|
165
|
+
const intl = useIntl();
|
|
160
166
|
const {
|
|
161
167
|
data = {},
|
|
162
168
|
panes = [],
|
|
@@ -166,11 +172,12 @@ const MenuWrapper = (props) => {
|
|
|
166
172
|
tabs = {},
|
|
167
173
|
tabsList = [],
|
|
168
174
|
block = null,
|
|
169
|
-
emptyTab =
|
|
175
|
+
emptyTab = () => {},
|
|
170
176
|
setEditingTab = noop,
|
|
171
177
|
tabsData = {},
|
|
172
178
|
onChangeBlock = noop,
|
|
173
179
|
setActiveTab = noop,
|
|
180
|
+
schema,
|
|
174
181
|
} = props;
|
|
175
182
|
const [open, setOpen] = React.useState(false);
|
|
176
183
|
const addNewTab = () => {
|
|
@@ -183,7 +190,10 @@ const MenuWrapper = (props) => {
|
|
|
183
190
|
blocks: {
|
|
184
191
|
...tabsData.blocks,
|
|
185
192
|
[tabId]: {
|
|
186
|
-
...emptyTab(
|
|
193
|
+
...emptyTab({
|
|
194
|
+
schema: schema.properties.data.schema,
|
|
195
|
+
intl,
|
|
196
|
+
}),
|
|
187
197
|
},
|
|
188
198
|
},
|
|
189
199
|
blocks_layout: {
|
|
@@ -193,7 +203,7 @@ const MenuWrapper = (props) => {
|
|
|
193
203
|
});
|
|
194
204
|
};
|
|
195
205
|
React.useEffect(() => {
|
|
196
|
-
if (
|
|
206
|
+
if (!node?.current) return;
|
|
197
207
|
const items = node.current.querySelectorAll(
|
|
198
208
|
'.ui.menu > .menu-wrapper > .item:not(.menu-title)',
|
|
199
209
|
);
|
|
@@ -271,6 +281,7 @@ const MenuWrapper = (props) => {
|
|
|
271
281
|
};
|
|
272
282
|
|
|
273
283
|
const Edit = (props) => {
|
|
284
|
+
const intl = useIntl();
|
|
274
285
|
const {
|
|
275
286
|
metadata = {},
|
|
276
287
|
data = {},
|
|
@@ -285,34 +296,33 @@ const Edit = (props) => {
|
|
|
285
296
|
multiSelected = [],
|
|
286
297
|
screen,
|
|
287
298
|
tabsData = {},
|
|
288
|
-
emptyTab =
|
|
299
|
+
emptyTab = () => {},
|
|
289
300
|
onChangeBlock = noop,
|
|
290
301
|
onChangeTabData = noop,
|
|
291
302
|
onSelectBlock = noop,
|
|
292
303
|
setEditingTab = noop,
|
|
304
|
+
schema,
|
|
293
305
|
} = props;
|
|
294
306
|
const menuPosition = getMenuPosition(data);
|
|
295
|
-
const isContainer = data.align === 'full';
|
|
296
|
-
const tabsTitle = data.title;
|
|
297
|
-
const tabsDescription = data.description;
|
|
298
|
-
const schema = React.useMemo(
|
|
299
|
-
() =>
|
|
300
|
-
config.blocks.blocksConfig[TABS_BLOCK].templates?.['default']?.schema(
|
|
301
|
-
config,
|
|
302
|
-
props,
|
|
303
|
-
) || {},
|
|
304
|
-
[props],
|
|
305
|
-
);
|
|
306
307
|
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
308
|
+
const {
|
|
309
|
+
title,
|
|
310
|
+
description,
|
|
311
|
+
align,
|
|
312
|
+
menuBorderless,
|
|
313
|
+
menuColor,
|
|
314
|
+
menuCompact,
|
|
315
|
+
menuFluid,
|
|
316
|
+
menuInverted,
|
|
317
|
+
menuPointing,
|
|
318
|
+
menuSecondary,
|
|
319
|
+
menuSize,
|
|
320
|
+
menuStackable,
|
|
321
|
+
menuTabular,
|
|
322
|
+
menuText,
|
|
323
|
+
menuAlign,
|
|
324
|
+
} = data;
|
|
325
|
+
const isContainer = align === 'full';
|
|
316
326
|
|
|
317
327
|
const panes = tabsList.map((tab, index) => {
|
|
318
328
|
return {
|
|
@@ -326,8 +336,9 @@ const Edit = (props) => {
|
|
|
326
336
|
blockId={props.id}
|
|
327
337
|
index={index}
|
|
328
338
|
lastIndex={tabsList.length - 1}
|
|
329
|
-
tabsTitle={
|
|
330
|
-
tabsDescription={
|
|
339
|
+
tabsTitle={title}
|
|
340
|
+
tabsDescription={description}
|
|
341
|
+
schema={schema}
|
|
331
342
|
/>
|
|
332
343
|
),
|
|
333
344
|
pane: (
|
|
@@ -335,7 +346,7 @@ const Edit = (props) => {
|
|
|
335
346
|
<div tabIndex={0} role="tabpanel" id={'tab-pane-' + tab}>
|
|
336
347
|
<BlocksForm
|
|
337
348
|
allowedBlocks={data?.allowedBlocks}
|
|
338
|
-
description={data?.
|
|
349
|
+
description={data?.instructions?.data}
|
|
339
350
|
manage={manage}
|
|
340
351
|
metadata={metadata}
|
|
341
352
|
pathname={props.pathname}
|
|
@@ -358,7 +369,10 @@ const Edit = (props) => {
|
|
|
358
369
|
[activeTab]: {
|
|
359
370
|
...(newFormData.blocks_layout.items.length > 0
|
|
360
371
|
? newFormData
|
|
361
|
-
: emptyTab(
|
|
372
|
+
: emptyTab({
|
|
373
|
+
schema: schema.properties.data.schema,
|
|
374
|
+
intl,
|
|
375
|
+
})),
|
|
362
376
|
},
|
|
363
377
|
},
|
|
364
378
|
},
|
|
@@ -402,19 +416,19 @@ const Edit = (props) => {
|
|
|
402
416
|
renderActiveOnly={false}
|
|
403
417
|
menu={{
|
|
404
418
|
attached: menuPosition.attached,
|
|
405
|
-
borderless:
|
|
406
|
-
color:
|
|
407
|
-
compact:
|
|
408
|
-
fluid:
|
|
409
|
-
inverted:
|
|
410
|
-
pointing:
|
|
411
|
-
secondary:
|
|
412
|
-
size:
|
|
413
|
-
stackable:
|
|
414
|
-
tabular:
|
|
415
|
-
text:
|
|
419
|
+
borderless: menuBorderless,
|
|
420
|
+
color: menuColor,
|
|
421
|
+
compact: menuCompact,
|
|
422
|
+
fluid: menuFluid,
|
|
423
|
+
inverted: menuInverted,
|
|
424
|
+
pointing: menuPointing,
|
|
425
|
+
secondary: menuSecondary,
|
|
426
|
+
size: menuSize,
|
|
427
|
+
stackable: menuStackable,
|
|
428
|
+
tabular: menuTabular,
|
|
429
|
+
text: menuText,
|
|
416
430
|
vertical: menuPosition.vertical,
|
|
417
|
-
className: cx(
|
|
431
|
+
className: cx(menuAlign, { container: isContainer }),
|
|
418
432
|
children: (
|
|
419
433
|
<MenuWrapper
|
|
420
434
|
{...props}
|
|
@@ -424,8 +438,9 @@ const Edit = (props) => {
|
|
|
424
438
|
tabsList={tabsList}
|
|
425
439
|
blockId={props.id}
|
|
426
440
|
lastIndex={tabsList.length - 1}
|
|
427
|
-
tabsTitle={
|
|
428
|
-
tabsDescription={
|
|
441
|
+
tabsTitle={title}
|
|
442
|
+
tabsDescription={description}
|
|
443
|
+
schema={schema}
|
|
429
444
|
/>
|
|
430
445
|
),
|
|
431
446
|
}}
|
|
@@ -437,6 +452,8 @@ const Edit = (props) => {
|
|
|
437
452
|
);
|
|
438
453
|
};
|
|
439
454
|
|
|
455
|
+
Edit.schemaEnhancer = defaultSchemaEnhancer;
|
|
456
|
+
|
|
440
457
|
export default compose(
|
|
441
458
|
connect((state) => {
|
|
442
459
|
return {
|
|
@@ -4,9 +4,7 @@ import { compose } from 'redux';
|
|
|
4
4
|
import { withRouter } from 'react-router';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { Menu, Tab, Container, Dropdown, Button } from 'semantic-ui-react';
|
|
7
|
-
import config from '@plone/volto/registry';
|
|
8
7
|
import { RenderBlocks } from '@plone/volto/components';
|
|
9
|
-
import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
|
|
10
8
|
import {
|
|
11
9
|
SimpleMarkdown,
|
|
12
10
|
getMenuPosition,
|
|
@@ -110,7 +108,7 @@ const MenuWrapper = (props) => {
|
|
|
110
108
|
const [open, setOpen] = React.useState(false);
|
|
111
109
|
|
|
112
110
|
React.useEffect(() => {
|
|
113
|
-
if (
|
|
111
|
+
if (!node?.current) return;
|
|
114
112
|
const items = node.current.querySelectorAll(
|
|
115
113
|
'.ui.menu > .menu-wrapper > .item:not(.menu-title)',
|
|
116
114
|
);
|
|
@@ -191,27 +189,25 @@ const View = (props) => {
|
|
|
191
189
|
screen,
|
|
192
190
|
} = props;
|
|
193
191
|
const menuPosition = getMenuPosition(data);
|
|
194
|
-
const isContainer = data.align === 'full';
|
|
195
|
-
const tabsTitle = data.title;
|
|
196
|
-
const tabsDescription = data.description;
|
|
197
|
-
const schema = React.useMemo(
|
|
198
|
-
() =>
|
|
199
|
-
config.blocks.blocksConfig[TABS_BLOCK].templates?.['default']?.schema(
|
|
200
|
-
config,
|
|
201
|
-
props,
|
|
202
|
-
) || {},
|
|
203
|
-
[props],
|
|
204
|
-
);
|
|
205
192
|
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
193
|
+
const {
|
|
194
|
+
title,
|
|
195
|
+
description,
|
|
196
|
+
align,
|
|
197
|
+
menuBorderless,
|
|
198
|
+
menuColor,
|
|
199
|
+
menuCompact,
|
|
200
|
+
menuFluid,
|
|
201
|
+
menuInverted,
|
|
202
|
+
menuPointing,
|
|
203
|
+
menuSecondary,
|
|
204
|
+
menuSize,
|
|
205
|
+
menuStackable,
|
|
206
|
+
menuTabular,
|
|
207
|
+
menuText,
|
|
208
|
+
menuAlign,
|
|
209
|
+
} = data;
|
|
210
|
+
const isContainer = align === 'full';
|
|
215
211
|
|
|
216
212
|
const panes = tabsList.map((tab, index) => {
|
|
217
213
|
return {
|
|
@@ -225,8 +221,8 @@ const View = (props) => {
|
|
|
225
221
|
blockId={props.id}
|
|
226
222
|
index={index}
|
|
227
223
|
lastIndex={tabsList.length - 1}
|
|
228
|
-
tabsTitle={
|
|
229
|
-
tabsDescription={
|
|
224
|
+
tabsTitle={title}
|
|
225
|
+
tabsDescription={description}
|
|
230
226
|
/>
|
|
231
227
|
),
|
|
232
228
|
pane: (
|
|
@@ -256,19 +252,19 @@ const View = (props) => {
|
|
|
256
252
|
renderActiveOnly={false}
|
|
257
253
|
menu={{
|
|
258
254
|
attached: menuPosition.attached,
|
|
259
|
-
borderless:
|
|
260
|
-
color:
|
|
261
|
-
compact:
|
|
262
|
-
fluid:
|
|
263
|
-
inverted:
|
|
264
|
-
pointing:
|
|
265
|
-
secondary:
|
|
266
|
-
size:
|
|
267
|
-
stackable:
|
|
268
|
-
tabular:
|
|
269
|
-
text:
|
|
255
|
+
borderless: menuBorderless,
|
|
256
|
+
color: menuColor,
|
|
257
|
+
compact: menuCompact,
|
|
258
|
+
fluid: menuFluid,
|
|
259
|
+
inverted: menuInverted,
|
|
260
|
+
pointing: menuPointing,
|
|
261
|
+
secondary: menuSecondary,
|
|
262
|
+
size: menuSize,
|
|
263
|
+
stackable: menuStackable,
|
|
264
|
+
tabular: menuTabular,
|
|
265
|
+
text: menuText,
|
|
270
266
|
vertical: menuPosition.vertical,
|
|
271
|
-
className: cx(
|
|
267
|
+
className: cx(menuAlign, { container: isContainer }),
|
|
272
268
|
children: (
|
|
273
269
|
<MenuWrapper
|
|
274
270
|
{...props}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import HorizontalResponsiveView from './View';
|
|
2
|
-
import horizontalResponsiveSchema from './schema';
|
|
3
2
|
import HorizontalResponsiveEdit from './Edit';
|
|
4
|
-
export {
|
|
5
|
-
HorizontalResponsiveEdit,
|
|
6
|
-
HorizontalResponsiveView,
|
|
7
|
-
horizontalResponsiveSchema,
|
|
8
|
-
};
|
|
3
|
+
export { HorizontalResponsiveEdit, HorizontalResponsiveView };
|
|
@@ -179,7 +179,7 @@ const messages = defineMessages({
|
|
|
179
179
|
},
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
const horizontalSchema = (config, props) => ({
|
|
183
183
|
title: props.intl.formatMessage(messages.HorizontalTabsBlock),
|
|
184
184
|
fieldsets: [
|
|
185
185
|
{
|
|
@@ -242,7 +242,6 @@ export default (config, props) => ({
|
|
|
242
242
|
},
|
|
243
243
|
menuColor: {
|
|
244
244
|
title: props.intl.formatMessage(messages.Color),
|
|
245
|
-
defaultValue: 'green',
|
|
246
245
|
choices: [
|
|
247
246
|
['red', props.intl.formatMessage(messages.Red)],
|
|
248
247
|
['orange', props.intl.formatMessage(messages.Orange)],
|
|
@@ -266,12 +265,11 @@ export default (config, props) => ({
|
|
|
266
265
|
menuCompact: {
|
|
267
266
|
title: props.intl.formatMessage(messages.MenuCompact),
|
|
268
267
|
type: 'boolean',
|
|
269
|
-
defaultValue: true,
|
|
270
268
|
},
|
|
271
269
|
menuFluid: {
|
|
272
270
|
title: props.intl.formatMessage(messages.MenuFluid),
|
|
273
271
|
type: 'boolean',
|
|
274
|
-
|
|
272
|
+
default: true,
|
|
275
273
|
},
|
|
276
274
|
menuInverted: {
|
|
277
275
|
title: props.intl.formatMessage(messages.MenuInverted),
|
|
@@ -280,10 +278,12 @@ export default (config, props) => ({
|
|
|
280
278
|
menuPointing: {
|
|
281
279
|
title: props.intl.formatMessage(messages.MenuPointing),
|
|
282
280
|
type: 'boolean',
|
|
281
|
+
default: true,
|
|
283
282
|
},
|
|
284
283
|
menuSecondary: {
|
|
285
284
|
title: props.intl.formatMessage(messages.MenuSecondary),
|
|
286
285
|
type: 'boolean',
|
|
286
|
+
default: true,
|
|
287
287
|
},
|
|
288
288
|
menuStackable: {
|
|
289
289
|
title: props.intl.formatMessage(messages.MenuStackable),
|
|
@@ -296,8 +296,9 @@ export default (config, props) => ({
|
|
|
296
296
|
menuText: {
|
|
297
297
|
title: props.intl.formatMessage(messages.MenuText),
|
|
298
298
|
type: 'boolean',
|
|
299
|
-
defaultValue: true,
|
|
300
299
|
},
|
|
301
300
|
},
|
|
302
301
|
required: [],
|
|
303
302
|
});
|
|
303
|
+
|
|
304
|
+
export default horizontalSchema;
|
package/src/helpers.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
|
-
import { emptyBlocksForm } from '@plone/volto/helpers';
|
|
2
|
+
import { emptyBlocksForm, applySchemaDefaults } from '@plone/volto/helpers';
|
|
3
3
|
import { visitBlocks, toSlug } from '@eeacms/volto-anchors/helpers';
|
|
4
4
|
|
|
5
|
-
export const empty = () => {
|
|
5
|
+
export const empty = ({ schema, intl }) => {
|
|
6
6
|
const tabId = uuid();
|
|
7
|
+
const data = {
|
|
8
|
+
'@type': 'tab',
|
|
9
|
+
...emptyBlocksForm(),
|
|
10
|
+
};
|
|
7
11
|
|
|
8
12
|
return {
|
|
9
13
|
blocks: {
|
|
10
|
-
[tabId]: {
|
|
11
|
-
'@type': 'tab',
|
|
12
|
-
...emptyBlocksForm(),
|
|
13
|
-
},
|
|
14
|
+
[tabId]: applySchemaDefaults({ data, schema, intl }),
|
|
14
15
|
},
|
|
15
16
|
blocks_layout: {
|
|
16
17
|
items: [tabId],
|
|
@@ -18,10 +19,13 @@ export const empty = () => {
|
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
export const emptyTab = () =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export const emptyTab = ({ schema, intl }) => {
|
|
23
|
+
const data = {
|
|
24
|
+
'@type': 'tab',
|
|
25
|
+
...emptyBlocksForm(),
|
|
26
|
+
};
|
|
27
|
+
return applySchemaDefaults({ data, schema, intl });
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
export const scrollToTarget = (target, offsetHeight = 0) => {
|
|
27
31
|
const bodyRect = document.body.getBoundingClientRect().top;
|