@colixsystems/widget-sdk 0.21.1 → 0.22.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/README.md +11 -1
- package/dist/contract.cjs +9 -1
- package/dist/contract.js +9 -1
- package/dist/index.d.ts +15 -0
- package/dist/property-schema.js +25 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,17 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
45
45
|
|
|
46
46
|
## Status
|
|
47
47
|
|
|
48
|
-
`v0.
|
|
48
|
+
`v0.22.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
49
|
+
|
|
50
|
+
### What's new in 0.22.0
|
|
51
|
+
|
|
52
|
+
**New `valueRef` propertySchema type — bind a widget to a single value in the datastore (REQ-WDG-VALUEREF).**
|
|
53
|
+
|
|
54
|
+
- **`valueRef`** is a composite picker: the Studio Properties Panel renders three cascading dropdowns — pick a **table**, then a **record**, then a **column** — and the bound widget resolves the one cell. It is the discoverable replacement for hand-typing a `tableRef` + a raw record-id `string` + a `columnRef` separately (the old Field Value shape).
|
|
55
|
+
- **Persisted value is an object** `{ tableId, recordId, column }` (new `ValueRefBinding` type), unlike every other ref type, which is a bare string. A widget reads it with `useDatastoreRecord(value.tableId, value.recordId)` then `record[value.column]`; any missing piece means "no value".
|
|
56
|
+
- **tenant-copy** remaps `tableId` to the copied table and **nulls `recordId`** (records are business data and are never copied), so a copied workspace shows the widget's fallback until the new operator re-picks a record. `column` (a name) is preserved verbatim.
|
|
57
|
+
- The built-in **Field Value** widget now uses `valueRef` (back-compatible: already-saved Field Value widgets that stored `tableId`/`recordId`/`column` as separate props keep rendering).
|
|
58
|
+
- **`CONTRACT.version` → `1.12.0`** (additive: one new optional propertySchema type). No existing export or type changed signature.
|
|
49
59
|
|
|
50
60
|
### What's new in 0.21.1
|
|
51
61
|
|
package/dist/contract.cjs
CHANGED
|
@@ -1034,7 +1034,15 @@ const CONTRACT = deepFreeze({
|
|
|
1034
1034
|
// widgets in coral until a first save persisted the blue — a divergence
|
|
1035
1035
|
// between the unsaved and saved-defaults render. Aligning the canonical
|
|
1036
1036
|
// tokens removes it (no shape/signature change — default-value fix only).
|
|
1037
|
-
|
|
1037
|
+
//
|
|
1038
|
+
// 1.12.0: additive (REQ-WDG-VALUEREF) — new `valueRef` propertySchema type.
|
|
1039
|
+
// A composite "single value from the datastore" picker whose persisted
|
|
1040
|
+
// value is an object `{ tableId, recordId, column }` (every other ref
|
|
1041
|
+
// type is a bare string). The Studio Properties Panel renders three
|
|
1042
|
+
// cascading dropdowns; tenant-copy remaps `tableId` and nulls `recordId`
|
|
1043
|
+
// (records are business data, never copied). No existing type changed
|
|
1044
|
+
// shape, so this is additive — minor bump on the pre-1.0 channel.
|
|
1045
|
+
version: "1.12.0",
|
|
1038
1046
|
hooks: HOOKS,
|
|
1039
1047
|
primitives: PRIMITIVES,
|
|
1040
1048
|
manifestSchema: MANIFEST_SCHEMA,
|
package/dist/contract.js
CHANGED
|
@@ -987,7 +987,15 @@ const CONTRACT = deepFreeze({
|
|
|
987
987
|
// widgets in coral until a first save persisted the blue — a divergence
|
|
988
988
|
// between the unsaved and saved-defaults render. Aligning the canonical
|
|
989
989
|
// tokens removes it (no shape/signature change — default-value fix only).
|
|
990
|
-
|
|
990
|
+
//
|
|
991
|
+
// 1.12.0: additive (REQ-WDG-VALUEREF) — new `valueRef` propertySchema type.
|
|
992
|
+
// A composite "single value from the datastore" picker whose persisted
|
|
993
|
+
// value is an object `{ tableId, recordId, column }` (every other ref
|
|
994
|
+
// type is a bare string). The Studio Properties Panel renders three
|
|
995
|
+
// cascading dropdowns; tenant-copy remaps `tableId` and nulls `recordId`
|
|
996
|
+
// (records are business data, never copied). No existing type changed
|
|
997
|
+
// shape, so this is additive — minor bump on the pre-1.0 channel.
|
|
998
|
+
version: "1.12.0",
|
|
991
999
|
hooks: HOOKS,
|
|
992
1000
|
primitives: PRIMITIVES,
|
|
993
1001
|
manifestSchema: MANIFEST_SCHEMA,
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ export type WidgetPropertyType =
|
|
|
29
29
|
| "tableRef"
|
|
30
30
|
| "columnRef"
|
|
31
31
|
| "recordBinding"
|
|
32
|
+
// REQ-WDG-VALUEREF: composite "single value from the datastore" picker.
|
|
33
|
+
// Persisted value is `{ tableId, recordId, column }`; the bound widget
|
|
34
|
+
// resolves the one cell.
|
|
35
|
+
| "valueRef"
|
|
32
36
|
// REQ-USERMGMT M4 / §4.8: Group picker that emits a bare
|
|
33
37
|
// AppUserGroup UUID into the page JSON.
|
|
34
38
|
| "groupRef"
|
|
@@ -56,6 +60,17 @@ export interface WidgetPropertyDef {
|
|
|
56
60
|
|
|
57
61
|
export type WidgetPropertySchema = Record<string, WidgetPropertyDef>;
|
|
58
62
|
|
|
63
|
+
/**
|
|
64
|
+
* REQ-WDG-VALUEREF: the persisted value of a `valueRef` property. Each
|
|
65
|
+
* field is optional while the author is mid-pick; a widget treats any
|
|
66
|
+
* missing piece as "no value".
|
|
67
|
+
*/
|
|
68
|
+
export interface ValueRefBinding {
|
|
69
|
+
tableId?: string;
|
|
70
|
+
recordId?: string;
|
|
71
|
+
column?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
59
74
|
export interface WidgetEventDescriptor {
|
|
60
75
|
name: string;
|
|
61
76
|
description?: string;
|
package/dist/property-schema.js
CHANGED
|
@@ -6,6 +6,14 @@ const VALID_TYPES = new Set([
|
|
|
6
6
|
"color", "icon", "image",
|
|
7
7
|
"select", "multiselect",
|
|
8
8
|
"tableRef", "columnRef", "recordBinding",
|
|
9
|
+
// REQ-WDG-VALUEREF: `valueRef` is a composite "single value from the
|
|
10
|
+
// datastore" picker. Unlike the bare-string refs above, its persisted
|
|
11
|
+
// value is an OBJECT `{ tableId, recordId, column }` — the author picks a
|
|
12
|
+
// table, then a record, then a column, and the bound widget resolves the
|
|
13
|
+
// one cell. The Studio Properties Panel renders three cascading dropdowns
|
|
14
|
+
// (`ValueRefEditor`). tenant-copy remaps `tableId` and NULLS `recordId`
|
|
15
|
+
// (records are business data, never copied) — see tenant-copy.service.js.
|
|
16
|
+
"valueRef",
|
|
9
17
|
// REQ-USERMGMT M4 / §4.8: `groupRef` is a Group picker that emits a bare
|
|
10
18
|
// AppUserGroup UUID into the page JSON. Renders via `GroupSelector` in
|
|
11
19
|
// the Studio Properties Panel. REQ-GEN-07 compliance: no typed UUIDs —
|
|
@@ -134,6 +142,23 @@ function coerceLeaf(def, value, path, errors) {
|
|
|
134
142
|
return value;
|
|
135
143
|
}
|
|
136
144
|
return value.map((item, i) => coerceLeaf(def.items, item, `${path}[${i}]`, errors));
|
|
145
|
+
case "valueRef": {
|
|
146
|
+
// REQ-WDG-VALUEREF: a `{ tableId, recordId, column }` binding. Each
|
|
147
|
+
// sub-field is an optional string (a half-configured binding is valid
|
|
148
|
+
// while the author is still picking); the bound widget treats any
|
|
149
|
+
// missing piece as "no value" and shows its fallback.
|
|
150
|
+
if (!isPlainObject(value)) {
|
|
151
|
+
errors.push(`${path}: expected object`);
|
|
152
|
+
return value;
|
|
153
|
+
}
|
|
154
|
+
for (const sub of ["tableId", "recordId", "column"]) {
|
|
155
|
+
const v = value[sub];
|
|
156
|
+
if (v !== undefined && v !== null && typeof v !== "string") {
|
|
157
|
+
errors.push(`${path}.${sub}: expected string`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
137
162
|
case "object": {
|
|
138
163
|
if (!isPlainObject(value)) {
|
|
139
164
|
errors.push(`${path}: expected object`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|