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