@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.
@@ -3091,34 +3091,12 @@ function ensureFileStyles() {
3091
3091
  padding: 6px;
3092
3092
  }
3093
3093
 
3094
- /* \u2500\u2500\u2500 Meta line below multi grid \u2500\u2500\u2500 */
3095
- .fb-meta-line {
3094
+ /* \u2500\u2500\u2500 Clear-all row below multi grid \u2500\u2500\u2500 */
3095
+ .fb-clear-all-row {
3096
3096
  margin-top: 10px;
3097
3097
  display: flex;
3098
3098
  align-items: center;
3099
- justify-content: space-between;
3100
- gap: 8px;
3101
- flex-wrap: wrap;
3102
- }
3103
- .fb-meta-text {
3104
- font-size: 12px;
3105
- color: #94a3b8;
3106
- display: flex;
3107
- align-items: center;
3108
- gap: 8px;
3109
- flex-wrap: wrap;
3110
- }
3111
- .fb-meta-dot {
3112
- width: 4px;
3113
- height: 4px;
3114
- border-radius: 50%;
3115
- background: #cbd5e1;
3116
- flex-shrink: 0;
3117
- }
3118
- .fb-meta-mono {
3119
- font-family: ui-monospace, 'JetBrains Mono', monospace;
3120
- font-size: 11px;
3121
- letter-spacing: -0.02em;
3099
+ justify-content: flex-end;
3122
3100
  }
3123
3101
  .fb-clear-all-btn {
3124
3102
  font-size: 12px;
@@ -4938,58 +4916,22 @@ function buildPlaceholderTile(isDragOver = false) {
4938
4916
  div.className = `fb-multi-placeholder fb-checker${isDragOver ? " fb-drag-over" : ""}`;
4939
4917
  return div;
4940
4918
  }
4941
- function buildMetaLine(state, element, ridCount, maxCount, canClearAll, onClearAll) {
4942
- const line = document.createElement("div");
4943
- line.className = "fb-meta-line";
4944
- const metaText = document.createElement("div");
4945
- metaText.className = "fb-meta-text";
4946
- if (element.maxSize && element.maxSize !== Infinity) {
4947
- const sizeSpan = document.createElement("span");
4948
- sizeSpan.textContent = t("hintMaxSize", state, { size: element.maxSize });
4949
- metaText.appendChild(sizeSpan);
4950
- metaText.appendChild(buildMetaDot());
4951
- }
4952
- const exts = getAllowedExtensions(
4953
- element.accept
4954
- );
4955
- if (exts.length > 0) {
4956
- const fmtSpan = document.createElement("span");
4957
- fmtSpan.className = "fb-meta-mono";
4958
- fmtSpan.textContent = exts.map((e) => e.toUpperCase()).join(", ");
4959
- metaText.appendChild(fmtSpan);
4960
- metaText.appendChild(buildMetaDot());
4961
- }
4962
- const countSpan = document.createElement("span");
4963
- if (maxCount < Infinity) {
4964
- countSpan.textContent = t("fileCountWithMax", state, {
4965
- count: ridCount,
4966
- max: maxCount
4967
- });
4968
- } else {
4969
- const countKey = ridCount === 1 ? "fileCountSingle" : "fileCountPlural";
4970
- countSpan.textContent = t(countKey, state, { count: ridCount });
4971
- }
4972
- metaText.appendChild(countSpan);
4973
- line.appendChild(metaText);
4974
- if (canClearAll && ridCount > 1) {
4975
- const clearBtn = document.createElement("button");
4976
- clearBtn.type = "button";
4977
- clearBtn.className = "fb-clear-all-btn";
4978
- clearBtn.textContent = t("clearAll", state);
4979
- clearBtn.onclick = (e) => {
4980
- e.stopPropagation();
4981
- if (window.confirm(t("clearAll", state) + "?")) {
4982
- onClearAll();
4983
- }
4984
- };
4985
- line.appendChild(clearBtn);
4986
- }
4987
- return line;
4988
- }
4989
- function buildMetaDot() {
4990
- const dot = document.createElement("span");
4991
- dot.className = "fb-meta-dot";
4992
- 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;
4993
4935
  }
4994
4936
  var gridResizeObservers = /* @__PURE__ */ new WeakMap();
4995
4937
  function disposePlaceholdersForUpload(container) {
@@ -5010,7 +4952,6 @@ function renderResourcePills(opts) {
5010
4952
  maxCount,
5011
4953
  isReadonly = false,
5012
4954
  onLibraryPick,
5013
- element,
5014
4955
  onClearAll,
5015
4956
  openPicker: openPickerProp
5016
4957
  } = opts;
@@ -5156,17 +5097,9 @@ function renderResourcePills(opts) {
5156
5097
  }
5157
5098
  }
5158
5099
  });
5159
- if (element) {
5160
- const metaLine = buildMetaLine(
5161
- state,
5162
- element,
5163
- ridList.length,
5164
- effectiveMax,
5165
- Boolean(onClearAll),
5166
- onClearAll != null ? onClearAll : (() => {
5167
- })
5168
- );
5169
- container.appendChild(metaLine);
5100
+ if (onClearAll) {
5101
+ const row = buildClearAllRow(state, ridList.length, onClearAll);
5102
+ if (row) container.appendChild(row);
5170
5103
  }
5171
5104
  }
5172
5105
  function renderFileElementEdit(element, ctx, wrapper, pathKey) {
@@ -5395,7 +5328,6 @@ function setupMultiFileEditMode(element, ctx, wrapper, pathKey, maxFiles) {
5395
5328
  maxCount: maxFiles < Infinity ? maxFiles : void 0,
5396
5329
  isReadonly: currentlyReadonly,
5397
5330
  onLibraryPick: currentlyReadonly ? null : onLibraryPick,
5398
- element,
5399
5331
  onClearAll: currentlyReadonly ? void 0 : () => {
5400
5332
  var _a2, _b2;
5401
5333
  for (const rid of initialFiles) {
@@ -10929,9 +10861,6 @@ var defaultConfig = {
10929
10861
  hintRequired: "Required",
10930
10862
  hintOptional: "Optional",
10931
10863
  hintPattern: "Format: {pattern}",
10932
- fileCountSingle: "{count} file",
10933
- fileCountPlural: "{count} files",
10934
- fileCountWithMax: "{count} / {max} files",
10935
10864
  fileCountRange: "({min}-{max})",
10936
10865
  uploadingFile: "Uploading\u2026",
10937
10866
  filesCounter: "{count}/{max}",
@@ -11005,9 +10934,6 @@ var defaultConfig = {
11005
10934
  hintRequired: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
11006
10935
  hintOptional: "\u041D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",
11007
10936
  hintPattern: "\u0424\u043E\u0440\u043C\u0430\u0442: {pattern}",
11008
- fileCountSingle: "{count} \u0444\u0430\u0439\u043B",
11009
- fileCountPlural: "{count} \u0444\u0430\u0439\u043B\u043E\u0432",
11010
- fileCountWithMax: "{count} / {max} \u0444\u0430\u0439\u043B\u043E\u0432",
11011
10937
  fileCountRange: "({min}-{max})",
11012
10938
  uploadingFile: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
11013
10939
  filesCounter: "{count}/{max}",