Skip to content

Commit

Permalink
update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
RayenRomdhane committed Dec 12, 2023
1 parent bc8b581 commit 1c939dd
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unrelesed]

### Added

- Add `itemType` and `itemDefinition` attributes in `ComponentAttributeDefinition`.
- Add tests for new attributes and validation.

### Changed

- Change `__typeOfValueValidation` in `ComponentAttribute`:
- Enhanced validation for Array attributes by checking element types.
- Introduced support for the `itemType` attribute in Array attributes.

## [0.22.0] - 2023/10/19

### Added
Expand Down
95 changes: 95 additions & 0 deletions guides/migrations/0.22.0_to_0.23.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Migrate from version 0.22.0 to 0.23.0

## Update in `ComponentAttributeDefinition`

- Added itemType and itemDefinition attributes to ComponentAttributeDefinition class enabling precise configuration of array elements within the component attribute.
- itemType: Type of individual array elements
- itemDefinition: Definition of the structure for individual array elements (Required if itemType is equal to 'Object')

```js
// Before:
constructor(props = {
name: null,
type: null,
displayName: null,
description: null,
url: null,
linkType: null,
linkRef: [],
linkColor: 'black',
linkWidth: 2,
linkDashStyle: null,
containerRef: null,
required: false,
definedAttributes: [],
rules: {
values: null,
min: null,
max: null,
regex: null,
},
}) {
}
// Old way of using it:
const attribute = new ComponentAttributeDefinition({
name: 'myAttribute',
type: 'Array',
definedAttributes: [
new ComponentAttributeDefinition({
name: 'subAttribute1',
type: 'Number',
}),
new ComponentAttributeDefinition({
name: 'subAttribute2',
type: 'Number',
}),
],
});

// After:
constructor(props = {
name: null,
...
itemDefinition: [],
itemType: null,
...
}) {
}
// New way of using it:
const attribute = new ComponentAttributeDefinition({
name: 'myAttribute',
type: 'Array',
itemType: 'Number',
itemDefinition: [],
definedAttributes: [
new ComponentAttributeDefinition({
name: 'subAttribute1',
type: 'Number',
}),
new ComponentAttributeDefinition({
name: 'subAttribute2',
type: 'Number',
}),
],
});
// Case of ArrayofObjects
const attribute = new ComponentAttributeDefinition({
name: 'myAttribute',
type: 'Array',
itemType: 'Object',
itemDefinition: [
new ComponentAttributeDefinition({
type: 'Object',
definedAttributes: [
new ComponentAttributeDefinition({
name: 'subAttribute1',
type: 'String',
}),
new ComponentAttributeDefinition({
name: 'subAttribute2',
type: 'Number',
}),
],
}),
],
});

0 comments on commit 1c939dd

Please sign in to comment.