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