текстовое значение галочка
This commit is contained in:
@@ -9,6 +9,7 @@ interface TextConfig {
|
|||||||
placeholder?: string
|
placeholder?: string
|
||||||
required?: boolean
|
required?: boolean
|
||||||
showIncrementButton?: boolean // Новый параметр для отображения кнопки +1
|
showIncrementButton?: boolean // Новый параметр для отображения кнопки +1
|
||||||
|
addZeroWidthSpace?: boolean // Добавляем невидимый символ \u200B к значению
|
||||||
targetCells: any[]
|
targetCells: any[]
|
||||||
name?: string
|
name?: string
|
||||||
id?: string // Добавляем id для совместимости с TemplateElement
|
id?: string // Добавляем id для совместимости с TemplateElement
|
||||||
@@ -51,6 +52,7 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
|
|||||||
placeholder: '',
|
placeholder: '',
|
||||||
required: false,
|
required: false,
|
||||||
showIncrementButton: false,
|
showIncrementButton: false,
|
||||||
|
addZeroWidthSpace: false,
|
||||||
targetCells: [],
|
targetCells: [],
|
||||||
name: '',
|
name: '',
|
||||||
},
|
},
|
||||||
@@ -65,7 +67,10 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
|
|||||||
mapToCells: config => config.targetCells || [],
|
mapToCells: config => config.targetCells || [],
|
||||||
mapToCellValues: (config, value) => {
|
mapToCellValues: (config, value) => {
|
||||||
const cells = config.targetCells || []
|
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 }) => (
|
Editor: ({ config, onChange }) => (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
@@ -84,6 +89,21 @@ export const textDefinition: ElementDefinition<TextConfig, string> = {
|
|||||||
Показывать кнопку +1
|
Показывать кнопку +1
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
),
|
),
|
||||||
Preview: ({ config }) => (
|
Preview: ({ config }) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user