jupiter-dynamic-forms 1.7.3 → 1.8.0

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/dist/index.mjs CHANGED
@@ -2706,6 +2706,7 @@ let JupiterFormSection = class extends LitElement {
2706
2706
  this._showAddColumnDialog = false;
2707
2707
  this._sectionPeriodType = "duration";
2708
2708
  this._expandedConcepts = /* @__PURE__ */ new Set();
2709
+ this._allTreeExpanded = false;
2709
2710
  }
2710
2711
  connectedCallback() {
2711
2712
  super.connectedCallback();
@@ -2843,6 +2844,50 @@ let JupiterFormSection = class extends LitElement {
2843
2844
  }
2844
2845
  return result;
2845
2846
  }
2847
+ _getAllConceptIds(concepts) {
2848
+ const result = [];
2849
+ for (const concept of concepts) {
2850
+ if (concept.children && concept.children.length > 0) {
2851
+ result.push(concept.id);
2852
+ result.push(...this._getAllConceptIds(concept.children));
2853
+ }
2854
+ }
2855
+ return result;
2856
+ }
2857
+ _expandAllTrees() {
2858
+ const allConceptIds = this._getAllConceptIds(this.section.concepts || []);
2859
+ allConceptIds.forEach((id) => this._expandedConcepts.add(id));
2860
+ this._allTreeExpanded = true;
2861
+ this.requestUpdate();
2862
+ }
2863
+ _collapseAllTrees() {
2864
+ this._expandedConcepts.clear();
2865
+ this._allTreeExpanded = false;
2866
+ this.requestUpdate();
2867
+ }
2868
+ _toggleAllTrees(event) {
2869
+ event.stopPropagation();
2870
+ if (!this._expanded) {
2871
+ this._expanded = true;
2872
+ }
2873
+ if (this._allTreeExpanded) {
2874
+ this._collapseAllTrees();
2875
+ } else {
2876
+ this._expandAllTrees();
2877
+ }
2878
+ }
2879
+ _handleTreeCheckboxChange(event) {
2880
+ event.stopPropagation();
2881
+ const checkbox = event.target;
2882
+ if (!this._expanded) {
2883
+ this._expanded = true;
2884
+ }
2885
+ if (checkbox.checked) {
2886
+ this._expandAllTrees();
2887
+ } else {
2888
+ this._collapseAllTrees();
2889
+ }
2890
+ }
2846
2891
  _handleConceptExpand(event) {
2847
2892
  event.stopPropagation();
2848
2893
  const { conceptId, expanded } = event.detail;
@@ -2851,6 +2896,8 @@ let JupiterFormSection = class extends LitElement {
2851
2896
  } else {
2852
2897
  this._expandedConcepts.delete(conceptId);
2853
2898
  }
2899
+ const allConceptIds = this._getAllConceptIds(this.section.concepts || []);
2900
+ this._allTreeExpanded = allConceptIds.length > 0 && allConceptIds.every((id) => this._expandedConcepts.has(id));
2854
2901
  this.requestUpdate();
2855
2902
  this.dispatchEvent(new CustomEvent("concept-expand", {
2856
2903
  detail: event.detail,
@@ -2885,8 +2932,10 @@ let JupiterFormSection = class extends LitElement {
2885
2932
  <p class="section-description">${this.section.description}</p>
2886
2933
  ` : ""}
2887
2934
  </div>
2888
- <div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
2889
- ${this.collapsible ? "" : ""}
2935
+ <div class="section-header-controls">
2936
+ <div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
2937
+ ${this.collapsible ? "▶" : ""}
2938
+ </div>
2890
2939
  </div>
2891
2940
  </div>
2892
2941
 
@@ -2906,8 +2955,19 @@ let JupiterFormSection = class extends LitElement {
2906
2955
  <p class="section-description">${this.section.description}</p>
2907
2956
  ` : ""}
2908
2957
  </div>
2909
- <div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
2910
- ${this.collapsible ? "" : ""}
2958
+ <div class="section-header-controls">
2959
+ <div class="tree-control">
2960
+ <input
2961
+ type="checkbox"
2962
+ class="tree-control-checkbox"
2963
+ .checked="${this._allTreeExpanded}"
2964
+ @change="${this._handleTreeCheckboxChange}"
2965
+ />
2966
+ <span class="tree-control-label" @click="${this._toggleAllTrees}">${this._allTreeExpanded ? "Collapse Tree" : "Expand Tree"}</span>
2967
+ </div>
2968
+ <div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
2969
+ ${this.collapsible ? "▶" : ""}
2970
+ </div>
2911
2971
  </div>
2912
2972
  </div>
2913
2973
 
@@ -3063,6 +3123,43 @@ JupiterFormSection.styles = css`
3063
3123
  visibility: hidden;
3064
3124
  }
3065
3125
 
3126
+ .section-header-controls {
3127
+ display: flex;
3128
+ align-items: center;
3129
+ gap: 12px;
3130
+ }
3131
+
3132
+ .tree-control {
3133
+ display: flex;
3134
+ align-items: center;
3135
+ gap: 6px;
3136
+ font-size: 12px;
3137
+ color: var(--jupiter-text-secondary, #666);
3138
+ background: var(--jupiter-button-background, #fff);
3139
+ border: 1px solid var(--jupiter-border-color, #ddd);
3140
+ border-radius: 4px;
3141
+ padding: 4px 8px;
3142
+ cursor: pointer;
3143
+ transition: all 0.2s ease;
3144
+ }
3145
+
3146
+ .tree-control:hover {
3147
+ background: var(--jupiter-button-hover-background, #f5f5f5);
3148
+ border-color: var(--jupiter-primary-color, #007bff);
3149
+ }
3150
+
3151
+ .tree-control-checkbox {
3152
+ width: 14px;
3153
+ height: 14px;
3154
+ cursor: pointer;
3155
+ }
3156
+
3157
+ .tree-control-label {
3158
+ cursor: pointer;
3159
+ font-weight: 500;
3160
+ white-space: nowrap;
3161
+ }
3162
+
3066
3163
  .section-content {
3067
3164
  display: block;
3068
3165
  transition: max-height 0.3s ease;
@@ -3257,6 +3354,9 @@ __decorateClass$2([
3257
3354
  __decorateClass$2([
3258
3355
  r()
3259
3356
  ], JupiterFormSection.prototype, "_expandedConcepts", 2);
3357
+ __decorateClass$2([
3358
+ r()
3359
+ ], JupiterFormSection.prototype, "_allTreeExpanded", 2);
3260
3360
  JupiterFormSection = __decorateClass$2([
3261
3361
  t$1("jupiter-form-section")
3262
3362
  ], JupiterFormSection);