mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 04:25:03 +02:00
Add limit for types in navigator and add list view for types (#8489)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { ButtonIcon, showPopup, closeTooltip } from '@hcengineering/ui'
|
||||
import { ViewOptionModel, ViewOptions, Viewlet } from '@hcengineering/view'
|
||||
import { ViewOptionModel, ViewOptions, Viewlet, type ViewOptionsModel, BuildModelKey } from '@hcengineering/view'
|
||||
import view from '../plugin'
|
||||
import { getViewOptions, viewOptionStore, defaultOptions } from '../viewOptions'
|
||||
import ViewOptionsButton from './ViewOptionsButton.svelte'
|
||||
@@ -26,6 +26,8 @@
|
||||
export let viewlet: Viewlet | undefined = undefined
|
||||
export let disabled: boolean = false
|
||||
export let viewOptionsConfig: ViewOptionModel[] | undefined = undefined
|
||||
export let defaultViewOptions: ViewOptions | undefined = undefined
|
||||
export let defaultConfig: (BuildModelKey | string)[] | undefined = undefined
|
||||
|
||||
let btn: HTMLButtonElement
|
||||
let pressed: boolean = false
|
||||
@@ -33,12 +35,29 @@
|
||||
function clickHandler () {
|
||||
pressed = true
|
||||
closeTooltip()
|
||||
showPopup(ViewletSetting, { viewlet }, btn, () => {
|
||||
showPopup(ViewletSetting, { viewlet, defaultConfig }, btn, () => {
|
||||
pressed = false
|
||||
})
|
||||
}
|
||||
|
||||
$: viewOptions = getViewOptions(viewlet, $viewOptionStore, defaultOptions)
|
||||
function getDefaults (viewOptions: ViewOptionsModel): ViewOptions {
|
||||
const res: ViewOptions = {
|
||||
groupBy: [viewOptions.groupBy[0] ?? defaultOptions.groupBy[0]],
|
||||
orderBy: viewOptions.orderBy?.[0] ?? defaultOptions.orderBy
|
||||
}
|
||||
for (const opt of viewOptions.other) {
|
||||
res[opt.key] = opt.defaultValue
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
function getDefaultOptions (): ViewOptions {
|
||||
if (defaultViewOptions != null) return defaultViewOptions
|
||||
|
||||
return viewlet?.viewOptions != null ? getDefaults(viewlet.viewOptions) : defaultOptions
|
||||
}
|
||||
|
||||
$: viewOptions = getViewOptions(viewlet, $viewOptionStore, getDefaultOptions())
|
||||
|
||||
$: disabled = $restrictionStore.readonly
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user