@tano.page/workbench 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +50 -16
- package/src/App.vue +82 -752
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/agent-identities.ts +1 -97
- package/src/assistant/agent-task-context.ts +1 -54
- package/src/assistant/attachments.ts +1 -1
- package/src/assistant/completion.ts +1 -61
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +425 -8
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/connection-actions.ts +237 -0
- package/src/assistant/document-mentions.ts +1 -33
- package/src/assistant/engine.ts +1 -532
- package/src/assistant/execution.ts +6 -33
- package/src/assistant/files.ts +5 -13
- package/src/assistant/hash.ts +1 -4
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/language.ts +10 -37
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/plugin-bridge-builder.ts +146 -0
- package/src/assistant/prompts.ts +1 -58
- package/src/assistant/proposal-actions.ts +336 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +167 -327
- package/src/assistant/structures.ts +1 -155
- package/src/assistant/tasks.ts +8 -96
- package/src/assistant/tool-rules.ts +1 -7
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-help.ts +177 -0
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-lifecycle.ts +249 -0
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-settings.ts +185 -0
- package/src/composables/use-workbench-shortcuts.ts +40 -1021
- package/src/composables/use-workbench-views.ts +325 -0
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentActionMenu.vue +279 -0
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/documents/components/DocumentInspector.vue +168 -0
- package/src/documents/components/DocumentPane.vue +482 -0
- package/src/documents/description-merge.ts +1 -9
- package/src/features.ts +1 -0
- package/src/files/components/FileMetadataPanel.vue +49 -15
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locale-catalogs.ts +7 -6
- package/src/i18n/locale-registry.ts +8 -6
- package/src/i18n/locales/de-DE.json +371 -3
- package/src/i18n/locales/en-US.json +371 -2
- package/src/i18n/locales/es-ES.json +371 -3
- package/src/i18n/locales/ja-JP.json +370 -2
- package/src/i18n/locales/zh-TW.json +370 -2
- package/src/mail/components/MailAccountDialog.vue +450 -0
- package/src/mail/components/MailComposerDialog.vue +326 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +821 -0
- package/src/mail/components/SidebarMail.vue +134 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/content-references.ts +6 -56
- package/src/objects/wiki-links.ts +1 -48
- package/src/objects/workspace-objects.ts +3 -4
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +65 -9
- package/src/plans/components/CalendarAgendaView.vue +165 -0
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarFilterBar.vue +128 -0
- package/src/plans/components/CalendarMonthView.vue +224 -0
- package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
- package/src/plans/components/CalendarTimelineView.vue +517 -0
- package/src/plans/components/CalendarTopbarControls.vue +101 -0
- package/src/plans/components/CalendarView.vue +264 -748
- package/src/plans/components/CalendarYearView.vue +138 -0
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanConnectionsDialog.vue +1 -1
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/components/calendar-shared.css +192 -0
- package/src/plans/composables/use-calendar-interactions.ts +396 -0
- package/src/plans/composables/use-calendar-scroll.ts +420 -0
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +136 -57
- package/src/plugins/components/PluginDeveloperArea.vue +192 -0
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +21 -25
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +273 -288
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +37 -34
- package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +112 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/components/PluginsTabPage.vue +61 -0
- package/src/plugins/components/plugin-center.css +5 -0
- package/src/plugins/data.ts +9 -86
- package/src/plugins/editor-plugin-adapters.ts +169 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-data.ts +2 -3
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-rpc-router.ts +558 -0
- package/src/plugins/plugin-sdk.ts +1 -94
- package/src/plugins/plugin-ui-dialogs.ts +167 -0
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +1 -73
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/view-header.ts +2 -7
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +103 -4
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/SettingsPanel.vue +8 -3
- package/src/settings/components/WorkbenchSettings.vue +20 -7
- package/src/settings/components/settings-context.ts +1 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/settings/settings-tab.ts +1 -0
- package/src/shell/command-palette.ts +3 -3
- package/src/shell/components/EditorToolbar.vue +8 -9
- package/src/shell/components/EditorTools.vue +1 -5
- package/src/shell/components/PaneTopbar.vue +393 -0
- package/src/shell/components/SelectionToolbar.vue +0 -2
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +58 -34
- package/src/shell/components/WorkbenchModals.vue +47 -62
- package/src/shell/components/WorkbenchPanes.vue +371 -1342
- package/src/shell/components/WorkbenchSidebar.vue +486 -0
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/pane-registry.ts +69 -0
- package/src/shell/use-surface-dismissal.ts +219 -0
- package/src/shell/use-workbench-commands.ts +599 -0
- package/src/shell/use-workbench-keybindings.ts +337 -0
- package/src/shell/use-workbench.ts +531 -1153
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/shell/workbench-context.ts +30 -3
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-document-io.ts +807 -0
- package/src/stores/workspace-file-ops.ts +1 -1
- package/src/stores/workspace-knowledge.ts +2 -114
- package/src/stores/workspace-lifecycle.ts +459 -0
- package/src/stores/workspace-plugins-state.ts +254 -259
- package/src/stores/workspace-session.ts +287 -0
- package/src/stores/workspace-tabs-layout.ts +6 -44
- package/src/stores/workspace-types.ts +50 -0
- package/src/stores/workspace.ts +184 -1363
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +0 -1
- package/src/tabs/components/DesktopTabs.vue +19 -14
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/windows/AuxiliaryWindows.vue +2 -2
- package/src/windows/use-window-event-bridge.ts +152 -0
- package/src/workspace/components/TemplateLibrary.vue +1 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
- package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/assistant/locales/de-DE.json +0 -126
- package/src/assistant/locales/en-US.json +0 -126
- package/src/assistant/locales/es-ES.json +0 -126
- package/src/assistant/locales/ja-JP.json +0 -126
- package/src/assistant/locales/zh-CN.json +0 -126
- package/src/assistant/locales/zh-TW.json +0 -126
- package/src/assistant/task-prompts.json +0 -39
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -1,554 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useWindowContext } from '../../windows/context';
|
|
3
|
-
const { window, document } = useWindowContext();
|
|
4
|
-
|
|
5
|
-
import { vSurfaceMotion } from '@tano/editor/surface-motion';
|
|
6
|
-
import { uiLocale, t } from '../../i18n/i18n';
|
|
7
|
-
import { computed, nextTick, ref, watch } from 'vue';
|
|
8
|
-
import { objectTypeRegistry, referenceUrl } from '@tano/protocol';
|
|
9
|
-
import { objectTypeLabel as referenceTypeLabel } from '../../i18n/ui-labels';
|
|
10
|
-
import type {
|
|
11
|
-
WorkspaceObject,
|
|
12
|
-
ReferenceIdentity,
|
|
13
|
-
ReferenceTarget,
|
|
14
|
-
ObjectField,
|
|
15
|
-
} from '@tano/protocol';
|
|
16
|
-
import type { ObjectRecord } from '../workspace-objects';
|
|
17
|
-
import { useWorkspaceStore } from '../../stores/workspace';
|
|
18
|
-
import { useWorkbenchRuntime } from '../../runtime';
|
|
19
|
-
import PlanDateField from '../../plans/components/PlanDateField.vue';
|
|
20
|
-
import DescriptionEditor from '../../documents/components/DescriptionEditor.vue';
|
|
21
|
-
import ReferenceConnections from './ReferenceConnections.vue';
|
|
22
|
-
import ObjectRelationEditor from './ObjectRelationEditor.vue';
|
|
23
|
-
import { readPlanDate, writePlanDate } from '../../plans/plan-date';
|
|
24
|
-
import type { PlanDateValue } from '../../plans/plan-date';
|
|
25
|
-
|
|
26
|
-
const props = defineProps<{
|
|
27
|
-
personal?: {
|
|
28
|
-
id: string;
|
|
29
|
-
records: ObjectRecord[];
|
|
30
|
-
errors: string[];
|
|
31
|
-
writable: boolean;
|
|
32
|
-
createObject: (value: Pick<WorkspaceObject, 'type' | 'name' | 'description' | 'properties' | 'archived'>) => Promise<ObjectRecord>;
|
|
33
|
-
updateObject: (record: ObjectRecord, value: WorkspaceObject, expectedId: string) => Promise<ObjectRecord>;
|
|
34
|
-
};
|
|
35
|
-
selectedId?: string;
|
|
36
|
-
initialType?: string;
|
|
37
|
-
selectedIdentity?: ReferenceIdentity;
|
|
38
|
-
open: boolean;
|
|
39
|
-
canOpenAsset?: boolean;
|
|
40
|
-
canImportAsset?: boolean;
|
|
41
|
-
previewAsset?: (target: ReferenceTarget) => string | null;
|
|
42
|
-
}>();
|
|
43
|
-
const emit = defineEmits<{
|
|
44
|
-
close: [];
|
|
45
|
-
openResource: [identity: ReferenceIdentity];
|
|
46
|
-
openReference: [identity: ReferenceIdentity];
|
|
47
|
-
createDocument: [];
|
|
48
|
-
importAsset: [];
|
|
49
|
-
}>();
|
|
50
|
-
const store = useWorkspaceStore();
|
|
51
|
-
const objectDetails = useWorkbenchRuntime().extensions?.().objectDetails;
|
|
52
|
-
const scopeId = computed(() => props.personal?.id ?? store.workspace?.id);
|
|
53
|
-
const scopeKey = computed(() => `${props.personal ? 'personal' : 'workspace'}:${scopeId.value ?? ''}`);
|
|
54
|
-
const records = computed(() => props.personal?.records ?? store.objects);
|
|
55
|
-
const personalTargets = computed<ReferenceTarget[] | undefined>(() => props.personal?.records.map(({ object, path }) => ({
|
|
56
|
-
workspace: props.personal!.id, type: object.type, id: object.id, name: object.name, path, description: object.description, archived: object.archived,
|
|
57
|
-
})));
|
|
58
|
-
function openLinked(identity: ReferenceIdentity) {
|
|
59
|
-
if (!props.personal) return emit('openReference', identity);
|
|
60
|
-
const record = records.value.find(record => record.object.type === identity.type && record.object.id === identity.id);
|
|
61
|
-
if (record) select(record);
|
|
62
|
-
}
|
|
63
|
-
const objectErrors = computed(() => props.personal?.errors ?? store.objectErrors);
|
|
64
|
-
interface Draft {
|
|
65
|
-
key: string;
|
|
66
|
-
workspace: string;
|
|
67
|
-
scope: string;
|
|
68
|
-
record?: ObjectRecord;
|
|
69
|
-
value: WorkspaceObject;
|
|
70
|
-
json: string;
|
|
71
|
-
error: string;
|
|
72
|
-
}
|
|
73
|
-
const drafts = new Map<string, Draft>();
|
|
74
|
-
const current = ref<Draft>();
|
|
75
|
-
const search = ref('');
|
|
76
|
-
const resourceId = ref<string>();
|
|
77
|
-
const resource = computed(() =>
|
|
78
|
-
!props.personal ? store.referenceTargets.find(
|
|
79
|
-
(target) => target.id === resourceId.value && ['document', 'asset'].includes(target.type),
|
|
80
|
-
) : undefined,
|
|
81
|
-
);
|
|
82
|
-
const previewUrl = computed(() => (resource.value ? props.previewAsset?.(resource.value) : null));
|
|
83
|
-
const resourceTypes = computed(() =>
|
|
84
|
-
store.objectDefinitions.filter((type) => type.storage === 'resource'),
|
|
85
|
-
);
|
|
86
|
-
const recordTypes = computed(() =>
|
|
87
|
-
store.objectDefinitions.filter((type) => type.storage === 'record' && (!props.personal || type.type === 'event')),
|
|
88
|
-
);
|
|
89
|
-
const selectableTypes = computed(() => recordTypes.value.filter(type => !type.legacy || current.value?.record?.object.type === type.type));
|
|
90
|
-
const definition = computed(() =>
|
|
91
|
-
recordTypes.value.find((type) => type.type === current.value?.value.type),
|
|
92
|
-
);
|
|
93
|
-
const retired = computed(() => objectTypeRegistry.get(current.value?.value.type ?? '')?.retired === true);
|
|
94
|
-
const visibleFields = computed(() => definition.value?.fields.filter(field =>
|
|
95
|
-
current.value?.value.type !== 'event' || !['date', 'start', 'end'].includes(field.key)) ?? []);
|
|
96
|
-
const planDate = computed<PlanDateValue>(() => {
|
|
97
|
-
try { return readPlanDate(JSON.parse(current.value?.json ?? '{}')); }
|
|
98
|
-
catch { return { date: '', time: '', end: '' }; }
|
|
99
|
-
});
|
|
100
|
-
function updatePlanDate(value: PlanDateValue) {
|
|
101
|
-
if (!current.value || editDisabled.value) return;
|
|
102
|
-
try {
|
|
103
|
-
const properties = JSON.parse(current.value.json);
|
|
104
|
-
if (!properties || typeof properties !== 'object' || Array.isArray(properties))
|
|
105
|
-
throw new Error(t('请先修正结构化属性 JSON'));
|
|
106
|
-
current.value.json = JSON.stringify(writePlanDate(properties, value), null, 2);
|
|
107
|
-
current.value.error = '';
|
|
108
|
-
} catch (error) { current.value.error = String(error); }
|
|
109
|
-
}
|
|
110
|
-
const editDisabled = computed(() => disabled.value || !definition.value || current.value?.record?.object.properties.syncReadOnly === true);
|
|
111
|
-
const resources = computed(() =>
|
|
112
|
-
props.personal ? [] : store.referenceTargets.filter(
|
|
113
|
-
(target) =>
|
|
114
|
-
['document', 'asset'].includes(target.type) &&
|
|
115
|
-
`${target.name} ${target.path} ${referenceTypeLabel(target.type)}`
|
|
116
|
-
.toLowerCase()
|
|
117
|
-
.includes(search.value.toLowerCase()),
|
|
118
|
-
),
|
|
119
|
-
);
|
|
120
|
-
const busy = ref(false);
|
|
121
|
-
const confirmDelete = ref(false);
|
|
122
|
-
async function removeCurrent() {
|
|
123
|
-
const draft = current.value;
|
|
124
|
-
if (!draft?.record || props.personal || editDisabled.value) return;
|
|
125
|
-
busy.value = true;
|
|
126
|
-
try {
|
|
127
|
-
await store.deleteObject(draft.record, draft.workspace);
|
|
128
|
-
drafts.delete(`${draft.scope}:${draft.record.object.id}`);
|
|
129
|
-
current.value = undefined; confirmDelete.value = false;
|
|
130
|
-
} catch (reason) { draft.error = String(reason); } finally { busy.value = false; }
|
|
131
|
-
}
|
|
132
|
-
const panel = ref<HTMLElement>();
|
|
133
|
-
let previousFocus: HTMLElement | null = null;
|
|
134
|
-
watch(
|
|
135
|
-
() => props.open,
|
|
136
|
-
async (open) => {
|
|
137
|
-
if (open) {
|
|
138
|
-
previousFocus = document.activeElement as HTMLElement;
|
|
139
|
-
await nextTick();
|
|
140
|
-
panel.value?.focus();
|
|
141
|
-
} else if (previousFocus?.isConnected) previousFocus.focus();
|
|
142
|
-
},
|
|
143
|
-
{ immediate: true },
|
|
144
|
-
);
|
|
145
|
-
function trapFocus(event: KeyboardEvent) {
|
|
146
|
-
if (event.key !== 'Tab' || !panel.value) return;
|
|
147
|
-
const controls = Array.from(
|
|
148
|
-
panel.value.querySelectorAll<HTMLElement>(
|
|
149
|
-
'button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary',
|
|
150
|
-
),
|
|
151
|
-
).filter((el) => el.getClientRects().length);
|
|
152
|
-
const first = controls[0],
|
|
153
|
-
last = controls.at(-1);
|
|
154
|
-
if (
|
|
155
|
-
event.shiftKey &&
|
|
156
|
-
(document.activeElement === first || document.activeElement === panel.value)
|
|
157
|
-
) {
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
last?.focus();
|
|
160
|
-
} else if (!event.shiftKey && document.activeElement === last) {
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
first?.focus();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const disabled = computed(
|
|
166
|
-
() => props.personal ? !props.personal.writable || busy.value :
|
|
167
|
-
!store.workspace ||
|
|
168
|
-
store.workspace.readOnly ||
|
|
169
|
-
!store.capabilities.features.objectReferences ||
|
|
170
|
-
busy.value,
|
|
171
|
-
);
|
|
172
|
-
const filtered = computed(() =>
|
|
173
|
-
records.value.filter(({ object }) =>
|
|
174
|
-
(props.personal || store.workspaceSettings.showPeopleDirectory || object.type !== 'person') &&
|
|
175
|
-
`${object.name} ${referenceTypeLabel(object.type)}`
|
|
176
|
-
.toLowerCase()
|
|
177
|
-
.includes(search.value.toLowerCase()),
|
|
178
|
-
),
|
|
179
|
-
);
|
|
180
|
-
function select(record?: ObjectRecord) {
|
|
181
|
-
confirmDelete.value = false;
|
|
182
|
-
const workspace = scopeId.value;
|
|
183
|
-
if (!workspace || busy.value) return;
|
|
184
|
-
resourceId.value = undefined;
|
|
185
|
-
const key = `${scopeKey.value}:${record?.object.id ?? (props.initialType ? `new:${props.initialType}` : 'new')}`;
|
|
186
|
-
let draft = drafts.get(key);
|
|
187
|
-
if (!draft) {
|
|
188
|
-
const value: WorkspaceObject = record
|
|
189
|
-
? JSON.parse(JSON.stringify(record.object))
|
|
190
|
-
: {
|
|
191
|
-
version: 1,
|
|
192
|
-
id: '',
|
|
193
|
-
type: props.personal ? 'event' : props.initialType ?? 'person',
|
|
194
|
-
name: '',
|
|
195
|
-
description: '',
|
|
196
|
-
archived: false,
|
|
197
|
-
properties: props.personal ? { checkable: true, completed: false } : {},
|
|
198
|
-
};
|
|
199
|
-
draft = {
|
|
200
|
-
key,
|
|
201
|
-
workspace,
|
|
202
|
-
scope: scopeKey.value,
|
|
203
|
-
record,
|
|
204
|
-
value,
|
|
205
|
-
json: JSON.stringify(value.properties, null, 2),
|
|
206
|
-
error: '',
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
current.value = draft;
|
|
210
|
-
// Keep the reactive draft, including its original base hash, when changing selection or closing.
|
|
211
|
-
drafts.set(key, current.value);
|
|
212
|
-
}
|
|
213
|
-
watch(
|
|
214
|
-
[scopeKey, () => props.selectedId, () => props.selectedIdentity, () => props.open, () => props.initialType],
|
|
215
|
-
([workspaceId, , selectedIdentity, open], previous) => {
|
|
216
|
-
if (!open && workspaceId === previous?.[0]) return;
|
|
217
|
-
current.value = undefined;
|
|
218
|
-
resourceId.value = undefined;
|
|
219
|
-
if (selectedIdentity && ['document', 'asset'].includes(selectedIdentity.type)) {
|
|
220
|
-
const resource = store.referenceTargets.find((target) => target.type === selectedIdentity.type && target.id === selectedIdentity.id);
|
|
221
|
-
if (resource) selectResource(resource.id);
|
|
222
|
-
} else if (props.selectedId) {
|
|
223
|
-
const record = records.value.find(({ object }) => object.id === props.selectedId);
|
|
224
|
-
if (record) select(record);
|
|
225
|
-
else resourceId.value = props.selectedId;
|
|
226
|
-
} else if (props.initialType) select();
|
|
227
|
-
},
|
|
228
|
-
{ immediate: true },
|
|
229
|
-
);
|
|
230
|
-
async function save(copy = false) {
|
|
231
|
-
const draft = current.value;
|
|
232
|
-
if (!draft || editDisabled.value || draft.scope !== scopeKey.value) return;
|
|
233
|
-
draft.error = '';
|
|
234
|
-
busy.value = true;
|
|
235
|
-
try {
|
|
236
|
-
const properties = JSON.parse(draft.json);
|
|
237
|
-
if (!properties || typeof properties !== 'object' || Array.isArray(properties))
|
|
238
|
-
throw new Error(t('属性必须是 JSON 对象'));
|
|
239
|
-
const value = { ...draft.value, name: draft.value.name.trim(), properties };
|
|
240
|
-
const saved =
|
|
241
|
-
draft.record && !copy
|
|
242
|
-
? await (props.personal ?? store).updateObject(draft.record, value, draft.workspace)
|
|
243
|
-
: await (props.personal ?? store).createObject(value);
|
|
244
|
-
if (current.value !== draft || scopeKey.value !== draft.scope) return;
|
|
245
|
-
drafts.delete(draft.key);
|
|
246
|
-
drafts.delete(`${draft.scope}:${saved.object.id}`);
|
|
247
|
-
busy.value = false;
|
|
248
|
-
select(saved);
|
|
249
|
-
} catch (error) {
|
|
250
|
-
draft.error = String(error);
|
|
251
|
-
} finally {
|
|
252
|
-
busy.value = false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function fieldValue(field: ObjectField) {
|
|
256
|
-
try {
|
|
257
|
-
const value = JSON.parse(current.value?.json ?? '{}')[field.key];
|
|
258
|
-
if (field.type === 'datetime' && value) {
|
|
259
|
-
const date = new Date(value);
|
|
260
|
-
if (!Number.isFinite(date.getTime())) return '';
|
|
261
|
-
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, 16);
|
|
262
|
-
}
|
|
263
|
-
return value ?? '';
|
|
264
|
-
} catch {
|
|
265
|
-
return '';
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function updateField(field: ObjectField, event: Event) {
|
|
269
|
-
if (!current.value || editDisabled.value) return;
|
|
270
|
-
try {
|
|
271
|
-
const properties = JSON.parse(current.value.json);
|
|
272
|
-
if (!properties || typeof properties !== 'object' || Array.isArray(properties))
|
|
273
|
-
throw new Error(t('请先修正结构化属性 JSON'));
|
|
274
|
-
const input = event.target as HTMLInputElement;
|
|
275
|
-
if (field.type === 'boolean') {
|
|
276
|
-
properties[field.key] = input.checked;
|
|
277
|
-
if (current.value.value.type === 'event' && field.key === 'checkable' && !input.checked)
|
|
278
|
-
properties.completed = false;
|
|
279
|
-
}
|
|
280
|
-
else if (!input.value) delete properties[field.key];
|
|
281
|
-
else
|
|
282
|
-
properties[field.key] =
|
|
283
|
-
field.type === 'datetime'
|
|
284
|
-
? new Date(input.value).toISOString()
|
|
285
|
-
: field.type === 'number'
|
|
286
|
-
? Number(input.value)
|
|
287
|
-
: input.value;
|
|
288
|
-
if (current.value.value.type === 'event' && input.value) {
|
|
289
|
-
if (field.key === 'date') {
|
|
290
|
-
delete properties.start;
|
|
291
|
-
delete properties.end;
|
|
292
|
-
} else if (field.key === 'start' || field.key === 'end') delete properties.date;
|
|
293
|
-
}
|
|
294
|
-
current.value.json = JSON.stringify(properties, null, 2);
|
|
295
|
-
current.value.error = '';
|
|
296
|
-
} catch (error) {
|
|
297
|
-
current.value.error = String(error);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function selectResource(id: string) {
|
|
301
|
-
if (!busy.value) {
|
|
302
|
-
current.value = undefined;
|
|
303
|
-
resourceId.value = id;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function resetDraft() {
|
|
307
|
-
if (!current.value || busy.value) return;
|
|
308
|
-
const record = records.value.find(({ object }) => object.id === current.value?.record?.object.id);
|
|
309
|
-
drafts.delete(current.value.key);
|
|
310
|
-
select(record);
|
|
311
|
-
}
|
|
312
|
-
const uri = computed(() =>
|
|
313
|
-
props.personal && current.value?.record ? t('个人事项 · {0}', [current.value.value.id]) : current.value?.record
|
|
314
|
-
? referenceUrl({
|
|
315
|
-
type: current.value.value.type,
|
|
316
|
-
id: current.value.value.id,
|
|
317
|
-
})
|
|
318
|
-
: t('保存后生成唯一 ID'),
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
</script>
|
|
322
|
-
|
|
323
|
-
<template>
|
|
324
|
-
<div v-surface-motion="'ObjectPanel:0'" class="object-panel-backdrop" @click.self="emit('close')">
|
|
325
|
-
<section
|
|
326
|
-
ref="panel"
|
|
327
|
-
class="object-panel"
|
|
328
|
-
tabindex="-1"
|
|
329
|
-
role="dialog"
|
|
330
|
-
aria-modal="true"
|
|
331
|
-
:aria-label="personal ? t('个人事项') : t('工作区对象')"
|
|
332
|
-
@keydown.esc="emit('close')"
|
|
333
|
-
@keydown="trapFocus"
|
|
334
|
-
>
|
|
335
|
-
<header>
|
|
336
|
-
<div>
|
|
337
|
-
<h2>{{ personal ? t('个人事项') : t('工作区对象') }}</h2>
|
|
338
|
-
<p>{{ personal ? t('个人计划独立保存,不随工作区分享;尚未开启跨设备同步。') : t('内置事件、人物、文档和资产。需要完成的事件就是任务,也可为事件安排时间。') }}</p>
|
|
339
|
-
</div>
|
|
340
|
-
<button :aria-label="personal ? t('关闭个人事项') : t('关闭工作区对象')" @click="emit('close')">{{ t('关闭') }}</button>
|
|
341
|
-
</header>
|
|
342
|
-
<p v-if="!personal && !store.capabilities.features.objectReferences" class="object-notice">
|
|
343
|
-
{{ t('「工作区对象与引用」已关闭。现有对象和引用仍保留,可在工作区设置中重新启用。') }}
|
|
344
|
-
</p>
|
|
345
|
-
<p v-if="store.isDemo" class="object-notice">{{ t('浏览器演示存储:对象保存在当前浏览器中。') }}</p>
|
|
346
|
-
<p v-for="error in objectErrors" :key="error" role="alert">{{ error }}</p>
|
|
347
|
-
<div class="object-panel-body">
|
|
348
|
-
<aside>
|
|
349
|
-
<input v-model="search" :aria-label="personal ? t('搜索个人事项') : t('搜索工作区对象')" :placeholder="t('搜索对象')" />
|
|
350
|
-
<button :disabled="disabled" @click="select()">{{ personal ? t('+ 新建个人事件') : t('+ 新建对象') }}</button>
|
|
351
|
-
<div v-if="!personal" class="object-resource-actions">
|
|
352
|
-
<button :disabled="disabled" @click="emit('createDocument')">{{ t('新建文档') }}</button
|
|
353
|
-
><button v-if="canImportAsset" :disabled="disabled" @click="emit('importAsset')">
|
|
354
|
-
{{ t('导入资产') }}
|
|
355
|
-
</button>
|
|
356
|
-
</div>
|
|
357
|
-
<button
|
|
358
|
-
v-for="record in filtered"
|
|
359
|
-
:key="record.object.id"
|
|
360
|
-
:class="{ selected: current?.value.id === record.object.id }"
|
|
361
|
-
:disabled="busy"
|
|
362
|
-
@click="select(record)"
|
|
363
|
-
>
|
|
364
|
-
<strong>{{ record.object.name }}</strong
|
|
365
|
-
><small
|
|
366
|
-
>{{ referenceTypeLabel(record.object.type) }} ·
|
|
367
|
-
{{
|
|
368
|
-
store.objectDefinitions.find((type) => type.type === record.object.type)
|
|
369
|
-
?.category === 'core'
|
|
370
|
-
&& !personal
|
|
371
|
-
? t('内置对象')
|
|
372
|
-
: personal ? t('个人') : objectTypeRegistry.get(record.object.type)?.retired ? t('旧版记录') : t('插件对象')
|
|
373
|
-
}}{{ record.object.archived ? t(' · 已归档') : '' }}</small
|
|
374
|
-
>
|
|
375
|
-
</button>
|
|
376
|
-
<small v-if="resources.length">{{ t('文件资源') }}</small>
|
|
377
|
-
<button
|
|
378
|
-
v-for="target in resources"
|
|
379
|
-
:key="`${target.type}:${target.id}`"
|
|
380
|
-
:disabled="busy"
|
|
381
|
-
:class="{ selected: resourceId === target.id }"
|
|
382
|
-
@click="selectResource(target.id)"
|
|
383
|
-
>
|
|
384
|
-
<strong>{{ target.name }}</strong
|
|
385
|
-
><small>{{ referenceTypeLabel(target.type) }} · {{ target.path }}</small>
|
|
386
|
-
</button>
|
|
387
|
-
<p v-if="!filtered.length && !resources.length">
|
|
388
|
-
{{ t('暂无对象。创建后,在文档中输入 @ 或 [[ 选择引用。') }}
|
|
389
|
-
</p>
|
|
390
|
-
</aside>
|
|
391
|
-
<form v-if="current" @submit.prevent="save()">
|
|
392
|
-
<label
|
|
393
|
-
>{{ t('类别 ·') }} {{ personal ? t('个人') : retired ? t('旧版记录') : definition?.category === 'plugin' ? t('插件对象') : t('内置对象')
|
|
394
|
-
}}<select v-model="current.value.type" :disabled="disabled || !!current.record">
|
|
395
|
-
<option v-if="!definition" :value="current.value.type">
|
|
396
|
-
{{ referenceTypeLabel(current.value.type) }}
|
|
397
|
-
</option>
|
|
398
|
-
<option v-for="type in selectableTypes" :key="type.type" :value="type.type">
|
|
399
|
-
{{ type.category === 'core' ? t(type.label) : type.label }}
|
|
400
|
-
</option>
|
|
401
|
-
</select></label
|
|
402
|
-
>
|
|
403
|
-
<label
|
|
404
|
-
>{{ t('名称') }}<input
|
|
405
|
-
v-model="current.value.name"
|
|
406
|
-
:disabled="editDisabled"
|
|
407
|
-
required
|
|
408
|
-
maxlength="200"
|
|
409
|
-
/></label>
|
|
410
|
-
<DescriptionEditor :key="`${current.scope}:${current.record?.object.id ?? (props.initialType ? `new:${props.initialType}` : 'new')}`" v-model="current.value.description" :disabled="editDisabled" :targets="personal ? [] : store.referenceTargets.filter(target => target.type !== 'document' || !target.path.startsWith('.tano/'))" />
|
|
411
|
-
<ReferenceConnections :identity="current.value" :draft="current.value.description" :local-targets="personalTargets" :active="open" @open="openLinked" />
|
|
412
|
-
<ObjectRelationEditor v-if="current.record && !personal" :identity="current.record.object" :workspace-id="current.workspace" :disabled="editDisabled" @open="openLinked" />
|
|
413
|
-
<component
|
|
414
|
-
:is="objectDetails"
|
|
415
|
-
v-if="objectDetails && !personal && current.record"
|
|
416
|
-
:key="`${current.scope}:${current.record.object.id}`"
|
|
417
|
-
:workspace-id="current.workspace"
|
|
418
|
-
:object="current.record.object"
|
|
419
|
-
:disabled="editDisabled"
|
|
420
|
-
@open-reference="openLinked"
|
|
421
|
-
/>
|
|
422
|
-
<p v-if="retired" class="object-notice">
|
|
423
|
-
{{ t('项目由工作区文件夹和 Markdown 文档承载。旧项目对象及已有引用只读保留,不再创建、编辑或另存为项目对象。') }}
|
|
424
|
-
</p>
|
|
425
|
-
<p v-else-if="!definition" class="object-notice">
|
|
426
|
-
{{ t('此类型不属于内置核心对象,且未注册对应插件。文件和既有引用已保留,当前只读,不参与引用推荐。') }}
|
|
427
|
-
</p>
|
|
428
|
-
<p v-if="current.record?.object.properties.syncReadOnly" class="object-notice">{{ t('此事项来自只读连接或重复日程系列,请在来源应用中编辑;更新会在同步后显示。') }}</p>
|
|
429
|
-
<div v-if="definition?.fields.length" class="object-fields">
|
|
430
|
-
<label v-for="field in visibleFields" :key="field.key"
|
|
431
|
-
>{{ definition?.category === 'core' ? t(field.label) : field.label }}{{ field.required ? ' *' : ''
|
|
432
|
-
}}<input
|
|
433
|
-
:type="
|
|
434
|
-
current.value.type === 'event' && field.key === 'date'
|
|
435
|
-
? 'date'
|
|
436
|
-
: field.type === 'datetime'
|
|
437
|
-
? 'datetime-local'
|
|
438
|
-
: field.type === 'boolean'
|
|
439
|
-
? 'checkbox'
|
|
440
|
-
: field.type === 'number'
|
|
441
|
-
? 'number'
|
|
442
|
-
: 'text'
|
|
443
|
-
"
|
|
444
|
-
:step="field.type === 'number' ? 'any' : undefined"
|
|
445
|
-
:value="fieldValue(field)"
|
|
446
|
-
:checked="field.type === 'boolean' && fieldValue(field) === true"
|
|
447
|
-
:required="field.required && field.type !== 'boolean'"
|
|
448
|
-
:disabled="editDisabled || (current.value.type === 'event' && field.key === 'completed' && fieldValue({ key: 'checkable', label: '', type: 'boolean' }) !== true)"
|
|
449
|
-
@input="updateField(field, $event)"
|
|
450
|
-
/></label>
|
|
451
|
-
<PlanDateField v-if="current.value.type === 'event'" :key="`${current.scope}:${current.record?.object.id ?? (props.initialType ? `new:${props.initialType}` : 'new')}`" class="object-plan-date" :model-value="planDate" :disabled="editDisabled" @update:model-value="updatePlanDate" />
|
|
452
|
-
<small v-if="current.value.type === 'event'"
|
|
453
|
-
>{{ t('计划日期可精确到某天或具体时刻,有起止时间时选择「时间段」。时间按本地时区输入。勾选「需要完成」即可作为任务。') }}</small
|
|
454
|
-
>
|
|
455
|
-
</div>
|
|
456
|
-
<p v-if="current.value.type === 'person' && !objectDetails" class="object-notice">
|
|
457
|
-
{{ t('人物是工作区记录,不代表登录账号或访问权限。') }}
|
|
458
|
-
</p>
|
|
459
|
-
<label class="object-archive"
|
|
460
|
-
><input
|
|
461
|
-
v-model="current.value.archived"
|
|
462
|
-
type="checkbox"
|
|
463
|
-
:disabled="editDisabled"
|
|
464
|
-
/>{{ personal ? t('归档(从计划中隐藏)') : t('归档(保留已有引用,停止推荐)') }}</label
|
|
465
|
-
>
|
|
466
|
-
<details>
|
|
467
|
-
<summary>{{ t('结构化属性(JSON)') }}</summary>
|
|
468
|
-
<label
|
|
469
|
-
>{{ t('属性') }}<textarea
|
|
470
|
-
v-model="current.json"
|
|
471
|
-
:disabled="editDisabled"
|
|
472
|
-
rows="6"
|
|
473
|
-
spellcheck="false"
|
|
474
|
-
/></label
|
|
475
|
-
><small>{{ t('事件可补充 owner、deadline 等属性;截止日期不等同于计划执行时间。') }}</small>
|
|
476
|
-
</details>
|
|
477
|
-
<code class="object-identity">{{ uri }}</code
|
|
478
|
-
><small v-if="current.record">{{ current.record.path }}</small>
|
|
479
|
-
<p v-if="current.error" role="alert">{{ current.error }}</p>
|
|
480
|
-
<footer>
|
|
481
|
-
<button v-if="current.record && !personal" type="button" :disabled="editDisabled" @click="confirmDelete = !confirmDelete">{{ t('删除对象') }}</button>
|
|
482
|
-
<button type="submit" :disabled="editDisabled">
|
|
483
|
-
{{ busy ? t('保存中…') : t('保存对象') }}</button
|
|
484
|
-
><button
|
|
485
|
-
v-if="current.record"
|
|
486
|
-
type="button"
|
|
487
|
-
:disabled="editDisabled"
|
|
488
|
-
@click="save(true)"
|
|
489
|
-
>
|
|
490
|
-
{{ t('另存副本') }}</button
|
|
491
|
-
><button type="button" :disabled="busy" @click="resetDraft">{{ t('放弃草稿并重新读取') }}</button>
|
|
492
|
-
</footer>
|
|
493
|
-
<div v-if="confirmDelete" role="alert">
|
|
494
|
-
<p>{{ t('删除此对象后,已有关系会保留为缺失引用。确认删除?') }}</p>
|
|
495
|
-
<button type="button" :disabled="editDisabled" @click="removeCurrent">{{ t('确认删除对象') }}</button>
|
|
496
|
-
</div>
|
|
497
|
-
</form>
|
|
498
|
-
<div v-else-if="resource" class="object-panel-empty object-resource">
|
|
499
|
-
<h3>{{ resource.name }}</h3>
|
|
500
|
-
<p>{{ referenceTypeLabel(resource.type) }} · {{ t('文件资源') }}</p>
|
|
501
|
-
<img
|
|
502
|
-
v-if="previewUrl"
|
|
503
|
-
class="object-asset-preview"
|
|
504
|
-
:src="previewUrl"
|
|
505
|
-
:alt="resource.name"
|
|
506
|
-
/>
|
|
507
|
-
<dl>
|
|
508
|
-
<dt>{{ t('路径') }}</dt>
|
|
509
|
-
<dd>{{ resource.path }}</dd>
|
|
510
|
-
<dt>{{ t('类型(按扩展名)') }}</dt>
|
|
511
|
-
<dd>{{ resource.mime }}</dd>
|
|
512
|
-
<dt>{{ t('大小') }}</dt>
|
|
513
|
-
<dd>{{ resource.size }} {{ t('字节') }}</dd>
|
|
514
|
-
<dt>{{ t('修改时间') }}</dt>
|
|
515
|
-
<dd>{{ new Date(resource.modified ?? 0).toLocaleString(uiLocale) }}</dd>
|
|
516
|
-
</dl>
|
|
517
|
-
<code class="object-identity">{{ referenceUrl(resource) }}</code>
|
|
518
|
-
<ReferenceConnections :identity="resource" :active="open" @open="openLinked" />
|
|
519
|
-
<p>
|
|
520
|
-
{{
|
|
521
|
-
resource.type === 'document'
|
|
522
|
-
? t('正文仍保存在 Markdown 文件中;这里仅展示文件身份和元数据。')
|
|
523
|
-
: t('原始文件保存在工作区;移动或重命名跟随文件 ID,不重复保存文件内容。')
|
|
524
|
-
}}
|
|
525
|
-
</p>
|
|
526
|
-
<button
|
|
527
|
-
:disabled="
|
|
528
|
-
!store.capabilities.features.objectReferences ||
|
|
529
|
-
(resource.type === 'asset' && !canOpenAsset)
|
|
530
|
-
"
|
|
531
|
-
@click="emit('openResource', resource)"
|
|
532
|
-
>
|
|
533
|
-
{{ resource.type === 'document' ? t('打开文档') : t('导出资产副本') }}
|
|
534
|
-
</button>
|
|
535
|
-
<p v-if="resource.type === 'asset' && !canOpenAsset">
|
|
536
|
-
{{ t('当前模式仅展示资产元数据;打开或导出本地文件请使用桌面版。') }}
|
|
537
|
-
</p>
|
|
538
|
-
</div>
|
|
539
|
-
<div v-else class="object-panel-empty">
|
|
540
|
-
<h3>{{ t('让人与 Agent 引用同一个对象') }}</h3>
|
|
541
|
-
<p>
|
|
542
|
-
{{ t('创建任务、项目、实验、人物或事件。文档和资产自动从工作区文件索引。关闭面板后,未保存的草稿会保留在本次会话中。') }}
|
|
543
|
-
</p>
|
|
544
|
-
<p>
|
|
545
|
-
{{ t('文件资源:') }}{{
|
|
546
|
-
resourceTypes.map((type) => type.category === 'core' ? t(type.label) : type.label).join(' / ')
|
|
547
|
-
}}{{ t('。Paper、Dataset、代码仓库等领域类型由插件注册,不默认内置。') }}
|
|
548
|
-
</p>
|
|
549
|
-
<p>{{ t('在文档输入 @person:名称 可限定类型;使用 / 菜单的“对象引用”插入卡片。') }}</p>
|
|
550
|
-
</div>
|
|
551
|
-
</div>
|
|
552
|
-
</section>
|
|
553
|
-
</div>
|
|
554
|
-
</template>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useWindowContext } from '../../windows/context';
|
|
3
|
-
const { window, document } = useWindowContext();
|
|
4
|
-
|
|
5
|
-
import { vSurfaceMotion } from '@tano/editor/surface-motion';
|
|
6
|
-
import { t } from '../../i18n/i18n';
|
|
7
|
-
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
|
|
8
|
-
import SidebarPlan from './SidebarPlan.vue';
|
|
9
|
-
defineProps<{ date: Date }>();
|
|
10
|
-
const emit = defineEmits<{
|
|
11
|
-
close: [];
|
|
12
|
-
'select-date': [date: Date];
|
|
13
|
-
'select-event': [id: string];
|
|
14
|
-
}>();
|
|
15
|
-
const panel = ref<HTMLElement>();
|
|
16
|
-
let previous: HTMLElement | null = null;
|
|
17
|
-
onMounted(async () => {
|
|
18
|
-
previous = document.activeElement as HTMLElement;
|
|
19
|
-
await nextTick();
|
|
20
|
-
panel.value?.focus();
|
|
21
|
-
});
|
|
22
|
-
onUnmounted(() => {
|
|
23
|
-
if (previous?.isConnected) previous.focus();
|
|
24
|
-
});
|
|
25
|
-
function keyboard(event: KeyboardEvent) {
|
|
26
|
-
if (event.key === 'Escape') {
|
|
27
|
-
event.stopPropagation();
|
|
28
|
-
emit('close');
|
|
29
|
-
}
|
|
30
|
-
if (event.key !== 'Tab') return;
|
|
31
|
-
const controls = [
|
|
32
|
-
...(panel.value?.querySelectorAll<HTMLElement>(
|
|
33
|
-
'button:not(:disabled), select:not(:disabled), [tabindex="0"]',
|
|
34
|
-
) ?? []),
|
|
35
|
-
];
|
|
36
|
-
if (
|
|
37
|
-
event.shiftKey &&
|
|
38
|
-
(document.activeElement === controls[0] || document.activeElement === panel.value)
|
|
39
|
-
) {
|
|
40
|
-
event.preventDefault();
|
|
41
|
-
controls.at(-1)?.focus();
|
|
42
|
-
} else if (!event.shiftKey && document.activeElement === controls.at(-1)) {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
controls[0]?.focus();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
</script>
|
|
49
|
-
<template>
|
|
50
|
-
<div v-surface-motion="'PersonalPlanDialog:0'" class="personal-plan-backdrop" @mousedown.self="emit('close')">
|
|
51
|
-
<section
|
|
52
|
-
ref="panel"
|
|
53
|
-
class="personal-plan-dialog"
|
|
54
|
-
role="dialog"
|
|
55
|
-
aria-modal="true"
|
|
56
|
-
:aria-label="t('个人计划')"
|
|
57
|
-
tabindex="-1"
|
|
58
|
-
@keydown="keyboard"
|
|
59
|
-
>
|
|
60
|
-
<header>
|
|
61
|
-
<strong>{{ t('个人计划') }}</strong
|
|
62
|
-
><button :aria-label="t('关闭个人计划')" @click="emit('close')">{{ t('关闭') }}</button>
|
|
63
|
-
</header>
|
|
64
|
-
<SidebarPlan
|
|
65
|
-
:date="date"
|
|
66
|
-
@select-date="emit('select-date', $event)"
|
|
67
|
-
@select-event="emit('select-event', $event)"
|
|
68
|
-
/>
|
|
69
|
-
</section>
|
|
70
|
-
</div>
|
|
71
|
-
</template>
|
|
72
|
-
<style scoped>
|
|
73
|
-
.personal-plan-backdrop {
|
|
74
|
-
position: fixed;
|
|
75
|
-
inset: 0;
|
|
76
|
-
z-index: 70;
|
|
77
|
-
display: flex;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
align-items: center;
|
|
80
|
-
background: #0005;
|
|
81
|
-
padding: 16px;
|
|
82
|
-
}
|
|
83
|
-
.personal-plan-dialog {
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
width: 380px;
|
|
87
|
-
max-width: 100%;
|
|
88
|
-
max-height: 88vh;
|
|
89
|
-
padding: 20px;
|
|
90
|
-
border: 1px solid var(--line);
|
|
91
|
-
border-radius: 12px;
|
|
92
|
-
background: var(--paper);
|
|
93
|
-
color: var(--text);
|
|
94
|
-
}
|
|
95
|
-
header {
|
|
96
|
-
display: flex;
|
|
97
|
-
justify-content: space-between;
|
|
98
|
-
align-items: center;
|
|
99
|
-
margin-bottom: 10px;
|
|
100
|
-
}
|
|
101
|
-
header button {
|
|
102
|
-
padding: 4px 8px;
|
|
103
|
-
border-radius: 5px;
|
|
104
|
-
}
|
|
105
|
-
</style>
|