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

View File

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

View File

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

View File

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