@dmitryvim/form-builder 0.1.33 → 0.1.34

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/demo.js CHANGED
@@ -113,7 +113,7 @@ const EXAMPLE_SCHEMA = {
113
113
  maxCount: 5,
114
114
  minLength: 2,
115
115
  maxLength: 20,
116
- default: "popular"
116
+ default: "popular",
117
117
  },
118
118
  {
119
119
  type: "textarea",
@@ -127,13 +127,14 @@ const EXAMPLE_SCHEMA = {
127
127
  maxCount: 4,
128
128
  minLength: 10,
129
129
  maxLength: 200,
130
- rows: 3
130
+ rows: 3,
131
131
  },
132
132
  {
133
133
  type: "number",
134
134
  key: "dimensions",
135
135
  label: "Размеры (см)",
136
- description: "Укажите размеры товара в сантиметрах: длина, ширина, высота",
136
+ description:
137
+ "Укажите размеры товара в сантиметрах: длина, ширина, высота",
137
138
  placeholder: "0",
138
139
  required: false,
139
140
  multiple: true,
@@ -142,7 +143,7 @@ const EXAMPLE_SCHEMA = {
142
143
  min: 0,
143
144
  max: 500,
144
145
  step: 0.1,
145
- decimals: 1
146
+ decimals: 1,
146
147
  },
147
148
  {
148
149
  type: "select",
@@ -159,9 +160,9 @@ const EXAMPLE_SCHEMA = {
159
160
  { value: "red", label: "Красный" },
160
161
  { value: "blue", label: "Синий" },
161
162
  { value: "green", label: "Зеленый" },
162
- { value: "gray", label: "Серый" }
163
+ { value: "gray", label: "Серый" },
163
164
  ],
164
- default: "white"
165
+ default: "white",
165
166
  },
166
167
  {
167
168
  type: "file",
@@ -328,10 +329,10 @@ let actionLabelMap = new Map();
328
329
  // Build action value -> label mapping from schema for efficient lookup
329
330
  function buildActionLabelMap(schema) {
330
331
  const map = new Map();
331
-
332
+
332
333
  function processElements(elements) {
333
334
  if (!Array.isArray(elements)) return;
334
-
335
+
335
336
  for (const element of elements) {
336
337
  if (element.actions && Array.isArray(element.actions)) {
337
338
  for (const action of element.actions) {
@@ -340,18 +341,18 @@ function buildActionLabelMap(schema) {
340
341
  }
341
342
  }
342
343
  }
343
-
344
+
344
345
  // Process nested group elements
345
346
  if (element.elements && Array.isArray(element.elements)) {
346
347
  processElements(element.elements);
347
348
  }
348
349
  }
349
350
  }
350
-
351
+
351
352
  if (schema && schema.elements) {
352
353
  processElements(schema.elements);
353
354
  }
354
-
355
+
355
356
  return map;
356
357
  }
357
358
 
@@ -442,7 +443,7 @@ function setupFormBuilder() {
442
443
  const actionLabel = actionLabelMap.get(value) || value; // fallback to value
443
444
 
444
445
  console.log("Action clicked:", { label: actionLabel, value });
445
-
446
+
446
447
  // Show message to user (compatible with all environments)
447
448
  if (typeof window !== "undefined" && window.alert) {
448
449
  window.alert(`${actionLabel} clicked: ${value}`);