Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/panel/src/components/Panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
-->
<script lang="ts">
import { afterUpdate, createEventDispatcher, SvelteComponent } from 'svelte'
import { Writable, writable } from 'svelte/store'

Check warning on line 18 in packages/panel/src/components/Panel.svelte

View workflow job for this annotation

GitHub Actions / formatting

Unable to resolve path to module 'svelte/store'

import activity from '@hcengineering/activity'
import { AccountRole, Doc, getCurrentAccount } from '@hcengineering/core'
import {
Component,
deviceOptionsStore as deviceInfo,
printModeStore,
Panel,
Scroller,
resizeObserver,
Expand Down Expand Up @@ -54,7 +55,7 @@
export let content: HTMLElement | undefined | null = undefined
export let withoutContentScroll: boolean = false
export let customAside: ButtonItem[] | undefined = undefined
export let selectedAside: string | boolean = customAside ? customAside[0].id : isAside

Check warning on line 58 in packages/panel/src/components/Panel.svelte

View workflow job for this annotation

GitHub Actions / formatting

Unexpected nullish value in conditional. The condition is always false
export let printHeader: boolean = true
export let printAside: boolean = false
export let adaptive: HeaderAdaptive = 'disabled'
Expand Down Expand Up @@ -89,7 +90,7 @@
const waitCount = 10
const PanelScrollTop: Writable<Record<string, number>> = writable<Record<string, number>>({})

const startScrollHeightCheck = () => {

Check warning on line 93 in packages/panel/src/components/Panel.svelte

View workflow job for this annotation

GitHub Actions / formatting

Missing return type on function
clearTimeout(timer)
timer = setTimeout(() => {
if (content == null) {
Expand Down Expand Up @@ -122,6 +123,8 @@
startScrollHeightCheck()
}
})

$: max = useMaxWidth === true || $printModeStore
</script>

<Panel
Expand Down Expand Up @@ -250,7 +253,7 @@
</svelte:fragment>

{#if $deviceInfo.isMobile}
<div bind:this={content} class="popupPanel-body__mobile-content clear-mins" class:max={useMaxWidth}>
<div bind:this={content} class="popupPanel-body__mobile-content clear-mins" class:max>
<slot />
{#if showActivity}
{#key object._id}
Expand All @@ -265,7 +268,7 @@
<div
bind:this={content}
class={contentClasses ?? 'popupPanel-body__main-content py-8 clear-mins'}
class:max={useMaxWidth}
class:max
class:side-content-space={sideContentSpace > 0}
style:--side-content-space={`${sideContentSpace}px`}
>
Expand All @@ -289,14 +292,14 @@
<Scroller
bind:divScroll={content}
on:divScrollTop={(event) => {
if (lastHref === window.location.href && event && event.detail !== $PanelScrollTop[lastHref]) {

Check warning on line 295 in packages/panel/src/components/Panel.svelte

View workflow job for this annotation

GitHub Actions / formatting

Unexpected any value in conditional. An explicit comparison or type cast is required
$PanelScrollTop[lastHref] = event.detail
}
}}
>
<div
class={contentClasses ?? 'popupPanel-body__main-content py-8'}
class:max={useMaxWidth}
class:max
class:side-content-space={sideContentSpace > 0}
style:--side-content-space={`${sideContentSpace}px`}
use:resizeObserver={(element) => {
Expand Down
1 change: 1 addition & 0 deletions packages/presentation/src/components/PDFViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
</svelte:fragment>

<svelte:fragment slot="utils">
<slot name="utils" />
{#if !isLoading && src !== ''}
<a class="no-line" href={src} download={name} bind:this={download}>
<Button
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type {
export { themeStore, languageStore } from '@hcengineering/theme'
// export { applicationShortcutKey } from './utils'
export { getCurrentLocation, locationToUrl, navigate, location, setLocationStorageKey } from './location'
export { isAppFocusedStore, printModeStore } from './stores'

export { default as EditBox } from './components/EditBox.svelte'
export { default as Label } from './components/Label.svelte'
Expand Down
23 changes: 21 additions & 2 deletions packages/ui/src/stores.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2025 Hardcore Engineering Inc.
// Copyright © 2026 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
Expand All @@ -11,6 +11,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { writable } from 'svelte/store'
import { readable, writable } from 'svelte/store'

export const isAppFocusedStore = writable(true)

export const printModeStore = readable(false, (set) => {
if (globalThis.window?.matchMedia === undefined) {
return
}

const printMedia = globalThis.window.matchMedia('print')

const update = (): void => {
set(printMedia.matches)
}

update()
printMedia.addEventListener('change', update)

return () => {
printMedia.removeEventListener('change', update)
}
})
2 changes: 1 addition & 1 deletion packages/ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export interface RadioItem {

export type ButtonBaseType = 'type-button' | 'type-button-icon'

export type ButtonBaseKind = 'primary' | 'secondary' | 'tertiary' | 'negative'
export type ButtonBaseKind = 'primary' | 'secondary' | 'tertiary' | 'negative' | 'ghost'

export type ButtonBaseSize = 'large' | 'medium' | 'small' | 'extra-small' | 'min'

Expand Down
31 changes: 22 additions & 9 deletions plugins/document-resources/src/components/EditDoc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
export let embedded: boolean = false

$: locked = doc?.lockedBy != null
$: readonly = $restrictionStore.readonly || locked
$: effectiveReadonly = readonly || $restrictionStore.readonly || locked

let useMaxWidth = getUseMaxWidth()
$: saveUseMaxWidth(useMaxWidth)
Expand Down Expand Up @@ -308,7 +308,14 @@
{#if doc}
<ComponentExtensions
extension={view.extensions.EditDocTitleExtension}
props={{ size: 'medium', kind: 'ghost', _id: doc._id, _class: doc._class, value: doc, readonly }}
props={{
size: 'medium',
kind: 'ghost',
_id: doc._id,
_class: doc._class,
value: doc,
readonly: effectiveReadonly
}}
/>
{/if}
{#if !$restrictionStore.disableActions}
Expand Down Expand Up @@ -349,7 +356,7 @@
? getPlatformColorDef(doc.color, $themeStore.dark).icon
: 'currentColor'
}}
disabled={readonly}
disabled={effectiveReadonly}
showTooltip={{ label: document.string.Icon, direction: 'bottom' }}
on:click={chooseIcon}
/>
Expand All @@ -359,7 +366,7 @@
focusIndex={1}
fill
bind:value={title}
{readonly}
readonly={effectiveReadonly}
placeholder={document.string.DocumentNamePlaceholder}
on:blur={(evt) => saveTitle(evt)}
on:keydown={(evt) => {
Expand Down Expand Up @@ -388,7 +395,7 @@
<DocumentEditor
focusIndex={30}
object={doc}
{readonly}
readonly={effectiveReadonly}
boundary={content}
overflow={'none'}
editorAttributes={{ style: 'padding: 0 2em 2em; margin: 0 -2em; min-height: 30vh' }}
Expand All @@ -408,19 +415,25 @@
</div>
</div>

<RelationsEditor object={doc} {readonly} />
<RelationsEditor object={doc} readonly={effectiveReadonly} />

<svelte:fragment slot="aside">
{#if selectedAside === 'references'}
<References doc={doc._id} />
{:else if selectedAside === 'history'}
<History value={doc} {readonly} />
<History value={doc} readonly={effectiveReadonly} />
{/if}
</svelte:fragment>

<svelte:fragment slot="custom-attributes">
<!-- TODO show other properties -->
<ClassAttributeBar object={doc} _class={doc._class} to={core.class.Doc} ignoreKeys={['name']} {readonly} />
<ClassAttributeBar
object={doc}
_class={doc._class}
to={core.class.Doc}
ignoreKeys={['name']}
readonly={effectiveReadonly}
/>

<div class="doc-divider" />

Expand All @@ -438,7 +451,7 @@
<div class="flex">
<Component
is={tags.component.TagsAttributeEditor}
props={{ object: doc, label: document.string.AddLabel, readonly }}
props={{ object: doc, label: document.string.AddLabel, readonly: effectiveReadonly }}
/>
</div>
<div class="divider" />
Expand Down
8 changes: 7 additions & 1 deletion plugins/guest-resources/src/components/Guest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
PanelInstance,
Popup,
PopupAlignment,
printModeStore,
ResolvedLocation,
TooltipInstance,
areLocationsEqual,
Expand Down Expand Up @@ -287,7 +288,12 @@
</div>
<div bind:this={cover} class="cover" />
<TooltipInstance />
<PanelInstance bind:this={panelInstance} {contentPanel} readonly={$restrictionStore.readonly} embedded>
<PanelInstance
bind:this={panelInstance}
{contentPanel}
readonly={$restrictionStore.readonly || $printModeStore}
embedded
>
<svelte:fragment slot="panel-header">
<ActionContext context={{ mode: 'panel' }} />
</svelte:fragment>
Expand Down
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Tisk do PDF",
"PrintingDocumentOf": "Tisk dokumentu {current} z {total}",
"DownloadAll": "Stáhnout vše",
"PrintFailed": "Tisk se nezdařil"
"PrintFailed": "Tisk se nezdařil",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Als PDF drucken",
"PrintingDocumentOf": "Dokument {current} von {total} wird gedruckt",
"DownloadAll": "Alle herunterladen",
"PrintFailed": "Druck fehlgeschlagen"
"PrintFailed": "Druck fehlgeschlagen",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Print to PDF",
"PrintingDocumentOf": "Printing document {current} of {total}",
"DownloadAll": "Download all",
"PrintFailed": "Print failed"
"PrintFailed": "Print failed",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Imprimir en PDF",
"PrintingDocumentOf": "Imprimiendo documento {current} de {total}",
"DownloadAll": "Descargar todo",
"PrintFailed": "Error al imprimir"
"PrintFailed": "Error al imprimir",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
6 changes: 4 additions & 2 deletions plugins/print-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Imprimer en PDF",
"PrintingDocumentOf": "Impression du document {current} sur {total}",
"DownloadAll": "Tout télécharger",
"PrintFailed": "Échec de l'impression"
"PrintFailed": "Échec de l'impression",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Stampa in PDF",
"PrintingDocumentOf": "Stampa documento {current} di {total}",
"DownloadAll": "Scarica tutto",
"PrintFailed": "Stampa non riuscita"
"PrintFailed": "Stampa non riuscita",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "PDFとして印刷",
"PrintingDocumentOf": "ドキュメント {current} / {total} を印刷中",
"DownloadAll": "すべてダウンロード",
"PrintFailed": "印刷に失敗しました"
"PrintFailed": "印刷に失敗しました",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "PDF로 인쇄",
"PrintingDocumentOf": "문서 {current} / {total} 인쇄 중",
"DownloadAll": "모두 다운로드",
"PrintFailed": "인쇄 실패"
"PrintFailed": "인쇄 실패",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Imprimir em PDF",
"PrintingDocumentOf": "Imprimindo documento {current} de {total}",
"DownloadAll": "Baixar tudo",
"PrintFailed": "Falha na impressão"
"PrintFailed": "Falha na impressão",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Imprimir em PDF",
"PrintingDocumentOf": "Imprimindo documento {current} de {total}",
"DownloadAll": "Descarregar tudo",
"PrintFailed": "Falha na impressão"
"PrintFailed": "Falha na impressão",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "Печать в PDF",
"PrintingDocumentOf": "Печать документа {current} из {total}",
"DownloadAll": "Скачать все",
"PrintFailed": "Ошибка печати"
"PrintFailed": "Ошибка печати",
"PrintSettings": "Настройки печати",
"LandscapeMode": "Ландшафтный режим"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "PDF'e yazdır",
"PrintingDocumentOf": "Belge yazdırılıyor {current} / {total}",
"DownloadAll": "Tümünü indir",
"PrintFailed": "Yazdırma başarısız"
"PrintFailed": "Yazdırma başarısız",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
4 changes: 3 additions & 1 deletion plugins/print-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"PrintToPDF": "打印为 PDF",
"PrintingDocumentOf": "正在打印文档 {current} / {total}",
"DownloadAll": "全部下载",
"PrintFailed": "打印失败"
"PrintFailed": "打印失败",
"PrintSettings": "Print settings",
"LandscapeMode": "Landscape mode"
}
}
Loading
Loading