@object-ui/fields 16.0.0 → 17.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 +630 -0
- package/README.md +45 -7
- package/dist/FieldEditWidget.d.ts +7 -0
- package/dist/field-type-alias.d.ts +16 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +35 -11
- package/dist/index.js +2241 -1853
- package/dist/widgets/CheckboxesField.cascade.test.d.ts +0 -0
- package/dist/widgets/CheckboxesField.d.ts +8 -1
- package/dist/widgets/FileField.d.ts +1 -1
- package/dist/widgets/FilterConditionField.d.ts +32 -0
- package/dist/widgets/ImageField.d.ts +1 -1
- package/dist/widgets/ImageLightbox.d.ts +30 -0
- package/dist/widgets/ImageLightbox.test.d.ts +1 -0
- package/dist/widgets/LookupField.hydration.test.d.ts +1 -0
- package/dist/widgets/LookupField.idField.test.d.ts +1 -0
- package/dist/widgets/MultiSelectField.cascade.test.d.ts +0 -0
- package/dist/widgets/MultiSelectField.d.ts +10 -2
- package/dist/widgets/RadioField.cascade.test.d.ts +0 -0
- package/dist/widgets/RadioField.d.ts +8 -1
- package/dist/widgets/RecipientPickerField.test.d.ts +0 -0
- package/dist/widgets/SelectField.d.ts +13 -9
- package/dist/widgets/__tests__/FilterConditionField.matchAll.test.d.ts +8 -0
- package/dist/widgets/__tests__/FilterConditionField.operators.test.d.ts +8 -0
- package/dist/widgets/deriveLookupColumns.d.ts +1 -0
- package/dist/widgets/file-value.d.ts +112 -0
- package/dist/widgets/file-value.test.d.ts +1 -0
- package/dist/widgets/types.d.ts +6 -0
- package/dist/widgets/useCascadingOptions.d.ts +18 -0
- package/dist/widgets/useFieldTranslation.d.ts +2 -0
- package/dist/widgets/useUploadingSignal.d.ts +9 -0
- package/dist/widgets/useUploadingSignal.test.d.ts +1 -0
- package/package.json +11 -10
- package/src/FieldEditWidget.test.ts +74 -2
- package/src/FieldEditWidget.tsx +44 -4
- package/src/field-type-alias.ts +100 -0
- package/src/field-type-coverage.test.ts +3 -1
- package/src/index.tsx +137 -135
- package/src/standard-widgets.test.tsx +44 -0
- package/src/widgets/CheckboxesField.cascade.test.tsx +143 -0
- package/src/widgets/CheckboxesField.tsx +77 -11
- package/src/widgets/FileField.tsx +91 -52
- package/src/widgets/FilterConditionField.tsx +109 -9
- package/src/widgets/ImageField.tsx +106 -65
- package/src/widgets/ImageLightbox.test.tsx +52 -0
- package/src/widgets/ImageLightbox.tsx +108 -0
- package/src/widgets/LookupField.hydration.test.tsx +136 -0
- package/src/widgets/LookupField.idField.test.tsx +61 -0
- package/src/widgets/LookupField.tsx +106 -9
- package/src/widgets/MultiSelectField.cascade.test.tsx +143 -0
- package/src/widgets/MultiSelectField.tsx +78 -11
- package/src/widgets/ObjectRefField.tsx +9 -4
- package/src/widgets/PeoplePicker.test.tsx +20 -0
- package/src/widgets/PeoplePicker.tsx +15 -3
- package/src/widgets/RadioField.cascade.test.tsx +141 -0
- package/src/widgets/RadioField.tsx +69 -9
- package/src/widgets/RecipientPickerField.test.tsx +157 -0
- package/src/widgets/RecipientPickerField.tsx +36 -16
- package/src/widgets/SelectField.tsx +33 -31
- package/src/widgets/TextAreaField.tsx +8 -3
- package/src/widgets/__tests__/FilterConditionField.matchAll.test.ts +66 -0
- package/src/widgets/__tests__/FilterConditionField.operators.test.ts +142 -0
- package/src/widgets/deriveLookupColumns.test.ts +13 -0
- package/src/widgets/deriveLookupColumns.ts +5 -15
- package/src/widgets/file-value.test.ts +230 -0
- package/src/widgets/file-value.ts +230 -0
- package/src/widgets/types.ts +6 -0
- package/src/widgets/useCascadingOptions.ts +46 -0
- package/src/widgets/useFieldTranslation.ts +30 -0
- package/src/widgets/useUploadingSignal.test.tsx +62 -0
- package/src/widgets/useUploadingSignal.ts +20 -0
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface DateDisplayOptions {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Format date as relative time (e.g., "3 days ago", "Today", "Overdue 3d"),
|
|
70
|
-
* localized via `Intl.RelativeTimeFormat` (objectstack-ai/
|
|
70
|
+
* localized via `Intl.RelativeTimeFormat` (objectstack-ai/objectstack#3040).
|
|
71
71
|
*
|
|
72
72
|
* `dueLike` gates the "Overdue" wording — a past `start_date`/`created_at`
|
|
73
73
|
* isn't overdue, only a past due/deadline-semantic field is. Non-due-like
|
|
@@ -162,7 +162,17 @@ export declare function PhoneCellRenderer({ value }: CellRendererProps): React.R
|
|
|
162
162
|
*/
|
|
163
163
|
export declare function FileCellRenderer({ value, field }: CellRendererProps): React.ReactElement;
|
|
164
164
|
/**
|
|
165
|
-
* Image field cell renderer (with thumbnails)
|
|
165
|
+
* Image field cell renderer (with thumbnails + click-to-zoom).
|
|
166
|
+
*
|
|
167
|
+
* An image value may be a plain URL string, an object ({ url | src | href … }),
|
|
168
|
+
* a bare `sys_file` id, or an array of any of those. Normalising through
|
|
169
|
+
* `readFileValues` (which resolves a bare id to its stable download URL) means
|
|
170
|
+
* a string-URL field, a CDN link, and an unexpanded reference all render a
|
|
171
|
+
* thumbnail instead of a broken `<img src="">` placeholder.
|
|
172
|
+
*
|
|
173
|
+
* Clicking a thumbnail opens a full-screen lightbox (single or gallery). The
|
|
174
|
+
* click is `stopPropagation`-guarded so, inside a grid row, enlarging an image
|
|
175
|
+
* doesn't also trigger row navigation.
|
|
166
176
|
*/
|
|
167
177
|
export declare function ImageCellRenderer({ value }: CellRendererProps): React.ReactElement;
|
|
168
178
|
/**
|
|
@@ -234,15 +244,7 @@ export declare function LocationCellRenderer({ value }: CellRendererProps): Reac
|
|
|
234
244
|
* Get the appropriate cell renderer for a field type
|
|
235
245
|
*/
|
|
236
246
|
export declare function getCellRenderer(fieldType: string): React.FC<CellRendererProps>;
|
|
237
|
-
|
|
238
|
-
* Map field type to form component type
|
|
239
|
-
*
|
|
240
|
-
* @param fieldType - The ObjectQL field type identifier to convert
|
|
241
|
-
* (for example: `"text"`, `"number"`, `"date"`, `"lookup"`).
|
|
242
|
-
* @returns The normalized form field type string used in the form schema
|
|
243
|
-
* (for example: `"input"`, `"textarea"`, `"date-picker"`, `"select"`).
|
|
244
|
-
*/
|
|
245
|
-
export declare function mapFieldTypeToFormType(fieldType: string): string;
|
|
247
|
+
export { mapFieldTypeToFormType } from './field-type-alias';
|
|
246
248
|
/**
|
|
247
249
|
* Formats file size in bytes to human-readable string
|
|
248
250
|
* @param bytes - File size in bytes (must be non-negative)
|
|
@@ -269,6 +271,27 @@ export declare function evaluateCondition(condition: any, formData: any): boolea
|
|
|
269
271
|
* `INLINE_EXCLUDED_FIELD_TYPES` and its drift-guard test.
|
|
270
272
|
*/
|
|
271
273
|
export declare const FORM_FIELD_TYPES: readonly string[];
|
|
274
|
+
/**
|
|
275
|
+
* Resolve an arbitrary field-type spelling to the widget key the form uses.
|
|
276
|
+
* A key already present in the widget map resolves to itself; spec aliases
|
|
277
|
+
* (`toggle`, `json`, `repeater`, `secret`, …) resolve through
|
|
278
|
+
* {@link mapFieldTypeToFormType}; anything unknown falls back to `text` —
|
|
279
|
+
* the same fallback the form renderer applies.
|
|
280
|
+
*
|
|
281
|
+
* Consumers that render field widgets outside the form (e.g. the app-shell
|
|
282
|
+
* `ActionParamDialog`) use this + {@link getLazyFieldWidget} so their type
|
|
283
|
+
* support can never drift behind the form surface (ADR-0059).
|
|
284
|
+
*/
|
|
285
|
+
export declare function resolveFormWidgetType(fieldType: string): string;
|
|
286
|
+
/**
|
|
287
|
+
* Lazily-loaded form field widget for a field type. Shares the exact loaders
|
|
288
|
+
* of {@link fieldWidgetMap} (the same components `registerField` registers for
|
|
289
|
+
* forms), wrapped in `React.lazy` and cached per type — so a consumer can
|
|
290
|
+
* render any form-supported field type without eagerly bundling every widget.
|
|
291
|
+
* Render inside a `<Suspense>` boundary. Unknown types resolve to the `text`
|
|
292
|
+
* widget via {@link resolveFormWidgetType}.
|
|
293
|
+
*/
|
|
294
|
+
export declare function getLazyFieldWidget(fieldType: string): React.ComponentType<any>;
|
|
272
295
|
export declare function registerField(fieldType: string): void;
|
|
273
296
|
/**
|
|
274
297
|
* Register all field types (for backward compatibility)
|
|
@@ -287,6 +310,7 @@ export declare function registerAllFields(): void;
|
|
|
287
310
|
*/
|
|
288
311
|
export declare function registerFields(): void;
|
|
289
312
|
export * from './widgets/types';
|
|
313
|
+
export * from './widgets/file-value';
|
|
290
314
|
export * from './FieldEditWidget';
|
|
291
315
|
export * from './widgets/TextField';
|
|
292
316
|
export * from './widgets/NumberField';
|