@extend-ai/react-xlsx 0.13.4 → 0.14.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/README.md +20 -0
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +871 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -1
- package/dist/index.d.ts +133 -1
- package/dist/index.js +871 -79
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +128 -0
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/xlsx-worker.js
CHANGED
|
@@ -4229,6 +4229,131 @@ function normalizeHexColor3(value) {
|
|
|
4229
4229
|
}
|
|
4230
4230
|
return "#000000";
|
|
4231
4231
|
}
|
|
4232
|
+
function mapDukeFormControlAnchor(anchor) {
|
|
4233
|
+
return {
|
|
4234
|
+
from: {
|
|
4235
|
+
col: anchor.fromCol,
|
|
4236
|
+
colOffsetEmu: anchor.fromColOffset,
|
|
4237
|
+
row: anchor.fromRow,
|
|
4238
|
+
rowOffsetEmu: anchor.fromRowOffset
|
|
4239
|
+
},
|
|
4240
|
+
kind: "two-cell",
|
|
4241
|
+
to: {
|
|
4242
|
+
col: anchor.toCol,
|
|
4243
|
+
colOffsetEmu: anchor.toColOffset,
|
|
4244
|
+
row: anchor.toRow,
|
|
4245
|
+
rowOffsetEmu: anchor.toRowOffset
|
|
4246
|
+
}
|
|
4247
|
+
};
|
|
4248
|
+
}
|
|
4249
|
+
function mapDukeFormControlKind(kind) {
|
|
4250
|
+
switch (kind.kind) {
|
|
4251
|
+
case "button":
|
|
4252
|
+
return { caption: kind.caption, kind: "button", label: normalizeControlLabel(kind.caption) };
|
|
4253
|
+
case "checkbox":
|
|
4254
|
+
return {
|
|
4255
|
+
caption: kind.caption,
|
|
4256
|
+
checked: kind.state === "checked",
|
|
4257
|
+
kind: "checkbox",
|
|
4258
|
+
label: normalizeControlLabel(kind.caption),
|
|
4259
|
+
linkedCell: kind.cellLink,
|
|
4260
|
+
no3D: kind.no3D,
|
|
4261
|
+
state: kind.state
|
|
4262
|
+
};
|
|
4263
|
+
case "optionButton":
|
|
4264
|
+
return {
|
|
4265
|
+
caption: kind.caption,
|
|
4266
|
+
checked: kind.state === "checked",
|
|
4267
|
+
firstInGroup: kind.firstInGroup,
|
|
4268
|
+
kind: "radio",
|
|
4269
|
+
label: normalizeControlLabel(kind.caption),
|
|
4270
|
+
linkedCell: kind.cellLink,
|
|
4271
|
+
no3D: kind.no3D,
|
|
4272
|
+
state: kind.state
|
|
4273
|
+
};
|
|
4274
|
+
case "label":
|
|
4275
|
+
return { caption: kind.caption, kind: "label", label: normalizeControlLabel(kind.caption) };
|
|
4276
|
+
case "groupBox":
|
|
4277
|
+
return {
|
|
4278
|
+
caption: kind.caption,
|
|
4279
|
+
kind: "group-box",
|
|
4280
|
+
label: normalizeControlLabel(kind.caption),
|
|
4281
|
+
no3D: kind.no3D
|
|
4282
|
+
};
|
|
4283
|
+
case "listBox":
|
|
4284
|
+
return {
|
|
4285
|
+
inputRange: kind.inputRange,
|
|
4286
|
+
kind: "listbox",
|
|
4287
|
+
linkedCell: kind.cellLink,
|
|
4288
|
+
no3D: kind.no3D,
|
|
4289
|
+
selected: [...kind.selected],
|
|
4290
|
+
selection: kind.selection
|
|
4291
|
+
};
|
|
4292
|
+
case "dropdown":
|
|
4293
|
+
return {
|
|
4294
|
+
inputRange: kind.inputRange,
|
|
4295
|
+
kind: "dropdown",
|
|
4296
|
+
lines: kind.lines,
|
|
4297
|
+
linkedCell: kind.cellLink,
|
|
4298
|
+
no3D: kind.no3D,
|
|
4299
|
+
selected: kind.selected
|
|
4300
|
+
};
|
|
4301
|
+
case "scrollbar":
|
|
4302
|
+
return {
|
|
4303
|
+
horizontal: kind.horizontal,
|
|
4304
|
+
increment: kind.increment,
|
|
4305
|
+
kind: "scrollbar",
|
|
4306
|
+
linkedCell: kind.cellLink,
|
|
4307
|
+
max: kind.max,
|
|
4308
|
+
min: kind.min,
|
|
4309
|
+
page: kind.page,
|
|
4310
|
+
value: kind.value
|
|
4311
|
+
};
|
|
4312
|
+
case "spinner":
|
|
4313
|
+
return {
|
|
4314
|
+
increment: kind.increment,
|
|
4315
|
+
kind: "spinner",
|
|
4316
|
+
linkedCell: kind.cellLink,
|
|
4317
|
+
max: kind.max,
|
|
4318
|
+
min: kind.min,
|
|
4319
|
+
value: kind.value
|
|
4320
|
+
};
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
function mapDukeFormControl(control, controlIndex, workbookSheetIndex) {
|
|
4324
|
+
return {
|
|
4325
|
+
anchor: mapDukeFormControlAnchor(control.anchor),
|
|
4326
|
+
controlIndex,
|
|
4327
|
+
dukeAnchor: { ...control.anchor },
|
|
4328
|
+
editAs: control.anchor.editAs,
|
|
4329
|
+
hidden: false,
|
|
4330
|
+
id: `form-control-${workbookSheetIndex}-${controlIndex}`,
|
|
4331
|
+
locked: control.locked,
|
|
4332
|
+
name: control.name,
|
|
4333
|
+
printable: control.printable,
|
|
4334
|
+
sheetIndex: workbookSheetIndex,
|
|
4335
|
+
workbookSheetIndex,
|
|
4336
|
+
zIndex: controlIndex + 1,
|
|
4337
|
+
...mapDukeFormControlKind(control.kind)
|
|
4338
|
+
};
|
|
4339
|
+
}
|
|
4340
|
+
function collectWorkbookFormControls(workbook2) {
|
|
4341
|
+
return Array.from({ length: workbook2.sheetCount }, (_, workbookSheetIndex) => {
|
|
4342
|
+
try {
|
|
4343
|
+
const controls = workbook2.getSheet(workbookSheetIndex).formControls;
|
|
4344
|
+
return Array.isArray(controls) ? controls.map((control, controlIndex) => mapDukeFormControl(control, controlIndex, workbookSheetIndex)) : [];
|
|
4345
|
+
} catch {
|
|
4346
|
+
return [];
|
|
4347
|
+
}
|
|
4348
|
+
});
|
|
4349
|
+
}
|
|
4350
|
+
function normalizeControlLabel(label) {
|
|
4351
|
+
if (!label) {
|
|
4352
|
+
return void 0;
|
|
4353
|
+
}
|
|
4354
|
+
const normalized = label.replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
4355
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
4356
|
+
}
|
|
4232
4357
|
function parseWorkbookStructureAssetsFromArchive(archive, options) {
|
|
4233
4358
|
const contentTypes = parseContentTypes(archive);
|
|
4234
4359
|
const workbookSheets = parseWorkbookSheets(archive);
|
|
@@ -4445,6 +4570,7 @@ function normalizeWorksheetVisibility2(value) {
|
|
|
4445
4570
|
var workbook = null;
|
|
4446
4571
|
var chartsByWorkbookSheetIndex = [];
|
|
4447
4572
|
var chartsheets = [];
|
|
4573
|
+
var formControlsByWorkbookSheetIndex = [];
|
|
4448
4574
|
var sheets = [];
|
|
4449
4575
|
var tablesByWorkbookSheetIndex = [];
|
|
4450
4576
|
var tabs = [];
|
|
@@ -4891,6 +5017,7 @@ async function loadWorkbook(buffer, skipXmlParsing = false, showHiddenSheets = f
|
|
|
4891
5017
|
activeWorkbook = result.workbook;
|
|
4892
5018
|
}
|
|
4893
5019
|
const nextWorkbook = activeWorkbook;
|
|
5020
|
+
formControlsByWorkbookSheetIndex = collectWorkbookFormControls(nextWorkbook);
|
|
4894
5021
|
const shouldUseFastStructureParse = bytes.byteLength >= FAST_STRUCTURE_PARSE_THRESHOLD_BYTES && totalFormulas <= FORMULA_COUNT_THRESHOLD;
|
|
4895
5022
|
const structureAssets = effectiveSkipXmlParsing || shouldUseFastStructureParse || !canParseXmlInWorker() ? null : parseWorkbookStructureAssets(bytes, {
|
|
4896
5023
|
includeCachedFormulaValues: true
|
|
@@ -4922,6 +5049,7 @@ async function loadWorkbook(buffer, skipXmlParsing = false, showHiddenSheets = f
|
|
|
4922
5049
|
return {
|
|
4923
5050
|
chartsByWorkbookSheetIndex,
|
|
4924
5051
|
chartsheets,
|
|
5052
|
+
formControlsByWorkbookSheetIndex,
|
|
4925
5053
|
sheets,
|
|
4926
5054
|
tablesByWorkbookSheetIndex,
|
|
4927
5055
|
tabs
|