Merge pull request #2154 from mslourens/duplicate_ui_conditions
add duplicate condition button
This commit is contained in:
commit
145cb78742
|
@ -101,6 +101,12 @@
|
||||||
conditions = conditions.filter(link => link.id !== id)
|
conditions = conditions.filter(link => link.id !== id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const duplicateCondition = id => {
|
||||||
|
const condition = conditions.find(link => link.id === id)
|
||||||
|
const duplicate = { ...condition, id: generate() }
|
||||||
|
conditions = [...conditions, duplicate]
|
||||||
|
}
|
||||||
|
|
||||||
const handleFinalize = e => {
|
const handleFinalize = e => {
|
||||||
updateConditions(e)
|
updateConditions(e)
|
||||||
dragDisabled = true
|
dragDisabled = true
|
||||||
|
@ -235,6 +241,12 @@
|
||||||
bind:value={condition.referenceValue}
|
bind:value={condition.referenceValue}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
<Icon
|
||||||
|
name="Duplicate"
|
||||||
|
hoverable
|
||||||
|
size="S"
|
||||||
|
on:click={() => duplicateCondition(condition.id)}
|
||||||
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
name="Close"
|
name="Close"
|
||||||
hoverable
|
hoverable
|
||||||
|
@ -273,7 +285,7 @@
|
||||||
gap: var(--spacing-l);
|
gap: var(--spacing-l);
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
grid-template-columns: auto 1fr auto 1fr 1fr 1fr 1fr auto;
|
grid-template-columns: auto 1fr auto 1fr 1fr 1fr 1fr auto auto;
|
||||||
border-radius: var(--border-radius-s);
|
border-radius: var(--border-radius-s);
|
||||||
transition: background-color ease-in-out 130ms;
|
transition: background-color ease-in-out 130ms;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue