Skip to content

Commit 9098b81

Browse files
committed
[FIX] cf: conditional formatting preview is truncated for nothing
In the side panel, the preview of a conditional formatting rule is truncated at 142px, even if there is enough space to display it fully. Task: 5344000 X-original-commit: 5d0df51
1 parent 7ed20c4 commit 9098b81

File tree

3 files changed

+148
-170
lines changed

3 files changed

+148
-170
lines changed

src/components/side_panel/conditional_formatting/cf_preview/cf_preview.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { ICONS } from "../../../icons/icons";
99
import { CellIsOperators, CfTerms } from "../../../translations_terms";
1010

1111
css/* scss */ `
12-
.o-cf-preview {
12+
.o-spreadsheet .o-cf-preview {
1313
&.o-cf-cursor-ptr {
1414
cursor: pointer;
1515
}
1616
1717
border-bottom: 1px solid ${GRAY_300};
18-
height: 60px;
18+
height: 80px;
1919
padding: 10px;
20+
box-sizing: border-box;
2021
position: relative;
2122
cursor: pointer;
2223
&:hover,
@@ -30,7 +31,6 @@ css/* scss */ `
3031
.o-cf-preview-icon {
3132
border: 1px solid ${GRAY_300};
3233
background-color: #fff;
33-
position: absolute;
3434
height: 50px;
3535
width: 50px;
3636
.o-icon {
@@ -39,12 +39,6 @@ css/* scss */ `
3939
}
4040
}
4141
.o-cf-preview-description {
42-
left: 65px;
43-
margin-bottom: auto;
44-
margin-right: 8px;
45-
margin-top: auto;
46-
position: relative;
47-
width: 142px;
4842
.o-cf-preview-description-rule {
4943
margin-bottom: 4px;
5044
max-height: 2.8em;
@@ -54,16 +48,11 @@ css/* scss */ `
5448
font-size: 12px;
5549
}
5650
}
57-
.o-cf-delete {
58-
left: 90%;
59-
top: 39%;
60-
position: absolute;
61-
}
6251
&:not(:hover):not(.o-cf-dragging) .o-cf-drag-handle {
6352
display: none !important;
6453
}
6554
.o-cf-drag-handle {
66-
left: -8px;
55+
left: 2px;
6756
cursor: move;
6857
.o-icon {
6958
width: 6px;

src/components/side_panel/conditional_formatting/cf_preview/cf_preview.xml

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,43 @@
22
<t t-name="o-spreadsheet-ConditionalFormatPreview">
33
<t t-set="cf" t-value="props.conditionalFormat"/>
44
<div
5-
class="o-cf-preview w-100"
5+
class="o-cf-preview w-100 d-flex align-items-center"
66
t-ref="cfPreview"
77
t-att-class="props.class"
88
t-att-data-id="cf.id"
99
t-on-click="props.onPreviewClick"
1010
t-on-pointerdown="(ev) => this.onMouseDown(ev)">
11-
<div class="position-relative h-100 w-100 d-flex align-items-center">
11+
<div class="o-cf-drag-handle h-100 position-absolute d-flex align-items-center o-button-icon">
12+
<t t-call="o-spreadsheet-Icon.THIN_DRAG_HANDLE"/>
13+
</div>
14+
<t t-if="cf.rule.type==='IconSetRule'">
15+
<div class="o-cf-preview-icon d-flex justify-content-around align-items-center me-3">
16+
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.upper].template}}"/>
17+
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.middle].template}}"/>
18+
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.lower].template}}"/>
19+
</div>
20+
</t>
21+
<t t-else="">
1222
<div
13-
class="o-cf-drag-handle h-100 position-absolute d-flex align-items-center o-button-icon">
14-
<t t-call="o-spreadsheet-Icon.THIN_DRAG_HANDLE"/>
23+
t-att-style="getPreviewImageStyle(cf.rule)"
24+
class="o-cf-preview-icon d-flex justify-content-around align-items-center me-3 flex-shrink-0">
25+
123
1526
</div>
16-
<t t-if="cf.rule.type==='IconSetRule'">
17-
<div class="o-cf-preview-icon d-flex justify-content-around align-items-center me-2">
18-
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.upper].template}}"/>
19-
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.middle].template}}"/>
20-
<t t-call="o-spreadsheet-Icon.{{icons[cf.rule.icons.lower].template}}"/>
21-
</div>
22-
</t>
23-
<t t-else="">
24-
<div
25-
t-att-style="getPreviewImageStyle(cf.rule)"
26-
class="o-cf-preview-icon d-flex justify-content-around align-items-center me-2">
27-
123
28-
</div>
29-
</t>
30-
<div class="o-cf-preview-description">
31-
<div class="o-cf-preview-ruletype">
32-
<div class="o-cf-preview-description-rule o-fw-bold text-truncate">
33-
<t t-esc="getDescription(cf)"/>
34-
</div>
27+
</t>
28+
<div class="o-cf-preview-description me-3 overflow-auto">
29+
<div class="o-cf-preview-ruletype">
30+
<div class="o-cf-preview-description-rule o-fw-bold text-truncate">
31+
<t t-esc="getDescription(cf)"/>
3532
</div>
36-
<div class="o-cf-preview-range text-truncate" t-esc="cf.ranges"/>
3733
</div>
38-
<div class="o-cf-delete">
39-
<div
40-
class="o-cf-delete-button o-button-icon"
41-
t-on-click.stop="(ev) => this.deleteConditionalFormat(cf, ev)"
42-
title="Remove rule">
43-
<t t-call="o-spreadsheet-Icon.TRASH_FILLED"/>
44-
</div>
34+
<div class="o-cf-preview-range text-truncate" t-esc="cf.ranges"/>
35+
</div>
36+
<div class="o-cf-delete ms-auto">
37+
<div
38+
class="o-cf-delete-button o-button-icon"
39+
t-on-click.stop="(ev) => this.deleteConditionalFormat(cf, ev)"
40+
title="Remove rule">
41+
<t t-call="o-spreadsheet-Icon.TRASH_FILLED"/>
4542
</div>
4643
</div>
4744
</div>

0 commit comments

Comments
 (0)