UBER-1157: Some dependant fixes (#3936)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-03 16:11:12 +07:00 committed by GitHub
parent 67d63e5d28
commit 9f82ec3b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 62 additions and 53 deletions

View File

@ -610,7 +610,7 @@ input.search {
} }
/* --------- */ /* --------- */
.no-word-wrap { word-wrap: none; } .no-word-wrap { word-wrap: none; text-wrap: nowrap; }
.relative { position: relative; } .relative { position: relative; }
.absolute { position: absolute; } .absolute { position: absolute; }
.abs-lt-content { .abs-lt-content {

View File

@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import type { DefSeparators, SeparatedItem } from './types'
import { DelayedCaller } from './utils' import { DelayedCaller } from './utils'
import type { SeparatedItem, DefSeparators } from './types'
// limitations under the License. // limitations under the License.
let observer: ResizeObserver let observer: ResizeObserver
@ -163,10 +163,4 @@ export const settingsSeparators: DefSeparators = [
null null
] ]
export const timeSeparators: DefSeparators = [
{ minSize: 12.5, size: 17.5, maxSize: 22.5, float: 'navigator' },
{ minSize: 25, size: 35, maxSize: 45 },
null
]
export const separatorsStore = writable<string[]>([]) export const separatorsStore = writable<string[]>([])

View File

@ -57,7 +57,7 @@ function generateDailyValues (
while (true) { while (true) {
if (bySetPos == null || bySetPos.includes(getSetPos(currentDate))) { if (bySetPos == null || bySetPos.includes(getSetPos(currentDate))) {
const res = currentDate.getTime() const res = currentDate.getTime()
if (res > from) { if (res > from && res < to) {
values.push(res) values.push(res)
} }
i++ i++
@ -92,7 +92,7 @@ function generateWeeklyValues (
while (date < end) { while (date < end) {
if ((byDay == null || matchesByDay(date, byDay)) && (bySetPos == null || bySetPos.includes(getSetPos(date)))) { if ((byDay == null || matchesByDay(date, byDay)) && (bySetPos == null || bySetPos.includes(getSetPos(date)))) {
const res = date.getTime() const res = date.getTime()
if (res > from) { if (res > from && res < to) {
values.push(res) values.push(res)
} }
i++ i++
@ -172,7 +172,7 @@ function generateMonthlyValues (
(bySetPos == null || bySetPos.includes(getSetPos(currentDate))) (bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
) { ) {
const res = currentDate.getTime() const res = currentDate.getTime()
if (res > from) { if (res > from && res < to) {
values.push(res) values.push(res)
} }
i++ i++
@ -212,7 +212,7 @@ function generateYearlyValues (
(bySetPos == null || bySetPos.includes(getSetPos(currentDate))) (bySetPos == null || bySetPos.includes(getSetPos(currentDate)))
) { ) {
const res = currentDate.getTime() const res = currentDate.getTime()
if (res > from) { if (res > from && res < to) {
values.push(res) values.push(res)
} }
i++ i++
@ -316,7 +316,8 @@ export function getAllEvents (events: Event[], from: Timestamp, to: Timestamp):
} }
} }
for (const rec of recur) { for (const rec of recur) {
recurData.push(...getReccuringEventInstances(rec, instancesMap.get(rec.eventId) ?? [], from, to)) const recEvents = getReccuringEventInstances(rec, instancesMap.get(rec.eventId) ?? [], from, to)
recurData.push(...recEvents)
} }
const res = [ const res = [
...base, ...base,

View File

@ -39,7 +39,7 @@
import ScheduleView from './ScheduleView.svelte' import ScheduleView from './ScheduleView.svelte'
import Sidebar from './sidebar/Sidebar.svelte' import Sidebar from './sidebar/Sidebar.svelte'
export let visibileNav: boolean = true export let visibleNav: boolean = true
export let navFloat: boolean = false export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal' export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'
@ -127,7 +127,7 @@
</script> </script>
<div class="flex h-full clear-mins"> <div class="flex h-full clear-mins">
{#if visibileNav} {#if visibleNav}
<Sidebar <Sidebar
{department} {department}
{descendants} {descendants}

View File

@ -42,7 +42,7 @@
import People from './People.svelte' import People from './People.svelte'
import { subscribe } from '../utils' import { subscribe } from '../utils'
export let visibileNav: boolean = true export let visibleNav: boolean = true
export let navFloat: boolean = false export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal' export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'
let filter: 'all' | 'read' | 'unread' = 'all' let filter: 'all' | 'read' | 'unread' = 'all'
@ -143,7 +143,7 @@
</script> </script>
<div class="flex-row-top h-full"> <div class="flex-row-top h-full">
{#if visibileNav} {#if visibleNav}
<div <div
class="antiPanel-navigator {appsDirection === 'horizontal' class="antiPanel-navigator {appsDirection === 'horizontal'
? 'portrait' ? 'portrait'

View File

@ -36,7 +36,7 @@
import { onDestroy } from 'svelte' import { onDestroy } from 'svelte'
import CategoryElement from './CategoryElement.svelte' import CategoryElement from './CategoryElement.svelte'
export let visibileNav: boolean = true export let visibleNav: boolean = true
export let navFloat: boolean = false export let navFloat: boolean = false
export let appsDirection: 'vertical' | 'horizontal' = 'horizontal' export let appsDirection: 'vertical' | 'horizontal' = 'horizontal'
@ -97,7 +97,7 @@
</script> </script>
<div class="flex h-full clear-mins"> <div class="flex h-full clear-mins">
{#if visibileNav} {#if visibleNav}
<div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}"> <div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}">
<div class="antiPanel-wrap__content"> <div class="antiPanel-wrap__content">
<NavHeader label={setting.string.Settings} /> <NavHeader label={setting.string.Settings} />
@ -149,7 +149,7 @@
<Component <Component
is={category.component} is={category.component}
props={{ props={{
visibileNav visibleNav
}} }}
/> />
{/if} {/if}

View File

@ -37,7 +37,7 @@
let categories: SettingsCategory[] = [] let categories: SettingsCategory[] = []
const account = getCurrentAccount() as PersonAccount const account = getCurrentAccount() as PersonAccount
export let visibileNav = true export let visibleNav = true
const settingsQuery = createQuery() const settingsQuery = createQuery()
settingsQuery.query( settingsQuery.query(
@ -72,7 +72,7 @@
</script> </script>
<div class="flex h-full clear-mins"> <div class="flex h-full clear-mins">
{#if visibileNav} {#if visibleNav}
<div class="antiPanel-navigator filledNav indent"> <div class="antiPanel-navigator filledNav indent">
<div class="antiPanel-wrap__content"> <div class="antiPanel-wrap__content">
<div class="antiNav-header overflow-label"> <div class="antiNav-header overflow-label">

View File

@ -41,6 +41,7 @@ import { getResource } from '@hcengineering/platform'
import { AttributeCategory, KeyedAttribute, getAttributePresenterClass, hasResource } from '@hcengineering/presentation' import { AttributeCategory, KeyedAttribute, getAttributePresenterClass, hasResource } from '@hcengineering/presentation'
import { import {
AnyComponent, AnyComponent,
AnySvelteComponent,
ErrorPresenter, ErrorPresenter,
Location, Location,
getCurrentResolvedLocation, getCurrentResolvedLocation,
@ -889,3 +890,16 @@ export async function openDoc (hierarchy: Hierarchy, object: Doc): Promise<void>
const loc = await getObjectLinkFragment(hierarchy, object, {}, comp) const loc = await getObjectLinkFragment(hierarchy, object, {}, comp)
navigate(loc) navigate(loc)
} }
/**
* @public
*/
export async function getSpacePresenter (
client: Client,
_class: Ref<Class<Doc>>
): Promise<AnySvelteComponent | undefined> {
const value = client.getHierarchy().classHierarchyMixin(_class, view.mixin.SpacePresenter)
if (value?.presenter !== undefined) {
return await getResource(value.presenter)
}
}

View File

@ -113,9 +113,9 @@
let panelInstance: PanelInstance let panelInstance: PanelInstance
let popupInstance: Popup let popupInstance: Popup
let visibileNav: boolean = getMetadata(workbench.metadata.NavigationExpandedDefault) ?? true let visibleNav: boolean = getMetadata(workbench.metadata.NavigationExpandedDefault) ?? true
async function toggleNav (): Promise<void> { async function toggleNav (): Promise<void> {
visibileNav = !visibileNav visibleNav = !visibleNav
closeTooltip() closeTooltip()
if (currentApplication && navigatorModel && navigator) { if (currentApplication && navigatorModel && navigator) {
await tick() await tick()
@ -480,16 +480,16 @@
let navFloat: boolean = !($deviceInfo.docWidth < 1024) let navFloat: boolean = !($deviceInfo.docWidth < 1024)
$: if ($deviceInfo.docWidth <= 1024 && !navFloat) { $: if ($deviceInfo.docWidth <= 1024 && !navFloat) {
visibileNav = false visibleNav = false
navFloat = true navFloat = true
} else if ($deviceInfo.docWidth > 1024 && navFloat) { } else if ($deviceInfo.docWidth > 1024 && navFloat) {
if (getMetadata(workbench.metadata.NavigationExpandedDefault) === undefined) { if (getMetadata(workbench.metadata.NavigationExpandedDefault) === undefined) {
navFloat = false navFloat = false
visibileNav = true visibleNav = true
} }
} }
const checkOnHide = (): void => { const checkOnHide = (): void => {
if (visibileNav && $deviceInfo.docWidth <= 1024) visibileNav = false if (visibleNav && $deviceInfo.docWidth <= 1024) visibleNav = false
} }
let appsDirection: 'vertical' | 'horizontal' let appsDirection: 'vertical' | 'horizontal'
$: appsDirection = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'horizontal' : 'vertical' $: appsDirection = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'horizontal' : 'vertical'
@ -598,7 +598,7 @@
</clipPath> </clipPath>
</svg> </svg>
<div class="workbench-container" style:flex-direction={appsDirection === 'horizontal' ? 'column-reverse' : 'row'}> <div class="workbench-container" style:flex-direction={appsDirection === 'horizontal' ? 'column-reverse' : 'row'}>
<div class="antiPanel-application {appsDirection}" class:lastDivider={!visibileNav}> <div class="antiPanel-application {appsDirection}" class:lastDivider={!visibleNav}>
<div <div
class="hamburger-container clear-mins" class="hamburger-container clear-mins"
class:portrait={appsDirection === 'horizontal'} class:portrait={appsDirection === 'horizontal'}
@ -617,8 +617,8 @@
<div class="topmenu-container clear-mins flex-no-shrink" class:mini={appsMini}> <div class="topmenu-container clear-mins flex-no-shrink" class:mini={appsMini}>
<AppItem <AppItem
icon={TopMenu} icon={TopMenu}
label={visibileNav ? workbench.string.HideMenu : workbench.string.ShowMenu} label={visibleNav ? workbench.string.HideMenu : workbench.string.ShowMenu}
selected={!visibileNav} selected={!visibleNav}
size={appsMini ? 'small' : 'medium'} size={appsMini ? 'small' : 'medium'}
on:click={toggleNav} on:click={toggleNav}
/> />
@ -684,9 +684,9 @@
}} }}
/> />
<div class="workbench-container"> <div class="workbench-container">
{#if currentApplication && navigatorModel && navigator && visibileNav} {#if currentApplication && navigatorModel && navigator && visibleNav}
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
{#if navFloat}<div class="cover shown" on:click={() => (visibileNav = false)} />{/if} {#if navFloat}<div class="cover shown" on:click={() => (visibleNav = false)} />{/if}
<div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}"> <div class="antiPanel-navigator {appsDirection === 'horizontal' ? 'portrait' : 'landscape'}">
<div class="antiPanel-wrap__content"> <div class="antiPanel-wrap__content">
{#if currentApplication} {#if currentApplication}
@ -741,7 +741,7 @@
}} }}
> >
{#if currentApplication && currentApplication.component} {#if currentApplication && currentApplication.component}
<Component is={currentApplication.component} props={{ currentSpace, visibileNav, navFloat, appsDirection }} /> <Component is={currentApplication.component} props={{ currentSpace, visibleNav, navFloat, appsDirection }} />
{:else if specialComponent} {:else if specialComponent}
<Component <Component
is={specialComponent.component} is={specialComponent.component}
@ -749,7 +749,7 @@
model: navigatorModel, model: navigatorModel,
...specialComponent.componentProps, ...specialComponent.componentProps,
currentSpace, currentSpace,
visibileNav, visibleNav,
navFloat, navFloat,
appsDirection appsDirection
}} }}
@ -764,7 +764,7 @@
{:else if currentView?.component !== undefined} {:else if currentView?.component !== undefined}
<Component <Component
is={currentView.component} is={currentView.component}
props={{ ...currentView.componentProps, currentView, visibileNav, navFloat, appsDirection }} props={{ ...currentView.componentProps, currentView, visibleNav, navFloat, appsDirection }}
/> />
{:else} {:else}
<SpaceView {currentSpace} {currentView} {createItemDialog} {createItemLabel} /> <SpaceView {currentSpace} {currentView} {createItemDialog} {createItemLabel} />

View File

@ -31,11 +31,17 @@
navigate, navigate,
showPopup showPopup
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { NavLink, TreeItem, TreeNode, getActions as getContributedActions } from '@hcengineering/view-resources' import {
NavLink,
TreeItem,
TreeNode,
getActions as getContributedActions,
getSpacePresenter
} from '@hcengineering/view-resources'
import { SpacesNavModel } from '@hcengineering/workbench' import { SpacesNavModel } from '@hcengineering/workbench'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin' import plugin from '../../plugin'
import { classIcon, getSpaceName, getSpacePresenter } from '../../utils' import { classIcon, getSpaceName } from '../../utils'
import TreeSeparator from './TreeSeparator.svelte' import TreeSeparator from './TreeSeparator.svelte'
export let model: SpacesNavModel export let model: SpacesNavModel

View File

@ -22,9 +22,15 @@
import { getClient } from '@hcengineering/presentation' import { getClient } from '@hcengineering/presentation'
import { Action, IconEdit } from '@hcengineering/ui' import { Action, IconEdit } from '@hcengineering/ui'
import view from '@hcengineering/view' import view from '@hcengineering/view'
import { NavLink, TreeItem, TreeNode, getActions as getContributedActions } from '@hcengineering/view-resources' import {
NavLink,
TreeItem,
TreeNode,
getActions as getContributedActions,
getSpacePresenter
} from '@hcengineering/view-resources'
import { SpacesNavModel } from '@hcengineering/workbench' import { SpacesNavModel } from '@hcengineering/workbench'
import { classIcon, getSpaceName, getSpacePresenter } from '../../utils' import { classIcon, getSpaceName } from '../../utils'
export let label: IntlString export let label: IntlString
export let spaces: Space[] export let spaces: Space[]

View File

@ -17,12 +17,13 @@
import type { Class, Client, Doc, Obj, Ref, Space, TxOperations } from '@hcengineering/core' import type { Class, Client, Doc, Obj, Ref, Space, TxOperations } from '@hcengineering/core'
import core from '@hcengineering/core' import core from '@hcengineering/core'
import type { Workspace } from '@hcengineering/login' import type { Workspace } from '@hcengineering/login'
import login, { loginId } from '@hcengineering/login'
import type { Asset } from '@hcengineering/platform' import type { Asset } from '@hcengineering/platform'
import { getResource, setMetadata } from '@hcengineering/platform' import { getResource, setMetadata } from '@hcengineering/platform'
import preference from '@hcengineering/preference' import preference from '@hcengineering/preference'
import { closeClient, getClient } from '@hcengineering/presentation' import { closeClient, getClient } from '@hcengineering/presentation'
import presentation from '@hcengineering/presentation/src/plugin'
import { import {
AnySvelteComponent,
closePanel, closePanel,
fetchMetadataLocalStorage, fetchMetadataLocalStorage,
getCurrentLocation, getCurrentLocation,
@ -33,9 +34,6 @@ import view from '@hcengineering/view'
import type { Application } from '@hcengineering/workbench' import type { Application } from '@hcengineering/workbench'
import workbench, { NavigatorModel } from '@hcengineering/workbench' import workbench, { NavigatorModel } from '@hcengineering/workbench'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import login, { loginId } from '@hcengineering/login'
import presentation from '@hcengineering/presentation/src/plugin'
export function classIcon (client: Client, _class: Ref<Class<Obj>>): Asset | undefined { export function classIcon (client: Client, _class: Ref<Class<Obj>>): Asset | undefined {
return client.getHierarchy().getClass(_class).icon return client.getHierarchy().getClass(_class).icon
} }
@ -206,13 +204,3 @@ export function signOut (): void {
void closeClient() void closeClient()
navigate({ path: [loginId] }) navigate({ path: [loginId] })
} }
export async function getSpacePresenter (
client: Client,
_class: Ref<Class<Doc>>
): Promise<AnySvelteComponent | undefined> {
const value = client.getHierarchy().classHierarchyMixin(_class, view.mixin.SpacePresenter)
if (value?.presenter !== undefined) {
return await getResource(value.presenter)
}
}