fix border rendering
This commit is contained in:
parent
3363de1070
commit
b2c8548c67
|
@ -234,8 +234,6 @@ $cellHeight: 28px;
|
||||||
height: $cellHeight;
|
height: $cellHeight;
|
||||||
max-height: $cellHeight;
|
max-height: $cellHeight;
|
||||||
min-height: $cellHeight;
|
min-height: $cellHeight;
|
||||||
border-left: solid 0.5px var(--divider);
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
cursor: cell;
|
cursor: cell;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<tr :class="[$style.row, [row.ranged ? $style.ranged : {}]]">
|
<tr :class="[$style.row, [row.ranged ? $style.ranged : {}]]">
|
||||||
<MkNumberCell
|
<MkNumberCell
|
||||||
|
v-if="gridSetting.rowNumberVisible"
|
||||||
:content="(row.index + 1).toString()"
|
:content="(row.index + 1).toString()"
|
||||||
:row="row"
|
:row="row"
|
||||||
/>
|
/>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { toRefs } from 'vue';
|
import { toRefs } from 'vue';
|
||||||
import { GridEventEmitter, GridRow, Size } from '@/components/grid/grid.js';
|
import { GridEventEmitter, GridRow, GridSetting, Size } from '@/components/grid/grid.js';
|
||||||
import MkDataCell from '@/components/grid/MkDataCell.vue';
|
import MkDataCell from '@/components/grid/MkDataCell.vue';
|
||||||
import MkNumberCell from '@/components/grid/MkNumberCell.vue';
|
import MkNumberCell from '@/components/grid/MkNumberCell.vue';
|
||||||
import { CellValue, GridCell } from '@/components/grid/cell.js';
|
import { CellValue, GridCell } from '@/components/grid/cell.js';
|
||||||
|
@ -33,6 +34,7 @@ const emit = defineEmits<{
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
row: GridRow,
|
row: GridRow,
|
||||||
cells: GridCell[],
|
cells: GridCell[],
|
||||||
|
gridSetting: GridSetting,
|
||||||
bus: GridEventEmitter,
|
bus: GridEventEmitter,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
<table
|
<table
|
||||||
ref="rootEl"
|
ref="rootEl"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
:class="$style.grid"
|
:class="[$style.grid, $style.border]"
|
||||||
@mousedown="onMouseDown"
|
@mousedown="onMouseDown"
|
||||||
@keydown="onKeyDown"
|
@keydown="onKeyDown"
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<MkHeaderRow
|
<MkHeaderRow
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
:gridSetting="gridSetting"
|
||||||
:bus="bus"
|
:bus="bus"
|
||||||
@operation:beginWidthChange="onHeaderCellWidthBeginChange"
|
@operation:beginWidthChange="onHeaderCellWidthBeginChange"
|
||||||
@operation:endWidthChange="onHeaderCellWidthEndChange"
|
@operation:endWidthChange="onHeaderCellWidthEndChange"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
:key="row.index"
|
:key="row.index"
|
||||||
:row="row"
|
:row="row"
|
||||||
:cells="cells[row.index]"
|
:cells="cells[row.index]"
|
||||||
|
:gridSetting="gridSetting"
|
||||||
:bus="bus"
|
:bus="bus"
|
||||||
@operation:beginEdit="onCellEditBegin"
|
@operation:beginEdit="onCellEditBegin"
|
||||||
@operation:endEdit="onCellEditEnd"
|
@operation:endEdit="onCellEditEnd"
|
||||||
|
@ -42,6 +44,7 @@ import {
|
||||||
GridColumn,
|
GridColumn,
|
||||||
GridEventEmitter,
|
GridEventEmitter,
|
||||||
GridRow,
|
GridRow,
|
||||||
|
GridSetting,
|
||||||
GridState,
|
GridState,
|
||||||
Size,
|
Size,
|
||||||
} from '@/components/grid/grid.js';
|
} from '@/components/grid/grid.js';
|
||||||
|
@ -52,10 +55,15 @@ import { cellValidation, ValidateViolation } from '@/components/grid/cell-valida
|
||||||
import { CELL_ADDRESS_NONE, CellAddress, CellValue, GridCell } from '@/components/grid/cell.js';
|
import { CELL_ADDRESS_NONE, CellAddress, CellValue, GridCell } from '@/components/grid/cell.js';
|
||||||
import { calcCellWidth, equalCellAddress, getCellAddress } from '@/components/grid/utils.js';
|
import { calcCellWidth, equalCellAddress, getCellAddress } from '@/components/grid/utils.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
|
gridSetting?: GridSetting,
|
||||||
columnSettings: ColumnSetting[],
|
columnSettings: ColumnSetting[],
|
||||||
data: DataSource[]
|
data: DataSource[]
|
||||||
}>();
|
}>(), {
|
||||||
|
gridSetting: () => ({
|
||||||
|
rowNumberVisible: true,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'operation:cellValidation', violation: ValidateViolation): void;
|
(ev: 'operation:cellValidation', violation: ValidateViolation): void;
|
||||||
|
@ -65,7 +73,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const bus = new GridEventEmitter();
|
const bus = new GridEventEmitter();
|
||||||
|
|
||||||
const { columnSettings, data } = toRefs(props);
|
const { gridSetting, columnSettings, data } = toRefs(props);
|
||||||
|
|
||||||
const rootEl = ref<InstanceType<typeof HTMLTableElement>>();
|
const rootEl = ref<InstanceType<typeof HTMLTableElement>>();
|
||||||
const columns = ref<GridColumn[]>([]);
|
const columns = ref<GridColumn[]>([]);
|
||||||
|
@ -798,14 +806,68 @@ refreshData();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style module lang="scss">
|
<style module lang="scss">
|
||||||
|
$borderSetting: solid 0.5px var(--divider);
|
||||||
|
$borderRadius: var(--radius);
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
border: solid 0.5px var(--divider);
|
.border {
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-radius: var(--radius);
|
|
||||||
|
thead {
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
border-left: $borderSetting;
|
||||||
|
border-top: $borderSetting;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
// 左上セル
|
||||||
|
border-top-left-radius: $borderRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
// 右上セル
|
||||||
|
border-top-right-radius: $borderRadius;
|
||||||
|
border-right: $borderSetting;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody {
|
||||||
|
tr {
|
||||||
|
td, th {
|
||||||
|
border-left: $borderSetting;
|
||||||
|
border-top: $borderSetting;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
// 一番右端の列
|
||||||
|
border-right: $borderSetting;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
td, th {
|
||||||
|
// 一番下の行
|
||||||
|
border-bottom: $borderSetting;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
// 左下セル
|
||||||
|
border-bottom-left-radius: $borderRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
// 右下セル
|
||||||
|
border-bottom-right-radius: $borderRadius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -145,7 +145,6 @@ function updateContentSize() {
|
||||||
$handleWidth: 5px;
|
$handleWidth: 5px;
|
||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
border-left: solid 0.5px var(--divider);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<tr :class="$style.header">
|
<tr :class="$style.header">
|
||||||
<MkNumberCell
|
<MkNumberCell
|
||||||
|
v-if="gridSetting.rowNumberVisible"
|
||||||
content="#"
|
content="#"
|
||||||
:top="true"
|
:top="true"
|
||||||
/>
|
/>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { GridColumn, GridEventEmitter, Size } from '@/components/grid/grid.js';
|
import { GridColumn, GridEventEmitter, GridSetting, Size } from '@/components/grid/grid.js';
|
||||||
import MkHeaderCell from '@/components/grid/MkHeaderCell.vue';
|
import MkHeaderCell from '@/components/grid/MkHeaderCell.vue';
|
||||||
import MkNumberCell from '@/components/grid/MkNumberCell.vue';
|
import MkNumberCell from '@/components/grid/MkNumberCell.vue';
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ const emit = defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
defineProps<{
|
defineProps<{
|
||||||
columns: GridColumn[],
|
columns: GridColumn[],
|
||||||
|
gridSetting: GridSetting,
|
||||||
bus: GridEventEmitter,
|
bus: GridEventEmitter,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<th :class="[$style.cell, [top ? {} : $style.border]]">
|
<th :class="[$style.cell]">
|
||||||
<div
|
<div
|
||||||
:class="[
|
:class="[
|
||||||
$style.root,
|
$style.root,
|
||||||
|
@ -16,7 +16,6 @@ import { GridRow } from '@/components/grid/grid.js';
|
||||||
defineProps<{
|
defineProps<{
|
||||||
content: string,
|
content: string,
|
||||||
row?: GridRow,
|
row?: GridRow,
|
||||||
top?: boolean,
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -50,8 +49,4 @@ $cellWidth: 34px;
|
||||||
background-color: var(--accentedBg);
|
background-color: var(--accentedBg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.border {
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,6 +2,10 @@ import { EventEmitter } from 'eventemitter3';
|
||||||
import { CellValidator } from '@/components/grid/cell-validators.js';
|
import { CellValidator } from '@/components/grid/cell-validators.js';
|
||||||
import { CellValue } from '@/components/grid/cell.js';
|
import { CellValue } from '@/components/grid/cell.js';
|
||||||
|
|
||||||
|
export type GridSetting = {
|
||||||
|
rowNumberVisible: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export type DataSource = Record<string, CellValue>;
|
export type DataSource = Record<string, CellValue>;
|
||||||
|
|
||||||
export type GridState = 'normal' | 'cellSelecting' | 'cellEditing' | 'colResizing' | 'colSelecting' | 'rowSelecting'
|
export type GridState = 'normal' | 'cellSelecting' | 'cellEditing' | 'colResizing' | 'colSelecting' | 'rowSelecting'
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div v-if="registerLogs.length > 0" style="overflow-y: scroll;">
|
<div v-if="registerLogs.length > 0" style="overflow-y: scroll;">
|
||||||
<MkGrid
|
<MkGrid
|
||||||
|
:gridSetting="{ rowNumberVisible: false }"
|
||||||
:data="convertedRegisterLogs"
|
:data="convertedRegisterLogs"
|
||||||
:columnSettings="registerLogColumnSettings"
|
:columnSettings="registerLogColumnSettings"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue