@limetech/lime-elements 37.61.1 → 37.61.2

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
@@ -1,3 +1,11 @@
1
+ ## [37.61.2](https://github.com/Lundalogik/lime-elements/compare/v37.61.1...v37.61.2) (2024-09-19)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+
7
+ * **form:** render collapsed children when they become visible ([6a2ffa0](https://github.com/Lundalogik/lime-elements/commit/6a2ffa050c3186043186d7d8f16cd5cd246b0698))
8
+
1
9
  ## [37.61.1](https://github.com/Lundalogik/lime-elements/compare/v37.61.0...v37.61.1) (2024-09-19)
2
10
 
3
11
 
@@ -23714,13 +23714,24 @@ class CollapsibleItemTemplate extends react.Component {
23714
23714
  constructor(props) {
23715
23715
  super(props);
23716
23716
  this.props = props;
23717
+ this.state = {
23718
+ isOpen: false,
23719
+ };
23720
+ this.handleOpen = () => {
23721
+ this.setState({
23722
+ isOpen: true,
23723
+ });
23724
+ };
23717
23725
  this.handleAction = this.handleAction.bind(this);
23718
23726
  this.isDeepEmpty = this.isDeepEmpty.bind(this);
23719
- this.isOpen = this.isDeepEmpty(props.data);
23727
+ this.setState({
23728
+ isOpen: this.isDeepEmpty(props.data),
23729
+ });
23720
23730
  }
23721
23731
  componentDidMount() {
23722
23732
  const section = this.refs.section;
23723
23733
  section.addEventListener('action', this.handleAction);
23734
+ section.addEventListener('open', this.handleOpen);
23724
23735
  this.setActions(section);
23725
23736
  }
23726
23737
  componentDidUpdate() {
@@ -23730,15 +23741,20 @@ class CollapsibleItemTemplate extends react.Component {
23730
23741
  componentWillUnmount() {
23731
23742
  const section = this.refs.section;
23732
23743
  section.removeEventListener('action', this.handleAction);
23744
+ section.removeEventListener('open', this.handleOpen);
23733
23745
  }
23734
23746
  render() {
23735
23747
  const { data, schema, formSchema } = this.props;
23748
+ let children;
23749
+ if (this.state.isOpen) {
23750
+ children = this.props.item.children;
23751
+ }
23736
23752
  return react.createElement('limel-collapsible-section', {
23737
23753
  header: findTitle(data, schema, formSchema) || 'New item',
23738
23754
  class: 'limel-form-array-item--object',
23739
23755
  ref: 'section',
23740
- 'is-open': this.isOpen,
23741
- }, this.props.item.children);
23756
+ 'is-open': this.state.isOpen,
23757
+ }, children);
23742
23758
  }
23743
23759
  setActions(element) {
23744
23760
  const { item, index } = this.props;