jupiter-dynamic-forms 1.17.8 → 1.17.9
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/core/form-field.d.ts +3 -0
- package/dist/core/form-field.d.ts.map +1 -1
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/index.js +111 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +264 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1742,7 +1742,12 @@ const field$1 = {
|
|
|
1742
1742
|
phonePlaceholder: "+1 (555) 000-0000",
|
|
1743
1743
|
enterValue: "Enter value",
|
|
1744
1744
|
enterDetailedInformation: "Enter detailed information...",
|
|
1745
|
-
scale: "Scale"
|
|
1745
|
+
scale: "Scale",
|
|
1746
|
+
addText: "Add text",
|
|
1747
|
+
editText: "Edit",
|
|
1748
|
+
save: "Save",
|
|
1749
|
+
cancel: "Cancel",
|
|
1750
|
+
characters: "characters"
|
|
1746
1751
|
};
|
|
1747
1752
|
const admin$1 = {
|
|
1748
1753
|
title: "Configure Roles",
|
|
@@ -1909,7 +1914,12 @@ const field = {
|
|
|
1909
1914
|
phonePlaceholder: "+31 (0)20 123 4567",
|
|
1910
1915
|
enterValue: "Voer waarde in",
|
|
1911
1916
|
enterDetailedInformation: "Voer gedetailleerde informatie in...",
|
|
1912
|
-
scale: "Schaal"
|
|
1917
|
+
scale: "Schaal",
|
|
1918
|
+
addText: "Tekst toevoegen",
|
|
1919
|
+
editText: "Bewerken",
|
|
1920
|
+
save: "Opslaan",
|
|
1921
|
+
cancel: "Annuleren",
|
|
1922
|
+
characters: "tekens"
|
|
1913
1923
|
};
|
|
1914
1924
|
const admin = {
|
|
1915
1925
|
title: "Rollen configureren",
|
|
@@ -3397,6 +3407,169 @@ let JupiterFormField = class extends LitElement {
|
|
|
3397
3407
|
this._closePeriodPopup();
|
|
3398
3408
|
}
|
|
3399
3409
|
}
|
|
3410
|
+
_ensureTextDialogStyles() {
|
|
3411
|
+
if (document.getElementById("jdf-text-dialog-styles"))
|
|
3412
|
+
return;
|
|
3413
|
+
const style = document.createElement("style");
|
|
3414
|
+
style.id = "jdf-text-dialog-styles";
|
|
3415
|
+
style.textContent = `
|
|
3416
|
+
dialog.jdf-text-entry-dialog {
|
|
3417
|
+
border: none; border-radius: 8px; padding: 0;
|
|
3418
|
+
max-width: 600px; width: 90vw;
|
|
3419
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;
|
|
3420
|
+
font-family: inherit;
|
|
3421
|
+
}
|
|
3422
|
+
dialog.jdf-text-entry-dialog::backdrop { background: rgba(0,0,0,0.35); }
|
|
3423
|
+
.jdf-text-dialog-header {
|
|
3424
|
+
background: #f0f2f5; padding: 14px 20px;
|
|
3425
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
3426
|
+
border-bottom: 1px solid #ddd;
|
|
3427
|
+
}
|
|
3428
|
+
.jdf-text-dialog-title {
|
|
3429
|
+
font-size: 15px; font-weight: 600; color: #333; margin: 0;
|
|
3430
|
+
font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
3431
|
+
}
|
|
3432
|
+
.jdf-text-dialog-close {
|
|
3433
|
+
flex-shrink: 0; width: 28px; height: 28px; border: none; background: transparent;
|
|
3434
|
+
font-size: 20px; line-height: 1; cursor: pointer; color: #666;
|
|
3435
|
+
border-radius: 4px; display: flex; align-items: center; justify-content: center;
|
|
3436
|
+
padding: 0; font-family: inherit; margin-left: 8px;
|
|
3437
|
+
}
|
|
3438
|
+
.jdf-text-dialog-close:hover { background: #ddd; color: #333; }
|
|
3439
|
+
.jdf-text-dialog-body { padding: 20px 20px 12px; }
|
|
3440
|
+
.jdf-text-dialog-textarea {
|
|
3441
|
+
width: 100%; min-height: 200px; max-height: 50vh;
|
|
3442
|
+
padding: 10px 12px; font-size: 14px; font-family: inherit;
|
|
3443
|
+
border: 1px solid #ddd; border-radius: 4px;
|
|
3444
|
+
box-sizing: border-box; resize: vertical; line-height: 1.5;
|
|
3445
|
+
color: #333; background: #fff;
|
|
3446
|
+
}
|
|
3447
|
+
.jdf-text-dialog-textarea:focus {
|
|
3448
|
+
outline: none; border-color: #1976d2;
|
|
3449
|
+
box-shadow: 0 0 0 2px rgba(25,118,210,0.2);
|
|
3450
|
+
}
|
|
3451
|
+
.jdf-text-dialog-char-count {
|
|
3452
|
+
margin-top: 4px; font-size: 12px; color: #888; text-align: right;
|
|
3453
|
+
font-family: inherit;
|
|
3454
|
+
}
|
|
3455
|
+
.jdf-text-dialog-actions {
|
|
3456
|
+
display: flex; justify-content: flex-end; gap: 8px;
|
|
3457
|
+
padding: 12px 20px 16px; border-top: 1px solid #eee;
|
|
3458
|
+
}
|
|
3459
|
+
.jdf-text-dialog-cancel {
|
|
3460
|
+
padding: 7px 18px; border: 1px solid #ddd; border-radius: 4px;
|
|
3461
|
+
background: transparent; color: #555; font-size: 14px;
|
|
3462
|
+
cursor: pointer; font-family: inherit;
|
|
3463
|
+
}
|
|
3464
|
+
.jdf-text-dialog-cancel:hover { background: #f5f5f5; }
|
|
3465
|
+
.jdf-text-dialog-save {
|
|
3466
|
+
padding: 7px 18px; border: none; border-radius: 4px;
|
|
3467
|
+
background: #1976d2; color: #fff; font-size: 14px;
|
|
3468
|
+
cursor: pointer; font-family: inherit; font-weight: 500;
|
|
3469
|
+
}
|
|
3470
|
+
.jdf-text-dialog-save:hover { background: #1565c0; }
|
|
3471
|
+
`;
|
|
3472
|
+
document.head.appendChild(style);
|
|
3473
|
+
}
|
|
3474
|
+
_openTextDialog(currentValue, fieldLabel) {
|
|
3475
|
+
var _a;
|
|
3476
|
+
this._ensureTextDialogStyles();
|
|
3477
|
+
(_a = document.getElementById("jdf-text-entry-dialog")) == null ? void 0 : _a.remove();
|
|
3478
|
+
const dialog = document.createElement("dialog");
|
|
3479
|
+
dialog.id = "jdf-text-entry-dialog";
|
|
3480
|
+
dialog.className = "jdf-text-entry-dialog";
|
|
3481
|
+
dialog.setAttribute("role", "dialog");
|
|
3482
|
+
dialog.setAttribute("aria-modal", "true");
|
|
3483
|
+
dialog.setAttribute("aria-labelledby", "jdf-text-dialog-title");
|
|
3484
|
+
dialog.innerHTML = `
|
|
3485
|
+
<div class="jdf-text-dialog-header">
|
|
3486
|
+
<h3 class="jdf-text-dialog-title" id="jdf-text-dialog-title"></h3>
|
|
3487
|
+
<button class="jdf-text-dialog-close" type="button" aria-label="Close">×</button>
|
|
3488
|
+
</div>
|
|
3489
|
+
<div class="jdf-text-dialog-body">
|
|
3490
|
+
<textarea class="jdf-text-dialog-textarea" spellcheck="true"></textarea>
|
|
3491
|
+
<div class="jdf-text-dialog-char-count"></div>
|
|
3492
|
+
</div>
|
|
3493
|
+
<div class="jdf-text-dialog-actions">
|
|
3494
|
+
<button class="jdf-text-dialog-cancel" type="button"></button>
|
|
3495
|
+
<button class="jdf-text-dialog-save" type="button"></button>
|
|
3496
|
+
</div>
|
|
3497
|
+
`;
|
|
3498
|
+
dialog.querySelector(".jdf-text-dialog-title").textContent = fieldLabel;
|
|
3499
|
+
dialog.querySelector(".jdf-text-dialog-cancel").textContent = I18n.t("field.cancel");
|
|
3500
|
+
dialog.querySelector(".jdf-text-dialog-save").textContent = I18n.t("field.save");
|
|
3501
|
+
const textarea = dialog.querySelector(".jdf-text-dialog-textarea");
|
|
3502
|
+
const charCount = dialog.querySelector(".jdf-text-dialog-char-count");
|
|
3503
|
+
textarea.value = currentValue;
|
|
3504
|
+
charCount.textContent = `${currentValue.length} ${I18n.t("field.characters")}`;
|
|
3505
|
+
textarea.addEventListener("input", () => {
|
|
3506
|
+
charCount.textContent = `${textarea.value.length} ${I18n.t("field.characters")}`;
|
|
3507
|
+
});
|
|
3508
|
+
dialog.querySelector(".jdf-text-dialog-close").addEventListener("click", () => dialog.close());
|
|
3509
|
+
dialog.querySelector(".jdf-text-dialog-cancel").addEventListener("click", () => dialog.close());
|
|
3510
|
+
dialog.querySelector(".jdf-text-dialog-save").addEventListener("click", () => {
|
|
3511
|
+
const newValue = textarea.value;
|
|
3512
|
+
const oldValue = this.value;
|
|
3513
|
+
this.value = newValue;
|
|
3514
|
+
this._touched = true;
|
|
3515
|
+
this.dispatchEvent(new CustomEvent("field-change", {
|
|
3516
|
+
detail: { fieldId: this.field.id, conceptId: this.conceptId, columnId: this.columnId, value: newValue, oldValue },
|
|
3517
|
+
bubbles: true
|
|
3518
|
+
}));
|
|
3519
|
+
dialog.close();
|
|
3520
|
+
});
|
|
3521
|
+
dialog.addEventListener("click", (ev) => {
|
|
3522
|
+
const rect = dialog.getBoundingClientRect();
|
|
3523
|
+
if (ev.clientX < rect.left || ev.clientX > rect.right || ev.clientY < rect.top || ev.clientY > rect.bottom) {
|
|
3524
|
+
dialog.close();
|
|
3525
|
+
}
|
|
3526
|
+
});
|
|
3527
|
+
dialog.addEventListener("close", () => dialog.remove());
|
|
3528
|
+
document.body.appendChild(dialog);
|
|
3529
|
+
dialog.showModal();
|
|
3530
|
+
textarea.focus();
|
|
3531
|
+
}
|
|
3532
|
+
_renderTextDialogTrigger(effectiveValue, effectiveDisabled) {
|
|
3533
|
+
const hasValue = effectiveValue !== null && effectiveValue !== void 0 && String(effectiveValue).trim() !== "";
|
|
3534
|
+
const displayText = hasValue ? String(effectiveValue) : "";
|
|
3535
|
+
if (effectiveDisabled) {
|
|
3536
|
+
return html`
|
|
3537
|
+
<span class="text-readonly-label ${hasValue ? "" : "empty"}"
|
|
3538
|
+
title="${displayText}">${hasValue ? displayText : "—"}</span>
|
|
3539
|
+
`;
|
|
3540
|
+
}
|
|
3541
|
+
if (!hasValue) {
|
|
3542
|
+
return html`
|
|
3543
|
+
<button class="text-trigger-btn" type="button"
|
|
3544
|
+
aria-label="${I18n.t("field.addText")}"
|
|
3545
|
+
@click="${() => {
|
|
3546
|
+
var _a;
|
|
3547
|
+
return this._openTextDialog("", ((_a = this.field) == null ? void 0 : _a.label) || "");
|
|
3548
|
+
}}">
|
|
3549
|
+
+ ${I18n.t("field.addText")}
|
|
3550
|
+
</button>
|
|
3551
|
+
`;
|
|
3552
|
+
}
|
|
3553
|
+
return html`
|
|
3554
|
+
<div class="text-filled">
|
|
3555
|
+
<span class="text-filled-label" title="${displayText}"
|
|
3556
|
+
@click="${() => {
|
|
3557
|
+
var _a;
|
|
3558
|
+
return this._openTextDialog(displayText, ((_a = this.field) == null ? void 0 : _a.label) || "");
|
|
3559
|
+
}}">
|
|
3560
|
+
${displayText}
|
|
3561
|
+
</span>
|
|
3562
|
+
<button class="text-edit-btn" type="button"
|
|
3563
|
+
aria-label="${I18n.t("field.editText")}"
|
|
3564
|
+
@click="${() => {
|
|
3565
|
+
var _a;
|
|
3566
|
+
return this._openTextDialog(displayText, ((_a = this.field) == null ? void 0 : _a.label) || "");
|
|
3567
|
+
}}">
|
|
3568
|
+
✎ ${I18n.t("field.editText")}
|
|
3569
|
+
</button>
|
|
3570
|
+
</div>
|
|
3571
|
+
`;
|
|
3572
|
+
}
|
|
3400
3573
|
_handlePeriodChange(event, type) {
|
|
3401
3574
|
const target = event.target;
|
|
3402
3575
|
const value = target.value;
|
|
@@ -3481,19 +3654,7 @@ let JupiterFormField = class extends LitElement {
|
|
|
3481
3654
|
;
|
|
3482
3655
|
const effectiveFieldType = typeConfig.fieldType || this.field.type || "text";
|
|
3483
3656
|
if (effectiveFieldType === "textarea" || isTextareaType(effectiveFieldType)) {
|
|
3484
|
-
return
|
|
3485
|
-
<textarea
|
|
3486
|
-
id="${fieldId}"
|
|
3487
|
-
name="${fieldName}"
|
|
3488
|
-
class="${cssClass}"
|
|
3489
|
-
.value="${effectiveValue || ""}"
|
|
3490
|
-
?disabled="${effectiveDisabled || this.field.disabled}"
|
|
3491
|
-
placeholder="${typeConfig.placeholder || this.field.placeholder || ""}"
|
|
3492
|
-
@input="${this._handleInput}"
|
|
3493
|
-
@focus="${this._handleFocus}"
|
|
3494
|
-
@blur="${this._handleBlur}"
|
|
3495
|
-
></textarea>
|
|
3496
|
-
`;
|
|
3657
|
+
return this._renderTextDialogTrigger(effectiveValue, effectiveDisabled || this.field.disabled || false);
|
|
3497
3658
|
}
|
|
3498
3659
|
if (effectiveFieldType === "select" || this.field.type === "select") {
|
|
3499
3660
|
const selectOptions = typeConfig.enumerations || this.field.options || [];
|
|
@@ -3892,6 +4053,8 @@ JupiterFormField.styles = css`
|
|
|
3892
4053
|
:host {
|
|
3893
4054
|
display: block;
|
|
3894
4055
|
margin-bottom: 0px; /* Remove bottom margin for table layout */
|
|
4056
|
+
overflow: hidden;
|
|
4057
|
+
min-width: 0;
|
|
3895
4058
|
}
|
|
3896
4059
|
|
|
3897
4060
|
:host([hideLabel]) {
|
|
@@ -3919,6 +4082,8 @@ JupiterFormField.styles = css`
|
|
|
3919
4082
|
display: flex;
|
|
3920
4083
|
align-items: center;
|
|
3921
4084
|
gap: 8px;
|
|
4085
|
+
min-width: 0;
|
|
4086
|
+
overflow: hidden;
|
|
3922
4087
|
}
|
|
3923
4088
|
|
|
3924
4089
|
.period-icon-btn {
|
|
@@ -4237,6 +4402,89 @@ JupiterFormField.styles = css`
|
|
|
4237
4402
|
outline: none;
|
|
4238
4403
|
border-color: var(--jupiter-primary-color, #1976d2);
|
|
4239
4404
|
}
|
|
4405
|
+
|
|
4406
|
+
/* Text dialog trigger — empty state */
|
|
4407
|
+
.text-trigger-btn {
|
|
4408
|
+
flex: 1;
|
|
4409
|
+
min-width: 0;
|
|
4410
|
+
padding: 5px 8px;
|
|
4411
|
+
border: 1px dashed var(--jupiter-border-color, #bbb);
|
|
4412
|
+
border-radius: 4px;
|
|
4413
|
+
background: transparent;
|
|
4414
|
+
color: var(--jupiter-text-secondary, #888);
|
|
4415
|
+
font-size: 12px;
|
|
4416
|
+
cursor: pointer;
|
|
4417
|
+
text-align: center;
|
|
4418
|
+
font-family: inherit;
|
|
4419
|
+
box-sizing: border-box;
|
|
4420
|
+
}
|
|
4421
|
+
|
|
4422
|
+
.text-trigger-btn:hover {
|
|
4423
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
4424
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
4425
|
+
background: rgba(25, 118, 210, 0.04);
|
|
4426
|
+
}
|
|
4427
|
+
|
|
4428
|
+
/* Text dialog trigger — filled state */
|
|
4429
|
+
.text-filled {
|
|
4430
|
+
display: flex;
|
|
4431
|
+
align-items: center;
|
|
4432
|
+
gap: 4px;
|
|
4433
|
+
flex: 1;
|
|
4434
|
+
min-width: 0;
|
|
4435
|
+
overflow: hidden;
|
|
4436
|
+
}
|
|
4437
|
+
|
|
4438
|
+
.text-filled-label {
|
|
4439
|
+
flex: 1;
|
|
4440
|
+
font-size: 13px;
|
|
4441
|
+
color: var(--jupiter-text-primary, #333);
|
|
4442
|
+
overflow: hidden;
|
|
4443
|
+
text-overflow: ellipsis;
|
|
4444
|
+
white-space: nowrap;
|
|
4445
|
+
cursor: pointer;
|
|
4446
|
+
min-width: 0;
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
.text-filled-label:hover {
|
|
4450
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4453
|
+
.text-edit-btn {
|
|
4454
|
+
flex-shrink: 0;
|
|
4455
|
+
padding: 2px 7px;
|
|
4456
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
4457
|
+
border-radius: 3px;
|
|
4458
|
+
background: transparent;
|
|
4459
|
+
color: var(--jupiter-text-secondary, #666);
|
|
4460
|
+
font-size: 11px;
|
|
4461
|
+
cursor: pointer;
|
|
4462
|
+
font-family: inherit;
|
|
4463
|
+
white-space: nowrap;
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
.text-edit-btn:hover {
|
|
4467
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
4468
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
4469
|
+
background: rgba(25, 118, 210, 0.04);
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4472
|
+
/* Read-only filled text (disabled/inputForm) */
|
|
4473
|
+
.text-readonly-label {
|
|
4474
|
+
display: block;
|
|
4475
|
+
font-size: 13px;
|
|
4476
|
+
color: var(--jupiter-text-primary, #333);
|
|
4477
|
+
overflow: hidden;
|
|
4478
|
+
text-overflow: ellipsis;
|
|
4479
|
+
white-space: nowrap;
|
|
4480
|
+
flex: 1;
|
|
4481
|
+
min-width: 0;
|
|
4482
|
+
}
|
|
4483
|
+
|
|
4484
|
+
.text-readonly-label.empty {
|
|
4485
|
+
color: var(--jupiter-text-secondary, #999);
|
|
4486
|
+
font-style: italic;
|
|
4487
|
+
}
|
|
4240
4488
|
`;
|
|
4241
4489
|
__decorateClass$6([
|
|
4242
4490
|
n2({ type: Object })
|
|
@@ -6230,6 +6478,7 @@ JupiterFormSection.styles = css`
|
|
|
6230
6478
|
|
|
6231
6479
|
.form-table {
|
|
6232
6480
|
width: 100%;
|
|
6481
|
+
table-layout: fixed;
|
|
6233
6482
|
border-collapse: separate;
|
|
6234
6483
|
border-spacing: 0;
|
|
6235
6484
|
background: var(--jupiter-table-background, #fff);
|