-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc8b581
commit 1c939dd
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}), | ||
], | ||
}), | ||
], | ||
}); |