Commit 4500214b2a158965281e43e673622e4492e8ca26

Authored by nebv
1 parent beb4c3a3

fix: fix editable cells cannot be entered

src/components/Table/src/components/renderEditableCell.tsx
@@ -43,7 +43,7 @@ const EditableCell = defineComponent({ @@ -43,7 +43,7 @@ const EditableCell = defineComponent({
43 const elRef = ref<any>(null); 43 const elRef = ref<any>(null);
44 44
45 const isEditRef = ref(false); 45 const isEditRef = ref(false);
46 - const currentValueRef = ref<string | boolean>(''); 46 + const currentValueRef = ref<string | boolean>(props.value);
47 47
48 function handleChange(e: ChangeEvent | string | boolean) { 48 function handleChange(e: ChangeEvent | string | boolean) {
49 if ((e as ChangeEvent).target && Reflect.has((e as ChangeEvent).target, 'value')) { 49 if ((e as ChangeEvent).target && Reflect.has((e as ChangeEvent).target, 'value')) {
@@ -106,7 +106,7 @@ const EditableCell = defineComponent({ @@ -106,7 +106,7 @@ const EditableCell = defineComponent({
106 }} 106 }}
107 style={{ width: 'calc(100% - 48px)' }} 107 style={{ width: 'calc(100% - 48px)' }}
108 ref={elRef} 108 ref={elRef}
109 - value={value} 109 + value={unref(currentValueRef)}
110 size="small" 110 size="small"
111 onChange={handleChange} 111 onChange={handleChange}
112 onPressEnter={handleSubmit} 112 onPressEnter={handleSubmit}
@@ -141,12 +141,12 @@ export function renderEditableCell({ @@ -141,12 +141,12 @@ export function renderEditableCell({
141 return ({ text, record }: { text: string; record: any }) => { 141 return ({ text, record }: { text: string; record: any }) => {
142 return ( 142 return (
143 <EditableCell 143 <EditableCell
  144 + {...componentOn}
  145 + {...componentProps}
144 value={text} 146 value={text}
145 dataKey={record.key} 147 dataKey={record.key}
146 dataIndex={dataIndex} 148 dataIndex={dataIndex}
147 component={component} 149 component={component}
148 - on={componentOn}  
149 - componentProps={componentProps}  
150 /> 150 />
151 ); 151 );
152 }; 152 };
src/views/demo/echarts/Line.vue
1 <template> 1 <template>
2 - <div class="p-4">  
3 - <div ref="chartRef" :style="{ height, width }" />  
4 - </div> 2 + <div ref="chartRef" :style="{ height, width }" />
5 </template> 3 </template>
6 <script lang="ts"> 4 <script lang="ts">
7 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue'; 5 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
@@ -18,7 +16,7 @@ @@ -18,7 +16,7 @@
18 }, 16 },
19 height: { 17 height: {
20 type: String as PropType<string>, 18 type: String as PropType<string>,
21 - default: '80vh', 19 + default: 'calc(100vh - 78px)',
22 }, 20 },
23 }, 21 },
24 setup() { 22 setup() {
src/views/demo/echarts/Map.vue
1 <template> 1 <template>
2 - <div class="p-4">  
3 - <div ref="chartRef" :style="{ height, width }" />  
4 - </div> 2 + <div ref="chartRef" :style="{ height, width }" />
5 </template> 3 </template>
6 <script lang="ts"> 4 <script lang="ts">
7 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue'; 5 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
@@ -18,7 +16,7 @@ @@ -18,7 +16,7 @@
18 }, 16 },
19 height: { 17 height: {
20 type: String as PropType<string>, 18 type: String as PropType<string>,
21 - default: '80vh', 19 + default: 'calc(100vh - 78px)',
22 }, 20 },
23 }, 21 },
24 setup() { 22 setup() {
src/views/demo/echarts/Pie.vue
1 <template> 1 <template>
2 - <div class="p-4">  
3 - <div ref="chartRef" :style="{ height, width }" />  
4 - </div> 2 + <div ref="chartRef" :style="{ height, width }" />
5 </template> 3 </template>
6 <script lang="ts"> 4 <script lang="ts">
7 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue'; 5 import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
@@ -16,7 +14,7 @@ @@ -16,7 +14,7 @@
16 }, 14 },
17 height: { 15 height: {
18 type: String as PropType<string>, 16 type: String as PropType<string>,
19 - default: '80vh', 17 + default: 'calc(100vh - 78px)',
20 }, 18 },
21 }, 19 },
22 setup() { 20 setup() {