Commit 7b76945bff004e969bf409de1b7fed594a119b6d
Committed by
GitHub
1 parent
540423ec
chore: perf TableAction.vue、build/utils.ts、prettier.config.js (#868)
* perf: 优化 build 时 vite 模式判断 * perf: 优化 TableAction, 仅在 action.tooltip 存在的情况下 才使用 Tooltip 组件 * docs: 仅在 action.tooltip 存在的情况下 才使用 Tooltip 组件 * fix: 在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题 * docs: 修复在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题
Showing
4 changed files
with
16 additions
and
12 deletions
CHANGELOG.zh_CN.md
@@ -5,9 +5,11 @@ | @@ -5,9 +5,11 @@ | ||
5 | - 修复树形表格的带有展开图标的单元格的内容对齐问题 | 5 | - 修复树形表格的带有展开图标的单元格的内容对齐问题 |
6 | - 新增`headerTop`插槽 | 6 | - 新增`headerTop`插槽 |
7 | - **AppSearch** 修复可能会搜索隐藏菜单的问题 | 7 | - **AppSearch** 修复可能会搜索隐藏菜单的问题 |
8 | +- **TableAction** 仅在 action.tooltip 存在的情况下 才包裹 Tooltip 组件 | ||
8 | - **其它** | 9 | - **其它** |
9 | - 修复菜单默认折叠的配置不起作用的问题 | 10 | - 修复菜单默认折叠的配置不起作用的问题 |
10 | - 修复`safari`浏览器报错导致网站打不开 | 11 | - 修复`safari`浏览器报错导致网站打不开 |
12 | + - 修复在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题 | ||
11 | 13 | ||
12 | ### 🎫 Chores | 14 | ### 🎫 Chores |
13 | 15 |
build/utils.ts
@@ -44,7 +44,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { | @@ -44,7 +44,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { | ||
44 | */ | 44 | */ |
45 | function getConfFiles() { | 45 | function getConfFiles() { |
46 | const script = process.env.npm_lifecycle_script; | 46 | const script = process.env.npm_lifecycle_script; |
47 | - const reg = new RegExp('--mode ([a-z]+) '); | 47 | + const reg = new RegExp('--mode ([a-z]+)'); |
48 | const result = reg.exec(script as string) as any; | 48 | const result = reg.exec(script as string) as any; |
49 | if (result) { | 49 | if (result) { |
50 | const mode = result[1] as string; | 50 | const mode = result[1] as string; |
prettier.config.js
@@ -15,6 +15,6 @@ module.exports = { | @@ -15,6 +15,6 @@ module.exports = { | ||
15 | requirePragma: false, | 15 | requirePragma: false, |
16 | proseWrap: 'never', | 16 | proseWrap: 'never', |
17 | htmlWhitespaceSensitivity: 'strict', | 17 | htmlWhitespaceSensitivity: 'strict', |
18 | - endOfLine: 'lf', | 18 | + endOfLine: 'auto', |
19 | rangeStart: 0, | 19 | rangeStart: 0, |
20 | }; | 20 | }; |
src/components/Table/src/components/TableAction.vue
1 | <template> | 1 | <template> |
2 | <div :class="[prefixCls, getAlign]" @click="onCellClick"> | 2 | <div :class="[prefixCls, getAlign]" @click="onCellClick"> |
3 | <template v-for="(action, index) in getActions" :key="`${index}-${action.label}`"> | 3 | <template v-for="(action, index) in getActions" :key="`${index}-${action.label}`"> |
4 | - <Tooltip v-bind="getTooltip(action.tooltip)"> | 4 | + <Tooltip v-if="action.tooltip" v-bind="getTooltip(action.tooltip)"> |
5 | <PopConfirmButton v-bind="action"> | 5 | <PopConfirmButton v-bind="action"> |
6 | <Icon :icon="action.icon" class="mr-1" v-if="action.icon" /> | 6 | <Icon :icon="action.icon" class="mr-1" v-if="action.icon" /> |
7 | {{ action.label }} | 7 | {{ action.label }} |
8 | </PopConfirmButton> | 8 | </PopConfirmButton> |
9 | </Tooltip> | 9 | </Tooltip> |
10 | + <PopConfirmButton v-else v-bind="action"> | ||
11 | + <Icon :icon="action.icon" class="mr-1" v-if="action.icon" /> | ||
12 | + {{ action.label }} | ||
13 | + </PopConfirmButton> | ||
10 | <Divider | 14 | <Divider |
11 | type="vertical" | 15 | type="vertical" |
12 | class="action-divider" | 16 | class="action-divider" |
@@ -126,15 +130,13 @@ | @@ -126,15 +130,13 @@ | ||
126 | return actionColumn?.align ?? 'left'; | 130 | return actionColumn?.align ?? 'left'; |
127 | }); | 131 | }); |
128 | 132 | ||
129 | - const getTooltip = computed(() => { | ||
130 | - return (data: string | TooltipProps): TooltipProps => { | ||
131 | - if (isString(data)) { | ||
132 | - return { title: data, placement: 'bottom' }; | ||
133 | - } else { | ||
134 | - return Object.assign({ placement: 'bottom' }, data); | ||
135 | - } | ||
136 | - }; | ||
137 | - }); | 133 | + function getTooltip(data: string | TooltipProps): TooltipProps { |
134 | + if (isString(data)) { | ||
135 | + return { title: data, placement: 'bottom' }; | ||
136 | + } else { | ||
137 | + return Object.assign({ placement: 'bottom' }, data); | ||
138 | + } | ||
139 | + } | ||
138 | 140 | ||
139 | function onCellClick(e: MouseEvent) { | 141 | function onCellClick(e: MouseEvent) { |
140 | if (!props.stopButtonPropagation) return; | 142 | if (!props.stopButtonPropagation) return; |