@arronqzy/vue-view 0.1.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/README.md +50 -0
- package/package.json +49 -0
- package/src/env.d.ts +62 -0
- package/src/index.ts +4 -0
- package/src/panel/VueViewOnlinePreview.vue +276 -0
- package/src/panel/VueViewPanel.vue +871 -0
- package/src/panel/components/ConfigHintIcon.vue +34 -0
- package/src/panel/components/ElementsLayer.vue +165 -0
- package/src/panel/components/MaterialPreview.vue +135 -0
- package/src/panel/components/MaterialSidebar.vue +526 -0
- package/src/panel/components/MaterialSidebarTreeNode.vue +305 -0
- package/src/panel/components/MoveableLayer.vue +859 -0
- package/src/panel/components/PanelCanvas.vue +630 -0
- package/src/panel/components/PanelConfigSidebar.vue +397 -0
- package/src/panel/components/PanelRulers.vue +177 -0
- package/src/panel/components/SelectLayer.vue +115 -0
- package/src/panel/components/ViewElementScopePanel.vue +76 -0
- package/src/panel/components/WorkspaceConfigSidebar.vue +147 -0
- package/src/panel/components/WorkspaceProjectNav.vue +192 -0
- package/src/panel/components/WorkspaceStageSplit.vue +258 -0
- package/src/panel/components/config/ConfigColorField.vue +52 -0
- package/src/panel/components/config/ConfigFieldGroup.vue +20 -0
- package/src/panel/components/config/ConfigSection.vue +50 -0
- package/src/panel/components/config/PanelConfigAudioSection.vue +256 -0
- package/src/panel/components/config/PanelConfigChartSection.vue +650 -0
- package/src/panel/components/config/PanelConfigGeometrySection.vue +209 -0
- package/src/panel/components/config/PanelConfigGridChildSpan.vue +68 -0
- package/src/panel/components/config/PanelConfigGridSection.vue +103 -0
- package/src/panel/components/config/PanelConfigImageSection.vue +136 -0
- package/src/panel/components/config/PanelConfigMultiSelect.vue +434 -0
- package/src/panel/components/config/PanelConfigNodeInfo.vue +165 -0
- package/src/panel/components/config/PanelConfigReferenceSection.vue +77 -0
- package/src/panel/components/config/PanelConfigStyleSections.vue +208 -0
- package/src/panel/components/config/PanelConfigTextSection.vue +195 -0
- package/src/panel/components/config/PanelConfigVideoSection.vue +107 -0
- package/src/panel/components/config/shared.ts +74 -0
- package/src/panel/components/elementsLayerNodes.ts +830 -0
- package/src/panel/components/materialSidebarData.ts +85 -0
- package/src/panel/components/scope-config/ScopeConfigProvider.vue +153 -0
- package/src/panel/components/scope-config/ScopeTemplateAutocompleteHost.vue +234 -0
- package/src/panel/components/scope-config/ScopeTemplatePreviewHost.vue +192 -0
- package/src/panel/components/scope-config/ScopeTemplatePreviewPanel.vue +42 -0
- package/src/panel/components/scope-config/ScopeTemplateUsageHint.vue +20 -0
- package/src/panel/components/scope-config/ScopeTemplateWarningsPanel.vue +63 -0
- package/src/panel/components/scope-config/scopeConfigContext.ts +17 -0
- package/src/panel/components/scope-config/useScopeConfig.ts +11 -0
- package/src/panel/constants/messages.ts +34 -0
- package/src/panel/constants/zIndex.ts +6 -0
- package/src/panel/hooks/usePanelElements.ts +1075 -0
- package/src/panel/hooks/useRafThrottledScroll.ts +25 -0
- package/src/panel/hooks/useWorkspaceProjects.ts +240 -0
- package/src/panel/lib/panel-ruler-canvas.ts +139 -0
- package/src/panel/library/workspace-project-cache.ts +23 -0
- package/src/panel/library/workspace-project-db.ts +111 -0
- package/src/panel/library/workspace-project-sync.ts +41 -0
- package/src/panel/library/workspace-snapshot.ts +30 -0
- package/src/panel/parseOnlinePreviewSearchParams.ts +13 -0
- package/src/panel/scope/view-scope-store.ts +82 -0
- package/src/panel/types.ts +127 -0
- package/src/panel/utils/chartOptionBuilder.ts +327 -0
- package/src/panel/utils/gridPlacement.ts +189 -0
- package/src/panel/utils/mappingLayerOps.ts +142 -0
- package/src/panel/utils/panelElementDefaults.ts +161 -0
- package/src/panel/utils/panelElementNodes.ts +35 -0
- package/src/panel/utils/panelStateIO.ts +124 -0
- package/src/panel/utils/scope-autocomplete.ts +114 -0
- package/src/panel/utils/scope-field-labels.ts +46 -0
- package/src/panel/utils/scope-template-chart.ts +92 -0
- package/src/panel/utils/scope-template-preview.ts +124 -0
- package/src/panel/utils/scope-template-spread.ts +229 -0
- package/src/panel/utils/scope-template-warnings.ts +243 -0
- package/src/panel/utils/scope-template.ts +97 -0
- package/src/panel/utils/updateElementDraft.ts +221 -0
- package/src/panel/viewportZoom.ts +26 -0
- package/src/tailwind.css +43 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="space-y-2">
|
|
3
|
+
<p>
|
|
4
|
+
表单中可使用模版字符串引用 scope,例如
|
|
5
|
+
<code class="rounded bg-muted px-1">{`{scope?.a||0}`}</code>
|
|
6
|
+
、
|
|
7
|
+
<code class="rounded bg-muted px-1">{`{scope?.name||''}`}</code>
|
|
8
|
+
。支持 <code class="rounded bg-muted px-1">?.</code> 与
|
|
9
|
+
<code class="rounded bg-muted px-1">||</code> 占位。
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
数组展开模版
|
|
13
|
+
<code class="rounded bg-muted px-1">{`[...{scope?.a?.b}]`}</code>
|
|
14
|
+
、
|
|
15
|
+
<code class="rounded bg-muted px-1">{`[...{scope?.data?.data?.statusName}]`}</code>
|
|
16
|
+
:在文本字段输出逗号分隔字符串;在图表「类目」等数组字段会展开为 n
|
|
17
|
+
个独立项(如 3 条数据对应 3 个类目)。
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, ref, watch } from "vue";
|
|
3
|
+
import { useScopeConfig } from "./useScopeConfig";
|
|
4
|
+
|
|
5
|
+
const WARNINGS_COLLAPSE_STORAGE_KEY = "panel:config-scope-warnings-collapsed";
|
|
6
|
+
|
|
7
|
+
const ctx = useScopeConfig();
|
|
8
|
+
const isCollapsed = ref(false);
|
|
9
|
+
|
|
10
|
+
onMounted(() => {
|
|
11
|
+
const stored = window.localStorage.getItem(WARNINGS_COLLAPSE_STORAGE_KEY);
|
|
12
|
+
if (stored === "1") isCollapsed.value = true;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
watch(isCollapsed, (next) => {
|
|
16
|
+
window.localStorage.setItem(
|
|
17
|
+
WARNINGS_COLLAPSE_STORAGE_KEY,
|
|
18
|
+
next ? "1" : "0"
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
v-if="ctx && ctx.warnings.length > 0"
|
|
26
|
+
class="mt-2 border-t border-border/50 pt-2"
|
|
27
|
+
>
|
|
28
|
+
<div class="flex items-center justify-between gap-2">
|
|
29
|
+
<div class="text-[11px] font-medium text-amber-700 dark:text-amber-300">
|
|
30
|
+
异常调用警告
|
|
31
|
+
<span
|
|
32
|
+
class="ml-1.5 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold"
|
|
33
|
+
>
|
|
34
|
+
{{ ctx.warnings.length }}
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
class="rounded border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent"
|
|
40
|
+
@click="isCollapsed = !isCollapsed"
|
|
41
|
+
>
|
|
42
|
+
{{ isCollapsed ? "展开警告" : "收起警告" }}
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
<ul
|
|
46
|
+
v-if="!isCollapsed"
|
|
47
|
+
class="mt-2 max-h-[200px] space-y-1 overflow-auto text-[10px] leading-relaxed"
|
|
48
|
+
>
|
|
49
|
+
<li
|
|
50
|
+
v-for="warning in ctx.warnings"
|
|
51
|
+
:key="`${warning.fieldId}-${warning.kind}-${warning.missingPath}-${warning.expression}`"
|
|
52
|
+
>
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
class="w-full rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-left text-amber-800 hover:bg-amber-500/15 dark:text-amber-200"
|
|
56
|
+
@click="ctx.scrollToField(warning.fieldId)"
|
|
57
|
+
>
|
|
58
|
+
{{ warning.message }}
|
|
59
|
+
</button>
|
|
60
|
+
</li>
|
|
61
|
+
</ul>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from "vue";
|
|
2
|
+
import type { ScopeTemplateWarning } from "../../utils/scope-template-warnings";
|
|
3
|
+
|
|
4
|
+
export type ScopeConfigContextValue = {
|
|
5
|
+
warnings: ScopeTemplateWarning[];
|
|
6
|
+
warningsByField: Map<string, ScopeTemplateWarning[]>;
|
|
7
|
+
scrollToField: (fieldId: string) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const scopeConfigKey: InjectionKey<ScopeConfigContextValue> =
|
|
11
|
+
Symbol("scopeConfig");
|
|
12
|
+
|
|
13
|
+
export type ScopeConfigProviderProps = {
|
|
14
|
+
scope?: unknown;
|
|
15
|
+
warnings: ScopeTemplateWarning[];
|
|
16
|
+
scrollContainerRef?: Ref<HTMLElement | null | undefined>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { scopeConfigKey } from "./scopeConfigContext";
|
|
3
|
+
|
|
4
|
+
export function useScopeConfig() {
|
|
5
|
+
return inject(scopeConfigKey, null);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function useScopeFieldWarnings(fieldId: string) {
|
|
9
|
+
const ctx = useScopeConfig();
|
|
10
|
+
return ctx?.warningsByField.get(fieldId) ?? [];
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const PANEL_MESSAGES = {
|
|
2
|
+
nodeNotFound: "未找到节点,可能已被删除",
|
|
3
|
+
sourceNodeNotFound: "未找到源节点,可能已被删除",
|
|
4
|
+
targetLayerNotFound: "目标图层不存在",
|
|
5
|
+
nodeMoveSameLayer: "已在当前图层",
|
|
6
|
+
nodeDeleteLocked: "锁定节点不可删除,请在右侧【节点信息】中取消锁定后重试",
|
|
7
|
+
nodeDeleteLayerLocked: "当前节点所在图层已锁定,无法删除。请先在图层栏取消锁定",
|
|
8
|
+
nodeBatchDeleteContainsLocked:
|
|
9
|
+
"选中节点包含锁定节点,无法批量删除。请先在右侧【节点信息】中取消锁定",
|
|
10
|
+
nodeMoveLocked: "锁定节点不允许更换图层,请先在右侧【节点信息】中取消锁定",
|
|
11
|
+
nodeMoveSourceLayerLocked: "节点所在图层已锁定,无法更换图层。请先在图层栏取消锁定",
|
|
12
|
+
nodeMoveTargetLayerLocked: "目标图层已锁定,无法移入。请先在图层栏取消锁定",
|
|
13
|
+
activeLayerLockedCannotAdd: "当前图层已锁定,无法新增节点",
|
|
14
|
+
nodeLayerLockedCannotCopy: "当前节点所在图层已锁定,无法复制",
|
|
15
|
+
selectionContainsLockedLayerNode: "选中节点包含锁定图层内容,无法批量删除",
|
|
16
|
+
sourceLayerLockedCannotPaste: "复制源节点所在图层已锁定,无法粘贴",
|
|
17
|
+
nodeConfigLocked: "当前节点已锁定,配置项不可编辑。",
|
|
18
|
+
nodeConfigLayerLocked: "当前节点所在图层已锁定,配置项不可编辑。",
|
|
19
|
+
readImageFailed: "读取图片失败",
|
|
20
|
+
readAudioFailed: "读取音频失败",
|
|
21
|
+
readVideoFailed: "读取视频失败",
|
|
22
|
+
readRecordAudioFailed: "录音读取失败",
|
|
23
|
+
audioLocalSaved: "已写入本地音频(base64)",
|
|
24
|
+
audioRemoteUploaded: "已上传服务器并更新远程链接",
|
|
25
|
+
audioServerUploadFailed: "服务器上传失败,仅保留本地音频",
|
|
26
|
+
audioPosterSet: "已设置音频占位图",
|
|
27
|
+
audioRecordUnsupported: "当前环境不支持录音",
|
|
28
|
+
audioRecordSaved: "录音已保存,可直接播放",
|
|
29
|
+
audioRecording: "录音中...",
|
|
30
|
+
audioRecordStartFailed: "无法开始录音,请检查麦克风权限",
|
|
31
|
+
videoLocalSaved: "已写入本地视频(base64)",
|
|
32
|
+
videoRemoteUploaded: "已上传服务器并更新远程链接",
|
|
33
|
+
videoServerUploadFailed: "服务器上传失败,仅保留本地视频",
|
|
34
|
+
} as const;
|