@dmitryvim/form-builder 0.4.0 → 0.5.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/browser/formbuilder.min.js +106 -114
- package/dist/browser/{formbuilder.v0.4.0.min.js → formbuilder.v0.5.1.min.js} +106 -114
- package/dist/cjs/index.cjs +46 -125
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +46 -125
- package/dist/esm/index.js.map +1 -1
- package/dist/form-builder.js +106 -114
- package/dist/types/components/file/render-edit.d.ts +0 -4
- package/dist/types/types/config.d.ts +6 -3
- package/dist/types/types/schema.d.ts +9 -2
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -427,6 +427,20 @@ function ensureThemingHooks(doc) {
|
|
|
427
427
|
min-height: var(--fb-slide-card-min-height);
|
|
428
428
|
padding: var(--fb-slide-card-padding);
|
|
429
429
|
}
|
|
430
|
+
/* Slides-mode outer grid. Responsive by design \u2014 column count derives from
|
|
431
|
+
container width and --fb-slide-min-width, not from a schema "columns" prop.
|
|
432
|
+
min(100%, ...) prevents the card from overflowing a narrow container.
|
|
433
|
+
Override per-form: set --fb-slide-min-width / --fb-slides-gap on any
|
|
434
|
+
ancestor (theme, host CSS, or the form root). */
|
|
435
|
+
.fb-container-slides {
|
|
436
|
+
display: grid;
|
|
437
|
+
gap: var(--fb-slides-gap, 14px);
|
|
438
|
+
align-items: stretch;
|
|
439
|
+
grid-template-columns: repeat(
|
|
440
|
+
auto-fit,
|
|
441
|
+
minmax(min(100%, var(--fb-slide-min-width, 280px)), 1fr)
|
|
442
|
+
);
|
|
443
|
+
}
|
|
430
444
|
[data-fb-label-row] > label {
|
|
431
445
|
font-size: var(--fb-label-section-font-size);
|
|
432
446
|
letter-spacing: var(--fb-label-section-letter-spacing);
|
|
@@ -3077,34 +3091,12 @@ function ensureFileStyles() {
|
|
|
3077
3091
|
padding: 6px;
|
|
3078
3092
|
}
|
|
3079
3093
|
|
|
3080
|
-
/* \u2500\u2500\u2500
|
|
3081
|
-
.fb-
|
|
3094
|
+
/* \u2500\u2500\u2500 Clear-all row below multi grid \u2500\u2500\u2500 */
|
|
3095
|
+
.fb-clear-all-row {
|
|
3082
3096
|
margin-top: 10px;
|
|
3083
3097
|
display: flex;
|
|
3084
3098
|
align-items: center;
|
|
3085
|
-
justify-content:
|
|
3086
|
-
gap: 8px;
|
|
3087
|
-
flex-wrap: wrap;
|
|
3088
|
-
}
|
|
3089
|
-
.fb-meta-text {
|
|
3090
|
-
font-size: 12px;
|
|
3091
|
-
color: #94a3b8;
|
|
3092
|
-
display: flex;
|
|
3093
|
-
align-items: center;
|
|
3094
|
-
gap: 8px;
|
|
3095
|
-
flex-wrap: wrap;
|
|
3096
|
-
}
|
|
3097
|
-
.fb-meta-dot {
|
|
3098
|
-
width: 4px;
|
|
3099
|
-
height: 4px;
|
|
3100
|
-
border-radius: 50%;
|
|
3101
|
-
background: #cbd5e1;
|
|
3102
|
-
flex-shrink: 0;
|
|
3103
|
-
}
|
|
3104
|
-
.fb-meta-mono {
|
|
3105
|
-
font-family: ui-monospace, 'JetBrains Mono', monospace;
|
|
3106
|
-
font-size: 11px;
|
|
3107
|
-
letter-spacing: -0.02em;
|
|
3099
|
+
justify-content: flex-end;
|
|
3108
3100
|
}
|
|
3109
3101
|
.fb-clear-all-btn {
|
|
3110
3102
|
font-size: 12px;
|
|
@@ -4924,58 +4916,22 @@ function buildPlaceholderTile(isDragOver = false) {
|
|
|
4924
4916
|
div.className = `fb-multi-placeholder fb-checker${isDragOver ? " fb-drag-over" : ""}`;
|
|
4925
4917
|
return div;
|
|
4926
4918
|
}
|
|
4927
|
-
function
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
fmtSpan.className = "fb-meta-mono";
|
|
4944
|
-
fmtSpan.textContent = exts.map((e) => e.toUpperCase()).join(", ");
|
|
4945
|
-
metaText.appendChild(fmtSpan);
|
|
4946
|
-
metaText.appendChild(buildMetaDot());
|
|
4947
|
-
}
|
|
4948
|
-
const countSpan = document.createElement("span");
|
|
4949
|
-
if (maxCount < Infinity) {
|
|
4950
|
-
countSpan.textContent = t("fileCountWithMax", state, {
|
|
4951
|
-
count: ridCount,
|
|
4952
|
-
max: maxCount
|
|
4953
|
-
});
|
|
4954
|
-
} else {
|
|
4955
|
-
const countKey = ridCount === 1 ? "fileCountSingle" : "fileCountPlural";
|
|
4956
|
-
countSpan.textContent = t(countKey, state, { count: ridCount });
|
|
4957
|
-
}
|
|
4958
|
-
metaText.appendChild(countSpan);
|
|
4959
|
-
line.appendChild(metaText);
|
|
4960
|
-
if (canClearAll && ridCount > 1) {
|
|
4961
|
-
const clearBtn = document.createElement("button");
|
|
4962
|
-
clearBtn.type = "button";
|
|
4963
|
-
clearBtn.className = "fb-clear-all-btn";
|
|
4964
|
-
clearBtn.textContent = t("clearAll", state);
|
|
4965
|
-
clearBtn.onclick = (e) => {
|
|
4966
|
-
e.stopPropagation();
|
|
4967
|
-
if (window.confirm(t("clearAll", state) + "?")) {
|
|
4968
|
-
onClearAll();
|
|
4969
|
-
}
|
|
4970
|
-
};
|
|
4971
|
-
line.appendChild(clearBtn);
|
|
4972
|
-
}
|
|
4973
|
-
return line;
|
|
4974
|
-
}
|
|
4975
|
-
function buildMetaDot() {
|
|
4976
|
-
const dot = document.createElement("span");
|
|
4977
|
-
dot.className = "fb-meta-dot";
|
|
4978
|
-
return dot;
|
|
4919
|
+
function buildClearAllRow(state, ridCount, onClearAll) {
|
|
4920
|
+
if (ridCount <= 1) return null;
|
|
4921
|
+
const row = document.createElement("div");
|
|
4922
|
+
row.className = "fb-clear-all-row";
|
|
4923
|
+
const clearBtn = document.createElement("button");
|
|
4924
|
+
clearBtn.type = "button";
|
|
4925
|
+
clearBtn.className = "fb-clear-all-btn";
|
|
4926
|
+
clearBtn.textContent = t("clearAll", state);
|
|
4927
|
+
clearBtn.onclick = (e) => {
|
|
4928
|
+
e.stopPropagation();
|
|
4929
|
+
if (window.confirm(t("clearAll", state) + "?")) {
|
|
4930
|
+
onClearAll();
|
|
4931
|
+
}
|
|
4932
|
+
};
|
|
4933
|
+
row.appendChild(clearBtn);
|
|
4934
|
+
return row;
|
|
4979
4935
|
}
|
|
4980
4936
|
var gridResizeObservers = /* @__PURE__ */ new WeakMap();
|
|
4981
4937
|
function disposePlaceholdersForUpload(container) {
|
|
@@ -4996,7 +4952,6 @@ function renderResourcePills(opts) {
|
|
|
4996
4952
|
maxCount,
|
|
4997
4953
|
isReadonly = false,
|
|
4998
4954
|
onLibraryPick,
|
|
4999
|
-
element,
|
|
5000
4955
|
onClearAll,
|
|
5001
4956
|
openPicker: openPickerProp
|
|
5002
4957
|
} = opts;
|
|
@@ -5142,17 +5097,9 @@ function renderResourcePills(opts) {
|
|
|
5142
5097
|
}
|
|
5143
5098
|
}
|
|
5144
5099
|
});
|
|
5145
|
-
if (
|
|
5146
|
-
const
|
|
5147
|
-
|
|
5148
|
-
element,
|
|
5149
|
-
ridList.length,
|
|
5150
|
-
effectiveMax,
|
|
5151
|
-
Boolean(onClearAll),
|
|
5152
|
-
onClearAll != null ? onClearAll : (() => {
|
|
5153
|
-
})
|
|
5154
|
-
);
|
|
5155
|
-
container.appendChild(metaLine);
|
|
5100
|
+
if (onClearAll) {
|
|
5101
|
+
const row = buildClearAllRow(state, ridList.length, onClearAll);
|
|
5102
|
+
if (row) container.appendChild(row);
|
|
5156
5103
|
}
|
|
5157
5104
|
}
|
|
5158
5105
|
function renderFileElementEdit(element, ctx, wrapper, pathKey) {
|
|
@@ -5381,7 +5328,6 @@ function setupMultiFileEditMode(element, ctx, wrapper, pathKey, maxFiles) {
|
|
|
5381
5328
|
maxCount: maxFiles < Infinity ? maxFiles : void 0,
|
|
5382
5329
|
isReadonly: currentlyReadonly,
|
|
5383
5330
|
onLibraryPick: currentlyReadonly ? null : onLibraryPick,
|
|
5384
|
-
element,
|
|
5385
5331
|
onClearAll: currentlyReadonly ? void 0 : () => {
|
|
5386
5332
|
var _a2, _b2;
|
|
5387
5333
|
for (const rid of initialFiles) {
|
|
@@ -6896,10 +6842,7 @@ function renderSingleContainerElement(element, ctx, wrapper, pathKey) {
|
|
|
6896
6842
|
containerWrap.appendChild(itemsWrap);
|
|
6897
6843
|
wrapper.appendChild(containerWrap);
|
|
6898
6844
|
}
|
|
6899
|
-
function getChildWrapperClass(
|
|
6900
|
-
if (isSlides) {
|
|
6901
|
-
return "fb-row";
|
|
6902
|
-
}
|
|
6845
|
+
function getChildWrapperClass(columns) {
|
|
6903
6846
|
const cols = columns || 1;
|
|
6904
6847
|
return cols === 1 ? "fb-row" : `grid grid-cols-${cols} gap-2`;
|
|
6905
6848
|
}
|
|
@@ -6945,9 +6888,6 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
|
|
|
6945
6888
|
const isSlides = element.displayMode === "slides";
|
|
6946
6889
|
if (isSlides) {
|
|
6947
6890
|
itemsWrap.className = "fb-container-slides";
|
|
6948
|
-
const slideCols = element.columns;
|
|
6949
|
-
const gridTemplateColumns = typeof slideCols === "number" && slideCols > 0 ? `repeat(${slideCols}, 1fr)` : "repeat(auto-fit, minmax(280px, 1fr))";
|
|
6950
|
-
itemsWrap.style.cssText = `display:grid;grid-template-columns:${gridTemplateColumns};gap:var(--fb-slides-gap, 14px);align-items:start;`;
|
|
6951
6891
|
} else {
|
|
6952
6892
|
itemsWrap.className = "fb-row";
|
|
6953
6893
|
}
|
|
@@ -6983,7 +6923,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
|
|
|
6983
6923
|
item.setAttribute("data-fb-slide-card", "");
|
|
6984
6924
|
}
|
|
6985
6925
|
const childWrapper = document.createElement("div");
|
|
6986
|
-
childWrapper.className = getChildWrapperClass(
|
|
6926
|
+
childWrapper.className = getChildWrapperClass(
|
|
6927
|
+
isSlides ? void 0 : element.columns
|
|
6928
|
+
);
|
|
6987
6929
|
element.elements.forEach((child) => {
|
|
6988
6930
|
var _a2;
|
|
6989
6931
|
if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
|
|
@@ -7051,16 +6993,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
|
|
|
7051
6993
|
item.setAttribute("data-fb-slide-card", "");
|
|
7052
6994
|
}
|
|
7053
6995
|
const childWrapper = document.createElement("div");
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
const columns = element.columns || 1;
|
|
7058
|
-
if (columns === 1) {
|
|
7059
|
-
childWrapper.className = "fb-row";
|
|
7060
|
-
} else {
|
|
7061
|
-
childWrapper.className = `grid grid-cols-${columns} gap-2`;
|
|
7062
|
-
}
|
|
7063
|
-
}
|
|
6996
|
+
childWrapper.className = getChildWrapperClass(
|
|
6997
|
+
isSlides ? void 0 : element.columns
|
|
6998
|
+
);
|
|
7064
6999
|
element.elements.forEach((child) => {
|
|
7065
7000
|
var _a3, _b2;
|
|
7066
7001
|
if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
|
|
@@ -7099,16 +7034,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
|
|
|
7099
7034
|
item.setAttribute("data-fb-slide-card", "");
|
|
7100
7035
|
}
|
|
7101
7036
|
const childWrapper = document.createElement("div");
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
const columns = element.columns || 1;
|
|
7106
|
-
if (columns === 1) {
|
|
7107
|
-
childWrapper.className = "fb-row";
|
|
7108
|
-
} else {
|
|
7109
|
-
childWrapper.className = `grid grid-cols-${columns} gap-2`;
|
|
7110
|
-
}
|
|
7111
|
-
}
|
|
7037
|
+
childWrapper.className = getChildWrapperClass(
|
|
7038
|
+
isSlides ? void 0 : element.columns
|
|
7039
|
+
);
|
|
7112
7040
|
element.elements.forEach((child) => {
|
|
7113
7041
|
var _a2;
|
|
7114
7042
|
if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
|
|
@@ -7138,7 +7066,6 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
|
|
|
7138
7066
|
containerWrap.appendChild(itemsWrap);
|
|
7139
7067
|
if (!containerIsReadonly) {
|
|
7140
7068
|
if (isSlides) {
|
|
7141
|
-
itemsWrap.style.alignItems = "stretch";
|
|
7142
7069
|
const handle = createSlideAddTile(handleAddItem, {
|
|
7143
7070
|
label: element.addLabel
|
|
7144
7071
|
});
|
|
@@ -10934,9 +10861,6 @@ var defaultConfig = {
|
|
|
10934
10861
|
hintRequired: "Required",
|
|
10935
10862
|
hintOptional: "Optional",
|
|
10936
10863
|
hintPattern: "Format: {pattern}",
|
|
10937
|
-
fileCountSingle: "{count} file",
|
|
10938
|
-
fileCountPlural: "{count} files",
|
|
10939
|
-
fileCountWithMax: "{count} / {max} files",
|
|
10940
10864
|
fileCountRange: "({min}-{max})",
|
|
10941
10865
|
uploadingFile: "Uploading\u2026",
|
|
10942
10866
|
filesCounter: "{count}/{max}",
|
|
@@ -11010,9 +10934,6 @@ var defaultConfig = {
|
|
|
11010
10934
|
hintRequired: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
|
|
11011
10935
|
hintOptional: "\u041D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
|
|
11012
10936
|
hintPattern: "\u0424\u043E\u0440\u043C\u0430\u0442: {pattern}",
|
|
11013
|
-
fileCountSingle: "{count} \u0444\u0430\u0439\u043B",
|
|
11014
|
-
fileCountPlural: "{count} \u0444\u0430\u0439\u043B\u043E\u0432",
|
|
11015
|
-
fileCountWithMax: "{count} / {max} \u0444\u0430\u0439\u043B\u043E\u0432",
|
|
11016
10937
|
fileCountRange: "({min}-{max})",
|
|
11017
10938
|
uploadingFile: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
|
|
11018
10939
|
filesCounter: "{count}/{max}",
|