@univerjs/core 1.1.0 → 1.3.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/lib/cjs/facade.js +2 -3
- package/lib/cjs/index.js +269 -135
- package/lib/es/facade.js +2 -3
- package/lib/es/index.js +263 -136
- package/lib/facade.js +2 -3
- package/lib/index.js +263 -136
- package/lib/types/docs/data-model/text-x/utils.d.ts +2 -1
- package/lib/types/index.d.ts +4 -0
- package/lib/types/services/instance/instance.service.d.ts +1 -1
- package/lib/types/shared/record-value.d.ts +36 -0
- package/lib/types/shared/units.d.ts +19 -0
- package/lib/types/sheets/sheet-dimensions.d.ts +21 -0
- package/lib/types/sheets/sheet-skeleton.d.ts +6 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +8 -8
- package/package.json +5 -5
package/lib/cjs/facade.js
CHANGED
|
@@ -39,10 +39,9 @@ var FBaseInitialable = class extends _univerjs_core.Disposable {
|
|
|
39
39
|
this._injector = _injector;
|
|
40
40
|
const Ctor = this.constructor;
|
|
41
41
|
if (Boolean(Ctor[ManualInitSymbol])) return;
|
|
42
|
-
const self = this;
|
|
43
42
|
const initializers = Object.getPrototypeOf(this)[InitializerSymbol$1];
|
|
44
|
-
if (initializers) initializers.forEach(
|
|
45
|
-
fn.apply(
|
|
43
|
+
if (initializers) initializers.forEach((fn) => {
|
|
44
|
+
fn.apply(this, [_injector]);
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
/**
|
package/lib/cjs/index.js
CHANGED
|
@@ -1699,7 +1699,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
|
1699
1699
|
//#endregion
|
|
1700
1700
|
//#region package.json
|
|
1701
1701
|
var name = "@univerjs/core";
|
|
1702
|
-
var version = "1.
|
|
1702
|
+
var version = "1.3.0";
|
|
1703
1703
|
|
|
1704
1704
|
//#endregion
|
|
1705
1705
|
//#region src/common/array.ts
|
|
@@ -5804,7 +5804,7 @@ function datePartsToExcel1900Serial(year, month, day) {
|
|
|
5804
5804
|
return unixDays + (unixDays <= -25509 ? 25568 : 25569);
|
|
5805
5805
|
}
|
|
5806
5806
|
function excelSerialToDateTimeParts(serial, options) {
|
|
5807
|
-
if (!Number.isFinite(serial) || serial < 0) return null;
|
|
5807
|
+
if (!Number.isFinite(serial) || serial < 0 || serial >= getDateSystemMaxSerial(options.dateSystem) + 1) return null;
|
|
5808
5808
|
const wholeDays = Math.floor(serial);
|
|
5809
5809
|
const excel1900Serial = options.dateSystem === "date1904" ? wholeDays + EXCEL_1904_OFFSET : wholeDays;
|
|
5810
5810
|
const [year, month, day] = toYMD(excel1900Serial, 0, true);
|
|
@@ -14963,6 +14963,13 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
14963
14963
|
const { startIndex: removeStartIndex, paragraphId: removeParagraphId, paragraphStyle: removeParagraphStyle, bullet: removeBullet } = removeParagraph;
|
|
14964
14964
|
let newParagraphStyle;
|
|
14965
14965
|
let newBullet;
|
|
14966
|
+
const paragraphAttributes = coverType === 0 ? {
|
|
14967
|
+
...removeParagraph,
|
|
14968
|
+
...updateParagraph
|
|
14969
|
+
} : {
|
|
14970
|
+
...updateParagraph,
|
|
14971
|
+
...removeParagraph
|
|
14972
|
+
};
|
|
14966
14973
|
if (coverType === 0) {
|
|
14967
14974
|
newParagraphStyle = {
|
|
14968
14975
|
...removeParagraphStyle,
|
|
@@ -14992,10 +14999,11 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
14992
14999
|
}
|
|
14993
15000
|
if (updateStartIndex === removeStartIndex) {
|
|
14994
15001
|
splitUpdateParagraphs.push({
|
|
15002
|
+
...paragraphAttributes,
|
|
14995
15003
|
startIndex: updateStartIndex,
|
|
14996
15004
|
paragraphId: updateParagraphId ?? removeParagraphId,
|
|
14997
15005
|
paragraphStyle: newParagraphStyle,
|
|
14998
|
-
bullet: newBullet
|
|
15006
|
+
bullet: removeBullet == null && updateBullet == null ? void 0 : newBullet
|
|
14999
15007
|
});
|
|
15000
15008
|
break;
|
|
15001
15009
|
}
|
|
@@ -15715,10 +15723,10 @@ function getBlockRangeSlice(body, startOffset, endOffset, mode = 0) {
|
|
|
15715
15723
|
const { blockRanges = [] } = body;
|
|
15716
15724
|
const newBlockRanges = [];
|
|
15717
15725
|
for (const blockRange of blockRanges) {
|
|
15718
|
-
const
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
...
|
|
15726
|
+
const { startIndex, endIndex } = blockRange;
|
|
15727
|
+
if (!(mode === 1 ? startIndex >= startOffset && endIndex < endOffset : hasStructuralRangeInSlice(startIndex, endIndex, startOffset, endOffset, mode))) continue;
|
|
15728
|
+
newBlockRanges.push({
|
|
15729
|
+
...blockRange,
|
|
15722
15730
|
...getSlicedStructuralRange(startIndex, endIndex, startOffset, endOffset, mode)
|
|
15723
15731
|
});
|
|
15724
15732
|
}
|
|
@@ -16067,7 +16075,7 @@ var ActionIterator = class {
|
|
|
16067
16075
|
return this.peekLength() < Number.POSITIVE_INFINITY;
|
|
16068
16076
|
}
|
|
16069
16077
|
next(length) {
|
|
16070
|
-
if (
|
|
16078
|
+
if (length === void 0) length = Number.POSITIVE_INFINITY;
|
|
16071
16079
|
const nextAction = this._actions[this._index];
|
|
16072
16080
|
if (nextAction) {
|
|
16073
16081
|
const offset = this._offset;
|
|
@@ -16607,6 +16615,21 @@ function transformParagraph(originParagraph, targetParagraph, originCoverType, t
|
|
|
16607
16615
|
else if (originParagraph.bullet === void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
16608
16616
|
else if (originCoverType === 1 || targetCoverType === 1) paragraph.bullet = transformType === 0 && targetParagraph.bullet ? Tools.deepClone(targetParagraph.bullet) : Tools.deepClone(originParagraph.bullet);
|
|
16609
16617
|
else if (transformType === 0 && targetParagraph.bullet !== void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
16618
|
+
for (const key of [
|
|
16619
|
+
"headingCollapsed",
|
|
16620
|
+
"styleId",
|
|
16621
|
+
"sourceBullet",
|
|
16622
|
+
"directBullet"
|
|
16623
|
+
]) {
|
|
16624
|
+
const origin = originParagraph[key];
|
|
16625
|
+
const target = targetParagraph[key];
|
|
16626
|
+
let value;
|
|
16627
|
+
if (originCoverType === 1 && targetCoverType === 1) value = transformType === 1 ? origin : target;
|
|
16628
|
+
else if (origin === void 0) value = target;
|
|
16629
|
+
else if (originCoverType === 1 || targetCoverType === 1) value = transformType === 0 && target !== void 0 ? target : origin;
|
|
16630
|
+
else if (transformType === 0) value = target;
|
|
16631
|
+
if (value !== void 0) Object.assign(paragraph, { [key]: Tools.deepClone(value) });
|
|
16632
|
+
}
|
|
16610
16633
|
if (paragraph.bullet === void 0) delete paragraph.bullet;
|
|
16611
16634
|
return paragraph;
|
|
16612
16635
|
}
|
|
@@ -16944,11 +16967,7 @@ var TextX = class TextX {
|
|
|
16944
16967
|
}
|
|
16945
16968
|
if (action.t === "r" && action.body != null) {
|
|
16946
16969
|
const body = getBodySlice(doc, index, index + action.len, true);
|
|
16947
|
-
for (const field of [
|
|
16948
|
-
"tables",
|
|
16949
|
-
"columnGroups",
|
|
16950
|
-
"blockRanges"
|
|
16951
|
-
]) if (action.body[field] == null) delete body[field];
|
|
16970
|
+
for (const field of Object.keys(body)) if (field !== "dataStream" && field !== "paragraphs" && action.body[field] == null) Reflect.deleteProperty(body, field);
|
|
16952
16971
|
if (action.body.paragraphs == null) delete body.paragraphs;
|
|
16953
16972
|
else {
|
|
16954
16973
|
var _body$paragraphs;
|
|
@@ -20164,6 +20183,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
20164
20183
|
_defineProperty(this, "_trackedRanges", /* @__PURE__ */ new Set());
|
|
20165
20184
|
_defineProperty(this, "_childHandleRevision", 0);
|
|
20166
20185
|
this._doc = new DocumentDataModel(data);
|
|
20186
|
+
this._data.body = this._doc.getBody();
|
|
20167
20187
|
}
|
|
20168
20188
|
/**
|
|
20169
20189
|
* Returns editable paragraph handles backed by this detached rich-text builder.
|
|
@@ -22495,6 +22515,96 @@ function convertTextRotation(textRotation) {
|
|
|
22495
22515
|
};
|
|
22496
22516
|
}
|
|
22497
22517
|
|
|
22518
|
+
//#endregion
|
|
22519
|
+
//#region src/sheets/sheet-dimensions.ts
|
|
22520
|
+
function isValidSheetDimension(value, allowZero = true) {
|
|
22521
|
+
return typeof value === "number" && Number.isFinite(value) && (allowZero ? value >= 0 : value > 0);
|
|
22522
|
+
}
|
|
22523
|
+
function normalizeSheetDimension(value, fallback, allowZero = true) {
|
|
22524
|
+
return isValidSheetDimension(value, allowZero) ? value : fallback;
|
|
22525
|
+
}
|
|
22526
|
+
function isValidColumnDimensions(data) {
|
|
22527
|
+
return (data === null || data === void 0 ? void 0 : data.w) == null || isValidSheetDimension(data.w);
|
|
22528
|
+
}
|
|
22529
|
+
function isValidRowDimensions(data) {
|
|
22530
|
+
return ((data === null || data === void 0 ? void 0 : data.h) == null || isValidSheetDimension(data.h)) && ((data === null || data === void 0 ? void 0 : data.ah) == null || isValidSheetDimension(data.ah));
|
|
22531
|
+
}
|
|
22532
|
+
|
|
22533
|
+
//#endregion
|
|
22534
|
+
//#region src/sheets/sheet-snapshot-utils.ts
|
|
22535
|
+
const DEFAULT_WORKSHEET_ROW_COUNT_KEY = "DEFAULT_WORKSHEET_ROW_COUNT";
|
|
22536
|
+
const DEFAULT_WORKSHEET_ROW_COUNT = 1e3;
|
|
22537
|
+
const DEFAULT_WORKSHEET_COLUMN_COUNT_KEY = "DEFAULT_WORKSHEET_COLUMN_COUNT";
|
|
22538
|
+
const DEFAULT_WORKSHEET_COLUMN_COUNT = 20;
|
|
22539
|
+
const DEFAULT_WORKSHEET_ROW_HEIGHT_KEY = "DEFAULT_WORKSHEET_ROW_HEIGHT";
|
|
22540
|
+
const DEFAULT_WORKSHEET_ROW_HEIGHT = 24;
|
|
22541
|
+
const DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
|
|
22542
|
+
const DEFAULT_WORKSHEET_COLUMN_WIDTH = 88;
|
|
22543
|
+
const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
|
|
22544
|
+
const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH = 46;
|
|
22545
|
+
const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
|
|
22546
|
+
const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT = 20;
|
|
22547
|
+
/**
|
|
22548
|
+
* This function is used to merge the user passed in snapshot with the default snapshot
|
|
22549
|
+
* without changing the user's snapshot's reference.
|
|
22550
|
+
*
|
|
22551
|
+
* @param snapshot user passed in snapshot
|
|
22552
|
+
* @returns merged snapshot
|
|
22553
|
+
*/
|
|
22554
|
+
function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
22555
|
+
const defaultSnapshot = {
|
|
22556
|
+
name: "Sheet1",
|
|
22557
|
+
id: "sheet-01",
|
|
22558
|
+
tabColor: "",
|
|
22559
|
+
hidden: 0,
|
|
22560
|
+
rowCount: DEFAULT_WORKSHEET_ROW_COUNT,
|
|
22561
|
+
columnCount: 20,
|
|
22562
|
+
zoomRatio: 1,
|
|
22563
|
+
freeze: {
|
|
22564
|
+
xSplit: 0,
|
|
22565
|
+
ySplit: 0,
|
|
22566
|
+
startRow: -1,
|
|
22567
|
+
startColumn: -1
|
|
22568
|
+
},
|
|
22569
|
+
scrollTop: 0,
|
|
22570
|
+
scrollLeft: 0,
|
|
22571
|
+
defaultColumnWidth: 88,
|
|
22572
|
+
defaultRowHeight: 24,
|
|
22573
|
+
mergeData: [],
|
|
22574
|
+
cellData: {},
|
|
22575
|
+
rowData: {},
|
|
22576
|
+
columnData: {},
|
|
22577
|
+
showGridlines: 1,
|
|
22578
|
+
rowHeader: {
|
|
22579
|
+
width: 46,
|
|
22580
|
+
hidden: 0
|
|
22581
|
+
},
|
|
22582
|
+
columnHeader: {
|
|
22583
|
+
height: 20,
|
|
22584
|
+
hidden: 0
|
|
22585
|
+
},
|
|
22586
|
+
rightToLeft: 0
|
|
22587
|
+
};
|
|
22588
|
+
Object.keys(defaultSnapshot).forEach((_key) => {
|
|
22589
|
+
const key = _key;
|
|
22590
|
+
if (typeof snapshot[key] === "undefined") snapshot[key] = defaultSnapshot[key];
|
|
22591
|
+
});
|
|
22592
|
+
const freeze = snapshot.freeze;
|
|
22593
|
+
freeze.xSplit = freeze.xSplit ?? defaultSnapshot.freeze.xSplit;
|
|
22594
|
+
freeze.ySplit = freeze.ySplit ?? defaultSnapshot.freeze.ySplit;
|
|
22595
|
+
freeze.startRow = freeze.ySplit === 0 ? defaultSnapshot.freeze.startRow : freeze.startRow ?? defaultSnapshot.freeze.startRow;
|
|
22596
|
+
freeze.startColumn = freeze.xSplit === 0 ? defaultSnapshot.freeze.startColumn : freeze.startColumn ?? defaultSnapshot.freeze.startColumn;
|
|
22597
|
+
snapshot.defaultColumnWidth = normalizeSheetDimension(snapshot.defaultColumnWidth, 88, false);
|
|
22598
|
+
snapshot.defaultRowHeight = normalizeSheetDimension(snapshot.defaultRowHeight, 24, false);
|
|
22599
|
+
for (const column of Object.values(snapshot.columnData)) if (column && column.w !== void 0 && !isValidSheetDimension(column.w)) column.w = 0;
|
|
22600
|
+
for (const row of Object.values(snapshot.rowData)) {
|
|
22601
|
+
if (!row) continue;
|
|
22602
|
+
if (row.h !== void 0 && !isValidSheetDimension(row.h)) row.h = 0;
|
|
22603
|
+
if (row.ah !== void 0 && !isValidSheetDimension(row.ah)) delete row.ah;
|
|
22604
|
+
}
|
|
22605
|
+
return snapshot;
|
|
22606
|
+
}
|
|
22607
|
+
|
|
22498
22608
|
//#endregion
|
|
22499
22609
|
//#region src/sheets/column-manager.ts
|
|
22500
22610
|
/**
|
|
@@ -22634,7 +22744,9 @@ var ColumnManager = class {
|
|
|
22634
22744
|
*/
|
|
22635
22745
|
getColumnWidth(columnPos) {
|
|
22636
22746
|
var _this$_columnData$col2;
|
|
22637
|
-
|
|
22747
|
+
const defaultWidth = normalizeSheetDimension(this._config.defaultColumnWidth, 88, false);
|
|
22748
|
+
const width = (_this$_columnData$col2 = this._columnData[columnPos]) === null || _this$_columnData$col2 === void 0 ? void 0 : _this$_columnData$col2.w;
|
|
22749
|
+
return width === void 0 ? defaultWidth : normalizeSheetDimension(width, 0);
|
|
22638
22750
|
}
|
|
22639
22751
|
/**
|
|
22640
22752
|
* Set the width of column
|
|
@@ -22642,6 +22754,7 @@ var ColumnManager = class {
|
|
|
22642
22754
|
* @param width width of column
|
|
22643
22755
|
*/
|
|
22644
22756
|
setColumnWidth(columnPos, width) {
|
|
22757
|
+
if (!isValidSheetDimension(width)) return;
|
|
22645
22758
|
const column = this._columnData[columnPos];
|
|
22646
22759
|
if (width === this._config.defaultColumnWidth) {
|
|
22647
22760
|
if (column) {
|
|
@@ -22678,7 +22791,10 @@ var ColumnManager = class {
|
|
|
22678
22791
|
}
|
|
22679
22792
|
for (let c = startColumn; c <= endColumn; c++) {
|
|
22680
22793
|
const columnData = columnDataInfo === null || columnDataInfo === void 0 ? void 0 : columnDataInfo[c - startColumn];
|
|
22681
|
-
if (columnData !== void 0 && columnData !== null && Object.keys(columnData).length > 0)
|
|
22794
|
+
if (columnData !== void 0 && columnData !== null && Object.keys(columnData).length > 0) {
|
|
22795
|
+
this._columnData[c] = { ...columnData };
|
|
22796
|
+
if (columnData.w !== void 0 && !isValidSheetDimension(columnData.w)) this._columnData[c].w = 0;
|
|
22797
|
+
}
|
|
22682
22798
|
}
|
|
22683
22799
|
}
|
|
22684
22800
|
/**
|
|
@@ -23306,13 +23422,14 @@ var RowManager = class {
|
|
|
23306
23422
|
getRowHeight(rowPos, count = 1) {
|
|
23307
23423
|
const { _rowData } = this;
|
|
23308
23424
|
const config = this._config;
|
|
23425
|
+
const defaultHeight = normalizeSheetDimension(config.defaultRowHeight, 24, false);
|
|
23309
23426
|
let height = 0;
|
|
23310
23427
|
for (let i = 0; i < count; i++) {
|
|
23311
|
-
const { ia, ah, h =
|
|
23428
|
+
const { ia, ah, h = defaultHeight } = _rowData[i + rowPos] || {
|
|
23312
23429
|
hd: 0,
|
|
23313
|
-
h:
|
|
23430
|
+
h: defaultHeight
|
|
23314
23431
|
};
|
|
23315
|
-
height += (ia == null || ia === 1) &&
|
|
23432
|
+
height += (ia == null || ia === 1) && isValidSheetDimension(ah, false) ? ah : normalizeSheetDimension(h, 0);
|
|
23316
23433
|
}
|
|
23317
23434
|
return height;
|
|
23318
23435
|
}
|
|
@@ -23322,6 +23439,7 @@ var RowManager = class {
|
|
|
23322
23439
|
* @param height row height
|
|
23323
23440
|
*/
|
|
23324
23441
|
setRowHeight(rowPos, height) {
|
|
23442
|
+
if (!isValidSheetDimension(height)) return;
|
|
23325
23443
|
const row = this._rowData[rowPos];
|
|
23326
23444
|
if (height === this._config.defaultRowHeight) {
|
|
23327
23445
|
if (row) {
|
|
@@ -23362,7 +23480,12 @@ var RowManager = class {
|
|
|
23362
23480
|
}
|
|
23363
23481
|
for (let r = startRow; r <= endRow; r++) {
|
|
23364
23482
|
const rowData = rowDataInfo === null || rowDataInfo === void 0 ? void 0 : rowDataInfo[r - startRow];
|
|
23365
|
-
if (rowData !== void 0 && rowData !== null && Object.keys(rowData).length > 0)
|
|
23483
|
+
if (rowData !== void 0 && rowData !== null && Object.keys(rowData).length > 0) {
|
|
23484
|
+
this._rowData[r] = { ...rowData };
|
|
23485
|
+
const row = this._rowData[r];
|
|
23486
|
+
if (row.h !== void 0 && !isValidSheetDimension(row.h)) row.h = 0;
|
|
23487
|
+
if (row.ah !== void 0 && !isValidSheetDimension(row.ah)) delete row.ah;
|
|
23488
|
+
}
|
|
23366
23489
|
}
|
|
23367
23490
|
}
|
|
23368
23491
|
/**
|
|
@@ -23479,73 +23602,6 @@ var RowManager = class {
|
|
|
23479
23602
|
}
|
|
23480
23603
|
};
|
|
23481
23604
|
|
|
23482
|
-
//#endregion
|
|
23483
|
-
//#region src/sheets/sheet-snapshot-utils.ts
|
|
23484
|
-
const DEFAULT_WORKSHEET_ROW_COUNT_KEY = "DEFAULT_WORKSHEET_ROW_COUNT";
|
|
23485
|
-
const DEFAULT_WORKSHEET_ROW_COUNT = 1e3;
|
|
23486
|
-
const DEFAULT_WORKSHEET_COLUMN_COUNT_KEY = "DEFAULT_WORKSHEET_COLUMN_COUNT";
|
|
23487
|
-
const DEFAULT_WORKSHEET_COLUMN_COUNT = 20;
|
|
23488
|
-
const DEFAULT_WORKSHEET_ROW_HEIGHT_KEY = "DEFAULT_WORKSHEET_ROW_HEIGHT";
|
|
23489
|
-
const DEFAULT_WORKSHEET_ROW_HEIGHT = 24;
|
|
23490
|
-
const DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
|
|
23491
|
-
const DEFAULT_WORKSHEET_COLUMN_WIDTH = 88;
|
|
23492
|
-
const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
|
|
23493
|
-
const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH = 46;
|
|
23494
|
-
const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
|
|
23495
|
-
const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT = 20;
|
|
23496
|
-
/**
|
|
23497
|
-
* This function is used to merge the user passed in snapshot with the default snapshot
|
|
23498
|
-
* without changing the user's snapshot's reference.
|
|
23499
|
-
*
|
|
23500
|
-
* @param snapshot user passed in snapshot
|
|
23501
|
-
* @returns merged snapshot
|
|
23502
|
-
*/
|
|
23503
|
-
function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
23504
|
-
const defaultSnapshot = {
|
|
23505
|
-
name: "Sheet1",
|
|
23506
|
-
id: "sheet-01",
|
|
23507
|
-
tabColor: "",
|
|
23508
|
-
hidden: 0,
|
|
23509
|
-
rowCount: DEFAULT_WORKSHEET_ROW_COUNT,
|
|
23510
|
-
columnCount: 20,
|
|
23511
|
-
zoomRatio: 1,
|
|
23512
|
-
freeze: {
|
|
23513
|
-
xSplit: 0,
|
|
23514
|
-
ySplit: 0,
|
|
23515
|
-
startRow: -1,
|
|
23516
|
-
startColumn: -1
|
|
23517
|
-
},
|
|
23518
|
-
scrollTop: 0,
|
|
23519
|
-
scrollLeft: 0,
|
|
23520
|
-
defaultColumnWidth: 88,
|
|
23521
|
-
defaultRowHeight: 24,
|
|
23522
|
-
mergeData: [],
|
|
23523
|
-
cellData: {},
|
|
23524
|
-
rowData: {},
|
|
23525
|
-
columnData: {},
|
|
23526
|
-
showGridlines: 1,
|
|
23527
|
-
rowHeader: {
|
|
23528
|
-
width: 46,
|
|
23529
|
-
hidden: 0
|
|
23530
|
-
},
|
|
23531
|
-
columnHeader: {
|
|
23532
|
-
height: 20,
|
|
23533
|
-
hidden: 0
|
|
23534
|
-
},
|
|
23535
|
-
rightToLeft: 0
|
|
23536
|
-
};
|
|
23537
|
-
Object.keys(defaultSnapshot).forEach((_key) => {
|
|
23538
|
-
const key = _key;
|
|
23539
|
-
if (typeof snapshot[key] === "undefined") snapshot[key] = defaultSnapshot[key];
|
|
23540
|
-
});
|
|
23541
|
-
const freeze = snapshot.freeze;
|
|
23542
|
-
freeze.xSplit = freeze.xSplit ?? defaultSnapshot.freeze.xSplit;
|
|
23543
|
-
freeze.ySplit = freeze.ySplit ?? defaultSnapshot.freeze.ySplit;
|
|
23544
|
-
freeze.startRow = freeze.ySplit === 0 ? defaultSnapshot.freeze.startRow : freeze.startRow ?? defaultSnapshot.freeze.startRow;
|
|
23545
|
-
freeze.startColumn = freeze.xSplit === 0 ? defaultSnapshot.freeze.startColumn : freeze.startColumn ?? defaultSnapshot.freeze.startColumn;
|
|
23546
|
-
return snapshot;
|
|
23547
|
-
}
|
|
23548
|
-
|
|
23549
23605
|
//#endregion
|
|
23550
23606
|
//#region src/sheets/span-model.ts
|
|
23551
23607
|
var SpanModel = class extends Disposable {
|
|
@@ -25267,8 +25323,7 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
25267
25323
|
}
|
|
25268
25324
|
}
|
|
25269
25325
|
_tryResetFocusOnRemoval(unitId) {
|
|
25270
|
-
|
|
25271
|
-
if (((_this$focused3 = this.focused) === null || _this$focused3 === void 0 ? void 0 : _this$focused3.getUnitId()) === unitId) this._focused$.next(null);
|
|
25326
|
+
if (this._focused$.getValue() === unitId) this.focusUnit(null);
|
|
25272
25327
|
}
|
|
25273
25328
|
_getUnitById(unitId) {
|
|
25274
25329
|
for (const [type, units] of this._unitsByType) {
|
|
@@ -27201,6 +27256,69 @@ var RTree = class {
|
|
|
27201
27256
|
}
|
|
27202
27257
|
};
|
|
27203
27258
|
|
|
27259
|
+
//#endregion
|
|
27260
|
+
//#region src/types/enum/record-filter.ts
|
|
27261
|
+
/**
|
|
27262
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27263
|
+
*
|
|
27264
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27265
|
+
* you may not use this file except in compliance with the License.
|
|
27266
|
+
* You may obtain a copy of the License at
|
|
27267
|
+
*
|
|
27268
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27269
|
+
*
|
|
27270
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27271
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27272
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27273
|
+
* See the License for the specific language governing permissions and
|
|
27274
|
+
* limitations under the License.
|
|
27275
|
+
*/
|
|
27276
|
+
/** Typed record identities shared by compact Table and external report filters. */
|
|
27277
|
+
let RecordValueType = /* @__PURE__ */ function(RecordValueType) {
|
|
27278
|
+
RecordValueType["Blank"] = "blank";
|
|
27279
|
+
RecordValueType["String"] = "string";
|
|
27280
|
+
RecordValueType["Number"] = "number";
|
|
27281
|
+
RecordValueType["Date"] = "date";
|
|
27282
|
+
RecordValueType["Boolean"] = "boolean";
|
|
27283
|
+
RecordValueType["Error"] = "error";
|
|
27284
|
+
return RecordValueType;
|
|
27285
|
+
}({});
|
|
27286
|
+
/** Values are wire identifiers; an absent native Table filter represents All. */
|
|
27287
|
+
let FilterSelectionMode = /* @__PURE__ */ function(FilterSelectionMode) {
|
|
27288
|
+
FilterSelectionMode["All"] = "all";
|
|
27289
|
+
FilterSelectionMode["Include"] = "include";
|
|
27290
|
+
FilterSelectionMode["Exclude"] = "exclude";
|
|
27291
|
+
return FilterSelectionMode;
|
|
27292
|
+
}({});
|
|
27293
|
+
|
|
27294
|
+
//#endregion
|
|
27295
|
+
//#region src/shared/record-value.ts
|
|
27296
|
+
function getRecordValueKey(_value) {
|
|
27297
|
+
const value = _value;
|
|
27298
|
+
if (!isRecord(value) || typeof value.type !== "string") throw new TypeError("Invalid record value.");
|
|
27299
|
+
switch (value.type) {
|
|
27300
|
+
case "blank":
|
|
27301
|
+
if ("value" in value) throw new TypeError("Blank record values cannot have a value.");
|
|
27302
|
+
return "[\"blank\"]";
|
|
27303
|
+
case "string":
|
|
27304
|
+
case "error":
|
|
27305
|
+
if (typeof value.value !== "string") throw new TypeError("Invalid record value.");
|
|
27306
|
+
return JSON.stringify([value.type, value.value]);
|
|
27307
|
+
case "boolean":
|
|
27308
|
+
if (typeof value.value !== "boolean") throw new TypeError("Invalid record value.");
|
|
27309
|
+
return JSON.stringify([value.type, value.value]);
|
|
27310
|
+
case "number":
|
|
27311
|
+
case "date":
|
|
27312
|
+
if (typeof value.value !== "number") throw new TypeError("Invalid record value.");
|
|
27313
|
+
if (!Number.isFinite(value.value)) throw new RangeError("Record numeric values must be finite.");
|
|
27314
|
+
return JSON.stringify([value.type, value.value === 0 ? 0 : value.value]);
|
|
27315
|
+
default: throw new TypeError("Unknown record value type.");
|
|
27316
|
+
}
|
|
27317
|
+
}
|
|
27318
|
+
function isRecord(value) {
|
|
27319
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27320
|
+
}
|
|
27321
|
+
|
|
27204
27322
|
//#endregion
|
|
27205
27323
|
//#region src/shared/timer.ts
|
|
27206
27324
|
/**
|
|
@@ -27247,6 +27365,32 @@ function delayAnimationFrame(frames = 1) {
|
|
|
27247
27365
|
});
|
|
27248
27366
|
}
|
|
27249
27367
|
|
|
27368
|
+
//#endregion
|
|
27369
|
+
//#region src/shared/units.ts
|
|
27370
|
+
/**
|
|
27371
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27372
|
+
*
|
|
27373
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27374
|
+
* you may not use this file except in compliance with the License.
|
|
27375
|
+
* You may obtain a copy of the License at
|
|
27376
|
+
*
|
|
27377
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27378
|
+
*
|
|
27379
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27380
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27381
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27382
|
+
* See the License for the specific language governing permissions and
|
|
27383
|
+
* limitations under the License.
|
|
27384
|
+
*/
|
|
27385
|
+
/** English Metric Units per CSS pixel at 96 DPI. */
|
|
27386
|
+
const EMU_PER_CSS_PX = 9525;
|
|
27387
|
+
function cssPxToEmu(value) {
|
|
27388
|
+
return Math.round(value * EMU_PER_CSS_PX);
|
|
27389
|
+
}
|
|
27390
|
+
function emuToCssPx(value) {
|
|
27391
|
+
return value / EMU_PER_CSS_PX;
|
|
27392
|
+
}
|
|
27393
|
+
|
|
27250
27394
|
//#endregion
|
|
27251
27395
|
//#region src/sheets/clone.ts
|
|
27252
27396
|
/**
|
|
@@ -27473,6 +27617,21 @@ Skeleton = __decorate([__decorateParam(0, (0, _wendellhu_redi.Inject)(LocaleServ
|
|
|
27473
27617
|
//#endregion
|
|
27474
27618
|
//#region src/sheets/sheet-skeleton.ts
|
|
27475
27619
|
/**
|
|
27620
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27621
|
+
*
|
|
27622
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27623
|
+
* you may not use this file except in compliance with the License.
|
|
27624
|
+
* You may obtain a copy of the License at
|
|
27625
|
+
*
|
|
27626
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27627
|
+
*
|
|
27628
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27629
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27630
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27631
|
+
* See the License for the specific language governing permissions and
|
|
27632
|
+
* limitations under the License.
|
|
27633
|
+
*/
|
|
27634
|
+
/**
|
|
27476
27635
|
* Reusable gap fixture for visual and integration testing.
|
|
27477
27636
|
*/
|
|
27478
27637
|
function createSheetGapTestConfig(overrides = {}) {
|
|
@@ -27711,17 +27870,18 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
27711
27870
|
_generateRowMatrixCache(rowCount, rowData, defaultRowHeight) {
|
|
27712
27871
|
let rowTotalHeight = 0;
|
|
27713
27872
|
const rowHeightAccumulation = [];
|
|
27873
|
+
const fallbackHeight = normalizeSheetDimension(defaultRowHeight, 24, false);
|
|
27714
27874
|
const data = rowData;
|
|
27715
27875
|
for (let r = 0; r < rowCount; r++) {
|
|
27716
27876
|
var _this$_gapConfig$rowG2;
|
|
27717
|
-
let rowHeight =
|
|
27877
|
+
let rowHeight = fallbackHeight;
|
|
27718
27878
|
if (this.worksheet.getRowFiltered(r)) rowHeight = 0;
|
|
27719
27879
|
else if (data[r] != null) {
|
|
27720
27880
|
const rowDataItem = data[r];
|
|
27721
27881
|
if (!rowDataItem) continue;
|
|
27722
|
-
const { h =
|
|
27723
|
-
if ((ia == null || ia === 1) &&
|
|
27724
|
-
else rowHeight = h;
|
|
27882
|
+
const { h = fallbackHeight, ah, ia } = rowDataItem;
|
|
27883
|
+
if ((ia == null || ia === 1) && isValidSheetDimension(ah, false)) rowHeight = ah;
|
|
27884
|
+
else rowHeight = normalizeSheetDimension(h, 0);
|
|
27725
27885
|
if (rowDataItem.hd === 1) rowHeight = 0;
|
|
27726
27886
|
}
|
|
27727
27887
|
const gapSize = ((_this$_gapConfig$rowG2 = this._gapConfig.rowGaps) === null || _this$_gapConfig$rowG2 === void 0 || (_this$_gapConfig$rowG2 = _this$_gapConfig$rowG2[r]) === null || _this$_gapConfig$rowG2 === void 0 ? void 0 : _this$_gapConfig$rowG2.size) ?? 0;
|
|
@@ -27740,14 +27900,15 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
27740
27900
|
_generateColumnMatrixCache(colCount, columnData, defaultColumnWidth) {
|
|
27741
27901
|
let columnTotalWidth = 0;
|
|
27742
27902
|
const columnWidthAccumulation = [];
|
|
27903
|
+
const fallbackWidth = normalizeSheetDimension(defaultColumnWidth, 88, false);
|
|
27743
27904
|
const data = columnData;
|
|
27744
27905
|
for (let c = 0; c < colCount; c++) {
|
|
27745
27906
|
var _this$_gapConfig$colG2;
|
|
27746
|
-
let columnWidth =
|
|
27907
|
+
let columnWidth = fallbackWidth;
|
|
27747
27908
|
if (data[c] != null) {
|
|
27748
27909
|
const columnDataItem = data[c];
|
|
27749
27910
|
if (!columnDataItem) continue;
|
|
27750
|
-
if (columnDataItem.w
|
|
27911
|
+
if (columnDataItem.w !== void 0) columnWidth = normalizeSheetDimension(columnDataItem.w, 0);
|
|
27751
27912
|
if (columnDataItem.hd === 1) columnWidth = 0;
|
|
27752
27913
|
}
|
|
27753
27914
|
const gapSize = ((_this$_gapConfig$colG2 = this._gapConfig.colGaps) === null || _this$_gapConfig$colG2 === void 0 || (_this$_gapConfig$colG2 = _this$_gapConfig$colG2[c]) === null || _this$_gapConfig$colG2 === void 0 ? void 0 : _this$_gapConfig$colG2.size) ?? 0;
|
|
@@ -28070,13 +28231,14 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
28070
28231
|
};
|
|
28071
28232
|
}
|
|
28072
28233
|
/**
|
|
28073
|
-
*
|
|
28234
|
+
* Coordinates include the row and column headers. Defaults to the current viewport transform;
|
|
28235
|
+
* pass unit scales and zero scroll for Sheet model coordinates.
|
|
28074
28236
|
*/
|
|
28075
|
-
getCellIndexAndOffsetByPosition(offsetX, offsetY
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
});
|
|
28237
|
+
getCellIndexAndOffsetByPosition(offsetX, offsetY, scaleX = this._scaleX, scaleY = this._scaleY, scrollXY = {
|
|
28238
|
+
x: this._scrollX,
|
|
28239
|
+
y: this._scrollY
|
|
28240
|
+
}) {
|
|
28241
|
+
const { actualRow, actualColumn, startX, startY } = this.getCellWithCoordByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
28080
28242
|
return {
|
|
28081
28243
|
row: actualRow,
|
|
28082
28244
|
rowOffset: offsetY - startY,
|
|
@@ -28462,41 +28624,6 @@ let DataValidationType = /* @__PURE__ */ function(DataValidationType) {
|
|
|
28462
28624
|
return DataValidationType;
|
|
28463
28625
|
}({});
|
|
28464
28626
|
|
|
28465
|
-
//#endregion
|
|
28466
|
-
//#region src/types/enum/record-filter.ts
|
|
28467
|
-
/**
|
|
28468
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
28469
|
-
*
|
|
28470
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
28471
|
-
* you may not use this file except in compliance with the License.
|
|
28472
|
-
* You may obtain a copy of the License at
|
|
28473
|
-
*
|
|
28474
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28475
|
-
*
|
|
28476
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
28477
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28478
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28479
|
-
* See the License for the specific language governing permissions and
|
|
28480
|
-
* limitations under the License.
|
|
28481
|
-
*/
|
|
28482
|
-
/** Typed record identities shared by compact Table and external report filters. */
|
|
28483
|
-
let RecordValueType = /* @__PURE__ */ function(RecordValueType) {
|
|
28484
|
-
RecordValueType["Blank"] = "blank";
|
|
28485
|
-
RecordValueType["String"] = "string";
|
|
28486
|
-
RecordValueType["Number"] = "number";
|
|
28487
|
-
RecordValueType["Date"] = "date";
|
|
28488
|
-
RecordValueType["Boolean"] = "boolean";
|
|
28489
|
-
RecordValueType["Error"] = "error";
|
|
28490
|
-
return RecordValueType;
|
|
28491
|
-
}({});
|
|
28492
|
-
/** Values are wire identifiers; an absent native Table filter represents All. */
|
|
28493
|
-
let FilterSelectionMode = /* @__PURE__ */ function(FilterSelectionMode) {
|
|
28494
|
-
FilterSelectionMode["All"] = "all";
|
|
28495
|
-
FilterSelectionMode["Include"] = "include";
|
|
28496
|
-
FilterSelectionMode["Exclude"] = "exclude";
|
|
28497
|
-
return FilterSelectionMode;
|
|
28498
|
-
}({});
|
|
28499
|
-
|
|
28500
28627
|
//#endregion
|
|
28501
28628
|
//#region src/services/resource-loader/resource-loader.service.ts
|
|
28502
28629
|
let ResourceLoaderService = class ResourceLoaderService extends Disposable {
|
|
@@ -28915,6 +29042,7 @@ exports.DocumentFlavor = DocumentFlavor;
|
|
|
28915
29042
|
exports.DocxBreakType = DocxBreakType;
|
|
28916
29043
|
exports.DrawingTypeEnum = DrawingTypeEnum;
|
|
28917
29044
|
exports.EDITOR_ACTIVATED = EDITOR_ACTIVATED;
|
|
29045
|
+
exports.EMU_PER_CSS_PX = EMU_PER_CSS_PX;
|
|
28918
29046
|
exports.EXCEL_1904_OFFSET = EXCEL_1904_OFFSET;
|
|
28919
29047
|
exports.EXTENSION_NAMES = EXTENSION_NAMES;
|
|
28920
29048
|
exports.ErrorService = ErrorService;
|
|
@@ -29287,6 +29415,7 @@ exports.createRandomId = createRandomId;
|
|
|
29287
29415
|
exports.createRowColIter = createRowColIter;
|
|
29288
29416
|
exports.createSectionId = createSectionId;
|
|
29289
29417
|
exports.createSheetGapTestConfig = createSheetGapTestConfig;
|
|
29418
|
+
exports.cssPxToEmu = cssPxToEmu;
|
|
29290
29419
|
exports.currencySymbols = currencySymbols;
|
|
29291
29420
|
exports.customNameCharacterCheck = customNameCharacterCheck;
|
|
29292
29421
|
exports.dateKit = dateKit;
|
|
@@ -29301,6 +29430,7 @@ exports.dedupeBy = dedupeBy;
|
|
|
29301
29430
|
exports.deepCompare = deepCompare;
|
|
29302
29431
|
exports.delayAnimationFrame = delayAnimationFrame;
|
|
29303
29432
|
exports.deleteContent = deleteContent;
|
|
29433
|
+
exports.emuToCssPx = emuToCssPx;
|
|
29304
29434
|
exports.excelDateSerial = excelDateSerial;
|
|
29305
29435
|
exports.excelDateTimePartsToSerial = excelDateTimePartsToSerial;
|
|
29306
29436
|
exports.excelDateTimeSerial = excelDateTimeSerial;
|
|
@@ -29360,6 +29490,7 @@ exports.getParagraphContentStartOffsets = getParagraphContentStartOffsets;
|
|
|
29360
29490
|
exports.getParagraphFollowingBlockOffset = getParagraphFollowingBlockOffset;
|
|
29361
29491
|
exports.getParagraphsSlice = getParagraphsSlice;
|
|
29362
29492
|
exports.getPlainText = getPlainText;
|
|
29493
|
+
exports.getRecordValueKey = getRecordValueKey;
|
|
29363
29494
|
exports.getReverseDirection = getReverseDirection;
|
|
29364
29495
|
exports.getRichTextEditPath = getRichTextEditPath;
|
|
29365
29496
|
exports.getSdtBindingKey = getSdtBindingKey;
|
|
@@ -29446,7 +29577,10 @@ exports.isSameStyleTextRun = isSameStyleTextRun;
|
|
|
29446
29577
|
exports.isTextFormat = isTextFormat;
|
|
29447
29578
|
exports.isUnitRangesEqual = isUnitRangesEqual;
|
|
29448
29579
|
exports.isValidBaseRecordId = isValidBaseRecordId;
|
|
29580
|
+
exports.isValidColumnDimensions = isValidColumnDimensions;
|
|
29449
29581
|
exports.isValidRange = isValidRange;
|
|
29582
|
+
exports.isValidRowDimensions = isValidRowDimensions;
|
|
29583
|
+
exports.isValidSheetDimension = isValidSheetDimension;
|
|
29450
29584
|
Object.defineProperty(exports, "isValueDependencyItem", {
|
|
29451
29585
|
enumerable: true,
|
|
29452
29586
|
get: function () {
|
package/lib/es/facade.js
CHANGED
|
@@ -38,10 +38,9 @@ var FBaseInitialable = class extends Disposable {
|
|
|
38
38
|
this._injector = _injector;
|
|
39
39
|
const Ctor = this.constructor;
|
|
40
40
|
if (Boolean(Ctor[ManualInitSymbol])) return;
|
|
41
|
-
const self = this;
|
|
42
41
|
const initializers = Object.getPrototypeOf(this)[InitializerSymbol$1];
|
|
43
|
-
if (initializers) initializers.forEach(
|
|
44
|
-
fn.apply(
|
|
42
|
+
if (initializers) initializers.forEach((fn) => {
|
|
43
|
+
fn.apply(this, [_injector]);
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
/**
|