jupiter-dynamic-forms 1.15.5 → 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>