[TSK-1368] Remove "Apply" button from filters (#3165)

Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@icloud.com>
This commit is contained in:
Sergei Ogorelkov 2023-05-12 07:11:13 +04:00 committed by GitHub
parent 3d1e1a54ee
commit cd91d46f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 33 deletions

View File

@ -30,7 +30,6 @@
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view' import { Filter } from '@hcengineering/view'
import { FilterQuery } from '@hcengineering/view-resources' import { FilterQuery } from '@hcengineering/view-resources'
import view from '@hcengineering/view-resources/src/plugin'
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import tags from '../plugin' import tags from '../plugin'
import { tagLevel } from '../utils' import { tagLevel } from '../utils'
@ -109,6 +108,11 @@
} }
objects = objects objects = objects
categories = categories categories = categories
filter.value = [...selected]
// Replace last one with value with level
filter.props = { level }
onChange(filter)
} }
$: schema = filter.key.attribute.schema ?? '0' $: schema = filter.key.attribute.schema ?? '0'
@ -209,17 +213,6 @@
{/if} {/if}
</div> </div>
</div> </div>
<Button
shape={'round'}
label={view.string.Apply}
on:click={async () => {
filter.value = [...selected]
// Replace last one with value with level
filter.props = { level }
onChange(filter)
dispatch('close')
}}
/>
</div> </div>
<style> <style>

View File

@ -18,7 +18,6 @@
import presentation, { getClient } from '@hcengineering/presentation' import presentation, { getClient } from '@hcengineering/presentation'
import ui, { import ui, {
addNotification, addNotification,
Button,
Icon, Icon,
IconCheck, IconCheck,
deviceOptionsStore, deviceOptionsStore,
@ -140,6 +139,8 @@
filter.value = [...filter.value, undefined] filter.value = [...filter.value, undefined]
} }
} }
onChange(filter)
} }
let search: string = '' let search: string = ''
@ -216,12 +217,4 @@
{/await} {/await}
</div> </div>
</div> </div>
<Button
shape={'filter'}
label={view.string.Apply}
on:click={() => {
onChange(filter)
dispatch('close')
}}
/>
</div> </div>

View File

@ -16,7 +16,7 @@
import core, { Class, Doc, FindResult, getObjectValue, Ref, SortingOrder, Space } from '@hcengineering/core' import core, { Class, Doc, FindResult, getObjectValue, Ref, SortingOrder, Space } from '@hcengineering/core'
import { translate } from '@hcengineering/platform' import { translate } from '@hcengineering/platform'
import presentation, { getClient } from '@hcengineering/presentation' import presentation, { getClient } from '@hcengineering/presentation'
import ui, { Button, Icon, IconCheck, Label, Loading, resizeObserver, deviceOptionsStore } from '@hcengineering/ui' import ui, { Icon, IconCheck, Label, Loading, resizeObserver, deviceOptionsStore } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view' import { Filter } from '@hcengineering/view'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { getPresenter } from '../../utils' import { getPresenter } from '../../utils'
@ -112,6 +112,11 @@
selectedValues.add(value) selectedValues.add(value)
} }
selectedValues = selectedValues selectedValues = selectedValues
filter.value = [...selectedValues.values()].map((v) => {
return [v, [...(realValues.get(v) ?? [])]]
})
onChange(filter)
} }
let search: string = '' let search: string = ''
@ -185,15 +190,4 @@
{/await} {/await}
</div> </div>
</div> </div>
<Button
shape={'filter'}
label={view.string.Apply}
on:click={() => {
filter.value = Array.from(selectedValues.values()).map((p) => {
return [p, Array.from(realValues.get(p) ?? [])]
})
onChange(filter)
dispatch('close')
}}
/>
</div> </div>