{sortedDisplayFields.map((displayField, displayIndex) => {
- const { fieldName, displayLabel, isMandated } = displayField
- const isVisible = visibleFields.includes(fieldName)
- const isRequired = requiredFields.includes(fieldName)
+ const { fieldName, label, isMandated } = displayField
+ const isVisible = rsvpFormFields.some(f => f.field === fieldName)
+ const isRequired = rsvpFormFields.some(f => f.field === fieldName && f.required === true)
const isDragging = draggedIndex === displayIndex
const isDragOver = dragOverIndex === displayIndex
const canDrag = isVisible
+ const fieldDef = getFieldDef(fieldName)
+ const showOptionEditor = fieldSourceMode === 'scope' && fieldDef && isSelectableField(fieldDef)
+ const optState = showOptionEditor ? getEffectiveOptionState(fieldName) : null
+
+ const isExpanded = expandedOptions.has(fieldName)
+ const toggleExpanded = () =>
+ setExpandedOptions(prev => {
+ const next = new Set(prev)
+ if (isExpanded) next.delete(fieldName)
+ else next.add(fieldName)
+ return next
+ })
+
return (
handleDragStart(e, displayIndex)}
onDragOver={(e) => handleDragOver(e, displayIndex)}
onDragLeave={handleDragLeave}
onDrop={(e) => handleDrop(e, displayIndex)}
- onDragEnd={handleDragEnd}
style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr 1fr 40px',
- gap: '16px',
- alignItems: 'center',
- padding: '12px 16px',
borderRadius: '6px',
- backgroundColor: isDragging
- ? SURFACES.PILL_BG
+ backgroundColor: isDragging
+ ? SURFACES.PILL_BG
: isVisible
? SURFACES.CANVAS
: 'transparent',
- border: isDragOver
- ? `2px solid ${SURFACES.SELECTED_RING}`
+ border: isDragOver
+ ? `2px solid ${SURFACES.SELECTED_RING}`
: isVisible
? `1px solid ${SURFACES.BORDER}`
: '1px solid transparent',
opacity: isDragging ? 0.5 : 1,
transition: 'border-color 0.2s, background-color 0.2s',
- cursor: canDrag ? 'default' : 'default'
}}
>
-
- {displayLabel}
- {isMandated && (
-
- (Always required)
-
- )}
-
-
handleVisibleToggle(fieldName, checked)}
- isDisabled={isMandated}
- >
- Appears on form
-
-
handleRequiredToggle(fieldName, checked)}
- isDisabled={!isVisible || isMandated}
- >
- Required field
-
- {/* Drag handle - only visible for selected fields */}
handleDragStart(e, displayIndex)}
+ onDragEnd={handleDragEnd}
style={{
- display: 'flex',
- justifyContent: 'center',
+ display: 'grid',
+ gridTemplateColumns: '1fr 1fr 1fr 40px 40px',
+ gap: '16px',
alignItems: 'center',
- cursor: canDrag ? 'grab' : 'default',
- color: canDrag ? COLORS.GRAY_600 : SURFACES.BORDER,
- opacity: canDrag ? 1 : 0.3
+ padding: '12px 16px',
}}
>
-
+
+ {label}
+ {isMandated && (
+
+ (Always required)
+
+ )}
+
+
handleVisibleToggle(fieldName, checked)}
+ isDisabled={isMandated}
+ >
+ Appears on form
+
+
handleRequiredToggle(fieldName, checked)}
+ isDisabled={!isVisible || isMandated}
+ >
+ Required field
+
+ {showOptionEditor && optState && isVisible ? (
+
+
+
+ ) : null}
+
+
+
+
+ {showOptionEditor && optState && isVisible && isExpanded && (
+
+
+ {optState.order.map((optValue, optDisplayIdx) => {
+ const optLabel = fieldDef?.options?.find(o => o.value === optValue)?.label ?? optValue
+ const optEnabled = !optState.disabledValues.includes(optValue)
+ const oDragging = optionDrag?.fieldName === fieldName && optionDrag.index === optDisplayIdx
+ const oOver = optionDragOver?.fieldName === fieldName && optionDragOver.index === optDisplayIdx
+
+ return (
+
handleOptionDragStart(e, fieldName, optDisplayIdx)}
+ onDragOver={(e) => handleOptionDragOver(e, fieldName, optDisplayIdx)}
+ onDragLeave={handleOptionDragLeave}
+ onDrop={(e) => handleOptionDrop(e, fieldName, optDisplayIdx)}
+ onDragEnd={handleOptionDragEnd}
+ style={{
+ display: 'grid',
+ gridTemplateColumns: '1fr 1fr 40px',
+ gap: 12,
+ alignItems: 'center',
+ padding: '8px 12px',
+ borderRadius: 6,
+ backgroundColor: oDragging ? SURFACES.PILL_BG : SURFACES.CANVAS,
+ border: oOver ? `2px solid ${SURFACES.SELECTED_RING}` : 'none',
+ opacity: oDragging ? 0.6 : 1
+ }}
+ >
+
{optLabel}
+
handleOptionEnabledToggle(fieldName, optValue, checked)}
+ >
+ Include option
+
+
+
+
+
+ )
+ })}
+
+
+ )}
)
})}
@@ -457,8 +658,7 @@ export const RegistrationFieldsComponent: React.FC