Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBER-274,-287,-288,-294: fixed tooltip, ActionsPopup, ListHeader, activity. #3282

Merged
merged 3 commits into from
May 30, 2023
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
2 changes: 1 addition & 1 deletion packages/presentation/src/components/DocPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
icon={IconSearch}
size={'large'}
width={'100%'}
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
bind:value={search}
on:change={() => dispatch('search', search)}
on:input={() => dispatch('search', search)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</script>

<Panel on:changeContent on:close>
<EditBox focus bind:value={search} kind="search-style" />
<EditBox autoFocus bind:value={search} kind="search-style" />
<div class="indexed-background">
<div class="indexed-doc text-base max-h-125">
<div class="flex">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{#if noPanel}
<div class="p-1 flex-col">
<Label label={presentation.string.DocumentPreview} />
<EditBox focus bind:value={search} kind="search-style" />
<EditBox autoFocus bind:value={search} kind="search-style" />
</div>
<div class="indexed-background">
<div class="indexed-doc text-base max-h-125">
Expand All @@ -36,7 +36,7 @@
</div>
{:else}
<Panel on:changeContent on:close>
<EditBox focus bind:value={search} kind="search-style" />
<EditBox autoFocus bind:value={search} kind="search-style" />
<div class="indexed-background">
<div class="indexed-doc text-base max-h-125">
{#if indexDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
{/each}
</div>
<EditBox
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
icon={IconSearch}
kind={'search-style'}
focusIndex={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
icon={IconSearch}
size={'large'}
width={'100%'}
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
bind:value={searchQuery}
{placeholder}
{placeholderParam}
Expand Down
2 changes: 1 addition & 1 deletion packages/text-editor/src/components/LinkPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
}}
on:changeContent
>
<EditBox placeholder={linkPlaceholder} bind:value={link} focus />
<EditBox placeholder={linkPlaceholder} bind:value={link} autoFocus />
</Card>
7 changes: 7 additions & 0 deletions packages/theme/styles/_layouts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ input.search {
display: flex;
align-items: stretch;
}
.flex-row-baseline {
display: flex;
align-items: baseline;
flex-wrap: nowrap;
min-width: 0;
}
.flex-row-center {
display: flex;
align-items: center;
Expand Down Expand Up @@ -659,6 +665,7 @@ input.search {
.max-w-40 { max-width: 10rem; }
.max-w-60 { max-width: 15rem; }
.max-w-80 { max-width: 20rem; }
.max-w-120 { max-width: 30rem; }
.max-w-240 { max-width: 60rem; }
.max-h-0 { max-height: 0; }
.max-h-2 { max-height: .5rem; }
Expand Down
12 changes: 12 additions & 0 deletions packages/theme/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@
&.noMargin { margin: 0; }
}

.antiHSpacer {
flex-shrink: 0;
width: .25rem;

&:not(.withMargins) { margin: 0 !important; }

&.x1-5 { width: .375rem; }
&.x2 { width: .5rem; }
&.x3 { width: .75rem; }
&.x4 { width: 1rem; }
}

.antiSection {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/ColorPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
icon={IconSearch}
size={'large'}
width={'100%'}
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
bind:value={search}
{placeholder}
{placeholderParam}
Expand Down
27 changes: 25 additions & 2 deletions packages/ui/src/components/Component.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
export let shrink: boolean = false
export let showLoading = true
export let inline: boolean = false
export let disabled: boolean = false

$: component = is != null ? getResource(is) : Promise.reject(new Error('is not defined'))
</script>
Expand All @@ -40,11 +41,33 @@
{:then Ctor}
<ErrorBoundary>
{#if $$slots.default !== undefined}
<Ctor bind:this={innerRef} {...props} {inline} on:change on:close on:open on:click on:delete on:action>
<Ctor
bind:this={innerRef}
{...props}
{inline}
{disabled}
on:change
on:close
on:open
on:click
on:delete
on:action
>
<slot />
</Ctor>
{:else}
<Ctor bind:this={innerRef} {...props} {inline} on:change on:close on:open on:click on:delete on:action />
<Ctor
bind:this={innerRef}
{...props}
{inline}
{disabled}
on:change
on:close
on:open
on:click
on:delete
on:action
/>
{/if}
</ErrorBoundary>
{:catch err}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/DropdownLabelsPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
icon={IconSearch}
size={'large'}
width={'100%'}
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
bind:value={search}
{placeholder}
{placeholderParam}
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/components/EditBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
export let format: 'text' | 'password' | 'number' = 'text'
export let maxDigitsAfterPoint: number | undefined = undefined
export let kind: EditStyle = 'editbox'
export let focus: boolean = false
export let autoFocus: boolean = false
export let select: boolean = false
export let focusable: boolean = false
export let disabled: boolean = false
Expand Down Expand Up @@ -87,9 +87,9 @@
}

onMount(() => {
if (focus) {
if (autoFocus) {
input.focus()
focus = false
autoFocus = false
}
if (select) {
input.select()
Expand Down Expand Up @@ -125,7 +125,7 @@
input.addEventListener('focus', updateFocus, { once: true })
}

export function focused (): void {
export function focus (): void {
input.focus()
}
</script>
Expand Down
12 changes: 7 additions & 5 deletions packages/ui/src/components/EditWithIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@
export let value: string | undefined = undefined
export let placeholder: IntlString = plugin.string.EditBoxPlaceholder
export let placeholderParam: any | undefined = undefined
export let focus: boolean = false
export let autoFocus: boolean = false
export let size: 'small' | 'medium' | 'large' = 'medium'

const dispatch = createEventDispatcher()
let textHTML: HTMLInputElement
let phTraslate: string = ''

export function focus () {
textHTML.focus()
autoFocus = false
}

$: translate(placeholder, placeholderParam ?? {}).then((res) => {
phTraslate = res
})
$: if (textHTML !== undefined) {
if (focus) {
textHTML.focus()
focus = false
}
if (autoFocus) focus()
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/SelectPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
icon={IconSearch}
size={'large'}
width={'100%'}
focus={!$deviceOptionsStore.isMobile}
autoFocus={!$deviceOptionsStore.isMobile}
bind:value={search}
{placeholder}
{placeholderParam}
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/TooltipInstance.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@
class:doublePadding={$tooltip.label}
use:resizeObserver={(element) => {
clWidth = element.clientWidth
if (kind === 'submenu') fitSubmenu()
else fitTooltip(tooltipHTML)
}}
bind:this={tooltipHTML}
>
Expand Down
10 changes: 6 additions & 4 deletions plugins/activity-resources/src/components/TxViewTx.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
<IconAdd size={'x-small'} fill={'var(--theme-trans-color)'} />
{/if}
{#if typeof viewlet?.component === 'string'}
<Component is={viewlet?.component} props={getProps(ctx, edit)} inline on:close={onCancelEdit} />
<Component is={viewlet?.component} props={getProps(ctx, edit)} disabled inline on:close={onCancelEdit} />
{:else}
<svelte:component this={viewlet?.component} {...getProps(ctx, edit)} inline on:close={onCancelEdit} />
<svelte:component this={viewlet?.component} {...getProps(ctx, edit)} disabled inline on:close={onCancelEdit} />
{/if}
<div class="antiHSpacer" />
{/each}
{#each filterTx([...tx.txes, tx], core.class.TxRemoveDoc) as ctx, i}
{#if i === 0 && !presentersOnly}
<IconDelete size={'x-small'} fill={'var(--theme-trans-color)'} />
{/if}
{#if typeof viewlet?.component === 'string'}
<Component is={viewlet?.component} props={getProps(ctx, edit)} inline on:close={onCancelEdit} />
<Component is={viewlet?.component} props={getProps(ctx, edit)} disabled inline on:close={onCancelEdit} />
{:else}
<svelte:component this={viewlet?.component} {...getProps(ctx, edit)} inline on:close={onCancelEdit} />
<svelte:component this={viewlet?.component} {...getProps(ctx, edit)} disabled inline on:close={onCancelEdit} />
{/if}
<div class="antiHSpacer" />
{/each}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{#if typeClass === core.class.TypeString || typeClass === core.class.TypeMarkup}
<EditBox bind:value />
{:else if typeClass === core.class.TypeNumber}
<NumberEditor value={Number(value)} {onChange} focus={true} placeholder={ui.string.EditBoxPlaceholder} />
<NumberEditor value={Number(value)} {onChange} autoFocus placeholder={ui.string.EditBoxPlaceholder} />
{:else if typeClass === core.class.TypeBoolean}
<BooleanEditor {value} {onChange} />
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<NumberEditor
kind={'button'}
value={syncPeriod}
focus={false}
autoFocus={false}
placeholder={getEmbeddedLabel('Period')}
onChange={(val) => {
if (val) {
Expand All @@ -165,7 +165,7 @@
<NumberEditor
kind={'button'}
value={limit}
focus={false}
autoFocus={false}
placeholder={getEmbeddedLabel('Limit')}
onChange={(val) => {
if (val) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/board-resources/src/components/CreateBoard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
icon={IconFolder}
bind:value={name}
placeholder={board.string.Board}
focus
autoFocus
/>
<!-- <ToggleWithLabel label={board.string.MakePrivate} description={board.string.MakePrivateDescription} /> -->

Expand Down
2 changes: 1 addition & 1 deletion plugins/board-resources/src/components/CreateCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
bind:value={title}
icon={board.icon.Card}
placeholder={board.string.CardPlaceholder}
focus
autoFocus
/>
</Grid>
</Card>
7 changes: 6 additions & 1 deletion plugins/board-resources/src/components/EditCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@
}}
/>
</svelte:fragment>
<EditBox bind:value={object.title} kind={'large-style'} focus on:change={() => change('title', object?.title)} />
<EditBox
bind:value={object.title}
kind={'large-style'}
autoFocus
on:change={() => change('title', object?.title)}
/>
<div class="background-accent-bg-color border-divider-color border-radius-3 p-4 mt-4 w-full">
<StyledTextBox
alwaysEdit={true}
Expand Down
4 changes: 2 additions & 2 deletions plugins/board-resources/src/components/KanbanCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<div class="fs-title text-lg">
<EditBox
bind:value={object.title}
focus
autoFocus
on:change={() => updateCard(client, object, 'title', object?.title)}
/>
</div>
Expand Down Expand Up @@ -158,7 +158,7 @@
<div class="fs-title text-lg">
<EditBox
bind:value={object.title}
focus
autoFocus
on:change={() => updateCard(client, object, 'title', object?.title)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<div class="flex-col flex-gap-1">
<Label label={board.string.Title} />
<div class="p-2 mt-1 mb-1 border-divider-color border-radius-1">
<EditBox bind:value={name} focus={true} />
<EditBox bind:value={name} autoFocus />
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}}
on:changeContent
>
<EditBox bind:value={title} placeholder={calendar.string.Title} kind={'large-style'} focus />
<EditBox bind:value={title} placeholder={calendar.string.Title} kind={'large-style'} autoFocus />
<svelte:fragment slot="pool">
<DateRangePresenter
value={startDate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
}}
on:changeContent
>
<EditBox bind:value={title} placeholder={calendar.string.Title} kind={'large-style'} focus />
<EditBox bind:value={title} placeholder={calendar.string.Title} kind={'large-style'} autoFocus />
<svelte:fragment slot="pool">
<!-- <TimeShiftPicker title={calendar.string.Date} bind:value direction="after" /> -->
<DateRangePresenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{/if}
</div>
{#if withInput}
<div class="mt-2">
<div class="mt-2 max-w-120">
<CommentInput {object} />
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
icon={IconFolder}
bind:value={name}
placeholder={chunter.string.ChannelNamePlaceholder}
focus
autoFocus
/>
</Card>
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
icon={IconFolder}
bind:value={name}
placeholder={chunter.string.ChannelNamePlaceholder}
focus
autoFocus
/>
<ToggleWithLabel
label={presentation.string.MakePrivate}
Expand Down
Loading