текстовое значение галочка

This commit is contained in:
2025-08-06 22:57:37 +03:00
parent bc7f9d25ac
commit 3a0d729042

View File

@@ -9,6 +9,7 @@ interface TextConfig {
placeholder?: string
required?: boolean
showIncrementButton?: boolean // Новый параметр для отображения кнопки +1
addZeroWidthSpace?: boolean // Добавляем невидимый символ \u200B к значению
targetCells: any[]
name?: string
id?: string // Добавляем id для совместимости с TemplateElement
@@ -51,6 +52,7 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
placeholder: '',
required: false,
showIncrementButton: false,
addZeroWidthSpace: false,
targetCells: [],
name: '',
},
@@ -65,7 +67,10 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
mapToCells: config => config.targetCells || [],
mapToCellValues: (config, value) => {
const cells = config.targetCells || []
return cells.map(target => ({ target, value: value || '' }))
const cellValue = config.addZeroWidthSpace
? `\u200B${value || ''}`
: value || ''
return cells.map(target => ({ target, value: cellValue }))
},
Editor: ({ config, onChange }) => (
<div className="space-y-4">
@@ -84,6 +89,21 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
Показывать кнопку +1
</label>
</div>
<div className="flex items-center space-x-2">
<Checkbox
id="addZeroWidthSpace"
checked={config.addZeroWidthSpace || false}
onCheckedChange={checked =>
onChange({ ...config, addZeroWidthSpace: !!checked })
}
/>
<label
htmlFor="addZeroWidthSpace"
className="text-sm font-medium text-gray-900"
>
Только текстовое значение
</label>
</div>
</div>
),
Preview: ({ config }) => (