@eeacms/volto-tabs-block 7.0.2 → 7.0.4

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 CHANGED
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [7.0.4](https://github.com/eea/volto-tabs-block/compare/7.0.3...7.0.4) - 4 December 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: check if schema.propierties.data exists - refs #261239 [dobri1408 - [`4bf628e`](https://github.com/eea/volto-tabs-block/commit/4bf628e4d0fdcb1c7919553bdcfedbea9a7e0a2e)]
12
+
13
+ ### [7.0.3](https://github.com/eea/volto-tabs-block/compare/7.0.2...7.0.3) - 29 November 2023
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: delete styles on tab - refs #260427 [dobri1408 - [`6925c95`](https://github.com/eea/volto-tabs-block/commit/6925c958780e9446949c9023053970f042052ecf)]
18
+
7
19
  ### [7.0.2](https://github.com/eea/volto-tabs-block/compare/7.0.1...7.0.2) - 24 November 2023
8
20
 
9
21
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tabs-block",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "volto-tabs-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -51,7 +51,8 @@ const Edit = (props) => {
51
51
  const accordionConfig = config.blocks.blocksConfig[
52
52
  TABS_BLOCK
53
53
  ].variations.filter((v, _i) => v.id === data.variation);
54
- const { icons, semanticIcon, transformWidth = 800 } = accordionConfig?.[0];
54
+ const { icons, semanticIcon, transformWidth = 800 } =
55
+ accordionConfig?.[0] || {};
55
56
 
56
57
  const tabsContainer = React.useRef();
57
58
  const [mounted, setMounted] = React.useState(false);
@@ -116,7 +117,7 @@ const Edit = (props) => {
116
117
  ...(newFormData.blocks_layout.items.length > 0
117
118
  ? newFormData
118
119
  : emptyTab({
119
- schema: schema.properties.data.schema,
120
+ schema: schema?.properties?.data?.schema || {},
120
121
  intl,
121
122
  })),
122
123
  },
@@ -42,7 +42,8 @@ const View = (props) => {
42
42
  const accordionConfig = config.blocks.blocksConfig[
43
43
  TABS_BLOCK
44
44
  ].variations.filter((v, _i) => v.id === data.variation);
45
- const { icons, semanticIcon, transformWidth = 800 } = accordionConfig?.[0];
45
+ const { icons, semanticIcon, transformWidth = 800 } =
46
+ accordionConfig?.[0] || {};
46
47
 
47
48
  const tabsContainer = React.useRef();
48
49
  const [mounted, setMounted] = React.useState(false);
@@ -59,7 +59,7 @@ export const MenuItem = (props) => {
59
59
  ...tabsData.blocks,
60
60
  [tabId]: {
61
61
  ...emptyTab({
62
- schema: schema.properties.data.schema,
62
+ schema: schema?.properties?.data?.schema || {},
63
63
  intl,
64
64
  }),
65
65
  },
@@ -267,7 +267,7 @@ const Edit = (props) => {
267
267
  ...(newFormData.blocks_layout.items.length > 0
268
268
  ? newFormData
269
269
  : emptyTab({
270
- schema: schema.properties.data.schema,
270
+ schema: schema?.properties?.data?.schema || {},
271
271
  intl,
272
272
  })),
273
273
  },
package/src/index.js CHANGED
@@ -107,7 +107,7 @@ const applyConfig = (config) => {
107
107
  },
108
108
  ],
109
109
  getBlocks: (data) => {
110
- const { blocks = {}, blocks_layout = {} } = data?.data;
110
+ const { blocks = {}, blocks_layout = {} } = data?.data || {};
111
111
  if (blocks_layout?.items?.length) {
112
112
  return {
113
113
  blocks: blocks_layout.items.map((block, index) => ({
@@ -101,7 +101,7 @@ const TabsWidget = (props) => {
101
101
  },
102
102
  blocks_layout: {
103
103
  ...value.blocks_layout,
104
- items: [...value.blocks_layout?.items, newId],
104
+ items: [...(value.blocks_layout?.items || []), newId],
105
105
  },
106
106
  });
107
107
  }}
@@ -170,7 +170,7 @@ const TabsWidget = (props) => {
170
170
  blocks_layout: {
171
171
  ...value.blocks_layout,
172
172
  items: without(
173
- [...value.blocks_layout?.items],
173
+ [...(value.blocks_layout?.items || [])],
174
174
  childId,
175
175
  ),
176
176
  },
@@ -227,6 +227,7 @@ const TabsWidget = (props) => {
227
227
  <StyleWrapperEdit
228
228
  {...props}
229
229
  selected={activeTabId}
230
+ blockData={activeTabData}
230
231
  isVisible={blockStyleVisible}
231
232
  setIsVisible={(value) => {
232
233
  setActiveTabId(null);
@@ -238,6 +239,17 @@ const TabsWidget = (props) => {
238
239
  ...(activeTabData.size ? { size: activeTabData.size } : {}),
239
240
  }}
240
241
  choices={[]}
242
+ onChangeBlock={(block, newData) => {
243
+ onChange(id, {
244
+ ...value,
245
+ blocks: {
246
+ ...value.blocks,
247
+ [activeTabId]: {
248
+ ...newData,
249
+ },
250
+ },
251
+ });
252
+ }}
241
253
  onChangeValue={(styleId, styleValue) =>
242
254
  onChange(id, {
243
255
  ...value,