@dmitryvim/form-builder 0.1.34 → 0.1.35
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 +12 -13
- package/dist/elements.html +161 -610
- package/dist/elements.js +231 -269
- package/dist/form-builder.js +258 -730
- package/dist/index.html +2 -27
- package/package.json +3 -8
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,14 +127,13 @@ 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:
|
|
137
|
-
"Укажите размеры товара в сантиметрах: длина, ширина, высота",
|
|
136
|
+
description: "Укажите размеры товара в сантиметрах: длина, ширина, высота",
|
|
138
137
|
placeholder: "0",
|
|
139
138
|
required: false,
|
|
140
139
|
multiple: true,
|
|
@@ -143,7 +142,7 @@ const EXAMPLE_SCHEMA = {
|
|
|
143
142
|
min: 0,
|
|
144
143
|
max: 500,
|
|
145
144
|
step: 0.1,
|
|
146
|
-
decimals: 1
|
|
145
|
+
decimals: 1
|
|
147
146
|
},
|
|
148
147
|
{
|
|
149
148
|
type: "select",
|
|
@@ -160,9 +159,9 @@ const EXAMPLE_SCHEMA = {
|
|
|
160
159
|
{ value: "red", label: "Красный" },
|
|
161
160
|
{ value: "blue", label: "Синий" },
|
|
162
161
|
{ value: "green", label: "Зеленый" },
|
|
163
|
-
{ value: "gray", label: "Серый" }
|
|
162
|
+
{ value: "gray", label: "Серый" }
|
|
164
163
|
],
|
|
165
|
-
default: "white"
|
|
164
|
+
default: "white"
|
|
166
165
|
},
|
|
167
166
|
{
|
|
168
167
|
type: "file",
|
|
@@ -329,10 +328,10 @@ let actionLabelMap = new Map();
|
|
|
329
328
|
// Build action value -> label mapping from schema for efficient lookup
|
|
330
329
|
function buildActionLabelMap(schema) {
|
|
331
330
|
const map = new Map();
|
|
332
|
-
|
|
331
|
+
|
|
333
332
|
function processElements(elements) {
|
|
334
333
|
if (!Array.isArray(elements)) return;
|
|
335
|
-
|
|
334
|
+
|
|
336
335
|
for (const element of elements) {
|
|
337
336
|
if (element.actions && Array.isArray(element.actions)) {
|
|
338
337
|
for (const action of element.actions) {
|
|
@@ -341,18 +340,18 @@ function buildActionLabelMap(schema) {
|
|
|
341
340
|
}
|
|
342
341
|
}
|
|
343
342
|
}
|
|
344
|
-
|
|
343
|
+
|
|
345
344
|
// Process nested group elements
|
|
346
345
|
if (element.elements && Array.isArray(element.elements)) {
|
|
347
346
|
processElements(element.elements);
|
|
348
347
|
}
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
|
-
|
|
350
|
+
|
|
352
351
|
if (schema && schema.elements) {
|
|
353
352
|
processElements(schema.elements);
|
|
354
353
|
}
|
|
355
|
-
|
|
354
|
+
|
|
356
355
|
return map;
|
|
357
356
|
}
|
|
358
357
|
|
|
@@ -443,7 +442,7 @@ function setupFormBuilder() {
|
|
|
443
442
|
const actionLabel = actionLabelMap.get(value) || value; // fallback to value
|
|
444
443
|
|
|
445
444
|
console.log("Action clicked:", { label: actionLabel, value });
|
|
446
|
-
|
|
445
|
+
|
|
447
446
|
// Show message to user (compatible with all environments)
|
|
448
447
|
if (typeof window !== "undefined" && window.alert) {
|
|
449
448
|
window.alert(`${actionLabel} clicked: ${value}`);
|