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 而保错问题
This commit is contained in:
周旭 2021-07-08 23:20:49 +08:00 committed by GitHub
parent 540423ecf7
commit 7b76945bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 12 deletions

View File

@ -5,9 +5,11 @@
- 修复树形表格的带有展开图标的单元格的内容对齐问题 - 修复树形表格的带有展开图标的单元格的内容对齐问题
- 新增`headerTop`插槽 - 新增`headerTop`插槽
- **AppSearch** 修复可能会搜索隐藏菜单的问题 - **AppSearch** 修复可能会搜索隐藏菜单的问题
- **TableAction** 仅在 action.tooltip 存在的情况下 才包裹 Tooltip 组件
- **其它** - **其它**
- 修复菜单默认折叠的配置不起作用的问题 - 修复菜单默认折叠的配置不起作用的问题
- 修复`safari`浏览器报错导致网站打不开 - 修复`safari`浏览器报错导致网站打不开
- 修复在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题
### 🎫 Chores ### 🎫 Chores

View File

@ -44,7 +44,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
*/ */
function getConfFiles() { function getConfFiles() {
const script = process.env.npm_lifecycle_script; const script = process.env.npm_lifecycle_script;
const reg = new RegExp('--mode ([a-z]+) '); const reg = new RegExp('--mode ([a-z]+)');
const result = reg.exec(script as string) as any; const result = reg.exec(script as string) as any;
if (result) { if (result) {
const mode = result[1] as string; const mode = result[1] as string;

View File

@ -15,6 +15,6 @@ module.exports = {
requirePragma: false, requirePragma: false,
proseWrap: 'never', proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict', htmlWhitespaceSensitivity: 'strict',
endOfLine: 'lf', endOfLine: 'auto',
rangeStart: 0, rangeStart: 0,
}; };

View File

@ -1,12 +1,16 @@
<template> <template>
<div :class="[prefixCls, getAlign]" @click="onCellClick"> <div :class="[prefixCls, getAlign]" @click="onCellClick">
<template v-for="(action, index) in getActions" :key="`${index}-${action.label}`"> <template v-for="(action, index) in getActions" :key="`${index}-${action.label}`">
<Tooltip v-bind="getTooltip(action.tooltip)"> <Tooltip v-if="action.tooltip" v-bind="getTooltip(action.tooltip)">
<PopConfirmButton v-bind="action"> <PopConfirmButton v-bind="action">
<Icon :icon="action.icon" class="mr-1" v-if="action.icon" /> <Icon :icon="action.icon" class="mr-1" v-if="action.icon" />
{{ action.label }} {{ action.label }}
</PopConfirmButton> </PopConfirmButton>
</Tooltip> </Tooltip>
<PopConfirmButton v-else v-bind="action">
<Icon :icon="action.icon" class="mr-1" v-if="action.icon" />
{{ action.label }}
</PopConfirmButton>
<Divider <Divider
type="vertical" type="vertical"
class="action-divider" class="action-divider"
@ -126,15 +130,13 @@
return actionColumn?.align ?? 'left'; return actionColumn?.align ?? 'left';
}); });
const getTooltip = computed(() => { function getTooltip(data: string | TooltipProps): TooltipProps {
return (data: string | TooltipProps): TooltipProps => { if (isString(data)) {
if (isString(data)) { return { title: data, placement: 'bottom' };
return { title: data, placement: 'bottom' }; } else {
} else { return Object.assign({ placement: 'bottom' }, data);
return Object.assign({ placement: 'bottom' }, data); }
} }
};
});
function onCellClick(e: MouseEvent) { function onCellClick(e: MouseEvent) {
if (!props.stopButtonPropagation) return; if (!props.stopButtonPropagation) return;