jupiter-dynamic-forms 1.18.0 → 1.18.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
@@ -674,7 +674,7 @@ class XBRLFormBuilder {
674
674
  */
675
675
  static buildConceptTree(concept, level, periodStartDate, periodEndDate, roleInfo, sectionId, language = "en", conceptIdOccurrences, ancestorPeriodHint) {
676
676
  var _a, _b;
677
- const label = this.getPreferredLabel(concept.labels, language);
677
+ const label = this.getPreferredLabel(concept.labels, language, concept.preferredLabel);
678
678
  const childPeriodHint = ((_a = concept.preferredLabel) == null ? void 0 : _a.includes("periodStartLabel")) ? "start" : ((_b = concept.preferredLabel) == null ? void 0 : _b.includes("periodEndLabel")) ? "end" : ancestorPeriodHint;
679
679
  const fields = [];
680
680
  if (!concept.elementAbstract) {
@@ -754,7 +754,7 @@ class XBRLFormBuilder {
754
754
  static createFieldFromConcept(concept, periodStartDate, periodEndDate, forcedColumnId, ancestorPeriodHint, language = "en") {
755
755
  var _a;
756
756
  const fieldType = this.mapXBRLTypeToFieldType(concept.type);
757
- const label = this.getPreferredLabel(concept.labels, language);
757
+ const label = this.getPreferredLabel(concept.labels, language, concept.preferredLabel);
758
758
  let columnId;
759
759
  if (forcedColumnId) {
760
760
  columnId = forcedColumnId;
@@ -806,11 +806,19 @@ class XBRLFormBuilder {
806
806
  * @param labels - Array of XBRL labels
807
807
  * @param language - ISO language code (e.g., 'en', 'nl', 'de')
808
808
  */
809
- static getPreferredLabel(labels, language = "en") {
809
+ static getPreferredLabel(labels, language = "en", preferredRole) {
810
810
  if (!labels || labels.length === 0)
811
811
  return "Unnamed Concept";
812
812
  const languageLabels = labels.filter((l2) => l2.lang === language);
813
813
  const labelsToSearch = languageLabels.length > 0 ? languageLabels : labels;
814
+ if (preferredRole) {
815
+ const roleSpecificInLanguage = languageLabels.find((l2) => l2.role === preferredRole);
816
+ if (roleSpecificInLanguage)
817
+ return roleSpecificInLanguage.label;
818
+ const roleSpecificAnyLanguage = labels.find((l2) => l2.role === preferredRole);
819
+ if (roleSpecificAnyLanguage)
820
+ return roleSpecificAnyLanguage.label;
821
+ }
814
822
  const preferred = labelsToSearch.find((l2) => l2.preferredLabel);
815
823
  if (preferred)
816
824
  return preferred.label;
@@ -3092,6 +3100,7 @@ let JupiterFormField = class extends LitElement {
3092
3100
  this._touched = false;
3093
3101
  this._showPeriodPopup = false;
3094
3102
  this._availableUnits = [];
3103
+ this._numericDraftValue = null;
3095
3104
  }
3096
3105
  willUpdate(changedProperties) {
3097
3106
  var _a;
@@ -3133,13 +3142,33 @@ let JupiterFormField = class extends LitElement {
3133
3142
  _isRoundingLevelConcept() {
3134
3143
  return !!this.conceptId && this.conceptId.includes("DocumentIntendedRoundingLevel");
3135
3144
  }
3145
+ _isNumericField() {
3146
+ var _a;
3147
+ const typeConfig = getInputTypeForConceptType(this.conceptType, this.datatypes);
3148
+ const effectiveFieldType = typeConfig.fieldType || ((_a = this.field) == null ? void 0 : _a.type) || "text";
3149
+ return isNumericType(effectiveFieldType) || this._getInputType() === "number";
3150
+ }
3151
+ _isIntermediateNumericValue(raw) {
3152
+ return raw === "-" || raw === "." || raw === "-.";
3153
+ }
3136
3154
  _handleInput(event) {
3137
3155
  const target = event.target;
3156
+ const oldValue = this.value;
3138
3157
  let value = target.value;
3139
- if (this.field.type === "number" || this.field.type === "decimal") {
3140
- value = value === "" ? null : Number(value);
3158
+ if (this._isNumericField()) {
3159
+ const rawValue = target.value;
3160
+ this._numericDraftValue = rawValue;
3161
+ if (rawValue === "" || this._isIntermediateNumericValue(rawValue)) {
3162
+ value = null;
3163
+ } else {
3164
+ const parsed = Number(rawValue);
3165
+ value = Number.isNaN(parsed) ? null : parsed;
3166
+ }
3141
3167
  } else if (this.field.type === "boolean") {
3142
3168
  value = target.checked;
3169
+ this._numericDraftValue = null;
3170
+ } else {
3171
+ this._numericDraftValue = null;
3143
3172
  }
3144
3173
  this.value = value;
3145
3174
  this._touched = true;
@@ -3149,7 +3178,7 @@ let JupiterFormField = class extends LitElement {
3149
3178
  conceptId: this.conceptId,
3150
3179
  columnId: this.columnId,
3151
3180
  value,
3152
- oldValue: this.value
3181
+ oldValue
3153
3182
  },
3154
3183
  bubbles: true
3155
3184
  }));
@@ -3165,6 +3194,16 @@ let JupiterFormField = class extends LitElement {
3165
3194
  }));
3166
3195
  }
3167
3196
  _handleBlur() {
3197
+ if (this._isNumericField() && this._numericDraftValue !== null) {
3198
+ const raw = this._numericDraftValue;
3199
+ if (raw === "" || this._isIntermediateNumericValue(raw)) {
3200
+ this.value = null;
3201
+ } else {
3202
+ const parsed = Number(raw);
3203
+ this.value = Number.isNaN(parsed) ? null : parsed;
3204
+ }
3205
+ this._numericDraftValue = null;
3206
+ }
3168
3207
  this._touched = true;
3169
3208
  this._validateXBRLDatatype();
3170
3209
  this._validateUnitSelection();
@@ -3227,7 +3266,7 @@ let JupiterFormField = class extends LitElement {
3227
3266
  if (event.ctrlKey || event.metaKey) {
3228
3267
  return;
3229
3268
  }
3230
- if (event.key === "-" && target.selectionStart === 0 && !target.value.includes("-")) {
3269
+ if (event.key === "-" && !target.value.includes("-") && (target.selectionStart === 0 || target.selectionStart === null || target.value.length === 0)) {
3231
3270
  return;
3232
3271
  }
3233
3272
  if (event.key === "." && !target.value.includes(".")) {
@@ -3666,7 +3705,7 @@ let JupiterFormField = class extends LitElement {
3666
3705
  id="${fieldId}"
3667
3706
  name="${fieldName}"
3668
3707
  class="${cssClass}"
3669
- .value="${effectiveValue || ""}"
3708
+ .value="${effectiveValue ?? ""}"
3670
3709
  ?disabled="${effectiveDisabled || this.field.disabled}"
3671
3710
  @change="${this._handleInput}"
3672
3711
  @focus="${this._handleFocus}"
@@ -3712,13 +3751,14 @@ let JupiterFormField = class extends LitElement {
3712
3751
  const step = typeConfig.step !== void 0 ? typeConfig.step : isNumericType(effectiveFieldType) ? "any" : void 0;
3713
3752
  const min = typeConfig.min;
3714
3753
  const max = typeConfig.max;
3754
+ const renderedInputValue = this._isNumericField() && this._numericDraftValue !== null ? this._numericDraftValue : effectiveValue ?? "";
3715
3755
  return html`
3716
3756
  <input
3717
3757
  id="${fieldId}"
3718
3758
  name="${fieldName}"
3719
3759
  type="${inputType}"
3720
3760
  class="${cssClass}"
3721
- .value="${effectiveValue || ""}"
3761
+ .value="${renderedInputValue}"
3722
3762
  ?disabled="${effectiveDisabled || this.field.disabled}"
3723
3763
  placeholder="${typeConfig.placeholder || this.field.placeholder || ""}"
3724
3764
  step="${step !== void 0 ? step : ""}"
@@ -4567,6 +4607,9 @@ __decorateClass$6([
4567
4607
  __decorateClass$6([
4568
4608
  r()
4569
4609
  ], JupiterFormField.prototype, "_availableUnits", 2);
4610
+ __decorateClass$6([
4611
+ r()
4612
+ ], JupiterFormField.prototype, "_numericDraftValue", 2);
4570
4613
  JupiterFormField = __decorateClass$6([
4571
4614
  t$1("jupiter-form-field")
4572
4615
  ], JupiterFormField);
@@ -5020,25 +5063,30 @@ JupiterConceptTree.styles = css`
5020
5063
 
5021
5064
  .concept-info-btn {
5022
5065
  flex-shrink: 0;
5023
- width: 18px;
5024
- height: 18px;
5066
+ width: 22px;
5067
+ height: 22px;
5025
5068
  border-radius: 50%;
5026
- border: 1px solid transparent;
5027
- background: transparent;
5028
- color: var(--jupiter-text-secondary, #888);
5029
- font-size: 12px;
5069
+ border: 1px solid var(--jupiter-border-color, #cfd8dc);
5070
+ background: var(--jupiter-card-background, #fff);
5071
+ color: var(--jupiter-primary-color, #1976d2);
5072
+ font-size: 13px;
5073
+ font-weight: 700;
5030
5074
  cursor: pointer;
5031
5075
  display: flex;
5032
5076
  align-items: center;
5033
5077
  justify-content: center;
5034
5078
  opacity: 0;
5035
- transition: opacity 0.15s, background 0.15s, color 0.15s;
5079
+ transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
5036
5080
  padding: 0;
5037
5081
  margin-left: 4px;
5038
5082
  line-height: 1;
5083
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
5084
+ pointer-events: auto;
5039
5085
  }
5040
5086
 
5041
- .concept-content:hover .concept-info-btn {
5087
+ .concept-content:hover .concept-info-btn,
5088
+ .concept-info-btn:hover,
5089
+ .concept-info-btn:focus-visible {
5042
5090
  opacity: 1;
5043
5091
  }
5044
5092
 
@@ -5046,6 +5094,14 @@ JupiterConceptTree.styles = css`
5046
5094
  background: var(--jupiter-primary-color, #1976d2);
5047
5095
  color: #fff;
5048
5096
  border-color: var(--jupiter-primary-color, #1976d2);
5097
+ box-shadow: 0 2px 6px rgba(25, 118, 210, 0.25);
5098
+ }
5099
+
5100
+ .concept-info-btn:focus-visible {
5101
+ outline: none;
5102
+ border-color: var(--jupiter-primary-color, #1976d2);
5103
+ box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.25);
5104
+ opacity: 1;
5049
5105
  }
5050
5106
 
5051
5107
  `;
@@ -6642,6 +6698,7 @@ JupiterFormSection.styles = css`
6642
6698
  border-radius: 3px;
6643
6699
  font-size: 12px;
6644
6700
  background: var(--jupiter-input-background, #fff);
6701
+ color:#000;
6645
6702
  }
6646
6703
 
6647
6704
  .typed-member-header-field:focus {
@@ -10915,7 +10972,7 @@ let JupiterDynamicForm = class extends LitElement {
10915
10972
  if (concept.abstract)
10916
10973
  return;
10917
10974
  const isCustomColumn = column2.id.startsWith("col-");
10918
- const isDimensionColumn = column2.id.startsWith("duration_") || column2.id.startsWith("instant_");
10975
+ const isDimensionColumn = column2.id.startsWith("duration_") || column2.id.startsWith("instant_") || column2.id.startsWith("typed-");
10919
10976
  const isMixedSection = section2.showPeriodControl === true;
10920
10977
  const shouldSkipPeriodCheck = !columnPeriodType || column2.id === "duration" || column2.id === "default" || isCustomColumn && isMixedSection || isDimensionColumn;
10921
10978
  if (!shouldSkipPeriodCheck && conceptPeriodType && columnPeriodType) {
@@ -12950,35 +13007,35 @@ JupiterDynamicForm.styles = css`
12950
13007
  }
12951
13008
 
12952
13009
  .side-panel-role-item.has-errors {
12953
- border-left: 2px solid var(--jupiter-error-color, #d32f2f);
13010
+ border-left: 4px solid var(--jupiter-error-color, #d32f2f);
12954
13011
  }
12955
13012
 
12956
13013
  .side-panel-role-item.has-errors.active {
12957
- border-left: 2px solid var(--jupiter-error-color, #d32f2f);
13014
+ border-left: 4px solid var(--jupiter-error-color, #d32f2f);
12958
13015
  }
12959
13016
 
12960
13017
  .side-panel-role-item.has-no-data {
12961
- border-left: 2px solid var(--jupiter-untouched-color, #757575);
13018
+ border-left: 4px solid var(--jupiter-untouched-color, #757575);
12962
13019
  }
12963
13020
 
12964
13021
  .side-panel-role-item.has-no-data.active {
12965
- border-left: 2px solid var(--jupiter-untouched-color, #757575);
13022
+ border-left: 4px solid var(--jupiter-untouched-color, #757575);
12966
13023
  }
12967
13024
 
12968
13025
  .side-panel-role-item.has-empty-fields {
12969
- border-left: 2px solid var(--jupiter-warning-color, #ff9800);
13026
+ border-left: 4px solid var(--jupiter-warning-color, #ff9800);
12970
13027
  }
12971
13028
 
12972
13029
  .side-panel-role-item.has-empty-fields.active {
12973
- border-left: 2px solid var(--jupiter-warning-color, #ff9800);
13030
+ border-left: 4px solid var(--jupiter-warning-color, #ff9800);
12974
13031
  }
12975
13032
 
12976
13033
  .side-panel-role-item.has-complete-data {
12977
- border-left: 2px solid var(--jupiter-success-color, #4caf50);
13034
+ border-left: 4px solid var(--jupiter-success-color, #4caf50);
12978
13035
  }
12979
13036
 
12980
13037
  .side-panel-role-item.has-complete-data.active {
12981
- border-left: 2px solid var(--jupiter-success-color, #4caf50);
13038
+ border-left: 4px solid var(--jupiter-success-color, #4caf50);
12982
13039
  }
12983
13040
 
12984
13041
  .role-completion-row {