@dmitryvim/form-builder 0.5.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/esm/index.js CHANGED
@@ -3043,34 +3043,12 @@ function ensureFileStyles() {
3043
3043
  padding: 6px;
3044
3044
  }
3045
3045
 
3046
- /* \u2500\u2500\u2500 Meta line below multi grid \u2500\u2500\u2500 */
3047
- .fb-meta-line {
3046
+ /* \u2500\u2500\u2500 Clear-all row below multi grid \u2500\u2500\u2500 */
3047
+ .fb-clear-all-row {
3048
3048
  margin-top: 10px;
3049
3049
  display: flex;
3050
3050
  align-items: center;
3051
- justify-content: space-between;
3052
- gap: 8px;
3053
- flex-wrap: wrap;
3054
- }
3055
- .fb-meta-text {
3056
- font-size: 12px;
3057
- color: #94a3b8;
3058
- display: flex;
3059
- align-items: center;
3060
- gap: 8px;
3061
- flex-wrap: wrap;
3062
- }
3063
- .fb-meta-dot {
3064
- width: 4px;
3065
- height: 4px;
3066
- border-radius: 50%;
3067
- background: #cbd5e1;
3068
- flex-shrink: 0;
3069
- }
3070
- .fb-meta-mono {
3071
- font-family: ui-monospace, 'JetBrains Mono', monospace;
3072
- font-size: 11px;
3073
- letter-spacing: -0.02em;
3051
+ justify-content: flex-end;
3074
3052
  }
3075
3053
  .fb-clear-all-btn {
3076
3054
  font-size: 12px;
@@ -4860,58 +4838,22 @@ function buildPlaceholderTile(isDragOver = false) {
4860
4838
  div.className = `fb-multi-placeholder fb-checker${isDragOver ? " fb-drag-over" : ""}`;
4861
4839
  return div;
4862
4840
  }
4863
- function buildMetaLine(state, element, ridCount, maxCount, canClearAll, onClearAll) {
4864
- const line = document.createElement("div");
4865
- line.className = "fb-meta-line";
4866
- const metaText = document.createElement("div");
4867
- metaText.className = "fb-meta-text";
4868
- if (element.maxSize && element.maxSize !== Infinity) {
4869
- const sizeSpan = document.createElement("span");
4870
- sizeSpan.textContent = t("hintMaxSize", state, { size: element.maxSize });
4871
- metaText.appendChild(sizeSpan);
4872
- metaText.appendChild(buildMetaDot());
4873
- }
4874
- const exts = getAllowedExtensions(
4875
- element.accept
4876
- );
4877
- if (exts.length > 0) {
4878
- const fmtSpan = document.createElement("span");
4879
- fmtSpan.className = "fb-meta-mono";
4880
- fmtSpan.textContent = exts.map((e) => e.toUpperCase()).join(", ");
4881
- metaText.appendChild(fmtSpan);
4882
- metaText.appendChild(buildMetaDot());
4883
- }
4884
- const countSpan = document.createElement("span");
4885
- if (maxCount < Infinity) {
4886
- countSpan.textContent = t("fileCountWithMax", state, {
4887
- count: ridCount,
4888
- max: maxCount
4889
- });
4890
- } else {
4891
- const countKey = ridCount === 1 ? "fileCountSingle" : "fileCountPlural";
4892
- countSpan.textContent = t(countKey, state, { count: ridCount });
4893
- }
4894
- metaText.appendChild(countSpan);
4895
- line.appendChild(metaText);
4896
- if (canClearAll && ridCount > 1) {
4897
- const clearBtn = document.createElement("button");
4898
- clearBtn.type = "button";
4899
- clearBtn.className = "fb-clear-all-btn";
4900
- clearBtn.textContent = t("clearAll", state);
4901
- clearBtn.onclick = (e) => {
4902
- e.stopPropagation();
4903
- if (window.confirm(t("clearAll", state) + "?")) {
4904
- onClearAll();
4905
- }
4906
- };
4907
- line.appendChild(clearBtn);
4908
- }
4909
- return line;
4910
- }
4911
- function buildMetaDot() {
4912
- const dot = document.createElement("span");
4913
- dot.className = "fb-meta-dot";
4914
- return dot;
4841
+ function buildClearAllRow(state, ridCount, onClearAll) {
4842
+ if (ridCount <= 1) return null;
4843
+ const row = document.createElement("div");
4844
+ row.className = "fb-clear-all-row";
4845
+ const clearBtn = document.createElement("button");
4846
+ clearBtn.type = "button";
4847
+ clearBtn.className = "fb-clear-all-btn";
4848
+ clearBtn.textContent = t("clearAll", state);
4849
+ clearBtn.onclick = (e) => {
4850
+ e.stopPropagation();
4851
+ if (window.confirm(t("clearAll", state) + "?")) {
4852
+ onClearAll();
4853
+ }
4854
+ };
4855
+ row.appendChild(clearBtn);
4856
+ return row;
4915
4857
  }
4916
4858
  var gridResizeObservers = /* @__PURE__ */ new WeakMap();
4917
4859
  function disposePlaceholdersForUpload(container) {
@@ -4931,7 +4873,6 @@ function renderResourcePills(opts) {
4931
4873
  maxCount,
4932
4874
  isReadonly = false,
4933
4875
  onLibraryPick,
4934
- element,
4935
4876
  onClearAll,
4936
4877
  openPicker: openPickerProp
4937
4878
  } = opts;
@@ -5075,17 +5016,9 @@ function renderResourcePills(opts) {
5075
5016
  }
5076
5017
  }
5077
5018
  });
5078
- if (element) {
5079
- const metaLine = buildMetaLine(
5080
- state,
5081
- element,
5082
- ridList.length,
5083
- effectiveMax,
5084
- Boolean(onClearAll),
5085
- onClearAll ?? (() => {
5086
- })
5087
- );
5088
- container.appendChild(metaLine);
5019
+ if (onClearAll) {
5020
+ const row = buildClearAllRow(state, ridList.length, onClearAll);
5021
+ if (row) container.appendChild(row);
5089
5022
  }
5090
5023
  }
5091
5024
  function renderFileElementEdit(element, ctx, wrapper, pathKey) {
@@ -5309,7 +5242,6 @@ function setupMultiFileEditMode(element, ctx, wrapper, pathKey, maxFiles) {
5309
5242
  maxCount: maxFiles < Infinity ? maxFiles : void 0,
5310
5243
  isReadonly: currentlyReadonly,
5311
5244
  onLibraryPick: currentlyReadonly ? null : onLibraryPick,
5312
- element,
5313
5245
  onClearAll: currentlyReadonly ? void 0 : () => {
5314
5246
  for (const rid of initialFiles) {
5315
5247
  releaseLocalFileUrl(state.resourceIndex.get(rid)?.file);
@@ -10737,9 +10669,6 @@ var defaultConfig = {
10737
10669
  hintRequired: "Required",
10738
10670
  hintOptional: "Optional",
10739
10671
  hintPattern: "Format: {pattern}",
10740
- fileCountSingle: "{count} file",
10741
- fileCountPlural: "{count} files",
10742
- fileCountWithMax: "{count} / {max} files",
10743
10672
  fileCountRange: "({min}-{max})",
10744
10673
  uploadingFile: "Uploading\u2026",
10745
10674
  filesCounter: "{count}/{max}",
@@ -10813,9 +10742,6 @@ var defaultConfig = {
10813
10742
  hintRequired: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
10814
10743
  hintOptional: "\u041D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
10815
10744
  hintPattern: "\u0424\u043E\u0440\u043C\u0430\u0442: {pattern}",
10816
- fileCountSingle: "{count} \u0444\u0430\u0439\u043B",
10817
- fileCountPlural: "{count} \u0444\u0430\u0439\u043B\u043E\u0432",
10818
- fileCountWithMax: "{count} / {max} \u0444\u0430\u0439\u043B\u043E\u0432",
10819
10745
  fileCountRange: "({min}-{max})",
10820
10746
  uploadingFile: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
10821
10747
  filesCounter: "{count}/{max}",