@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/esm/index.js
CHANGED
|
@@ -56,13 +56,6 @@ function addFormatHint(element, parts, state) {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function addRequiredHint(element, parts, state) {
|
|
60
|
-
if (element.required) {
|
|
61
|
-
parts.push(t("hintRequired", state));
|
|
62
|
-
} else {
|
|
63
|
-
parts.push(t("hintOptional", state));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
59
|
function addPatternHint(element, parts, state) {
|
|
67
60
|
if (element.pattern) {
|
|
68
61
|
parts.push(t("hintPattern", state, { pattern: element.pattern }));
|
|
@@ -70,7 +63,6 @@ function addPatternHint(element, parts, state) {
|
|
|
70
63
|
}
|
|
71
64
|
function makeFieldHint(element, state) {
|
|
72
65
|
const parts = [];
|
|
73
|
-
addRequiredHint(element, parts, state);
|
|
74
66
|
addLengthHint(element, parts, state);
|
|
75
67
|
if (element.type !== "slider") {
|
|
76
68
|
addRangeHint(element, parts, state);
|
|
@@ -1294,10 +1286,12 @@ function renderSelectElement(element, ctx, wrapper, pathKey) {
|
|
|
1294
1286
|
selectInput.addEventListener("change", handleChange);
|
|
1295
1287
|
}
|
|
1296
1288
|
wrapper.appendChild(selectInput);
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1289
|
+
if (!state.config.readonly) {
|
|
1290
|
+
const selectHint = document.createElement("p");
|
|
1291
|
+
selectHint.className = "text-xs text-gray-500 mt-1";
|
|
1292
|
+
selectHint.textContent = makeFieldHint(element, state);
|
|
1293
|
+
wrapper.appendChild(selectHint);
|
|
1294
|
+
}
|
|
1301
1295
|
}
|
|
1302
1296
|
function renderMultipleSelectElement(element, ctx, wrapper, pathKey) {
|
|
1303
1297
|
const state = ctx.state;
|
|
@@ -1430,10 +1424,12 @@ function renderMultipleSelectElement(element, ctx, wrapper, pathKey) {
|
|
|
1430
1424
|
values.forEach((value) => addSelectItem(value));
|
|
1431
1425
|
updateAddButton();
|
|
1432
1426
|
updateRemoveButtons();
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1427
|
+
if (!state.config.readonly) {
|
|
1428
|
+
const hint = document.createElement("p");
|
|
1429
|
+
hint.className = "text-xs text-gray-500 mt-1";
|
|
1430
|
+
hint.textContent = makeFieldHint(element, state);
|
|
1431
|
+
wrapper.appendChild(hint);
|
|
1432
|
+
}
|
|
1437
1433
|
}
|
|
1438
1434
|
function validateSelectElement(element, key, context) {
|
|
1439
1435
|
const errors = [];
|
|
@@ -2859,14 +2855,16 @@ function renderColourElement(element, ctx, wrapper, pathKey) {
|
|
|
2859
2855
|
const editUI = createEditColourUI(initialValue, pathKey, ctx);
|
|
2860
2856
|
wrapper.appendChild(editUI);
|
|
2861
2857
|
}
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2858
|
+
if (!state.config.readonly) {
|
|
2859
|
+
const colourHint = document.createElement("p");
|
|
2860
|
+
colourHint.className = "mt-1";
|
|
2861
|
+
colourHint.style.cssText = `
|
|
2862
|
+
font-size: var(--fb-font-size-small);
|
|
2863
|
+
color: var(--fb-text-secondary-color);
|
|
2864
|
+
`;
|
|
2865
|
+
colourHint.textContent = makeFieldHint(element, state);
|
|
2866
|
+
wrapper.appendChild(colourHint);
|
|
2867
|
+
}
|
|
2870
2868
|
}
|
|
2871
2869
|
function renderMultipleColourElement(element, ctx, wrapper, pathKey) {
|
|
2872
2870
|
const state = ctx.state;
|
|
@@ -3004,14 +3002,16 @@ function renderMultipleColourElement(element, ctx, wrapper, pathKey) {
|
|
|
3004
3002
|
values.forEach((value) => addColourItem(value));
|
|
3005
3003
|
updateAddButton();
|
|
3006
3004
|
updateRemoveButtons();
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3005
|
+
if (!state.config.readonly) {
|
|
3006
|
+
const hint = document.createElement("p");
|
|
3007
|
+
hint.className = "mt-1";
|
|
3008
|
+
hint.style.cssText = `
|
|
3009
|
+
font-size: var(--fb-font-size-small);
|
|
3010
|
+
color: var(--fb-text-secondary-color);
|
|
3011
|
+
`;
|
|
3012
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3013
|
+
wrapper.appendChild(hint);
|
|
3014
|
+
}
|
|
3015
3015
|
}
|
|
3016
3016
|
function validateColourElement(element, key, context) {
|
|
3017
3017
|
const errors = [];
|
|
@@ -3323,14 +3323,16 @@ function renderSliderElement(element, ctx, wrapper, pathKey) {
|
|
|
3323
3323
|
state.config.readonly
|
|
3324
3324
|
);
|
|
3325
3325
|
wrapper.appendChild(sliderUI);
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3326
|
+
if (!state.config.readonly) {
|
|
3327
|
+
const hint = document.createElement("p");
|
|
3328
|
+
hint.className = "mt-1";
|
|
3329
|
+
hint.style.cssText = `
|
|
3330
|
+
font-size: var(--fb-font-size-small);
|
|
3331
|
+
color: var(--fb-text-secondary-color);
|
|
3332
|
+
`;
|
|
3333
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3334
|
+
wrapper.appendChild(hint);
|
|
3335
|
+
}
|
|
3334
3336
|
}
|
|
3335
3337
|
function renderMultipleSliderElement(element, ctx, wrapper, pathKey) {
|
|
3336
3338
|
if (element.min === void 0 || element.min === null) {
|
|
@@ -3479,14 +3481,16 @@ function renderMultipleSliderElement(element, ctx, wrapper, pathKey) {
|
|
|
3479
3481
|
values.forEach((value) => addSliderItem(value));
|
|
3480
3482
|
updateAddButton();
|
|
3481
3483
|
updateRemoveButtons();
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3484
|
+
if (!state.config.readonly) {
|
|
3485
|
+
const hint = document.createElement("p");
|
|
3486
|
+
hint.className = "mt-1";
|
|
3487
|
+
hint.style.cssText = `
|
|
3488
|
+
font-size: var(--fb-font-size-small);
|
|
3489
|
+
color: var(--fb-text-secondary-color);
|
|
3490
|
+
`;
|
|
3491
|
+
hint.textContent = makeFieldHint(element, state);
|
|
3492
|
+
wrapper.appendChild(hint);
|
|
3493
|
+
}
|
|
3490
3494
|
}
|
|
3491
3495
|
function validateSliderElement(element, key, context) {
|
|
3492
3496
|
const errors = [];
|