@contrail/documents 2.4.0-alpha.86639ad → 2.4.0-alpha.8be4908
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 +33 -16
- package/lib/containers/container-kind.d.ts +0 -1
- package/lib/containers/container-kind.js +2 -2
- package/lib/containers/document-container-index.d.ts +2 -1
- package/lib/containers/document-container-index.js +14 -5
- package/lib/containers/document-container.d.ts +4 -3
- package/lib/containers/document-container.js +15 -11
- package/lib/containers/document-container.service.js +18 -41
- package/lib/util/dynamic-text/dynamic-text-util.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,18 +13,25 @@ Also shipped on the 1.x line as 1.21.0.
|
|
|
13
13
|
|
|
14
14
|
- `DocumentContainerService.buildIndex` and `DocumentContainerIndex` — which containers hold which
|
|
15
15
|
elements, for one document, resolved once and read back by lookup. A container is a frame or a
|
|
16
|
-
section, described by a `ContainerKind` carrying `elementType
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
section, described by a `ContainerKind` carrying `elementType` and `nests`. An element belongs to
|
|
17
|
+
the container whose box covers its anchor point and which is drawn below it, unless the element's
|
|
18
|
+
own box encloses that container or the element is a group holding it. `nests` decides the shape of
|
|
19
|
+
the answer: sections nest, so an element in a section inside another is in both, and the chain
|
|
20
|
+
requires the inner container to be drawn above the outer; frames do not, so an element covered by
|
|
21
|
+
two frames is in the topmost. A container of another kind is placed by the same rules as any
|
|
22
|
+
element, so a frame can be in a section and a section drawn above a frame is in that frame. The
|
|
23
|
+
rule is written out in `src/containers/DOCUMENT_CONTAINERS_SPEC.md`, which the code is measured
|
|
24
|
+
against.
|
|
25
|
+
- `SECTION_ELEMENT_TYPE` and `FRAME_ELEMENT_TYPE` in `document-element-constants`, so the rule
|
|
26
|
+
above has one definition rather than one per app. `SHAPE_ELEMENT_TYPES` moved here with them; no
|
|
27
|
+
container rule reads it, and it is exported for the board's own shape handling.
|
|
28
|
+
- `DocumentContainerUtil.resizeKeepingAnchor` — the size a value needs and the position that keeps
|
|
29
|
+
the element's anchor where it is, returned together. Applying one without the other drags the
|
|
30
|
+
drawn corner that membership reads, and `calculateSize` alone let a caller do exactly that.
|
|
24
31
|
- `DocumentContainerUtil` — the container geometry as statics, with `anchorFor` for a caller
|
|
25
32
|
holding an element rather than a measured box.
|
|
26
33
|
- `positionKeepingAnchor` — where an element has to sit for its drawn corner to land where it did
|
|
27
|
-
before a resize. Rotation turns about the centre and the centre moves with the size, so a rotated
|
|
34
|
+
before a resize. Prefer `resizeKeepingAnchor` above, which pairs it with the size. Rotation turns about the centre and the centre moves with the size, so a rotated
|
|
28
35
|
element resized about its stored position drags its corner along with it. The board already makes
|
|
29
36
|
this move; a server recomputing a dynamic text has to make the same one, or the corner is not the
|
|
30
37
|
fixed point the anchor rule needs.
|
|
@@ -51,10 +58,17 @@ Also shipped on the 1.x line as 1.21.0.
|
|
|
51
58
|
- The corner is the rotated one (VIBE-9567). A 200x20 text turned on its side draws as a 20x200
|
|
52
59
|
column, and its unrotated `position` can sit well clear of the frame it is visibly on, which
|
|
53
60
|
reported "Move to a frame" for a vertical text the user could see was placed correctly.
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
- An element covering a container is not inside it, whatever its type. This replaces a rule that
|
|
62
|
+
excluded only shapes wider and taller than the container, which let a background image join the
|
|
63
|
+
frame it covered and needed an exemption for dynamic text, whose size the container decides. An
|
|
64
|
+
unrotated dynamic text cannot be excluded by enclosure, since its anchor is the corner of the box
|
|
65
|
+
it would have to cover with.
|
|
66
|
+
- `isDynamicText` requires a `propertyBindings.text` binding, which is the one the value is read
|
|
67
|
+
from. The text tool creates an element with empty `propertyBindings` and `propertyBindingsMetaData`
|
|
68
|
+
and both are truthy, so an unconfigured text was anchored at its corner while the canvas centred
|
|
69
|
+
it.
|
|
70
|
+
- A line or callout is measured from the elements it connects even with no stored `position` of its
|
|
71
|
+
own, where it was previously left out of the index entirely.
|
|
58
72
|
- `min` and `max` rendered an infinity sign when every member value was empty. The early return
|
|
59
73
|
checked the list length before the empty values were filtered out, so `Math.min` of nothing
|
|
60
74
|
reached the formatter. Both now fall through to `n/a`.
|
|
@@ -71,9 +85,12 @@ Also shipped on the 1.x line as 1.21.0.
|
|
|
71
85
|
caller holding an element gets the answer the index would give it. Reading `size` directly
|
|
72
86
|
disagreed for the types whose box is not position plus size: a component's box is built from the
|
|
73
87
|
rows it draws, and a line's comes from its `lineDefinition`.
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
- A container path is a containment chain, walked outward from the container the element sits on.
|
|
89
|
+
Two containers that merely cross are not a chain, so the later-drawn one takes the element rather
|
|
90
|
+
than both claiming it. `containerPathAtPoint` walks the same chain, so a drop preview agrees with
|
|
91
|
+
the drop; it applies only the anchor rule, having no element to compare against a container.
|
|
92
|
+
- `buildIndex` scans element types before measuring anything, so a document holding no containers
|
|
93
|
+
of the kinds asked for returns an empty index without a geometry pass.
|
|
77
94
|
|
|
78
95
|
## [2.3.0] - 2026-09-21
|
|
79
96
|
|
|
@@ -3,7 +3,6 @@ export type ContainerElementType = typeof FRAME_ELEMENT_TYPE | typeof SECTION_EL
|
|
|
3
3
|
export interface ContainerKind {
|
|
4
4
|
elementType: ContainerElementType;
|
|
5
5
|
nests: boolean;
|
|
6
|
-
layer: number;
|
|
7
6
|
}
|
|
8
7
|
export declare const SECTION_KIND: ContainerKind;
|
|
9
8
|
export declare const FRAME_KIND: ContainerKind;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CONTAINER_KINDS = exports.FRAME_KIND = exports.SECTION_KIND = void 0;
|
|
4
4
|
const document_element_constants_1 = require("../document-element-constants");
|
|
5
|
-
exports.SECTION_KIND = { elementType: document_element_constants_1.SECTION_ELEMENT_TYPE, nests: true
|
|
6
|
-
exports.FRAME_KIND = { elementType: document_element_constants_1.FRAME_ELEMENT_TYPE, nests: false
|
|
5
|
+
exports.SECTION_KIND = { elementType: document_element_constants_1.SECTION_ELEMENT_TYPE, nests: true };
|
|
6
|
+
exports.FRAME_KIND = { elementType: document_element_constants_1.FRAME_ELEMENT_TYPE, nests: false };
|
|
7
7
|
exports.CONTAINER_KINDS = [exports.SECTION_KIND, exports.FRAME_KIND];
|
|
@@ -10,6 +10,7 @@ export declare class DocumentContainerIndex {
|
|
|
10
10
|
memberIdsByContainerId: Map<string, string[]>;
|
|
11
11
|
containerIdsByElementType: Map<string, string[]>;
|
|
12
12
|
});
|
|
13
|
+
static empty(): DocumentContainerIndex;
|
|
13
14
|
getContainer(containerId: string): DocumentContainer | null;
|
|
14
15
|
containersOf(documentElementId: string, elementType: ContainerElementType): DocumentContainer[];
|
|
15
16
|
containerIdsOf(documentElementId: string, elementType: ContainerElementType): readonly string[];
|
|
@@ -17,8 +18,8 @@ export declare class DocumentContainerIndex {
|
|
|
17
18
|
memberIdsOf(containerId: string): readonly string[];
|
|
18
19
|
memberDocumentElementsOf(containerId: string): DocumentElement[];
|
|
19
20
|
containerPathAtPoint(point: PositionDefinition, elementType: ContainerElementType): readonly string[];
|
|
20
|
-
maxDepth(elementType: ContainerElementType): number;
|
|
21
21
|
private containersOfType;
|
|
22
22
|
private resolveAll;
|
|
23
23
|
private containerPath;
|
|
24
|
+
private containerPathCopy;
|
|
24
25
|
}
|
|
@@ -6,6 +6,15 @@ class DocumentContainerIndex {
|
|
|
6
6
|
constructor(data) {
|
|
7
7
|
this.data = data;
|
|
8
8
|
}
|
|
9
|
+
static empty() {
|
|
10
|
+
return new DocumentContainerIndex({
|
|
11
|
+
documentElementsById: new Map(),
|
|
12
|
+
containersById: new Map(),
|
|
13
|
+
containerPathsByDocumentElementId: new Map(),
|
|
14
|
+
memberIdsByContainerId: new Map(),
|
|
15
|
+
containerIdsByElementType: new Map(),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
9
18
|
getContainer(containerId) {
|
|
10
19
|
var _a;
|
|
11
20
|
return (_a = this.data.containersById.get(containerId)) !== null && _a !== void 0 ? _a : null;
|
|
@@ -14,7 +23,7 @@ class DocumentContainerIndex {
|
|
|
14
23
|
return this.resolveAll(this.containerIdsOf(documentElementId, elementType));
|
|
15
24
|
}
|
|
16
25
|
containerIdsOf(documentElementId, elementType) {
|
|
17
|
-
return this.
|
|
26
|
+
return this.containerPathCopy(documentElementId, elementType);
|
|
18
27
|
}
|
|
19
28
|
innermostContainerIdOf(documentElementId, elementType) {
|
|
20
29
|
const path = this.containerPath(documentElementId, elementType);
|
|
@@ -22,7 +31,7 @@ class DocumentContainerIndex {
|
|
|
22
31
|
}
|
|
23
32
|
memberIdsOf(containerId) {
|
|
24
33
|
var _a;
|
|
25
|
-
return (_a = this.data.memberIdsByContainerId.get(containerId)) !== null && _a !== void 0 ? _a : [];
|
|
34
|
+
return [...((_a = this.data.memberIdsByContainerId.get(containerId)) !== null && _a !== void 0 ? _a : [])];
|
|
26
35
|
}
|
|
27
36
|
memberDocumentElementsOf(containerId) {
|
|
28
37
|
const members = [];
|
|
@@ -42,9 +51,6 @@ class DocumentContainerIndex {
|
|
|
42
51
|
const path = nests ? document_container_1.DocumentContainerUtil.chain(covering) : document_container_1.DocumentContainerUtil.topmost(covering);
|
|
43
52
|
return path.map((container) => container.id);
|
|
44
53
|
}
|
|
45
|
-
maxDepth(elementType) {
|
|
46
|
-
return this.containersOfType(elementType).reduce((max, container) => Math.max(max, container.depth + 1), 0);
|
|
47
|
-
}
|
|
48
54
|
containersOfType(elementType) {
|
|
49
55
|
var _a;
|
|
50
56
|
return this.resolveAll((_a = this.data.containerIdsByElementType.get(elementType)) !== null && _a !== void 0 ? _a : []);
|
|
@@ -63,5 +69,8 @@ class DocumentContainerIndex {
|
|
|
63
69
|
var _a, _b;
|
|
64
70
|
return (_b = (_a = this.data.containerPathsByDocumentElementId.get(documentElementId)) === null || _a === void 0 ? void 0 : _a.get(elementType)) !== null && _b !== void 0 ? _b : [];
|
|
65
71
|
}
|
|
72
|
+
containerPathCopy(documentElementId, elementType) {
|
|
73
|
+
return [...this.containerPath(documentElementId, elementType)];
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
exports.DocumentContainerIndex = DocumentContainerIndex;
|
|
@@ -3,10 +3,8 @@ import { ContainerKind } from './container-kind';
|
|
|
3
3
|
export interface DocumentContainer {
|
|
4
4
|
id: string;
|
|
5
5
|
kind: ContainerKind;
|
|
6
|
-
name: string;
|
|
7
6
|
documentElement: DocumentElement;
|
|
8
7
|
box: CoordinateBox;
|
|
9
|
-
depth: number;
|
|
10
8
|
drawOrder: number;
|
|
11
9
|
}
|
|
12
10
|
export interface MeasuredDocumentElement {
|
|
@@ -19,10 +17,13 @@ export declare class DocumentContainerUtil {
|
|
|
19
17
|
static centerOf(box: CoordinateBox): PositionDefinition;
|
|
20
18
|
static anchorOf(documentElement: DocumentElement, box: CoordinateBox): PositionDefinition;
|
|
21
19
|
static positionKeepingAnchor(documentElement: DocumentElement, newSize: SizeDefinition): PositionDefinition;
|
|
20
|
+
static resizeKeepingAnchor(dynamicTextElement: DocumentElement, entityType: any, text: string): {
|
|
21
|
+
size: SizeDefinition;
|
|
22
|
+
position: PositionDefinition;
|
|
23
|
+
};
|
|
22
24
|
static anchorFor(documentElement: DocumentElement, position?: PositionDefinition, startElement?: DocumentElement, endElement?: DocumentElement): PositionDefinition;
|
|
23
25
|
static containsPoint(box: CoordinateBox, point: PositionDefinition): boolean;
|
|
24
26
|
static encloses(outer: CoordinateBox, inner: CoordinateBox): boolean;
|
|
25
|
-
static isWiderAndTallerThan(box: CoordinateBox, other: CoordinateBox): boolean;
|
|
26
27
|
static chain(candidates: DocumentContainer[]): DocumentContainer[];
|
|
27
28
|
static topmost(containers: DocumentContainer[]): DocumentContainer[];
|
|
28
29
|
}
|
|
@@ -38,14 +38,23 @@ class DocumentContainerUtil {
|
|
|
38
38
|
const after = cornerOffset(newSize);
|
|
39
39
|
return { x: position.x + before.x - after.x, y: position.y + before.y - after.y };
|
|
40
40
|
}
|
|
41
|
+
static resizeKeepingAnchor(dynamicTextElement, entityType, text) {
|
|
42
|
+
const size = dynamic_text_util_1.DynamicTextUtil.calculateSize(dynamicTextElement, entityType, text);
|
|
43
|
+
return { size, position: DocumentContainerUtil.positionKeepingAnchor(dynamicTextElement, size) };
|
|
44
|
+
}
|
|
41
45
|
static anchorFor(documentElement, position, startElement, endElement) {
|
|
42
46
|
const at = position !== null && position !== void 0 ? position : documentElement === null || documentElement === void 0 ? void 0 : documentElement.position;
|
|
43
47
|
if (!at) {
|
|
44
48
|
return null;
|
|
45
49
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
try {
|
|
51
|
+
const measured = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(Object.assign(Object.assign({}, documentElement), { position: at }), startElement, endElement);
|
|
52
|
+
const box = DocumentContainerUtil.toCoordinateBox(measured.x, measured.y, measured.width, measured.height);
|
|
53
|
+
return DocumentContainerUtil.anchorOf(documentElement, box);
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
59
|
static containsPoint(box, point) {
|
|
51
60
|
return point.x >= box.left && point.x <= box.right && point.y >= box.top && point.y <= box.bottom;
|
|
@@ -58,24 +67,19 @@ class DocumentContainerUtil {
|
|
|
58
67
|
outer.bottom === inner.bottom;
|
|
59
68
|
return covers && !identical;
|
|
60
69
|
}
|
|
61
|
-
static isWiderAndTallerThan(box, other) {
|
|
62
|
-
return box.width > other.width && box.height > other.height;
|
|
63
|
-
}
|
|
64
70
|
static chain(candidates) {
|
|
65
71
|
if (!candidates.length) {
|
|
66
72
|
return [];
|
|
67
73
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
.reduce((topmost, container) => (container.drawOrder > topmost.drawOrder ? container : topmost));
|
|
71
|
-
const path = [innermostOf(candidates)];
|
|
74
|
+
const topmostOf = (of) => of.reduce((topmost, container) => (container.drawOrder > topmost.drawOrder ? container : topmost));
|
|
75
|
+
const path = [topmostOf(candidates)];
|
|
72
76
|
for (;;) {
|
|
73
77
|
const current = path[0];
|
|
74
78
|
const enclosing = candidates.filter((container) => !path.includes(container) && this.encloses(container.box, current.box));
|
|
75
79
|
if (!enclosing.length) {
|
|
76
80
|
return path;
|
|
77
81
|
}
|
|
78
|
-
path.unshift(
|
|
82
|
+
path.unshift(topmostOf(enclosing));
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
static topmost(containers) {
|
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DocumentContainerService = void 0;
|
|
4
4
|
const document_element_factory_1 = require("../document-element-factory");
|
|
5
|
-
const dynamic_text_util_1 = require("../util/dynamic-text/dynamic-text-util");
|
|
6
|
-
const document_element_constants_1 = require("../document-element-constants");
|
|
7
5
|
const container_kind_1 = require("./container-kind");
|
|
8
6
|
const document_container_index_1 = require("./document-container-index");
|
|
9
7
|
const document_container_1 = require("./document-container");
|
|
10
8
|
class DocumentContainerService {
|
|
11
9
|
static buildIndex(documentElements, kinds = container_kind_1.CONTAINER_KINDS) {
|
|
12
|
-
var _a, _b
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const elements = (documentElements !== null && documentElements !== void 0 ? documentElements : []).filter((element) => !!element);
|
|
12
|
+
const containerElementTypes = new Set(kinds.map((kind) => kind.elementType));
|
|
13
|
+
if (!elements.some((element) => containerElementTypes.has(element.type))) {
|
|
14
|
+
return document_container_index_1.DocumentContainerIndex.empty();
|
|
15
|
+
}
|
|
16
|
+
const documentElementsById = new Map(elements.map((element) => [element.id, element]));
|
|
17
|
+
const measuredDocumentElements = this.measureDocumentElements(elements, documentElementsById);
|
|
18
|
+
const containersByElementType = new Map(kinds.map((kind) => [kind.elementType, this.collectContainers(measuredDocumentElements, kind)]));
|
|
16
19
|
const containersById = new Map();
|
|
17
20
|
const containerIdsByElementType = new Map();
|
|
18
21
|
containersByElementType.forEach((containers, elementType) => {
|
|
@@ -22,29 +25,17 @@ class DocumentContainerService {
|
|
|
22
25
|
const pathsByMeasured = new Map();
|
|
23
26
|
for (const measured of measuredDocumentElements) {
|
|
24
27
|
const byElementType = new Map();
|
|
25
|
-
for (const kind of
|
|
28
|
+
for (const kind of kinds) {
|
|
26
29
|
byElementType.set(kind.elementType, this.resolvePath(measured, kind, (_a = containersByElementType.get(kind.elementType)) !== null && _a !== void 0 ? _a : []));
|
|
27
30
|
}
|
|
28
31
|
pathsByMeasured.set(measured, byElementType);
|
|
29
32
|
}
|
|
30
|
-
for (const measured of measuredDocumentElements) {
|
|
31
|
-
const container = containersById.get(measured.documentElement.id);
|
|
32
|
-
if (container && container.documentElement === measured.documentElement) {
|
|
33
|
-
container.depth = ((_c = (_b = pathsByMeasured.get(measured)) === null || _b === void 0 ? void 0 : _b.get(container.kind.elementType)) !== null && _c !== void 0 ? _c : []).length;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const measuredById = new Map();
|
|
37
|
-
for (const measured of measuredDocumentElements) {
|
|
38
|
-
if (!measuredById.has(measured.documentElement.id)) {
|
|
39
|
-
measuredById.set(measured.documentElement.id, measured);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
33
|
const containerPathsByDocumentElementId = new Map();
|
|
43
34
|
const memberIdsByContainerId = new Map();
|
|
44
35
|
for (const measured of measuredDocumentElements) {
|
|
45
36
|
const documentElementId = measured.documentElement.id;
|
|
46
37
|
const pathsByElementType = new Map();
|
|
47
|
-
((
|
|
38
|
+
((_b = pathsByMeasured.get(measured)) !== null && _b !== void 0 ? _b : new Map()).forEach((path, elementType) => pathsByElementType.set(elementType, path.map((container) => container.id)));
|
|
48
39
|
for (const path of pathsByElementType.values()) {
|
|
49
40
|
for (const containerId of path) {
|
|
50
41
|
const members = memberIdsByContainerId.get(containerId);
|
|
@@ -59,7 +50,7 @@ class DocumentContainerService {
|
|
|
59
50
|
containerPathsByDocumentElementId.set(documentElementId, pathsByElementType);
|
|
60
51
|
}
|
|
61
52
|
return new document_container_index_1.DocumentContainerIndex({
|
|
62
|
-
documentElementsById
|
|
53
|
+
documentElementsById,
|
|
63
54
|
containersById,
|
|
64
55
|
containerPathsByDocumentElementId,
|
|
65
56
|
memberIdsByContainerId,
|
|
@@ -69,8 +60,7 @@ class DocumentContainerService {
|
|
|
69
60
|
static isContainer(documentElement, kinds = container_kind_1.CONTAINER_KINDS) {
|
|
70
61
|
return kinds.some((kind) => kind.elementType === (documentElement === null || documentElement === void 0 ? void 0 : documentElement.type));
|
|
71
62
|
}
|
|
72
|
-
static measureDocumentElements(documentElements) {
|
|
73
|
-
const documentElementsById = new Map(documentElements.map((documentElement) => [documentElement.id, documentElement]));
|
|
63
|
+
static measureDocumentElements(documentElements, documentElementsById) {
|
|
74
64
|
return documentElements.map((documentElement, drawOrder) => ({
|
|
75
65
|
documentElement,
|
|
76
66
|
drawOrder,
|
|
@@ -79,12 +69,9 @@ class DocumentContainerService {
|
|
|
79
69
|
}
|
|
80
70
|
static measure(documentElement, documentElementsById) {
|
|
81
71
|
var _a, _b;
|
|
82
|
-
if (!(documentElement === null || documentElement === void 0 ? void 0 : documentElement.position)) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
72
|
try {
|
|
86
|
-
const start = ((_a = documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
|
|
87
|
-
const end = ((_b = documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
|
|
73
|
+
const start = ((_a = documentElement === null || documentElement === void 0 ? void 0 : documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
|
|
74
|
+
const end = ((_b = documentElement === null || documentElement === void 0 ? void 0 : documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
|
|
88
75
|
const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(documentElement, start, end);
|
|
89
76
|
return document_container_1.DocumentContainerUtil.toCoordinateBox(x, y, width, height);
|
|
90
77
|
}
|
|
@@ -98,10 +85,8 @@ class DocumentContainerService {
|
|
|
98
85
|
.map((measured) => ({
|
|
99
86
|
id: measured.documentElement.id,
|
|
100
87
|
kind,
|
|
101
|
-
name: measured.documentElement.name,
|
|
102
88
|
documentElement: measured.documentElement,
|
|
103
89
|
box: measured.box,
|
|
104
|
-
depth: 0,
|
|
105
90
|
drawOrder: measured.drawOrder,
|
|
106
91
|
}));
|
|
107
92
|
}
|
|
@@ -109,14 +94,8 @@ class DocumentContainerService {
|
|
|
109
94
|
if (!containers.length || !measured.box) {
|
|
110
95
|
return [];
|
|
111
96
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (ownKind.elementType === kind.elementType) {
|
|
115
|
-
return kind.nests ? document_container_1.DocumentContainerUtil.chain(this.enclosersOf(measured, containers)) : [];
|
|
116
|
-
}
|
|
117
|
-
if (kind.layer > ownKind.layer) {
|
|
118
|
-
return [];
|
|
119
|
-
}
|
|
97
|
+
if (measured.documentElement.type === kind.elementType) {
|
|
98
|
+
return kind.nests ? document_container_1.DocumentContainerUtil.chain(this.enclosersOf(measured, containers)) : [];
|
|
120
99
|
}
|
|
121
100
|
const candidates = this.candidateContainers(measured, containers);
|
|
122
101
|
return kind.nests ? document_container_1.DocumentContainerUtil.chain(candidates) : document_container_1.DocumentContainerUtil.topmost(candidates);
|
|
@@ -132,8 +111,6 @@ class DocumentContainerService {
|
|
|
132
111
|
}
|
|
133
112
|
static candidateContainers(measured, containers) {
|
|
134
113
|
const anchor = document_container_1.DocumentContainerUtil.anchorOf(measured.documentElement, measured.box);
|
|
135
|
-
const isShape = document_element_constants_1.SHAPE_ELEMENT_TYPES.includes(measured.documentElement.type) &&
|
|
136
|
-
!dynamic_text_util_1.DynamicTextUtil.isDynamicText(measured.documentElement);
|
|
137
114
|
return containers.filter((container) => {
|
|
138
115
|
var _a;
|
|
139
116
|
if (container.documentElement === measured.documentElement || measured.drawOrder <= container.drawOrder) {
|
|
@@ -142,7 +119,7 @@ class DocumentContainerService {
|
|
|
142
119
|
if (!document_container_1.DocumentContainerUtil.containsPoint(container.box, anchor)) {
|
|
143
120
|
return false;
|
|
144
121
|
}
|
|
145
|
-
if (
|
|
122
|
+
if (document_container_1.DocumentContainerUtil.encloses(measured.box, container.box)) {
|
|
146
123
|
return false;
|
|
147
124
|
}
|
|
148
125
|
return !((_a = measured.documentElement.elementIds) === null || _a === void 0 ? void 0 : _a.includes(container.id));
|
|
@@ -56,8 +56,9 @@ function isContainerBinding(bindingProperty) {
|
|
|
56
56
|
}
|
|
57
57
|
class DynamicTextUtil {
|
|
58
58
|
static isDynamicText(documentElement) {
|
|
59
|
+
var _a;
|
|
59
60
|
return ((documentElement === null || documentElement === void 0 ? void 0 : documentElement.type) === 'text' &&
|
|
60
|
-
!!documentElement.propertyBindings &&
|
|
61
|
+
!!((_a = documentElement.propertyBindings) === null || _a === void 0 ? void 0 : _a.text) &&
|
|
61
62
|
!!documentElement.propertyBindingsMetaData);
|
|
62
63
|
}
|
|
63
64
|
static takesValueFromContainer(bindingProperty) {
|
|
@@ -208,7 +209,7 @@ class DynamicTextUtil {
|
|
|
208
209
|
}
|
|
209
210
|
else if (displayFunction === DynamicTextDisplayFunction.UNIQUE_ARRAY) {
|
|
210
211
|
text = Array.from(new Set(memberValues
|
|
211
|
-
.filter((e) => e !== null && e !== undefined)
|
|
212
|
+
.filter((e) => e !== null && e !== undefined && e !== '')
|
|
212
213
|
.flat()
|
|
213
214
|
.map((e) => formatter.formatValueForProperty(e, property))))
|
|
214
215
|
.sort()
|