From 2307ab5eb5d48462d537af87257b3413eba1391e Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Fri, 11 Feb 2022 20:41:16 +0700 Subject: [PATCH] Update StatesBar (Safari fix) Signed-off-by: Alexander Platov --- packages/theme/styles/components.scss | 63 ++++++++++++++++ .../src/components/state/StatesBar.svelte | 44 ++---------- .../components/state/StatesBarElement.svelte | 71 ++++++++----------- 3 files changed, 97 insertions(+), 81 deletions(-) diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 271890663d..ee6ad5306a 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -200,3 +200,66 @@ } } .ac-column__list-item + .ac-column__list-item { margin-top: .75rem; } + +/* StatesBar */ +.antiStatesBar { + overflow-x: auto; + display: flex; + align-items: center; + flex: 1 0; + padding: 0.125rem 0; + min-width: 0; + // width: auto; + + &::-webkit-scrollbar:horizontal { height: 0.125rem; } + &::-webkit-scrollbar-track { margin: 0.25rem; } + &::-webkit-scrollbar-thumb { background-color: var(--theme-bg-accent-color); } + + &.mask-none { mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 1); } + &.mask-left { mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 1) 1rem); } + &.mask-right { mask-image: linear-gradient(to left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 1) 1rem); } + &.mask-both { + mask-image: linear-gradient( + to right, + rgba(0, 0, 0, 0) 0, + rgba(0, 0, 0, 1) 1rem, + rgba(0, 0, 0, 1) calc(100% - 1rem), + rgba(0, 0, 0, 0) 100% + ); + } + + .asb-bar { + flex: 1 0 auto; + position: relative; + display: flex; + min-width: 0; + // max-width: 100%; + width: auto; + // height: auto; + + &__back { + width: auto; + height: 2.25rem; + } + &__element { + fill: var(--theme-button-bg-enabled); + stroke: var(--theme-bg-accent-color); + stroke-linecap: round; + stroke-linejoin: round; + } + &__selected { fill: red; } + + .asb-label__container { + position: absolute; + display: flex; + justify-content: center; + align-items: center; + top: 0; + left: 1rem; + right: 1rem; + min-width: 0; + width: calc(100% - 2rem); + height: 100%; + } + } +} diff --git a/plugins/task-resources/src/components/state/StatesBar.svelte b/plugins/task-resources/src/components/state/StatesBar.svelte index 44b2f5ab4e..47f226db9f 100644 --- a/plugins/task-resources/src/components/state/StatesBar.svelte +++ b/plugins/task-resources/src/components/state/StatesBar.svelte @@ -33,7 +33,7 @@ let maskLeft: boolean = false let maskRight: boolean = false let mask: 'left' | 'right' | 'both' | 'none' = 'none' - let stepStyle = (gap === 'small') ? 'step-lr25' : 'step-lr75' + let stepStyle = (gap === 'small') ? 'safari-gap-1' : 'safari-gap-2' const dispatch = createEventDispatcher() @@ -87,9 +87,12 @@ } }) onDestroy(() => { if (div) div.removeEventListener('scroll', checkMask) }) + afterUpdate(() => { + console.log('!!!!!!!!!!!!!!!!!!!!!!! UPDATED') + }) -
+
{#each states as item, i (item._id)} {/each}
- - diff --git a/plugins/task-resources/src/components/state/StatesBarElement.svelte b/plugins/task-resources/src/components/state/StatesBarElement.svelte index 9c864d040d..6099855cc6 100644 --- a/plugins/task-resources/src/components/state/StatesBarElement.svelte +++ b/plugins/task-resources/src/components/state/StatesBarElement.svelte @@ -25,79 +25,66 @@ let lenght: number = 0 let text: HTMLElement + let divBar: HTMLElement + let svgBack: SVGElement + + // $: if (text) lenght = (text.clientWidth + 20 > 300) ? 300 : text.clientWidth + 20 + // $: if (lenght) { + // if (position === 'start') d = `M0,8c0-4.4,3.6-8,8-8h2h${lenght}h1.8c0.8,0,1.6,0.5,1.9,1.3l6.1,16c0.2,0.5,0.2,1,0,1.4l-6.1,16c-0.3,0.8-1,1.3-1.9,1.3L${lenght + 10},36H10 l-2,0c-4.4,0-8-3.6-8-8V8z` + // else if (position === 'middle') d = `M6.1,17.3l-6-15.9C-0.2,0.7,0.3,0,1,0h9h${lenght}h1.8c0.8,0,1.6,0.5,1.9,1.3l6.1,16c0.2,0.5,0.2,1,0,1.4l-6.1,16 c-0.3,0.8-1,1.3-1.9,1.3H${lenght + 10}H10H1c-0.7,0-1.2-0.7-0.9-1.4l6-15.9C6.3,18.3,6.3,17.7,6.1,17.3z` + // else if (position === 'end') d = `M6.1,17.3l-6-15.9C-0.2,0.7,0.3,0,1,0h9h${lenght}h2c4.4,0,8,3.6,8,8v20c0,4.4-3.6,8-8,8h-2H10H1 c-0.7,0-1.2-0.7-0.9-1.4l6-15.9C6.3,18.3,6.3,17.7,6.1,17.3z` + // else d = `M0,8c0-4.4,3.6-8,8-8l2,0h${lenght}l2,0c4.4,0,8,3.6,8,8v20c0,4.4-3.6,8-8,8h-2H10H8c-4.4,0-8-3.6-8-8V8z` + // } afterUpdate(() => { if (text) lenght = (text.clientWidth + 20 > 300) ? 300 : text.clientWidth + 20 + if (divBar) divBar.style.width = lenght + 20 + 'px' + if (svgBack) svgBack.style.width = lenght + 20 + 'px' })
{label}
{#if lenght > 0}
-
{label}
- - {#if position === 'start'} + + {#if (position === 'start') } - {:else if position === 'middle'} + {:else if (position === 'middle') } - {:else if position === 'end'} + {:else if (position === 'end') } {:else} {/if} +
{label}
{/if} - -