jvs-ppt-ui 0.0.29 → 0.0.30
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/dist/lib/jvs-ppt-ui.es.js +14381 -14300
- package/dist/lib/jvs-ppt-ui.umd.js +94 -94
- package/dist/lib/style.css +1 -1
- package/package.json +1 -1
- package/src/components/AIPptDialog.vue +1 -1
- package/src/components/DslInputDialog.vue +1 -1
- package/src/components/FormulaDialog.vue +1 -1
- package/src/components/SidebarLeft.vue +1 -0
- package/src/components/StyleBuilderDialog.vue +9 -8
- package/src/components/sidebar/panels/SidebarDesignPanel.vue +1 -1
- package/src/composables/sidebar/useSidebarDesign.ts +2 -0
- package/src/composables/useSlides.ts +70 -16
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ interface PptApprovalPayload {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// 当打开弹窗时初始化表单
|
|
41
|
-
watch(() => props.visible, (newVal) => {
|
|
41
|
+
const watchVisibleImmediate = (cb: (newVal: boolean) => void) => { watch(() => props.visible, cb); queueMicrotask(() => { if (props.visible) cb(true) }) }; watchVisibleImmediate((newVal) => {
|
|
42
42
|
if (newVal) {
|
|
43
43
|
prompt.value = '2026年企业级大模型落地与数字化转型白皮书'
|
|
44
44
|
selectedTheme.value = '雅致青绿'
|
|
@@ -17,7 +17,7 @@ const dslText = ref('')
|
|
|
17
17
|
const jsonError = ref('')
|
|
18
18
|
const textareaRef = ref<HTMLTextAreaElement | null>(null)
|
|
19
19
|
|
|
20
|
-
watch(() => props.visible, (newVal) => {
|
|
20
|
+
const watchVisibleImmediate = (cb: (newVal: boolean) => void) => { watch(() => props.visible, cb); queueMicrotask(() => { if (props.visible) cb(true) }) }; watchVisibleImmediate((newVal) => {
|
|
21
21
|
if (newVal) {
|
|
22
22
|
jsonError.value = ''
|
|
23
23
|
nextTick(() => {
|
|
@@ -686,6 +686,7 @@ const addSlideWithLayout = (layoutId: string) => {
|
|
|
686
686
|
newSlide.masterId = activeMasterId.value || 'master-default'
|
|
687
687
|
newSlide.layoutId = masterLayout.id
|
|
688
688
|
newSlide.showMasterElements = true
|
|
689
|
+
const parentMaster = (slideMasters.value || []).find((m: any) => (m.layouts || []).some((l: any) => l.id === masterLayout.id)) || slideMasters.value?.[0]; if ((parentMaster as any)?.themeId) { newSlide.themeId = (parentMaster as any).themeId; newSlide.themeName = (parentMaster as any).themeName }
|
|
689
690
|
if (masterLayout.background) {
|
|
690
691
|
newSlide.background = masterLayout.background
|
|
691
692
|
}
|
|
@@ -58,7 +58,7 @@ function selectThemePreset(preset: StyleRecipe) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
watch(() => props.visible, (newVal) => {
|
|
61
|
+
const watchVisibleImmediate = (cb: (newVal: boolean) => void) => { watch([() => props.visible, () => props.initialRecipeId, () => props.targetMode], ([v]) => cb(v)); queueMicrotask(() => { if (props.visible) cb(true) }) }; watchVisibleImmediate((newVal) => {
|
|
62
62
|
if (newVal) {
|
|
63
63
|
applyScope.value = props.targetMode || 'all'
|
|
64
64
|
Object.keys(draftCacheMap).forEach(key => delete draftCacheMap[key])
|
|
@@ -625,7 +625,7 @@ function handlePickerChange(val: any) {
|
|
|
625
625
|
</div>
|
|
626
626
|
<div class="header-theme-usage-info">
|
|
627
627
|
正在编辑:<strong style="color: #0f172a;">{{ localRecipe.name }}</strong>
|
|
628
|
-
<span class="header-usage-pill" :class="getThemeUsageLabel(localRecipe.id).type">
|
|
628
|
+
<span class="header-usage-pill" :class="getThemeUsageLabel(localRecipe.id).type" :title="getThemeUsageLabel(localRecipe.id).fullText || getThemeUsageLabel(localRecipe.id).text" style="white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;">
|
|
629
629
|
{{ getThemeUsageLabel(localRecipe.id).text }}
|
|
630
630
|
</span>
|
|
631
631
|
</div>
|
|
@@ -995,11 +995,11 @@ function handlePickerChange(val: any) {
|
|
|
995
995
|
<div class="config-sidebar">
|
|
996
996
|
<div class="sidebar-header">
|
|
997
997
|
<div>
|
|
998
|
-
<h3>{{ localRecipe.name || '主题配置' }}</h3>
|
|
999
|
-
<div style="font-size: 11px; color: #64748b; margin-top: 2px;">编辑全局或单页样式配方</div>
|
|
998
|
+
<h3 style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{ localRecipe.name || '主题配置' }}</h3>
|
|
999
|
+
<div style="font-size: 11px; color: #64748b; margin-top: 2px; white-space: nowrap;">编辑全局或单页样式配方</div>
|
|
1000
1000
|
</div>
|
|
1001
|
-
<div class="theme-usage-badge-container">
|
|
1002
|
-
<span class="theme-usage-badge" :class="getThemeUsageLabel(localRecipe.id).type">
|
|
1001
|
+
<div class="theme-usage-badge-container" style="flex-shrink: 0; margin-left: 10px;">
|
|
1002
|
+
<span class="theme-usage-badge" :class="getThemeUsageLabel(localRecipe.id).type" :title="getThemeUsageLabel(localRecipe.id).fullText || getThemeUsageLabel(localRecipe.id).text" style="white-space: nowrap; max-width: 145px; overflow: hidden; text-overflow: ellipsis;">
|
|
1003
1003
|
{{ getThemeUsageLabel(localRecipe.id).text }}
|
|
1004
1004
|
</span>
|
|
1005
1005
|
</div>
|
|
@@ -1577,8 +1577,8 @@ function handlePickerChange(val: any) {
|
|
|
1577
1577
|
<!-- Usage Pill Badge -->
|
|
1578
1578
|
<div class="usage-pill" :class="getThemeUsageLabel(themeItem.id).type">
|
|
1579
1579
|
{{ getThemeUsageSlides(themeItem.id).length === slides.length && slides.length > 0 ? '全部' :
|
|
1580
|
-
(getThemeUsageSlides(themeItem.id).length > 0 ? `P${getThemeUsageSlides(themeItem.id).join(',')}` :
|
|
1581
|
-
'未用') }}
|
|
1580
|
+
(getThemeUsageSlides(themeItem.id).length > 2 ? `${getThemeUsageSlides(themeItem.id).length}页` : (getThemeUsageSlides(themeItem.id).length > 0 ? `P${getThemeUsageSlides(themeItem.id).join(',')}` :
|
|
1581
|
+
'未用')) }}
|
|
1582
1582
|
</div>
|
|
1583
1583
|
</div>
|
|
1584
1584
|
</el-tooltip>
|
|
@@ -1938,6 +1938,7 @@ function handlePickerChange(val: any) {
|
|
|
1938
1938
|
margin-bottom: 20px;
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
1941
|
+
.sidebar-header > div:first-child { min-width: 0; flex: 1; }
|
|
1941
1942
|
.sidebar-header h3 {
|
|
1942
1943
|
margin: 0;
|
|
1943
1944
|
font-size: 16px;
|
|
@@ -24,7 +24,7 @@ const props = defineProps<{
|
|
|
24
24
|
|
|
25
25
|
// 样式构建器挂载闩锁:首次打开后保持挂载,异步 chunk 只加载一次
|
|
26
26
|
const styleBuilderMounted = ref(false)
|
|
27
|
-
watch(() => props.styleBuilderVisible, v => { if (v) styleBuilderMounted.value = true })
|
|
27
|
+
watch(() => props.styleBuilderVisible, v => { if (v) styleBuilderMounted.value = true }, { immediate: true })
|
|
28
28
|
|
|
29
29
|
const emit = defineEmits<{
|
|
30
30
|
(e: 'update:designActiveTab', val: string): void
|
|
@@ -170,6 +170,8 @@ export function useSidebarDesign() {
|
|
|
170
170
|
|
|
171
171
|
slide.masterId = parentMaster?.id || slide.masterId || 'master-default'
|
|
172
172
|
slide.layoutId = masterLayout.id
|
|
173
|
+
if (masterLayout.background && (!slide.bgType || slide.bgType === 'color')) slide.background = masterLayout.background
|
|
174
|
+
if ((parentMaster as any)?.themeId && !slide.themeId) { slide.themeId = (parentMaster as any).themeId; slide.themeName = (parentMaster as any).themeName }
|
|
173
175
|
slide.showMasterElements = true
|
|
174
176
|
slide.elements = [...nonLayoutElements, ...newElements]
|
|
175
177
|
addHistorySnapshot()
|
|
@@ -1858,10 +1858,17 @@ export function getEffectiveSlideBackground(slide?: any): any {
|
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
1861
|
-
// 3.
|
|
1861
|
+
// 3. 向上继承匹配版式或母版的背景(非外部导入母版时,幻灯片自身的纯白背景即为该页独立背景,不随母版主题色变更被覆盖)
|
|
1862
1862
|
const { masterId, layoutId } = resolveSlideMasterAndLayout(slide)
|
|
1863
1863
|
const master = slideMasters.value.find(m => m && m.id === masterId) || slideMasters.value[0]
|
|
1864
1864
|
const layout = layoutId && master ? master.layouts?.find(l => l && l.id === layoutId) : null
|
|
1865
|
+
const isImportedMaster = Boolean((master as any)?.isImported)
|
|
1866
|
+
const masterThemeId = (master as any)?.themeId || (!isImportedMaster ? 'tech-blue' : '')
|
|
1867
|
+
if (directBg && typeof directBg === 'string' && !['transparent', 'none', ''].includes(directBg.trim().toLowerCase())) {
|
|
1868
|
+
if (!isImportedMaster || (slide.themeId && masterThemeId && slide.themeId !== masterThemeId)) {
|
|
1869
|
+
return formatBareUrlWithMode(directBg, slide.bgImageMode, slide.isPattern)
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1865
1872
|
|
|
1866
1873
|
if (layout?.background && layout.background !== '#ffffff' && layout.background !== 'none') {
|
|
1867
1874
|
return formatBareUrlWithMode(layout.background, (layout as any).bgImageMode, (layout as any).isPattern)
|
|
@@ -1876,7 +1883,8 @@ export function getEffectiveSlideBackground(slide?: any): any {
|
|
|
1876
1883
|
function applyStyleRecipeToMaster(
|
|
1877
1884
|
recipe: StyleRecipe,
|
|
1878
1885
|
mode: boolean | 'all' | 'single' = 'single',
|
|
1879
|
-
masterId?: string
|
|
1886
|
+
masterId?: string,
|
|
1887
|
+
silent = false
|
|
1880
1888
|
) {
|
|
1881
1889
|
const isAll = mode === true || mode === 'all'
|
|
1882
1890
|
const targetMasters = isAll
|
|
@@ -1930,12 +1938,14 @@ function applyStyleRecipeToMaster(
|
|
|
1930
1938
|
}
|
|
1931
1939
|
|
|
1932
1940
|
// 同 tick 多母版变更 + 急切快照:pre-flush watcher 尚未排空,显式标脏目标母版
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1941
|
+
if (!silent) {
|
|
1942
|
+
targetMasters.forEach(m => {
|
|
1943
|
+
const i = slideMasters.value.indexOf(m)
|
|
1944
|
+
if (i >= 0) dirtyMasterIndexes.add(i)
|
|
1945
|
+
})
|
|
1946
|
+
addMasterHistorySnapshot()
|
|
1947
|
+
notify(isAll ? `已应用主题「${recipe.name}」到全部母版` : `已应用主题「${recipe.name}」到当前母版`)
|
|
1948
|
+
}
|
|
1939
1949
|
}
|
|
1940
1950
|
|
|
1941
1951
|
function applyStyleRecipeToSlides(
|
|
@@ -1992,12 +2002,22 @@ function applyStyleRecipeToSlides(
|
|
|
1992
2002
|
}
|
|
1993
2003
|
})
|
|
1994
2004
|
|
|
1995
|
-
// 🌟
|
|
2005
|
+
// 🌟 单页应用时,先锁定其余已存在幻灯片自身的主题标识与背景,再同步关联母版与版式以当前选中主题渲染
|
|
1996
2006
|
if (effectiveMode === 'single' && targetSlides[0]) {
|
|
1997
2007
|
const curSlide = targetSlides[0]
|
|
1998
2008
|
const resolved = resolveSlideMasterAndLayout(curSlide)
|
|
2009
|
+
const curMaster = slideMasters.value.find(m => m.id === resolved.masterId) || slideMasters.value[0]
|
|
2010
|
+
const prevMasterThemeId = (curMaster as any)?.themeId || 'tech-blue'
|
|
2011
|
+
slides.value.forEach(s => {
|
|
2012
|
+
if (s !== curSlide) {
|
|
2013
|
+
if (!s.themeId) s.themeId = prevMasterThemeId
|
|
2014
|
+
if ((curMaster as any)?.isImported && (!s.background || s.background === '#ffffff')) {
|
|
2015
|
+
s.background = getEffectiveSlideBackground(s) || '#ffffff'
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
})
|
|
1999
2019
|
if (resolved.masterId) {
|
|
2000
|
-
applyStyleRecipeToMaster(recipe, 'single', resolved.masterId)
|
|
2020
|
+
applyStyleRecipeToMaster(recipe, 'single', resolved.masterId, true)
|
|
2001
2021
|
}
|
|
2002
2022
|
}
|
|
2003
2023
|
|
|
@@ -2051,7 +2071,7 @@ function applyStyleRecipeToSlides(
|
|
|
2051
2071
|
if (effectiveMode === 'all') {
|
|
2052
2072
|
notify(`已应用主题「${recipe.name}」到全部幻灯片与母版`)
|
|
2053
2073
|
} else if (effectiveMode === 'single') {
|
|
2054
|
-
notify(`已应用主题「${recipe.name}」到第 ${activeIndex.value + 1}
|
|
2074
|
+
notify(`已应用主题「${recipe.name}」到第 ${activeIndex.value + 1} 页`)
|
|
2055
2075
|
} else if (effectiveMode === 'used') {
|
|
2056
2076
|
notify(`已保存主题「${recipe.name}」并同步更新使用该主题的 ${targetSlides.length} 页幻灯片`)
|
|
2057
2077
|
}
|
|
@@ -2117,7 +2137,7 @@ function getEffectiveMasterElementsForSlide(slide: any, recolorWithTheme: boolea
|
|
|
2117
2137
|
// 🌟 核心判断:只有当前幻灯片显式指定了与母版不同的主题时,才需要进行母版元素主题重映射!
|
|
2118
2138
|
// 若幻灯片与母版同属一个主题(例如刚导入 PPT),母版本身的颜色就是最权威的原始效果,直接返回 combined
|
|
2119
2139
|
const slideThemeId = slide.themeId
|
|
2120
|
-
const masterThemeId = (master as any)?.themeId
|
|
2140
|
+
const masterThemeId = (master as any)?.themeId || (!(master as any)?.isImported ? 'tech-blue' : '')
|
|
2121
2141
|
const needRecolor = recolorWithTheme && slideThemeId && masterThemeId && slideThemeId !== masterThemeId
|
|
2122
2142
|
|
|
2123
2143
|
if (needRecolor) {
|
|
@@ -2230,16 +2250,39 @@ function getThemeUsageSlides(themeId: string): number[] {
|
|
|
2230
2250
|
return pages
|
|
2231
2251
|
}
|
|
2232
2252
|
|
|
2233
|
-
function
|
|
2253
|
+
function formatPageRanges(pages: number[]): string[] {
|
|
2254
|
+
const ranges: string[] = []
|
|
2255
|
+
let i = 0
|
|
2256
|
+
while (i < pages.length) {
|
|
2257
|
+
const start = pages[i]
|
|
2258
|
+
let end = start
|
|
2259
|
+
while (i + 1 < pages.length && pages[i + 1] === end + 1) {
|
|
2260
|
+
i++
|
|
2261
|
+
end = pages[i]
|
|
2262
|
+
}
|
|
2263
|
+
ranges.push(start === end ? `${start}` : (end === start + 1 ? `${start}, ${end}` : `${start}-${end}`))
|
|
2264
|
+
i++
|
|
2265
|
+
}
|
|
2266
|
+
return ranges
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
function getThemeUsageLabel(themeId: string): { type: 'all' | 'partial' | 'none'; text: string; fullText: string; pages: number[] } {
|
|
2234
2270
|
const pages = getThemeUsageSlides(themeId)
|
|
2235
2271
|
const total = slides.value ? slides.value.length : 0
|
|
2236
2272
|
if (total > 0 && pages.length === total) {
|
|
2237
|
-
|
|
2273
|
+
const text = `全部页面 (共 ${total} 页)`
|
|
2274
|
+
return { type: 'all', text, fullText: text, pages }
|
|
2238
2275
|
}
|
|
2239
2276
|
if (pages.length > 0) {
|
|
2240
|
-
|
|
2277
|
+
const ranges = formatPageRanges(pages)
|
|
2278
|
+
const fullRangeStr = ranges.join(', ')
|
|
2279
|
+
const fullText = `第 ${pages.join(', ')} 页 (共 ${pages.length} 页)`
|
|
2280
|
+
const text = (ranges.length <= 2 && fullRangeStr.length <= 12)
|
|
2281
|
+
? `第 ${fullRangeStr} 页`
|
|
2282
|
+
: `第 ${ranges.slice(0, 2).join(', ')} 等 ${pages.length} 页`
|
|
2283
|
+
return { type: 'partial', text, fullText, pages }
|
|
2241
2284
|
}
|
|
2242
|
-
return { type: 'none', text: '未被使用', pages: [] }
|
|
2285
|
+
return { type: 'none', text: '未被使用', fullText: '未被使用', pages: [] }
|
|
2243
2286
|
}
|
|
2244
2287
|
|
|
2245
2288
|
function getActiveSlideThemeRecipe(targetSlide?: any): StyleRecipe {
|
|
@@ -2330,6 +2373,17 @@ watch(activeIndex, (newIdx) => {
|
|
|
2330
2373
|
if (!selectedSlideIndexes.value.includes(newIdx)) {
|
|
2331
2374
|
selectedSlideIndexes.value = [newIdx]
|
|
2332
2375
|
}
|
|
2376
|
+
const curSlide = slides.value[newIdx]
|
|
2377
|
+
if (curSlide?.themeId && !isMasterEditingView.value) {
|
|
2378
|
+
const resolved = resolveSlideMasterAndLayout(curSlide)
|
|
2379
|
+
const master = slideMasters.value.find(m => m.id === resolved.masterId) || slideMasters.value[0]
|
|
2380
|
+
if (master && !(master as any).isImported && (master as any).themeId !== curSlide.themeId) {
|
|
2381
|
+
const targetRecipe = getActiveSlideThemeRecipe(curSlide)
|
|
2382
|
+
if (targetRecipe) {
|
|
2383
|
+
applyStyleRecipeToMaster(targetRecipe, 'single', master.id, true)
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2333
2387
|
})
|
|
2334
2388
|
|
|
2335
2389
|
const activeSlide = computed<Slide>({
|