ooxml-core 1.9.0 → 1.11.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/PptxHandler-DNZHAHUY.cjs +12 -0
- package/dist/PptxHandler-E44KDHMQ.mjs +3 -0
- package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-NROFYT2N.mjs} +2 -2
- package/dist/automation/index.cjs +3236 -2258
- package/dist/automation/index.mjs +3236 -2258
- package/dist/{chunk-SWF7KVL5.cjs → chunk-2UVH6RHI.cjs} +1608 -1163
- package/dist/{chunk-M76PHYRR.mjs → chunk-7DSZI7S6.mjs} +1 -1
- package/dist/{chunk-AT66SA5M.cjs → chunk-7QZGRB3T.cjs} +28 -10
- package/dist/chunk-ANZ4Q6I3.cjs +21 -0
- package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
- package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
- package/dist/{chunk-FIELY5PI.mjs → chunk-EC2W2MDY.mjs} +30 -2
- package/dist/chunk-EGTRL3QJ.mjs +19 -0
- package/dist/chunk-GXHKNSZX.mjs +9 -0
- package/dist/{chunk-OXHMZS7B.mjs → chunk-HCXUI5UC.mjs} +943 -273
- package/dist/chunk-HDQXPSHY.cjs +17 -0
- package/dist/chunk-KTYBFGEY.mjs +14 -0
- package/dist/chunk-QOO36KG4.cjs +42 -0
- package/dist/chunk-R2KZXD6U.mjs +39 -0
- package/dist/{chunk-IGOA57LE.mjs → chunk-U2DF3EGK.mjs} +1 -1
- package/dist/{chunk-OB277ZGE.mjs → chunk-UAY26XOI.mjs} +27 -9
- package/dist/{chunk-WSO4T2LJ.mjs → chunk-W5ARCUJB.mjs} +26 -3
- package/dist/chunk-XZPZHXV4.cjs +12 -0
- package/dist/{chunk-LCS3J3QI.mjs → chunk-YB5SRNFS.mjs} +717 -272
- package/dist/docx/layout/adapt-table.d.ts +2 -2
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +554 -83
- package/dist/docx/layout/index.mjs +554 -84
- package/dist/docx/layout/nested-fragment-edges.d.ts +9 -0
- package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -0
- package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
- package/dist/docx/layout/page-cursor.d.ts +2 -0
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +20 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +16 -0
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-cell-layout.d.ts +3 -2
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-content.d.ts +4 -0
- package/dist/docx/layout/table-content.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +5 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -1
- package/dist/docx/layout/table-frames.d.ts +4 -0
- package/dist/docx/layout/table-frames.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +8 -3
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-note-completion.d.ts +5 -0
- package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
- package/dist/docx/layout/table-note-stories.d.ts +6 -0
- package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +801 -296
- package/dist/pptx/automation/index.d.ts +5 -4
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → elements-DD3UGOMd.d.ts} +27 -3248
- package/dist/pptx/chunks/elements-DD3UGOMd.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-BZrFyNtU.d.ts} +113 -5
- package/dist/pptx/chunks/index-BZrFyNtU.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-DdX02BSm.d.ts} +19 -3
- package/dist/pptx/chunks/index-DdX02BSm.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts +1512 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +1 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts +1473 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +1 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts +3261 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +801 -296
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +1 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +19 -18
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +3 -2
- package/dist/pptx/editor/render/font-family-update.cjs +14 -0
- package/dist/pptx/editor/render/font-family-update.d.ts +17 -0
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -0
- package/dist/pptx/editor/render/font-family-update.mjs +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.cjs +14 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +17 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.mjs +12 -0
- package/dist/pptx/editor/render/remap-text.cjs +2 -2
- package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.cjs +18 -0
- package/dist/pptx/editor/render/text-content-style.d.ts +9 -0
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-content-style.mjs +5 -0
- package/dist/pptx/editor/render/text-runs-style-patch.cjs +17 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +7 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-runs-style-patch.mjs +15 -0
- package/dist/pptx/editor/render/text-style-scope.cjs +173 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts +76 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-style-scope.mjs +164 -0
- package/dist/pptx/editor/render/theme-editor-model.cjs +1 -1
- package/dist/pptx/editor/render/theme-editor-model.mjs +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.cjs +11 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +14 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/update-text-segment-style.mjs +2 -0
- package/dist/pptx/index.cjs +1091 -296
- package/dist/pptx/index.d.ts +7 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +590 -122
- package/dist/teams/index.mjs +590 -122
- package/dist/visio/date-cache.d.ts +3 -0
- package/dist/visio/date-cache.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +3 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-text-field-commands.d.ts +15 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts +2 -2
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +501 -220
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +501 -220
- package/dist/visio/model.d.ts +6 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/style.d.ts +1 -1
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts +3 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-editability.d.ts +6 -0
- package/dist/visio/text-field-editability.d.ts.map +1 -0
- package/dist/visio/text-field-fraction.d.ts +3 -0
- package/dist/visio/text-field-fraction.d.ts.map +1 -0
- package/dist/visio/text-field-independent.d.ts +4 -0
- package/dist/visio/text-field-independent.d.ts.map +1 -0
- package/dist/visio/text-field-numeric.d.ts +1 -1
- package/dist/visio/text-field-numeric.d.ts.map +1 -1
- package/dist/visio/text-field-source.d.ts +6 -0
- package/dist/visio/text-field-source.d.ts.map +1 -0
- package/dist/visio/text-field-system-date.d.ts +4 -0
- package/dist/visio/text-field-system-date.d.ts.map +1 -0
- package/dist/visio/text-fields.d.ts +1 -0
- package/dist/visio/text-fields.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +514 -221
- package/dist/visio/ui/index.mjs +514 -221
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +1362 -659
- package/dist/xlsx/index.mjs +1361 -660
- package/dist/xlsx/load/index.cjs +1091 -430
- package/dist/xlsx/load/index.mjs +1091 -430
- package/dist/xlsx/model-pivots.d.ts +31 -2
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/aggregate.d.ts +3 -1
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +2 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
- package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +2 -4
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
- package/dist/xlsx/pivot/index.d.ts +2 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -1
- package/dist/xlsx/pivot/measures.d.ts +13 -0
- package/dist/xlsx/pivot/measures.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts +5 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter.d.ts +11 -0
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/values-axis.d.ts +12 -0
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +640 -137
- package/dist/xlsx/ui/index.mjs +640 -137
- package/package.json +2 -2
- package/dist/PptxHandler-AT7FVG5Q.mjs +0 -2
- package/dist/PptxHandler-VFSCECPL.cjs +0 -11
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BZh-IMkN.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts +0 -2970
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
package/dist/visio/index.cjs
CHANGED
|
@@ -3456,6 +3456,208 @@ function takeDeferredTextSizes(root2) {
|
|
|
3456
3456
|
return shapes;
|
|
3457
3457
|
}
|
|
3458
3458
|
|
|
3459
|
+
// visio/text-fields.ts
|
|
3460
|
+
var PROPERTY_FUNCTIONS = {
|
|
3461
|
+
TITLE: "title",
|
|
3462
|
+
SUBJECT: "subject",
|
|
3463
|
+
CREATOR: "creator",
|
|
3464
|
+
KEYWORDS: "keywords",
|
|
3465
|
+
DESCRIPTION: "description",
|
|
3466
|
+
CATEGORY: "category",
|
|
3467
|
+
COMPANY: "company",
|
|
3468
|
+
MANAGER: "manager"
|
|
3469
|
+
};
|
|
3470
|
+
var DATE_FUNCTIONS = {
|
|
3471
|
+
NOW: void 0,
|
|
3472
|
+
DOCCREATION: "created",
|
|
3473
|
+
DOCLASTSAVE: "modified",
|
|
3474
|
+
DOCLASTEDIT: "modified",
|
|
3475
|
+
DOCLASTPRINT: "lastPrinted"
|
|
3476
|
+
};
|
|
3477
|
+
var VISIO_FIELD_FUNCTIONS = [
|
|
3478
|
+
...Object.keys(PROPERTY_FUNCTIONS),
|
|
3479
|
+
...Object.keys(DATE_FUNCTIONS),
|
|
3480
|
+
"PAGENAME"
|
|
3481
|
+
];
|
|
3482
|
+
function visioWallClock(date2) {
|
|
3483
|
+
return new Date(
|
|
3484
|
+
Date.UTC(
|
|
3485
|
+
date2.getFullYear(),
|
|
3486
|
+
date2.getMonth(),
|
|
3487
|
+
date2.getDate(),
|
|
3488
|
+
date2.getHours(),
|
|
3489
|
+
date2.getMinutes(),
|
|
3490
|
+
date2.getSeconds()
|
|
3491
|
+
)
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
var EPOCH = Date.UTC(1899, 11, 30);
|
|
3495
|
+
var visioSerialDate = (serial) => Number.isFinite(serial) && Math.abs(serial) < 3e6 ? new Date(EPOCH + Math.round(serial * 864e5)) : void 0;
|
|
3496
|
+
function evaluateVisioTextField(formula, context) {
|
|
3497
|
+
let ast;
|
|
3498
|
+
try {
|
|
3499
|
+
ast = parseVisioFormula(formula, { maxLength: 4096 });
|
|
3500
|
+
} catch {
|
|
3501
|
+
return void 0;
|
|
3502
|
+
}
|
|
3503
|
+
if (ast.kind === "call") {
|
|
3504
|
+
const name3 = ast.name;
|
|
3505
|
+
if (Object.hasOwn(PROPERTY_FUNCTIONS, name3) && !ast.args.length) {
|
|
3506
|
+
const value = context.properties?.[PROPERTY_FUNCTIONS[name3]];
|
|
3507
|
+
return value === void 0 ? void 0 : { kind: "string", text: value };
|
|
3508
|
+
}
|
|
3509
|
+
if (Object.hasOwn(DATE_FUNCTIONS, name3) && !ast.args.length) {
|
|
3510
|
+
if (name3 === "NOW") return context.now ? { kind: "date", date: context.now } : void 0;
|
|
3511
|
+
const stamp = context.properties?.[DATE_FUNCTIONS[name3]];
|
|
3512
|
+
const time = stamp ? Date.parse(stamp) : Number.NaN;
|
|
3513
|
+
return Number.isFinite(time) ? { kind: "date", date: visioWallClock(new Date(time)) } : void 0;
|
|
3514
|
+
}
|
|
3515
|
+
if (name3 === "PAGENAME" && ast.args.length <= 1)
|
|
3516
|
+
return context.pageName === void 0 ? void 0 : { kind: "string", text: context.pageName };
|
|
3517
|
+
}
|
|
3518
|
+
try {
|
|
3519
|
+
const result = evaluateVisioFormula(
|
|
3520
|
+
ast,
|
|
3521
|
+
context.resolve ?? (() => {
|
|
3522
|
+
throw new Error("No cell context");
|
|
3523
|
+
}),
|
|
3524
|
+
{
|
|
3525
|
+
...context.pageNumber === void 0 ? {} : { pageNumber: context.pageNumber },
|
|
3526
|
+
...context.pageCount === void 0 ? {} : { pageCount: context.pageCount }
|
|
3527
|
+
}
|
|
3528
|
+
);
|
|
3529
|
+
return { kind: "number", value: result.value, unit: result.unit };
|
|
3530
|
+
} catch {
|
|
3531
|
+
return void 0;
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
var MONTHS = [
|
|
3535
|
+
"January",
|
|
3536
|
+
"February",
|
|
3537
|
+
"March",
|
|
3538
|
+
"April",
|
|
3539
|
+
"May",
|
|
3540
|
+
"June",
|
|
3541
|
+
"July",
|
|
3542
|
+
"August",
|
|
3543
|
+
"September",
|
|
3544
|
+
"October",
|
|
3545
|
+
"November",
|
|
3546
|
+
"December"
|
|
3547
|
+
];
|
|
3548
|
+
var DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
3549
|
+
var pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
3550
|
+
function dateToken(date2, token) {
|
|
3551
|
+
const hours = date2.getUTCHours();
|
|
3552
|
+
switch (token) {
|
|
3553
|
+
case "yyyy":
|
|
3554
|
+
return pad(date2.getUTCFullYear(), 4);
|
|
3555
|
+
case "yy":
|
|
3556
|
+
return pad(date2.getUTCFullYear() % 100);
|
|
3557
|
+
case "MMMM":
|
|
3558
|
+
return MONTHS[date2.getUTCMonth()];
|
|
3559
|
+
case "MMM":
|
|
3560
|
+
return MONTHS[date2.getUTCMonth()].slice(0, 3);
|
|
3561
|
+
case "MM":
|
|
3562
|
+
return pad(date2.getUTCMonth() + 1);
|
|
3563
|
+
case "M":
|
|
3564
|
+
return String(date2.getUTCMonth() + 1);
|
|
3565
|
+
case "dddd":
|
|
3566
|
+
return DAYS[date2.getUTCDay()];
|
|
3567
|
+
case "ddd":
|
|
3568
|
+
return DAYS[date2.getUTCDay()].slice(0, 3);
|
|
3569
|
+
case "dd":
|
|
3570
|
+
return pad(date2.getUTCDate());
|
|
3571
|
+
case "d":
|
|
3572
|
+
return String(date2.getUTCDate());
|
|
3573
|
+
case "HH":
|
|
3574
|
+
return pad(hours);
|
|
3575
|
+
case "H":
|
|
3576
|
+
return String(hours);
|
|
3577
|
+
case "hh":
|
|
3578
|
+
return pad(hours % 12 || 12);
|
|
3579
|
+
case "h":
|
|
3580
|
+
return String(hours % 12 || 12);
|
|
3581
|
+
case "mm":
|
|
3582
|
+
return pad(date2.getUTCMinutes());
|
|
3583
|
+
case "ss":
|
|
3584
|
+
return pad(date2.getUTCSeconds());
|
|
3585
|
+
case "tt":
|
|
3586
|
+
return hours < 12 ? "AM" : "PM";
|
|
3587
|
+
default:
|
|
3588
|
+
return void 0;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
function formatDate(date2, picture) {
|
|
3592
|
+
return picture.replace(
|
|
3593
|
+
/yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|HH|H|hh|h|mm|ss|tt|"[^"]*"/g,
|
|
3594
|
+
(token) => {
|
|
3595
|
+
if (token.startsWith('"')) return token.slice(1, -1);
|
|
3596
|
+
return dateToken(date2, token) ?? token;
|
|
3597
|
+
}
|
|
3598
|
+
);
|
|
3599
|
+
}
|
|
3600
|
+
function formatNumber(value, picture) {
|
|
3601
|
+
const match = /^(#,##)?0(?:\.(0+|#+))?$/.exec(picture);
|
|
3602
|
+
if (!match) return void 0;
|
|
3603
|
+
const decimals = match[2]?.length ?? 0;
|
|
3604
|
+
const optional = match[2]?.startsWith("#") ?? false;
|
|
3605
|
+
const [coefficient, exponent = "0"] = Math.abs(value).toString().split("e");
|
|
3606
|
+
const shifted = Number(coefficient + "e" + (Number(exponent) + decimals));
|
|
3607
|
+
const rounded = Math.floor(shifted + 0.5) / 10 ** decimals;
|
|
3608
|
+
let text5 = (Math.sign(value) * rounded).toFixed(decimals);
|
|
3609
|
+
if (optional && text5.includes(".")) text5 = text5.replace(/\.?0+$/, "");
|
|
3610
|
+
if (match[1]) {
|
|
3611
|
+
const [whole, fraction] = text5.split(".");
|
|
3612
|
+
text5 = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (fraction ? `.${fraction}` : "");
|
|
3613
|
+
}
|
|
3614
|
+
return text5 === "-0" ? "0" : text5;
|
|
3615
|
+
}
|
|
3616
|
+
var VISIO_FIELD_FORMATS = {
|
|
3617
|
+
shortDate: "{{M/d/yyyy}}",
|
|
3618
|
+
isoDate: "{{yyyy-MM-dd}}",
|
|
3619
|
+
longDate: "{{dddd, MMMM d, yyyy}}",
|
|
3620
|
+
time: "{{h:mm tt}}",
|
|
3621
|
+
dateTime: "{{M/d/yyyy h:mm tt}}",
|
|
3622
|
+
text: "@",
|
|
3623
|
+
integer: "0",
|
|
3624
|
+
decimal: "0.00",
|
|
3625
|
+
decimalUnits: "0.00 u",
|
|
3626
|
+
integerUnits: "0 u"
|
|
3627
|
+
};
|
|
3628
|
+
function formatVisioFieldValue(value, format4 = "") {
|
|
3629
|
+
const picture = format4.trim();
|
|
3630
|
+
if (value.kind === "string") return picture === "" || picture === "@" ? value.text : void 0;
|
|
3631
|
+
if (value.kind === "date") {
|
|
3632
|
+
const date2 = /^\{\{(.+)\}\}$/.exec(picture)?.[1] ?? (picture ? void 0 : "M/d/yyyy");
|
|
3633
|
+
return date2 === void 0 ? void 0 : formatDate(value.date, date2);
|
|
3634
|
+
}
|
|
3635
|
+
const units2 = / u$/.test(picture);
|
|
3636
|
+
const body = picture.replace(/ u$/, "");
|
|
3637
|
+
let number5 = value.value, suffix = "";
|
|
3638
|
+
if (value.unit === "angle") {
|
|
3639
|
+
number5 = number5 * 180 / Math.PI;
|
|
3640
|
+
suffix = " deg.";
|
|
3641
|
+
} else if (value.unit === "length") suffix = " in.";
|
|
3642
|
+
else if (value.unit !== "scalar") return void 0;
|
|
3643
|
+
const text5 = body === "" || body === "@" ? String(Number(number5.toFixed(4))) : formatNumber(Number(number5.toFixed(10)), body);
|
|
3644
|
+
if (text5 === void 0) return void 0;
|
|
3645
|
+
return units2 || body === "" ? `${text5}${suffix}` : text5;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
// visio/text-field-independent.ts
|
|
3649
|
+
function independentTextFieldFormula(cell, formula) {
|
|
3650
|
+
const row2 = cell.parentNode, section3 = row2?.parentNode;
|
|
3651
|
+
if (cell.localName !== "Cell" || row2?.localName !== "Row" || section3?.localName !== "Section" || attribute2(section3, "N") !== "Field" || row2.hasAttribute("Del") || section3.hasAttribute("Del") || row2.hasAttribute("N") || row2.hasAttribute("T") || !/^(0|[1-9]\d*)$/.test(attribute2(row2, "IX") ?? "0") || (attribute2(section3, "IX") ?? "0") !== "0" || cell.hasAttribute("E"))
|
|
3652
|
+
return false;
|
|
3653
|
+
if (attribute2(cell, "N") === "Format")
|
|
3654
|
+
return /^\s*FIELDPICTURE\(\s*(2|37|204)\s*\)\s*$/i.test(formula);
|
|
3655
|
+
if (attribute2(cell, "N") !== "Value") return false;
|
|
3656
|
+
if (/^\s*DATE\(\s*\d{1,4}\s*,\s*\d{1,2}\s*,\s*\d{1,2}\s*\)\s*$/i.test(formula)) return true;
|
|
3657
|
+
const direct = /^\s*([A-Z]+)\(\s*\)\s*$/i.exec(formula)?.[1]?.toUpperCase();
|
|
3658
|
+
return direct !== void 0 && VISIO_FIELD_FUNCTIONS.includes(direct);
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3459
3661
|
// visio/edit-connector-glue.ts
|
|
3460
3662
|
var VISIO_WALK_GLUE = "_WALKGLUE(BegTrigger,EndTrigger,WalkPreference)";
|
|
3461
3663
|
var walkGlue = /^\s*_WALKGLUE\((?:BegTrigger,EndTrigger|EndTrigger,BegTrigger),WalkPreference\)\s*$/i;
|
|
@@ -3565,7 +3767,7 @@ function indexCells(roots, options) {
|
|
|
3565
3767
|
unit: cellUnit(cell, relative)
|
|
3566
3768
|
};
|
|
3567
3769
|
const source = attribute2(node2, "F");
|
|
3568
|
-
if (executableCellFormula(source) && !inertDoubleClickFormula(cell, source) && !(glue2 && isNativeGlueCell(cell, source)) && // A trigger only counts events of the sheet it names; an unglued connector keeps one
|
|
3770
|
+
if (executableCellFormula(source) && !independentTextFieldFormula(node2, source) && !inertDoubleClickFormula(cell, source) && !(glue2 && isNativeGlueCell(cell, source)) && // A trigger only counts events of the sheet it names; an unglued connector keeps one
|
|
3569
3771
|
// (Visio's freshly dropped connector names its own sheet).
|
|
3570
3772
|
!(/^(BegTrigger|EndTrigger)$/.test(cell) && isNativeGlueCell(cell, source))) {
|
|
3571
3773
|
try {
|
|
@@ -6782,6 +6984,77 @@ async function prepareImages(shapes, pkg, sourcePart, report, options, converter
|
|
|
6782
6984
|
}
|
|
6783
6985
|
}
|
|
6784
6986
|
|
|
6987
|
+
// visio/text-field-source.ts
|
|
6988
|
+
var proofs = /* @__PURE__ */ new WeakMap();
|
|
6989
|
+
function textFieldSourceKey(cells4) {
|
|
6990
|
+
if (proofs.has(cells4)) return proofs.get(cells4);
|
|
6991
|
+
if (cells4.size > 64) {
|
|
6992
|
+
proofs.set(cells4, void 0);
|
|
6993
|
+
return void 0;
|
|
6994
|
+
}
|
|
6995
|
+
const key2 = JSON.stringify(
|
|
6996
|
+
[...cells4].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name3, cell]) => [
|
|
6997
|
+
name3,
|
|
6998
|
+
cell.value ?? null,
|
|
6999
|
+
cell.formula ?? null,
|
|
7000
|
+
cell.unit ?? null,
|
|
7001
|
+
cell.error ?? null
|
|
7002
|
+
])
|
|
7003
|
+
);
|
|
7004
|
+
const bounded6 = key2.length <= 2048 ? key2 : void 0;
|
|
7005
|
+
proofs.set(cells4, bounded6);
|
|
7006
|
+
return bounded6;
|
|
7007
|
+
}
|
|
7008
|
+
|
|
7009
|
+
// visio/text-field-editability.ts
|
|
7010
|
+
function assertEditableFieldRow(existing) {
|
|
7011
|
+
for (const name3 of ["Calendar", "ObjectKind"]) {
|
|
7012
|
+
const cell = children2(existing, "Cell").find((cell2) => attribute2(cell2, "N") === name3);
|
|
7013
|
+
if (cell && (attribute2(cell, "V") !== "0" || cell.hasAttribute("F") || cell.hasAttribute("E")))
|
|
7014
|
+
fail(
|
|
7015
|
+
"UNSUPPORTED_TEXT_FIELD",
|
|
7016
|
+
"Nonstandard field calendar or object profiles cannot be edited."
|
|
7017
|
+
);
|
|
7018
|
+
}
|
|
7019
|
+
for (const cell of children2(existing, "Cell")) {
|
|
7020
|
+
const name3 = attribute2(cell, "N") ?? "";
|
|
7021
|
+
if (/^(value|format|type|calendar|objectkind)$/i.test(name3) && !["Value", "Format", "Type", "Calendar", "ObjectKind"].includes(name3))
|
|
7022
|
+
fail("UNSUPPORTED_TEXT_FIELD", "Noncanonical field cell names cannot be edited.");
|
|
7023
|
+
if (["Value", "Format", "Type"].includes(attribute2(cell, "N") ?? "") && (cell.hasAttribute("E") || /^\s*(Inh|GUARD\s*\()/i.test(attribute2(cell, "F") ?? "")))
|
|
7024
|
+
fail("UNSUPPORTED_TEXT_FIELD", "Protected or inherited field cells cannot be edited.");
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
function assertEditableFieldShape(shape) {
|
|
7028
|
+
if (shape.localName !== "Shape" || shape.parentNode?.parentNode?.localName !== "PageContents" || shape.hasAttribute("Master") || shape.hasAttribute("MasterShape") || attribute2(shape, "Type") === "Group" || ["Shapes", "ForeignData", "Rel"].some((name3) => children2(shape, name3).length))
|
|
7029
|
+
fail("UNSUPPORTED_TEXT_FIELD", "Existing field edits require a top-level plain local shape.");
|
|
7030
|
+
}
|
|
7031
|
+
function editableTextFieldIndices(text5, allowed) {
|
|
7032
|
+
const result = /* @__PURE__ */ new Set();
|
|
7033
|
+
if (!allowed || !text5) return result;
|
|
7034
|
+
const shape = text5.parentNode;
|
|
7035
|
+
try {
|
|
7036
|
+
assertEditableFieldShape(shape);
|
|
7037
|
+
assertFormattingText(shape);
|
|
7038
|
+
const rows = formattingRows(shape, "Field");
|
|
7039
|
+
const markers = children2(text5, "fld");
|
|
7040
|
+
const counts = /* @__PURE__ */ new Map();
|
|
7041
|
+
for (const marker2 of markers) {
|
|
7042
|
+
const index = attribute2(marker2, "IX");
|
|
7043
|
+
counts.set(index, (counts.get(index) ?? 0) + 1);
|
|
7044
|
+
}
|
|
7045
|
+
for (const [index, row2] of rows) {
|
|
7046
|
+
if (counts.get(index) !== 1 || textFieldSourceKey(readCells(row2)) === void 0) continue;
|
|
7047
|
+
try {
|
|
7048
|
+
assertEditableFieldRow(row2);
|
|
7049
|
+
result.add(index);
|
|
7050
|
+
} catch {
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
} catch {
|
|
7054
|
+
}
|
|
7055
|
+
return result;
|
|
7056
|
+
}
|
|
7057
|
+
|
|
6785
7058
|
// geometry/svg-path-curves.ts
|
|
6786
7059
|
function sampleCubic(p0, p1, p2, p3, segments, out) {
|
|
6787
7060
|
for (let i = 1; i <= segments; i++) {
|
|
@@ -8881,195 +9154,35 @@ function visioFieldCase(text5, upper) {
|
|
|
8881
9154
|
}).join("");
|
|
8882
9155
|
}
|
|
8883
9156
|
|
|
8884
|
-
// visio/text-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
DOCLASTEDIT: "modified",
|
|
8900
|
-
DOCLASTPRINT: "lastPrinted"
|
|
8901
|
-
};
|
|
8902
|
-
var VISIO_FIELD_FUNCTIONS = [
|
|
8903
|
-
...Object.keys(PROPERTY_FUNCTIONS),
|
|
8904
|
-
...Object.keys(DATE_FUNCTIONS),
|
|
8905
|
-
"PAGENAME"
|
|
8906
|
-
];
|
|
8907
|
-
function visioWallClock(date2) {
|
|
8908
|
-
return new Date(
|
|
8909
|
-
Date.UTC(
|
|
8910
|
-
date2.getFullYear(),
|
|
8911
|
-
date2.getMonth(),
|
|
8912
|
-
date2.getDate(),
|
|
8913
|
-
date2.getHours(),
|
|
8914
|
-
date2.getMinutes(),
|
|
8915
|
-
date2.getSeconds()
|
|
8916
|
-
)
|
|
8917
|
-
);
|
|
8918
|
-
}
|
|
8919
|
-
var EPOCH = Date.UTC(1899, 11, 30);
|
|
8920
|
-
var visioDateSerial = (date2) => Number(((date2.getTime() - EPOCH) / 864e5).toFixed(8));
|
|
8921
|
-
var visioSerialDate = (serial) => Number.isFinite(serial) && Math.abs(serial) < 3e6 ? new Date(EPOCH + Math.round(serial * 864e5)) : void 0;
|
|
8922
|
-
function evaluateVisioTextField(formula, context) {
|
|
8923
|
-
let ast;
|
|
8924
|
-
try {
|
|
8925
|
-
ast = parseVisioFormula(formula, { maxLength: 4096 });
|
|
8926
|
-
} catch {
|
|
8927
|
-
return void 0;
|
|
8928
|
-
}
|
|
8929
|
-
if (ast.kind === "call") {
|
|
8930
|
-
const name3 = ast.name;
|
|
8931
|
-
if (Object.hasOwn(PROPERTY_FUNCTIONS, name3) && !ast.args.length) {
|
|
8932
|
-
const value = context.properties?.[PROPERTY_FUNCTIONS[name3]];
|
|
8933
|
-
return value === void 0 ? void 0 : { kind: "string", text: value };
|
|
8934
|
-
}
|
|
8935
|
-
if (Object.hasOwn(DATE_FUNCTIONS, name3) && !ast.args.length) {
|
|
8936
|
-
if (name3 === "NOW") return context.now ? { kind: "date", date: context.now } : void 0;
|
|
8937
|
-
const stamp = context.properties?.[DATE_FUNCTIONS[name3]];
|
|
8938
|
-
const time = stamp ? Date.parse(stamp) : Number.NaN;
|
|
8939
|
-
return Number.isFinite(time) ? { kind: "date", date: visioWallClock(new Date(time)) } : void 0;
|
|
8940
|
-
}
|
|
8941
|
-
if (name3 === "PAGENAME" && ast.args.length <= 1)
|
|
8942
|
-
return context.pageName === void 0 ? void 0 : { kind: "string", text: context.pageName };
|
|
8943
|
-
}
|
|
8944
|
-
try {
|
|
8945
|
-
const result = evaluateVisioFormula(
|
|
8946
|
-
ast,
|
|
8947
|
-
context.resolve ?? (() => {
|
|
8948
|
-
throw new Error("No cell context");
|
|
8949
|
-
}),
|
|
8950
|
-
{
|
|
8951
|
-
...context.pageNumber === void 0 ? {} : { pageNumber: context.pageNumber },
|
|
8952
|
-
...context.pageCount === void 0 ? {} : { pageCount: context.pageCount }
|
|
8953
|
-
}
|
|
8954
|
-
);
|
|
8955
|
-
return { kind: "number", value: result.value, unit: result.unit };
|
|
8956
|
-
} catch {
|
|
8957
|
-
return void 0;
|
|
8958
|
-
}
|
|
8959
|
-
}
|
|
8960
|
-
var MONTHS = [
|
|
8961
|
-
"January",
|
|
8962
|
-
"February",
|
|
8963
|
-
"March",
|
|
8964
|
-
"April",
|
|
8965
|
-
"May",
|
|
8966
|
-
"June",
|
|
8967
|
-
"July",
|
|
8968
|
-
"August",
|
|
8969
|
-
"September",
|
|
8970
|
-
"October",
|
|
8971
|
-
"November",
|
|
8972
|
-
"December"
|
|
8973
|
-
];
|
|
8974
|
-
var DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
8975
|
-
var pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
8976
|
-
function dateToken(date2, token) {
|
|
8977
|
-
const hours = date2.getUTCHours();
|
|
8978
|
-
switch (token) {
|
|
8979
|
-
case "yyyy":
|
|
8980
|
-
return pad(date2.getUTCFullYear(), 4);
|
|
8981
|
-
case "yy":
|
|
8982
|
-
return pad(date2.getUTCFullYear() % 100);
|
|
8983
|
-
case "MMMM":
|
|
8984
|
-
return MONTHS[date2.getUTCMonth()];
|
|
8985
|
-
case "MMM":
|
|
8986
|
-
return MONTHS[date2.getUTCMonth()].slice(0, 3);
|
|
8987
|
-
case "MM":
|
|
8988
|
-
return pad(date2.getUTCMonth() + 1);
|
|
8989
|
-
case "M":
|
|
8990
|
-
return String(date2.getUTCMonth() + 1);
|
|
8991
|
-
case "dddd":
|
|
8992
|
-
return DAYS[date2.getUTCDay()];
|
|
8993
|
-
case "ddd":
|
|
8994
|
-
return DAYS[date2.getUTCDay()].slice(0, 3);
|
|
8995
|
-
case "dd":
|
|
8996
|
-
return pad(date2.getUTCDate());
|
|
8997
|
-
case "d":
|
|
8998
|
-
return String(date2.getUTCDate());
|
|
8999
|
-
case "HH":
|
|
9000
|
-
return pad(hours);
|
|
9001
|
-
case "H":
|
|
9002
|
-
return String(hours);
|
|
9003
|
-
case "hh":
|
|
9004
|
-
return pad(hours % 12 || 12);
|
|
9005
|
-
case "h":
|
|
9006
|
-
return String(hours % 12 || 12);
|
|
9007
|
-
case "mm":
|
|
9008
|
-
return pad(date2.getUTCMinutes());
|
|
9009
|
-
case "ss":
|
|
9010
|
-
return pad(date2.getUTCSeconds());
|
|
9011
|
-
case "tt":
|
|
9012
|
-
return hours < 12 ? "AM" : "PM";
|
|
9013
|
-
default:
|
|
9014
|
-
return void 0;
|
|
9015
|
-
}
|
|
9016
|
-
}
|
|
9017
|
-
function formatDate(date2, picture) {
|
|
9018
|
-
return picture.replace(
|
|
9019
|
-
/yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|HH|H|hh|h|mm|ss|tt|"[^"]*"/g,
|
|
9020
|
-
(token) => {
|
|
9021
|
-
if (token.startsWith('"')) return token.slice(1, -1);
|
|
9022
|
-
return dateToken(date2, token) ?? token;
|
|
9157
|
+
// visio/text-field-fraction.ts
|
|
9158
|
+
function fractionalFieldNumber(value, maxDenominator) {
|
|
9159
|
+
if (!Number.isFinite(value) || Math.abs(value) > 1e15) return void 0;
|
|
9160
|
+
const absolute = Math.abs(value);
|
|
9161
|
+
let whole = Math.floor(absolute);
|
|
9162
|
+
const remainder = absolute - whole;
|
|
9163
|
+
let numerator = 0, denominator = 1, error = remainder;
|
|
9164
|
+
for (let candidate = 1; candidate <= maxDenominator; candidate++) {
|
|
9165
|
+
const top = Math.round(remainder * candidate);
|
|
9166
|
+
const fraction = top / candidate;
|
|
9167
|
+
const distance4 = Math.abs(remainder - fraction);
|
|
9168
|
+
if (distance4 < error || distance4 === error && fraction > numerator / denominator) {
|
|
9169
|
+
numerator = top;
|
|
9170
|
+
denominator = candidate;
|
|
9171
|
+
error = distance4;
|
|
9023
9172
|
}
|
|
9024
|
-
);
|
|
9025
|
-
}
|
|
9026
|
-
function formatNumber(value, picture) {
|
|
9027
|
-
const match = /^(#,##)?0(?:\.(0+|#+))?$/.exec(picture);
|
|
9028
|
-
if (!match) return void 0;
|
|
9029
|
-
const decimals = match[2]?.length ?? 0;
|
|
9030
|
-
const optional = match[2]?.startsWith("#") ?? false;
|
|
9031
|
-
let text5 = value.toFixed(decimals);
|
|
9032
|
-
if (optional && text5.includes(".")) text5 = text5.replace(/\.?0+$/, "");
|
|
9033
|
-
if (match[1]) {
|
|
9034
|
-
const [whole, fraction] = text5.split(".");
|
|
9035
|
-
text5 = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (fraction ? `.${fraction}` : "");
|
|
9036
9173
|
}
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
shortDate: "{{M/d/yyyy}}",
|
|
9041
|
-
longDate: "{{dddd, MMMM d, yyyy}}",
|
|
9042
|
-
time: "{{h:mm tt}}",
|
|
9043
|
-
dateTime: "{{M/d/yyyy h:mm tt}}",
|
|
9044
|
-
text: "@",
|
|
9045
|
-
integer: "0",
|
|
9046
|
-
decimal: "0.00",
|
|
9047
|
-
decimalUnits: "0.00 u",
|
|
9048
|
-
integerUnits: "0 u"
|
|
9049
|
-
};
|
|
9050
|
-
function formatVisioFieldValue(value, format4 = "") {
|
|
9051
|
-
const picture = format4.trim();
|
|
9052
|
-
if (value.kind === "string") return picture === "" || picture === "@" ? value.text : void 0;
|
|
9053
|
-
if (value.kind === "date") {
|
|
9054
|
-
const date2 = /^\{\{(.+)\}\}$/.exec(picture)?.[1] ?? (picture ? void 0 : "M/d/yyyy");
|
|
9055
|
-
return date2 === void 0 ? void 0 : formatDate(value.date, date2);
|
|
9174
|
+
if (numerator === denominator) {
|
|
9175
|
+
whole++;
|
|
9176
|
+
numerator = 0;
|
|
9056
9177
|
}
|
|
9057
|
-
const
|
|
9058
|
-
|
|
9059
|
-
let number5 = value.value, suffix = "";
|
|
9060
|
-
if (value.unit === "angle") {
|
|
9061
|
-
number5 = number5 * 180 / Math.PI;
|
|
9062
|
-
suffix = " deg.";
|
|
9063
|
-
} else if (value.unit === "length") suffix = " in.";
|
|
9064
|
-
else if (value.unit !== "scalar") return void 0;
|
|
9065
|
-
const text5 = body === "" || body === "@" ? String(Number(number5.toFixed(4))) : formatNumber(Number(number5.toFixed(10)), body);
|
|
9066
|
-
if (text5 === void 0) return void 0;
|
|
9067
|
-
return units2 || body === "" ? `${text5}${suffix}` : text5;
|
|
9178
|
+
const text5 = numerator ? `${whole ? whole + " " : ""}${numerator}/${denominator}` : String(whole);
|
|
9179
|
+
return value < 0 && text5 !== "0" ? "-" + text5 : text5;
|
|
9068
9180
|
}
|
|
9069
9181
|
|
|
9070
9182
|
// visio/text-field-numeric.ts
|
|
9071
9183
|
function numericFieldPicture(value, code, displayUnit) {
|
|
9072
|
-
if (value.kind !== "number" || code <
|
|
9184
|
+
if (value.kind !== "number" || code < 0 || code > 18 || code > 9 && code < 15 || !Number.isInteger(code))
|
|
9185
|
+
return void 0;
|
|
9073
9186
|
const unit3 = displayUnit?.toUpperCase() ?? "NUM";
|
|
9074
9187
|
const units2 = {
|
|
9075
9188
|
NUM: ["scalar", 1, ""],
|
|
@@ -9082,21 +9195,106 @@ function numericFieldPicture(value, code, displayUnit) {
|
|
|
9082
9195
|
};
|
|
9083
9196
|
const definition = Object.hasOwn(units2, unit3) ? units2[unit3] : void 0;
|
|
9084
9197
|
if (!definition || definition[0] !== value.unit) return void 0;
|
|
9085
|
-
const
|
|
9086
|
-
const
|
|
9087
|
-
const
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
)
|
|
9198
|
+
const general = code < 2;
|
|
9199
|
+
const decimals = general ? 4 : Math.floor((code - 2) / 2);
|
|
9200
|
+
const picture = general ? "0.####" : decimals ? `0.${"0".repeat(decimals)}` : "0";
|
|
9201
|
+
const displayed = value.value * definition[1];
|
|
9202
|
+
if (!Number.isFinite(displayed)) return void 0;
|
|
9203
|
+
if (code >= 15) {
|
|
9204
|
+
const fraction = fractionalFieldNumber(displayed, code < 17 ? 9 : 99);
|
|
9205
|
+
return fraction === void 0 ? void 0 : fraction + (code % 2 === 0 ? definition[2] : "");
|
|
9206
|
+
}
|
|
9207
|
+
if ((general || !decimals) && Math.abs(displayed) > 1e15) return void 0;
|
|
9208
|
+
const scientific = decimals > 0 && (Math.abs(displayed) >= 1e15 || displayed !== 0 && Math.abs(displayed) < 0.5 / 10 ** decimals);
|
|
9209
|
+
let text5;
|
|
9210
|
+
if (scientific) {
|
|
9211
|
+
const [coefficient, power] = displayed.toExponential().split("e");
|
|
9212
|
+
let exponent = Number(power);
|
|
9213
|
+
let precision = Math.abs(displayed) >= 1e15 ? decimals : decimals - 1;
|
|
9214
|
+
const mantissaPicture = precision ? `0.${"0".repeat(precision)}` : "0";
|
|
9215
|
+
let mantissa = formatVisioFieldValue(
|
|
9216
|
+
{ kind: "number", value: Number(coefficient), unit: "scalar" },
|
|
9217
|
+
mantissaPicture
|
|
9218
|
+
);
|
|
9219
|
+
if (mantissa === void 0) return void 0;
|
|
9220
|
+
if (Math.abs(Number(mantissa)) >= 10) {
|
|
9221
|
+
exponent += 1;
|
|
9222
|
+
precision = decimals;
|
|
9223
|
+
mantissa = Math.sign(displayed).toFixed(precision);
|
|
9224
|
+
}
|
|
9225
|
+
if (general) mantissa = mantissa.replace(/\.?0+$/, "");
|
|
9226
|
+
else if (!mantissa.includes(".")) mantissa += ".";
|
|
9227
|
+
text5 = mantissa + (code % 2 ? "e" : "E") + exponent;
|
|
9228
|
+
} else {
|
|
9229
|
+
text5 = formatVisioFieldValue({ kind: "number", value: displayed, unit: "scalar" }, picture);
|
|
9230
|
+
}
|
|
9091
9231
|
return text5 === void 0 ? void 0 : text5 + (code % 2 ? definition[2] : "");
|
|
9092
9232
|
}
|
|
9093
9233
|
|
|
9234
|
+
// visio/date-cache.ts
|
|
9235
|
+
function visioIsoDateSerial(text5) {
|
|
9236
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/.exec(
|
|
9237
|
+
text5.trim()
|
|
9238
|
+
);
|
|
9239
|
+
if (!match) return void 0;
|
|
9240
|
+
const year = Number(match[1]), month = Number(match[2]), day = Number(match[3]);
|
|
9241
|
+
const hour = Number(match[4] ?? 0), minute = Number(match[5] ?? 0), second = Number(match[6] ?? 0);
|
|
9242
|
+
const millisecond = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
|
|
9243
|
+
if (year < 1 || hour > 23 || minute > 59 || second > 59) return void 0;
|
|
9244
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
|
9245
|
+
date2.setUTCFullYear(year, month - 1, day);
|
|
9246
|
+
date2.setUTCHours(hour, minute, second, millisecond);
|
|
9247
|
+
if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month - 1 || date2.getUTCDate() !== day)
|
|
9248
|
+
return void 0;
|
|
9249
|
+
return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
|
|
9250
|
+
}
|
|
9251
|
+
|
|
9252
|
+
// visio/text-field-system-date.ts
|
|
9253
|
+
var LONG_DATE = "{{dddd, MMMM d, yyyy}}";
|
|
9254
|
+
function englishLongDateProfile(cached5) {
|
|
9255
|
+
const match = /^[A-Za-z]+, [A-Za-z]+ ([1-9]|[12]\d|3[01]), (\d{4})$/.exec(cached5);
|
|
9256
|
+
if (!match) return false;
|
|
9257
|
+
for (let month = 0; month < 12; month++) {
|
|
9258
|
+
const candidate = /* @__PURE__ */ new Date(0);
|
|
9259
|
+
candidate.setUTCFullYear(Number(match[2]), month, Number(match[1]));
|
|
9260
|
+
if (candidate.getUTCMonth() === month && candidate.getTime() >= Date.UTC(1899, 11, 30) && formatVisioFieldValue({ kind: "date", date: candidate }, LONG_DATE) === cached5)
|
|
9261
|
+
return true;
|
|
9262
|
+
}
|
|
9263
|
+
return false;
|
|
9264
|
+
}
|
|
9265
|
+
function systemDatePicture(date2, code, cached5) {
|
|
9266
|
+
if (!Number.isFinite(date2.getTime()) || date2.getTime() < Date.UTC(1899, 11, 30) || date2.getUTCFullYear() > 9999)
|
|
9267
|
+
return void 0;
|
|
9268
|
+
if (code === "204") return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
|
|
9269
|
+
if (code === "21" || code === "201")
|
|
9270
|
+
return englishLongDateProfile(cached5) ? formatVisioFieldValue({ kind: "date", date: date2 }, LONG_DATE) : void 0;
|
|
9271
|
+
if (code === "20" || code === "200") {
|
|
9272
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(cached5) || visioIsoDateSerial(cached5) === void 0)
|
|
9273
|
+
return void 0;
|
|
9274
|
+
return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
|
|
9275
|
+
}
|
|
9276
|
+
if (code !== "211" && code !== "212") return void 0;
|
|
9277
|
+
const match = /^(\d{4}-\d{2}-\d{2}) ([1-9]|1[0-2]):([0-5]\d)(?::([0-5]\d))? (AM|PM)$/.exec(
|
|
9278
|
+
cached5
|
|
9279
|
+
);
|
|
9280
|
+
if (!match || code === "212" !== (match[4] !== void 0)) return void 0;
|
|
9281
|
+
const hour = Number(match[2]) % 12 + (match[5] === "PM" ? 12 : 0);
|
|
9282
|
+
if (visioIsoDateSerial(
|
|
9283
|
+
`${match[1]}T${String(hour).padStart(2, "0")}:${match[3]}:${match[4] ?? "00"}`
|
|
9284
|
+
) === void 0)
|
|
9285
|
+
return void 0;
|
|
9286
|
+
return formatVisioFieldValue(
|
|
9287
|
+
{ kind: "date", date: date2 },
|
|
9288
|
+
code === "211" ? "{{yyyy-MM-dd h:mm tt}}" : "{{yyyy-MM-dd h:mm:ss tt}}"
|
|
9289
|
+
);
|
|
9290
|
+
}
|
|
9291
|
+
|
|
9094
9292
|
// visio/text-field-display.ts
|
|
9095
9293
|
function cachedValue(value, unit3) {
|
|
9096
9294
|
if (value === void 0) return void 0;
|
|
9097
9295
|
if (unit3 === "STR") return { kind: "string", text: value };
|
|
9098
9296
|
if (unit3 === "DATE") {
|
|
9099
|
-
const date2 = visioSerialDate(Number(value));
|
|
9297
|
+
const date2 = visioSerialDate(visioIsoDateSerial(value) ?? Number(value));
|
|
9100
9298
|
return date2 ? { kind: "date", date: date2 } : void 0;
|
|
9101
9299
|
}
|
|
9102
9300
|
try {
|
|
@@ -9112,7 +9310,12 @@ function textFieldDisplay(element2, sheet, context) {
|
|
|
9112
9310
|
const row2 = sectionRows(sheet, "Field").find((candidate) => candidate.index === index);
|
|
9113
9311
|
const value = row2?.cells.get("Value"), format4 = row2?.cells.get("Format");
|
|
9114
9312
|
const formula = value?.formula && value.formula !== "Inh" ? value.formula : void 0;
|
|
9115
|
-
const
|
|
9313
|
+
const sourceKey = row2 ? textFieldSourceKey(row2.cells) : void 0;
|
|
9314
|
+
const result = {
|
|
9315
|
+
cached: cached5,
|
|
9316
|
+
...formula ? { formula } : {},
|
|
9317
|
+
...sourceKey !== void 0 ? { index, format: format4?.value ?? "", sourceKey } : {}
|
|
9318
|
+
};
|
|
9116
9319
|
if (!row2 || !context) return { text: cached5, ...result };
|
|
9117
9320
|
const picture = format4?.value ?? "";
|
|
9118
9321
|
const evaluated = formula ? evaluateVisioTextField(formula, context) : void 0;
|
|
@@ -9126,6 +9329,8 @@ function textFieldDisplay(element2, sheet, context) {
|
|
|
9126
9329
|
}
|
|
9127
9330
|
if (source?.kind === "number" && code !== void 0)
|
|
9128
9331
|
text6 = numericFieldPicture(source, Number(code), value?.unit) ?? cached5;
|
|
9332
|
+
if (source?.kind === "date" && code !== void 0)
|
|
9333
|
+
text6 = systemDatePicture(source.date, code, cached5) ?? cached5;
|
|
9129
9334
|
return { text: text6, ...result };
|
|
9130
9335
|
}
|
|
9131
9336
|
const text5 = source ? formatVisioFieldValue(source, picture) : void 0;
|
|
@@ -9984,7 +10189,8 @@ function runStyle(cells4, resources, report, themeCells) {
|
|
|
9984
10189
|
...characterExtras(cells4, report)
|
|
9985
10190
|
};
|
|
9986
10191
|
}
|
|
9987
|
-
function shapeText(sheet, node2, width, height, resources, report, consume, consumeParagraph) {
|
|
10192
|
+
function shapeText(sheet, node2, width, height, resources, report, consume, consumeParagraph, allowFieldEditing = false) {
|
|
10193
|
+
const editableFields = editableTextFieldIndices(node2, allowFieldEditing);
|
|
9988
10194
|
const cells4 = sheet.cells;
|
|
9989
10195
|
const characters = new Map(sectionRows(sheet, "Character").map((row2) => [row2.index, row2.cells]));
|
|
9990
10196
|
const defaultCells = characters.get("0") ?? /* @__PURE__ */ new Map();
|
|
@@ -10019,7 +10225,9 @@ function shapeText(sheet, node2, width, height, resources, report, consume, cons
|
|
|
10019
10225
|
start: textOffset,
|
|
10020
10226
|
end: textOffset + field2.text.length,
|
|
10021
10227
|
cached: field2.cached,
|
|
10022
|
-
...field2.
|
|
10228
|
+
...field2.index !== void 0 && editableFields.has(field2.index) ? { editable: true } : {},
|
|
10229
|
+
...field2.formula ? { formula: field2.formula } : {},
|
|
10230
|
+
...field2.index === void 0 ? {} : { index: field2.index, format: field2.format, sourceKey: field2.sourceKey }
|
|
10023
10231
|
});
|
|
10024
10232
|
append(field2.text);
|
|
10025
10233
|
} else if (element2.localName !== "pp" && element2.localName !== "tp") {
|
|
@@ -10582,15 +10790,6 @@ function booleanValue(text5) {
|
|
|
10582
10790
|
const value = numeric3(text5);
|
|
10583
10791
|
return value === void 0 ? void 0 : value !== 0;
|
|
10584
10792
|
}
|
|
10585
|
-
function isoSerialDays(text5) {
|
|
10586
|
-
const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?)?$/.exec(
|
|
10587
|
-
text5.trim()
|
|
10588
|
-
);
|
|
10589
|
-
if (!match) return void 0;
|
|
10590
|
-
const [year, month, day, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
|
|
10591
|
-
const time = Date.UTC(year, month - 1, day, hour, minute, second);
|
|
10592
|
-
return Number.isFinite(time) ? (time - Date.UTC(1899, 11, 30)) / 864e5 : void 0;
|
|
10593
|
-
}
|
|
10594
10793
|
function property(row2, budget, report) {
|
|
10595
10794
|
const get = (key2) => cached(row2.cells, key2, budget, report);
|
|
10596
10795
|
const rawType = get("Type"), rawValue = get("Value");
|
|
@@ -10601,7 +10800,7 @@ function property(row2, budget, report) {
|
|
|
10601
10800
|
if (rawValue !== void 0 && row2.cells.get("Value")?.error === void 0) {
|
|
10602
10801
|
if (type === 0 || type === 1 || type === 4) value = budget.retain(rawValue);
|
|
10603
10802
|
else if (type === 3) value = booleanValue(rawValue);
|
|
10604
|
-
else if (type === 5) value = numeric3(rawValue) ??
|
|
10803
|
+
else if (type === 5) value = numeric3(rawValue) ?? visioIsoDateSerial(rawValue);
|
|
10605
10804
|
else if (valueKind !== "unparsed") value = numeric3(rawValue);
|
|
10606
10805
|
}
|
|
10607
10806
|
if (value === void 0) {
|
|
@@ -11307,7 +11506,8 @@ function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
|
11307
11506
|
context.resources,
|
|
11308
11507
|
report,
|
|
11309
11508
|
context.consumeText,
|
|
11310
|
-
context.consumeParagraph
|
|
11509
|
+
context.consumeParagraph,
|
|
11510
|
+
depth === 0 && masterId === void 0 && !sheet.cells.get("LockTextEdit")?.error && !sheet.cells.get("LockTextEdit")?.formula && number(sheet.cells, "LockTextEdit", 0, report) === 0
|
|
11311
11511
|
),
|
|
11312
11512
|
hidden: membership.hidden || type === "Guide" || number(sheet.cells, "NoShow", 0, report) !== 0,
|
|
11313
11513
|
visibility: {
|
|
@@ -21950,6 +22150,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
21950
22150
|
continue;
|
|
21951
22151
|
const source = executableCellFormula(attribute2(node2, "F"));
|
|
21952
22152
|
if (!source || inertDoubleClickFormula(attribute2(node2, "N") ?? "", source)) continue;
|
|
22153
|
+
if (independentTextFieldFormula(node2, source)) continue;
|
|
21953
22154
|
if (attribute2(node2, "V") === "Themed" && isThemeLookupFormula(source)) continue;
|
|
21954
22155
|
if (isConnectedGlueCell(node2, source)) continue;
|
|
21955
22156
|
const owner = node2.parentNode;
|
|
@@ -26819,7 +27020,8 @@ function shapeResolver(shape) {
|
|
|
26819
27020
|
}
|
|
26820
27021
|
function valueCell(value) {
|
|
26821
27022
|
if (value.kind === "string") return { v: value.text, u: "STR", type: 0 };
|
|
26822
|
-
if (value.kind === "date")
|
|
27023
|
+
if (value.kind === "date")
|
|
27024
|
+
return { v: value.date.toISOString().replace(/Z$/, ""), u: "DATE", type: 5 };
|
|
26823
27025
|
const unit3 = value.unit === "length" ? "IN" : value.unit === "angle" ? "DEG" : void 0;
|
|
26824
27026
|
return { v: String(Number(value.value.toFixed(10))), ...unit3 ? { u: unit3 } : {}, type: 2 };
|
|
26825
27027
|
}
|
|
@@ -26859,9 +27061,23 @@ async function insertVisioTextField(pkg, pagePaths, roots, document, edit, check
|
|
|
26859
27061
|
effectiveFormattingRows(shape, document, "Paragraph")
|
|
26860
27062
|
);
|
|
26861
27063
|
const rows = formattingRows(shape, "Field");
|
|
26862
|
-
const
|
|
26863
|
-
if (
|
|
27064
|
+
const updating = edit.type === "update-text-field";
|
|
27065
|
+
if (updating) assertEditableFieldShape(shape);
|
|
27066
|
+
const point2 = insertionPoint(text5, updating ? void 0 : edit.offset);
|
|
27067
|
+
if ((updating || edit.offset !== void 0) && point2.logical !== edit.expectedText)
|
|
26864
27068
|
fail("EDIT_STALE_TEXT", "The shape text changed since the field position was chosen.");
|
|
27069
|
+
const existing = updating ? rows.get(edit.fieldIndex) : void 0;
|
|
27070
|
+
const markers = updating ? children2(text5, "fld").filter((field3) => attribute2(field3, "IX") === edit.fieldIndex) : [];
|
|
27071
|
+
if (updating) {
|
|
27072
|
+
if (!existing || markers.length !== 1)
|
|
27073
|
+
fail(
|
|
27074
|
+
"UNSUPPORTED_TEXT_FIELD",
|
|
27075
|
+
"Existing fields require one live local row and unique text marker."
|
|
27076
|
+
);
|
|
27077
|
+
if (markers[0].textContent !== edit.expectedCached || textFieldSourceKey(readCells(existing)) !== edit.expectedSourceKey)
|
|
27078
|
+
fail("EDIT_STALE_TEXT", "The field source changed since it was selected.");
|
|
27079
|
+
assertEditableFieldRow(existing);
|
|
27080
|
+
}
|
|
26865
27081
|
const context = { ...await pageContext(pkg, edit.pageId), resolve: shapeResolver(shape) };
|
|
26866
27082
|
let value;
|
|
26867
27083
|
try {
|
|
@@ -26874,9 +27090,19 @@ async function insertVisioTextField(pkg, pagePaths, roots, document, edit, check
|
|
|
26874
27090
|
"UNSUPPORTED_TEXT_FIELD",
|
|
26875
27091
|
`This editor cannot evaluate the field formula. Supported: ${VISIO_FIELD_FUNCTIONS.join(", ")}, PAGENUMBER, PAGECOUNT and numeric formulas on this shape.`
|
|
26876
27092
|
);
|
|
26877
|
-
const
|
|
27093
|
+
const format4 = edit.format ?? "";
|
|
27094
|
+
const display = formatVisioFieldValue(value, format4);
|
|
26878
27095
|
if (display === void 0)
|
|
26879
27096
|
fail("UNSUPPORTED_TEXT_FIELD", "The field format does not suit the field value.");
|
|
27097
|
+
const prepared = valueCell(value);
|
|
27098
|
+
if (existing && markers[0].textContent === display) {
|
|
27099
|
+
const same5 = (name3, v, u, f) => {
|
|
27100
|
+
const cell2 = children2(existing, "Cell").find((cell3) => attribute2(cell3, "N") === name3);
|
|
27101
|
+
return attribute2(cell2, "V") === v && attribute2(cell2, "U") === u && attribute2(cell2, "F") === f;
|
|
27102
|
+
};
|
|
27103
|
+
if (same5("Value", prepared.v, prepared.u, edit.formula) && same5("Format", format4, "STR", `"${format4.replaceAll('"', '""')}"`) && same5("Type", String(prepared.type), void 0, void 0))
|
|
27104
|
+
return false;
|
|
27105
|
+
}
|
|
26880
27106
|
if (texts[0])
|
|
26881
27107
|
await assertFormattingDependencies(
|
|
26882
27108
|
pkg,
|
|
@@ -26884,31 +27110,49 @@ async function insertVisioTextField(pkg, pagePaths, roots, document, edit, check
|
|
|
26884
27110
|
roots,
|
|
26885
27111
|
edit.pageId,
|
|
26886
27112
|
shape,
|
|
26887
|
-
|
|
27113
|
+
new Map([
|
|
27114
|
+
["TheText", text5],
|
|
27115
|
+
...existing ? ["Value", "Format", "Type"].flatMap((name3) => {
|
|
27116
|
+
const cell2 = children2(existing, "Cell").find((cell3) => attribute2(cell3, "N") === name3);
|
|
27117
|
+
return [
|
|
27118
|
+
[`Field.${updating ? edit.fieldIndex : ""}.${name3}`, cell2],
|
|
27119
|
+
[`Fields.${name3}`, cell2]
|
|
27120
|
+
];
|
|
27121
|
+
}) : []
|
|
27122
|
+
]),
|
|
26888
27123
|
check
|
|
26889
27124
|
);
|
|
26890
27125
|
check();
|
|
26891
|
-
const index = String(rows.size ? Math.max(...[...rows.keys()].map(Number)) + 1 : 0);
|
|
27126
|
+
const index = updating ? edit.fieldIndex : String(rows.size ? Math.max(...[...rows.keys()].map(Number)) + 1 : 0);
|
|
26892
27127
|
let section3 = children2(shape, "Section").find((node2) => attribute2(node2, "N") === "Field");
|
|
26893
27128
|
if (!section3) {
|
|
26894
27129
|
section3 = owner.createElementNS(ns, "Section");
|
|
26895
27130
|
section3.setAttribute("N", "Field");
|
|
26896
27131
|
shape.insertBefore(section3, texts[0] ?? null);
|
|
26897
27132
|
}
|
|
26898
|
-
const row2 = owner.createElementNS(ns, "Row");
|
|
26899
|
-
row2.setAttribute("IX", index);
|
|
27133
|
+
const row2 = existing ?? owner.createElementNS(ns, "Row");
|
|
27134
|
+
if (!existing) row2.setAttribute("IX", index);
|
|
26900
27135
|
const cell = (name3, v, extra = {}) => {
|
|
26901
|
-
const node2 = owner.createElementNS(ns, "Cell");
|
|
27136
|
+
const node2 = children2(row2, "Cell").find((cell2) => attribute2(cell2, "N") === name3) ?? owner.createElementNS(ns, "Cell");
|
|
26902
27137
|
node2.setAttribute("N", name3);
|
|
26903
27138
|
node2.setAttribute("V", v);
|
|
27139
|
+
if (updating) {
|
|
27140
|
+
node2.removeAttribute("U");
|
|
27141
|
+
node2.removeAttribute("F");
|
|
27142
|
+
}
|
|
26904
27143
|
for (const [key2, item] of Object.entries(extra)) node2.setAttribute(key2, item);
|
|
26905
|
-
row2.appendChild(node2);
|
|
27144
|
+
if (!node2.parentNode) row2.appendChild(node2);
|
|
26906
27145
|
};
|
|
26907
|
-
const stored =
|
|
27146
|
+
const stored = prepared;
|
|
26908
27147
|
cell("Value", stored.v, { ...stored.u ? { U: stored.u } : {}, F: edit.formula });
|
|
26909
|
-
if (
|
|
27148
|
+
if (format4 || updating)
|
|
27149
|
+
cell("Format", format4, { U: "STR", F: `"${format4.replaceAll('"', '""')}"` });
|
|
26910
27150
|
cell("Type", String(stored.type));
|
|
26911
|
-
section3.appendChild(row2);
|
|
27151
|
+
if (!row2.parentNode) section3.appendChild(row2);
|
|
27152
|
+
if (updating) {
|
|
27153
|
+
markers[0].textContent = display;
|
|
27154
|
+
return true;
|
|
27155
|
+
}
|
|
26912
27156
|
const field2 = owner.createElementNS(ns, "fld");
|
|
26913
27157
|
field2.setAttribute("IX", index);
|
|
26914
27158
|
field2.appendChild(owner.createTextNode(display));
|
|
@@ -29306,6 +29550,35 @@ function snapshotGuideEdit(edit) {
|
|
|
29306
29550
|
}
|
|
29307
29551
|
|
|
29308
29552
|
// visio/edit-text-field-commands.ts
|
|
29553
|
+
function snapshotTextFieldUpdate(edit) {
|
|
29554
|
+
const insert = snapshotTextFieldInsert({
|
|
29555
|
+
pageId: edit.pageId,
|
|
29556
|
+
shapeId: edit.shapeId,
|
|
29557
|
+
formula: edit.formula,
|
|
29558
|
+
...edit.format === void 0 ? {} : { format: edit.format }
|
|
29559
|
+
});
|
|
29560
|
+
if (analyzeVisioFormula(parseVisioFormula(insert.formula)).references.some(
|
|
29561
|
+
(ref) => /^fields?\./i.test(ref.cell)
|
|
29562
|
+
))
|
|
29563
|
+
fail("UNSUPPORTED_TEXT_FIELD", "Existing field formulas cannot reference Field rows.");
|
|
29564
|
+
if (typeof edit.fieldIndex !== "string" || !/^(0|[1-9]\d{0,9})$/.test(edit.fieldIndex) || Number(edit.fieldIndex) > 4294967295)
|
|
29565
|
+
fail("INVALID_EDIT", "An existing field needs a canonical row index.");
|
|
29566
|
+
if ([edit.expectedText, edit.expectedCached, edit.expectedSourceKey].some(
|
|
29567
|
+
(value) => typeof value !== "string" || value.length > 1e6
|
|
29568
|
+
) || !edit.expectedSourceKey)
|
|
29569
|
+
fail("INVALID_EDIT", "An existing field needs its source text and row identity.");
|
|
29570
|
+
return {
|
|
29571
|
+
type: "update-text-field",
|
|
29572
|
+
pageId: insert.pageId,
|
|
29573
|
+
shapeId: insert.shapeId,
|
|
29574
|
+
fieldIndex: edit.fieldIndex,
|
|
29575
|
+
formula: insert.formula,
|
|
29576
|
+
format: insert.format,
|
|
29577
|
+
expectedText: edit.expectedText,
|
|
29578
|
+
expectedCached: edit.expectedCached,
|
|
29579
|
+
expectedSourceKey: edit.expectedSourceKey
|
|
29580
|
+
};
|
|
29581
|
+
}
|
|
29309
29582
|
function snapshotTextFieldInsert(edit) {
|
|
29310
29583
|
const { pageId: pageId2, shapeId: shapeId2 } = edit;
|
|
29311
29584
|
if ([pageId2, shapeId2].some((id3) => typeof id3 !== "string" || !id3 || id3.length > 256))
|
|
@@ -30059,6 +30332,14 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
30059
30332
|
return { ...target2, type: edit.type, text: text5(edit.text) };
|
|
30060
30333
|
if (edit.type === "replace-text-ranges") return snapshotTextRanges(edit, text5);
|
|
30061
30334
|
if (edit.type === "insert-text-field") return snapshotTextFieldInsert(edit);
|
|
30335
|
+
if (edit.type === "update-text-field") {
|
|
30336
|
+
const update = snapshotTextFieldUpdate(edit);
|
|
30337
|
+
update.formula = text5(update.formula);
|
|
30338
|
+
update.expectedText = text5(update.expectedText);
|
|
30339
|
+
update.expectedCached = text5(update.expectedCached);
|
|
30340
|
+
update.expectedSourceKey = text5(update.expectedSourceKey);
|
|
30341
|
+
return update;
|
|
30342
|
+
}
|
|
30062
30343
|
if (isVisioFormatEdit(edit)) return snapshotFormatting(edit);
|
|
30063
30344
|
if (edit.type === "reorder-shape") {
|
|
30064
30345
|
if (!["front", "back", "forward", "backward"].includes(edit.order))
|
|
@@ -35486,7 +35767,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
35486
35767
|
const dirty = /* @__PURE__ */ new Map();
|
|
35487
35768
|
const roots = /* @__PURE__ */ new Map();
|
|
35488
35769
|
const geometryCommands = commands.filter(
|
|
35489
|
-
(command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "insert-text-field" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && command2.type !== "change-shape" && command2.type !== "insert-picture" && command2.type !== "set-page-theme" && !isVisioMetadataEdit(command2) && command2.type !== "set-shape-data" && !isVisioGroupEdit(command2) && !isVisioDiagramPartEdit(command2) && !isVisioGuideEdit(command2) && !isVisioFormatEdit(command2)
|
|
35770
|
+
(command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "insert-text-field" && command2.type !== "update-text-field" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && command2.type !== "change-shape" && command2.type !== "insert-picture" && command2.type !== "set-page-theme" && !isVisioMetadataEdit(command2) && command2.type !== "set-shape-data" && !isVisioGroupEdit(command2) && !isVisioDiagramPartEdit(command2) && !isVisioGuideEdit(command2) && !isVisioFormatEdit(command2)
|
|
35490
35771
|
);
|
|
35491
35772
|
let document;
|
|
35492
35773
|
let masterMovePins = emptyMasterMoveProof();
|
|
@@ -35494,7 +35775,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
35494
35775
|
let instanceDeletes = /* @__PURE__ */ new Set();
|
|
35495
35776
|
let groupMembers = /* @__PURE__ */ new Map();
|
|
35496
35777
|
if (geometryCommands.length || commands.some(
|
|
35497
|
-
(command2) => command2.type === "replace-plain-text" || command2.type === "replace-text-ranges" || command2.type === "insert-text-field" || isVisioFormatEdit(command2) || isVisioMetadataEdit(command2) || command2.type === "set-shape-data" || command2.type === "reorder-shape" || command2.type === "duplicate-shapes" || command2.type === "paste-shapes" || command2.type === "change-shape" || isVisioGroupEdit(command2) || isVisioDiagramPartEdit(command2) || isVisioGuideEdit(command2)
|
|
35778
|
+
(command2) => command2.type === "replace-plain-text" || command2.type === "replace-text-ranges" || command2.type === "insert-text-field" || command2.type === "update-text-field" || isVisioFormatEdit(command2) || isVisioMetadataEdit(command2) || command2.type === "set-shape-data" || command2.type === "reorder-shape" || command2.type === "duplicate-shapes" || command2.type === "paste-shapes" || command2.type === "change-shape" || isVisioGroupEdit(command2) || isVisioDiagramPartEdit(command2) || isVisioGuideEdit(command2)
|
|
35498
35779
|
)) {
|
|
35499
35780
|
for (const [pageId2, path2] of pages) {
|
|
35500
35781
|
const sourceRoot = await visioXml(pkg, path2, "PageContents");
|
|
@@ -35605,7 +35886,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
35605
35886
|
textChanged = true;
|
|
35606
35887
|
await noteTextSize(command2, root2);
|
|
35607
35888
|
}
|
|
35608
|
-
} else if (command2.type === "insert-text-field") {
|
|
35889
|
+
} else if (command2.type === "insert-text-field" || command2.type === "update-text-field") {
|
|
35609
35890
|
if (await insertVisioTextField(pkg, new Set(pages.values()), roots, document, command2, check)) {
|
|
35610
35891
|
dirty.set(path, root2);
|
|
35611
35892
|
textChanged = true;
|