mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 09:50:19 +00:00
Some calendar view improvements (#1175)
This commit is contained in:
parent
1db5547318
commit
fea10ad0f8
@ -93,7 +93,16 @@ export function createReviewModel (builder: Builder): void {
|
|||||||
company: contact.class.Organization
|
company: contact.class.Organization
|
||||||
}
|
}
|
||||||
} as FindOptions<Doc>,
|
} as FindOptions<Doc>,
|
||||||
config: []
|
config: [
|
||||||
|
'',
|
||||||
|
'title',
|
||||||
|
'$lookup.attachedTo',
|
||||||
|
'verdict',
|
||||||
|
{ key: '', presenter: recruit.component.OpinionsPresenter, label: recruit.string.Opinions, sortingKey: 'opinions' },
|
||||||
|
{ key: '$lookup.participants', presenter: calendar.component.PersonsPresenter, label: calendar.string.Participants, sortingKey: '$lookup.participants' },
|
||||||
|
'$lookup.company',
|
||||||
|
'modifiedOn'
|
||||||
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +128,6 @@ function createTableViewlet (builder: Builder): void {
|
|||||||
'$lookup.company',
|
'$lookup.company',
|
||||||
'date',
|
'date',
|
||||||
'dueDate',
|
'dueDate',
|
||||||
// { presenter: attachment.component.AttachmentsPresenter, label: attachment.string.Files, sortingKey: 'attachments' },
|
|
||||||
// { presenter: chunter.component.CommentsPresenter, label: chunter.string.Comments, sortingKey: 'comments' },
|
|
||||||
'modifiedOn'
|
'modifiedOn'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
export let component: AnySvelteComponent | AnyComponent | undefined = undefined
|
export let component: AnySvelteComponent | AnyComponent | undefined = undefined
|
||||||
export let props: any | undefined = undefined
|
export let props: any | undefined = undefined
|
||||||
export let anchor: HTMLElement | undefined = undefined
|
export let anchor: HTMLElement | undefined = undefined
|
||||||
|
export let fill = false
|
||||||
|
|
||||||
let triggerHTML: HTMLElement
|
let triggerHTML: HTMLElement
|
||||||
let shown: boolean = false
|
let shown: boolean = false
|
||||||
@ -29,7 +30,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="tooltip-trigger"
|
class="tooltip-trigger" class:fill={fill}
|
||||||
name={`tooltip-${label}`}
|
name={`tooltip-${label}`}
|
||||||
bind:this={triggerHTML}
|
bind:this={triggerHTML}
|
||||||
on:mousemove={() => {
|
on:mousemove={() => {
|
||||||
@ -42,5 +43,9 @@
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.tooltip-trigger {
|
.tooltip-trigger {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
&.fill {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
const todayDate = new Date()
|
const todayDate = new Date()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="month-calendar">
|
<div class="month-calendar flex-grow">
|
||||||
<div class="days-of-week-header">
|
<div class="days-of-week-header">
|
||||||
{#each [...Array(7).keys()] as dayOfWeek}
|
{#each [...Array(7).keys()] as dayOfWeek}
|
||||||
<div class="day-name">{getWeekDayName(day(firstDayOfCurrentMonth, dayOfWeek), weekFormat)}</div>
|
<div class="day-name">{getWeekDayName(day(firstDayOfCurrentMonth, dayOfWeek), weekFormat)}</div>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
currentDate.getMonth()}
|
currentDate.getMonth()}
|
||||||
on:click={() => onSelect(weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek))}
|
on:click={() => onSelect(weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek))}
|
||||||
>
|
>
|
||||||
{#if !$$slots.cell || weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek).getMonth() !== currentDate.getMonth()}
|
{#if !$$slots.cell }
|
||||||
{weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek).getDate()}
|
{weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek).getDate()}
|
||||||
{:else}
|
{:else}
|
||||||
<slot name="cell" date={weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek)} />
|
<slot name="cell" date={weekday(firstDayOfCurrentMonth, weekIndex, dayOfWeek)} />
|
||||||
@ -89,8 +89,8 @@
|
|||||||
color: var(--primary-button-color);
|
color: var(--primary-button-color);
|
||||||
}
|
}
|
||||||
.cell {
|
.cell {
|
||||||
height: 100%;
|
height: calc(100% - 5px);
|
||||||
width: 100%;
|
width: calc(100% - 5px);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
@ -211,18 +211,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{#if mode === CalendarMode.Year}
|
||||||
<ScrollBox bothScroll>
|
<ScrollBox bothScroll>
|
||||||
{#if mode === CalendarMode.Year}
|
|
||||||
<YearCalendar {mondayStart} cellHeight={'2.5rem'} bind:value={value} currentDate={currentDate(date, shifts)}>
|
<YearCalendar {mondayStart} cellHeight={'2.5rem'} bind:value={value} currentDate={currentDate(date, shifts)}>
|
||||||
<svelte:fragment slot="cell" let:date>
|
<svelte:fragment slot="cell" let:date>
|
||||||
<Day events={findEvents(objects, date)} {date} />
|
<Day events={findEvents(objects, date)} {date} {_class} {baseMenuClass} {options} {config} query={resultQuery} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</YearCalendar>
|
</YearCalendar>
|
||||||
|
</ScrollBox>
|
||||||
{:else if mode === CalendarMode.Month}
|
{:else if mode === CalendarMode.Month}
|
||||||
<MonthCalendar {mondayStart} cellHeight={'5rem'} bind:value={value} currentDate={currentDate(date, shifts)}>
|
<div class='flex flex-grow'>
|
||||||
<svelte:fragment slot="cell" let:date={date}>
|
<MonthCalendar {mondayStart} cellHeight={'8.5rem'} bind:value={value} currentDate={currentDate(date, shifts)}>
|
||||||
<Day events={findEvents(objects, date)} {date} size={'huge'}/>
|
<svelte:fragment slot="cell" let:date={date}>
|
||||||
</svelte:fragment>
|
<Day events={findEvents(objects, date)} {date} size={'huge'} {_class} {baseMenuClass} {options} {config} query={resultQuery}/>
|
||||||
</MonthCalendar>
|
</svelte:fragment>
|
||||||
|
</MonthCalendar>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</ScrollBox>
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Event } from '@anticrm/calendar'
|
import { Event } from '@anticrm/calendar'
|
||||||
|
import { Class, Doc, DocumentQuery, FindOptions, Ref } from '@anticrm/core'
|
||||||
import { Tooltip } from '@anticrm/ui'
|
import { Tooltip } from '@anticrm/ui'
|
||||||
import calendar from '../plugin'
|
import calendar from '../plugin'
|
||||||
import EventsPopup from './EventsPopup.svelte'
|
import EventsPopup from './EventsPopup.svelte'
|
||||||
@ -21,34 +22,82 @@
|
|||||||
export let events: Event[]
|
export let events: Event[]
|
||||||
export let date: Date
|
export let date: Date
|
||||||
export let size: 'small' | 'huge' = 'small'
|
export let size: 'small' | 'huge' = 'small'
|
||||||
|
|
||||||
|
export let _class: Ref<Class<Doc>>
|
||||||
|
export let query: DocumentQuery<Event> = {}
|
||||||
|
export let options: FindOptions<Event> | undefined = undefined
|
||||||
|
export let baseMenuClass: Ref<Class<Event>> | undefined = undefined
|
||||||
|
export let config: string[]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if events.length > 0}
|
{#if events.length > 0}
|
||||||
<Tooltip label={calendar.string.Events} component={EventsPopup} props={{ value: events }}>
|
<Tooltip
|
||||||
<div class="cell" class:huge={size === 'huge'}>
|
fill={size === 'huge'}
|
||||||
{date.getDate()}
|
label={calendar.string.Events}
|
||||||
<div class="marker" />
|
component={EventsPopup}
|
||||||
</div>
|
props={{ value: events, _class, query, options, baseMenuClass, config }}
|
||||||
|
>
|
||||||
|
{#if size === 'huge'}
|
||||||
|
<div class="cell" class:huge={size === 'huge'}>
|
||||||
|
<div class="flex flex-reverse fs-title flex-grow">
|
||||||
|
{date.getDate()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cell" class:huge={size === 'huge'}>
|
||||||
|
<div class="flex-col flex-grow">
|
||||||
|
{#each events.slice(0, 4) as e, ei}
|
||||||
|
<div class="overflow-label flex flex-between">
|
||||||
|
{e.title}
|
||||||
|
<div>
|
||||||
|
{new Date(e.date).getHours()}:{new Date(e.date).getMinutes()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{#if events.length > 4}
|
||||||
|
And {events.length - 4} more
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="cell">
|
||||||
|
{date.getDate()}
|
||||||
|
<div class="marker" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
{:else if size === 'huge'}
|
||||||
|
<!-- <div class="cell" class:huge={size === 'huge'}> -->
|
||||||
|
<div class="flex flex-reverse fs-title flex-grow title">
|
||||||
|
{date.getDate()}
|
||||||
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
{:else}
|
{:else}
|
||||||
{date.getDate()}
|
<div class="cell">
|
||||||
|
{date.getDate()}
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.marker {
|
|
||||||
// position: relative;
|
|
||||||
top: -0.25rem;
|
|
||||||
width: 0.25rem;
|
|
||||||
height: 0.25rem;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: var(--highlight-red);
|
|
||||||
}
|
|
||||||
.huge {
|
|
||||||
width: 5rem;
|
|
||||||
}
|
|
||||||
.cell {
|
.cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.marker {
|
||||||
|
position: relative;
|
||||||
|
top: -0.25rem;
|
||||||
|
width: 0.25rem;
|
||||||
|
height: 0.25rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--highlight-red);
|
||||||
|
}
|
||||||
|
&.huge {
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
align-self: flex-start;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -16,23 +16,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import type { Event } from '@anticrm/calendar'
|
import type { Event } from '@anticrm/calendar'
|
||||||
import core from '@anticrm/core'
|
import { Class, Doc, DocumentQuery, FindOptions, Ref } from '@anticrm/core'
|
||||||
import { Table } from '@anticrm/view-resources'
|
import { Table } from '@anticrm/view-resources'
|
||||||
import calendar from '../plugin'
|
|
||||||
|
|
||||||
export let value: Event[]
|
export let value: Event[]
|
||||||
|
|
||||||
|
export let _class: Ref<Class<Doc>>
|
||||||
|
export let query: DocumentQuery<Event> = {}
|
||||||
|
export let options: FindOptions<Event> | undefined = undefined
|
||||||
|
export let baseMenuClass: Ref<Class<Event>> | undefined = undefined
|
||||||
|
export let config: string[]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
_class={calendar.class.Event}
|
_class={_class}
|
||||||
config={['', 'title', '$lookup.space.name', 'date', 'dueDate', 'modifiedOn']}
|
config={config}
|
||||||
options={
|
{baseMenuClass}
|
||||||
{
|
options={ options }
|
||||||
lookup: {
|
query={ { ...query, _id: { $in: value.map(it => it._id) } } }
|
||||||
space: core.class.Space
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
query={ { _id: { $in: value.map(it => it._id) } } }
|
|
||||||
loadingProps={{ length: value.length ?? 0 }}
|
loadingProps={{ length: value.length ?? 0 }}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user