jvs-ppt-ui 0.0.35 → 0.0.37
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/iconfont/iconfont.css +7 -3
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.js +1 -1
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.json +7 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.ttf +0 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff +0 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff2 +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_01de32e3d01df54a.svg +9 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_12935f21f0b1ae78.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_201146e666f28fff.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_32ef4f2c1d76ea32.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_571054b13f220252.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_5b14f99769a8894c.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_62fc021bdae89b21.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_649d2b36f7fc251e.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_7e57de8ea8d46aba.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ad1284e63535689.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ff268d3709d6454.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_b8f80ac591d69945.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_dce239981c2cd1aa.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e2ea31ca7735e5c0.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e585ddb9ec5c408e.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_f3335fad3673d648.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_fb925327432cc7e7.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-library.json +1 -0
- package/dist/lib/jvs-ppt-ui.es.js +81545 -23219
- package/dist/lib/jvs-ppt-ui.umd.js +113 -112
- package/dist/lib/style.css +1 -1
- package/package.json +1 -1
- package/scripts/patch-pptxtojson.cjs +33 -0
- package/src/assets/chart/baseArea.png +0 -0
- package/src/assets/chart/baseBar.png +0 -0
- package/src/assets/chart/baseHistogram.png +0 -0
- package/src/assets/chart/basePie.png +0 -0
- package/src/assets/chart/bubbleChart.png +0 -0
- package/src/assets/chart/circyChart.png +0 -0
- package/src/assets/chart/compPolyline.png +0 -0
- package/src/assets/chart/lineChart.png +0 -0
- package/src/assets/chart/otherLine.png +0 -0
- package/src/assets/chart/otherLineChart.png +0 -0
- package/src/assets/chart/perHistogram.png +0 -0
- package/src/assets/chart/radarChart.png +0 -0
- package/src/assets/chart/roseChart.png +0 -0
- package/src/assets/chart/roseCircyChart.png +0 -0
- package/src/assets/chart/stackArea.png +0 -0
- package/src/assets/chart/stackBar.png +0 -0
- package/src/assets/chart/stackHistogram.png +0 -0
- package/src/assets/iconfont/iconfont.js +1 -1
- package/src/components/CanvasArea.vue +26 -13
- package/src/components/ChartTypeSelector.vue +15 -67
- package/src/components/Header.vue +10 -7
- package/src/components/SidebarLeft.vue +382 -30
- package/src/components/SidebarRight.vue +39 -1
- package/src/components/sidebar/panels/LayoutThumbSvg.vue +82 -14
- package/src/components/sidebar/panels/SidebarChartFormatPanel.vue +676 -3
- package/src/composables/sidebar/useSidebarChart.ts +88 -39
- package/src/composables/useSlides.ts +245 -25
- package/src/configs/layoutLibrary.ts +113 -0
- package/src/style.css +107 -17
- package/src/utils/pptxAnimationInjector.ts +36 -4
- package/src/assets/chart/baseMap.png +0 -0
- package/src/assets/chart/boxplot.png +0 -0
|
@@ -160,7 +160,7 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
160
160
|
|
|
161
161
|
const fontSize = parseFloat(el.style?.fontSize || el.fontSize || (isPlaceholder ? (el.placeholder?.type === 'title' ? '28' : '16') : '16')) || 16
|
|
162
162
|
|
|
163
|
-
const defaultWidthFallback = isVertical ? ((
|
|
163
|
+
const defaultWidthFallback = isVertical ? (((fontSize + 24) / baseW) * 100) : 0
|
|
164
164
|
const defaultHeightFallback = ((fontSize * 1.25) / baseH) * 100
|
|
165
165
|
const rawWVal = (el.style?.width && el.style.width !== 'auto') ? el.style.width : el.width
|
|
166
166
|
const rawHVal = (el.style?.height && el.style.height !== 'auto') ? el.style.height : (el.height && el.height !== 'auto' ? el.height : undefined)
|
|
@@ -194,7 +194,7 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
194
194
|
const baseRatio = 100 / baseW
|
|
195
195
|
const rawSvgSize = fontSize * baseRatio
|
|
196
196
|
const svgFontSize = isPlaceholder
|
|
197
|
-
? +(Math.max(1.
|
|
197
|
+
? +(Math.max(1.5, Math.min(7.5, rawSvgSize * 1.05))).toFixed(2)
|
|
198
198
|
: +(Math.max(1.4, Math.min(14, rawSvgSize))).toFixed(2)
|
|
199
199
|
|
|
200
200
|
const rawSegments: { text: string; indent: number }[] = []
|
|
@@ -260,7 +260,8 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
260
260
|
const lineHeight = +(svgFontSize * (fontSize >= 72 ? 1.05 : 1.25)).toFixed(2)
|
|
261
261
|
const lineCount = Math.min(parsedTextLines.length, 6)
|
|
262
262
|
const totalTextH = lineCount * lineHeight
|
|
263
|
-
const
|
|
263
|
+
const defaultVAlign = (!isVertical && isPlaceholder && h > svgFontSize * 3.8 && fontSize < 32) ? 'top' : 'middle'
|
|
264
|
+
const vAlign = el.verticalAlign || el.style?.verticalAlign || defaultVAlign
|
|
264
265
|
let textStartY = +(y + svgFontSize * 0.95).toFixed(2)
|
|
265
266
|
if (h > totalTextH) {
|
|
266
267
|
if (vAlign === 'bottom' || vAlign === 'down') {
|
|
@@ -273,6 +274,11 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
273
274
|
|
|
274
275
|
const isTitle = el.type === 'text' && (el.name?.includes('标题') || el.placeholder?.type === 'title' || fontSize >= 24)
|
|
275
276
|
const isText = el.type === 'text'
|
|
277
|
+
const fontFamily = (el.style?.fontFamily && el.style.fontFamily !== '默认字体' && el.style.fontFamily !== 'inherit')
|
|
278
|
+
? el.style.fontFamily
|
|
279
|
+
: ((el.fontFamily && el.fontFamily !== '默认字体' && el.fontFamily !== 'inherit')
|
|
280
|
+
? el.fontFamily
|
|
281
|
+
: 'sans-serif')
|
|
276
282
|
|
|
277
283
|
const color = parseColorString(el.style?.color || el.color, isPlaceholder ? (isTitle ? '#0f172a' : '#64748b') : (isTitle ? '#0f172a' : '#334155'))
|
|
278
284
|
const rawFillVal = (el.style && el.style.fill !== undefined) ? el.style.fill : el.fill
|
|
@@ -297,7 +303,7 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
297
303
|
const rawOpacity = el.style?.opacity !== undefined ? parseFloat(el.style.opacity) : (el.opacity !== undefined ? parseFloat(el.opacity) : 1)
|
|
298
304
|
const opacity = isNaN(rawOpacity) ? 1 : rawOpacity
|
|
299
305
|
const inlineAlignMatch = rawContentStr ? rawContentStr.match(/text-align:\s*(left|center|right)/i) : null
|
|
300
|
-
const textAlign = el.style?.textAlign || el.textAlign || (inlineAlignMatch ? inlineAlignMatch[1].toLowerCase() : (el.type === 'shape' ? 'center' :
|
|
306
|
+
const textAlign = el.style?.textAlign || el.textAlign || (inlineAlignMatch ? inlineAlignMatch[1].toLowerCase() : (el.type === 'shape' ? 'center' : 'left'))
|
|
301
307
|
const pattern = getElementPattern(el)
|
|
302
308
|
const rawBr = parseFloat(el.style?.borderRadius || el.borderRadius || 0) || 0
|
|
303
309
|
const rx = rawBr > 0 ? +((rawBr / baseW) * 100).toFixed(2) : (el.type === 'shape' ? 0.8 : 0)
|
|
@@ -379,6 +385,13 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
379
385
|
}
|
|
380
386
|
}
|
|
381
387
|
|
|
388
|
+
const chartColors: string[] = Array.isArray(el.style?.chartColors) && el.style.chartColors.length > 0
|
|
389
|
+
? el.style.chartColors
|
|
390
|
+
: (Array.isArray(el.themeColors) && el.themeColors.length > 0
|
|
391
|
+
? el.themeColors
|
|
392
|
+
: ['#2563eb', '#3b82f6', '#60a5fa', '#93c5fd'])
|
|
393
|
+
const chartType = String(el.chartType || 'bar').toLowerCase()
|
|
394
|
+
|
|
382
395
|
return {
|
|
383
396
|
id: el.id,
|
|
384
397
|
rawEl: el,
|
|
@@ -389,6 +402,8 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
389
402
|
isCircle,
|
|
390
403
|
isImagePlaceholder,
|
|
391
404
|
type: el.type || 'text',
|
|
405
|
+
chartType,
|
|
406
|
+
chartColors,
|
|
392
407
|
isImage: el.type === 'image' || Boolean(el.src || el.imageSrc || el.picBase64 || el.base64 || getElementImageSrc(el)),
|
|
393
408
|
imageSrc: getElementImageSrc(el),
|
|
394
409
|
clipViewBox,
|
|
@@ -413,6 +428,7 @@ function getLayoutSvgElements(elements: any[]) {
|
|
|
413
428
|
isPlaceholder,
|
|
414
429
|
textAlign,
|
|
415
430
|
svgFontSize,
|
|
431
|
+
fontFamily,
|
|
416
432
|
isTitle,
|
|
417
433
|
isText,
|
|
418
434
|
cleanText,
|
|
@@ -564,7 +580,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
564
580
|
text-anchor="middle"
|
|
565
581
|
:fill="item.color || '#ffffff'"
|
|
566
582
|
:font-size="item.svgFontSize"
|
|
567
|
-
font-family="
|
|
583
|
+
:font-family="item.fontFamily"
|
|
568
584
|
font-weight="bold"
|
|
569
585
|
style="pointer-events: none; user-select: none;"
|
|
570
586
|
>{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
|
|
@@ -588,7 +604,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
588
604
|
text-anchor="middle"
|
|
589
605
|
:fill="item.color || '#ffffff'"
|
|
590
606
|
:font-size="item.svgFontSize"
|
|
591
|
-
font-family="
|
|
607
|
+
:font-family="item.fontFamily"
|
|
592
608
|
font-weight="bold"
|
|
593
609
|
style="pointer-events: none; user-select: none;"
|
|
594
610
|
>{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
|
|
@@ -602,7 +618,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
602
618
|
text-anchor="middle"
|
|
603
619
|
:fill="item.color || '#ffffff'"
|
|
604
620
|
:font-size="item.svgFontSize"
|
|
605
|
-
font-family="
|
|
621
|
+
:font-family="item.fontFamily"
|
|
606
622
|
font-weight="bold"
|
|
607
623
|
style="pointer-events: none; user-select: none;"
|
|
608
624
|
>{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
|
|
@@ -625,17 +641,22 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
625
641
|
v-for="(lineObj, lIdx) in item.parsedTextLines.slice(0, 6)"
|
|
626
642
|
:key="lIdx"
|
|
627
643
|
:x="item.isVertical
|
|
628
|
-
? (item.x + item.w * 0.5)
|
|
644
|
+
? (item.x + item.w * 0.5 - (lIdx - (Math.min(item.parsedTextLines.length, 6) - 1) / 2) * item.lineHeight)
|
|
629
645
|
: (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15)
|
|
630
646
|
? (item.x + item.w * 0.5)
|
|
631
647
|
: (item.textAlign === 'right'
|
|
632
648
|
? (item.x + item.w - (item.isPlaceholder ? 1 : 0))
|
|
633
649
|
: (item.x + (lineObj.indent || 0) * 2.5 + (item.isPlaceholder ? 1 : 0))))"
|
|
634
|
-
:y="item.
|
|
635
|
-
|
|
650
|
+
:y="item.isVertical
|
|
651
|
+
? (item.textAlign === 'center' ? item.yCenter : (item.textAlign === 'right' ? (item.y + item.h - 1.2) : (item.y + 1.2)))
|
|
652
|
+
: (item.textStartY + lIdx * item.lineHeight)"
|
|
653
|
+
:text-anchor="item.isVertical
|
|
654
|
+
? (item.textAlign === 'center' ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))
|
|
655
|
+
: (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
|
|
656
|
+
:dominant-baseline="item.isVertical ? 'central' : undefined"
|
|
636
657
|
:fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
|
|
637
658
|
:font-size="item.svgFontSize"
|
|
638
|
-
font-family="
|
|
659
|
+
:font-family="item.fontFamily"
|
|
639
660
|
:font-weight="item.isTitle ? 'bold' : 'normal'"
|
|
640
661
|
:style="{ writingMode: item.isVertical ? 'vertical-rl' : 'horizontal-tb', pointerEvents: 'none', userSelect: 'none' }"
|
|
641
662
|
>{{ lineObj.text.length > 20 ? lineObj.text.substring(0, 20) + '...' : lineObj.text }}</text>
|
|
@@ -650,12 +671,15 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
650
671
|
? item.x + item.w - (item.isPlaceholder ? 1 : 0)
|
|
651
672
|
: item.x + (item.isPlaceholder ? 1 : 0)))"
|
|
652
673
|
:y="item.isVertical
|
|
653
|
-
? item.y + item.
|
|
674
|
+
? (item.textAlign === 'center' ? item.yCenter : (item.textAlign === 'right' ? (item.y + item.h - 1.2) : (item.y + 1.2)))
|
|
654
675
|
: (item.textStartY || Math.min(thumbSvgHeight - 1, item.y + item.h * 0.5 + item.svgFontSize * 0.35))"
|
|
655
|
-
:text-anchor="item.isVertical
|
|
676
|
+
:text-anchor="item.isVertical
|
|
677
|
+
? (item.textAlign === 'center' ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))
|
|
678
|
+
: (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
|
|
679
|
+
:dominant-baseline="item.isVertical ? 'central' : undefined"
|
|
656
680
|
:fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
|
|
657
681
|
:font-size="item.svgFontSize"
|
|
658
|
-
font-family="
|
|
682
|
+
:font-family="item.fontFamily"
|
|
659
683
|
:font-weight="item.isTitle ? 'bold' : 'normal'"
|
|
660
684
|
:style="{ writingMode: item.isVertical ? 'vertical-rl' : 'horizontal-tb', pointerEvents: 'none', userSelect: 'none' }"
|
|
661
685
|
>{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
|
|
@@ -677,6 +701,50 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
|
|
|
677
701
|
/>
|
|
678
702
|
</g>
|
|
679
703
|
</g>
|
|
704
|
+
<g v-else-if="item.type === 'chart'" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
|
|
705
|
+
<template v-if="item.chartType === 'donut' || item.chartType === 'ring' || item.chartType === 'pie'">
|
|
706
|
+
<circle
|
|
707
|
+
:cx="item.cx"
|
|
708
|
+
:cy="item.cy"
|
|
709
|
+
:r="Math.max(1.5, Math.min(item.w, item.h) * 0.36)"
|
|
710
|
+
:fill="item.chartType === 'pie' ? (item.chartColors[0] || '#2563eb') : 'none'"
|
|
711
|
+
:stroke="item.chartColors[0] || '#2563eb'"
|
|
712
|
+
:stroke-width="item.chartType === 'pie' ? 0.4 : Math.max(1.2, Math.min(item.w, item.h) * 0.14)"
|
|
713
|
+
/>
|
|
714
|
+
<circle
|
|
715
|
+
v-if="item.chartType !== 'pie'"
|
|
716
|
+
:cx="item.cx"
|
|
717
|
+
:cy="item.cy"
|
|
718
|
+
:r="Math.max(1.5, Math.min(item.w, item.h) * 0.36)"
|
|
719
|
+
fill="none"
|
|
720
|
+
:stroke="item.chartColors[2] || item.chartColors[1] || '#93c5fd'"
|
|
721
|
+
:stroke-width="Math.max(1.2, Math.min(item.w, item.h) * 0.14)"
|
|
722
|
+
:stroke-dasharray="`${Math.max(2, Math.min(item.w, item.h) * 0.8)} ${Math.max(4, Math.min(item.w, item.h) * 2)}`"
|
|
723
|
+
/>
|
|
724
|
+
</template>
|
|
725
|
+
<template v-else-if="item.chartType === 'line' || item.chartType === 'area'">
|
|
726
|
+
<polyline
|
|
727
|
+
:points="`${item.x + item.w * 0.08},${item.y + item.h * 0.82} ${item.x + item.w * 0.35},${item.y + item.h * 0.58} ${item.x + item.w * 0.65},${item.y + item.h * 0.38} ${item.x + item.w * 0.92},${item.y + item.h * 0.16}`"
|
|
728
|
+
fill="none"
|
|
729
|
+
:stroke="item.chartColors[0] || '#2563eb'"
|
|
730
|
+
stroke-width="1.1"
|
|
731
|
+
stroke-linecap="round"
|
|
732
|
+
stroke-linejoin="round"
|
|
733
|
+
/>
|
|
734
|
+
<line :x1="item.x + item.w * 0.06" :y1="item.y + item.h * 0.88" :x2="item.x + item.w * 0.94" :y2="item.y + item.h * 0.88" :stroke="item.chartColors[3] || '#cbd5e1'" stroke-width="0.4" />
|
|
735
|
+
</template>
|
|
736
|
+
<template v-else-if="item.chartType === 'horizontal-bar'">
|
|
737
|
+
<rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.15" :width="item.w * 0.78" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[0] || '#2563eb'" />
|
|
738
|
+
<rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.42" :width="item.w * 0.56" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[1] || item.chartColors[0] || '#3b82f6'" />
|
|
739
|
+
<rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.69" :width="item.w * 0.38" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[2] || item.chartColors[0] || '#60a5fa'" />
|
|
740
|
+
</template>
|
|
741
|
+
<template v-else>
|
|
742
|
+
<rect :x="item.x + item.w * 0.1" :y="item.y + item.h * 0.45" :width="item.w * 0.14" :height="item.h * 0.45" rx="0.5" :fill="item.chartColors[0] || '#2563eb'" />
|
|
743
|
+
<rect :x="item.x + item.w * 0.31" :y="item.y + item.h * 0.25" :width="item.w * 0.14" :height="item.h * 0.65" rx="0.5" :fill="item.chartColors[1] || item.chartColors[0] || '#3b82f6'" />
|
|
744
|
+
<rect :x="item.x + item.w * 0.52" :y="item.y + item.h * 0.35" :width="item.w * 0.14" :height="item.h * 0.55" rx="0.5" :fill="item.chartColors[2] || item.chartColors[0] || '#60a5fa'" />
|
|
745
|
+
<rect :x="item.x + item.w * 0.73" :y="item.y + item.h * 0.15" :width="item.w * 0.14" :height="item.h * 0.75" rx="0.5" :fill="item.chartColors[3] || item.chartColors[0] || '#93c5fd'" />
|
|
746
|
+
</template>
|
|
747
|
+
</g>
|
|
680
748
|
<rect v-else :x="item.x" :y="item.y" :width="item.w" :height="item.h" rx="1" fill="none" stroke="#e2e8f0" stroke-width="0.8" />
|
|
681
749
|
</template>
|
|
682
750
|
</template>
|