Commit 33a335a3f52aead522b3fbee0d558e2e797580ff

Authored by 无木
1 parent 9d2231b1

fix(table): `0` is not shown in editable cell

修复可编辑单元格中未能正确显示零值的问题

fixed: #1039
CHANGELOG.zh_CN.md
1 ### 🐛 Bug Fixes 1 ### 🐛 Bug Fixes
2 2
3 - **Cropper** 修复未能及时销毁的问题 3 - **Cropper** 修复未能及时销毁的问题
4 -- **BasicTable** 修复`CellFormat`无法使用`Map`类型数据的问题 4 +- **BasicTable**
  5 + - 修复`CellFormat`无法使用`Map`类型数据的问题
  6 + - 修复可编辑单元格未能正确显示`0`值的问题
5 - **Qrcode** 修复二维码组件在创建时未能及时绘制的问题 7 - **Qrcode** 修复二维码组件在创建时未能及时绘制的问题
6 8
7 ## 2.7.0(2021-08-03) 9 ## 2.7.0(2021-08-03)
src/components/Table/src/components/editable/EditableCell.vue
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }" 5 :class="{ [`${prefixCls}__normal`]: true, 'ellipsis-cell': column.ellipsis }"
6 @click="handleEdit" 6 @click="handleEdit"
7 > 7 >
8 - <div class="cell-content" :title="column.ellipsis ? getValues || '' : ''">{{  
9 - getValues || '&nbsp;' 8 + <div class="cell-content" :title="column.ellipsis ? getValues ?? '' : ''">{{
  9 + getValues ?? '&nbsp;'
10 }}</div> 10 }}</div>
11 <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" /> 11 <FormOutlined :class="`${prefixCls}__normal-icon`" v-if="!column.editRow" />
12 </div> 12 </div>
@@ -35,11 +35,10 @@ @@ -35,11 +35,10 @@
35 </template> 35 </template>
36 <script lang="ts"> 36 <script lang="ts">
37 import type { CSSProperties, PropType } from 'vue'; 37 import type { CSSProperties, PropType } from 'vue';
  38 + import { computed, defineComponent, nextTick, ref, toRaw, unref, watchEffect } from 'vue';
38 import type { BasicColumn } from '../../types/table'; 39 import type { BasicColumn } from '../../types/table';
39 import type { EditRecordRow } from './index'; 40 import type { EditRecordRow } from './index';
40 -  
41 - import { defineComponent, ref, unref, nextTick, computed, watchEffect, toRaw } from 'vue';  
42 - import { FormOutlined, CloseOutlined, CheckOutlined } from '@ant-design/icons-vue'; 41 + import { CheckOutlined, CloseOutlined, FormOutlined } from '@ant-design/icons-vue';
43 import { CellComponent } from './CellComponent'; 42 import { CellComponent } from './CellComponent';
44 43
45 import { useDesign } from '/@/hooks/web/useDesign'; 44 import { useDesign } from '/@/hooks/web/useDesign';
@@ -48,9 +47,9 @@ @@ -48,9 +47,9 @@
48 import clickOutside from '/@/directives/clickOutside'; 47 import clickOutside from '/@/directives/clickOutside';
49 48
50 import { propTypes } from '/@/utils/propTypes'; 49 import { propTypes } from '/@/utils/propTypes';
51 - import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is'; 50 + import { isArray, isBoolean, isFunction, isNumber, isString } from '/@/utils/is';
52 import { createPlaceholderMessage } from './helper'; 51 import { createPlaceholderMessage } from './helper';
53 - import { set, omit } from 'lodash-es'; 52 + import { omit, set } from 'lodash-es';
54 import { treeToList } from '/@/utils/helper/treeHelper'; 53 import { treeToList } from '/@/utils/helper/treeHelper';
55 54
56 export default defineComponent({ 55 export default defineComponent({
@@ -214,8 +213,7 @@ @@ -214,8 +213,7 @@
214 if (isBoolean(editRule) && !currentValue && !isNumber(currentValue)) { 213 if (isBoolean(editRule) && !currentValue && !isNumber(currentValue)) {
215 ruleVisible.value = true; 214 ruleVisible.value = true;
216 const component = unref(getComponent); 215 const component = unref(getComponent);
217 - const message = createPlaceholderMessage(component);  
218 - ruleMessage.value = message; 216 + ruleMessage.value = createPlaceholderMessage(component);
219 return false; 217 return false;
220 } 218 }
221 if (isFunction(editRule)) { 219 if (isFunction(editRule)) {