@object-ui/plugin-list 14.0.0 → 14.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,87 @@
1
1
  # @object-ui/plugin-list
2
2
 
3
+ ## 14.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dea65f7: Unify the list-view conditional tier onto the canonical CEL engine (#1584).
8
+
9
+ Conditional formatting (list / grid / kanban) and row-action `visible` /
10
+ `disabled` predicates are now evaluated by `@objectstack/formula`'s
11
+ `ExpressionEngine` — the same engine the server uses — instead of the legacy
12
+ JS-dialect `ExpressionEvaluator`, matching how `@objectstack/spec` already types
13
+ these surfaces (`ExpressionInputSchema` / CEL). The whole platform now speaks one
14
+ expression dialect (framework ADR-0058).
15
+
16
+ - `@object-ui/core`: new `evalRowPredicate` + `resolveConditionalFormatting`
17
+ helpers (next to `evalFieldPredicate`). One implementation of all three
18
+ formatting rule shapes; dialect routing (a `{ dialect: 'cel' }` envelope is
19
+ always CEL; a bare string is CEL unless it carries legacy-only syntax
20
+ (`${…}` / `===` / `?.` / `.includes()`), which routes to the old engine with a
21
+ one-time deprecation warning); the native `{ field, operator, value }` form is
22
+ translated to CEL.
23
+ - `@object-ui/react`: new `useRowPredicate` hook (canonical CEL, ambient
24
+ predicate scope merged).
25
+ - Consumers converged: `ListView.evaluateConditionalFormatting` (thin wrapper,
26
+ export kept), `ObjectGrid` row styling (inline copy removed), kanban card
27
+ styles, and the grid / data-table row-action menus. `plugin-view`'s kanban
28
+ branch now forwards top-level `conditionalFormatting` (previously dropped).
29
+ - Row-action `visible` fails **closed** (broken predicate → hidden + warn);
30
+ `disabled` fails soft. The CEL `in` operator (and list membership) now work in
31
+ row predicates — the legacy engine could not parse them.
32
+ - The legacy `FormField.condition: { field, equals/notEquals/in }` is retired to
33
+ a CEL translation (back-compat preserved); `FieldDesigner` migrated to
34
+ `visibleWhen`.
35
+
36
+ Fully back-compat: existing conditional-formatting rules, row-action predicates,
37
+ and form `condition` metadata keep working (translated / routed as needed).
38
+
39
+ - f0f10f5: feat(kanban): default lane field honours the ADR-0085 `stageField` role
40
+
41
+ Kanban views without an explicit `groupByField`/`groupField` hard-coded their
42
+ lane field to the literal `'status'` (in both app-shell's ObjectView options
43
+ and plugin-list's ListView fallback) — ignoring the object's declared
44
+ lifecycle and even inventing a field the object doesn't have. The default now
45
+ resolves through the shared `stageField` detector:
46
+
47
+ 1. explicit view config (unchanged, always wins);
48
+ 2. the object's `stageField` semantic role;
49
+ 3. `stageField: false` → **no default lanes** (the status-shaped field is
50
+ declared non-linear; the board renders its empty state until the view
51
+ picks a lane field explicitly);
52
+ 4. else the shared name/type heuristic (status / stage / state / phase by
53
+ name, then status/stage by type) — never a nonexistent field.
54
+
55
+ `detectStatusField` moved from `@object-ui/plugin-detail` to
56
+ `@object-ui/types` (new export, with the `StatusFieldSource` input type) so
57
+ plugin-list and app-shell share the exact semantics; plugin-detail re-exports
58
+ it unchanged.
59
+
60
+ Also fixes ListView's pre-existing rules-of-hooks error while touching the
61
+ file: `useListFieldLabel` wrapped `useObjectLabel()` in try/catch (hook-order
62
+ desync risk; the hook is provider-safe) — same fix as objectui#2595's
63
+ `useFieldLabel`.
64
+
65
+ Behavior change is limited to kanban views with no explicit lane field on
66
+ objects that either declare `stageField` (now honoured), declare
67
+ `stageField: false` (now suppressed), or have no status-shaped field at all
68
+ (previously grouped by a nonexistent `status` into one "undefined" lane; now
69
+ an honest empty state). Objects with a real `status` field — the common case —
70
+ are unchanged.
71
+
72
+ ### Patch Changes
73
+
74
+ - 4b0aee6: Fix: a view declaring its `sort` in the `@objectstack/spec` bare-string
75
+ top-level form (`sort: "name desc"` — `ListViewSchema.sort` is
76
+ `string | Array<{field, order}>`) crashed ListView with
77
+ "schema.sort.map is not a function". Found by the spec/renderer
78
+ shape-mismatch audit that followed the dashboard filter-options crash.
79
+ Sort parsing is now a single normalized `parseSortConfig` (exported) that
80
+ accepts the bare string, legacy `"field desc"` array entries, and
81
+ `{ field, order }` objects, and returns `[]` for malformed entries instead
82
+ of throwing. The `@object-ui/types` declaration already carried the union —
83
+ only the implementation missed the string branch.
84
+
3
85
  ## 14.0.0
4
86
 
5
87
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { FilterGroup } from '@object-ui/components';
1
+ import { SortItem, FilterGroup } from '@object-ui/components';
2
2
  import { ViewType } from './ViewSwitcher';
3
3
  import { ListViewSchema } from '@object-ui/types';
4
4
  /**
@@ -50,6 +50,19 @@ export interface ListViewProps {
50
50
  * E.g., ['status', 'in', ['a','b']] → ['or', ['status','=','a'], ['status','=','b']]
51
51
  */
52
52
  export declare function normalizeFilterCondition(condition: any[]): any[];
53
+ /**
54
+ * Format an action identifier string into a human-readable label.
55
+ * e.g., 'send_email' → 'Send Email'
56
+ */
57
+ /**
58
+ * Normalize a view's `sort` declaration to SortItem[]. @objectstack/spec
59
+ * ListViewSchema.sort is `string | Array<{ field, order }>` — the TOP-LEVEL
60
+ * value may be a bare string ("name desc"); array entries may be strings
61
+ * (legacy "field desc") or `{ field, order }` objects. Calling `.map` on the
62
+ * bare-string form threw "schema.sort.map is not a function" and crashed the
63
+ * list (spec/renderer shape-mismatch audit, objectui#2578 follow-up).
64
+ */
65
+ export declare function parseSortConfig(sort: unknown): SortItem[];
53
66
  /**
54
67
  * Normalize an array of filter conditions, expanding `in`/`not in` operators
55
68
  * and ensuring consistent AST structure.
@@ -59,12 +72,20 @@ export declare function convertFilterGroupToAST(group: FilterGroup): any[];
59
72
  /**
60
73
  * Evaluate conditional formatting rules against a record.
61
74
  * Returns a CSSProperties object for the first matching rule, or empty object.
62
- * Supports both field/operator/value rules and expression-based rules.
75
+ * Supports all three historical rule shapes (spec `{ condition, style }`,
76
+ * ObjectUI `{ expression, … }`, native `{ field, operator, value, … }`).
77
+ *
78
+ * Thin wrapper over `@object-ui/core`'s `resolveConditionalFormatting`, which
79
+ * evaluates every predicate on the canonical CEL engine (with a legacy-dialect
80
+ * fallback) so a list view speaks the same expression dialect the server does
81
+ * (issue #1584 / ADR-0058). Kept exported for back-compat with consumers that
82
+ * evaluate formatting outside the ListView component.
63
83
  *
64
- * Exported for use by child view renderers (e.g., ObjectGrid) and consumers
65
- * who need to evaluate formatting rules outside the ListView component.
84
+ * @param scope Extra top-level scope (the host predicate scope) bound
85
+ * alongside the row, so `features.*` / `current_user.*`
86
+ * conditions resolve as they do on grid rows / kanban cards.
66
87
  */
67
- export declare function evaluateConditionalFormatting(record: Record<string, unknown>, rules?: ListViewSchema['conditionalFormatting']): React.CSSProperties;
88
+ export declare function evaluateConditionalFormatting(record: Record<string, unknown>, rules?: ListViewSchema['conditionalFormatting'], scope?: Record<string, unknown>): React.CSSProperties;
68
89
  /**
69
90
  * Imperative handle exposed by ListView via React.forwardRef.
70
91
  * Allows parent components to trigger a data refresh programmatically.
@@ -1 +1 @@
1
- {"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAwB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAKhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,uEAAuE;IACvE,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