Browse Source

fix(nc-gui): line height issue

pull/10016/head
Ramesh Mane 3 days ago
parent
commit
6310686081
  1. 2
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 2
      packages/nc-gui/components/cell/Rating.vue
  3. 2
      packages/nc-gui/components/cell/User.vue
  4. 6
      packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue
  5. 6
      packages/nc-gui/components/smartsheet/grid/Table.vue
  6. 8
      packages/nc-gui/utils/cell.ts

2
packages/nc-gui/components/cell/MultiSelect.vue

@ -428,7 +428,7 @@ const onFocus = () => {
:style="{
'display': '-webkit-box',
'max-width': '100%',
'-webkit-line-clamp': rowHeightTruncateLines(rowHeight),
'-webkit-line-clamp': rowHeightTruncateLines(rowHeight, true),
'-webkit-box-orient': 'vertical',
'overflow': 'hidden',
}"

2
packages/nc-gui/components/cell/Rating.vue

@ -72,7 +72,7 @@ watch(rateDomRef, () => {
'padding': isExpandedFormOpen ? '0px 8px' : '0px 2px',
'display': '-webkit-box',
'max-width': '100%',
'-webkit-line-clamp': rowHeightTruncateLines(rowHeight),
'-webkit-line-clamp': rowHeight === 6 ? 5 : rowHeightTruncateLines(rowHeight, true),
'-webkit-box-orient': 'vertical',
'overflow': 'hidden',
}"

2
packages/nc-gui/components/cell/User.vue

@ -403,7 +403,7 @@ const isCollaborator = (userIdOrEmail) => {
:style="{
'display': '-webkit-box',
'max-width': '100%',
'-webkit-line-clamp': rowHeightTruncateLines(rowHeight),
'-webkit-line-clamp': rowHeightTruncateLines(rowHeight, true),
'-webkit-box-orient': 'vertical',
'overflow': 'hidden',
}"

6
packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue

@ -195,6 +195,8 @@ const onXcResizing = (cn: string | undefined, event: any) => {
const size = event.detail.split('px')[0]
gridViewCols.value[cn].width = `${normalizedWidth(metaColumnById.value[cn], size)}px`
refreshFillHandle()
}
const onXcStartResizing = (cn: string | undefined, event: any) => {
@ -1434,7 +1436,7 @@ const leftOffset = computed(() => {
const fillHandleTop = ref()
const fillHandleLeft = ref()
const refreshFillHandle = () => {
function refreshFillHandle() {
const rowIndex = isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row
const colIndex = isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col
if (rowIndex !== null && colIndex !== null) {
@ -1896,7 +1898,7 @@ watch(vSelectedAllRecords, (selectedAll) => {
</template>
</th>
<th
v-if="fields[0] && fields[0].id"
v-if="fields?.[0]?.id"
ref="primaryColHeader"
v-xc-ver-resize
:data-col="fields[0].id"

6
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -1214,6 +1214,8 @@ const onXcResizing = (cn: string | undefined, event: any) => {
const size = event.detail.split('px')[0]
gridViewCols.value[cn].width = `${normalizedWidth(metaColumnById.value[cn], size)}px`
refreshFillHandle()
}
const onXcStartResizing = (cn: string | undefined, event: any) => {
@ -1376,7 +1378,7 @@ const topOffset = computed(() => {
const fillHandleTop = ref()
const fillHandleLeft = ref()
const refreshFillHandle = () => {
function refreshFillHandle() {
nextTick(() => {
const rowIndex = isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row
const colIndex = isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col
@ -1834,7 +1836,7 @@ onKeyStroke('ArrowDown', onDown)
</div>
</th>
<th
v-if="fields[0] && fields[0].id"
v-if="fields?.[0]?.id"
v-xc-ver-resize
:data-col="fields[0].id"
:data-title="fields[0].title"

8
packages/nc-gui/utils/cell.ts

@ -107,14 +107,14 @@ export const rowHeightInPx: Record<string, number> = {
6: 120,
}
export const rowHeightTruncateLines = (rowHeight?: number) => {
export const rowHeightTruncateLines = (rowHeight?: number, isSelectOption = false) => {
switch (rowHeight) {
case 2:
return 3
return 2
case 4:
return 4
return isSelectOption ? 3 : 4
case 6:
return 6
return isSelectOption ? 4 : 6
default:
return 1
}

Loading…
Cancel
Save