diff --git a/models/calendar/src/index.ts b/models/calendar/src/index.ts index d7f09e8d9d..a727a9acf2 100644 --- a/models/calendar/src/index.ts +++ b/models/calendar/src/index.ts @@ -118,7 +118,7 @@ export class TReccuringEvent extends TEvent implements ReccuringEvent { @Model(calendar.class.ReccuringInstance, calendar.class.Event) @UX(calendar.string.Event, calendar.icon.Calendar) -export class TReccuringInstance extends TEvent implements ReccuringInstance { +export class TReccuringInstance extends TReccuringEvent implements ReccuringInstance { recurringEventId!: Ref originalStartTime!: number isCancelled?: boolean @@ -288,10 +288,6 @@ export function createModel (builder: Builder): void { editor: calendar.component.EditEvent }) - builder.mixin(calendar.class.ReccuringInstance, core.class.Class, view.mixin.ObjectEditor, { - editor: calendar.component.EditRecEvent - }) - builder.mixin(calendar.class.Event, core.class.Class, view.mixin.ObjectPresenter, { presenter: calendar.component.EventPresenter }) diff --git a/packages/ui/src/components/CircleButton.svelte b/packages/ui/src/components/CircleButton.svelte index 06c244a5b6..fb7a9a4cec 100644 --- a/packages/ui/src/components/CircleButton.svelte +++ b/packages/ui/src/components/CircleButton.svelte @@ -17,7 +17,7 @@ import type { AnySvelteComponent, ButtonSize } from '../types' import Icon from './Icon.svelte' - export let icon: Asset | AnySvelteComponent | undefined + export let icon: Asset | AnySvelteComponent | undefined = undefined export let size: ButtonSize = 'large' export let ghost: boolean = false export let selected: boolean = false @@ -35,13 +35,13 @@ on:click|stopPropagation on:mousemove > -
- {#if $$slots.content} - - {:else if icon} + {#if $$slots.content} + + {:else if icon} +
- {/if} -
+
+ {/if} diff --git a/packages/ui/src/components/calendar/SimpleTimePopup.svelte b/packages/ui/src/components/calendar/SimpleTimePopup.svelte new file mode 100644 index 0000000000..cf10d8d2c5 --- /dev/null +++ b/packages/ui/src/components/calendar/SimpleTimePopup.svelte @@ -0,0 +1,41 @@ + + + + + + diff --git a/packages/ui/src/components/calendar/TimeInputBox.svelte b/packages/ui/src/components/calendar/TimeInputBox.svelte new file mode 100644 index 0000000000..22d28a6f4c --- /dev/null +++ b/packages/ui/src/components/calendar/TimeInputBox.svelte @@ -0,0 +1,275 @@ + + + +
+
+ keyDown(ev, edits[0].id)} + on:focus={() => focused(edits[0].id)} + on:blur={() => (selected = null)} + > + {#if edits[0].value > -1} + {edits[0].value.toString().padStart(2, '0')} + {:else} + : + keyDown(ev, edits[1].id)} + on:focus={() => focused(edits[1].id)} + on:blur={() => (selected = null)} + > + {#if edits[1].value > -1} + {edits[1].value.toString().padStart(2, '0')} + {:else} +
+
+ + diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 2456b32d58..dbb076d515 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -190,6 +190,8 @@ export { default as StepsDialog } from './components/StepsDialog.svelte' export { default as EmojiPopup } from './components/EmojiPopup.svelte' export { default as IconWithEmoji } from './components/IconWithEmoji.svelte' export { default as ModeSelector } from './components/ModeSelector.svelte' +export { default as SimpleTimePopup } from './components/calendar/SimpleTimePopup.svelte' +export { default as NumberInput } from './components/NumberInput.svelte' export * from './types' export * from './location' diff --git a/plugins/calendar-assets/assets/icons.svg b/plugins/calendar-assets/assets/icons.svg index f1b5fd4490..4be7670c90 100644 --- a/plugins/calendar-assets/assets/icons.svg +++ b/plugins/calendar-assets/assets/icons.svg @@ -15,4 +15,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/calendar-assets/lang/en.json b/plugins/calendar-assets/lang/en.json index cb1935a387..2573d07702 100644 --- a/plugins/calendar-assets/lang/en.json +++ b/plugins/calendar-assets/lang/en.json @@ -51,6 +51,28 @@ "RemoveRecEvent": "Remove recurring event", "ThisEvent": "This event", "ThisAndNext": "This and following events", - "AllEvents": "All events" + "AllEvents": "All events", + "NewEvent": "New event", + "TimeZone": "Time zone", + "Repeat": "Repeat", + "On": "On", + "Every": "Every", + "After": "After", + "Ends": "Ends", + "Never": "Never", + "Day": "Day", + "Week": "Week", + "Month": "Month", + "Year": "Year", + "MondayShort": "Mo", + "TuesdayShort": "Tu", + "WednesdayShort": "We", + "ThursdayShort": "Th", + "FridayShort": "Fr", + "SaturdayShort": "Sa", + "SundayShort": "Su", + "OnUntil": "On", + "Times": "{count, plural, one {time} other {times}}", + "AddParticipants": "Add participants" } } \ No newline at end of file diff --git a/plugins/calendar-assets/lang/ru.json b/plugins/calendar-assets/lang/ru.json index 7fa464be83..1593d9a865 100644 --- a/plugins/calendar-assets/lang/ru.json +++ b/plugins/calendar-assets/lang/ru.json @@ -51,6 +51,29 @@ "RemoveRecEvent": "Удаление повторяющегося события", "ThisEvent": "Только это событие", "ThisAndNext": "Это и последующие события", - "AllEvents": "Все события" + "AllEvents": "Все события", + "NewEvent": "Новое событие", + "TimeZone": "Часовой пояс", + "Repeat": "Повтор", + "On": "В", + "Every": "Кажд.", + "After": "После", + "Ends": "Окончание", + "Never": "Никогда", + "Day": "{count, plural, one {день} few {дня} other {дней}}", + "Week": "{count, plural, one {неделю} few {недели} other {недель}}", + "Month": "{count, plural, one {месяц} few {месяца} other {месяцев}}", + "Year": "{count, plural, one {год} few {года} other {лет}}", + "MondayShort": "Пн", + "TuesdayShort": "Вт", + "WednesdayShort": "Ср", + "ThursdayShort": "Чт", + "FridayShort": "Пт", + "SaturdayShort": "Сб", + "SundayShort": "Вс", + "OnUntil": "До", + "Times": "{count, plural, one {раз} few {раза} other {раз}}", + "AddParticipants": "Добавить участников" + } } \ No newline at end of file diff --git a/plugins/calendar-assets/src/index.ts b/plugins/calendar-assets/src/index.ts index 43a6a7dd19..c7cf7433c8 100644 --- a/plugins/calendar-assets/src/index.ts +++ b/plugins/calendar-assets/src/index.ts @@ -21,7 +21,12 @@ loadMetadata(calendar.icon, { Calendar: `${icons}#calendar`, Reminder: `${icons}#reminder`, Notifications: `${icons}#notifications`, - Location: `${icons}#location` + Location: `${icons}#location`, + Watch: `${icons}#watch`, + Description: `${icons}#description`, + Participants: `${icons}#participants`, + Repeat: `${icons}#repeat`, + Globe: `${icons}#globe` }) addStringsLoader(calendarId, async (lang: string) => await import(`../lang/${lang}.json`)) diff --git a/plugins/calendar-resources/package.json b/plugins/calendar-resources/package.json index 8a9a5ba740..28e5e49922 100644 --- a/plugins/calendar-resources/package.json +++ b/plugins/calendar-resources/package.json @@ -37,6 +37,7 @@ "@hcengineering/ui": "^0.6.10", "@hcengineering/presentation": "^0.6.2", "@hcengineering/calendar": "^0.6.13", + "@hcengineering/theme": "^0.6.3", "svelte": "3.55.1", "@hcengineering/text-editor": "^0.6.0", "@hcengineering/contact": "^0.6.19", diff --git a/plugins/calendar-resources/src/components/AddParticipant.svelte b/plugins/calendar-resources/src/components/AddParticipant.svelte new file mode 100644 index 0000000000..14d7cb1429 --- /dev/null +++ b/plugins/calendar-resources/src/components/AddParticipant.svelte @@ -0,0 +1,176 @@ + + + + +
{ + input.focus() + }} + use:resizeObserver={(element) => { + parentWidth = element.parentElement?.getBoundingClientRect().width + }} +> +
+
+ ev.target && computeSize(ev.target)} + on:change + on:keydown + on:keypress + on:blur + /> +
+
+ + diff --git a/plugins/calendar-resources/src/components/CalendarView.svelte b/plugins/calendar-resources/src/components/CalendarView.svelte index 38d92c16b6..09b839d8fa 100644 --- a/plugins/calendar-resources/src/components/CalendarView.svelte +++ b/plugins/calendar-resources/src/components/CalendarView.svelte @@ -80,10 +80,10 @@ return getMonday(date, mondayStart).setHours(0, 0, 0, 0) } case CalendarMode.Month: { - return new Date(new Date(date).setDate(1)).setHours(0, 0, 0, 0) + return new Date(new Date(date).setDate(-7)).setHours(0, 0, 0, 0) } case CalendarMode.Year: { - return new Date(new Date(date).setMonth(0, 1)).setHours(0, 0, 0, 0) + return new Date(new Date(date).setMonth(0, -7)).setHours(0, 0, 0, 0) } } } @@ -101,10 +101,10 @@ return new Date(monday.setDate(monday.getDate() + 7)).setHours(0, 0, 0, 0) } case CalendarMode.Month: { - return new Date(new Date(date).setMonth(date.getMonth() + 1, 1)).setHours(0, 0, 0, 0) + return new Date(new Date(date).setMonth(date.getMonth() + 1, 14)).setHours(0, 0, 0, 0) } case CalendarMode.Year: { - return new Date(new Date(date).setMonth(12, 1)).setHours(0, 0, 0, 0) + return new Date(new Date(date).setMonth(12, 14)).setHours(0, 0, 0, 0) } } } @@ -378,7 +378,7 @@ events={objects} {mondayStart} displayedDaysCount={7} - startFromWeekStart={false} + startFromWeekStart bind:selectedDate bind:currentDate on:create={(e) => showCreateDialog(e.detail.date, e.detail.withTime)} diff --git a/plugins/calendar-resources/src/components/CreateEvent.svelte b/plugins/calendar-resources/src/components/CreateEvent.svelte index 14361313b3..fbbbc5bbd1 100644 --- a/plugins/calendar-resources/src/components/CreateEvent.svelte +++ b/plugins/calendar-resources/src/components/CreateEvent.svelte @@ -13,15 +13,18 @@ // limitations under the License. --> - 0 && participants.length > 0 && startDate !== undefined} - on:close={() => { - dispatch('close') - }} - on:changeContent -> - - - - await handleNewStartDate(event.detail)} - kind={'regular'} - {mode} - size={'large'} - editable +
+
+ +
+
+ +
+ {#if !allDay && rules.length === 0} +
+
(allDay = true)}> +
+
+
+
+
+
+ {:else} +
+
+ +
+
+ +
+
+ + {#if rules.length > 0} + + {:else} +
+
+ {/if} +
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+
+
+ + diff --git a/plugins/calendar-resources/src/components/DateEditor.svelte b/plugins/calendar-resources/src/components/DateEditor.svelte new file mode 100644 index 0000000000..da4d53a24d --- /dev/null +++ b/plugins/calendar-resources/src/components/DateEditor.svelte @@ -0,0 +1,100 @@ + + + +
+ {#if showDate || withoutTime} + + {/if} + {#if !withoutTime} + + {/if} +
+ + diff --git a/plugins/calendar-resources/src/components/DateLocalePresenter.svelte b/plugins/calendar-resources/src/components/DateLocalePresenter.svelte new file mode 100644 index 0000000000..431a6d89bb --- /dev/null +++ b/plugins/calendar-resources/src/components/DateLocalePresenter.svelte @@ -0,0 +1,31 @@ + + + +{new Date(date).toLocaleDateString('default', options)} diff --git a/plugins/calendar-resources/src/components/Day.svelte b/plugins/calendar-resources/src/components/Day.svelte index 207baa7fd5..e419ce8b5b 100644 --- a/plugins/calendar-resources/src/components/Day.svelte +++ b/plugins/calendar-resources/src/components/Day.svelte @@ -70,13 +70,7 @@ class="overflow-label mt-1 py-1 flex flex-between event cursor-pointer" style="background-color: {getPlatformColorForTextDef(e.space, $themeStore.dark).color};" on:click|stopPropagation|preventDefault={() => { - showPopup( - e._class === calendar.class.ReccuringInstance - ? calendar.component.EditRecEvent - : calendar.component.EditEvent, - { object: e }, - 'content' - ) + showPopup(calendar.component.EditEvent, { object: e }, 'content') }} > {e.title} diff --git a/plugins/calendar-resources/src/components/DayCalendar.svelte b/plugins/calendar-resources/src/components/DayCalendar.svelte index 5eb138f056..14afbcd990 100644 --- a/plugins/calendar-resources/src/components/DayCalendar.svelte +++ b/plugins/calendar-resources/src/components/DayCalendar.svelte @@ -106,7 +106,7 @@ return result } - $: calendarEvents = toCalendar(events, currentDate, displayedDaysCount, startHour, displayedHours + startHour) + $: calendarEvents = toCalendar(events, weekMonday, displayedDaysCount, startHour, displayedHours + startHour) $: fontSize = $deviceInfo.fontSize $: docHeight = $deviceInfo.docHeight @@ -325,7 +325,7 @@ event: CalendarItem ): { top: number; bottom: number; left: number; right: number; width: number; visibility: number } => { const result = { top: 0, bottom: 0, left: 0, right: 0, width: 0, visibility: 1 } - const checkDate = new Date(currentDate.getTime() + MILLISECONDS_IN_DAY * event.day) + const checkDate = new Date(weekMonday.getTime() + MILLISECONDS_IN_DAY * event.day) const startDay = checkDate.setHours(startHour, 0, 0, 0) const endDay = checkDate.setHours(displayedHours - 1, 59, 59, 999) const startTime = event.date < startDay ? { hours: 0, mins: 0 } : convertToTime(event.date) @@ -343,7 +343,7 @@ cellHeight * (displayedHours - startHour - endTime.hours - 1) + ((60 - endTime.mins) / 60) * cellHeight + getGridOffset(endTime.mins, true) + - (showHeader ? 0 : rem(2.5)) + (showHeader ? 0 : rem(3.5)) let cols = 1 let index: number = 0 grid[event.day].columns.forEach((col, i) => diff --git a/plugins/calendar-resources/src/components/EditEvent.svelte b/plugins/calendar-resources/src/components/EditEvent.svelte index 3b1b13e82a..754f8e1b05 100644 --- a/plugins/calendar-resources/src/components/EditEvent.svelte +++ b/plugins/calendar-resources/src/components/EditEvent.svelte @@ -13,193 +13,307 @@ // limitations under the License. --> - { - dispatch('close') - }} - withoutActivity={true} - withoutInput={true} -> - -
-
-
- - {#if doc} -
-
-