@contrail/documents 1.16.0-alpha.96c651c → 1.16.0-alpha.da92f7b
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
CHANGED
|
@@ -9,12 +9,26 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- `ASSET_VIEW_TEMPLATE` and its `asset-view` entry in `ComponentRegistry` — the component definition for an asset card. Image-forward: one image bound to the asset's viewable, one text row bound to `asset.name
|
|
12
|
+
- `ASSET_VIEW_TEMPLATE` and its `asset-view` entry in `ComponentRegistry` — the component definition for an asset card. Image-forward: one image bound to the asset's viewable, one text row bound to `asset.fileName` — the asset's seeded property, present in both client- and server-side hydration (a bare `asset.name` is frequently unset and the API's document rebind would blank the label). Consumers resolve it by slug through `DocumentElementFactory.createComponent('asset-view', …)`.
|
|
13
13
|
|
|
14
14
|
### Fixed
|
|
15
15
|
|
|
16
16
|
- `DocumentElementPropertyBindingHandler` only unwrapped `viewable.content` when it was an array, which is the item shape. An asset's `content` is a single object, so asset viewables never resolved `alternateUrls.originalFile`, and an SVG asset's high-resolution url fell back to a raster derivative instead of its source file. Both shapes are now handled; item viewables still select the record matching `primaryViewableId`.
|
|
17
17
|
|
|
18
|
+
## [1.15.1] - 2026-08-28
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `DYNAMIC_TEXT_DATA_SOURCE.SECTION`, the `DynamicTextContainer` type, `MOVE_TO_SECTION_TEXT`, and `isContainerBinding()`. `DynamicTextUtil.getDynamicTextValue` now evaluates `section.*` bindings (`name`, `count`, `itemFamilyCount`, `itemOptionCount`, `colorCount`) the same way it already evaluates `frame.*`.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- `getDynamicTextValue`'s fourth parameter is typed `DynamicTextContainer | null` rather than `{ name, id }`. This is source-compatible: `source` is optional and a container without one is treated as a frame, so existing callers need no change. Which kind of container is rendered is read from the binding (`frame.count` vs `section.count`); `source` records what the caller resolved. The parameter is now nullable to match what it always accepted, since callers pass `null` for an element in no container.
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
|
|
30
|
+
- A branch that cleared `property` for a container binding while handling a binding that names no container, which could never run.
|
|
31
|
+
|
|
18
32
|
## [1.15.0] - 2026-08-21
|
|
19
33
|
|
|
20
34
|
### Added
|
|
@@ -4,7 +4,14 @@ export declare enum DYNAMIC_TEXT_DATA_SOURCE {
|
|
|
4
4
|
PROJECT = "project",
|
|
5
5
|
BOARD = "board",
|
|
6
6
|
SHOWCASE = "showcase",
|
|
7
|
-
FRAME = "frame"
|
|
7
|
+
FRAME = "frame",
|
|
8
|
+
SECTION = "section"
|
|
9
|
+
}
|
|
10
|
+
export type DynamicTextContainerSource = DYNAMIC_TEXT_DATA_SOURCE.FRAME | DYNAMIC_TEXT_DATA_SOURCE.SECTION;
|
|
11
|
+
export interface DynamicTextContainer {
|
|
12
|
+
name: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
source?: DynamicTextContainerSource;
|
|
8
15
|
}
|
|
9
16
|
export declare enum DynamicTextDisplayFunction {
|
|
10
17
|
VALUE = "value",
|
|
@@ -18,6 +25,7 @@ export declare enum DynamicTextDisplayFunction {
|
|
|
18
25
|
SUM = "sum"
|
|
19
26
|
}
|
|
20
27
|
export declare const MOVE_TO_FRAME_TEXT = "Move to a frame";
|
|
28
|
+
export declare const MOVE_TO_SECTION_TEXT = "Move to a section";
|
|
21
29
|
export declare const CLICK_TO_CONFIGURE = "Click to configure";
|
|
22
30
|
export declare const HARD_CODED_TEXT: {
|
|
23
31
|
'project.name': string;
|
|
@@ -34,12 +42,15 @@ export declare const HARD_CODED_TEXT: {
|
|
|
34
42
|
'frame.itemFamilyCount': string;
|
|
35
43
|
'frame.itemOptionCount': string;
|
|
36
44
|
'frame.colorCount': string;
|
|
45
|
+
'section.name': string;
|
|
46
|
+
'section.count': string;
|
|
47
|
+
'section.itemFamilyCount': string;
|
|
48
|
+
'section.itemOptionCount': string;
|
|
49
|
+
'section.colorCount': string;
|
|
37
50
|
};
|
|
51
|
+
export declare function isContainerBinding(bindingProperty: string | null | undefined): boolean;
|
|
38
52
|
export declare class DynamicTextUtil {
|
|
39
|
-
static getDynamicTextValue(dynamicTextElement: DocumentElement, property: TypeProperty, propertyLevel: PropertyLevel,
|
|
40
|
-
name: string;
|
|
41
|
-
id?: string;
|
|
42
|
-
}, componentModels: any[], ownerReferenceModel?: any): string;
|
|
53
|
+
static getDynamicTextValue(dynamicTextElement: DocumentElement, property: TypeProperty, propertyLevel: PropertyLevel, container: DynamicTextContainer | null, componentModels: any[], ownerReferenceModel?: any): string;
|
|
43
54
|
static calculateSize(dynamicTextElement: DocumentElement, entityType: any, text: string): import("../..").SizeDefinition;
|
|
44
55
|
static getTextFromFrameMemberValues(displayFunction: string, property: any, memberValues: any[]): string;
|
|
45
56
|
private static getItemCount;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamicTextUtil = exports.HARD_CODED_TEXT = exports.CLICK_TO_CONFIGURE = exports.MOVE_TO_FRAME_TEXT = exports.DynamicTextDisplayFunction = exports.DYNAMIC_TEXT_DATA_SOURCE = void 0;
|
|
3
|
+
exports.DynamicTextUtil = exports.HARD_CODED_TEXT = exports.CLICK_TO_CONFIGURE = exports.MOVE_TO_SECTION_TEXT = exports.MOVE_TO_FRAME_TEXT = exports.DynamicTextDisplayFunction = exports.DYNAMIC_TEXT_DATA_SOURCE = void 0;
|
|
4
|
+
exports.isContainerBinding = isContainerBinding;
|
|
4
5
|
const types_1 = require("@contrail/types");
|
|
5
6
|
const util_1 = require("@contrail/util");
|
|
6
7
|
const document_util_1 = require("@contrail/document-util");
|
|
@@ -10,6 +11,7 @@ var DYNAMIC_TEXT_DATA_SOURCE;
|
|
|
10
11
|
DYNAMIC_TEXT_DATA_SOURCE["BOARD"] = "board";
|
|
11
12
|
DYNAMIC_TEXT_DATA_SOURCE["SHOWCASE"] = "showcase";
|
|
12
13
|
DYNAMIC_TEXT_DATA_SOURCE["FRAME"] = "frame";
|
|
14
|
+
DYNAMIC_TEXT_DATA_SOURCE["SECTION"] = "section";
|
|
13
15
|
})(DYNAMIC_TEXT_DATA_SOURCE || (exports.DYNAMIC_TEXT_DATA_SOURCE = DYNAMIC_TEXT_DATA_SOURCE = {}));
|
|
14
16
|
var DynamicTextDisplayFunction;
|
|
15
17
|
(function (DynamicTextDisplayFunction) {
|
|
@@ -24,6 +26,7 @@ var DynamicTextDisplayFunction;
|
|
|
24
26
|
DynamicTextDisplayFunction["SUM"] = "sum";
|
|
25
27
|
})(DynamicTextDisplayFunction || (exports.DynamicTextDisplayFunction = DynamicTextDisplayFunction = {}));
|
|
26
28
|
exports.MOVE_TO_FRAME_TEXT = 'Move to a frame';
|
|
29
|
+
exports.MOVE_TO_SECTION_TEXT = 'Move to a section';
|
|
27
30
|
exports.CLICK_TO_CONFIGURE = 'Click to configure';
|
|
28
31
|
exports.HARD_CODED_TEXT = {
|
|
29
32
|
'project.name': 'Project name',
|
|
@@ -40,16 +43,23 @@ exports.HARD_CODED_TEXT = {
|
|
|
40
43
|
'frame.itemFamilyCount': 'Item family count',
|
|
41
44
|
'frame.itemOptionCount': 'Item option count',
|
|
42
45
|
'frame.colorCount': 'Color count',
|
|
46
|
+
'section.name': 'Section name',
|
|
47
|
+
'section.count': 'Total count',
|
|
48
|
+
'section.itemFamilyCount': 'Item family count',
|
|
49
|
+
'section.itemOptionCount': 'Item option count',
|
|
50
|
+
'section.colorCount': 'Color count',
|
|
43
51
|
};
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
];
|
|
52
|
+
const CONTAINER_PROPERTY_SLUGS = ['name', 'count', 'itemFamilyCount', 'itemOptionCount', 'colorCount'];
|
|
53
|
+
const CONTAINER_SOURCES = [DYNAMIC_TEXT_DATA_SOURCE.FRAME, DYNAMIC_TEXT_DATA_SOURCE.SECTION];
|
|
54
|
+
function isContainerBinding(bindingProperty) {
|
|
55
|
+
if (!bindingProperty) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const [entityType, propertySlug] = bindingProperty.split('.');
|
|
59
|
+
return CONTAINER_SOURCES.includes(entityType) && CONTAINER_PROPERTY_SLUGS.includes(propertySlug);
|
|
60
|
+
}
|
|
51
61
|
class DynamicTextUtil {
|
|
52
|
-
static getDynamicTextValue(dynamicTextElement, property, propertyLevel,
|
|
62
|
+
static getDynamicTextValue(dynamicTextElement, property, propertyLevel, container, componentModels, ownerReferenceModel = null) {
|
|
53
63
|
var _a, _b, _c, _d;
|
|
54
64
|
if (!dynamicTextElement.propertyBindings || !dynamicTextElement.propertyBindings.text) {
|
|
55
65
|
return exports.CLICK_TO_CONFIGURE;
|
|
@@ -78,11 +88,11 @@ class DynamicTextUtil {
|
|
|
78
88
|
: formatter.formatValue(text, types_1.PropertyType.String);
|
|
79
89
|
}
|
|
80
90
|
else {
|
|
81
|
-
if (!
|
|
82
|
-
text = exports.MOVE_TO_FRAME_TEXT;
|
|
91
|
+
if (!container && !isSpecRelated) {
|
|
92
|
+
text = entityType === DYNAMIC_TEXT_DATA_SOURCE.SECTION ? exports.MOVE_TO_SECTION_TEXT : exports.MOVE_TO_FRAME_TEXT;
|
|
83
93
|
}
|
|
84
94
|
else {
|
|
85
|
-
if (entityType
|
|
95
|
+
if (CONTAINER_SOURCES.includes(entityType)) {
|
|
86
96
|
if (propertySlug === 'count') {
|
|
87
97
|
text = componentModels.length.toString();
|
|
88
98
|
}
|
|
@@ -90,13 +100,10 @@ class DynamicTextUtil {
|
|
|
90
100
|
text = this.getItemCount(propertySlug, componentModels);
|
|
91
101
|
}
|
|
92
102
|
else {
|
|
93
|
-
text =
|
|
103
|
+
text = container === null || container === void 0 ? void 0 : container.name;
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
else {
|
|
97
|
-
if (frameProperties.includes(bindingProperty)) {
|
|
98
|
-
property = null;
|
|
99
|
-
}
|
|
100
107
|
const frameMemberValues = [];
|
|
101
108
|
if (propertyLevel) {
|
|
102
109
|
componentModels = Array.from(new Map(componentModels
|
|
@@ -121,13 +128,13 @@ class DynamicTextUtil {
|
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
if (displayFunction === DynamicTextDisplayFunction.LABEL) {
|
|
124
|
-
if (['showcase', 'board', 'project',
|
|
131
|
+
if (['showcase', 'board', 'project', ...CONTAINER_SOURCES].includes(entityType) || isSpecRelated) {
|
|
125
132
|
text = exports.HARD_CODED_TEXT[bindingProperty] || (property === null || property === void 0 ? void 0 : property.label);
|
|
126
133
|
}
|
|
127
|
-
else if (!
|
|
134
|
+
else if (!container) {
|
|
128
135
|
text = exports.MOVE_TO_FRAME_TEXT;
|
|
129
136
|
}
|
|
130
|
-
else
|
|
137
|
+
else {
|
|
131
138
|
text = property === null || property === void 0 ? void 0 : property.label;
|
|
132
139
|
}
|
|
133
140
|
}
|