feat(脑图): f2快捷键编辑节点内容

This commit is contained in:
baiqi 2024-11-01 15:11:21 +08:00 committed by 刘瑞斌
parent c0f313de9c
commit 3d69fd433d
4 changed files with 21 additions and 9 deletions

View File

@ -18,7 +18,8 @@ type ShortcutKey =
| 'addSiblingModule'
| 'addSiblingCase'
| 'reviewPass'
| 'reviewReject';
| 'reviewReject'
| 'input';
// 快捷键事件映射combinationShortcuts中定义了组合键事件key为组合键value为事件名称
type Shortcuts = {
[key in ShortcutKey]?: (event: KeyboardEvent) => void;
@ -58,6 +59,7 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati
'enter': 'appendSiblingNode',
'tab': 'appendChildNode',
'backspace': 'delete',
'f2': 'input', // 进入编辑状态
};
// 业务快捷键
const businessShortcuts: { [key: string]: ShortcutKey } = {

View File

@ -131,6 +131,9 @@
const { appendChildNode, appendSiblingNode, minderDelete, minderExpand } = useMinderOperation(props);
const { unbindShortcuts } = useShortCut(
{
input: () => {
window.minderEditor.editText();
},
undo: () => {
window.minderHistory?.undo();
},

View File

@ -15,7 +15,7 @@
:filter-config-list="filterConfigList"
:custom-fields-config-list="searchCustomFields"
:search-placeholder="t('caseManagement.featureCase.searchPlaceholder')"
:count="props.modulesCount[props.activeFolder] || 0"
:count="modulesCount[props.activeFolder] || 0"
:name="moduleNamePath"
@keyword-search="fetchData"
@adv-search="handleAdvSearch"
@ -206,12 +206,12 @@
<div class="one-line-text max-h-[32px] max-w-[300px] text-[var(--color-text-1)]">
{{ moduleNamePath }}
</div>
<span class="text-[var(--color-text-4)]"> ({{ props.modulesCount[props.activeFolder] || 0 }})</span>
<span class="text-[var(--color-text-4)]"> ({{ modulesCount[props.activeFolder] || 0 }})</span>
</div>
<template #content>
<div class="max-w-[400px] text-[14px] font-medium text-[var(--color-text-1)]">
{{ moduleNamePath }}
<span class="text-[var(--color-text-4)]">({{ props.modulesCount[props.activeFolder] || 0 }})</span>
<span class="text-[var(--color-text-4)]">({{ modulesCount[props.activeFolder] || 0 }})</span>
</div>
</template>
</a-popover>
@ -235,8 +235,9 @@
<div class="mt-[16px] h-[calc(100%-32px)] border-t border-[var(--color-text-n8)]">
<!-- 脑图开始 -->
<MsFeatureCaseMinder
v-if="props.moduleCountIsInit"
:module-id="props.activeFolder"
:modules-count="props.modulesCount"
:modules-count="modulesCount"
:module-name="props.moduleName"
@save="handleMinderSave"
/>
@ -481,7 +482,7 @@
activeFolder: string;
moduleName: string;
offspringIds: string[]; // id
modulesCount: Record<string, number>; //
moduleCountIsInit: boolean;
}>();
const emit = defineEmits<{
@ -497,6 +498,10 @@
const showType = ref<ShowType>('list');
const modulesCount = computed(() => {
return featureCaseStore.modulesCount;
});
function handleShowTypeChange(val: string | number | boolean) {
minderStore.setShowType(MinderKeyEnum.FEATURE_CASE_MINDER, val as ShowType);
if (minderStore.minderUnsaved && val === 'list') {

View File

@ -82,8 +82,8 @@
ref="caseTableRef"
:active-folder="activeFolder"
:offspring-ids="offspringIds"
:modules-count="modulesCount"
:module-name="activeFolderName"
:module-count-is-init="moduleCountIsInit"
@init="initModulesCount"
@init-modules="initModules"
@set-active-folder="setActiveFolder('all')"
@ -232,14 +232,16 @@
return featureCaseStore.recycleModulesCount;
});
const moduleCountIsInit = ref(false);
/**
* 右侧表格数据刷新后若当前展示的是模块则刷新模块树的统计数量
*/
function initModulesCount(params: TableQueryParams, refreshModule = false) {
async function initModulesCount(params: TableQueryParams, refreshModule = false) {
if (refreshModule) {
caseTreeRef.value.initModules();
}
featureCaseStore.getCaseModulesCount(params);
await featureCaseStore.getCaseModulesCount(params);
moduleCountIsInit.value = true;
featureCaseStore.getRecycleModulesCount(params);
tableFilterParams.value = { ...params };
}