mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-05 10:29:51 +03:00
Fix fill defaults (#2832)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
9c56815002
commit
db5cb7fba2
@ -29,6 +29,7 @@
|
|||||||
export let items: DropdownTextItem[]
|
export let items: DropdownTextItem[]
|
||||||
export let multiselect = false
|
export let multiselect = false
|
||||||
export let selected: DropdownTextItem['id'] | DropdownTextItem['id'][] | undefined = multiselect ? [] : undefined
|
export let selected: DropdownTextItem['id'] | DropdownTextItem['id'][] | undefined = multiselect ? [] : undefined
|
||||||
|
export let allowDeselect: boolean = false
|
||||||
|
|
||||||
export let kind: ButtonKind = 'no-border'
|
export let kind: ButtonKind = 'no-border'
|
||||||
export let size: ButtonSize = 'small'
|
export let size: ButtonSize = 'small'
|
||||||
@ -70,9 +71,14 @@
|
|||||||
container,
|
container,
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
if (allowDeselect && selected === result) {
|
||||||
|
selected = undefined
|
||||||
|
dispatch('selected', undefined)
|
||||||
|
} else {
|
||||||
selected = result
|
selected = result
|
||||||
dispatch('selected', result)
|
dispatch('selected', result)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
opened = false
|
opened = false
|
||||||
mgr?.setFocusPos(focusIndex)
|
mgr?.setFocusPos(focusIndex)
|
||||||
},
|
},
|
||||||
|
@ -82,19 +82,19 @@
|
|||||||
return name === '' && templateId !== undefined
|
return name === '' && templateId !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
let changed = false
|
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
const templateQ = createQuery()
|
const templateQ = createQuery()
|
||||||
fillDefaults(hierarchy, vacancyData, recruit.class.Vacancy)
|
fillDefaults(hierarchy, vacancyData, recruit.class.Vacancy)
|
||||||
$: templateQ.query(task.class.KanbanTemplate, { _id: templateId }, (result) => {
|
$: templateId &&
|
||||||
|
templateQ.query(task.class.KanbanTemplate, { _id: templateId }, (result) => {
|
||||||
const { _class, _id, description, ...templateData } = result[0]
|
const { _class, _id, description, ...templateData } = result[0]
|
||||||
vacancyData = { ...(templateData as unknown as Data<VacancyClass>), fullDescription: description }
|
vacancyData = { ...(templateData as unknown as Data<VacancyClass>), fullDescription: description }
|
||||||
if (appliedTemplateId !== templateId) {
|
if (appliedTemplateId !== templateId) {
|
||||||
fullDescription = description ?? ''
|
fullDescription = description ?? ''
|
||||||
appliedTemplateId = templateId
|
appliedTemplateId = templateId
|
||||||
}
|
}
|
||||||
|
fillDefaults(hierarchy, vacancyData, recruit.class.Vacancy)
|
||||||
})
|
})
|
||||||
|
|
||||||
const issueTemplatesQ = createQuery()
|
const issueTemplatesQ = createQuery()
|
||||||
@ -267,9 +267,6 @@
|
|||||||
bind:content={fullDescription}
|
bind:content={fullDescription}
|
||||||
placeholder={recruit.string.FullDescription}
|
placeholder={recruit.string.FullDescription}
|
||||||
emphasized
|
emphasized
|
||||||
on:changeContent={() => {
|
|
||||||
changed = true
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
label={setting.string.SelectAValue}
|
label={setting.string.SelectAValue}
|
||||||
kind={'no-border'}
|
kind={'no-border'}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
|
allowDeselect
|
||||||
{type}
|
{type}
|
||||||
value={defaultValue ?? ''}
|
value={defaultValue ?? ''}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
@ -243,6 +243,7 @@
|
|||||||
appliedTemplateId = templateId
|
appliedTemplateId = templateId
|
||||||
const tagElements = await client.findAll(tags.class.TagElement, { _id: { $in: labels } })
|
const tagElements = await client.findAll(tags.class.TagElement, { _id: { $in: labels } })
|
||||||
object.labels = tagElements.map(tagAsRef)
|
object.labels = tagElements.map(tagAsRef)
|
||||||
|
fillDefaults(hierarchy, object, tracker.class.Issue)
|
||||||
}
|
}
|
||||||
|
|
||||||
$: template && updateTemplate(template)
|
$: template && updateTemplate(template)
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
export let onChange: (value: string) => void
|
export let onChange: (value: string) => void
|
||||||
export let kind: ButtonKind = 'link'
|
export let kind: ButtonKind = 'link'
|
||||||
export let size: ButtonSize = 'large'
|
export let size: ButtonSize = 'large'
|
||||||
|
export let allowDeselect: boolean = false
|
||||||
|
|
||||||
let items: DropdownTextItem[] = []
|
let items: DropdownTextItem[] = []
|
||||||
|
|
||||||
@ -54,6 +55,7 @@
|
|||||||
{size}
|
{size}
|
||||||
{kind}
|
{kind}
|
||||||
width={'100%'}
|
width={'100%'}
|
||||||
|
{allowDeselect}
|
||||||
autoSelect={false}
|
autoSelect={false}
|
||||||
on:selected={(e) => {
|
on:selected={(e) => {
|
||||||
onChange(e.detail)
|
onChange(e.detail)
|
||||||
|
Loading…
Reference in New Issue
Block a user