@colixsystems/widget-sdk 0.258.0 → 0.259.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 +5 -1
- package/dist/contract.cjs +3 -1
- package/dist/contract.js +3 -1
- package/dist/detail-parts-view.js +13 -10
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/contract.js +3 -1
package/README.md
CHANGED
|
@@ -85,7 +85,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
85
85
|
|
|
86
86
|
## Status
|
|
87
87
|
|
|
88
|
-
`v0.
|
|
88
|
+
`v0.259.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**.
|
|
89
|
+
|
|
90
|
+
### What's new in 0.259.0 (contract 1.210.0)
|
|
91
|
+
|
|
92
|
+
**`<Avatar url>` falls back to the initials** when its picture fails to load, instead of showing a broken image (as `<Avatar fileId>` already did). The built-in form fields for users, groups and related records now use `<PeoplePicker>`, and the User widget's photo uses `<Avatar>`.
|
|
89
93
|
|
|
90
94
|
### What's new in 0.258.0 (contract 1.209.0)
|
|
91
95
|
|
package/dist/contract.cjs
CHANGED
|
@@ -6377,7 +6377,9 @@ const CONTRACT = deepFreeze({
|
|
|
6377
6377
|
// 1.209.0: additive (sc-12242) — `<PeoplePicker>` takes `activeOnly`
|
|
6378
6378
|
// (users), a function `loadErrorText(error)`, and gives each option a
|
|
6379
6379
|
// `<testID>-option-<id>`.
|
|
6380
|
-
|
|
6380
|
+
// 1.210.0: behaviour (sc-12245) — `<Avatar url>` falls back to the
|
|
6381
|
+
// initials when its picture fails to load. No API change.
|
|
6382
|
+
version: "1.210.0",
|
|
6381
6383
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6382
6384
|
hooks: HOOKS,
|
|
6383
6385
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -6373,7 +6373,9 @@ const CONTRACT = deepFreeze({
|
|
|
6373
6373
|
// 1.209.0: additive (sc-12242) — `<PeoplePicker>` takes `activeOnly`
|
|
6374
6374
|
// (users), a function `loadErrorText(error)`, and gives each option a
|
|
6375
6375
|
// `<testID>-option-<id>`.
|
|
6376
|
-
|
|
6376
|
+
// 1.210.0: behaviour (sc-12245) — `<Avatar url>` falls back to the
|
|
6377
|
+
// initials when its picture fails to load. No API change.
|
|
6378
|
+
version: "1.210.0",
|
|
6377
6379
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6378
6380
|
hooks: HOOKS,
|
|
6379
6381
|
primitives: PRIMITIVES,
|
|
@@ -111,6 +111,13 @@ export function makeDetailParts(rn) {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// A photo that cannot load gives way to the initials.
|
|
115
|
+
function UrlAvatar({ photo, monogram }) {
|
|
116
|
+
const [failed, setFailed] = React.useState(false);
|
|
117
|
+
if (failed) return monogram;
|
|
118
|
+
return h(Image, { ...photo, onError: () => setFailed(true) });
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
function Avatar({ name, url, fileId, seed, size = "md", shape = "circle", accessibilityLabel, style, testID }) {
|
|
115
122
|
const { colors, radii, typography } = useDetailTheme();
|
|
116
123
|
const px = avatarPixelSize(size);
|
|
@@ -127,15 +134,6 @@ export function makeDetailParts(rn) {
|
|
|
127
134
|
const stored = typeof fileId === "string" && fileId !== "";
|
|
128
135
|
const source = typeof url === "string" ? url.trim() : "";
|
|
129
136
|
const label = accessibilityLabel || captionText(name) || "Avatar";
|
|
130
|
-
if (source && !stored) {
|
|
131
|
-
return h(Image, {
|
|
132
|
-
source: { uri: source },
|
|
133
|
-
accessibilityLabel: label,
|
|
134
|
-
resizeMode: "cover",
|
|
135
|
-
style: [box, style],
|
|
136
|
-
testID,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
137
|
const initials = initialsFor(name);
|
|
140
138
|
const fallback = { alignItems: "center", justifyContent: "center" };
|
|
141
139
|
const content = initials
|
|
@@ -152,11 +150,16 @@ export function makeDetailParts(rn) {
|
|
|
152
150
|
initials,
|
|
153
151
|
)
|
|
154
152
|
: h(Icon, { name: "user", size: Math.round(px * 0.55), color: ink });
|
|
153
|
+
const monogram = h(View, { style: [box, fallback, style], accessibilityLabel: label, testID }, content);
|
|
154
|
+
if (source && !stored) {
|
|
155
|
+
const photo = { source: { uri: source }, accessibilityLabel: label, resizeMode: "cover", style: [box, style], testID };
|
|
156
|
+
return h(UrlAvatar, { key: source, photo, monogram });
|
|
157
|
+
}
|
|
155
158
|
if (stored) {
|
|
156
159
|
const frame = { style: [box, fallback, { overflow: "hidden" }, style], accessibilityLabel: label, testID };
|
|
157
160
|
return h(FileAvatar, { key: fileId, fileId, px, frame, monogram: content });
|
|
158
161
|
}
|
|
159
|
-
return
|
|
162
|
+
return monogram;
|
|
160
163
|
}
|
|
161
164
|
Avatar.displayName = "Avatar";
|
|
162
165
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4151,7 +4151,7 @@ export const Avatar: (props: {
|
|
|
4151
4151
|
name?: string;
|
|
4152
4152
|
/** A stable id (a user id): tints the monogram with that person's colour. */
|
|
4153
4153
|
seed?: string;
|
|
4154
|
-
/** An absolute image URL. */
|
|
4154
|
+
/** An absolute image URL; the initials show if it cannot load. */
|
|
4155
4155
|
url?: string;
|
|
4156
4156
|
/**
|
|
4157
4157
|
* A filestore file id (a FILE column's value). Takes precedence over `url`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.259.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|
package/src/contract.js
CHANGED
|
@@ -6373,7 +6373,9 @@ const CONTRACT = deepFreeze({
|
|
|
6373
6373
|
// 1.209.0: additive (sc-12242) — `<PeoplePicker>` takes `activeOnly`
|
|
6374
6374
|
// (users), a function `loadErrorText(error)`, and gives each option a
|
|
6375
6375
|
// `<testID>-option-<id>`.
|
|
6376
|
-
|
|
6376
|
+
// 1.210.0: behaviour (sc-12245) — `<Avatar url>` falls back to the
|
|
6377
|
+
// initials when its picture fails to load. No API change.
|
|
6378
|
+
version: "1.210.0",
|
|
6377
6379
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6378
6380
|
hooks: HOOKS,
|
|
6379
6381
|
primitives: PRIMITIVES,
|