jupiter-dynamic-forms 1.8.0 → 1.8.1

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
@@ -2701,6 +2701,7 @@ let JupiterFormSection = class extends LitElement {
2701
2701
  this.disabled = false;
2702
2702
  this.collapsible = true;
2703
2703
  this.locale = "en-US";
2704
+ this.isFirstSection = false;
2704
2705
  this.availableDimensions = [];
2705
2706
  this._expanded = true;
2706
2707
  this._showAddColumnDialog = false;
@@ -2712,6 +2713,22 @@ let JupiterFormSection = class extends LitElement {
2712
2713
  super.connectedCallback();
2713
2714
  this._expanded = this.section.expanded !== false;
2714
2715
  this._determinePeriodType();
2716
+ this._checkAndExpandFirstSection();
2717
+ }
2718
+ updated(changedProperties) {
2719
+ super.updated(changedProperties);
2720
+ if (changedProperties.has("isFirstSection") || changedProperties.has("section")) {
2721
+ this._checkAndExpandFirstSection();
2722
+ }
2723
+ }
2724
+ _checkAndExpandFirstSection() {
2725
+ if (this.isFirstSection && this.section && this.section.concepts) {
2726
+ this._expanded = true;
2727
+ setTimeout(() => {
2728
+ this._expandAllTrees();
2729
+ console.log("🎯 First section detected - expanded section and tree by default");
2730
+ }, 0);
2731
+ }
2715
2732
  }
2716
2733
  _determinePeriodType() {
2717
2734
  const nonAbstractConcepts = this._getAllNonAbstractConcepts(this.section.concepts);
@@ -3339,6 +3356,9 @@ __decorateClass$2([
3339
3356
  __decorateClass$2([
3340
3357
  n2({ type: String })
3341
3358
  ], JupiterFormSection.prototype, "locale", 2);
3359
+ __decorateClass$2([
3360
+ n2({ type: Boolean })
3361
+ ], JupiterFormSection.prototype, "isFirstSection", 2);
3342
3362
  __decorateClass$2([
3343
3363
  n2({ type: Array })
3344
3364
  ], JupiterFormSection.prototype, "availableDimensions", 2);
@@ -3611,12 +3631,6 @@ let JupiterFilterRolesDialog = class extends LitElement {
3611
3631
  />
3612
3632
  <div class="role-info">
3613
3633
  <h4 class="role-title">${role.title}</h4>
3614
- ${role.description ? html`
3615
- <p class="role-description">${role.description}</p>
3616
- ` : ""}
3617
- ${role.id !== role.title ? html`
3618
- <p class="role-description">ID: ${role.id}</p>
3619
- ` : ""}
3620
3634
  ${((_a = role.metadata) == null ? void 0 : _a.roleURI) ? html`
3621
3635
  <p class="role-description">URI: ${role.metadata.roleURI}</p>
3622
3636
  ` : ""}
@@ -4017,10 +4031,17 @@ let JupiterDynamicForm = class extends LitElement {
4017
4031
  );
4018
4032
  console.log("✅ Generated schema with sections:", this._currentSchema.sections.length);
4019
4033
  this._allSections = [...this._currentSchema.sections];
4020
- if (this._allSections.length > 10 && this._selectedRoleIds.length === 0) {
4021
- this._selectedRoleIds = this._allSections.slice(0, 10).map((section) => section.id);
4022
- } else if (this._selectedRoleIds.length === 0) {
4023
- this._selectedRoleIds = this._allSections.map((section) => section.id);
4034
+ if (this._selectedRoleIds.length === 0) {
4035
+ if (this._allSections.length > 10) {
4036
+ this._selectedRoleIds = [];
4037
+ this._showFilterDialog = true;
4038
+ this._currentSchema = {
4039
+ ...this._currentSchema,
4040
+ sections: []
4041
+ };
4042
+ } else {
4043
+ this._selectedRoleIds = this._allSections.map((section) => section.id);
4044
+ }
4024
4045
  }
4025
4046
  this._applyRoleFilter();
4026
4047
  this._columns = [
@@ -4081,6 +4102,15 @@ let JupiterDynamicForm = class extends LitElement {
4081
4102
  _applyRoleFilter() {
4082
4103
  if (!this._currentSchema || !this._allSections.length)
4083
4104
  return;
4105
+ console.log(`🔍 Applying role filter: ${this._selectedRoleIds.length} selected out of ${this._allSections.length} total`);
4106
+ if (this._selectedRoleIds.length === 0) {
4107
+ console.log(`📝 No roles selected - showing empty form`);
4108
+ this._currentSchema = {
4109
+ ...this._currentSchema,
4110
+ sections: []
4111
+ };
4112
+ return;
4113
+ }
4084
4114
  this._preserveDataForHiddenSections();
4085
4115
  const filteredSections = this._allSections.filter(
4086
4116
  (section) => this._selectedRoleIds.includes(section.id)
@@ -4163,12 +4193,14 @@ let JupiterDynamicForm = class extends LitElement {
4163
4193
  }
4164
4194
  _handleFilterDialogCancel() {
4165
4195
  this._showFilterDialog = false;
4196
+ console.log(`🚫 Filter dialog cancelled. Current selection: ${this._selectedRoleIds.length}/${this._allSections.length}`);
4166
4197
  }
4167
4198
  _handleRoleFilterApply(event) {
4168
4199
  const { selectedRoleIds } = event.detail;
4169
4200
  this._selectedRoleIds = selectedRoleIds;
4170
4201
  this._applyRoleFilter();
4171
4202
  this._showFilterDialog = false;
4203
+ console.log(`🎯 Applied role filter: ${selectedRoleIds.length}/${this._allSections.length} roles selected`);
4172
4204
  this.dispatchEvent(new CustomEvent("roles-filter-changed", {
4173
4205
  detail: {
4174
4206
  selectedRoleIds,
@@ -5007,8 +5039,14 @@ let JupiterDynamicForm = class extends LitElement {
5007
5039
  </div>
5008
5040
  ` : ""}
5009
5041
 
5010
- <!-- Form Sections -->
5011
- ${schema.sections.map((section) => html`
5042
+ <!-- Form Sections or No Selection Message -->
5043
+ ${schema.sections.length === 0 && this._allSections.length > 10 ? html`
5044
+ <div class="no-roles-message">
5045
+ <h3>No Roles Selected</h3>
5046
+ <p>Please use the "Filter Roles" button below to select which sections you want to work with.</p>
5047
+ <p>Available roles: ${this._allSections.length}</p>
5048
+ </div>
5049
+ ` : schema.sections.map((section, index) => html`
5012
5050
  <jupiter-form-section
5013
5051
  .section="${section}"
5014
5052
  .columns="${section.columns || this._columns}"
@@ -5017,6 +5055,7 @@ let JupiterDynamicForm = class extends LitElement {
5017
5055
  .disabled="${this.disabled || this.readonly}"
5018
5056
  .collapsible="${config.collapsibleSections !== false}"
5019
5057
  .locale="${config.locale || "en-US"}"
5058
+ .isFirstSection="${index === 0}"
5020
5059
  .availableDimensions="${this._getAvailableDimensionsForSection(section.id)}"
5021
5060
  @field-change="${this._handleFieldChange}"
5022
5061
  @typed-member-change="${this._handleTypedMemberChange}"
@@ -5040,7 +5079,7 @@ let JupiterDynamicForm = class extends LitElement {
5040
5079
  <svg class="filter-icon" viewBox="0 0 24 24">
5041
5080
  <path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
5042
5081
  </svg>
5043
- Filter Roles
5082
+ ${this._selectedRoleIds.length === 0 ? "Select Roles" : "Filter Roles"}
5044
5083
  <span class="roles-count">${this._selectedRoleIds.length}/${this._allSections.length}</span>
5045
5084
  </button>
5046
5085
  ` : ""}
@@ -5254,6 +5293,25 @@ JupiterDynamicForm.styles = css`
5254
5293
  min-width: 18px;
5255
5294
  justify-content: center;
5256
5295
  }
5296
+
5297
+ .no-roles-message {
5298
+ padding: 40px;
5299
+ text-align: center;
5300
+ color: var(--jupiter-text-secondary, #666);
5301
+ background: var(--jupiter-background-light, #f8f9fa);
5302
+ border-radius: 8px;
5303
+ margin: 20px 0;
5304
+ }
5305
+
5306
+ .no-roles-message h3 {
5307
+ margin: 0 0 16px 0;
5308
+ color: var(--jupiter-text-primary, #333);
5309
+ }
5310
+
5311
+ .no-roles-message p {
5312
+ margin: 8px 0;
5313
+ line-height: 1.5;
5314
+ }
5257
5315
  `;
5258
5316
  __decorateClass([
5259
5317
  n2({ type: Object })