ooxml-ui 1.29.0 → 1.30.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/dist/chart/chartex-options-locales.d.ts +11 -0
- package/dist/chart/chartex-options.d.ts +37 -0
- package/dist/chart/data-sheet-locales.d.ts +3 -0
- package/dist/chart/format-pane-3d.d.ts.map +1 -1
- package/dist/chart/format-pane-advanced-intent.d.ts +6 -0
- package/dist/chart/format-pane-advanced-intent.d.ts.map +1 -0
- package/dist/chart/format-pane-advanced-space.d.ts +14 -0
- package/dist/chart/format-pane-advanced-space.d.ts.map +1 -0
- package/dist/chart/format-pane-analysis.d.ts +7 -0
- package/dist/chart/format-pane-analysis.d.ts.map +1 -0
- package/dist/chart/format-pane-axis.d.ts.map +1 -1
- package/dist/chart/format-pane-chartex.d.ts +4 -0
- package/dist/chart/format-pane-fill-kinds.d.ts +1 -0
- package/dist/chart/format-pane-intent.d.ts +4 -3
- package/dist/chart/format-pane-intent.d.ts.map +1 -1
- package/dist/chart/format-pane-locales/de.d.ts.map +1 -1
- package/dist/chart/format-pane-locales/en.d.ts.map +1 -1
- package/dist/chart/format-pane-locales/es.d.ts.map +1 -1
- package/dist/chart/format-pane-locales/fr.d.ts.map +1 -1
- package/dist/chart/format-pane-locales/zh-CN.d.ts.map +1 -1
- package/dist/chart/format-pane-options.d.ts.map +1 -1
- package/dist/chart/format-pane-space.d.ts +6 -5
- package/dist/chart/format-pane-space.d.ts.map +1 -1
- package/dist/chart/format-pane-targets.d.ts +1 -0
- package/dist/chart/format-pane-types.d.ts +1 -0
- package/dist/chart/format-pane-view.d.ts +20 -0
- package/dist/chart/format-pane-view.d.ts.map +1 -1
- package/dist/chart-format-locales.js +1 -1
- package/dist/{chunk-VM6ZTKB3.js → chunk-4OBMFPGF.js} +420 -0
- package/dist/{chunk-W2JD75LX.js → chunk-BKHWBIXP.js} +317 -100
- package/dist/chunk-E4H3Y7M4.js +462 -0
- package/dist/{chunk-WDOWQKKC.js → chunk-HNREZW5U.js} +909 -341
- package/dist/{chunk-YMZFOG2U.js → chunk-IE6HKH4X.js} +1 -1
- package/dist/{chunk-LNHFMJ2P.js → chunk-SBBFNAKM.js} +3 -3
- package/dist/{chunk-KSOHDEUI.js → chunk-SXVOXSTE.js} +1 -1
- package/dist/controls.js +2 -2
- package/dist/docx/chart-sheet-labels.d.ts +3 -0
- package/dist/docx/locales/en.d.ts +15 -0
- package/dist/docx/locales/smartart.d.ts +15 -0
- package/dist/docx/localization-strings.d.ts +15 -0
- package/dist/docx/ribbon-action.d.ts +4 -0
- package/dist/docx/smartart-format-galleries.d.ts +2 -0
- package/dist/docx.js +197 -43
- package/dist/form/checkable.d.ts +1 -0
- package/dist/index.js +6 -6
- package/dist/pptx/ai/host.cjs +60 -28
- package/dist/pptx/ai/host.d.ts +5 -0
- package/dist/pptx/ai/host.d.ts.map +1 -1
- package/dist/pptx/ai/host.mjs +1 -1
- package/dist/pptx/ai/index.cjs +74 -627
- package/dist/pptx/ai/index.mjs +5 -589
- package/dist/pptx/{chunk-UTBHXIDK.cjs → chunk-2CBK46AW.cjs} +46 -46
- package/dist/pptx/{chunk-DVLU476S.mjs → chunk-45OYSCLD.mjs} +1010 -381
- package/dist/pptx/{chunk-PATUICO4.cjs → chunk-46HIE4IE.cjs} +420 -0
- package/dist/pptx/{chunk-EHIQ4ANA.mjs → chunk-6MEBLCNK.mjs} +420 -0
- package/dist/pptx/{chunk-IY7H76CZ.cjs → chunk-BMMTD6PB.cjs} +593 -0
- package/dist/pptx/{chunk-67UQWOEQ.cjs → chunk-CQYWHRZE.cjs} +31 -0
- package/dist/pptx/{chunk-YO3EMGXD.mjs → chunk-D7UYDESZ.mjs} +2 -2
- package/dist/pptx/{chunk-6MZFWTBS.mjs → chunk-LXEMMWVI.mjs} +30 -1
- package/dist/pptx/{chunk-YQANSI3A.mjs → chunk-SMMEIEEJ.mjs} +584 -1
- package/dist/pptx/{chunk-BXCXY4HB.cjs → chunk-YMWEU56T.cjs} +1027 -392
- package/dist/pptx/dom/index.cjs +389 -389
- package/dist/pptx/dom/index.mjs +7 -7
- package/dist/pptx/export/html2canvas-clone.cjs +12 -4
- package/dist/pptx/export/html2canvas-clone.d.ts +17 -2
- package/dist/pptx/export/html2canvas-clone.d.ts.map +1 -1
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/index.cjs +3066 -3046
- package/dist/pptx/index.mjs +3 -3
- package/dist/pptx/render/collaboration-external-readiness.d.ts.map +1 -1
- package/dist/pptx/render/collaboration-live-patch.d.ts +3 -1
- package/dist/pptx/render/collaboration-live-patch.d.ts.map +1 -1
- package/dist/pptx/render/collaboration-reconcile.d.ts +1 -1
- package/dist/pptx/render/collaboration-reconcile.d.ts.map +1 -1
- package/dist/pptx/render/collaboration-text-target.d.ts +2 -1
- package/dist/pptx/render/collaboration-text-target.d.ts.map +1 -1
- package/dist/pptx/render/controller/collaboration-history.d.ts +22 -0
- package/dist/pptx/render/controller/collaboration-history.d.ts.map +1 -0
- package/dist/pptx/render/editor-keymap-chords.d.ts +3 -4
- package/dist/pptx/render/editor-keymap-chords.d.ts.map +1 -1
- package/dist/pptx/render/morph-animation.d.ts.map +1 -1
- package/dist/pptx/render/morph-plan.d.ts +2 -0
- package/dist/pptx/render/morph-plan.d.ts.map +1 -1
- package/dist/pptx/render/morph-text-slot.d.ts +7 -0
- package/dist/pptx/render/morph-text-slot.d.ts.map +1 -1
- package/dist/pptx/render/text-block-style.d.ts.map +1 -1
- package/dist/pptx/render/text-run-style.d.ts +2 -0
- package/dist/pptx/render/text-run-style.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-DHQ47GXP.cjs → smartart-insert-preview-7OL7VWEK.cjs} +5 -5
- package/dist/pptx/{smartart-insert-preview-IQVC5LMF.mjs → smartart-insert-preview-SKFD7NCQ.mjs} +4 -4
- package/dist/smartart/smartart-effects.d.ts +3 -0
- package/dist/smartart/smartart-geometry.d.ts +5 -0
- package/dist/smartart/smartart-paint.d.ts +4 -0
- package/dist/smartart/smartart-svg.d.ts +4 -1
- package/dist/smartart/smartart-text.d.ts +4 -0
- package/dist/smartart.js +1 -1
- package/dist/teams.js +3 -3
- package/dist/visio/viewer-chart-editor.d.ts +2 -1
- package/dist/visio.js +36 -19
- package/dist/xlsx/chart-ex-pane.d.ts +11 -0
- package/dist/xlsx/grid/smartart.d.ts +3 -4
- package/dist/xlsx/ribbon/shared-gallery.d.ts +14 -0
- package/dist/xlsx.js +386 -139
- package/package.json +2 -2
- package/dist/chunk-UBBC5FH7.js +0 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createIconSvg, paintIcon, getIcon } from './chunk-M6GF5ED2.js';
|
|
2
|
-
import { CHART_FORMAT_STRINGS, CHART_FORMAT_LOCALES } from './chunk-
|
|
2
|
+
import { CHART_FORMAT_STRINGS, CHART_FORMAT_LOCALES } from './chunk-4OBMFPGF.js';
|
|
3
3
|
import { initialsOf } from './chunk-YZH2QS7J.js';
|
|
4
4
|
import { parseSvgPreview } from './chunk-FN7IF6M6.js';
|
|
5
5
|
import { OfficeElement, controlStyles, definer, valueOn, flag, present, emit, triState, withTokens } from './chunk-QLHCGV4C.js';
|
|
@@ -10,7 +10,7 @@ import { repeat } from 'lit/directives/repeat.js';
|
|
|
10
10
|
import { normalizeLocale } from 'ooxml-core/i18n';
|
|
11
11
|
import { unsafeStatic, html as html$1 } from 'lit/static-html.js';
|
|
12
12
|
import { live } from 'lit/directives/live.js';
|
|
13
|
-
import { applyChartDataSheetEdits, chartDataSheetCellEdit, chartDataSheetPasteEdits, chartSeriesEntries, chartGroupPaintsLine, chartTargetShape, chartFormatTargetKey, resolveChartGradient } from 'ooxml-core/chart';
|
|
13
|
+
import { applyChartDataSheetEdits, chartDataSheetCellEdit, chartDataSheetPasteEdits, chartSeriesEntries, chartGroupPaintsLine, chartTargetShape, chartSeriesSecondaryAxisSupported, chartTargetHasText, chartFormatTargetKey, chartDrawingColorFromHex, chartSeriesOnSecondaryAxis, chartSeriesMarkersSupported, chartSeriesAnalysisSupported, resolveChartGradient, chartTargetEffects, chartTargetTextFormatting, CHART_MARKER_SYMBOLS, chartPointsToEmu, chartEffectEditsFromAppearance, chartThreeDFromAppearance, chartDrawingGradientFrom, chartTargetThreeD } from 'ooxml-core/chart';
|
|
14
14
|
import { resolveDrawingColor } from 'ooxml-core/drawingml';
|
|
15
15
|
import { keyed } from 'lit/directives/keyed.js';
|
|
16
16
|
import { OFFICE_STANDARD_COLORS, normalizePaletteHex, buildThemePalette, hslToRgb, toHex, hexToRgbChannels, rgbToHsl } from 'ooxml-core/color';
|
|
@@ -363,9 +363,9 @@ function groupOf(radio, scope) {
|
|
|
363
363
|
(other) => other.name === name && other.form === radio.form
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
|
-
function labelText(
|
|
366
|
+
function labelText(label, self) {
|
|
367
367
|
let text2 = "";
|
|
368
|
-
for (const node of
|
|
368
|
+
for (const node of label.childNodes) {
|
|
369
369
|
if (node === self) continue;
|
|
370
370
|
if (node.nodeType === 3) text2 += node.textContent ?? "";
|
|
371
371
|
else if (node instanceof Element && !node.localName.includes("-") && !/^(select|input|textarea)$/u.test(node.localName))
|
|
@@ -446,8 +446,8 @@ var OfficeUiRadio = class extends OfficeElement {
|
|
|
446
446
|
syncName() {
|
|
447
447
|
if (this.hasAttribute("aria-labelledby")) return;
|
|
448
448
|
if (this.hasAttribute("aria-label") && !this.autoNamed) return;
|
|
449
|
-
const
|
|
450
|
-
const text2 =
|
|
449
|
+
const label = this.closest("label") ?? this.internals?.labels?.[0];
|
|
450
|
+
const text2 = label ? labelText(label, this).replace(/\s+/gu, " ").trim() : "";
|
|
451
451
|
if (text2) {
|
|
452
452
|
this.autoNamed = true;
|
|
453
453
|
this.setAttribute("aria-label", text2);
|
|
@@ -849,11 +849,11 @@ var OfficeUiBackstage = class extends OfficeElement {
|
|
|
849
849
|
>`;
|
|
850
850
|
}
|
|
851
851
|
render() {
|
|
852
|
-
const
|
|
852
|
+
const label = this.label ?? "File";
|
|
853
853
|
const back = this.backLabel ?? "Back";
|
|
854
854
|
return html`
|
|
855
|
-
<div class="frame" role="dialog" aria-modal="true" aria-label=${
|
|
856
|
-
<nav part="nav" aria-label=${
|
|
855
|
+
<div class="frame" role="dialog" aria-modal="true" aria-label=${label}>
|
|
856
|
+
<nav part="nav" aria-label=${label} @click=${this.onNavClick}>
|
|
857
857
|
<button
|
|
858
858
|
type="button"
|
|
859
859
|
class="back"
|
|
@@ -1510,13 +1510,13 @@ function fileField(field, ctx) {
|
|
|
1510
1510
|
><input type="file" accept=${field.accept} hidden @change=${pick}
|
|
1511
1511
|
/></div>`;
|
|
1512
1512
|
}
|
|
1513
|
-
function control(field, ctx,
|
|
1513
|
+
function control(field, ctx, label) {
|
|
1514
1514
|
const disabled = ctx.locked || Boolean(field.disabled);
|
|
1515
1515
|
const commit = (event) => ctx.change(field.id, readValue(field, event.currentTarget));
|
|
1516
1516
|
if (field.kind === "select") {
|
|
1517
1517
|
const tag = unsafeStatic(ctx.tags.select);
|
|
1518
1518
|
return html$1`<${tag}
|
|
1519
|
-
aria-label=${
|
|
1519
|
+
aria-label=${label}
|
|
1520
1520
|
data-value=${field.value}
|
|
1521
1521
|
?disabled=${disabled}
|
|
1522
1522
|
@change=${commit}
|
|
@@ -1532,32 +1532,32 @@ function control(field, ctx, label2) {
|
|
|
1532
1532
|
if (field.kind === "checkbox") {
|
|
1533
1533
|
const tag = unsafeStatic(ctx.tags.checkbox);
|
|
1534
1534
|
return html$1`<${tag}
|
|
1535
|
-
aria-label=${
|
|
1535
|
+
aria-label=${label}
|
|
1536
1536
|
.checked=${live(field.value)}
|
|
1537
1537
|
?disabled=${disabled}
|
|
1538
1538
|
@change=${commit}
|
|
1539
1539
|
></${tag}>`;
|
|
1540
1540
|
}
|
|
1541
|
-
const
|
|
1541
|
+
const number3 = field.kind === "number" ? field : void 0;
|
|
1542
1542
|
return html`<input
|
|
1543
|
-
type=${field.kind === "color" ? "color" :
|
|
1544
|
-
aria-label=${
|
|
1543
|
+
type=${field.kind === "color" ? "color" : number3 ? "number" : "text"}
|
|
1544
|
+
aria-label=${label}
|
|
1545
1545
|
data-value=${String(field.value)}
|
|
1546
|
-
min=${
|
|
1547
|
-
max=${
|
|
1548
|
-
step=${
|
|
1549
|
-
placeholder=${
|
|
1550
|
-
inputmode=${
|
|
1546
|
+
min=${number3?.min ?? nothing}
|
|
1547
|
+
max=${number3?.max ?? nothing}
|
|
1548
|
+
step=${number3 ? number3.step ?? "any" : nothing}
|
|
1549
|
+
placeholder=${number3?.auto ? ctx.autoLabel : nothing}
|
|
1550
|
+
inputmode=${number3 ? "decimal" : nothing}
|
|
1551
1551
|
?disabled=${disabled}
|
|
1552
1552
|
@change=${commit}
|
|
1553
1553
|
/>`;
|
|
1554
1554
|
}
|
|
1555
|
-
function slider(field, ctx,
|
|
1555
|
+
function slider(field, ctx, label) {
|
|
1556
1556
|
const value = field.value === "" ? field.min ?? 0 : field.value;
|
|
1557
1557
|
let last = value;
|
|
1558
1558
|
return html`<div class="slider" data-chart-format-slider=${field.id}
|
|
1559
1559
|
>${rangeControl({
|
|
1560
|
-
label
|
|
1560
|
+
label,
|
|
1561
1561
|
value,
|
|
1562
1562
|
valueText: `${value}${field.unit ?? ""}`,
|
|
1563
1563
|
min: field.min ?? 0,
|
|
@@ -1575,47 +1575,652 @@ function slider(field, ctx, label2) {
|
|
|
1575
1575
|
function fieldTemplate(field, ctx) {
|
|
1576
1576
|
if (field.kind === "radio") return radioGroup(field, ctx);
|
|
1577
1577
|
if (field.kind === "file") return fileField(field, ctx);
|
|
1578
|
-
const
|
|
1578
|
+
const label = ctx.tr(field.label);
|
|
1579
1579
|
const title = field.hint ? ctx.tr(field.hint) : nothing;
|
|
1580
1580
|
if (field.kind === "checkbox")
|
|
1581
1581
|
return html`<label
|
|
1582
1582
|
class="field field-checkbox"
|
|
1583
1583
|
data-chart-format-field=${field.id}
|
|
1584
1584
|
title=${title}
|
|
1585
|
-
>${control(field, ctx,
|
|
1585
|
+
>${control(field, ctx, label)}${caption(label)}</label
|
|
1586
1586
|
>`;
|
|
1587
1587
|
const unit = field.kind === "number" && field.unit ? html`<span class="unit">${field.unit}</span>` : nothing;
|
|
1588
1588
|
return html`<label
|
|
1589
1589
|
class="field field-${field.kind}"
|
|
1590
1590
|
data-chart-format-field=${field.id}
|
|
1591
1591
|
title=${title}
|
|
1592
|
-
>${caption(
|
|
1593
|
-
>${field.kind === "number" && field.slider ? slider(field, ctx,
|
|
1592
|
+
>${caption(label)}${control(field, ctx, label)}${unit}</label
|
|
1593
|
+
>${field.kind === "number" && field.slider ? slider(field, ctx, label) : nothing}`;
|
|
1594
1594
|
}
|
|
1595
1595
|
|
|
1596
|
-
// src/chart/format-pane-
|
|
1597
|
-
var
|
|
1596
|
+
// src/chart/format-pane-3d.ts
|
|
1597
|
+
var CHART_BEVEL_TYPES = [
|
|
1598
|
+
"circle",
|
|
1599
|
+
"relaxedInset",
|
|
1600
|
+
"cross",
|
|
1601
|
+
"coolSlant",
|
|
1602
|
+
"angle",
|
|
1603
|
+
"softRound",
|
|
1604
|
+
"convex",
|
|
1605
|
+
"slope",
|
|
1606
|
+
"divot",
|
|
1607
|
+
"riblet",
|
|
1608
|
+
"hardEdge",
|
|
1609
|
+
"artDeco"
|
|
1610
|
+
];
|
|
1611
|
+
var MATERIALS = [
|
|
1612
|
+
"warmMatte",
|
|
1613
|
+
"matte",
|
|
1614
|
+
"plastic",
|
|
1615
|
+
"metal",
|
|
1616
|
+
"dkEdge",
|
|
1617
|
+
"softEdge",
|
|
1618
|
+
"flat",
|
|
1619
|
+
"softmetal",
|
|
1620
|
+
"clear",
|
|
1621
|
+
"powder",
|
|
1622
|
+
"translucentPowder"
|
|
1623
|
+
];
|
|
1624
|
+
var LIGHTING = [
|
|
1625
|
+
["threePt", "Three Point"],
|
|
1626
|
+
["balanced", "Balanced"],
|
|
1627
|
+
["soft", "Soft"],
|
|
1628
|
+
["harsh", "Harsh"],
|
|
1629
|
+
["flood", "Flood"],
|
|
1630
|
+
["contrasting", "Contrasting"],
|
|
1631
|
+
["flat", "Flat"],
|
|
1632
|
+
["twoPt", "Two Point"],
|
|
1633
|
+
["brightRoom", "Bright Room"]
|
|
1634
|
+
];
|
|
1635
|
+
var bevelChoices = () => [
|
|
1636
|
+
{ value: "none", label: t("marker.none", "None") },
|
|
1637
|
+
...CHART_BEVEL_TYPES.map((type) => ({
|
|
1638
|
+
value: type,
|
|
1639
|
+
label: t(`bevel.${type}`, type)
|
|
1640
|
+
}))
|
|
1641
|
+
];
|
|
1642
|
+
var size = (id, key, fallback, value) => ({
|
|
1643
|
+
id,
|
|
1644
|
+
kind: "number",
|
|
1645
|
+
label: t(key, fallback),
|
|
1646
|
+
value: Math.round(value * 100) / 100,
|
|
1647
|
+
min: 0,
|
|
1648
|
+
max: 1584,
|
|
1649
|
+
step: 0.5,
|
|
1650
|
+
unit: "pt"
|
|
1651
|
+
});
|
|
1652
|
+
function bevelFields(which, bevel) {
|
|
1653
|
+
const fields = [
|
|
1654
|
+
{
|
|
1655
|
+
id: `threeD.bevel${which}`,
|
|
1656
|
+
kind: "select",
|
|
1657
|
+
label: which === "Top" ? t("bevelTop", "Top bevel") : t("bevelBottom", "Bottom bevel"),
|
|
1658
|
+
value: bevel?.type ?? "none",
|
|
1659
|
+
choices: bevelChoices()
|
|
1660
|
+
}
|
|
1661
|
+
];
|
|
1662
|
+
if (bevel) {
|
|
1663
|
+
fields.push(
|
|
1664
|
+
size(`threeD.bevel${which}Width`, "width", "Width", bevel.width),
|
|
1665
|
+
size(`threeD.bevel${which}Height`, "height", "Height", bevel.height)
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
return fields;
|
|
1669
|
+
}
|
|
1670
|
+
function threeDSection(threeD) {
|
|
1671
|
+
return {
|
|
1672
|
+
id: "threeD",
|
|
1673
|
+
title: t("section.threeD", "3-D Format"),
|
|
1674
|
+
fields: [
|
|
1675
|
+
...bevelFields("Top", threeD.bevelTop),
|
|
1676
|
+
...bevelFields("Bottom", threeD.bevelBottom),
|
|
1677
|
+
{
|
|
1678
|
+
id: "threeD.depthColor",
|
|
1679
|
+
kind: "color",
|
|
1680
|
+
label: t("depthColor", "Depth color"),
|
|
1681
|
+
value: hexForInput(threeD.depth?.color)
|
|
1682
|
+
},
|
|
1683
|
+
size("threeD.depthSize", "depthSize", "Depth size", threeD.depth?.size ?? 0),
|
|
1684
|
+
{
|
|
1685
|
+
id: "threeD.contourColor",
|
|
1686
|
+
kind: "color",
|
|
1687
|
+
label: t("contourColor", "Contour color"),
|
|
1688
|
+
value: hexForInput(threeD.contour?.color)
|
|
1689
|
+
},
|
|
1690
|
+
size("threeD.contourSize", "contourSize", "Contour size", threeD.contour?.size ?? 0),
|
|
1691
|
+
{
|
|
1692
|
+
id: "threeD.material",
|
|
1693
|
+
kind: "select",
|
|
1694
|
+
label: t("material", "Material"),
|
|
1695
|
+
value: threeD.material ?? "warmMatte",
|
|
1696
|
+
choices: MATERIALS.map((material) => ({
|
|
1697
|
+
value: material,
|
|
1698
|
+
label: t(`material.${material}`, material)
|
|
1699
|
+
}))
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
id: "threeD.lighting",
|
|
1703
|
+
kind: "select",
|
|
1704
|
+
label: t("lighting", "Lighting"),
|
|
1705
|
+
value: threeD.lighting ?? "threePt",
|
|
1706
|
+
choices: LIGHTING.map(([value, fallback]) => ({
|
|
1707
|
+
value,
|
|
1708
|
+
label: t(`lighting.${value}`, fallback)
|
|
1709
|
+
}))
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
note: t(
|
|
1713
|
+
"threeDSaveNote",
|
|
1714
|
+
"3-D settings are saved for Office; this preview does not reproduce every 3-D effect."
|
|
1715
|
+
)
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
// src/chart/format-pane-effects.ts
|
|
1720
|
+
var DEFAULT_CHART_SHADOW = {
|
|
1721
|
+
color: "#000000",
|
|
1722
|
+
transparency: 60,
|
|
1723
|
+
blur: 4,
|
|
1724
|
+
distance: 3,
|
|
1725
|
+
angle: 45
|
|
1726
|
+
};
|
|
1727
|
+
var DEFAULT_CHART_GLOW = { color: "#4472C4", transparency: 60, radius: 5 };
|
|
1728
|
+
var num = (id, key, fallback, value, max, unit, step2 = 1) => ({
|
|
1729
|
+
id,
|
|
1730
|
+
kind: "number",
|
|
1731
|
+
label: t(key, fallback),
|
|
1732
|
+
value: Math.round(value * 100) / 100,
|
|
1733
|
+
min: 0,
|
|
1734
|
+
max,
|
|
1735
|
+
step: step2,
|
|
1736
|
+
unit
|
|
1737
|
+
});
|
|
1738
|
+
function shadowSection(prefix, shadow) {
|
|
1739
|
+
const section = {
|
|
1740
|
+
id: `${prefix}shadow`,
|
|
1741
|
+
title: t("section.shadow", "Shadow"),
|
|
1742
|
+
fields: [
|
|
1743
|
+
{
|
|
1744
|
+
id: `${prefix}shadow.enabled`,
|
|
1745
|
+
kind: "checkbox",
|
|
1746
|
+
label: t("shadow.enabled", "Outer shadow"),
|
|
1747
|
+
value: Boolean(shadow)
|
|
1748
|
+
}
|
|
1749
|
+
]
|
|
1750
|
+
};
|
|
1751
|
+
if (shadow) {
|
|
1752
|
+
section.fields.push(
|
|
1753
|
+
{
|
|
1754
|
+
id: `${prefix}shadow.color`,
|
|
1755
|
+
kind: "color",
|
|
1756
|
+
label: t("color", "Color"),
|
|
1757
|
+
value: hexForInput(shadow.color)
|
|
1758
|
+
},
|
|
1759
|
+
num(
|
|
1760
|
+
`${prefix}shadow.transparency`,
|
|
1761
|
+
"transparency",
|
|
1762
|
+
"Transparency",
|
|
1763
|
+
shadow.transparency ?? 0,
|
|
1764
|
+
100,
|
|
1765
|
+
"%"
|
|
1766
|
+
),
|
|
1767
|
+
num(`${prefix}shadow.blur`, "blur", "Blur", shadow.blur, 100, "pt", 0.5),
|
|
1768
|
+
num(`${prefix}shadow.angle`, "angle", "Angle", shadow.angle, 359, "\xB0"),
|
|
1769
|
+
num(`${prefix}shadow.distance`, "distance", "Distance", shadow.distance, 200, "pt", 0.5)
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
return section;
|
|
1773
|
+
}
|
|
1774
|
+
function glowSection(prefix, glow) {
|
|
1775
|
+
const section = {
|
|
1776
|
+
id: `${prefix}glow`,
|
|
1777
|
+
title: t("section.glow", "Glow"),
|
|
1778
|
+
fields: [
|
|
1779
|
+
{
|
|
1780
|
+
id: `${prefix}glow.enabled`,
|
|
1781
|
+
kind: "checkbox",
|
|
1782
|
+
label: t("glow.enabled", "Glow"),
|
|
1783
|
+
value: Boolean(glow)
|
|
1784
|
+
}
|
|
1785
|
+
]
|
|
1786
|
+
};
|
|
1787
|
+
if (glow) {
|
|
1788
|
+
section.fields.push(
|
|
1789
|
+
{
|
|
1790
|
+
id: `${prefix}glow.color`,
|
|
1791
|
+
kind: "color",
|
|
1792
|
+
label: t("color", "Color"),
|
|
1793
|
+
value: hexForInput(glow.color)
|
|
1794
|
+
},
|
|
1795
|
+
num(`${prefix}glow.radius`, "size", "Size", glow.radius, 150, "pt", 0.5),
|
|
1796
|
+
num(
|
|
1797
|
+
`${prefix}glow.transparency`,
|
|
1798
|
+
"transparency",
|
|
1799
|
+
"Transparency",
|
|
1800
|
+
glow.transparency ?? 0,
|
|
1801
|
+
100,
|
|
1802
|
+
"%"
|
|
1803
|
+
)
|
|
1804
|
+
);
|
|
1805
|
+
}
|
|
1806
|
+
return section;
|
|
1807
|
+
}
|
|
1808
|
+
function effectsSections(view) {
|
|
1809
|
+
const effects = view.effects ?? {};
|
|
1810
|
+
return [
|
|
1811
|
+
shadowSection("", effects.shadow),
|
|
1812
|
+
glowSection("", effects.glow),
|
|
1813
|
+
{
|
|
1814
|
+
id: "softEdges",
|
|
1815
|
+
title: t("section.softEdges", "Soft Edges"),
|
|
1816
|
+
fields: [num("softEdge.size", "size", "Size", effects.softEdge ?? 0, 100, "pt", 0.5)]
|
|
1817
|
+
},
|
|
1818
|
+
...view.support.threeD && view.threeD ? [threeDSection(view.threeD)] : []
|
|
1819
|
+
];
|
|
1820
|
+
}
|
|
1821
|
+
var TYPES = [
|
|
1822
|
+
["linear", "Linear"],
|
|
1823
|
+
["exp", "Exponential"],
|
|
1824
|
+
["log", "Logarithmic"],
|
|
1825
|
+
["poly", "Polynomial"],
|
|
1826
|
+
["power", "Power"],
|
|
1827
|
+
["movingAvg", "Moving average"]
|
|
1828
|
+
];
|
|
1829
|
+
var ERRORS = [
|
|
1830
|
+
["fixedVal", "Fixed value"],
|
|
1831
|
+
["percentage", "Percentage"],
|
|
1832
|
+
["stdDev", "Standard deviation"],
|
|
1833
|
+
["stdErr", "Standard error"]
|
|
1834
|
+
];
|
|
1835
|
+
var number = (id, key, fallback, value, min, max, auto2 = false) => ({
|
|
1836
|
+
id,
|
|
1837
|
+
kind: "number",
|
|
1838
|
+
label: t(key, fallback),
|
|
1839
|
+
value,
|
|
1840
|
+
min,
|
|
1841
|
+
max,
|
|
1842
|
+
step: 1,
|
|
1843
|
+
...auto2 ? { auto: true } : {}
|
|
1844
|
+
});
|
|
1845
|
+
function chartAnalysisSections(series) {
|
|
1846
|
+
const sections = [];
|
|
1847
|
+
if (series.marker)
|
|
1848
|
+
sections.push({
|
|
1849
|
+
id: "markers",
|
|
1850
|
+
title: t("section.markers", "Markers"),
|
|
1851
|
+
fields: [
|
|
1852
|
+
{
|
|
1853
|
+
id: "marker.symbol",
|
|
1854
|
+
kind: "select",
|
|
1855
|
+
label: t("marker.symbol", "Marker"),
|
|
1856
|
+
value: series.marker.symbol ?? "auto",
|
|
1857
|
+
choices: CHART_MARKER_SYMBOLS.map((symbol) => choice(symbol, `marker.${symbol}`, symbol))
|
|
1858
|
+
},
|
|
1859
|
+
number("marker.size", "marker.size", "Marker size", series.marker.size ?? 5, 2, 72)
|
|
1860
|
+
]
|
|
1861
|
+
});
|
|
1862
|
+
const analysis = series.analysis;
|
|
1863
|
+
if (!analysis) return sections;
|
|
1864
|
+
const trend = analysis.trendline;
|
|
1865
|
+
const error = analysis.errorBars;
|
|
1866
|
+
const fields = [
|
|
1867
|
+
{
|
|
1868
|
+
id: "trendline.type",
|
|
1869
|
+
kind: "select",
|
|
1870
|
+
label: t("trendline.type", "Trendline"),
|
|
1871
|
+
value: trend?.trendlineType ?? "none",
|
|
1872
|
+
disabled: analysis.multipleTrendlines,
|
|
1873
|
+
choices: [
|
|
1874
|
+
choice("none", "marker.none", "None"),
|
|
1875
|
+
...TYPES.map(([value, label]) => choice(value, `trendline.${value}`, label))
|
|
1876
|
+
]
|
|
1877
|
+
}
|
|
1878
|
+
];
|
|
1879
|
+
if (trend && !analysis.multipleTrendlines) {
|
|
1880
|
+
if (trend.trendlineType === "poly")
|
|
1881
|
+
fields.push(
|
|
1882
|
+
number("trendline.order", "trendline.order", "Polynomial order", trend.order ?? 2, 2, 6)
|
|
1883
|
+
);
|
|
1884
|
+
if (trend.trendlineType === "movingAvg")
|
|
1885
|
+
fields.push(
|
|
1886
|
+
number("trendline.period", "trendline.period", "Period", trend.period ?? 2, 2, 1e5)
|
|
1887
|
+
);
|
|
1888
|
+
fields.push(
|
|
1889
|
+
number(
|
|
1890
|
+
"trendline.forward",
|
|
1891
|
+
"trendline.forward",
|
|
1892
|
+
"Forecast forward",
|
|
1893
|
+
trend.forward ?? 0,
|
|
1894
|
+
0,
|
|
1895
|
+
1e5
|
|
1896
|
+
),
|
|
1897
|
+
number(
|
|
1898
|
+
"trendline.backward",
|
|
1899
|
+
"trendline.backward",
|
|
1900
|
+
"Forecast backward",
|
|
1901
|
+
trend.backward ?? 0,
|
|
1902
|
+
0,
|
|
1903
|
+
1e5
|
|
1904
|
+
)
|
|
1905
|
+
);
|
|
1906
|
+
if (trend.trendlineType !== "movingAvg")
|
|
1907
|
+
fields.push(
|
|
1908
|
+
{
|
|
1909
|
+
id: "trendline.equation",
|
|
1910
|
+
kind: "checkbox",
|
|
1911
|
+
label: t("trendline.equation", "Display equation"),
|
|
1912
|
+
value: trend.displayEquation ?? false
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
id: "trendline.rSquared",
|
|
1916
|
+
kind: "checkbox",
|
|
1917
|
+
label: t("trendline.rSquared", "Display R-squared"),
|
|
1918
|
+
value: trend.displayRSquared ?? false
|
|
1919
|
+
}
|
|
1920
|
+
);
|
|
1921
|
+
}
|
|
1922
|
+
sections.push({
|
|
1923
|
+
id: "trendlines",
|
|
1924
|
+
title: t("section.trendlines", "Trendlines"),
|
|
1925
|
+
fields,
|
|
1926
|
+
...analysis.multipleTrendlines ? {
|
|
1927
|
+
note: t(
|
|
1928
|
+
"analysis.multipleTrendlines",
|
|
1929
|
+
"This series has multiple trendlines. Their settings are preserved."
|
|
1930
|
+
)
|
|
1931
|
+
} : {}
|
|
1932
|
+
});
|
|
1933
|
+
const errorFields = [
|
|
1934
|
+
{
|
|
1935
|
+
id: "errorBars.type",
|
|
1936
|
+
kind: "select",
|
|
1937
|
+
label: t("errorBars.amount", "Error amount"),
|
|
1938
|
+
value: error?.valueType ?? "none",
|
|
1939
|
+
disabled: analysis.multipleErrorBars,
|
|
1940
|
+
choices: [
|
|
1941
|
+
choice("none", "marker.none", "None"),
|
|
1942
|
+
...ERRORS.map(([value, label]) => choice(value, `errorBars.${value}`, label)),
|
|
1943
|
+
...error?.valueType === "cust" ? [choice("cust", "errorBars.custom", "Custom source")] : []
|
|
1944
|
+
]
|
|
1945
|
+
}
|
|
1946
|
+
];
|
|
1947
|
+
if (error && !analysis.multipleErrorBars) {
|
|
1948
|
+
errorFields.push(
|
|
1949
|
+
{
|
|
1950
|
+
id: "errorBars.side",
|
|
1951
|
+
kind: "select",
|
|
1952
|
+
label: t("errorBars.direction", "Error bar direction"),
|
|
1953
|
+
value: error.barType ?? "both",
|
|
1954
|
+
choices: [
|
|
1955
|
+
["both", "Both"],
|
|
1956
|
+
["plus", "Plus"],
|
|
1957
|
+
["minus", "Minus"]
|
|
1958
|
+
].map(([value, label]) => choice(value, `errorBars.${value}`, label))
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
id: "errorBars.cap",
|
|
1962
|
+
kind: "checkbox",
|
|
1963
|
+
label: t("errorBars.cap", "End caps"),
|
|
1964
|
+
value: !error.noEndCap
|
|
1965
|
+
}
|
|
1966
|
+
);
|
|
1967
|
+
if (error.valueType !== "cust" && error.valueType !== "stdErr")
|
|
1968
|
+
errorFields.push(
|
|
1969
|
+
number("errorBars.value", "errorBars.value", "Error value", error.value ?? 1, 0, 1e5)
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
sections.push({
|
|
1973
|
+
id: "errorBars",
|
|
1974
|
+
title: t("section.errorBars", "Error bars"),
|
|
1975
|
+
fields: errorFields,
|
|
1976
|
+
...analysis.multipleErrorBars ? {
|
|
1977
|
+
note: t(
|
|
1978
|
+
"analysis.multipleErrorBars",
|
|
1979
|
+
"Ambiguous error bars are preserved and cannot be edited here."
|
|
1980
|
+
)
|
|
1981
|
+
} : {}
|
|
1982
|
+
});
|
|
1983
|
+
return sections;
|
|
1984
|
+
}
|
|
1985
|
+
function chartAnalysisFieldIntent(series, target, field, value) {
|
|
1986
|
+
if (!/^(marker|trendline|errorBars)\./u.test(field)) return void 0;
|
|
1987
|
+
if (!series || target.kind !== "series") return null;
|
|
1988
|
+
const seriesIndex = target.seriesIndex;
|
|
1989
|
+
const text2 = String(value);
|
|
1990
|
+
const n = value === "" || typeof value === "boolean" ? NaN : Number(value);
|
|
1991
|
+
if (field.startsWith("marker.")) {
|
|
1992
|
+
if (!series.marker) return null;
|
|
1993
|
+
if (field === "marker.symbol")
|
|
1994
|
+
return CHART_MARKER_SYMBOLS.some((symbol) => symbol === text2) ? { op: "marker", seriesIndex, edit: { symbol: text2 } } : null;
|
|
1995
|
+
return field === "marker.size" && Number.isInteger(n) && n >= 2 && n <= 72 ? { op: "marker", seriesIndex, edit: { size: n } } : null;
|
|
1996
|
+
}
|
|
1997
|
+
const analysis = series.analysis;
|
|
1998
|
+
if (!analysis) return null;
|
|
1999
|
+
if (field.startsWith("trendline.")) {
|
|
2000
|
+
if (analysis.multipleTrendlines) return null;
|
|
2001
|
+
const wrap2 = (edit) => ({ op: "trendline", seriesIndex, index: 0, edit });
|
|
2002
|
+
if (field === "trendline.type")
|
|
2003
|
+
return text2 === "none" ? analysis.trendline ? wrap2(null) : null : TYPES.some(([type]) => type === text2) ? wrap2({ type: text2 }) : null;
|
|
2004
|
+
if (!analysis.trendline) return null;
|
|
2005
|
+
if (field === "trendline.equation") return wrap2({ displayEquation: Boolean(value) });
|
|
2006
|
+
if (field === "trendline.rSquared") return wrap2({ displayRSquared: Boolean(value) });
|
|
2007
|
+
const key = field.slice(10);
|
|
2008
|
+
if (!["order", "period", "forward", "backward"].includes(key) || !Number.isFinite(n) || n < 0)
|
|
2009
|
+
return null;
|
|
2010
|
+
return wrap2({ [key]: n });
|
|
2011
|
+
}
|
|
2012
|
+
if (analysis.multipleErrorBars) return null;
|
|
2013
|
+
const wrap = (edit) => ({
|
|
2014
|
+
op: "errorBars",
|
|
2015
|
+
seriesIndex,
|
|
2016
|
+
direction: "y",
|
|
2017
|
+
edit
|
|
2018
|
+
});
|
|
2019
|
+
if (field === "errorBars.type")
|
|
2020
|
+
return text2 === "none" ? analysis.errorBars ? wrap(null) : null : ERRORS.some(([type]) => type === text2) ? wrap({ valueType: text2 }) : null;
|
|
2021
|
+
if (!analysis.errorBars) return null;
|
|
2022
|
+
if (field === "errorBars.cap") return wrap({ noEndCap: !value });
|
|
2023
|
+
if (field === "errorBars.side")
|
|
2024
|
+
return ["both", "plus", "minus"].includes(text2) ? wrap({ barType: text2 }) : null;
|
|
2025
|
+
return field === "errorBars.value" && Number.isFinite(n) && n >= 0 ? wrap({ value: n }) : null;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// src/chart/format-pane-advanced-intent.ts
|
|
2029
|
+
var num2 = (value) => value === "" || typeof value === "boolean" || !Number.isFinite(Number(value)) ? null : Number(value);
|
|
2030
|
+
function effectIntent(view, target, field, value) {
|
|
2031
|
+
const text2 = field.startsWith("text.");
|
|
2032
|
+
const name = text2 ? field.slice(5) : field;
|
|
2033
|
+
const match = /^(shadow|glow)\.(enabled|color|transparency|blur|distance|angle|radius)$/u.exec(
|
|
2034
|
+
name
|
|
2035
|
+
);
|
|
2036
|
+
const wrap = (edit) => text2 ? { op: "text", target, edit: { effect: edit } } : { op: "effect", target, edit };
|
|
2037
|
+
if (name === "softEdge.size" && !text2) {
|
|
2038
|
+
const n2 = num2(value);
|
|
2039
|
+
return n2 === null || n2 < 0 || n2 > 100 ? null : wrap(
|
|
2040
|
+
n2 === 0 ? { kind: "softEdge", remove: true } : { kind: "softEdge", radiusEmu: chartPointsToEmu(n2) }
|
|
2041
|
+
);
|
|
2042
|
+
}
|
|
2043
|
+
if (!match) return void 0;
|
|
2044
|
+
const kind = match[1] === "shadow" ? "outerShadow" : "glow";
|
|
2045
|
+
const property = match[2];
|
|
2046
|
+
const effects = text2 ? view.text?.effects : view.effects;
|
|
2047
|
+
const current = match[1] === "shadow" ? effects?.shadow : effects?.glow;
|
|
2048
|
+
if (property === "enabled") {
|
|
2049
|
+
if (!value) return wrap({ kind, remove: true });
|
|
2050
|
+
return wrap(
|
|
2051
|
+
chartEffectEditsFromAppearance(
|
|
2052
|
+
kind === "outerShadow" ? { shadow: DEFAULT_CHART_SHADOW } : { glow: DEFAULT_CHART_GLOW }
|
|
2053
|
+
)[0]
|
|
2054
|
+
);
|
|
2055
|
+
}
|
|
2056
|
+
if (property === "color") {
|
|
2057
|
+
const color = chartDrawingColorFromHex(String(value), current?.transparency ?? 0);
|
|
2058
|
+
return color ? wrap(kind === "outerShadow" ? { kind, color } : { kind: "glow", color }) : null;
|
|
2059
|
+
}
|
|
2060
|
+
const n = num2(value);
|
|
2061
|
+
if (n === null || n < 0) return null;
|
|
2062
|
+
if (property === "transparency") return n <= 100 ? wrap({ kind, transparency: n }) : null;
|
|
2063
|
+
if (kind === "glow")
|
|
2064
|
+
return property === "radius" && n <= 150 ? wrap({ kind, radiusEmu: chartPointsToEmu(n) }) : null;
|
|
2065
|
+
if (property === "angle")
|
|
2066
|
+
return n <= 359 ? wrap({ kind, directionAngle: Math.round(n * 6e4) }) : null;
|
|
2067
|
+
if (property === "blur")
|
|
2068
|
+
return n <= 100 ? wrap({ kind, blurRadiusEmu: chartPointsToEmu(n) }) : null;
|
|
2069
|
+
return property === "distance" && n <= 200 ? wrap({ kind, distanceEmu: chartPointsToEmu(n) }) : null;
|
|
2070
|
+
}
|
|
2071
|
+
function threeDIntent(view, target, field, value) {
|
|
2072
|
+
const properties = view.threeD ?? {};
|
|
2073
|
+
const text2 = String(value);
|
|
2074
|
+
const n = num2(value);
|
|
2075
|
+
const bevel = /^threeD\.bevel(Top|Bottom)(Width|Height)?$/u.exec(field);
|
|
2076
|
+
if (bevel) {
|
|
2077
|
+
const key2 = bevel[1] === "Top" ? "bevelTop" : "bevelBottom";
|
|
2078
|
+
const current2 = properties[key2] ?? { type: "circle", width: 6, height: 6 };
|
|
2079
|
+
if (!bevel[2])
|
|
2080
|
+
return {
|
|
2081
|
+
op: "threeD",
|
|
2082
|
+
target,
|
|
2083
|
+
edit: chartThreeDFromAppearance({
|
|
2084
|
+
[key2]: text2 === "none" ? null : { ...current2, type: text2 }
|
|
2085
|
+
})
|
|
2086
|
+
};
|
|
2087
|
+
if (n === null || n < 0 || n > 1584) return null;
|
|
2088
|
+
return {
|
|
2089
|
+
op: "threeD",
|
|
2090
|
+
target,
|
|
2091
|
+
edit: chartThreeDFromAppearance({
|
|
2092
|
+
[key2]: { ...current2, [bevel[2] === "Width" ? "width" : "height"]: n }
|
|
2093
|
+
})
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
2096
|
+
if (field === "threeD.material" || field === "threeD.lighting")
|
|
2097
|
+
return {
|
|
2098
|
+
op: "threeD",
|
|
2099
|
+
target,
|
|
2100
|
+
edit: chartThreeDFromAppearance({
|
|
2101
|
+
[field === "threeD.material" ? "material" : "lighting"]: text2
|
|
2102
|
+
})
|
|
2103
|
+
};
|
|
2104
|
+
const size2 = /^threeD\.(depth|contour)(Color|Size)$/u.exec(field);
|
|
2105
|
+
if (!size2) return null;
|
|
2106
|
+
const key = size2[1] === "depth" ? "depth" : "contour";
|
|
2107
|
+
const current = properties[key] ?? { size: 0 };
|
|
2108
|
+
if (size2[2] === "Color")
|
|
2109
|
+
return chartDrawingColorFromHex(text2) ? {
|
|
2110
|
+
op: "threeD",
|
|
2111
|
+
target,
|
|
2112
|
+
edit: chartThreeDFromAppearance({ [key]: { ...current, color: text2 } })
|
|
2113
|
+
} : null;
|
|
2114
|
+
return n === null || n < 0 || n > 1584 ? null : { op: "threeD", target, edit: chartThreeDFromAppearance({ [key]: { ...current, size: n } }) };
|
|
2115
|
+
}
|
|
2116
|
+
function textIntent(view, target, field, value) {
|
|
2117
|
+
const text2 = String(value);
|
|
2118
|
+
const n = num2(value);
|
|
2119
|
+
const properties = view.text ?? {};
|
|
2120
|
+
const wrap = (edit) => ({ op: "text", target, edit });
|
|
2121
|
+
if (field === "text.rotation")
|
|
2122
|
+
return value === "" ? wrap({ rotation: null }) : n === null || n < -90 || n > 90 ? null : wrap({ rotation: n });
|
|
2123
|
+
if (field === "text.anchor")
|
|
2124
|
+
return ["t", "ctr", "b"].includes(text2) ? wrap({ anchor: text2 }) : null;
|
|
2125
|
+
if (field === "text.direction")
|
|
2126
|
+
return ["horz", "vert", "vert270", "wordArtVert"].includes(text2) ? wrap({ direction: text2 }) : null;
|
|
2127
|
+
if (field === "text.fill.transparency" || field === "text.outline.transparency")
|
|
2128
|
+
return n === null || n < 0 || n > 100 ? null : wrap(
|
|
2129
|
+
field === "text.fill.transparency" ? { fillTransparency: n } : { lineTransparency: n }
|
|
2130
|
+
);
|
|
2131
|
+
const fill3 = field.startsWith("text.fill.");
|
|
2132
|
+
const prefix = fill3 ? "text.fill." : "text.outline.";
|
|
2133
|
+
const key = field.slice(prefix.length);
|
|
2134
|
+
if (!field.startsWith(prefix)) return null;
|
|
2135
|
+
const current = fill3 ? properties.fill : properties.outline;
|
|
2136
|
+
if (key === "kind" && text2 === "automatic") return wrap(fill3 ? { fill: null } : { line: null });
|
|
2137
|
+
if (key === "kind" && text2 === "none")
|
|
2138
|
+
return wrap(fill3 ? { fill: { kind: "none" } } : { line: { fill: { kind: "none" } } });
|
|
2139
|
+
if (key === "color" || key === "kind" && text2 === "solid") {
|
|
2140
|
+
const color = chartDrawingColorFromHex(
|
|
2141
|
+
key === "color" ? text2 : current?.color ?? "#000000",
|
|
2142
|
+
current?.transparency ?? 0
|
|
2143
|
+
);
|
|
2144
|
+
return color ? wrap(
|
|
2145
|
+
fill3 ? { fill: { kind: "solid", color } } : { line: { fill: { kind: "solid", color } } }
|
|
2146
|
+
) : null;
|
|
2147
|
+
}
|
|
2148
|
+
if (fill3 && key === "kind" && text2 === "gradient") {
|
|
2149
|
+
const gradient = chartDrawingGradientFrom(
|
|
2150
|
+
properties.fill?.gradient ?? defaultPaneGradient(properties.fill?.color)
|
|
2151
|
+
);
|
|
2152
|
+
return gradient ? wrap({ fill: gradient }) : null;
|
|
2153
|
+
}
|
|
2154
|
+
if (fill3 && /^gradient(Type|Start|End|Angle)$/u.test(key)) {
|
|
2155
|
+
const gradient = gradientEdit(
|
|
2156
|
+
properties.fill?.gradient ?? defaultPaneGradient(properties.fill?.color),
|
|
2157
|
+
key.slice(8),
|
|
2158
|
+
value
|
|
2159
|
+
);
|
|
2160
|
+
const next = gradient && chartDrawingGradientFrom(gradient);
|
|
2161
|
+
return next ? wrap({ fill: next }) : null;
|
|
2162
|
+
}
|
|
2163
|
+
if (!fill3 && key === "width")
|
|
2164
|
+
return n === null || n < 0 || n > 1584 ? null : wrap({ line: { widthEmu: chartPointsToEmu(n) } });
|
|
2165
|
+
return null;
|
|
2166
|
+
}
|
|
2167
|
+
function chartAdvancedFieldIntent(view, target, field, value) {
|
|
2168
|
+
try {
|
|
2169
|
+
if (field.startsWith("text.") && !view.support.text) return null;
|
|
2170
|
+
if (field.startsWith("threeD.") && !view.support.threeD) return null;
|
|
2171
|
+
if (/^(shadow|glow|softEdge)\./u.test(field) && view.support.effects === false) return null;
|
|
2172
|
+
if ((field.startsWith("fill.pattern") || field === "fill.kind" && value === "pattern") && !view.support.pattern)
|
|
2173
|
+
return null;
|
|
2174
|
+
if (/^line\.(compound|join|beginArrow|endArrow)$/u.test(field) && view.support.lineDetails === false)
|
|
2175
|
+
return null;
|
|
2176
|
+
const analysis = chartAnalysisFieldIntent(view.series, target, field, value);
|
|
2177
|
+
if (analysis !== void 0) return analysis;
|
|
2178
|
+
const effect = effectIntent(view, target, field, value);
|
|
2179
|
+
if (effect !== void 0) return effect;
|
|
2180
|
+
if (field.startsWith("threeD.")) return threeDIntent(view, target, field, value);
|
|
2181
|
+
if (field.startsWith("text.")) return textIntent(view, target, field, value);
|
|
2182
|
+
if (field === "fill.kind" && value === "pattern") return { op: "pattern", target, edit: {} };
|
|
2183
|
+
if (field.startsWith("fill.pattern")) {
|
|
2184
|
+
const text2 = String(value);
|
|
2185
|
+
if (field === "fill.patternPreset")
|
|
2186
|
+
return /^[A-Za-z][A-Za-z0-9]*$/u.test(text2) ? { op: "pattern", target, edit: { preset: text2 } } : null;
|
|
2187
|
+
const color = chartDrawingColorFromHex(text2);
|
|
2188
|
+
if (!color) return null;
|
|
2189
|
+
if (field === "fill.patternForeground")
|
|
2190
|
+
return { op: "pattern", target, edit: { foreground: color } };
|
|
2191
|
+
if (field === "fill.patternBackground")
|
|
2192
|
+
return { op: "pattern", target, edit: { background: color } };
|
|
2193
|
+
return null;
|
|
2194
|
+
}
|
|
2195
|
+
if (field === "line.width" && value === "")
|
|
2196
|
+
return { op: "lineOptions", target, edit: { widthEmu: null } };
|
|
2197
|
+
if (field === "line.compound")
|
|
2198
|
+
return ["sng", "dbl", "thickThin", "thinThick", "tri"].includes(String(value)) ? { op: "lineOptions", target, edit: { compound: String(value) } } : null;
|
|
2199
|
+
if (field === "line.join")
|
|
2200
|
+
return ["round", "bevel", "miter"].includes(String(value)) ? { op: "lineOptions", target, edit: { join: { kind: String(value) } } } : null;
|
|
2201
|
+
if (field === "line.beginArrow" || field === "line.endArrow")
|
|
2202
|
+
return ["none", "arrow", "triangle", "stealth", "diamond", "oval"].includes(String(value)) ? {
|
|
2203
|
+
op: "lineOptions",
|
|
2204
|
+
target,
|
|
2205
|
+
edit: field === "line.beginArrow" ? { headEnd: { type: String(value) } } : { tailEnd: { type: String(value) } }
|
|
2206
|
+
} : null;
|
|
2207
|
+
if (field === "series.axis")
|
|
2208
|
+
return target.kind === "series" && view.support.secondaryAxis && ["primary", "secondary"].includes(String(value)) ? { op: "secondaryAxis", seriesIndex: target.seriesIndex, secondary: value === "secondary" } : null;
|
|
2209
|
+
return void 0;
|
|
2210
|
+
} catch {
|
|
2211
|
+
return null;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
var number2 = (value) => {
|
|
1598
2215
|
if (value === "" || typeof value === "boolean") return null;
|
|
1599
2216
|
const n = typeof value === "number" ? value : Number(value);
|
|
1600
2217
|
return Number.isFinite(n) ? n : null;
|
|
1601
2218
|
};
|
|
1602
|
-
function drawingColorFromHex(hex,
|
|
1603
|
-
|
|
1604
|
-
if (!value) return null;
|
|
1605
|
-
const alpha = Math.round((100 - Math.min(100, Math.max(0, transparency3))) * 1e3);
|
|
1606
|
-
return {
|
|
1607
|
-
kind: "srgb",
|
|
1608
|
-
value: value.toUpperCase(),
|
|
1609
|
-
transforms: alpha < 1e5 ? [{ name: "alpha", value: String(alpha) }] : []
|
|
1610
|
-
};
|
|
2219
|
+
function drawingColorFromHex(hex, transparency4 = 0) {
|
|
2220
|
+
return chartDrawingColorFromHex(hex, transparency4);
|
|
1611
2221
|
}
|
|
1612
2222
|
function drawingGradientFrom(gradient) {
|
|
1613
|
-
|
|
1614
|
-
const color = drawingColorFromHex(stop.color, 100 - (stop.opacity ?? 1) * 100);
|
|
1615
|
-
return color ? [{ position: stop.position, color }] : [];
|
|
1616
|
-
});
|
|
1617
|
-
if (stops.length < 2) return null;
|
|
1618
|
-
return gradient.type === "radial" ? { kind: "gradient", stops, path: gradient.path ?? "circle" } : { kind: "gradient", stops, angle: gradient.angle ?? 0, scaled: gradient.scaled ?? false };
|
|
2223
|
+
return chartDrawingGradientFrom(gradient);
|
|
1619
2224
|
}
|
|
1620
2225
|
function defaultPaneGradient(color = "#4472C4") {
|
|
1621
2226
|
return {
|
|
@@ -1641,13 +2246,13 @@ function gradientEdit(current, part, value) {
|
|
|
1641
2246
|
return { ...current, stops };
|
|
1642
2247
|
}
|
|
1643
2248
|
default: {
|
|
1644
|
-
const n =
|
|
2249
|
+
const n = number2(value);
|
|
1645
2250
|
return n === null ? null : { ...current, stops, angle: (n % 360 + 360) % 360 };
|
|
1646
2251
|
}
|
|
1647
2252
|
}
|
|
1648
2253
|
}
|
|
1649
2254
|
function paintIntent(view, target, field, value) {
|
|
1650
|
-
const n =
|
|
2255
|
+
const n = number2(value);
|
|
1651
2256
|
const text2 = String(value);
|
|
1652
2257
|
const gradient = GRADIENT.exec(field);
|
|
1653
2258
|
if (gradient) {
|
|
@@ -1736,9 +2341,19 @@ var one = (key, value) => {
|
|
|
1736
2341
|
return edit;
|
|
1737
2342
|
};
|
|
1738
2343
|
function axisEdit(field, value) {
|
|
1739
|
-
const n =
|
|
2344
|
+
const n = number2(value);
|
|
1740
2345
|
const text2 = String(value);
|
|
1741
2346
|
switch (field) {
|
|
2347
|
+
case "axis.title":
|
|
2348
|
+
return { title: text2 };
|
|
2349
|
+
case "axis.numberFormatSourceLinked":
|
|
2350
|
+
return { numberFormatSourceLinked: Boolean(value) };
|
|
2351
|
+
case "axis.baseTimeUnit":
|
|
2352
|
+
case "axis.majorTimeUnit":
|
|
2353
|
+
case "axis.minorTimeUnit": {
|
|
2354
|
+
const key = field.slice(5);
|
|
2355
|
+
return text2 === "" ? { [key]: null } : ["days", "months", "years"].includes(text2) ? { [key]: text2 } : null;
|
|
2356
|
+
}
|
|
1742
2357
|
case "axis.min":
|
|
1743
2358
|
case "axis.max": {
|
|
1744
2359
|
const key = field === "axis.min" ? "min" : "max";
|
|
@@ -1787,6 +2402,8 @@ var SPACING = {
|
|
|
1787
2402
|
"series.holeSize": ["holeSize", 10, 90]
|
|
1788
2403
|
};
|
|
1789
2404
|
function chartFormatFieldIntent(view, target, field, value) {
|
|
2405
|
+
const advanced = chartAdvancedFieldIntent(view, target, field, value);
|
|
2406
|
+
if (advanced !== void 0) return advanced;
|
|
1790
2407
|
if (field.startsWith("fill.") || field.startsWith("line."))
|
|
1791
2408
|
return paintIntent(view, target, field, value);
|
|
1792
2409
|
if (field.startsWith("axis.")) {
|
|
@@ -1810,7 +2427,7 @@ function chartFormatFieldIntent(view, target, field, value) {
|
|
|
1810
2427
|
}
|
|
1811
2428
|
const spacing = SPACING[field];
|
|
1812
2429
|
if (spacing && target.kind === "series") {
|
|
1813
|
-
const n =
|
|
2430
|
+
const n = number2(value);
|
|
1814
2431
|
const [key, min, max] = spacing;
|
|
1815
2432
|
if (n === null || !Number.isInteger(n) || n < min || n > max) return null;
|
|
1816
2433
|
const edit = {};
|
|
@@ -1820,225 +2437,6 @@ function chartFormatFieldIntent(view, target, field, value) {
|
|
|
1820
2437
|
return null;
|
|
1821
2438
|
}
|
|
1822
2439
|
|
|
1823
|
-
// src/chart/format-pane-3d.ts
|
|
1824
|
-
var CHART_BEVEL_TYPES = [
|
|
1825
|
-
"circle",
|
|
1826
|
-
"relaxedInset",
|
|
1827
|
-
"cross",
|
|
1828
|
-
"coolSlant",
|
|
1829
|
-
"angle",
|
|
1830
|
-
"softRound",
|
|
1831
|
-
"convex",
|
|
1832
|
-
"slope",
|
|
1833
|
-
"divot",
|
|
1834
|
-
"riblet",
|
|
1835
|
-
"hardEdge",
|
|
1836
|
-
"artDeco"
|
|
1837
|
-
];
|
|
1838
|
-
var MATERIALS = [
|
|
1839
|
-
"warmMatte",
|
|
1840
|
-
"matte",
|
|
1841
|
-
"plastic",
|
|
1842
|
-
"metal",
|
|
1843
|
-
"dkEdge",
|
|
1844
|
-
"softEdge",
|
|
1845
|
-
"flat",
|
|
1846
|
-
"softmetal",
|
|
1847
|
-
"clear",
|
|
1848
|
-
"powder",
|
|
1849
|
-
"translucentPowder"
|
|
1850
|
-
];
|
|
1851
|
-
var LIGHTING = [
|
|
1852
|
-
["threePt", "Three Point"],
|
|
1853
|
-
["balanced", "Balanced"],
|
|
1854
|
-
["soft", "Soft"],
|
|
1855
|
-
["harsh", "Harsh"],
|
|
1856
|
-
["flood", "Flood"],
|
|
1857
|
-
["contrasting", "Contrasting"],
|
|
1858
|
-
["flat", "Flat"],
|
|
1859
|
-
["twoPt", "Two Point"],
|
|
1860
|
-
["brightRoom", "Bright Room"]
|
|
1861
|
-
];
|
|
1862
|
-
var label = (key, fallback) => ({ key, fallback });
|
|
1863
|
-
var bevelChoices = () => [
|
|
1864
|
-
{ value: "none", label: label("pptx.bevelTypes.none", "None") },
|
|
1865
|
-
...CHART_BEVEL_TYPES.map((type) => ({
|
|
1866
|
-
value: type,
|
|
1867
|
-
label: label(`pptx.bevelTypes.${type}`, type)
|
|
1868
|
-
}))
|
|
1869
|
-
];
|
|
1870
|
-
var size = (id, key, fallback, value) => ({
|
|
1871
|
-
id,
|
|
1872
|
-
kind: "number",
|
|
1873
|
-
label: t(key, fallback),
|
|
1874
|
-
value: Math.round(value * 100) / 100,
|
|
1875
|
-
min: 0,
|
|
1876
|
-
max: 1584,
|
|
1877
|
-
step: 0.5,
|
|
1878
|
-
unit: "pt"
|
|
1879
|
-
});
|
|
1880
|
-
function bevelFields(which, bevel) {
|
|
1881
|
-
const fields = [
|
|
1882
|
-
{
|
|
1883
|
-
id: `threeD.bevel${which}`,
|
|
1884
|
-
kind: "select",
|
|
1885
|
-
label: which === "Top" ? t("bevelTop", "Top bevel") : t("bevelBottom", "Bottom bevel"),
|
|
1886
|
-
value: bevel?.type ?? "none",
|
|
1887
|
-
choices: bevelChoices()
|
|
1888
|
-
}
|
|
1889
|
-
];
|
|
1890
|
-
if (bevel) {
|
|
1891
|
-
fields.push(
|
|
1892
|
-
size(`threeD.bevel${which}Width`, "width", "Width", bevel.width),
|
|
1893
|
-
size(`threeD.bevel${which}Height`, "height", "Height", bevel.height)
|
|
1894
|
-
);
|
|
1895
|
-
}
|
|
1896
|
-
return fields;
|
|
1897
|
-
}
|
|
1898
|
-
function threeDSection(threeD) {
|
|
1899
|
-
return {
|
|
1900
|
-
id: "threeD",
|
|
1901
|
-
title: t("section.threeD", "3-D Format"),
|
|
1902
|
-
fields: [
|
|
1903
|
-
...bevelFields("Top", threeD.bevelTop),
|
|
1904
|
-
...bevelFields("Bottom", threeD.bevelBottom),
|
|
1905
|
-
{
|
|
1906
|
-
id: "threeD.depthColor",
|
|
1907
|
-
kind: "color",
|
|
1908
|
-
label: t("depthColor", "Depth color"),
|
|
1909
|
-
value: hexForInput(threeD.depth?.color)
|
|
1910
|
-
},
|
|
1911
|
-
size("threeD.depthSize", "depthSize", "Depth size", threeD.depth?.size ?? 0),
|
|
1912
|
-
{
|
|
1913
|
-
id: "threeD.contourColor",
|
|
1914
|
-
kind: "color",
|
|
1915
|
-
label: t("contourColor", "Contour color"),
|
|
1916
|
-
value: hexForInput(threeD.contour?.color)
|
|
1917
|
-
},
|
|
1918
|
-
size("threeD.contourSize", "contourSize", "Contour size", threeD.contour?.size ?? 0),
|
|
1919
|
-
{
|
|
1920
|
-
id: "threeD.material",
|
|
1921
|
-
kind: "select",
|
|
1922
|
-
label: t("material", "Material"),
|
|
1923
|
-
value: threeD.material ?? "warmMatte",
|
|
1924
|
-
choices: MATERIALS.map((material) => ({
|
|
1925
|
-
value: material,
|
|
1926
|
-
label: label(`pptx.material.${material}`, material)
|
|
1927
|
-
}))
|
|
1928
|
-
},
|
|
1929
|
-
{
|
|
1930
|
-
id: "threeD.lighting",
|
|
1931
|
-
kind: "select",
|
|
1932
|
-
label: t("lighting", "Lighting"),
|
|
1933
|
-
value: threeD.lighting ?? "threePt",
|
|
1934
|
-
choices: LIGHTING.map(([value, fallback]) => ({
|
|
1935
|
-
value,
|
|
1936
|
-
label: t(`lighting.${value}`, fallback)
|
|
1937
|
-
}))
|
|
1938
|
-
}
|
|
1939
|
-
],
|
|
1940
|
-
note: t(
|
|
1941
|
-
"threeDNote",
|
|
1942
|
-
"Bevels and material are drawn as shading on the slide; depth, contour and lighting are saved for PowerPoint and drawn approximately."
|
|
1943
|
-
)
|
|
1944
|
-
};
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
// src/chart/format-pane-effects.ts
|
|
1948
|
-
var num = (id, key, fallback, value, max, unit, step2 = 1) => ({
|
|
1949
|
-
id,
|
|
1950
|
-
kind: "number",
|
|
1951
|
-
label: t(key, fallback),
|
|
1952
|
-
value: Math.round(value * 100) / 100,
|
|
1953
|
-
min: 0,
|
|
1954
|
-
max,
|
|
1955
|
-
step: step2,
|
|
1956
|
-
unit
|
|
1957
|
-
});
|
|
1958
|
-
function shadowSection(prefix, shadow) {
|
|
1959
|
-
const section = {
|
|
1960
|
-
id: `${prefix}shadow`,
|
|
1961
|
-
title: t("section.shadow", "Shadow"),
|
|
1962
|
-
fields: [
|
|
1963
|
-
{
|
|
1964
|
-
id: `${prefix}shadow.enabled`,
|
|
1965
|
-
kind: "checkbox",
|
|
1966
|
-
label: t("shadow.enabled", "Outer shadow"),
|
|
1967
|
-
value: Boolean(shadow)
|
|
1968
|
-
}
|
|
1969
|
-
]
|
|
1970
|
-
};
|
|
1971
|
-
if (shadow) {
|
|
1972
|
-
section.fields.push(
|
|
1973
|
-
{
|
|
1974
|
-
id: `${prefix}shadow.color`,
|
|
1975
|
-
kind: "color",
|
|
1976
|
-
label: t("color", "Color"),
|
|
1977
|
-
value: hexForInput(shadow.color)
|
|
1978
|
-
},
|
|
1979
|
-
num(
|
|
1980
|
-
`${prefix}shadow.transparency`,
|
|
1981
|
-
"transparency",
|
|
1982
|
-
"Transparency",
|
|
1983
|
-
shadow.transparency ?? 0,
|
|
1984
|
-
100,
|
|
1985
|
-
"%"
|
|
1986
|
-
),
|
|
1987
|
-
num(`${prefix}shadow.blur`, "blur", "Blur", shadow.blur, 100, "pt", 0.5),
|
|
1988
|
-
num(`${prefix}shadow.angle`, "angle", "Angle", shadow.angle, 359, "\xB0"),
|
|
1989
|
-
num(`${prefix}shadow.distance`, "distance", "Distance", shadow.distance, 200, "pt", 0.5)
|
|
1990
|
-
);
|
|
1991
|
-
}
|
|
1992
|
-
return section;
|
|
1993
|
-
}
|
|
1994
|
-
function glowSection(prefix, glow) {
|
|
1995
|
-
const section = {
|
|
1996
|
-
id: `${prefix}glow`,
|
|
1997
|
-
title: t("section.glow", "Glow"),
|
|
1998
|
-
fields: [
|
|
1999
|
-
{
|
|
2000
|
-
id: `${prefix}glow.enabled`,
|
|
2001
|
-
kind: "checkbox",
|
|
2002
|
-
label: t("glow.enabled", "Glow"),
|
|
2003
|
-
value: Boolean(glow)
|
|
2004
|
-
}
|
|
2005
|
-
]
|
|
2006
|
-
};
|
|
2007
|
-
if (glow) {
|
|
2008
|
-
section.fields.push(
|
|
2009
|
-
{
|
|
2010
|
-
id: `${prefix}glow.color`,
|
|
2011
|
-
kind: "color",
|
|
2012
|
-
label: t("color", "Color"),
|
|
2013
|
-
value: hexForInput(glow.color)
|
|
2014
|
-
},
|
|
2015
|
-
num(`${prefix}glow.radius`, "size", "Size", glow.radius, 150, "pt", 0.5),
|
|
2016
|
-
num(
|
|
2017
|
-
`${prefix}glow.transparency`,
|
|
2018
|
-
"transparency",
|
|
2019
|
-
"Transparency",
|
|
2020
|
-
glow.transparency ?? 0,
|
|
2021
|
-
100,
|
|
2022
|
-
"%"
|
|
2023
|
-
)
|
|
2024
|
-
);
|
|
2025
|
-
}
|
|
2026
|
-
return section;
|
|
2027
|
-
}
|
|
2028
|
-
function effectsSections(view) {
|
|
2029
|
-
const effects = view.effects ?? {};
|
|
2030
|
-
return [
|
|
2031
|
-
shadowSection("", effects.shadow),
|
|
2032
|
-
glowSection("", effects.glow),
|
|
2033
|
-
{
|
|
2034
|
-
id: "softEdges",
|
|
2035
|
-
title: t("section.softEdges", "Soft Edges"),
|
|
2036
|
-
fields: [num("softEdge.size", "size", "Size", effects.softEdge ?? 0, 100, "pt", 0.5)]
|
|
2037
|
-
},
|
|
2038
|
-
...view.support.threeD && view.threeD ? [threeDSection(view.threeD)] : []
|
|
2039
|
-
];
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
2440
|
// src/chart/format-pane-fill-kinds.ts
|
|
2043
2441
|
function gradientFields(prefix, gradient) {
|
|
2044
2442
|
const stops = gradient.stops;
|
|
@@ -2173,7 +2571,7 @@ var ARROWS = [
|
|
|
2173
2571
|
["diamond", "Diamond Arrow"],
|
|
2174
2572
|
["oval", "Oval Arrow"]
|
|
2175
2573
|
];
|
|
2176
|
-
var choices = (prefix, list) => list.map(([value,
|
|
2574
|
+
var choices = (prefix, list) => list.map(([value, label]) => choice(value, `${prefix}.${value}`, label));
|
|
2177
2575
|
function fillSection(view, source) {
|
|
2178
2576
|
if (!view.support.fill) {
|
|
2179
2577
|
return void 0;
|
|
@@ -2366,10 +2764,35 @@ var TICKS = [
|
|
|
2366
2764
|
["out", "Outside"],
|
|
2367
2765
|
["cross", "Cross"]
|
|
2368
2766
|
];
|
|
2369
|
-
var tickChoices = () => TICKS.map(([value,
|
|
2767
|
+
var tickChoices = () => TICKS.map(([value, label]) => choice(value, `tick.${value}`, label));
|
|
2370
2768
|
function axisOptions(axis) {
|
|
2371
2769
|
const value = axis.kind === "val" || axis.kind === "date";
|
|
2372
2770
|
const fields = [];
|
|
2771
|
+
if (axis.title !== void 0)
|
|
2772
|
+
fields.push({
|
|
2773
|
+
id: "axis.title",
|
|
2774
|
+
kind: "text",
|
|
2775
|
+
label: t("axis.title", "Axis title"),
|
|
2776
|
+
value: axis.title
|
|
2777
|
+
});
|
|
2778
|
+
if (axis.timeUnitsEditable)
|
|
2779
|
+
for (const [key, fallback] of [
|
|
2780
|
+
["baseTimeUnit", "Base unit"],
|
|
2781
|
+
["majorTimeUnit", "Major time unit"],
|
|
2782
|
+
["minorTimeUnit", "Minor time unit"]
|
|
2783
|
+
])
|
|
2784
|
+
fields.push({
|
|
2785
|
+
id: `axis.${key}`,
|
|
2786
|
+
kind: "select",
|
|
2787
|
+
label: t(`axis.${key}`, fallback),
|
|
2788
|
+
value: axis[key] ?? "",
|
|
2789
|
+
choices: [
|
|
2790
|
+
choice("", "automatic", "Auto"),
|
|
2791
|
+
choice("days", "axis.days", "Days"),
|
|
2792
|
+
choice("months", "axis.months", "Months"),
|
|
2793
|
+
choice("years", "axis.years", "Years")
|
|
2794
|
+
]
|
|
2795
|
+
});
|
|
2373
2796
|
if (value) {
|
|
2374
2797
|
fields.push(
|
|
2375
2798
|
auto("axis.min", "minimum", "Minimum", axis.min),
|
|
@@ -2493,7 +2916,15 @@ function axisOptions(axis) {
|
|
|
2493
2916
|
kind: "text",
|
|
2494
2917
|
label: t("formatCode", "Format Code"),
|
|
2495
2918
|
value: axis.numberFormat ?? ""
|
|
2496
|
-
}
|
|
2919
|
+
},
|
|
2920
|
+
...axis.numberFormatSourceLinked === void 0 ? [] : [
|
|
2921
|
+
{
|
|
2922
|
+
id: "axis.numberFormatSourceLinked",
|
|
2923
|
+
kind: "checkbox",
|
|
2924
|
+
label: t("axis.linkedFormat", "Linked to source"),
|
|
2925
|
+
value: axis.numberFormatSourceLinked
|
|
2926
|
+
}
|
|
2927
|
+
]
|
|
2497
2928
|
]
|
|
2498
2929
|
}
|
|
2499
2930
|
];
|
|
@@ -2683,7 +3114,7 @@ function optionsSections(source, target) {
|
|
|
2683
3114
|
switch (target.kind) {
|
|
2684
3115
|
case "series": {
|
|
2685
3116
|
const view = source.seriesOptions?.(target.seriesIndex);
|
|
2686
|
-
return view && seriesOptions(view);
|
|
3117
|
+
return view && [...seriesOptions(view), ...chartAnalysisSections(view)];
|
|
2687
3118
|
}
|
|
2688
3119
|
case "axis": {
|
|
2689
3120
|
const view = source.axisOptions?.(target.axisIndex);
|
|
@@ -2983,18 +3414,125 @@ function buildChartFormatModel(source, targetKey, tab = "fillLine", mode = "char
|
|
|
2983
3414
|
};
|
|
2984
3415
|
}
|
|
2985
3416
|
var transparency2 = (alpha) => Math.round((1 - alpha) * 100);
|
|
3417
|
+
var chartGroupFormatType = (group) => group.element.replace(/Chart$/u, "");
|
|
3418
|
+
function chartSeriesOptionsView(space, entry, seriesIndex, advanced) {
|
|
3419
|
+
const group = entry?.group;
|
|
3420
|
+
if (!entry || !group) return void 0;
|
|
3421
|
+
const view = { chartType: chartGroupFormatType(group) };
|
|
3422
|
+
for (const key of ["overlap", "gapWidth", "firstSliceAngle", "holeSize"])
|
|
3423
|
+
if (group[key] !== void 0) view[key] = group[key];
|
|
3424
|
+
if (advanced && chartSeriesSecondaryAxisSupported(space, seriesIndex))
|
|
3425
|
+
view.secondaryAxis = chartSeriesOnSecondaryAxis(space, seriesIndex);
|
|
3426
|
+
if (advanced && chartSeriesMarkersSupported(space, seriesIndex))
|
|
3427
|
+
view.marker = { ...entry.series.marker };
|
|
3428
|
+
if (advanced && chartSeriesAnalysisSupported(space, seriesIndex)) {
|
|
3429
|
+
const trends = entry.series.trendlines ?? [];
|
|
3430
|
+
const errors = (entry.series.errorBars ?? []).filter(
|
|
3431
|
+
(error) => (error.direction ?? "y") === "y"
|
|
3432
|
+
);
|
|
3433
|
+
view.analysis = {
|
|
3434
|
+
multipleTrendlines: trends.length > 1,
|
|
3435
|
+
multipleErrorBars: errors.length > 1,
|
|
3436
|
+
...trends[0] ? { trendline: structuredClone(trends[0]) } : {},
|
|
3437
|
+
...errors[0] ? { errorBars: structuredClone(errors[0]) } : {}
|
|
3438
|
+
};
|
|
3439
|
+
}
|
|
3440
|
+
return view;
|
|
3441
|
+
}
|
|
3442
|
+
function chartEffectsView(list, resolve) {
|
|
3443
|
+
const view = { shadow: null, glow: null, softEdge: 0 };
|
|
3444
|
+
for (const effect of list?.effects ?? []) {
|
|
3445
|
+
if (effect.kind === "outerShadow") {
|
|
3446
|
+
const color = effect.color && resolve(effect.color);
|
|
3447
|
+
view.shadow = {
|
|
3448
|
+
color: color?.hex ?? "#000000",
|
|
3449
|
+
transparency: transparency2(color?.alpha ?? 1),
|
|
3450
|
+
blur: (effect.blurRadiusEmu ?? 0) / 12700,
|
|
3451
|
+
distance: (effect.distanceEmu ?? 0) / 12700,
|
|
3452
|
+
angle: (effect.directionAngle ?? 0) / 6e4
|
|
3453
|
+
};
|
|
3454
|
+
} else if (effect.kind === "glow") {
|
|
3455
|
+
const color = effect.color && resolve(effect.color);
|
|
3456
|
+
view.glow = {
|
|
3457
|
+
color: color?.hex ?? "#4472C4",
|
|
3458
|
+
transparency: transparency2(color?.alpha ?? 1),
|
|
3459
|
+
radius: (effect.radiusEmu ?? 0) / 12700
|
|
3460
|
+
};
|
|
3461
|
+
} else if (effect.kind === "softEdge") view.softEdge = (effect.radiusEmu ?? 0) / 12700;
|
|
3462
|
+
}
|
|
3463
|
+
return view;
|
|
3464
|
+
}
|
|
3465
|
+
function chartThreeDView(space, target, resolve) {
|
|
3466
|
+
const properties = chartTargetThreeD(space, target);
|
|
3467
|
+
const color = (value) => value ? resolve(value)?.hex : void 0;
|
|
3468
|
+
const view = {};
|
|
3469
|
+
if (properties.bevelTop)
|
|
3470
|
+
view.bevelTop = {
|
|
3471
|
+
type: properties.bevelTop.preset,
|
|
3472
|
+
width: properties.bevelTop.widthEmu / 12700,
|
|
3473
|
+
height: properties.bevelTop.heightEmu / 12700
|
|
3474
|
+
};
|
|
3475
|
+
if (properties.bevelBottom)
|
|
3476
|
+
view.bevelBottom = {
|
|
3477
|
+
type: properties.bevelBottom.preset,
|
|
3478
|
+
width: properties.bevelBottom.widthEmu / 12700,
|
|
3479
|
+
height: properties.bevelBottom.heightEmu / 12700
|
|
3480
|
+
};
|
|
3481
|
+
const depth = color(properties.depthColor);
|
|
3482
|
+
const contour = color(properties.contourColor);
|
|
3483
|
+
view.depth = { size: (properties.depthEmu ?? 0) / 12700, ...depth ? { color: depth } : {} };
|
|
3484
|
+
view.contour = {
|
|
3485
|
+
size: (properties.contourWidthEmu ?? 0) / 12700,
|
|
3486
|
+
...contour ? { color: contour } : {}
|
|
3487
|
+
};
|
|
3488
|
+
if (properties.material !== void 0) view.material = properties.material;
|
|
3489
|
+
if (properties.lighting !== void 0) view.lighting = properties.lighting;
|
|
3490
|
+
return view;
|
|
3491
|
+
}
|
|
3492
|
+
function chartAdvancedElementView(space, target, resolve, fillView2, lineView2, threeD) {
|
|
3493
|
+
const result = {
|
|
3494
|
+
effects: chartEffectsView(chartTargetEffects(space, target), resolve)
|
|
3495
|
+
};
|
|
3496
|
+
if (threeD) result.threeD = chartThreeDView(space, target, resolve);
|
|
3497
|
+
if (chartTargetHasText(target)) {
|
|
3498
|
+
const properties = chartTargetTextFormatting(space, target);
|
|
3499
|
+
const fill3 = fillView2(properties.fill ?? void 0);
|
|
3500
|
+
const line = lineView2(properties.line ?? void 0);
|
|
3501
|
+
const text2 = {
|
|
3502
|
+
fill: {
|
|
3503
|
+
...fill3,
|
|
3504
|
+
kind: fill3.kind === "picture" || fill3.kind === "pattern" ? "automatic" : fill3.kind
|
|
3505
|
+
},
|
|
3506
|
+
outline: { ...line, kind: line.kind === "gradient" ? "automatic" : line.kind },
|
|
3507
|
+
effects: chartEffectsView(properties.effects, resolve)
|
|
3508
|
+
};
|
|
3509
|
+
if (properties.rotation !== void 0) text2.rotation = properties.rotation;
|
|
3510
|
+
if (properties.direction !== void 0) text2.direction = properties.direction;
|
|
3511
|
+
if (properties.anchor !== void 0) text2.anchor = properties.anchor;
|
|
3512
|
+
result.text = text2;
|
|
3513
|
+
}
|
|
3514
|
+
return result;
|
|
3515
|
+
}
|
|
3516
|
+
var transparency3 = (alpha) => Math.round((1 - alpha) * 100);
|
|
2986
3517
|
function fillView(fill3, resolve) {
|
|
2987
3518
|
switch (fill3?.kind) {
|
|
2988
3519
|
case "none":
|
|
2989
3520
|
return { kind: "none" };
|
|
2990
3521
|
case "solid": {
|
|
2991
3522
|
const color = resolve(fill3.color);
|
|
2992
|
-
return color ? { kind: "solid", color: color.hex, transparency:
|
|
3523
|
+
return color ? { kind: "solid", color: color.hex, transparency: transparency3(color.alpha) } : { kind: "solid" };
|
|
2993
3524
|
}
|
|
2994
3525
|
case "gradient":
|
|
2995
3526
|
return { kind: "gradient", gradient: resolveChartGradient(fill3, resolve) };
|
|
2996
3527
|
case "pattern":
|
|
2997
|
-
return {
|
|
3528
|
+
return {
|
|
3529
|
+
kind: "pattern",
|
|
3530
|
+
pattern: {
|
|
3531
|
+
preset: fill3.preset,
|
|
3532
|
+
foreground: fill3.foreground ? resolve(fill3.foreground)?.hex ?? "#000000" : "#000000",
|
|
3533
|
+
background: fill3.background ? resolve(fill3.background)?.hex ?? "#FFFFFF" : "#FFFFFF"
|
|
3534
|
+
}
|
|
3535
|
+
};
|
|
2998
3536
|
case "picture":
|
|
2999
3537
|
return { kind: "picture" };
|
|
3000
3538
|
default:
|
|
@@ -3011,17 +3549,20 @@ function lineView(line, resolve) {
|
|
|
3011
3549
|
...paint.gradient === void 0 ? {} : { gradient: paint.gradient },
|
|
3012
3550
|
...line?.widthEmu === void 0 ? {} : { width: Math.round(line.widthEmu / 12700 * 100) / 100 },
|
|
3013
3551
|
...line?.dash === void 0 ? {} : { dash: line.dash },
|
|
3014
|
-
...line?.cap === void 0 ? {} : { cap: line.cap }
|
|
3552
|
+
...line?.cap === void 0 ? {} : { cap: line.cap },
|
|
3553
|
+
...line?.compound === void 0 ? {} : { compound: line.compound },
|
|
3554
|
+
...line?.join === void 0 ? {} : { join: line.join.kind },
|
|
3555
|
+
...line?.headEnd?.type === void 0 ? {} : { beginArrow: line.headEnd.type },
|
|
3556
|
+
...line?.tailEnd?.type === void 0 ? {} : { endArrow: line.tailEnd.type }
|
|
3015
3557
|
};
|
|
3016
3558
|
}
|
|
3017
|
-
var chartTypeOf = (group) => group.element.replace(/Chart$/u, "");
|
|
3018
3559
|
var vertical = (axis, space) => {
|
|
3019
3560
|
if (axis.position) return axis.position === "l" || axis.position === "r";
|
|
3020
3561
|
const horizontalBars = space.plotArea.groups.some((group) => group.barDirection === "bar");
|
|
3021
3562
|
return axis.kind === "val" ? !horizontalBars : horizontalBars;
|
|
3022
3563
|
};
|
|
3023
3564
|
var seriesName = (series, index) => series?.tx?.text || series?.tx?.value || `Series ${index + 1}`;
|
|
3024
|
-
function axisView(axis) {
|
|
3565
|
+
function axisView(axis, advanced = false) {
|
|
3025
3566
|
const view = {
|
|
3026
3567
|
kind: axis.kind,
|
|
3027
3568
|
reverse: axis.scaling.orientation === "maxMin",
|
|
@@ -3042,6 +3583,16 @@ function axisView(axis) {
|
|
|
3042
3583
|
copy("majorTickMark", axis.majorTickMark);
|
|
3043
3584
|
copy("minorTickMark", axis.minorTickMark);
|
|
3044
3585
|
copy("tickLabelPosition", axis.tickLabelPosition);
|
|
3586
|
+
if (advanced) {
|
|
3587
|
+
view.title = axis.title?.text ?? "";
|
|
3588
|
+
if (axis.numberFormat) view.numberFormatSourceLinked = axis.numberFormat.sourceLinked ?? true;
|
|
3589
|
+
if (axis.kind === "date") {
|
|
3590
|
+
view.timeUnitsEditable = true;
|
|
3591
|
+
copy("baseTimeUnit", axis.baseTimeUnit);
|
|
3592
|
+
copy("majorTimeUnit", axis.majorTimeUnit);
|
|
3593
|
+
copy("minorTimeUnit", axis.minorTimeUnit);
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3045
3596
|
return view;
|
|
3046
3597
|
}
|
|
3047
3598
|
function targetsOf(space) {
|
|
@@ -3068,6 +3619,8 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
3068
3619
|
return resolved && { hex: resolved.hex, alpha: resolved.alpha };
|
|
3069
3620
|
};
|
|
3070
3621
|
const entries = chartSeriesEntries(space);
|
|
3622
|
+
const advanced = options.advanced !== false;
|
|
3623
|
+
const seriesOptions2 = (seriesIndex) => chartSeriesOptionsView(space, entries[seriesIndex], seriesIndex, advanced);
|
|
3071
3624
|
const describe = {
|
|
3072
3625
|
axis: (axisIndex) => {
|
|
3073
3626
|
const axis = space.plotArea.axes[axisIndex];
|
|
@@ -3086,15 +3639,25 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
3086
3639
|
shape = void 0;
|
|
3087
3640
|
}
|
|
3088
3641
|
return {
|
|
3642
|
+
...target.kind === "series" && seriesOptions2(target.seriesIndex) ? { series: seriesOptions2(target.seriesIndex) } : {},
|
|
3643
|
+
...advanced ? chartAdvancedElementView(
|
|
3644
|
+
space,
|
|
3645
|
+
target,
|
|
3646
|
+
resolve,
|
|
3647
|
+
(fill3) => fillView(fill3, resolve),
|
|
3648
|
+
(line) => lineView(line, resolve),
|
|
3649
|
+
!lineTarget
|
|
3650
|
+
) : {},
|
|
3089
3651
|
support: {
|
|
3090
3652
|
fill: !lineTarget,
|
|
3091
3653
|
gradient: true,
|
|
3092
|
-
pattern:
|
|
3654
|
+
pattern: advanced && !lineTarget,
|
|
3093
3655
|
picture: false,
|
|
3094
|
-
threeD:
|
|
3095
|
-
text:
|
|
3096
|
-
lineDetails:
|
|
3097
|
-
effects:
|
|
3656
|
+
threeD: advanced && !lineTarget,
|
|
3657
|
+
text: advanced && chartTargetHasText(target),
|
|
3658
|
+
lineDetails: advanced,
|
|
3659
|
+
effects: advanced,
|
|
3660
|
+
secondaryAxis: target.kind === "series" && advanced && chartSeriesSecondaryAxisSupported(space, target.seriesIndex)
|
|
3098
3661
|
},
|
|
3099
3662
|
fill: fillView(shape?.fill, resolve),
|
|
3100
3663
|
line: lineView(shape?.line, resolve)
|
|
@@ -3111,7 +3674,7 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
3111
3674
|
const set = (key, value) => {
|
|
3112
3675
|
if (value !== void 0) view[key] = value;
|
|
3113
3676
|
};
|
|
3114
|
-
set("chartType", group &&
|
|
3677
|
+
set("chartType", group && chartGroupFormatType(group));
|
|
3115
3678
|
set("showSeriesName", pick("showSeriesName"));
|
|
3116
3679
|
set("showCategory", pick("showCategoryName"));
|
|
3117
3680
|
set("showValue", pick("showValue"));
|
|
@@ -3122,21 +3685,26 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
3122
3685
|
};
|
|
3123
3686
|
return {
|
|
3124
3687
|
targets: chartFormatTargetOptions(targetsOf(space), describe),
|
|
3125
|
-
textOptions:
|
|
3688
|
+
textOptions: advanced,
|
|
3689
|
+
patternPresets: [
|
|
3690
|
+
"pct5",
|
|
3691
|
+
"pct10",
|
|
3692
|
+
"pct25",
|
|
3693
|
+
"pct50",
|
|
3694
|
+
"horz",
|
|
3695
|
+
"vert",
|
|
3696
|
+
"ltHorz",
|
|
3697
|
+
"cross",
|
|
3698
|
+
"diagCross"
|
|
3699
|
+
].map((preset) => ({
|
|
3700
|
+
value: preset,
|
|
3701
|
+
label: { key: `chartFormat.pattern.${preset}`, fallback: preset }
|
|
3702
|
+
})),
|
|
3126
3703
|
element,
|
|
3127
|
-
seriesOptions:
|
|
3128
|
-
const group = entries[seriesIndex]?.group;
|
|
3129
|
-
if (!group) return void 0;
|
|
3130
|
-
const view = { chartType: chartTypeOf(group) };
|
|
3131
|
-
if (group.overlap !== void 0) view.overlap = group.overlap;
|
|
3132
|
-
if (group.gapWidth !== void 0) view.gapWidth = group.gapWidth;
|
|
3133
|
-
if (group.firstSliceAngle !== void 0) view.firstSliceAngle = group.firstSliceAngle;
|
|
3134
|
-
if (group.holeSize !== void 0) view.holeSize = group.holeSize;
|
|
3135
|
-
return view;
|
|
3136
|
-
},
|
|
3704
|
+
seriesOptions: seriesOptions2,
|
|
3137
3705
|
axisOptions: (axisIndex) => {
|
|
3138
3706
|
const axis = space.plotArea.axes[axisIndex];
|
|
3139
|
-
return axis && axisView(axis);
|
|
3707
|
+
return axis && axisView(axis, advanced);
|
|
3140
3708
|
},
|
|
3141
3709
|
legendOptions: () => space.legend && {
|
|
3142
3710
|
...space.legend.position === void 0 ? {} : { position: space.legend.position },
|
|
@@ -3525,12 +4093,12 @@ var OfficeUiPrintPreview = class extends OfficeElement {
|
|
|
3525
4093
|
}
|
|
3526
4094
|
render() {
|
|
3527
4095
|
const total = this.list.length;
|
|
3528
|
-
const
|
|
4096
|
+
const label = this.label ?? "Print preview";
|
|
3529
4097
|
return html`
|
|
3530
4098
|
<div
|
|
3531
4099
|
class="sheet"
|
|
3532
4100
|
role="img"
|
|
3533
|
-
aria-label=${total > 1 ? `${
|
|
4101
|
+
aria-label=${total > 1 ? `${label}, page ${this.current + 1} of ${total}` : label}
|
|
3534
4102
|
>${this.clone ?? html`<p class="empty">${this.emptyLabel ?? "Nothing to print."}</p>`}</div
|
|
3535
4103
|
>
|
|
3536
4104
|
<div class="nav" ?hidden=${total < 2}>
|
|
@@ -3932,8 +4500,8 @@ var OfficeUiButton = class extends OfficeElement {
|
|
|
3932
4500
|
return this.getAttribute("icon");
|
|
3933
4501
|
}
|
|
3934
4502
|
/** The tooltip: `title`, else the label of an icon-only button; a product may always show it. */
|
|
3935
|
-
tooltip(
|
|
3936
|
-
return this.getAttribute("title") ?? (iconOnly ?
|
|
4503
|
+
tooltip(label, iconOnly) {
|
|
4504
|
+
return this.getAttribute("title") ?? (iconOnly ? label : "");
|
|
3937
4505
|
}
|
|
3938
4506
|
/** Whether the trailing menu chevron shows. */
|
|
3939
4507
|
showsCaret() {
|
|
@@ -3950,24 +4518,24 @@ var OfficeUiButton = class extends OfficeElement {
|
|
|
3950
4518
|
if (!present(this.disabled) && id) this.fire(requestEvent, { [detailKey]: id });
|
|
3951
4519
|
}
|
|
3952
4520
|
render() {
|
|
3953
|
-
const
|
|
4521
|
+
const label = this.getAttribute("label") ?? "";
|
|
3954
4522
|
const iconOnly = this.hasAttribute("icon-only");
|
|
3955
4523
|
const badge = this.getAttribute("badge") ?? "";
|
|
3956
4524
|
const expanded = this.getAttribute("expanded");
|
|
3957
|
-
const tooltip = this.tooltip(
|
|
4525
|
+
const tooltip = this.tooltip(label, iconOnly);
|
|
3958
4526
|
return html`<button
|
|
3959
4527
|
part="button"
|
|
3960
4528
|
type="button"
|
|
3961
4529
|
?disabled=${present(this.disabled)}
|
|
3962
4530
|
title=${tooltip || nothing}
|
|
3963
|
-
aria-label=${ifDefined(iconOnly &&
|
|
4531
|
+
aria-label=${ifDefined(iconOnly && label ? label : void 0)}
|
|
3964
4532
|
aria-keyshortcuts=${ifDefined(this.getAttribute("keyshortcuts") || void 0)}
|
|
3965
4533
|
aria-pressed=${ifDefined(asAttribute(this.pressed))}
|
|
3966
4534
|
aria-expanded=${ifDefined(expanded === null ? void 0 : String(expanded !== "false"))}
|
|
3967
4535
|
@click=${this.onClick}
|
|
3968
4536
|
@keydown=${this.onKeydown}
|
|
3969
4537
|
>${glyph(this.iconName())}<span class="label" ?hidden=${iconOnly}
|
|
3970
|
-
>${
|
|
4538
|
+
>${label}${glyph("chevronDown", "caret", !this.showsCaret())}</span
|
|
3971
4539
|
><span class="badge" aria-hidden="true" ?hidden=${!badge}>${badge}</span></button
|
|
3972
4540
|
>`;
|
|
3973
4541
|
}
|
|
@@ -4060,25 +4628,25 @@ var OfficeUiRibbonGroup = class extends OfficeElement {
|
|
|
4060
4628
|
this.setAttribute("aria-label", this.getAttribute("label") ?? "");
|
|
4061
4629
|
}
|
|
4062
4630
|
render() {
|
|
4063
|
-
const
|
|
4064
|
-
const launcherLabel = this.getAttribute("launcher-label") ?? `${
|
|
4631
|
+
const label = this.getAttribute("label") ?? "";
|
|
4632
|
+
const launcherLabel = this.getAttribute("launcher-label") ?? `${label} options`;
|
|
4065
4633
|
return html`
|
|
4066
4634
|
<div class="group">
|
|
4067
4635
|
<button
|
|
4068
4636
|
class="face"
|
|
4069
4637
|
type="button"
|
|
4070
4638
|
aria-haspopup="true"
|
|
4071
|
-
aria-label=${
|
|
4639
|
+
aria-label=${label}
|
|
4072
4640
|
aria-expanded=${String(this.hasAttribute("data-open"))}
|
|
4073
|
-
title=${
|
|
4641
|
+
title=${label}
|
|
4074
4642
|
@click=${this.onFace}
|
|
4075
|
-
>${glyph(this.iconName(), "face-icon")}<span>${
|
|
4643
|
+
>${glyph(this.iconName(), "face-icon")}<span>${label}</span>${glyph("chevronDown", "chev")}</button
|
|
4076
4644
|
>
|
|
4077
4645
|
<div class="row">
|
|
4078
4646
|
<slot @slotchange=${this.observe}></slot>
|
|
4079
4647
|
</div>
|
|
4080
4648
|
<div class="foot">
|
|
4081
|
-
<span class="caption">${
|
|
4649
|
+
<span class="caption">${label}</span>
|
|
4082
4650
|
<button
|
|
4083
4651
|
class="launcher"
|
|
4084
4652
|
type="button"
|
|
@@ -4892,13 +5460,13 @@ var OfficeUiRuler = class extends OfficeElement {
|
|
|
4892
5460
|
if (index % divisions !== 0) continue;
|
|
4893
5461
|
if (this.labelsWithinMargins && (index < 0 || at < this.marginStart || at > length - this.marginEnd))
|
|
4894
5462
|
continue;
|
|
4895
|
-
const
|
|
4896
|
-
if (!vertical2) context.fillText(
|
|
5463
|
+
const label = String(index / divisions);
|
|
5464
|
+
if (!vertical2) context.fillText(label, at + 2, 9);
|
|
4897
5465
|
else {
|
|
4898
5466
|
context.save();
|
|
4899
5467
|
context.translate(9, at - 2);
|
|
4900
5468
|
context.rotate(-Math.PI / 2);
|
|
4901
|
-
context.fillText(
|
|
5469
|
+
context.fillText(label, 0, 0);
|
|
4902
5470
|
context.restore();
|
|
4903
5471
|
}
|
|
4904
5472
|
}
|
|
@@ -6018,10 +6586,10 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
6018
6586
|
if (present(this.disabled)) this.hide(false);
|
|
6019
6587
|
}
|
|
6020
6588
|
render() {
|
|
6021
|
-
const { label
|
|
6589
|
+
const { label, split, open } = this;
|
|
6022
6590
|
const iconOnly = present(this.iconOnly);
|
|
6023
6591
|
const disabled = present(this.disabled);
|
|
6024
|
-
const title = this.getAttribute("title") ??
|
|
6592
|
+
const title = this.getAttribute("title") ?? label;
|
|
6025
6593
|
const popover = this.nativePopover;
|
|
6026
6594
|
return html`
|
|
6027
6595
|
<div class="wrap ${disabled ? "disabled" : ""}">
|
|
@@ -6030,7 +6598,7 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
6030
6598
|
part="button"
|
|
6031
6599
|
type="button"
|
|
6032
6600
|
title=${title}
|
|
6033
|
-
aria-label=${ifDefined(iconOnly ?
|
|
6601
|
+
aria-label=${ifDefined(iconOnly ? label : void 0)}
|
|
6034
6602
|
aria-keyshortcuts=${ifDefined(this.keyshortcuts || void 0)}
|
|
6035
6603
|
aria-haspopup=${ifDefined(split ? void 0 : "menu")}
|
|
6036
6604
|
role=${ifDefined(present(this.submenu) ? "menuitem" : void 0)}
|
|
@@ -6040,15 +6608,15 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
6040
6608
|
@click=${this.onMain}
|
|
6041
6609
|
@keydown=${this.onTriggerKey}
|
|
6042
6610
|
@pointerenter=${() => present(this.submenu) && this.show(-1)}
|
|
6043
|
-
>${glyph(this.icon)}<span class="text" ?hidden=${iconOnly}>${
|
|
6611
|
+
>${glyph(this.icon)}<span class="text" ?hidden=${iconOnly}>${label}</span></button
|
|
6044
6612
|
>
|
|
6045
6613
|
<!-- Without a split command the caret is decoration on one control, not a second button. -->
|
|
6046
6614
|
<button
|
|
6047
6615
|
class="caret"
|
|
6048
6616
|
part="caret"
|
|
6049
6617
|
type="button"
|
|
6050
|
-
title=${split ? `${
|
|
6051
|
-
aria-label=${ifDefined(split ? `${
|
|
6618
|
+
title=${split ? `${label} options` : title}
|
|
6619
|
+
aria-label=${ifDefined(split ? `${label} options` : void 0)}
|
|
6052
6620
|
aria-hidden=${ifDefined(split ? void 0 : "true")}
|
|
6053
6621
|
aria-haspopup="menu"
|
|
6054
6622
|
aria-expanded=${String(open)}
|
|
@@ -6083,10 +6651,10 @@ function optionRow(host, control2) {
|
|
|
6083
6651
|
const locked = Boolean(control2.disabled) || control2.enabledBy && draft[control2.enabledBy] !== true;
|
|
6084
6652
|
const disabled = Boolean(locked);
|
|
6085
6653
|
const info = control2.info ? html`<span class="info" title=${control2.info} role="img" aria-label=${control2.info}>i</span>` : "";
|
|
6086
|
-
const
|
|
6654
|
+
const label = html`<span class="label">${control2.label}${info}</span>`;
|
|
6087
6655
|
let body;
|
|
6088
6656
|
if (control2.kind === "toggle")
|
|
6089
|
-
body = html`${
|
|
6657
|
+
body = html`${label}<input
|
|
6090
6658
|
type="checkbox"
|
|
6091
6659
|
.checked=${value === true}
|
|
6092
6660
|
?disabled=${disabled}
|
|
@@ -6094,7 +6662,7 @@ function optionRow(host, control2) {
|
|
|
6094
6662
|
/>`;
|
|
6095
6663
|
else if (control2.kind === "select") {
|
|
6096
6664
|
const current = String(value ?? control2.choices[0]?.value ?? "");
|
|
6097
|
-
body = html`${
|
|
6665
|
+
body = html`${label}<select
|
|
6098
6666
|
aria-label=${control2.label}
|
|
6099
6667
|
?disabled=${disabled}
|
|
6100
6668
|
@change=${(event) => host.set(control2.key, event.target.value)}
|
|
@@ -6106,7 +6674,7 @@ function optionRow(host, control2) {
|
|
|
6106
6674
|
)}
|
|
6107
6675
|
</select>`;
|
|
6108
6676
|
} else if (control2.kind === "number")
|
|
6109
|
-
body = html`${
|
|
6677
|
+
body = html`${label}<span class="number"
|
|
6110
6678
|
><input
|
|
6111
6679
|
type="number"
|
|
6112
6680
|
min=${control2.min}
|
|
@@ -6127,7 +6695,7 @@ function optionRow(host, control2) {
|
|
|
6127
6695
|
/>${control2.unit ? html`<span class="unit">${control2.unit}</span>` : ""}</span
|
|
6128
6696
|
>`;
|
|
6129
6697
|
else
|
|
6130
|
-
body = html`${
|
|
6698
|
+
body = html`${label}<input
|
|
6131
6699
|
type="text"
|
|
6132
6700
|
maxlength=${ifDefined(control2.maxLength ? String(control2.maxLength) : void 0)}
|
|
6133
6701
|
aria-label=${control2.label}
|
|
@@ -6863,13 +7431,13 @@ var OfficeUiStatusBar = class extends OfficeElement {
|
|
|
6863
7431
|
>${glyph(spec.icon, "icon")}${spec.text ? html`<span class="label">${spec.text}</span>` : ""}</button
|
|
6864
7432
|
>`;
|
|
6865
7433
|
}
|
|
6866
|
-
zoomStep(id,
|
|
7434
|
+
zoomStep(id, label, icon) {
|
|
6867
7435
|
return html`<button
|
|
6868
7436
|
type="button"
|
|
6869
7437
|
class="zoom-step"
|
|
6870
7438
|
data-id=${id}
|
|
6871
|
-
title=${
|
|
6872
|
-
aria-label=${
|
|
7439
|
+
title=${label}
|
|
7440
|
+
aria-label=${label}
|
|
6873
7441
|
@click=${() => this.activate(id)}
|
|
6874
7442
|
@keydown=${this.onKeydown}
|
|
6875
7443
|
>${glyph(icon, "icon")}</button
|
|
@@ -7759,9 +8327,9 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
7759
8327
|
items() {
|
|
7760
8328
|
return [...this.renderRoot.querySelectorAll("button:not(:disabled)")];
|
|
7761
8329
|
}
|
|
7762
|
-
pick(color, source,
|
|
8330
|
+
pick(color, source, label, more = {}) {
|
|
7763
8331
|
if (present(this.disabled)) return;
|
|
7764
|
-
emit(this, "office-color-pick", { color, source, label
|
|
8332
|
+
emit(this, "office-color-pick", { color, source, label, ...more });
|
|
7765
8333
|
}
|
|
7766
8334
|
more() {
|
|
7767
8335
|
if (!present(this.disabled)) emit(this, "office-color-more", {});
|
|
@@ -8463,14 +9031,14 @@ var OfficeUiChartDataSheet = class extends OfficeElement {
|
|
|
8463
9031
|
}
|
|
8464
9032
|
this.highlightKey = key;
|
|
8465
9033
|
}
|
|
8466
|
-
cell(row, col,
|
|
9034
|
+
cell(row, col, label, marked) {
|
|
8467
9035
|
return html`<input
|
|
8468
9036
|
type="text"
|
|
8469
9037
|
class=${marked ? "cell highlight" : "cell"}
|
|
8470
9038
|
inputmode=${row > 0 && col > 0 ? "decimal" : "text"}
|
|
8471
9039
|
data-row=${row}
|
|
8472
9040
|
data-col=${col}
|
|
8473
|
-
aria-label=${
|
|
9041
|
+
aria-label=${label}
|
|
8474
9042
|
?disabled=${this.disabled}
|
|
8475
9043
|
.value=${live(this.cellText(row, col))}
|
|
8476
9044
|
@focus=${this.onFocus}
|
|
@@ -8481,12 +9049,12 @@ var OfficeUiChartDataSheet = class extends OfficeElement {
|
|
|
8481
9049
|
@cut=${(event) => event.stopPropagation()}
|
|
8482
9050
|
/>`;
|
|
8483
9051
|
}
|
|
8484
|
-
removeButton(
|
|
9052
|
+
removeButton(label, edit) {
|
|
8485
9053
|
return html`<button
|
|
8486
9054
|
type="button"
|
|
8487
9055
|
class="remove"
|
|
8488
|
-
title=${
|
|
8489
|
-
aria-label=${
|
|
9056
|
+
title=${label}
|
|
9057
|
+
aria-label=${label}
|
|
8490
9058
|
@click=${() => this.emitEdits([edit])}
|
|
8491
9059
|
>×</button
|
|
8492
9060
|
>`;
|
|
@@ -8843,14 +9411,14 @@ function attachKeyTips(scope) {
|
|
|
8843
9411
|
|
|
8844
9412
|
// src/ribbon/keytip-run.ts
|
|
8845
9413
|
var clash = (used, key) => used.some((other) => other.startsWith(key) || key.startsWith(other));
|
|
8846
|
-
function assignKeyTips(targets,
|
|
9414
|
+
function assignKeyTips(targets, label) {
|
|
8847
9415
|
const used = [];
|
|
8848
9416
|
for (const target of targets) {
|
|
8849
9417
|
if (target.key && !clash(used, target.key)) used.push(target.key);
|
|
8850
9418
|
else target.key = "";
|
|
8851
9419
|
}
|
|
8852
9420
|
for (const target of targets.filter((item) => !item.key)) {
|
|
8853
|
-
const source =
|
|
9421
|
+
const source = label(target).toUpperCase().replace(/[^A-Z0-9]/g, "") || "ZZ";
|
|
8854
9422
|
let key = "";
|
|
8855
9423
|
for (let a = 0; a < source.length && !key; a++)
|
|
8856
9424
|
for (let b = a + 1; b < source.length && !key; b++) {
|
|
@@ -8919,12 +9487,12 @@ function ensureRibbonTouchStyle(node) {
|
|
|
8919
9487
|
style.textContent = scroll_more_default;
|
|
8920
9488
|
host.append(style);
|
|
8921
9489
|
}
|
|
8922
|
-
function syncScrollMore(panel,
|
|
9490
|
+
function syncScrollMore(panel, label = "More") {
|
|
8923
9491
|
panel.querySelector(`:scope > .${CLASS}`)?.remove();
|
|
8924
9492
|
if (panel.hidden || panel.scrollWidth <= panel.clientWidth + 1) return;
|
|
8925
9493
|
ensureRibbonTouchStyle(panel);
|
|
8926
9494
|
const doc = panel.ownerDocument;
|
|
8927
|
-
const text2 = typeof
|
|
9495
|
+
const text2 = typeof label === "function" ? label(panel) : label;
|
|
8928
9496
|
const button = doc.createElement("button");
|
|
8929
9497
|
button.type = "button";
|
|
8930
9498
|
button.className = CLASS;
|
|
@@ -9045,12 +9613,12 @@ function createRibbonOverflow(options) {
|
|
|
9045
9613
|
button = overflowButton(group);
|
|
9046
9614
|
group.append(button);
|
|
9047
9615
|
}
|
|
9048
|
-
const
|
|
9616
|
+
const label = group.dataset.caption ?? group.dataset.label ?? "";
|
|
9049
9617
|
const span = button.querySelector("span");
|
|
9050
|
-
if (options.setCaption) options.setCaption(span,
|
|
9051
|
-
else span.textContent =
|
|
9052
|
-
button.setAttribute("aria-label",
|
|
9053
|
-
button.title =
|
|
9618
|
+
if (options.setCaption) options.setCaption(span, label);
|
|
9619
|
+
else span.textContent = label;
|
|
9620
|
+
button.setAttribute("aria-label", label);
|
|
9621
|
+
button.title = label;
|
|
9054
9622
|
group.setAttribute("data-collapsed", "");
|
|
9055
9623
|
}
|
|
9056
9624
|
syncScrollMore(panel, options.moreLabel);
|
|
@@ -9411,4 +9979,4 @@ function registerControls(registry) {
|
|
|
9411
9979
|
for (const define of CONTROL_DEFINERS) define(registry);
|
|
9412
9980
|
}
|
|
9413
9981
|
|
|
9414
|
-
export { CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, OfficeUiChartFormatPane, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, buildChartFormatModel, chartFormatFieldIntent, chartFormatLocale, chartFormatPaneTitle, chartFormatSourceTabs, chartFormatTargetLabel, chartFormatTargetOptions, chartFormatTranslator, chartSpaceFormatSource, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defaultPaneGradient, defineAccount, defineBackstage, defineButton, defineChartDataSheet, defineChartFormatPane, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineProgressDialog, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, drawingColorFromHex, drawingGradientFrom, fitRibbonGroups, formatCommentTime, glyph, hexForInput, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode, personalizeSection, profileInitials, rangeControl, range_control_default, readOfficeProfile, registerControls, resolveChartFormatSourceTarget, rulerDivisions, runKeyTips, sanitizeOfficeProfile, translateChartFormatText, typeAheadIndex, unavailableCategory, unavailableControl, userInterfaceSection, writeOfficeProfile };
|
|
9982
|
+
export { CHART_DATA_SHEET_ENGLISH, CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, OfficeUiChartFormatPane, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, buildChartFormatModel, chartFormatFieldIntent, chartFormatLocale, chartFormatPaneTitle, chartFormatSourceTabs, chartFormatTargetLabel, chartFormatTargetOptions, chartFormatTranslator, chartSpaceFormatSource, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defaultPaneGradient, defineAccount, defineBackstage, defineButton, defineChartDataSheet, defineChartFormatPane, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineProgressDialog, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, drawingColorFromHex, drawingGradientFrom, fitRibbonGroups, formatCommentTime, glyph, hexForInput, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode, personalizeSection, profileInitials, rangeControl, range_control_default, readOfficeProfile, registerControls, resolveChartFormatSourceTarget, rulerDivisions, runKeyTips, sanitizeOfficeProfile, translateChartFormatText, typeAheadIndex, unavailableCategory, unavailableControl, userInterfaceSection, writeOfficeProfile };
|