-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
+
+ Дополнительные настройки отсутствуют
),
Preview: ({ config }) => (
Предпросмотр
-
+
-
-
- {config.placeholder || "Отметить"}
-
+
+
{config.placeholder || 'Отметить'}
@@ -60,11 +39,9 @@ export const checkboxDefinition: ElementDefinition
= {
checked={value || false}
onChange={(e) => onChange?.(e.target.checked)}
required={config.required}
- className="w-4 h-4"
+ className="h-4 w-4"
/>
-
- {config.placeholder || "Отметить"}
-
+ {config.placeholder || 'Отметить'}
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/DateElement.tsx b/src/components/BasicElements/DateElement.tsx
index e64e5a0..69c21b7 100644
--- a/src/components/BasicElements/DateElement.tsx
+++ b/src/components/BasicElements/DateElement.tsx
@@ -1,15 +1,15 @@
-import { Input } from "@/components/ui/input";
-import { ElementDefinition } from "@/lib/element-registry";
-import { Calendar } from "lucide-react";
+import { Input } from '@/components/ui/input'
+import { ElementDefinition } from '@/lib/element-registry'
+import { Calendar } from 'lucide-react'
interface DateConfig {
- required?: boolean;
- targetCells: any[];
+ required?: boolean
+ targetCells: any[]
}
export const dateDefinition: ElementDefinition
= {
- type: "date",
- label: "Дата",
+ type: 'date',
+ label: 'Дата',
icon: ,
defaultConfig: {
required: false,
@@ -33,21 +33,17 @@ export const dateDefinition: ElementDefinition = {
Preview: () => (
Предпросмотр
-
),
Render: ({ config, value, onChange }) => (
onChange?.(e.target.value)}
required={config.required}
/>
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/NumberElement.tsx b/src/components/BasicElements/NumberElement.tsx
index 5b419d9..ebdaf0d 100644
--- a/src/components/BasicElements/NumberElement.tsx
+++ b/src/components/BasicElements/NumberElement.tsx
@@ -1,52 +1,34 @@
-import { Input } from "@/components/ui/input";
-import { ElementDefinition } from "@/lib/element-registry";
-import { Hash } from "lucide-react";
+import { Input } from '@/components/ui/input'
+import { ElementDefinition } from '@/lib/element-registry'
+import { Hash } from 'lucide-react'
interface NumberConfig {
- placeholder?: string;
- required?: boolean;
- targetCells: any[];
+ placeholder?: string
+ required?: boolean
+ targetCells: any[]
}
export const numberDefinition: ElementDefinition
= {
- type: "number",
- label: "Число",
+ type: 'number',
+ label: 'Число',
icon: ,
defaultConfig: {
- placeholder: "",
+ placeholder: '',
required: false,
targetCells: [],
},
Editor: ({ config, onChange }) => (
-
-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
+
+ Дополнительные настройки отсутствуют
),
Preview: ({ config }) => (
Предпросмотр
-
+
@@ -56,10 +38,10 @@ export const numberDefinition: ElementDefinition
= {
Render: ({ config, value, onChange }) => (
onChange?.(parseFloat(e.target.value) || 0)}
required={config.required}
/>
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/RadioElement.tsx b/src/components/BasicElements/RadioElement.tsx
index a50893f..9a224eb 100644
--- a/src/components/BasicElements/RadioElement.tsx
+++ b/src/components/BasicElements/RadioElement.tsx
@@ -1,22 +1,22 @@
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-import { ElementDefinition } from "@/lib/element-registry";
-import { ElementOption } from "@/types/template";
-import { CheckSquare, Plus, Trash2 } from "lucide-react";
+import { Button } from '@/components/ui/button'
+import { Input } from '@/components/ui/input'
+import { ElementDefinition } from '@/lib/element-registry'
+import { ElementOption } from '@/types/template'
+import { CheckSquare, Plus, Trash2 } from 'lucide-react'
interface RadioConfig {
- placeholder?: string;
- required?: boolean;
- options: ElementOption[];
- targetCells: any[];
+ placeholder?: string
+ required?: boolean
+ options: ElementOption[]
+ targetCells: any[]
}
export const radioDefinition: ElementDefinition = {
- type: "radio",
- label: "Радиокнопки",
+ type: 'radio',
+ label: 'Радиокнопки',
icon: ,
defaultConfig: {
- placeholder: "",
+ placeholder: '',
required: false,
options: [],
targetCells: [],
@@ -26,70 +26,61 @@ export const radioDefinition: ElementDefinition = {
onChange({
...config,
options: [...config.options, { value: '', label: '' }],
- });
- };
+ })
+ }
- const handleUpdateOption = (index: number, field: 'value' | 'label', value: string) => {
+ const handleUpdateOption = (
+ index: number,
+ field: 'value' | 'label',
+ value: string,
+ ) => {
onChange({
...config,
- options: config.options.map((option, i) =>
- i === index ? { ...option, [field]: value } : option
+ options: config.options.map((option, i) =>
+ i === index ? { ...option, [field]: value } : option,
),
- });
- };
+ })
+ }
const handleRemoveOption = (index: number) => {
onChange({
...config,
options: config.options.filter((_, i) => i !== index),
- });
- };
+ })
+ }
return (
-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
-
-
+
{config.options.map((option, index) => (
handleUpdateOption(index, 'value', e.target.value)}
+ onChange={(e) =>
+ handleUpdateOption(index, 'value', e.target.value)
+ }
/>
handleUpdateOption(index, 'label', e.target.value)}
+ onChange={(e) =>
+ handleUpdateOption(index, 'label', e.target.value)
+ }
/>
-
@@ -97,21 +88,23 @@ export const radioDefinition: ElementDefinition
= {
- );
+ )
},
Preview: ({ config }) => (
Предпросмотр
-
+
- {config.options.length > 0 ? config.options.map((option, index) => (
-
- )) : (
+ {config.options.length > 0 ? (
+ config.options.map((option, index) => (
+
+ ))
+ ) : (
)}
@@ -130,11 +123,11 @@ export const radioDefinition: ElementDefinition
= {
checked={value === option.value}
onChange={(e) => onChange?.(e.target.value)}
required={config.required}
- className="w-4 h-4"
+ className="h-4 w-4"
/>
{option.label}
))}
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/SelectElement.tsx b/src/components/BasicElements/SelectElement.tsx
index 26a7157..362a845 100644
--- a/src/components/BasicElements/SelectElement.tsx
+++ b/src/components/BasicElements/SelectElement.tsx
@@ -1,23 +1,29 @@
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
-import { ElementDefinition } from "@/lib/element-registry";
-import { ElementOption } from "@/types/template";
-import { ChevronDown, Plus, Trash2 } from "lucide-react";
+import { Button } from '@/components/ui/button'
+import { Input } from '@/components/ui/input'
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select'
+import { ElementDefinition } from '@/lib/element-registry'
+import { ElementOption } from '@/types/template'
+import { ChevronDown, Plus, Trash2 } from 'lucide-react'
interface SelectConfig {
- placeholder?: string;
- required?: boolean;
- options: ElementOption[];
- targetCells: any[];
+ placeholder?: string
+ required?: boolean
+ options: ElementOption[]
+ targetCells: any[]
}
export const selectDefinition: ElementDefinition
= {
- type: "select",
- label: "Выпадающий список",
+ type: 'select',
+ label: 'Выпадающий список',
icon: ,
defaultConfig: {
- placeholder: "",
+ placeholder: '',
required: false,
options: [],
targetCells: [],
@@ -27,70 +33,61 @@ export const selectDefinition: ElementDefinition = {
onChange({
...config,
options: [...config.options, { value: '', label: '' }],
- });
- };
+ })
+ }
- const handleUpdateOption = (index: number, field: 'value' | 'label', value: string) => {
+ const handleUpdateOption = (
+ index: number,
+ field: 'value' | 'label',
+ value: string,
+ ) => {
onChange({
...config,
- options: config.options.map((option, i) =>
- i === index ? { ...option, [field]: value } : option
+ options: config.options.map((option, i) =>
+ i === index ? { ...option, [field]: value } : option,
),
- });
- };
+ })
+ }
const handleRemoveOption = (index: number) => {
onChange({
...config,
options: config.options.filter((_, i) => i !== index),
- });
- };
+ })
+ }
return (
-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
-
-
+
{config.options.map((option, index) => (
handleUpdateOption(index, 'value', e.target.value)}
+ onChange={(e) =>
+ handleUpdateOption(index, 'value', e.target.value)
+ }
/>
handleUpdateOption(index, 'label', e.target.value)}
+ onChange={(e) =>
+ handleUpdateOption(index, 'label', e.target.value)
+ }
/>
- handleRemoveOption(index)}>
+ handleRemoveOption(index)}
+ >
@@ -98,16 +95,16 @@ export const selectDefinition: ElementDefinition
= {
- );
+ )
},
Preview: ({ config }) => (
Предпросмотр
-
+
@@ -117,7 +114,7 @@ export const selectDefinition: ElementDefinition
= {
Render: ({ config, value, onChange }) => (
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/TextElement.tsx b/src/components/BasicElements/TextElement.tsx
index c30fb6c..96e898f 100644
--- a/src/components/BasicElements/TextElement.tsx
+++ b/src/components/BasicElements/TextElement.tsx
@@ -1,51 +1,33 @@
-import { Input } from "@/components/ui/input";
-import { ElementDefinition } from "@/lib/element-registry";
-import { Type } from "lucide-react";
+import { Input } from '@/components/ui/input'
+import { ElementDefinition } from '@/lib/element-registry'
+import { Type } from 'lucide-react'
interface TextConfig {
- placeholder?: string;
- required?: boolean;
- targetCells: any[];
+ placeholder?: string
+ required?: boolean
+ targetCells: any[]
}
export const textDefinition: ElementDefinition = {
- type: "text",
- label: "Текстовое поле",
+ type: 'text',
+ label: 'Текстовое поле',
icon: ,
defaultConfig: {
- placeholder: "",
+ placeholder: '',
required: false,
targetCells: [],
},
Editor: ({ config, onChange }) => (
-
-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
+
+ Дополнительные настройки отсутствуют
),
Preview: ({ config }) => (
Предпросмотр
-
+
@@ -54,10 +36,10 @@ export const textDefinition: ElementDefinition
= {
),
Render: ({ config, value, onChange }) => (
onChange?.(e.target.value)}
required={config.required}
/>
),
-};
\ No newline at end of file
+}
diff --git a/src/components/BasicElements/TextareaElement.tsx b/src/components/BasicElements/TextareaElement.tsx
index b496dad..b23f3a6 100644
--- a/src/components/BasicElements/TextareaElement.tsx
+++ b/src/components/BasicElements/TextareaElement.tsx
@@ -1,52 +1,33 @@
-import { Input } from "@/components/ui/input";
-import { Textarea } from "@/components/ui/textarea";
-import { ElementDefinition } from "@/lib/element-registry";
-import { FileText } from "lucide-react";
+import { Textarea } from '@/components/ui/textarea'
+import { ElementDefinition } from '@/lib/element-registry'
+import { FileText } from 'lucide-react'
interface TextareaConfig {
- placeholder?: string;
- required?: boolean;
- targetCells: any[];
+ placeholder?: string
+ required?: boolean
+ targetCells: any[]
}
export const textareaDefinition: ElementDefinition = {
- type: "textarea",
- label: "Многострочный текст",
+ type: 'textarea',
+ label: 'Многострочный текст',
icon: ,
defaultConfig: {
- placeholder: "",
+ placeholder: '',
required: false,
targetCells: [],
},
Editor: ({ config, onChange }) => (
-
-
-
- onChange({ ...config, placeholder: e.target.value })}
- />
-
-
- onChange({ ...config, required: e.target.checked })}
- />
-
-
+
+ Дополнительные настройки отсутствуют
),
Preview: ({ config }) => (