提交 7156e47c 作者: Vben

fix(table): ensure that the value of the table action is updated correctly close #301 #313

上级 b7ce74ab
......@@ -4,6 +4,10 @@
- 重构项目以解决循环依赖项导致的热更新问题
### 🐛 Bug Fixes
- 确保 `table action` 的值被正确更新
## 2.0.3 (2021-03-07)
### ✨ Features
......
......@@ -112,7 +112,7 @@
"vite-plugin-style-import": "^0.8.1",
"vite-plugin-svg-icons": "^0.3.3",
"vite-plugin-theme": "^0.4.8",
"vite-plugin-windicss": "0.6.11",
"vite-plugin-windicss": "0.7.0",
"vue-eslint-parser": "^7.6.0",
"yargs": "^16.2.0"
},
......
......@@ -82,12 +82,12 @@ export function useDrawer(): UseDrawerReturnType {
if (openOnSet) {
dataTransferRef[unref(uidRef)] = null;
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = toRaw(data);
return;
}
const equal = isEqual(toRaw(dataTransferRef[unref(uidRef)]), data);
const equal = isEqual(toRaw(dataTransferRef[unref(uidRef)]), toRaw(data));
if (!equal) {
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = toRaw(data);
}
},
};
......
......@@ -82,12 +82,12 @@ export function useModal(): UseModalReturnType {
if (openOnSet) {
dataTransferRef[unref(uidRef)] = null;
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = toRaw(data);
return;
}
const equal = isEqual(toRaw(dataTransferRef[unref(uidRef)]), data);
const equal = isEqual(toRaw(dataTransferRef[unref(uidRef)]), toRaw(data));
if (!equal) {
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = toRaw(data);
}
},
};
......
......@@ -24,7 +24,7 @@
</template>
<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent, ref } from 'vue';
import { defineComponent, ref, computed } from 'vue';
import { Dropdown, Menu, Input } from 'ant-design-vue';
import { Icon } from '/@/components/Icon';
......@@ -58,6 +58,7 @@
},
title: propTypes.string,
toolbar: propTypes.bool,
checkable: propTypes.bool,
search: propTypes.bool,
checkAll: propTypes.func,
expandAll: propTypes.func,
......@@ -65,14 +66,32 @@
emits: ['strictly-change', 'search'],
setup(props, { emit }) {
const { t } = useI18n();
const toolbarList = ref([
{ label: t('component.tree.selectAll'), value: ToolbarEnum.SELECT_ALL },
{ label: t('component.tree.unSelectAll'), value: ToolbarEnum.UN_SELECT_ALL, divider: true },
{ label: t('component.tree.expandAll'), value: ToolbarEnum.EXPAND_ALL },
{ label: t('component.tree.unExpandAll'), value: ToolbarEnum.UN_EXPAND_ALL, divider: true },
{ label: t('component.tree.checkStrictly'), value: ToolbarEnum.CHECK_STRICTLY },
{ label: t('component.tree.checkUnStrictly'), value: ToolbarEnum.CHECK_UN_STRICTLY },
]);
const toolbarList = computed(() => {
const { checkable } = props;
const defaultToolbarList = [
{ label: t('component.tree.expandAll'), value: ToolbarEnum.EXPAND_ALL },
{
label: t('component.tree.unExpandAll'),
value: ToolbarEnum.UN_EXPAND_ALL,
divider: checkable,
},
];
return checkable
? [
{ label: t('component.tree.selectAll'), value: ToolbarEnum.SELECT_ALL },
{
label: t('component.tree.unSelectAll'),
value: ToolbarEnum.UN_SELECT_ALL,
divider: checkable,
},
...defaultToolbarList,
{ label: t('component.tree.checkStrictly'), value: ToolbarEnum.CHECK_STRICTLY },
{ label: t('component.tree.checkUnStrictly'), value: ToolbarEnum.CHE },
]
: defaultToolbarList;
});
function handleMenuClick(e: MenuInfo) {
const { key } = e;
......
......@@ -323,13 +323,14 @@
});
}
return () => {
const { title, helpMessage, toolbar, search } = props;
const { title, helpMessage, toolbar, search, checkable } = props;
const showTitle = title || toolbar || search;
const scrollStyle: CSSProperties = { height: 'calc(100% - 38px)' };
return (
<div class={[prefixCls, 'h-full bg-white', attrs.class]}>
{showTitle && (
<TreeHeader
checkable={checkable}
checkAll={checkAll}
expandAll={expandAll}
title={title}
......
......@@ -22,6 +22,7 @@ export const basicProps = {
search: propTypes.bool,
checkStrictly: propTypes.bool,
clickRowToExpand: propTypes.bool.def(true),
checkable: propTypes.bool.def(false),
replaceFields: {
type: Object as PropType<ReplaceFields>,
......
......@@ -86,7 +86,7 @@
reload();
}
function handleSelect(deptId: string = '') {
function handleSelect(deptId = '') {
reload({ searchInfo: { deptId } });
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论