jupiter-dynamic-forms 1.18.9 → 1.19.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
@@ -1749,7 +1749,7 @@ const field$1 = {
1749
1749
  enterDecimalValue: "Enter decimal value",
1750
1750
  enterNumberOfShares: "Enter number of shares",
1751
1751
  yearFormat: "YYYY",
1752
- enterPercentage: "Enter percentage",
1752
+ enterPercentage: "e.g. 0.25 for 25% or 0.2550 for 25.50%",
1753
1753
  emailPlaceholder: "email@example.com",
1754
1754
  urlPlaceholder: "https://example.com",
1755
1755
  phonePlaceholder: "+1 (555) 000-0000",
@@ -1924,7 +1924,7 @@ const field = {
1924
1924
  enterDecimalValue: "Voer decimale waarde in",
1925
1925
  enterNumberOfShares: "Voer aantal aandelen in",
1926
1926
  yearFormat: "JJJJ",
1927
- enterPercentage: "Voer percentage in",
1927
+ enterPercentage: "bijv. 0,25 voor 25% of 0,2550 voor 25,50%",
1928
1928
  emailPlaceholder: "email@voorbeeld.nl",
1929
1929
  urlPlaceholder: "https://voorbeeld.nl",
1930
1930
  phonePlaceholder: "+31 (0)20 123 4567",
@@ -3230,7 +3230,9 @@ let JupiterFormField = class extends LitElement {
3230
3230
  }));
3231
3231
  }
