mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
UBERF-5552 (#4662)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
34b16ae88d
commit
f1d55bfc56
@ -45,6 +45,9 @@
|
|||||||
const client = getClient()
|
const client = getClient()
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
let matched = false
|
||||||
|
$: matched = values.includes(newValue.trim())
|
||||||
|
|
||||||
async function save (): Promise<void> {
|
async function save (): Promise<void> {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
await client.createDoc(core.class.Enum, core.space.Model, {
|
await client.createDoc(core.class.Enum, core.space.Model, {
|
||||||
@ -62,8 +65,8 @@
|
|||||||
|
|
||||||
function add () {
|
function add () {
|
||||||
newValue = newValue.trim()
|
newValue = newValue.trim()
|
||||||
|
if (!newValue.length) return
|
||||||
if (matched) return
|
if (matched) return
|
||||||
if (values.includes(newValue)) return
|
|
||||||
values.push(newValue)
|
values.push(newValue)
|
||||||
values = values
|
values = values
|
||||||
newValue = ''
|
newValue = ''
|
||||||
@ -146,7 +149,6 @@
|
|||||||
const selection: number = 0
|
const selection: number = 0
|
||||||
|
|
||||||
// $: filtered = newValue.length > 0 ? values.filter((it) => it.includes(newValue)) : values
|
// $: filtered = newValue.length > 0 ? values.filter((it) => it.includes(newValue)) : values
|
||||||
$: matched = values.includes(newValue.trim())
|
|
||||||
|
|
||||||
// function onDelete () {
|
// function onDelete () {
|
||||||
// showPopup(
|
// showPopup(
|
||||||
@ -273,7 +275,11 @@
|
|||||||
size={'small'}
|
size={'small'}
|
||||||
tooltip={{ label: setting.string.Add }}
|
tooltip={{ label: setting.string.Add }}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (newItem) {
|
||||||
|
add()
|
||||||
|
} else {
|
||||||
newItem = true
|
newItem = true
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user