mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 04:38:02 +00:00
Fixed the aSide behavior (#7588)
Some checks are pending
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
Some checks are pending
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
This commit is contained in:
parent
d44793763e
commit
1254f0154a
@ -504,6 +504,27 @@
|
|||||||
if (parentElement != null && typeof float === 'string') parentElement.setAttribute('data-float', float)
|
if (parentElement != null && typeof float === 'string') parentElement.setAttribute('data-float', float)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clearContainer = (container: HTMLElement): void => {
|
||||||
|
if (container === null) return
|
||||||
|
if (container.hasAttribute('data-float')) container.removeAttribute('data-float')
|
||||||
|
if (container.hasAttribute('data-size')) container.removeAttribute('data-size')
|
||||||
|
container.style.width = ''
|
||||||
|
container.style.minWidth = ''
|
||||||
|
container.style.maxWidth = ''
|
||||||
|
}
|
||||||
|
const clearSibling = (): void => {
|
||||||
|
if (separators != null && prevElement != null && separators[index].float !== undefined) {
|
||||||
|
clearContainer(prevElement)
|
||||||
|
}
|
||||||
|
if (separators != null && nextElement != null && separators[index + 1].float !== undefined) {
|
||||||
|
clearContainer(nextElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const clearParent = (): void => {
|
||||||
|
if (parentElement === null && separator != null) parentElement = separator.parentElement as HTMLElement
|
||||||
|
if (parentElement != null && typeof float === 'string') clearContainer(parentElement)
|
||||||
|
}
|
||||||
|
|
||||||
const calculateSeparators = (): void => {
|
const calculateSeparators = (): void => {
|
||||||
if (parentElement != null) {
|
if (parentElement != null) {
|
||||||
const elements: Element[] = Array.from(parentElement.children)
|
const elements: Element[] = Array.from(parentElement.children)
|
||||||
@ -600,6 +621,10 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
|
if (mounted) {
|
||||||
|
if (sState === SeparatorState.FLOAT) clearParent()
|
||||||
|
else if (sState === SeparatorState.NORMAL) clearSibling()
|
||||||
|
}
|
||||||
window.removeEventListener('resize', resizeDocument)
|
window.removeEventListener('resize', resizeDocument)
|
||||||
if (sState !== SeparatorState.FLOAT && $separatorsStore.filter((f) => f === name).length > 0) {
|
if (sState !== SeparatorState.FLOAT && $separatorsStore.filter((f) => f === name).length > 0) {
|
||||||
$separatorsStore = $separatorsStore.filter((f) => f !== name)
|
$separatorsStore = $separatorsStore.filter((f) => f !== name)
|
||||||
|
@ -140,7 +140,7 @@
|
|||||||
updateDeviceSize()
|
updateDeviceSize()
|
||||||
|
|
||||||
$: secondRow = checkAdaptiveMatching($deviceInfo.size, 'xs')
|
$: secondRow = checkAdaptiveMatching($deviceInfo.size, 'xs')
|
||||||
$: asideFloat = $deviceInfo.aside.float
|
$: asideFloat = checkAdaptiveMatching($deviceInfo.size, 'sm')
|
||||||
$: asideOpen = $deviceInfo.aside.visible
|
$: asideOpen = $deviceInfo.aside.visible
|
||||||
$: appsMini =
|
$: appsMini =
|
||||||
$deviceInfo.isMobile &&
|
$deviceInfo.isMobile &&
|
||||||
|
@ -126,7 +126,8 @@
|
|||||||
import { get } from 'svelte/store'
|
import { get } from 'svelte/store'
|
||||||
|
|
||||||
const HIDE_NAVIGATOR = 720
|
const HIDE_NAVIGATOR = 720
|
||||||
const HIDE_ASIDE = 1024
|
const HIDE_ASIDE = 680 // sm
|
||||||
|
const FLOAT_ASIDE = 1024 // lg
|
||||||
let contentPanel: HTMLElement
|
let contentPanel: HTMLElement
|
||||||
|
|
||||||
const { setTheme } = getContext<{ setTheme: (theme: string) => void }>('theme')
|
const { setTheme } = getContext<{ setTheme: (theme: string) => void }>('theme')
|
||||||
@ -642,13 +643,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkWorkbenchWidth()
|
checkWorkbenchWidth()
|
||||||
$: if ($deviceInfo.docWidth <= HIDE_ASIDE && !$deviceInfo.aside.float) {
|
$: if ($deviceInfo.docWidth <= FLOAT_ASIDE && !$deviceInfo.aside.float) {
|
||||||
$deviceInfo.aside.visible = false
|
$deviceInfo.aside.visible = false
|
||||||
$deviceInfo.aside.float = true
|
$deviceInfo.aside.float = true
|
||||||
} else if ($deviceInfo.docWidth > HIDE_ASIDE && $deviceInfo.aside.float) {
|
} else if ($deviceInfo.docWidth > FLOAT_ASIDE && $deviceInfo.aside.float) {
|
||||||
$deviceInfo.aside.float = false
|
$deviceInfo.aside.float = false
|
||||||
$deviceInfo.aside.visible = !hiddenAside
|
$deviceInfo.aside.visible = !hiddenAside
|
||||||
}
|
}
|
||||||
|
$: expandedFloatASide = $deviceInfo.docWidth <= FLOAT_ASIDE && $deviceInfo.docWidth > HIDE_ASIDE
|
||||||
const checkOnHide = (): void => {
|
const checkOnHide = (): void => {
|
||||||
if ($deviceInfo.navigator.visible && $deviceInfo.navigator.float) $deviceInfo.navigator.visible = false
|
if ($deviceInfo.navigator.visible && $deviceInfo.navigator.float) $deviceInfo.navigator.visible = false
|
||||||
}
|
}
|
||||||
@ -976,6 +978,7 @@
|
|||||||
<div
|
<div
|
||||||
bind:this={contentPanel}
|
bind:this={contentPanel}
|
||||||
class={navigatorModel === undefined ? 'hulyPanels-container' : 'hulyComponent overflow-hidden'}
|
class={navigatorModel === undefined ? 'hulyPanels-container' : 'hulyComponent overflow-hidden'}
|
||||||
|
class:straighteningCorners={expandedFloatASide && $sidebarStore.variant === SidebarVariant.EXPANDED}
|
||||||
data-id={'contentPanel'}
|
data-id={'contentPanel'}
|
||||||
>
|
>
|
||||||
{#if currentApplication && currentApplication.component}
|
{#if currentApplication && currentApplication.component}
|
||||||
@ -1014,15 +1017,15 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if !$deviceInfo.aside.float}
|
{#if $deviceInfo.docWidth > HIDE_ASIDE}
|
||||||
{#if $sidebarStore.variant === SidebarVariant.EXPANDED}
|
{#if $sidebarStore.variant === SidebarVariant.EXPANDED && !expandedFloatASide}
|
||||||
<Separator name={'main'} index={0} color={'transparent'} separatorSize={0} short />
|
<Separator name={'main'} index={0} color={'transparent'} separatorSize={0} short />
|
||||||
{/if}
|
{/if}
|
||||||
<WidgetsBar />
|
<WidgetsBar expandedFloat={expandedFloatASide} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<Dock />
|
<Dock />
|
||||||
{#if $deviceInfo.aside.float}
|
{#if $deviceInfo.docWidth <= HIDE_ASIDE}
|
||||||
<div
|
<div
|
||||||
class="antiPanel-navigator right fly no-print {$deviceInfo.navigator.direction === 'horizontal'
|
class="antiPanel-navigator right fly no-print {$deviceInfo.navigator.direction === 'horizontal'
|
||||||
? 'portrait'
|
? 'portrait'
|
||||||
@ -1067,6 +1070,9 @@
|
|||||||
&.inner {
|
&.inner {
|
||||||
background-color: var(--theme-navpanel-color);
|
background-color: var(--theme-navpanel-color);
|
||||||
|
|
||||||
|
.straighteningCorners {
|
||||||
|
border-radius: var(--medium-BorderRadius) 0 0 var(--medium-BorderRadius);
|
||||||
|
}
|
||||||
&.rounded {
|
&.rounded {
|
||||||
border-radius: 0 var(--medium-BorderRadius) var(--medium-BorderRadius) 0;
|
border-radius: 0 var(--medium-BorderRadius) var(--medium-BorderRadius) 0;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
import SidebarMini from './SidebarMini.svelte'
|
import SidebarMini from './SidebarMini.svelte'
|
||||||
import SidebarExpanded from './SidebarExpanded.svelte'
|
import SidebarExpanded from './SidebarExpanded.svelte'
|
||||||
|
|
||||||
|
export let expandedFloat: boolean = false
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
const widgets = client.getModel().findAllSync(workbench.class.Widget, {})
|
const widgets = client.getModel().findAllSync(workbench.class.Widget, {})
|
||||||
@ -64,13 +66,14 @@
|
|||||||
<div
|
<div
|
||||||
id="sidebar"
|
id="sidebar"
|
||||||
class="antiPanel-application vertical sidebar-container"
|
class="antiPanel-application vertical sidebar-container"
|
||||||
class:mini
|
class:mini={mini || expandedFloat}
|
||||||
class:float={$deviceInfo.aside.float}
|
class:expandedFloat
|
||||||
|
class:float={$deviceInfo.aside.float && !expandedFloat}
|
||||||
>
|
>
|
||||||
{#if mini}
|
{#if mini}
|
||||||
<SidebarMini {widgets} {preferences} />
|
<SidebarMini {widgets} {preferences} />
|
||||||
{:else if $sidebarStore.variant === SidebarVariant.EXPANDED}
|
{:else if $sidebarStore.variant === SidebarVariant.EXPANDED}
|
||||||
<SidebarExpanded {widgets} {preferences} />
|
<SidebarExpanded {widgets} {preferences} float={expandedFloat} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -96,8 +99,18 @@
|
|||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
&:not(.expandedFloat) {
|
||||||
|
border-radius: var(--medium-BorderRadius);
|
||||||
|
}
|
||||||
|
&.expandedFloat {
|
||||||
|
border-left-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 680px) {
|
||||||
|
.sidebar-container {
|
||||||
border: 1px solid var(--theme-navpanel-divider);
|
border: 1px solid var(--theme-navpanel-divider);
|
||||||
border-radius: var(--medium-BorderRadius);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
Location,
|
Location,
|
||||||
Header,
|
Header,
|
||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
getCurrentLocation
|
getCurrentLocation,
|
||||||
|
Separator
|
||||||
} from '@hcengineering/ui'
|
} from '@hcengineering/ui'
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
|
|
||||||
@ -32,6 +33,7 @@
|
|||||||
|
|
||||||
export let widgets: Widget[] = []
|
export let widgets: Widget[] = []
|
||||||
export let preferences: WidgetPreference[] = []
|
export let preferences: WidgetPreference[] = []
|
||||||
|
export let float: boolean = false
|
||||||
|
|
||||||
let widgetId: Ref<Widget> | undefined = undefined
|
let widgetId: Ref<Widget> | undefined = undefined
|
||||||
let widget: Widget | undefined = undefined
|
let widget: Widget | undefined = undefined
|
||||||
@ -96,70 +98,92 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="sidebar-content">
|
<div class="sidebar-wrap__content" class:float>
|
||||||
{#if widget?.component}
|
{#if float}
|
||||||
<div class="component" use:resizeObserver={resize}>
|
<Separator name={'main'} index={0} color={'var(--theme-navpanel-border)'} float={'sidebar'} />
|
||||||
{#if widget.headerLabel}
|
{/if}
|
||||||
<Header
|
<div class="sidebar-content">
|
||||||
allowFullsize={false}
|
{#if widget?.component}
|
||||||
type="type-aside"
|
<div class="component" use:resizeObserver={resize}>
|
||||||
hideBefore={true}
|
{#if widget.headerLabel}
|
||||||
hideActions={false}
|
<Header
|
||||||
hideDescription={true}
|
allowFullsize={false}
|
||||||
adaptive="disabled"
|
type="type-aside"
|
||||||
closeOnEscape={false}
|
hideBefore={true}
|
||||||
|
hideActions={false}
|
||||||
|
hideDescription={true}
|
||||||
|
adaptive="disabled"
|
||||||
|
closeOnEscape={false}
|
||||||
|
on:close={() => {
|
||||||
|
if (widget !== undefined) {
|
||||||
|
closeWidget(widget._id)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Breadcrumbs items={[{ label: widget.headerLabel }]} currentOnly />
|
||||||
|
</Header>
|
||||||
|
{/if}
|
||||||
|
<Component
|
||||||
|
is={widget?.component}
|
||||||
|
props={{ tab, widgetState, height: componentHeight, width: componentWidth, widget }}
|
||||||
on:close={() => {
|
on:close={() => {
|
||||||
if (widget !== undefined) {
|
if (widget !== undefined) {
|
||||||
closeWidget(widget._id)
|
closeWidget(widget._id)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
<Breadcrumbs items={[{ label: widget.headerLabel }]} currentOnly />
|
</div>
|
||||||
</Header>
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
<Component
|
{#if widget !== undefined && tabs.length > 0}
|
||||||
is={widget?.component}
|
<SidebarTabs
|
||||||
props={{ tab, widgetState, height: componentHeight, width: componentWidth, widget }}
|
{tabs}
|
||||||
on:close={() => {
|
selected={tab?.id}
|
||||||
if (widget !== undefined) {
|
{widget}
|
||||||
closeWidget(widget._id)
|
on:close={(e) => {
|
||||||
}
|
void handleTabClose(e.detail, widget)
|
||||||
}}
|
}}
|
||||||
/>
|
on:open={(e) => {
|
||||||
</div>
|
handleTabOpen(e.detail, widget)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if widget !== undefined && tabs.length > 0}
|
<WidgetsBar {widgets} {preferences} selected={widgetId} expandedFloat={float} />
|
||||||
<SidebarTabs
|
|
||||||
{tabs}
|
|
||||||
selected={tab?.id}
|
|
||||||
{widget}
|
|
||||||
on:close={(e) => {
|
|
||||||
void handleTabClose(e.detail, widget)
|
|
||||||
}}
|
|
||||||
on:open={(e) => {
|
|
||||||
handleTabOpen(e.detail, widget)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
<WidgetsBar {widgets} {preferences} selected={widgetId} />
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.sidebar-wrap__content,
|
||||||
.sidebar-content {
|
.sidebar-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
border-top: 1px solid transparent; // var(--theme-divider-color);
|
|
||||||
border-right: 1px solid var(--theme-divider-color);
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
width: calc(100% - 3.5rem);
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
}
|
||||||
|
.sidebar-wrap__content {
|
||||||
|
width: calc(100% - 3.5rem);
|
||||||
background-color: var(--theme-panel-color);
|
background-color: var(--theme-panel-color);
|
||||||
|
border-top: 1px solid transparent; // var(--theme-divider-color);
|
||||||
|
border-right: 1px solid var(--theme-divider-color);
|
||||||
border-left: none;
|
border-left: none;
|
||||||
|
|
||||||
|
&.float {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 3.5rem;
|
||||||
|
border-top-color: var(--theme-divider-color);
|
||||||
|
border-bottom: 1px solid var(--theme-divider-color);
|
||||||
|
z-index: 491;
|
||||||
|
filter: drop-shadow(-2px 0 5px rgba(0, 0, 0, 0.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 680px) {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sidebar-content {
|
||||||
|
overflow: auto;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.component {
|
.component {
|
||||||
|
@ -86,11 +86,11 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
width: 30px;
|
width: 2rem;
|
||||||
min-width: 30px;
|
min-width: 2rem;
|
||||||
max-width: 30px;
|
max-width: 2rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-right: 1px solid var(--theme-divider-color);
|
border-left: 1px solid var(--theme-divider-color);
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0.25rem 0;
|
padding: 0.25rem 0;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
export let widgets: Widget[] = []
|
export let widgets: Widget[] = []
|
||||||
export let preferences: WidgetPreference[] = []
|
export let preferences: WidgetPreference[] = []
|
||||||
export let selected: Ref<Widget> | undefined = undefined
|
export let selected: Ref<Widget> | undefined = undefined
|
||||||
|
export let expandedFloat: boolean = false
|
||||||
|
|
||||||
function handleAddWidget (): void {
|
function handleAddWidget (): void {
|
||||||
showPopup(AddWidgetsPopup, { widgets })
|
showPopup(AddWidgetsPopup, { widgets })
|
||||||
@ -31,7 +32,7 @@
|
|||||||
|
|
||||||
function handleSelectWidget (widget: Widget): void {
|
function handleSelectWidget (widget: Widget): void {
|
||||||
if (selected === widget._id) {
|
if (selected === widget._id) {
|
||||||
if ($deviceInfo.aside.float) $deviceInfo.aside.visible = false
|
if ($deviceInfo.aside.float && !expandedFloat) $deviceInfo.aside.visible = false
|
||||||
else minimizeSidebar(true)
|
else minimizeSidebar(true)
|
||||||
} else {
|
} else {
|
||||||
openWidget(widget, $sidebarStore.widgetsState.get(widget._id)?.data, { active: true, openedByUser: true })
|
openWidget(widget, $sidebarStore.widgetsState.get(widget._id)?.data, { active: true, openedByUser: true })
|
||||||
|
Loading…
Reference in New Issue
Block a user