3232
3232
  _handleBlur() {
3233
+ let userTypedNewValue = false;
3233
3234
  if (this._isNumericField() && this._numericDraftValue !== null) {
3235
+ userTypedNewValue = true;
3234
3236
  const raw = this._numericDraftValue;
3235
3237
  if (raw === "" || this._isIntermediateNumericValue(raw)) {
3236
3238
  this.value = null;
@@ -3240,7 +3242,7 @@ let JupiterFormField = class extends LitElement {
3240
3242
  }
3241
3243
  this._numericDraftValue = null;
3242
3244
  }
3243
- if (this._isPercentItemType() && this.value !== null && this.value !== void 0) {
3245
+ if (this._isPercentItemType() && userTypedNewValue && this.value !== null && this.value !== void 0) {
3244
3246
  const numVal = Number(this.value);
3245
3247
  if (!isNaN(numVal) && Math.abs(numVal) > 1) {
3246
3248
  this.value = numVal / 100;
@@ -11349,7 +11351,7 @@ let JupiterDynamicForm = class extends LitElement {
11349
11351
  return null;
11350
11352
  }
11351
11353
  _addConceptDataToSubmission(concept, columnId, value, submissionData, section2) {
11352
- var _a, _b, _c, _d, _e, _f;
11354
+ var _a, _b, _c, _d, _e;
11353
11355
  const field2 = concept.fields.find((f2) => f2.columnId === columnId);
11354
11356
  if (!field2)
11355
11357
  return;
@@ -11361,12 +11363,6 @@ let JupiterDynamicForm = class extends LitElement {
11361
11363
  const periodStartDate = (fieldPeriodData == null ? void 0 : fieldPeriodData.startDate) || (column2 == null ? void 0 : column2.periodStartDate) || field2.periodStartDate || this.periodStartDate;
11362
11364
  const periodEndDate = (fieldPeriodData == null ? void 0 : fieldPeriodData.endDate) || (column2 == null ? void 0 : column2.periodEndDate) || field2.periodEndDate || this.periodEndDate;
11363
11365
  const periodInstantDate = (fieldPeriodData == null ? void 0 : fieldPeriodData.instantDate) || field2.periodInstantDate || periodEndDate || periodStartDate;
11364
- if ((_c = concept.type) == null ? void 0 : _c.toLowerCase().includes("percentitemtype")) {
11365
- const numericValue = Number(value);
11366
- if (!isNaN(numericValue) && Math.abs(numericValue) >= 1) {
11367
- value = numericValue / 100;
11368
- }
11369
- }
11370
11366
  const entry = {
11371
11367
  conceptId: concept.originalConceptId || concept.id,
11372
11368
  columnId,
@@ -11383,14 +11379,14 @@ let JupiterDynamicForm = class extends LitElement {
11383
11379
  entry.unit = fieldUnit;
11384
11380
  console.log(`✅ [Submission] Adding unit to entry: ${fieldUnit} for ${concept.id}/${columnId}`);
11385
11381
  }
11386
- const isMonetary = (_d = concept.type) == null ? void 0 : _d.toLowerCase().includes("monetary");
11387
- const fieldDecimals = (_e = this._decimalsData[concept.id]) == null ? void 0 : _e[columnId];
11382
+ const isMonetary = (_c = concept.type) == null ? void 0 : _c.toLowerCase().includes("monetary");
11383
+ const fieldDecimals = (_d = this._decimalsData[concept.id]) == null ? void 0 : _d[columnId];
11388
11384
  const decimalsValue = fieldDecimals || (this.decimals !== "INF" ? this.decimals : void 0);
11389
11385
  if (isMonetary && decimalsValue) {
11390
11386
  const parsed = parseFloat(decimalsValue);
11391
11387
  entry.decimals = isNaN(parsed) ? decimalsValue : String(-Math.abs(parsed));
11392
11388
  }
11393
- if ((_f = column2 == null ? void 0 : column2.dimensionData) == null ? void 0 : _f.memberLabel) {
11389
+ if ((_e = column2 == null ? void 0 : column2.dimensionData) == null ? void 0 : _e.memberLabel) {
11394
11390
  entry.dimension = column2.dimensionData.memberLabel;
11395
11391
  }
11396
11392
  console.log(`📤 [Submission Entry] Created entry:`, JSON.stringify(entry, null, 2));
@@ -11528,7 +11524,7 @@ let JupiterDynamicForm = class extends LitElement {
11528
11524
  }
11529
11525
  if (concept.fields && concept.fields.length > 0) {
11530
11526
  concept.fields.forEach((field2) => {
11531
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
11527
+ var _a, _b, _c, _d, _e, _f, _g, _h;
11532
11528
  const conceptData = this._formData[concept.id];
11533
11529
  let fieldValue = conceptData == null ? void 0 : conceptData[field2.columnId];
11534
11530
  const baseConceptId = field2.conceptId || concept.id.split("__").slice(0, -1).join("__") || concept.id;
@@ -11546,14 +11542,8 @@ let JupiterDynamicForm = class extends LitElement {
11546
11542
  }
11547
11543
  }
11548
11544
  if (fieldValue !== void 0 && fieldValue !== null && fieldValue !== "") {
11549
- if ((_b = concept.type) == null ? void 0 : _b.toLowerCase().includes("percentitemtype")) {
11550
- const numericFieldValue = Number(fieldValue);
11551
- if (!isNaN(numericFieldValue) && Math.abs(numericFieldValue) >= 1) {
11552
- fieldValue = numericFieldValue / 100;
11553
- }
11554
- }
11555
11545
  const column2 = this._findColumnByIdInSection(field2.columnId, section2);
11556
- const fieldPeriodData = (_c = this._periodData[concept.id]) == null ? void 0 : _c[field2.columnId];
11546
+ const fieldPeriodData = (_b = this._periodData[concept.id]) == null ? void 0 : _b[field2.columnId];
11557
11547
  const submissionEntry = {
11558
11548
  conceptId: concept.id,
11559
11549
  draftInstanceId: concept.id,
@@ -11575,21 +11565,21 @@ let JupiterDynamicForm = class extends LitElement {
11575
11565
  submissionEntry.period.endDate = endDate;
11576
11566
  }
11577
11567
  console.log(`🔍 [Submission] Concept: ${concept.id}, Column: ${field2.columnId}, Field Period: ${fieldPeriodData ? JSON.stringify(fieldPeriodData) : "none"}, Column Period: ${(column2 == null ? void 0 : column2.periodStartDate) || "none"} - ${(column2 == null ? void 0 : column2.periodEndDate) || "none"}, Used Period: ${submissionEntry.period.type === "instant" ? submissionEntry.period.date : `${submissionEntry.period.startDate} - ${submissionEntry.period.endDate}`}`);
11578
- const fieldUnit = (_d = this._unitData[concept.id]) == null ? void 0 : _d[field2.columnId];
11568
+ const fieldUnit = (_c = this._unitData[concept.id]) == null ? void 0 : _c[field2.columnId];
11579
11569
  if (fieldUnit) {
11580
11570
  submissionEntry.unit = fieldUnit;
11581
11571
  console.log(`✅ [Submission] Adding unit to entry: ${fieldUnit} for ${concept.id}/${field2.columnId}`);
11582
11572
  } else {
11583
11573
  console.log(`⚠️ [Submission] No unit found in _unitData for ${concept.id}/${field2.columnId}. _unitData state:`, JSON.stringify(this._unitData, null, 2));
11584
11574
  }
11585
- const isMonetary = (_e = concept.type) == null ? void 0 : _e.toLowerCase().includes("monetary");
11586
- const fieldDecimals = (_f = this._decimalsData[concept.id]) == null ? void 0 : _f[field2.columnId];
11575
+ const isMonetary = (_d = concept.type) == null ? void 0 : _d.toLowerCase().includes("monetary");
11576
+ const fieldDecimals = (_e = this._decimalsData[concept.id]) == null ? void 0 : _e[field2.columnId];
11587
11577
  const decimalsValue = fieldDecimals || (this.decimals !== "INF" ? this.decimals : void 0);
11588
11578
  if (isMonetary && decimalsValue) {
11589
11579
  const parsed = parseFloat(decimalsValue);
11590
11580
  submissionEntry.decimals = isNaN(parsed) ? decimalsValue : String(-Math.abs(parsed));
11591
11581
  }
11592
- if ((column2 == null ? void 0 : column2.type) === "dimension" && ((_g = column2.dimensionData) == null ? void 0 : _g.dimensionIdKey)) {
11582
+ if ((column2 == null ? void 0 : column2.type) === "dimension" && ((_f = column2.dimensionData) == null ? void 0 : _f.dimensionIdKey)) {
11593
11583
  submissionEntry.dimension = column2.dimensionData.dimensionIdKey;
11594
11584
  console.log(`🔍 [DynamicForm] Using dimension key from field's column (${field2.columnId}):`, column2.dimensionData.dimensionIdKey);
11595
11585
  } else {
@@ -11625,12 +11615,12 @@ let JupiterDynamicForm = class extends LitElement {
11625
11615
  console.log(`🔍 [DynamicForm] Column details:`, {
11626
11616
  id: column2.id,
11627
11617
  type: column2.type,
11628
- hasTypedMembers: (_h = column2.dimensionData) == null ? void 0 : _h.hasTypedMembers,
11618
+ hasTypedMembers: (_g = column2.dimensionData) == null ? void 0 : _g.hasTypedMembers,
11629
11619
  dimensionData: column2.dimensionData
11630
11620
  });
11631
11621
  }
11632
11622
  }
11633
- if (!submissionEntry.typedMembers && ((_i = field2.crossRoleTypedMembers) == null ? void 0 : _i.length)) {
11623
+ if (!submissionEntry.typedMembers && ((_h = field2.crossRoleTypedMembers) == null ? void 0 : _h.length)) {
11634
11624
  const crossRoleKey = `${concept.id}__${field2.columnId}`;
11635
11625
  const crossRoleValues = this._typedMemberData[crossRoleKey];
11636
11626
  if (crossRoleValues) {