Răsfoiți Sursa

Merge branch 'bug_8389' into debug

cldu 4 zile în urmă
părinte
comite
2cf7f0d99a
2 a modificat fișierele cu 7 adăugiri și 2 ștergeri
  1. 2 1
      src/components/sheet.vue
  2. 5 1
      src/hooks/sheet/useResizeTable.js

+ 2 - 1
src/components/sheet.vue

@@ -19,6 +19,7 @@ const {
   initTableCellsWid,
   getSize,
   SheetFFType,
+  haveDraggedSize,
 } = useResizeTable(tableRef)
 
 const props = defineProps({
@@ -88,7 +89,7 @@ initTableCellsWid('init',props.sceneConfig)
           :colspan="cell.mc.cs||1"
           :rowspan="cell.mc.rs||1"
           :style="`
-            width:${getSize(cell_index,'width')};
+            width:${haveDraggedSize ? getSize(cell_index,'width') : (index==0?getSize(cell_index,'width'):'auto')};
             background: ${cell.bg};
             font-size: ${props.config.FontSize||cell.fs||12}px;
             ${!cell.ct.s ? handleCellStyle(cell) : ''}

+ 5 - 1
src/hooks/sheet/useResizeTable.js

@@ -19,7 +19,7 @@ export function useResizeTable(refName) {
   const dragging = ref(false)
   const dragState=ref({})
   const dragStateHeight = ref({}) 
-  
+  const haveDraggedSize = ref(false)
   const handleMouseMove = _.throttle(function(e,rIndex,cIndex) {
 
     if(isMobile()) return
@@ -160,6 +160,7 @@ export function useResizeTable(refName) {
 
 
   function initTableCellsWid(type='init',sceneConfig) {
+    haveDraggedSize.value = false;
     if(type=='init'){
       const { HeightList,WidthList } = sceneConfig;
 
@@ -167,6 +168,7 @@ export function useResizeTable(refName) {
         const table = refName.value;
         if (table) {
           if(HeightList&&WidthList) {
+            haveDraggedSize.value = true;
             columnsWArr.value = WidthList.split(',').map(_ =>Number(_));
             rowsHArr.value = HeightList.split(',').map(_ =>Number(_));
             nextTick(() => {
@@ -192,6 +194,7 @@ export function useResizeTable(refName) {
         }
       })
     }else if(type === 'change') {
+      haveDraggedSize.value = true;
       changeTableCellWidSave()
     }
   }
@@ -258,5 +261,6 @@ export function useResizeTable(refName) {
     getSize,
     postSheetHeightMsg,
     SheetFFType,
+    haveDraggedSize,
   }
 }