@object-ui/core 4.0.5 → 4.0.7
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
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @object-ui/core
|
|
2
2
|
|
|
3
|
+
## 4.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7c9b85c: Fix compatibility with the framework's normalized Expression envelope format.
|
|
8
|
+
|
|
9
|
+
`@objectstack/spec` now emits predicate (`visible` / `enabled`) and template
|
|
10
|
+
(`titleFormat`) fields as `{ dialect, source }` envelopes instead of bare
|
|
11
|
+
strings. The previous implementation assumed strings and crashed the record
|
|
12
|
+
detail view (`TypeError: titleFormat.replace is not a function`) and printed
|
|
13
|
+
`Failed to evaluate expression: ${[object Object]}` for every action visibility
|
|
14
|
+
predicate.
|
|
15
|
+
- `@object-ui/core`: `ExpressionEvaluator.evaluate` / `evaluateCondition` now
|
|
16
|
+
unwrap Expression envelopes transparently.
|
|
17
|
+
- `@object-ui/react`: new `toPredicateInput()` helper to safely normalize
|
|
18
|
+
`boolean | string | Expression` predicate inputs into the `${expr}` form
|
|
19
|
+
expected by `useCondition`.
|
|
20
|
+
- `@object-ui/components`: `action-bar`, `action-button`, `action-group`,
|
|
21
|
+
`action-icon`, `action-menu` renderers use `toPredicateInput()` instead of
|
|
22
|
+
template-literal interpolation that produced `${[object Object]}`.
|
|
23
|
+
- `@object-ui/plugin-detail`, `@object-ui/plugin-kanban`,
|
|
24
|
+
`@object-ui/plugin-calendar`, `@object-ui/app-shell`,
|
|
25
|
+
`@object-ui/console`: title-format helpers accept both legacy strings and
|
|
26
|
+
the new `{ source }` envelope.
|
|
27
|
+
|
|
28
|
+
All changes are backward-compatible — legacy bare strings continue to work.
|
|
29
|
+
- @object-ui/types@4.0.7
|
|
30
|
+
|
|
31
|
+
## 4.0.6
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- @object-ui/types@4.0.6
|
|
36
|
+
|
|
3
37
|
## 4.0.5
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -54,7 +54,10 @@ export declare class ExpressionEvaluator {
|
|
|
54
54
|
* evaluator.evaluate('Amount is ${data.amount}'); // Returns: "Amount is 1500"
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
evaluate(expression: string | boolean | number | null | undefined
|
|
57
|
+
evaluate(expression: string | boolean | number | null | undefined | {
|
|
58
|
+
dialect?: string;
|
|
59
|
+
source?: string;
|
|
60
|
+
}, options?: EvaluationOptions): any;
|
|
58
61
|
/**
|
|
59
62
|
* Evaluate a single expression (without ${} wrapper)
|
|
60
63
|
*
|
|
@@ -79,7 +82,10 @@ export declare class ExpressionEvaluator {
|
|
|
79
82
|
* evaluator.evaluateCondition('${data.age >= 18}'); // Returns: true/false
|
|
80
83
|
* ```
|
|
81
84
|
*/
|
|
82
|
-
evaluateCondition(condition: string | boolean | undefined
|
|
85
|
+
evaluateCondition(condition: string | boolean | undefined | {
|
|
86
|
+
dialect?: string;
|
|
87
|
+
source?: string;
|
|
88
|
+
}, options?: EvaluationOptions): boolean;
|
|
83
89
|
/**
|
|
84
90
|
* Update the context with new data
|
|
85
91
|
*/
|
|
@@ -61,6 +61,13 @@ export class ExpressionEvaluator {
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
evaluate(expression, options = {}) {
|
|
64
|
+
// Unwrap Expression envelope produced by `@objectstack/spec`'s normalized
|
|
65
|
+
// template/CEL inputs: `{ dialect: 'cel' | 'template', source: '...' }`.
|
|
66
|
+
// We only consume `source` — the underlying syntax (`${expr}` or `{var}`)
|
|
67
|
+
// is identical to what we already supported as plain strings.
|
|
68
|
+
if (expression && typeof expression === 'object' && typeof expression.source === 'string') {
|
|
69
|
+
expression = expression.source;
|
|
70
|
+
}
|
|
64
71
|
// Handle non-string primitives
|
|
65
72
|
if (typeof expression !== 'string') {
|
|
66
73
|
return expression;
|
|
@@ -170,6 +177,10 @@ export class ExpressionEvaluator {
|
|
|
170
177
|
if (typeof condition === 'boolean') {
|
|
171
178
|
return condition;
|
|
172
179
|
}
|
|
180
|
+
// Unwrap Expression envelope (see `evaluate` for rationale).
|
|
181
|
+
if (condition && typeof condition === 'object' && typeof condition.source === 'string') {
|
|
182
|
+
condition = condition.source;
|
|
183
|
+
}
|
|
173
184
|
if (!condition) {
|
|
174
185
|
return true; // Default to visible/enabled if no condition
|
|
175
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@objectstack/spec": "^4.0.4",
|
|
29
29
|
"lodash": "^4.18.1",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@object-ui/types": "4.0.
|
|
31
|
+
"@object-ui/types": "4.0.7"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^6.0.3",
|