@itwin/core-backend 5.6.0-dev.8 → 5.7.0-dev.2
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/CHANGELOG.md +11 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +37 -14
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +33 -24
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +42 -4
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +0 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +5 -0
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +7 -0
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/StashManager.d.ts +1 -2
- package/lib/cjs/StashManager.d.ts.map +1 -1
- package/lib/cjs/StashManager.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +74 -52
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +114 -26
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +14 -1
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +14 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.js +29 -10
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.js +6 -6
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +37 -14
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +33 -24
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +42 -4
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts.map +1 -1
- package/lib/esm/SQLiteDb.js +0 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts +5 -0
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +7 -0
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/StashManager.d.ts +1 -2
- package/lib/esm/StashManager.d.ts.map +1 -1
- package/lib/esm/StashManager.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +74 -52
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +114 -26
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +14 -1
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +14 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.js +29 -10
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.js +6 -6
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +2 -3
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +39 -4
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.js +49 -42
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +546 -22
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +87 -44
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js +4 -4
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +9 -9
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/package.json +14 -14
|
@@ -257,10 +257,11 @@ describe("layoutTextBlock", () => {
|
|
|
257
257
|
});
|
|
258
258
|
it("adds margins", function () {
|
|
259
259
|
const expectMargins = (layoutRange, marginRange, margins) => {
|
|
260
|
-
|
|
261
|
-
expect(marginRange.
|
|
262
|
-
expect(marginRange.
|
|
263
|
-
expect(marginRange.
|
|
260
|
+
const textHeight = TextStyleSettings.defaultProps.textHeight;
|
|
261
|
+
expect(marginRange.low.x).to.equal(layoutRange.low.x - ((margins.left ?? 0) * textHeight));
|
|
262
|
+
expect(marginRange.high.x).to.equal(layoutRange.high.x + ((margins.right ?? 0) * textHeight));
|
|
263
|
+
expect(marginRange.low.y).to.equal(layoutRange.low.y - ((margins.bottom ?? 0) * textHeight));
|
|
264
|
+
expect(marginRange.high.y).to.equal(layoutRange.high.y + ((margins.top ?? 0) * textHeight));
|
|
264
265
|
};
|
|
265
266
|
const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor: 0 } });
|
|
266
267
|
textBlock.appendRun(makeTextRun("abc"));
|
|
@@ -296,6 +297,7 @@ describe("layoutTextBlock", () => {
|
|
|
296
297
|
return Math.round(num * multiplier) / multiplier;
|
|
297
298
|
};
|
|
298
299
|
it("aligns text of the same size on the bottom of the line", () => {
|
|
300
|
+
const textHeight = TextStyleSettings.defaultProps.textHeight;
|
|
299
301
|
const textBlock = TextBlock.create();
|
|
300
302
|
const run1 = TextRun.create({ content: "abc" });
|
|
301
303
|
const run2 = TextRun.create({ content: "defg" });
|
|
@@ -304,8 +306,8 @@ describe("layoutTextBlock", () => {
|
|
|
304
306
|
const layout = doLayout(textBlock);
|
|
305
307
|
const run1Layout = layout.lines[0].runs[0];
|
|
306
308
|
const run2Layout = layout.lines[0].runs[1];
|
|
307
|
-
expect(run1Layout.range.yLength()).to.equal(
|
|
308
|
-
expect(run2Layout.range.yLength()).to.equal(
|
|
309
|
+
expect(run1Layout.range.yLength()).to.equal(textHeight);
|
|
310
|
+
expect(run2Layout.range.yLength()).to.equal(textHeight);
|
|
309
311
|
expect(run1Layout.offsetFromLine.y).to.equal(0);
|
|
310
312
|
expect(run2Layout.offsetFromLine.y).to.equal(0);
|
|
311
313
|
});
|
|
@@ -375,6 +377,7 @@ describe("layoutTextBlock", () => {
|
|
|
375
377
|
it("produces one line per paragraph if document width <= 0", () => {
|
|
376
378
|
const lineSpacingFactor = 0.5;
|
|
377
379
|
const paragraphSpacingFactor = 0.25;
|
|
380
|
+
const textHeight = TextStyleSettings.defaultProps.textHeight;
|
|
378
381
|
const textBlock = TextBlock.create({ styleOverrides: { paragraphSpacingFactor, lineSpacingFactor } });
|
|
379
382
|
for (let i = 0; i < 4; i++) {
|
|
380
383
|
const layout = doLayout(textBlock);
|
|
@@ -384,7 +387,7 @@ describe("layoutTextBlock", () => {
|
|
|
384
387
|
else {
|
|
385
388
|
expect(layout.lines.length).to.equal(i);
|
|
386
389
|
expect(layout.range.low.x).to.equal(0);
|
|
387
|
-
expect(layout.range.low.y).to.equal(-i - ((i - 1) * (lineSpacingFactor + paragraphSpacingFactor)));
|
|
390
|
+
expect(layout.range.low.y).to.equal((-i - ((i - 1) * (lineSpacingFactor + paragraphSpacingFactor))) * textHeight);
|
|
388
391
|
expect(layout.range.high.x).to.equal(i * 3);
|
|
389
392
|
expect(layout.range.high.y).to.equal(0);
|
|
390
393
|
}
|
|
@@ -393,7 +396,7 @@ describe("layoutTextBlock", () => {
|
|
|
393
396
|
expect(line.runs.length).to.equal(l + 1);
|
|
394
397
|
expect(line.range.low.x).to.equal(0);
|
|
395
398
|
expect(line.range.low.y).to.equal(0);
|
|
396
|
-
expect(line.range.high.y).to.equal(
|
|
399
|
+
expect(line.range.high.y).to.equal(textHeight);
|
|
397
400
|
expect(line.range.high.x).to.equal(3 * (l + 1));
|
|
398
401
|
for (const run of line.runs) {
|
|
399
402
|
expect(run.charOffset).to.equal(0);
|
|
@@ -401,7 +404,7 @@ describe("layoutTextBlock", () => {
|
|
|
401
404
|
expect(run.range.low.x).to.equal(0);
|
|
402
405
|
expect(run.range.low.y).to.equal(0);
|
|
403
406
|
expect(run.range.high.x).to.equal(3);
|
|
404
|
-
expect(run.range.high.y).to.equal(
|
|
407
|
+
expect(run.range.high.y).to.equal(textHeight);
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
410
|
const p = textBlock.appendParagraph();
|
|
@@ -610,31 +613,33 @@ describe("layoutTextBlock", () => {
|
|
|
610
613
|
if (!isIntlSupported()) {
|
|
611
614
|
this.skip();
|
|
612
615
|
}
|
|
613
|
-
const
|
|
616
|
+
const textHeight = TextStyleSettings.defaultProps.textHeight;
|
|
617
|
+
const block = TextBlock.create({ width: 3, styleOverrides: { lineSpacingFactor: 0 } });
|
|
614
618
|
function expectBlockRange(width, height) {
|
|
615
619
|
const layout = doLayout(block);
|
|
616
620
|
expectRange(width, height, layout.range);
|
|
617
621
|
}
|
|
618
622
|
block.appendRun(makeTextRun("abc"));
|
|
619
|
-
expectBlockRange(3,
|
|
623
|
+
expectBlockRange(3, textHeight);
|
|
620
624
|
block.appendRun(makeTextRun("defg"));
|
|
621
|
-
expectBlockRange(4, 2);
|
|
625
|
+
expectBlockRange(4, 2 * textHeight);
|
|
622
626
|
block.width = 1;
|
|
623
|
-
expectBlockRange(4, 2);
|
|
627
|
+
expectBlockRange(4, 2 * textHeight);
|
|
624
628
|
block.width = 8;
|
|
625
|
-
expectBlockRange(8,
|
|
629
|
+
expectBlockRange(8, textHeight);
|
|
626
630
|
block.width = 6;
|
|
627
|
-
expectBlockRange(6, 2);
|
|
631
|
+
expectBlockRange(6, 2 * textHeight);
|
|
628
632
|
block.width = 10;
|
|
629
|
-
expectBlockRange(10,
|
|
633
|
+
expectBlockRange(10, textHeight);
|
|
630
634
|
block.appendRun(makeTextRun("hijk"));
|
|
631
|
-
expectBlockRange(10, 2);
|
|
635
|
+
expectBlockRange(10, 2 * textHeight);
|
|
632
636
|
});
|
|
633
637
|
it("computes range for split runs", function () {
|
|
634
638
|
if (!isIntlSupported()) {
|
|
635
639
|
this.skip();
|
|
636
640
|
}
|
|
637
|
-
const
|
|
641
|
+
const textHeight = 1;
|
|
642
|
+
const block = TextBlock.create({ styleOverrides: { textHeight, lineSpacingFactor: 0 } });
|
|
638
643
|
function expectBlockRange(width, height) {
|
|
639
644
|
const layout = doLayout(block);
|
|
640
645
|
expectRange(width, height, layout.range);
|
|
@@ -643,9 +648,9 @@ describe("layoutTextBlock", () => {
|
|
|
643
648
|
expect(sentence.length).to.equal(19);
|
|
644
649
|
block.appendRun(makeTextRun(sentence));
|
|
645
650
|
block.width = 19;
|
|
646
|
-
expectBlockRange(19,
|
|
651
|
+
expectBlockRange(19, textHeight);
|
|
647
652
|
block.width = 10;
|
|
648
|
-
expectBlockRange(10, 2);
|
|
653
|
+
expectBlockRange(10, 2 * textHeight);
|
|
649
654
|
});
|
|
650
655
|
it("computes range for list markers and list items based on indentation", function () {
|
|
651
656
|
const lineSpacingFactor = 2;
|
|
@@ -786,6 +791,7 @@ describe("layoutTextBlock", () => {
|
|
|
786
791
|
this.skip();
|
|
787
792
|
}
|
|
788
793
|
const block = TextBlock.create({ styleOverrides: { lineSpacingFactor: 0 } });
|
|
794
|
+
const textHeight = TextStyleSettings.defaultProps.textHeight;
|
|
789
795
|
function expectBlockRange(width, height, justification) {
|
|
790
796
|
const layout = doLayout(block, {
|
|
791
797
|
findTextStyle: () => TextStyleSettings.fromJSON({ justification })
|
|
@@ -798,52 +804,52 @@ describe("layoutTextBlock", () => {
|
|
|
798
804
|
});
|
|
799
805
|
expect(layout.lines.length).least(lineIndex + 1);
|
|
800
806
|
const line = layout.lines[lineIndex];
|
|
801
|
-
expect(line.offsetFromDocument.y).to.equal(-(lineIndex + 1));
|
|
807
|
+
expect(line.offsetFromDocument.y).to.equal(-((lineIndex + 1) * textHeight));
|
|
802
808
|
expect(line.offsetFromDocument.x).to.equal(offset);
|
|
803
809
|
}
|
|
804
810
|
// Two text runs with 7 characters total.
|
|
805
811
|
block.appendRun(makeTextRun("abc"));
|
|
806
812
|
block.appendRun(makeTextRun("defg"));
|
|
807
813
|
// 1 line of text with width 0: left, right, center justification.
|
|
808
|
-
expectBlockRange(7,
|
|
814
|
+
expectBlockRange(7, textHeight, "left");
|
|
809
815
|
expectLineOffset(0, 0, "left");
|
|
810
|
-
expectBlockRange(7,
|
|
816
|
+
expectBlockRange(7, textHeight, "right");
|
|
811
817
|
expectLineOffset(0, 0, "right");
|
|
812
|
-
expectBlockRange(7,
|
|
818
|
+
expectBlockRange(7, textHeight, "center");
|
|
813
819
|
expectLineOffset(0, 0, "center");
|
|
814
820
|
// 1 line of text from a width greater than number of characters: left, right, center justification.
|
|
815
821
|
block.width = 10;
|
|
816
|
-
expectBlockRange(10,
|
|
822
|
+
expectBlockRange(10, textHeight, "left");
|
|
817
823
|
expectLineOffset(0, 0, "left");
|
|
818
|
-
expectBlockRange(10,
|
|
824
|
+
expectBlockRange(10, textHeight, "right");
|
|
819
825
|
expectLineOffset(3, 0, "right"); // 3 = 10 - 7
|
|
820
|
-
expectBlockRange(10,
|
|
826
|
+
expectBlockRange(10, textHeight, "center");
|
|
821
827
|
expectLineOffset(1.5, 0, "center"); // 1.5 = (10 - 7) / 2
|
|
822
828
|
// 2 line of text from a width less than number of characters: left, right, center justification.
|
|
823
829
|
block.width = 4;
|
|
824
|
-
expectBlockRange(4, 2, "left");
|
|
830
|
+
expectBlockRange(4, 2 * textHeight, "left");
|
|
825
831
|
expectLineOffset(0, 0, "left");
|
|
826
832
|
expectLineOffset(0, 1, "left");
|
|
827
|
-
expectBlockRange(4, 2, "right");
|
|
833
|
+
expectBlockRange(4, 2 * textHeight, "right");
|
|
828
834
|
expectLineOffset(1, 0, "right");
|
|
829
835
|
expectLineOffset(0, 1, "right");
|
|
830
|
-
expectBlockRange(4, 2, "center");
|
|
836
|
+
expectBlockRange(4, 2 * textHeight, "center");
|
|
831
837
|
expectLineOffset(0.5, 0, "center");
|
|
832
838
|
expectLineOffset(0, 1, "center");
|
|
833
839
|
// Testing text longer the the width of the text block.
|
|
834
840
|
block.width = 2;
|
|
835
|
-
expectBlockRange(4, 2, "left");
|
|
841
|
+
expectBlockRange(4, 2 * textHeight, "left");
|
|
836
842
|
expectLineOffset(0, 0, "left");
|
|
837
843
|
expectLineOffset(0, 1, "left");
|
|
838
|
-
expectBlockRange(4, 2, "right");
|
|
844
|
+
expectBlockRange(4, 2 * textHeight, "right");
|
|
839
845
|
expectLineOffset(-1, 0, "right");
|
|
840
846
|
expectLineOffset(-2, 1, "right");
|
|
841
847
|
block.appendRun(makeTextRun("123456789"));
|
|
842
|
-
expectBlockRange(9, 3, "right");
|
|
848
|
+
expectBlockRange(9, 3 * textHeight, "right");
|
|
843
849
|
expectLineOffset(-1, 0, "right");
|
|
844
850
|
expectLineOffset(-2, 1, "right");
|
|
845
851
|
expectLineOffset(-7, 2, "right");
|
|
846
|
-
expectBlockRange(9, 3, "center");
|
|
852
|
+
expectBlockRange(9, 3 * textHeight, "center");
|
|
847
853
|
expectLineOffset(-0.5, 0, "center");
|
|
848
854
|
expectLineOffset(-1, 1, "center");
|
|
849
855
|
expectLineOffset(-3.5, 2, "center");
|
|
@@ -1587,6 +1593,7 @@ describe("produceTextBlockGeometry", () => {
|
|
|
1587
1593
|
expect(entries[17].text?.text).to.equal("Yellow");
|
|
1588
1594
|
});
|
|
1589
1595
|
it("offsets geometry entries by margins", () => {
|
|
1596
|
+
const textHeight = TextStyleSettings.defaults.textHeight;
|
|
1590
1597
|
function makeGeometryWithMargins(anchor, margins) {
|
|
1591
1598
|
const runs = [makeText()];
|
|
1592
1599
|
const block = makeTextBlock(runs);
|
|
@@ -1607,25 +1614,25 @@ describe("produceTextBlockGeometry", () => {
|
|
|
1607
1614
|
// Test case: bottom, left
|
|
1608
1615
|
let props = makeGeometryWithMargins({ horizontal: "left", vertical: "bottom" }, margins);
|
|
1609
1616
|
expect(props).not.to.be.undefined;
|
|
1610
|
-
expect(props?.origin, "Expected geometry to be offset by left and bottom margins").to.deep.equal({ x: left, y: bottom, z: 0 });
|
|
1617
|
+
expect(props?.origin, "Expected geometry to be offset by left and bottom margins").to.deep.equal({ x: left * textHeight, y: bottom * textHeight, z: 0 });
|
|
1611
1618
|
// Test case: top, right
|
|
1612
1619
|
props = makeGeometryWithMargins({ vertical: "top", horizontal: "right" }, margins);
|
|
1613
|
-
let x = (right + width) * -1;
|
|
1614
|
-
let y = (top + height) * -1;
|
|
1620
|
+
let x = (right * textHeight + width) * -1;
|
|
1621
|
+
let y = (top * textHeight + height) * -1;
|
|
1615
1622
|
expect(props).not.to.be.undefined;
|
|
1616
1623
|
expect(props?.origin, "Expected geometry to be offset by top and right margins").to.deep.equal({ x, y, z: 0 });
|
|
1617
1624
|
// Test case: middle, center
|
|
1618
1625
|
props = makeGeometryWithMargins({ vertical: "middle", horizontal: "center" }, margins);
|
|
1619
|
-
x = (left - right - width) / 2;
|
|
1620
|
-
y = (bottom - top - height) / 2;
|
|
1626
|
+
x = (left * textHeight - right * textHeight - width) / 2;
|
|
1627
|
+
y = (bottom * textHeight - top * textHeight - height) / 2;
|
|
1621
1628
|
expect(props).not.to.be.undefined;
|
|
1622
1629
|
expect(props?.origin, "Expected geometry to be centered in the margins").to.deep.equal({ x, y, z: 0 });
|
|
1623
1630
|
}
|
|
1624
1631
|
// xLength will be 4 because of the mock implementation on line 16.
|
|
1625
1632
|
// yLength will be 1 because of the mock implementation on line 16.
|
|
1626
|
-
testMargins({ top: 0, right: 0, bottom: 0, left: 0 },
|
|
1627
|
-
testMargins({ top: 1, right: 2, bottom: 3, left: 4 },
|
|
1628
|
-
testMargins({ top: -1, right: -2, bottom: -3, left: -4 },
|
|
1633
|
+
testMargins({ top: 0, right: 0, bottom: 0, left: 0 }, textHeight, 4);
|
|
1634
|
+
testMargins({ top: 1, right: 2, bottom: 3, left: 4 }, textHeight, 4);
|
|
1635
|
+
testMargins({ top: -1, right: -2, bottom: -3, left: -4 }, textHeight, 4);
|
|
1629
1636
|
});
|
|
1630
1637
|
});
|
|
1631
1638
|
// Ignoring the text strings from the spell checker
|