@dmitryvim/form-builder 0.2.12 → 0.2.13
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/browser/formbuilder.min.js +80 -80
- package/dist/browser/formbuilder.v0.2.13.min.js +362 -0
- package/dist/cjs/index.cjs +52 -48
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +52 -48
- package/dist/esm/index.js.map +1 -1
- package/dist/form-builder.js +80 -80
- package/package.json +1 -1
- package/dist/browser/formbuilder.v0.2.12.min.js +0 -362
package/dist/cjs/index.cjs
CHANGED
|
@@ -61,13 +61,6 @@ function addFormatHint(element, parts, state) {
|
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function addRequiredHint(element, parts, state) {
|
|
65
|
-
if (element.required) {
|
|
66
|
-
parts.push(t("hintRequired", state));
|
|
67
|
-
} else {
|
|
68
|
-
parts.push(t("hintOptional", state));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
64
|
function addPatternHint(element, parts, state) {
|
|
72
65
|
if (element.pattern) {
|
|
73
66
|
parts.push(t("hintPattern", state, { pattern: element.pattern }));
|
|
@@ -75,7 +68,6 @@ function addPatternHint(element, parts, state) {
|
|
|
75
68
|
}
|
|
76
69
|
function makeFieldHint(element, state) {
|
|
77
70
|
const parts = [];
|
|
78
|
-
addRequiredHint(element, parts, state);
|
|
79
71
|
addLengthHint(element, parts, state);
|
|
80
72
|
if (element.type !== "slider") {
|
|
81
73
|
addRangeHint(element, parts, state);
|
|
@@ -1309,10 +1301,12 @@ function renderSelectElement(element, ctx, wrapper, pathKey) {
|
|
|
1309
1301
|
selectInput.addEventListener("change", handleChange);
|
|
1310
1302
|
}
|
|
1311
1303
|
wrapper.appendChild(selectInput);
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1304
|
+
if (!state.config.readonly) {
|
|
1305
|
+
const selectHint = document.createElement("p");
|
|
1306
|
+
selectHint.className = "text-xs text-gray-500 mt-1";
|
|
1307
|
+
selectHint.textContent = makeFieldHint(element, state);
|
|
1308
|
+
wrapper.appendChild(selectHint);
|
|
1309
|
+
}
|
|
1316
1310
|
}
|
|
1317
1311
|
function renderMultipleSelectElement(element, ctx, wrapper, pathKey) {
|
|
1318
1312
|
var _a, _b, _c, _d;
|
|
@@ -1447,10 +1441,12 @@ function renderMultipleSelectElement(element, ctx, wrapper, pathKey) {
|
|
|
1447
1441
|
values.forEach((value) => addSelectItem(value));
|
|
1448
1442
|
updateAddButton();
|
|
1449
1443
|
updateRemoveButtons();
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1444
|
+
if (!state.config.readonly) {
|
|
1445
|
+
const hint = document.createElement("p");
|
|
1446
|
+
hint.className = "text-xs text-gray-500 mt-1";
|
|
1447
|
+
hint.textContent = makeFieldHint(element, state);
|
|
1448
|
+
wrapper.appendChild(hint);
|
|
1449
|
+
}
|
|
1454
1450
|
}
|
|
1455
1451
|
function validateSelectElement(element, key, context) {
|
|
1456
1452
|
var _a;
|
|
@@ -2897,14 +2893,16 @@ function renderColourElement(element, ctx, wrapper, pathKey) {
|
|
|
2897
2893
|
const editUI = createEditColourUI(initialValue, pathKey, ctx);
|
|
2898
2894
|
wrapper.appendChild(editUI);
|
|
2899
2895
|
}
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2896
|
+
if (!state.config.readonly) {
|
|
2897
|
+
const colourHint = document.createElement("p");
|
|
2898
|
+
colourHint.className = "mt-1";
|
|
2899
|
+
colourHint.style.cssText = `
|
|
2900
|
+
font-size: var(--fb-font-size-small);
|
|
2901
|
+
color: var(--fb-text-secondary-color);
|
|
2902
|
+
`;
|
|
2903
|
+
colourHint.textContent = makeFieldHint(element, state);
|
|
2904
|
+
wrapper.appendChild(colourHint);
|
|
2905
|
+
}
|
|
2908
2906
|
}
|
|
2909
2907
|
function renderMultipleColourElement(element, ctx, wrapper, pathKey) {
|
|
2910
2908
|
var _a, _b;
|
|
@@ -3043,14 +3041,16 @@ function renderMultipleColourElement(element, ctx, wrapper, pathKey) {
|
|
|
3043
3041
|
values.forEach((value) => addColourItem(value));
|
|
3044
3042
|
updateAddButton();
|
|
3045
3043
|
updateRemoveButtons();
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3044
|
+
if (!state.config.readonly) {
|
|
3045
|
+
const hint = document.createElement("p");
|
|
3046
|
+
hint.className = "mt-1";
|
|
3047
|
+
hint.style.cssText = `
|
|
3048
|
+
font-size: var(--fb-font-size-small);
|
|
3049
|
+
color: var(--fb-text-secondary-color);
|
|
3050
|
+
`;
|
|
3051
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3052
|
+
wrapper.appendChild(hint);
|
|
3053
|
+
}
|
|
3054
3054
|
}
|
|
3055
3055
|
function validateColourElement(element, key, context) {
|
|
3056
3056
|
var _a, _b, _c;
|
|
@@ -3367,14 +3367,16 @@ function renderSliderElement(element, ctx, wrapper, pathKey) {
|
|
|
3367
3367
|
state.config.readonly
|
|
3368
3368
|
);
|
|
3369
3369
|
wrapper.appendChild(sliderUI);
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3370
|
+
if (!state.config.readonly) {
|
|
3371
|
+
const hint = document.createElement("p");
|
|
3372
|
+
hint.className = "mt-1";
|
|
3373
|
+
hint.style.cssText = `
|
|
3374
|
+
font-size: var(--fb-font-size-small);
|
|
3375
|
+
color: var(--fb-text-secondary-color);
|
|
3376
|
+
`;
|
|
3377
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3378
|
+
wrapper.appendChild(hint);
|
|
3379
|
+
}
|
|
3378
3380
|
}
|
|
3379
3381
|
function renderMultipleSliderElement(element, ctx, wrapper, pathKey) {
|
|
3380
3382
|
var _a, _b;
|
|
@@ -3524,14 +3526,16 @@ function renderMultipleSliderElement(element, ctx, wrapper, pathKey) {
|
|
|
3524
3526
|
values.forEach((value) => addSliderItem(value));
|
|
3525
3527
|
updateAddButton();
|
|
3526
3528
|
updateRemoveButtons();
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3529
|
+
if (!state.config.readonly) {
|
|
3530
|
+
const hint = document.createElement("p");
|
|
3531
|
+
hint.className = "mt-1";
|
|
3532
|
+
hint.style.cssText = `
|
|
3533
|
+
font-size: var(--fb-font-size-small);
|
|
3534
|
+
color: var(--fb-text-secondary-color);
|
|
3535
|
+
`;
|
|
3536
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3537
|
+
wrapper.appendChild(hint);
|
|
3538
|
+
}
|
|
3535
3539
|
}
|
|
3536
3540
|
function validateSliderElement(element, key, context) {
|
|
3537
3541
|
var _a, _b, _c;
|