{
- haveNameChanges = true
+ bind:value={inputName}
+ on:change={() => {
+ handleChange({ name: inputName })
}}
- on:change={handleNameChange}
/>
{#if !isNewQuestion}
{#if question.hasCustomOption && question.kind !== QuestionKind.STRING}
@@ -423,18 +368,18 @@
{/if}
{#if !isNewQuestion && question.kind !== QuestionKind.STRING}
- {#each options as option, index (index)}
+ {#each inputOptions as option, index (index)}
{
- dragOver(ev, index)
+ onOptionDragOver(ev, index)
}}
on:dragleave={(ev) => {
- dragLeave(ev, index)
+ onOptionDragLeave(ev, index)
}}
- on:drop={dragDrop}
+ on:drop={onOptionDrop}
class:is-dragged={index === draggedIndex}
class:dragged-over={draggedIndex !== undefined &&
draggedOverIndex === index &&
@@ -445,9 +390,9 @@
role="presentation"
draggable={!readonly}
on:dragstart={(ev) => {
- dragStart(ev, index)
+ onOptionDragStart(ev, index)
}}
- on:dragend={dragEnd}
+ on:dragend={onOptionDragEnd}
>
{
- await changeOption(index)
+ bind:value={inputOptions[index]}
+ on:change={() => {
+ changeOption(index)
}}
/>
@@ -475,16 +420,20 @@
class="flex-row-center flex-gap-3 option"
role="listitem"
on:dragover={(ev) => {
- dragOver(ev, options.length)
+ onOptionDragOver(ev, question.options?.length ?? 0)
}}
on:dragleave={(ev) => {
- dragLeave(ev, options.length)
+ onOptionDragLeave(ev, question.options?.length ?? 0)
}}
- on:drop={dragDrop}
- class:dragged-over={draggedOverIndex === options.length && draggedIndex !== options.length - 1}
+ on:drop={onOptionDrop}
+ class:dragged-over={draggedOverIndex === inputOptions.length && draggedIndex !== inputOptions.length - 1}
>
-
+
{/if}
{/if}
diff --git a/plugins/survey-resources/src/components/EditSurvey.svelte b/plugins/survey-resources/src/components/EditSurvey.svelte
index 0a202f7a3c..fce06aa6d9 100644
--- a/plugins/survey-resources/src/components/EditSurvey.svelte
+++ b/plugins/survey-resources/src/components/EditSurvey.svelte
@@ -15,34 +15,76 @@
//
-->
@@ -95,7 +129,9 @@
placeholder={survey.string.Name}
bind:value={object.name}
kind={'large-style'}
- on:change={nameChange}
+ on:input={() => {
+ handleChange({ name: object.name })
+ }}
/>
@@ -103,7 +139,9 @@
disabled={readonly}
placeholder={survey.string.PromptPlaceholder}
bind:value={object.prompt}
- on:change={promptChange}
+ on:input={() => {
+ handleChange({ prompt: object.prompt })
+ }}
/>
@@ -115,42 +153,48 @@
- {#each questionEditSlots as question, index}
+ {#each questionList as question, index (index)}
+ {@const isNewQuestion = index === questionList.length - 1}
{
- dragOver(ev, index)
+ onQuestionDragOver(ev, index)
}}
on:dragleave={(ev) => {
- dragLeave(ev, index)
+ onQuestionDragLeave(ev, index)
}}
- on:drop={dragDrop}
+ on:drop={onQuestionDrop}
class:dragged-over={draggedIndex !== undefined &&
draggedOverIndex === index &&
draggedOverIndex !== draggedIndex &&
draggedOverIndex !== draggedIndex + 1}
>
- {#key index}
- {
- draggedIndex = index
- }}
- on:dragEnd={() => {
- draggedIndex = undefined
- draggedOverIndex = undefined
- }}
- />
- {/key}
+ {
+ deleteQuestion(index)
+ }}
+ on:change={(e) => {
+ isNewQuestion ? handleNewQuestionChange(e.detail) : handleQuestionChange(index, e.detail)
+ }}
+ {readonly}
+ on:dragStart={() => {
+ draggedIndex = index
+ }}
+ on:dragEnd={() => {
+ draggedIndex = undefined
+ draggedOverIndex = undefined
+ }}
+ />
{/each}
{/if}