pptx-angular-viewer 1.1.47 → 1.1.48
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.
|
@@ -49842,6 +49842,24 @@ class SmartArtRendererComponent {
|
|
|
49842
49842
|
asRect(node) {
|
|
49843
49843
|
return node.kind === 'rect' ? node : undefined;
|
|
49844
49844
|
}
|
|
49845
|
+
/**
|
|
49846
|
+
* Split node text on `\n` and compute per-line y offsets (in SVG px) that
|
|
49847
|
+
* centre the block around the node centre y (offset 0). Single-line text
|
|
49848
|
+
* produces one entry with offsetY=0, preserving the existing
|
|
49849
|
+
* `dominant-baseline="central"` behaviour exactly.
|
|
49850
|
+
*/
|
|
49851
|
+
textLines(text, fontSize) {
|
|
49852
|
+
const raw = (text ?? '').split('\n').filter((l) => l.length > 0);
|
|
49853
|
+
if (raw.length === 0) {
|
|
49854
|
+
return [{ text: '', offsetY: 0 }];
|
|
49855
|
+
}
|
|
49856
|
+
const lh = fontSize * 1.2;
|
|
49857
|
+
const totalH = raw.length * lh;
|
|
49858
|
+
return raw.map((line, i) => ({
|
|
49859
|
+
text: line,
|
|
49860
|
+
offsetY: -totalH / 2 + lh / 2 + i * lh,
|
|
49861
|
+
}));
|
|
49862
|
+
}
|
|
49845
49863
|
// ── Inline node-text editing ───────────────────────────────────────────
|
|
49846
49864
|
/** Double-click a node enters inline edit mode (when editable). */
|
|
49847
49865
|
onNodeDblClick(event, node) {
|
|
@@ -49981,13 +49999,16 @@ class SmartArtRendererComponent {
|
|
|
49981
49999
|
@if (shape.text) {
|
|
49982
50000
|
<text
|
|
49983
50001
|
[attr.x]="shape.textX"
|
|
49984
|
-
[attr.y]="shape.textY"
|
|
49985
50002
|
text-anchor="middle"
|
|
49986
50003
|
dominant-baseline="central"
|
|
49987
50004
|
[attr.fill]="shape.fontColor"
|
|
49988
50005
|
[attr.font-size]="shape.fontSize"
|
|
49989
50006
|
>
|
|
49990
|
-
|
|
50007
|
+
@for (line of textLines(shape.text, shape.fontSize); track $index) {
|
|
50008
|
+
<tspan [attr.x]="shape.textX" [attr.y]="shape.textY + line.offsetY">
|
|
50009
|
+
{{ line.text }}
|
|
50010
|
+
</tspan>
|
|
50011
|
+
}
|
|
49991
50012
|
</text>
|
|
49992
50013
|
}
|
|
49993
50014
|
</g>
|
|
@@ -50034,13 +50055,14 @@ class SmartArtRendererComponent {
|
|
|
50034
50055
|
/>
|
|
50035
50056
|
<text
|
|
50036
50057
|
[attr.x]="c.cx"
|
|
50037
|
-
[attr.y]="c.cy"
|
|
50038
50058
|
text-anchor="middle"
|
|
50039
50059
|
dominant-baseline="central"
|
|
50040
50060
|
fill="white"
|
|
50041
50061
|
[attr.font-size]="c.fontSize"
|
|
50042
50062
|
>
|
|
50043
|
-
|
|
50063
|
+
@for (line of textLines(c.text, c.fontSize); track $index) {
|
|
50064
|
+
<tspan [attr.x]="c.cx" [attr.y]="c.cy + line.offsetY">{{ line.text }}</tspan>
|
|
50065
|
+
}
|
|
50044
50066
|
</text>
|
|
50045
50067
|
} @else if (asPolygon(node); as p) {
|
|
50046
50068
|
<polygon
|
|
@@ -50052,13 +50074,16 @@ class SmartArtRendererComponent {
|
|
|
50052
50074
|
/>
|
|
50053
50075
|
<text
|
|
50054
50076
|
[attr.x]="p.textX"
|
|
50055
|
-
[attr.y]="p.textY"
|
|
50056
50077
|
text-anchor="middle"
|
|
50057
50078
|
dominant-baseline="central"
|
|
50058
50079
|
fill="white"
|
|
50059
50080
|
[attr.font-size]="p.fontSize"
|
|
50060
50081
|
>
|
|
50061
|
-
|
|
50082
|
+
@for (line of textLines(p.text, p.fontSize); track $index) {
|
|
50083
|
+
<tspan [attr.x]="p.textX" [attr.y]="p.textY + line.offsetY">
|
|
50084
|
+
{{ line.text }}
|
|
50085
|
+
</tspan>
|
|
50086
|
+
}
|
|
50062
50087
|
</text>
|
|
50063
50088
|
} @else if (asRect(node); as r) {
|
|
50064
50089
|
<rect
|
|
@@ -50074,13 +50099,16 @@ class SmartArtRendererComponent {
|
|
|
50074
50099
|
/>
|
|
50075
50100
|
<text
|
|
50076
50101
|
[attr.x]="r.textX"
|
|
50077
|
-
[attr.y]="r.textY"
|
|
50078
50102
|
text-anchor="middle"
|
|
50079
50103
|
dominant-baseline="central"
|
|
50080
50104
|
fill="white"
|
|
50081
50105
|
[attr.font-size]="r.fontSize"
|
|
50082
50106
|
>
|
|
50083
|
-
|
|
50107
|
+
@for (line of textLines(r.text, r.fontSize); track $index) {
|
|
50108
|
+
<tspan [attr.x]="r.textX" [attr.y]="r.textY + line.offsetY">
|
|
50109
|
+
{{ line.text }}
|
|
50110
|
+
</tspan>
|
|
50111
|
+
}
|
|
50084
50112
|
</text>
|
|
50085
50113
|
}
|
|
50086
50114
|
</g>
|
|
@@ -50118,7 +50146,7 @@ class SmartArtRendererComponent {
|
|
|
50118
50146
|
<span class="pptx-ng-sr-only" aria-live="polite" role="status">{{ liveMessage() }}</span>
|
|
50119
50147
|
</div>
|
|
50120
50148
|
</div>
|
|
50121
|
-
`, isInline: true, styles: [".pptx-ng-smartart-chrome{box-sizing:border-box;overflow:hidden;position:relative}.pptx-ng-smartart-svg{width:100%;height:100%;pointer-events:none}.pptx-ng-smartart-node--editable{pointer-events:auto;cursor:text}.pptx-ng-smartart-node-editor{position:absolute;box-sizing:border-box;margin:0;padding:1px 2px;border:1px solid var(--pptx-inspector-active, #0078d4);border-radius:2px;background:#fff;color:#111;font-size:11px;line-height:1.1;text-align:center;resize:none;overflow:hidden;z-index:2}.pptx-ng-smartart-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:#fffc;pointer-events:none}.pptx-ng-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
50149
|
+
`, isInline: true, styles: [".pptx-ng-smartart-chrome{box-sizing:border-box;overflow:hidden;position:relative}.pptx-ng-smartart-svg{width:100%;height:100%;pointer-events:none}.pptx-ng-smartart-node--editable{pointer-events:auto;cursor:text}.pptx-ng-smartart-node--editable:hover{filter:drop-shadow(0 0 2px rgba(96,165,250,.8))}.pptx-ng-smartart-node-editor{position:absolute;box-sizing:border-box;margin:0;padding:1px 2px;border:1px solid var(--pptx-inspector-active, #0078d4);border-radius:2px;background:#fff;color:#111;font-size:11px;line-height:1.1;text-align:center;resize:none;overflow:hidden;z-index:2}.pptx-ng-smartart-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:#fffc;pointer-events:none}.pptx-ng-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
50122
50150
|
}
|
|
50123
50151
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: SmartArtRendererComponent, decorators: [{
|
|
50124
50152
|
type: Component,
|
|
@@ -50171,13 +50199,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
50171
50199
|
@if (shape.text) {
|
|
50172
50200
|
<text
|
|
50173
50201
|
[attr.x]="shape.textX"
|
|
50174
|
-
[attr.y]="shape.textY"
|
|
50175
50202
|
text-anchor="middle"
|
|
50176
50203
|
dominant-baseline="central"
|
|
50177
50204
|
[attr.fill]="shape.fontColor"
|
|
50178
50205
|
[attr.font-size]="shape.fontSize"
|
|
50179
50206
|
>
|
|
50180
|
-
|
|
50207
|
+
@for (line of textLines(shape.text, shape.fontSize); track $index) {
|
|
50208
|
+
<tspan [attr.x]="shape.textX" [attr.y]="shape.textY + line.offsetY">
|
|
50209
|
+
{{ line.text }}
|
|
50210
|
+
</tspan>
|
|
50211
|
+
}
|
|
50181
50212
|
</text>
|
|
50182
50213
|
}
|
|
50183
50214
|
</g>
|
|
@@ -50224,13 +50255,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
50224
50255
|
/>
|
|
50225
50256
|
<text
|
|
50226
50257
|
[attr.x]="c.cx"
|
|
50227
|
-
[attr.y]="c.cy"
|
|
50228
50258
|
text-anchor="middle"
|
|
50229
50259
|
dominant-baseline="central"
|
|
50230
50260
|
fill="white"
|
|
50231
50261
|
[attr.font-size]="c.fontSize"
|
|
50232
50262
|
>
|
|
50233
|
-
|
|
50263
|
+
@for (line of textLines(c.text, c.fontSize); track $index) {
|
|
50264
|
+
<tspan [attr.x]="c.cx" [attr.y]="c.cy + line.offsetY">{{ line.text }}</tspan>
|
|
50265
|
+
}
|
|
50234
50266
|
</text>
|
|
50235
50267
|
} @else if (asPolygon(node); as p) {
|
|
50236
50268
|
<polygon
|
|
@@ -50242,13 +50274,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
50242
50274
|
/>
|
|
50243
50275
|
<text
|
|
50244
50276
|
[attr.x]="p.textX"
|
|
50245
|
-
[attr.y]="p.textY"
|
|
50246
50277
|
text-anchor="middle"
|
|
50247
50278
|
dominant-baseline="central"
|
|
50248
50279
|
fill="white"
|
|
50249
50280
|
[attr.font-size]="p.fontSize"
|
|
50250
50281
|
>
|
|
50251
|
-
|
|
50282
|
+
@for (line of textLines(p.text, p.fontSize); track $index) {
|
|
50283
|
+
<tspan [attr.x]="p.textX" [attr.y]="p.textY + line.offsetY">
|
|
50284
|
+
{{ line.text }}
|
|
50285
|
+
</tspan>
|
|
50286
|
+
}
|
|
50252
50287
|
</text>
|
|
50253
50288
|
} @else if (asRect(node); as r) {
|
|
50254
50289
|
<rect
|
|
@@ -50264,13 +50299,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
50264
50299
|
/>
|
|
50265
50300
|
<text
|
|
50266
50301
|
[attr.x]="r.textX"
|
|
50267
|
-
[attr.y]="r.textY"
|
|
50268
50302
|
text-anchor="middle"
|
|
50269
50303
|
dominant-baseline="central"
|
|
50270
50304
|
fill="white"
|
|
50271
50305
|
[attr.font-size]="r.fontSize"
|
|
50272
50306
|
>
|
|
50273
|
-
|
|
50307
|
+
@for (line of textLines(r.text, r.fontSize); track $index) {
|
|
50308
|
+
<tspan [attr.x]="r.textX" [attr.y]="r.textY + line.offsetY">
|
|
50309
|
+
{{ line.text }}
|
|
50310
|
+
</tspan>
|
|
50311
|
+
}
|
|
50274
50312
|
</text>
|
|
50275
50313
|
}
|
|
50276
50314
|
</g>
|
|
@@ -50308,7 +50346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
50308
50346
|
<span class="pptx-ng-sr-only" aria-live="polite" role="status">{{ liveMessage() }}</span>
|
|
50309
50347
|
</div>
|
|
50310
50348
|
</div>
|
|
50311
|
-
`, styles: [".pptx-ng-smartart-chrome{box-sizing:border-box;overflow:hidden;position:relative}.pptx-ng-smartart-svg{width:100%;height:100%;pointer-events:none}.pptx-ng-smartart-node--editable{pointer-events:auto;cursor:text}.pptx-ng-smartart-node-editor{position:absolute;box-sizing:border-box;margin:0;padding:1px 2px;border:1px solid var(--pptx-inspector-active, #0078d4);border-radius:2px;background:#fff;color:#111;font-size:11px;line-height:1.1;text-align:center;resize:none;overflow:hidden;z-index:2}.pptx-ng-smartart-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:#fffc;pointer-events:none}.pptx-ng-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
|
|
50349
|
+
`, styles: [".pptx-ng-smartart-chrome{box-sizing:border-box;overflow:hidden;position:relative}.pptx-ng-smartart-svg{width:100%;height:100%;pointer-events:none}.pptx-ng-smartart-node--editable{pointer-events:auto;cursor:text}.pptx-ng-smartart-node--editable:hover{filter:drop-shadow(0 0 2px rgba(96,165,250,.8))}.pptx-ng-smartart-node-editor{position:absolute;box-sizing:border-box;margin:0;padding:1px 2px;border:1px solid var(--pptx-inspector-active, #0078d4);border-radius:2px;background:#fff;color:#111;font-size:11px;line-height:1.1;text-align:center;resize:none;overflow:hidden;z-index:2}.pptx-ng-smartart-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:11px;color:#fffc;pointer-events:none}.pptx-ng-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
|
|
50312
50350
|
}], ctorParameters: () => [], propDecorators: { element: [{ type: i0.Input, args: [{ isSignal: true, alias: "element", required: true }] }], zIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIndex", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], nodeEditor: [{ type: i0.ViewChild, args: ['nodeEditor', { isSignal: true }] }] } });
|
|
50313
50351
|
|
|
50314
50352
|
const PALETTES = {
|