diff --git a/packages/opendesign/src/table/OTable.vue b/packages/opendesign/src/table/OTable.vue index b51d23298001c163c95bd17f76c453a19ff6d313..6b5c853bd4c425148a8c3fa05ace39b2b92f304d 100644 --- a/packages/opendesign/src/table/OTable.vue +++ b/packages/opendesign/src/table/OTable.vue @@ -42,6 +42,7 @@ const boderClass = computed(() => { :class="[ { 'o-table-small': props.small, + 'o-table-medium': !props.small, }, ]" > diff --git a/packages/opendesign/src/table/style/media.scss b/packages/opendesign/src/table/style/media.scss index 871ef1022486187dcab084a5e5d672b8c3bc329a..8574f0cbdb8201a7826aa16c19f056d339386822 100644 --- a/packages/opendesign/src/table/style/media.scss +++ b/packages/opendesign/src/table/style/media.scss @@ -1,88 +1,36 @@ @use '../../_styles/mixin.scss' as *; -.o-table { - @include respond-to('<=pad') { - --table-radius: var(--o-radius_control-s); - } - - @include respond-to('laptop') { +.o-table-medium { + @include respond-to('<=pc_s') { --table-text-size: var(--o-font_size-tip1); --table-text-height: var(--o-line_height-tip1); - --table-head-cell-height: 40px; - --table-cell-height: 48px; - - --table-head-cell-padding: 8px 12px; - --table-cell-padding: 12px 12px; + --table-head-cell-padding-y: 8px; + --table-cell-padding-y: 8px; --table-edge-padding: 24px; } - @include respond-to('pad') { - --table-text-size: var(--o-font_size-tip1); - --table-text-height: var(--o-line_height-tip1); - - --table-head-cell-height: 40px; - --table-cell-height: 48px; - --table-head-cell-padding: 8px 8px; - --table-cell-padding: 8px 8px; - - --table-edge-padding: 16px; - } - @include respond-to('phone') { + @include respond-to('<=pad_v') { --table-text-size: var(--o-font_size-tip2); --table-text-height: var(--o-line_height-tip2); - --table-head-cell-height: 32px; - --table-cell-height: 32px; - - --table-head-cell-padding: 8px 8px; - --table-cell-padding: 8px 8px; - --table-edge-padding: 12px; } -} -.o-table-small { + @include respond-to('<=pad') { --table-radius: var(--o-radius_control-s); } +} - @include respond-to('laptop') { - --table-text-size: var(--o-font_size-tip1); - --table-text-height: var(--o-line_height-tip1); - - --table-head-cell-height: 32px; - --table-cell-height: 40px; - - --table-head-cell-padding: 5px 8px; - --table-cell-padding: 8px 8px; - - --table-edge-padding: 24px; - } - - @include respond-to('pad') { - --table-text-size: var(--o-font_size-tip1); - --table-text-height: var(--o-line_height-tip1); - - --table-head-cell-height: 32px; - --table-cell-height: 40px; - - --table-head-cell-padding: 5px 8px; - --table-cell-padding: 5px 8px; - - --table-edge-padding: 16px; - } - - @include respond-to('phone') { +.o-table-small { + @include respond-to('<=pad') { --table-text-size: var(--o-font_size-tip2); --table-text-height: var(--o-line_height-tip2); - --table-head-cell-height: 32px; - --table-cell-height: 32px; - - --table-head-cell-padding: 7px 8px; - --table-cell-padding: 7px 8px; - + --table-radius: var(--o-radius_control-s); + } + @include respond-to('<=pad_v') { --table-edge-padding: 12px; } } diff --git a/packages/opendesign/src/table/style/style.scss b/packages/opendesign/src/table/style/style.scss index a5055fd82d5d21425ba4e99b9fc98a1f2cd21a39..4fd5a49f1acd3b1602edbc18d5d05c7daa192a7f 100644 --- a/packages/opendesign/src/table/style/style.scss +++ b/packages/opendesign/src/table/style/style.scss @@ -3,13 +3,26 @@ .o-table { position: relative; - color: var(--table-color); table { width: 100%; border-spacing: 0; } + thead { + position: relative; + + &:after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 1px; + background-image: var(--o-color-main2, linear-gradient(to right, var(--o-color-control4), var(--o-color-control4))); + } + } + th, td { box-sizing: border-box; @@ -17,11 +30,12 @@ th { text-align: left; - font-weight: normal; + font-weight: 600; background-color: var(--table-head-bg); padding: var(--table-head-cell-padding); font-size: var(--table-head-text-size); line-height: var(--table-head-text-height); + color: var(--table-head-color); height: var(--table-head-cell-height); } @@ -29,9 +43,17 @@ padding: var(--table-cell-padding); font-size: var(--table-text-size); line-height: var(--table-text-height); + color: var(--table-cell-color); height: var(--table-cell-height); } + th:first-child, td:first-child { + padding-left: var(--table-edge-padding); + } + th:last-child, td:last-child { + padding-right: var(--table-edge-padding); + } + tbody tr { @include hover { &:hover { diff --git a/packages/opendesign/src/table/style/var.scss b/packages/opendesign/src/table/style/var.scss index bf3725917580060261fe615932c0376a95a5739e..fa0d9a77f5e1d56d4d6cfb64b7b9f961ea0e45af 100644 --- a/packages/opendesign/src/table/style/var.scss +++ b/packages/opendesign/src/table/style/var.scss @@ -5,13 +5,15 @@ --table-head-text-size: var(--table-text-size); --table-head-text-height: var(--table-text-height); - --table-color: var(--o-color-info2); + --table-head-color: var(--o-color-info2); + --table-cell-color: var(--o-color-info1); --table-tip-text-size: var(--o-font_size-tip1); --table-tip-text-height: var(--o-line_height-tip1); --table-tip-color: var(--o-color-info3); - --table-head-bg: var(--o-color-control1-light); + // control5在1.1.x版本以后应用 + --table-head-bg: var(--o-color-control5, var(--o-color-control-light)); --table-row-hover: var(--o-color-control2-light); --table-row-active: var(--o-color-control3-light); @@ -21,33 +23,35 @@ --table-body-min-height: 200px; - --table-bg-color: var(--o-color-control-light); + --table-bg-color: var(--o-color-control5, var(--o-color-control-light)); --table-radius: var(--o-radius_control-m); - --table-head-cell-height: 48px; - --table-cell-height: 56px; + --table-head-cell-height: auto; + --table-cell-height: auto; - --table-head-cell-padding: 12px 16px; - --table-cell-padding: 16px 16px; + --table-head-cell-padding-x: 16px; + --table-head-cell-padding-y: 12px; + --table-cell-padding-x: 16px; + --table-cell-padding-y: 12px; - --table-edge-padding: 40px; + --table-head-cell-padding: var(--table-head-cell-padding-y) var(--table-head-cell-padding-x); + --table-cell-padding: var(--table-cell-padding-y) var(--table-cell-padding-x); + + --table-edge-padding: 32px; } .o-table-small { - --table-text-size: var(--o-font_size-text1); - --table-text-height: var(--o-line_height-text1); + --table-text-size: var(--o-font_size-tip1); + --table-text-height: var(--o-line_height-tip1); --table-head-text-size: var(--table-text-size); --table-head-text-height: var(--table-text-height); --table-radius: var(--o-radius_control-m); - --table-head-cell-height: 40px; - --table-cell-height: 48px; - - --table-head-cell-padding: 8px 12px; - --table-cell-padding: 12px 12px; + --table-head-cell-padding-y: 8px; + --table-cell-padding-y: 8px; - --table-edge-padding: 40px; + --table-edge-padding: 16px; }