From a42485079db5830b25f268652b1328f86b2ddb52 Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Wed, 9 Aug 2023 17:28:27 +0300 Subject: [PATCH] #6642 Matrix wrong paddings - simple cases --- src/defaultCss/defaultV2Css.ts | 1 + src/defaultV2-theme/blocks/sd-table.scss | 21 ++++++++++++++------- src/martixBase.ts | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/defaultCss/defaultV2Css.ts b/src/defaultCss/defaultV2Css.ts index a272c96fba..493cb33f09 100644 --- a/src/defaultCss/defaultV2Css.ts +++ b/src/defaultCss/defaultV2Css.ts @@ -379,6 +379,7 @@ export var defaultV2Css = { mainRoot: "sd-element sd-question sd-row__question sd-element--complex sd-question--complex sd-question--table", tableWrapper: "sd-matrix sd-table-wrapper", root: "sd-table sd-matrix__table", + noHeader: "sd-table--no-header", rootVerticalAlignTop: "sd-table--align-top", rootVerticalAlignMiddle: "sd-table--align-middle", rootAlternateRows: "sd-table--alternate-rows", diff --git a/src/defaultV2-theme/blocks/sd-table.scss b/src/defaultV2-theme/blocks/sd-table.scss index c203e3ef2e..eacce3c9b4 100644 --- a/src/defaultV2-theme/blocks/sd-table.scss +++ b/src/defaultV2-theme/blocks/sd-table.scss @@ -1,8 +1,11 @@ .sd-table { width: 100%; background: $question-background; - border-collapse: collapse; + border-collapse: separate; white-space: normal; + border-spacing: 0 16px; + margin: calcSize(-2) 0; + table-layout: fixed; } .sd-table--align-top { @@ -11,11 +14,15 @@ } } +.sd-table--no-header { + padding-top: calcSize(3) +} .sd-table--alternate-rows { - margin: 0 8px; + margin-left: calcSize(1); + margin-right: calcSize(1); width: calc(100% - 2 * #{$base-unit}); - .sd-table__cell:first-of-type { + .sd-table__cell:not(.sd-table__cell--header):first-of-type { padding-left: calcSize(2); } @@ -54,7 +61,7 @@ font-weight: normal; font-size: $font-editorfont-size; line-height: multiply(1.5, $font-editorfont-size); - padding: calcSize(1); + padding: 0 calcSize(1); color: $foreground; text-align: center; } @@ -111,7 +118,7 @@ .sd-table__cell--header { font-weight: 600; vertical-align: top; - padding: calcSize(1.5) calcSize(1) calcSize(2.5); + padding: calcSize(1.5) calcSize(1); &:not(.sd-table__cell--empty) { min-width: calcSize(14); @@ -189,7 +196,7 @@ font-weight: 600; text-align: left; min-width: calcSize(12); - padding: calcSize(2.5) calcSize(1); + padding: calcSize(1.5) calcSize(1); } .sd-matrixdynamic__content .sd-table__question-wrapper { @@ -275,7 +282,7 @@ } &>.sd-question__content { - padding-top: calcSize(2.5); + padding-top: calcSize(2); min-width: min-content; } diff --git a/src/martixBase.ts b/src/martixBase.ts index a10e3ad888..87edd0c440 100644 --- a/src/martixBase.ts +++ b/src/martixBase.ts @@ -304,6 +304,7 @@ export class QuestionMatrixBaseModel extends Question { public getTableCss(): string { return new CssClassBuilder() .append(this.cssClasses.root) + .append(this.cssClasses.noHeader, !this.showHeader) .append(this.cssClasses.rootAlternateRows, this.alternateRows) .append(this.cssClasses.rootVerticalAlignTop, (this.verticalAlign === "top")) .append(this.cssClasses.rootVerticalAlignMiddle, (this.verticalAlign === "middle")).toString();