jupiter-dynamic-forms 1.15.4 → 1.15.6

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
@@ -3222,7 +3222,31 @@ let JupiterFormField = class extends LitElement {
3222
3222
  periodType: this.field.periodType
3223
3223
  });
3224
3224
  }
3225
+ /**
3226
+ * Renders a plain text label for readonly mode instead of an interactive input.
3227
+ * Resolves the display value for selects (shows label, not raw id) and
3228
+ * booleans (shows Yes/No).
3229
+ */
3230
+ _renderReadonlyValue(effectiveValue) {
3231
+ const typeConfig = getInputTypeForConceptType(this.conceptType, this.datatypes);
3232
+ const effectiveFieldType = typeConfig.fieldType || this.field.type || "text";
3233
+ let displayValue;
3234
+ if (effectiveFieldType === "boolean" || isCheckboxType(effectiveFieldType)) {
3235
+ displayValue = effectiveValue ? I18n.t("form.yes") : I18n.t("form.no");
3236
+ } else if (effectiveFieldType === "select" || this.field.type === "select") {
3237
+ const selectOptions = typeConfig.enumerations || this.field.options || [];
3238
+ const match = selectOptions.find((o2) => o2.value === effectiveValue);
3239
+ displayValue = match ? match.label || match.value : effectiveValue ?? "";
3240
+ } else {
3241
+ displayValue = effectiveValue !== null && effectiveValue !== void 0 ? String(effectiveValue) : "";
3242
+ }
3243
+ const isEmpty = displayValue === "" || displayValue === null || displayValue === void 0;
3244
+ return html`<span class="readonly-value ${isEmpty ? "empty" : ""}">${isEmpty ? "—" : displayValue}</span>`;
3245
+ }
3225
3246
  _renderInput(effectiveValue = this.value, effectiveDisabled = this.disabled) {
3247
+ if (this.mode === "readonly") {
3248
+ return this._renderReadonlyValue(effectiveValue);
3249
+ }
3226
3250
  const hasErrors = this._errors.some((e2) => e2.severity === "error");
3227
3251
  const hasWarnings = this._errors.some((e2) => e2.severity === "warning");
3228
3252
  const isMonetary = this._isMonetaryType();
@@ -3806,6 +3830,21 @@ JupiterFormField.styles = css`
3806
3830
  min-height: 60px;
3807
3831
  }
3808
3832
 
3833
+ .readonly-value {
3834
+ display: block;
3835
+ padding: 6px 0;
3836
+ color: var(--jupiter-text-primary, #333);
3837
+ font-size: inherit;
3838
+ line-height: 1.4;
3839
+ word-break: break-word;
3840
+ min-height: 1.4em;
3841
+ }
3842
+
3843
+ .readonly-value.empty {
3844
+ color: var(--jupiter-text-secondary, #999);
3845
+ font-style: italic;
3846
+ }
3847
+
3809
3848
  .checkbox-container {
3810
3849
  display: flex;
3811
3850
  align-items: center;
@@ -5121,13 +5160,19 @@ let JupiterFormSection = class extends LitElement {
5121
5160
  <div class="typed-members-header">
5122
5161
  ${(_c = (_b = column2.dimensionData) == null ? void 0 : _b.typedMembers) == null ? void 0 : _c.map((typedMember) => html`
5123
5162
  <div class="typed-member-header-input">
5124
- <input
5125
- type="text"
5126
- class="typed-member-header-field"
5127
- placeholder="${I18n.t("section.enterPlaceholder")} ${typedMember.axisLabel}"
5128
- .value="${this._getTypedMemberHeaderValue(column2.id, typedMember.axisId)}"
5129
- @input="${(e2) => this._handleTypedMemberHeaderChange(e2, column2.id, typedMember.axisId)}"
5130
- />
5163
+ ${this.mode === "readonly" ? html`
5164
+ <span class="typed-member-header-field" style="display:block;padding:4px 0;">
5165
+ ${this._getTypedMemberHeaderValue(column2.id, typedMember.axisId) || ""}
5166
+ </span>
5167
+ ` : html`
5168
+ <input
5169
+ type="text"
5170
+ class="typed-member-header-field"
5171
+ placeholder="${I18n.t("section.enterPlaceholder")} ${typedMember.axisLabel}"
5172
+ .value="${this._getTypedMemberHeaderValue(column2.id, typedMember.axisId)}"
5173
+ @input="${(e2) => this._handleTypedMemberHeaderChange(e2, column2.id, typedMember.axisId)}"
5174
+ />
5175
+ `}
5131
5176
  </div>
5132
5177
  `)}
5133
5178
  </div>
@@ -7246,12 +7291,10 @@ let JupiterDynamicForm = class extends LitElement {
7246
7291
  });
7247
7292
  console.log("✅ Custom order applied to _allSections:", this._allSections.map((s2) => s2.title));
7248
7293
  }
7249
- if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
7250
- this._allSections = this._filterRolesByAxisConfig(this._allSections);
7251
- }
7252
7294
  if (this._selectedRoleIds.length === 0) {
7253
- this._selectedRoleIds = this._allSections.map((section2) => section2.id);
7254
- console.log("✅ Auto-selected all roles:", this._selectedRoleIds.length);
7295
+ const initialSections = this.roleFilterAxes && this.roleFilterAxes.length > 0 ? this._filterRolesByAxisConfig(this._allSections) : this._allSections;
7296
+ this._selectedRoleIds = initialSections.map((section2) => section2.id);
7297
+ console.log(`✅ Auto-selected ${this._selectedRoleIds.length} roles (of ${this._allSections.length} total)`);
7255
7298
  }
7256
7299
  this._applyRoleFilter();
7257
7300
  this._columns = [
@@ -8742,9 +8785,6 @@ let JupiterDynamicForm = class extends LitElement {
8742
8785
  this._periodPreferences
8743
8786
  );
8744
8787
  this._allSections = [...this._currentSchema.sections];
8745
- if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
8746
- this._allSections = this._filterRolesByAxisConfig(this._allSections);
8747
- }
8748
8788
  console.log("✅ Schema rebuilt with restored period preferences");
8749
8789
  console.log("🔄 Applying custom period data to schema fields...");
8750
8790
  this._applyCustomPeriodDataToFields();