Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eeacms/volto-accordion-block

Package Overview
Dependencies
Maintainers
8
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eeacms/volto-accordion-block - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

7

CHANGELOG.md

@@ -7,4 +7,11 @@ ### Changelog

#### [3.4.3](https://github.com/eea/volto-accordion-block/compare/3.4.2...3.4.3)
- Fix schemaEnhancer support for default values on newly created accord… [`#24`](https://github.com/eea/volto-accordion-block/pull/24)
#### [3.4.2](https://github.com/eea/volto-accordion-block/compare/3.4.1...3.4.2)
> 16 September 2021
- Add infrastructure support for i18n and locales folder (#23) [`#25`](https://github.com/eea/volto-accordion-block/pull/25)
- Add infrastructure support for i18n and locales folder [`#23`](https://github.com/eea/volto-accordion-block/pull/23)

@@ -11,0 +18,0 @@

2

package.json
{
"name": "@eeacms/volto-accordion-block",
"version": "3.4.2",
"version": "3.4.3",
"description": "volto-accordion-block: Volto accordion block",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -15,2 +15,4 @@ import { BlocksForm, Icon, SidebarPortal } from '@plone/volto/components';

import { emptyAccordion, getPanels } from './util';
import { cloneDeep } from 'lodash';
import config from '@plone/volto/registry';

@@ -35,2 +37,31 @@ const Edit = (props) => {

const applySchemaEnhancer = (originalSchema) => {
let schema, schemaEnhancer;
const formData = data;
const { blocks } = config;
const blockType = formData['@type'];
const variations = blocks?.blocksConfig[blockType]?.variations || [];
if (variations.length === 0) {
// No variations present but anyways
// finalize the schema with a schemaEnhancer in the block config is present
schemaEnhancer = blocks.blocksConfig?.[blockType]?.schemaEnhancer;
if (schemaEnhancer)
schema = schemaEnhancer({ schema: originalSchema, formData, intl });
}
const activeItemName = formData?.variation;
let activeItem = variations.find((item) => item.id === activeItemName);
if (!activeItem) activeItem = variations.find((item) => item.isDefault);
schemaEnhancer = activeItem?.['schemaEnhancer'];
schema = schemaEnhancer
? schemaEnhancer({ schema: cloneDeep(originalSchema), formData, intl })
: cloneDeep(originalSchema);
return schema;
};
/**

@@ -41,3 +72,3 @@ * Will set field values from schema, by matching the default values

const setInitialData = () => {
const accordionSchema = accordionBlockSchema({ intl });
const accordionSchema = applySchemaEnhancer(accordionBlockSchema({ intl }));
const defaultValues = Object.keys(accordionSchema.properties).reduce(

@@ -44,0 +75,0 @@ (accumulator, currentVal) => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc