@object-ui/fields 17.3.0 → 17.6.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 +1655 -0
- package/README.md +1 -12
- package/dist/FieldEditWidget.d.ts +23 -3
- package/dist/currency.d.ts +46 -0
- package/dist/field-type-alias.d.ts +35 -1
- package/dist/index.cjs +4 -4
- package/dist/index.css +651 -0
- package/dist/index.d.ts +474 -85
- package/dist/index.js +5418 -5023
- package/dist/widgets/AddressField.d.ts +4 -12
- package/dist/widgets/AutoNumberField.d.ts +1 -1
- package/dist/widgets/AvatarField.d.ts +1 -1
- package/dist/widgets/BooleanField.d.ts +1 -1
- package/dist/widgets/CapabilityMultiSelectField.d.ts +1 -1
- package/dist/widgets/CheckboxesField.d.ts +1 -1
- package/dist/widgets/CodeField.d.ts +1 -1
- package/dist/widgets/ColorField.d.ts +1 -1
- package/dist/widgets/CurrencyField.d.ts +1 -1
- package/dist/widgets/DateField.d.ts +1 -1
- package/dist/widgets/DateTimeField.d.ts +1 -1
- package/dist/widgets/EmailField.d.ts +1 -1
- package/dist/widgets/FileField.d.ts +18 -2
- package/dist/widgets/FilterConditionField.d.ts +28 -1
- package/dist/widgets/FormulaField.d.ts +1 -1
- package/dist/widgets/FullscreenFieldEditor.d.ts +49 -152
- package/dist/widgets/GeolocationField.d.ts +1 -1
- package/dist/widgets/GridField.d.ts +68 -6
- package/dist/widgets/ImageField.d.ts +1 -1
- package/dist/widgets/LocationField.d.ts +1 -1
- package/dist/widgets/LookupField.d.ts +1 -1
- package/dist/widgets/MasterDetailField.d.ts +1 -1
- package/dist/widgets/MultiSelectField.d.ts +1 -1
- package/dist/widgets/NumberField.d.ts +1 -1
- package/dist/widgets/ObjectField.d.ts +1 -1
- package/dist/widgets/ObjectRefField.d.ts +1 -1
- package/dist/widgets/OptionsEmptyState.d.ts +21 -1
- package/dist/widgets/PasswordField.d.ts +1 -1
- package/dist/widgets/PercentField.d.ts +1 -1
- package/dist/widgets/PhoneField.d.ts +1 -1
- package/dist/widgets/QRCodeField.d.ts +1 -1
- package/dist/widgets/RadioField.d.ts +1 -1
- package/dist/widgets/RatingField.d.ts +1 -1
- package/dist/widgets/RecipientPickerField.d.ts +1 -1
- package/dist/widgets/RecordPickerDialog.d.ts +34 -10
- package/dist/widgets/RichTextField.d.ts +37 -1
- package/dist/widgets/SelectField.d.ts +26 -6
- package/dist/widgets/SignatureField.d.ts +32 -2
- package/dist/widgets/SliderField.d.ts +37 -2
- package/dist/widgets/SummaryField.d.ts +1 -1
- package/dist/widgets/TagsField.d.ts +1 -1
- package/dist/widgets/TextAreaField.d.ts +6 -2
- package/dist/widgets/TextField.d.ts +1 -1
- package/dist/widgets/TimeField.d.ts +1 -1
- package/dist/widgets/UrlField.d.ts +1 -1
- package/dist/widgets/UserField.d.ts +1 -1
- package/dist/widgets/VectorField.d.ts +1 -1
- package/dist/widgets/_cell-renderer-bridge.d.ts +1 -1
- package/dist/widgets/address-format.d.ts +88 -0
- package/dist/widgets/file-size-guard.d.ts +41 -0
- package/dist/widgets/lookupColumnDisplay.d.ts +93 -0
- package/dist/widgets/nativeDateValue.d.ts +37 -0
- package/dist/widgets/richTextDisplay.d.ts +80 -0
- package/dist/widgets/toDomProps.d.ts +30 -10
- package/dist/widgets/toHostGroupProps.d.ts +189 -0
- package/dist/widgets/types.d.ts +8 -3
- package/dist/widgets/useRecordQuery.d.ts +7 -1
- package/package.json +17 -14
- package/dist/FieldEditWidget.test.d.ts +0 -8
- package/dist/__tests__/DateCellRenderer.test.d.ts +0 -0
- package/dist/__tests__/NumberCellRenderer.test.d.ts +0 -0
- package/dist/__tests__/cell-truncation.test.d.ts +0 -0
- package/dist/__tests__/field-carrier-sdui.test.d.ts +0 -0
- package/dist/__tests__/lookupCellDisplayField.test.d.ts +0 -0
- package/dist/__tests__/lookupCellDisplayName.test.d.ts +0 -0
- package/dist/__tests__/lookupCellReferenceKey.test.d.ts +0 -0
- package/dist/__tests__/registry-collision.test.d.ts +0 -0
- package/dist/__tests__/resolveFieldCurrency.test.d.ts +0 -1
- package/dist/__tests__/spec-symbol-batch7.test.d.ts +0 -8
- package/dist/__tests__/validation-feedback.test.d.ts +0 -0
- package/dist/__tests__/widget-aria-invalid-e2e.test.d.ts +0 -0
- package/dist/__tests__/widget-aria-invalid-registry-e2e.test.d.ts +0 -0
- package/dist/__tests__/widget-dom-leak-e2e.test.d.ts +0 -0
- package/dist/__tests__/widget-props-contract.test.d.ts +0 -8
- package/dist/coerce-safe-value.test.d.ts +0 -1
- package/dist/complex-widgets.test.d.ts +0 -1
- package/dist/datetime-widgets.test.d.ts +0 -1
- package/dist/field-type-coverage.test.d.ts +0 -1
- package/dist/standard-widgets.test.d.ts +0 -0
- package/dist/widgets/AddressField.uniqueIds.test.d.ts +0 -0
- package/dist/widgets/CapabilityMultiSelectField.test.d.ts +0 -0
- package/dist/widgets/CharacterCount.d.ts +0 -56
- package/dist/widgets/CheckboxesField.cascade.test.d.ts +0 -0
- package/dist/widgets/GeolocationField.uniqueIds.test.d.ts +0 -0
- package/dist/widgets/GridField.test.d.ts +0 -1
- package/dist/widgets/ImageLightbox.test.d.ts +0 -1
- package/dist/widgets/LookupField.dependsOn.test.d.ts +0 -8
- package/dist/widgets/LookupField.gateHintLabel.test.d.ts +0 -8
- package/dist/widgets/LookupField.hydration.test.d.ts +0 -1
- package/dist/widgets/LookupField.idField.test.d.ts +0 -1
- package/dist/widgets/MultiSelectField.cascade.test.d.ts +0 -0
- package/dist/widgets/OptionsEmptyState.no-provider.test.d.ts +0 -0
- package/dist/widgets/OptionsEmptyState.test.d.ts +0 -0
- package/dist/widgets/PeoplePicker.test.d.ts +0 -8
- package/dist/widgets/PeoplePickerComponents.test.d.ts +0 -8
- package/dist/widgets/RadioField.cascade.test.d.ts +0 -0
- package/dist/widgets/RecipientPickerField.test.d.ts +0 -0
- package/dist/widgets/RecordPickerDialog.filterOptions.test.d.ts +0 -8
- package/dist/widgets/RecordPickerDialog.selectLabel.test.d.ts +0 -8
- package/dist/widgets/SelectField.cascade.test.d.ts +0 -0
- package/dist/widgets/TagsField.placeholder.no-provider.test.d.ts +0 -0
- package/dist/widgets/TagsField.placeholder.test.d.ts +0 -0
- package/dist/widgets/UserFieldPicker.test.d.ts +0 -8
- package/dist/widgets/__tests__/FilterConditionField.matchAll.test.d.ts +0 -8
- package/dist/widgets/__tests__/FilterConditionField.operators.test.d.ts +0 -8
- package/dist/widgets/__tests__/FullscreenFieldEditor.i18n.test.d.ts +0 -0
- package/dist/widgets/__tests__/FullscreenFieldEditor.no-provider.test.d.ts +0 -0
- package/dist/widgets/__tests__/RichTextField.fullscreenDisabled.test.d.ts +0 -0
- package/dist/widgets/__tests__/RichTextField.mobileFullscreen.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.characterCount.announcements.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.characterCount.i18n.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.characterCount.no-provider.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.fullscreenCharacterCount.i18n.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.fullscreenCharacterCount.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.fullscreenDisabled.test.d.ts +0 -0
- package/dist/widgets/__tests__/TextAreaField.mobileFullscreen.test.d.ts +0 -0
- package/dist/widgets/deriveLookupColumns.test.d.ts +0 -1
- package/dist/widgets/file-value.test.d.ts +0 -1
- package/dist/widgets/personDisplay.test.d.ts +0 -8
- package/dist/widgets/recentLookups.test.d.ts +0 -1
- package/dist/widgets/useRecordQuery.test.d.ts +0 -8
- package/dist/widgets/useUploadingSignal.test.d.ts +0 -1
- package/src/FieldEditWidget.test.ts +0 -133
- package/src/FieldEditWidget.tsx +0 -191
- package/src/__tests__/DateCellRenderer.test.tsx +0 -73
- package/src/__tests__/NumberCellRenderer.test.tsx +0 -60
- package/src/__tests__/cell-truncation.test.tsx +0 -96
- package/src/__tests__/field-carrier-sdui.test.tsx +0 -169
- package/src/__tests__/lookupCellDisplayField.test.tsx +0 -107
- package/src/__tests__/lookupCellDisplayName.test.tsx +0 -119
- package/src/__tests__/lookupCellReferenceKey.test.tsx +0 -57
- package/src/__tests__/registry-collision.test.ts +0 -91
- package/src/__tests__/resolveFieldCurrency.test.ts +0 -20
- package/src/__tests__/spec-symbol-batch7.test.ts +0 -126
- package/src/__tests__/validation-feedback.test.tsx +0 -361
- package/src/__tests__/widget-aria-invalid-e2e.test.tsx +0 -265
- package/src/__tests__/widget-aria-invalid-registry-e2e.test.tsx +0 -338
- package/src/__tests__/widget-dom-leak-e2e.test.tsx +0 -598
- package/src/__tests__/widget-props-contract.test.tsx +0 -142
- package/src/coerce-safe-value.test.ts +0 -34
- package/src/complex-widgets.test.tsx +0 -908
- package/src/currency.ts +0 -14
- package/src/datetime-widgets.test.tsx +0 -93
- package/src/field-type-alias.ts +0 -100
- package/src/field-type-coverage.test.ts +0 -67
- package/src/index.tsx +0 -2503
- package/src/standard-widgets.test.tsx +0 -357
- package/src/widgets/AddressField.tsx +0 -132
- package/src/widgets/AddressField.uniqueIds.test.tsx +0 -92
- package/src/widgets/AutoNumberField.tsx +0 -18
- package/src/widgets/AvatarField.tsx +0 -117
- package/src/widgets/BooleanField.tsx +0 -52
- package/src/widgets/CapabilityMultiSelectField.test.tsx +0 -168
- package/src/widgets/CapabilityMultiSelectField.tsx +0 -229
- package/src/widgets/CharacterCount.tsx +0 -263
- package/src/widgets/CheckboxesField.cascade.test.tsx +0 -143
- package/src/widgets/CheckboxesField.tsx +0 -136
- package/src/widgets/CodeField.tsx +0 -41
- package/src/widgets/ColorField.tsx +0 -53
- package/src/widgets/CurrencyField.tsx +0 -95
- package/src/widgets/DateField.tsx +0 -31
- package/src/widgets/DateTimeField.tsx +0 -37
- package/src/widgets/EmailField.tsx +0 -37
- package/src/widgets/FileField.tsx +0 -494
- package/src/widgets/FilterConditionField.tsx +0 -454
- package/src/widgets/FormulaField.tsx +0 -33
- package/src/widgets/FullscreenFieldEditor.tsx +0 -271
- package/src/widgets/GeolocationField.tsx +0 -167
- package/src/widgets/GeolocationField.uniqueIds.test.tsx +0 -88
- package/src/widgets/GridField.test.tsx +0 -406
- package/src/widgets/GridField.tsx +0 -966
- package/src/widgets/ImageCropperDialog.tsx +0 -245
- package/src/widgets/ImageField.tsx +0 -255
- package/src/widgets/ImageLightbox.test.tsx +0 -52
- package/src/widgets/ImageLightbox.tsx +0 -108
- package/src/widgets/LocationField.tsx +0 -57
- package/src/widgets/LookupField.dependsOn.test.tsx +0 -233
- package/src/widgets/LookupField.gateHintLabel.test.tsx +0 -135
- package/src/widgets/LookupField.hydration.test.tsx +0 -136
- package/src/widgets/LookupField.idField.test.tsx +0 -61
- package/src/widgets/LookupField.tsx +0 -1291
- package/src/widgets/MarkdownContent.tsx +0 -19
- package/src/widgets/MasterDetailField.tsx +0 -131
- package/src/widgets/MultiSelectField.cascade.test.tsx +0 -143
- package/src/widgets/MultiSelectField.tsx +0 -142
- package/src/widgets/NumberField.tsx +0 -49
- package/src/widgets/ObjectField.tsx +0 -94
- package/src/widgets/ObjectRefField.tsx +0 -121
- package/src/widgets/OptionsEmptyState.no-provider.test.tsx +0 -88
- package/src/widgets/OptionsEmptyState.test.tsx +0 -169
- package/src/widgets/OptionsEmptyState.tsx +0 -83
- package/src/widgets/PasswordField.tsx +0 -49
- package/src/widgets/PeoplePicker.test.tsx +0 -360
- package/src/widgets/PeoplePicker.tsx +0 -579
- package/src/widgets/PeoplePickerComponents.test.tsx +0 -104
- package/src/widgets/PercentField.tsx +0 -95
- package/src/widgets/PersonRow.tsx +0 -117
- package/src/widgets/PhoneField.tsx +0 -37
- package/src/widgets/QRCodeField.tsx +0 -103
- package/src/widgets/RadioField.cascade.test.tsx +0 -141
- package/src/widgets/RadioField.tsx +0 -111
- package/src/widgets/RatingField.tsx +0 -81
- package/src/widgets/RecipientPickerField.test.tsx +0 -157
- package/src/widgets/RecipientPickerField.tsx +0 -188
- package/src/widgets/RecordPickerDialog.filterOptions.test.tsx +0 -611
- package/src/widgets/RecordPickerDialog.selectLabel.test.tsx +0 -112
- package/src/widgets/RecordPickerDialog.tsx +0 -1316
- package/src/widgets/RichTextField.tsx +0 -176
- package/src/widgets/SelectField.cascade.test.tsx +0 -138
- package/src/widgets/SelectField.tsx +0 -162
- package/src/widgets/SelectionTray.tsx +0 -110
- package/src/widgets/SignatureField.tsx +0 -140
- package/src/widgets/SliderField.tsx +0 -39
- package/src/widgets/SummaryField.tsx +0 -31
- package/src/widgets/TagsField.placeholder.no-provider.test.tsx +0 -68
- package/src/widgets/TagsField.placeholder.test.tsx +0 -95
- package/src/widgets/TagsField.tsx +0 -88
- package/src/widgets/TextAreaField.tsx +0 -213
- package/src/widgets/TextField.tsx +0 -45
- package/src/widgets/TimeField.tsx +0 -31
- package/src/widgets/UrlField.tsx +0 -46
- package/src/widgets/UserField.tsx +0 -58
- package/src/widgets/UserFieldPicker.test.tsx +0 -78
- package/src/widgets/VectorField.tsx +0 -29
- package/src/widgets/__tests__/FilterConditionField.matchAll.test.ts +0 -66
- package/src/widgets/__tests__/FilterConditionField.operators.test.ts +0 -142
- package/src/widgets/__tests__/FullscreenFieldEditor.i18n.test.tsx +0 -248
- package/src/widgets/__tests__/FullscreenFieldEditor.no-provider.test.tsx +0 -116
- package/src/widgets/__tests__/RichTextField.fullscreenDisabled.test.tsx +0 -244
- package/src/widgets/__tests__/RichTextField.mobileFullscreen.test.tsx +0 -195
- package/src/widgets/__tests__/TextAreaField.characterCount.announcements.test.tsx +0 -417
- package/src/widgets/__tests__/TextAreaField.characterCount.i18n.test.tsx +0 -287
- package/src/widgets/__tests__/TextAreaField.characterCount.no-provider.test.tsx +0 -160
- package/src/widgets/__tests__/TextAreaField.fullscreenCharacterCount.i18n.test.tsx +0 -161
- package/src/widgets/__tests__/TextAreaField.fullscreenCharacterCount.test.tsx +0 -346
- package/src/widgets/__tests__/TextAreaField.fullscreenDisabled.test.tsx +0 -246
- package/src/widgets/__tests__/TextAreaField.mobileFullscreen.test.tsx +0 -175
- package/src/widgets/_cell-renderer-bridge.ts +0 -19
- package/src/widgets/deriveLookupColumns.test.ts +0 -112
- package/src/widgets/deriveLookupColumns.ts +0 -108
- package/src/widgets/file-value.test.ts +0 -230
- package/src/widgets/file-value.ts +0 -246
- package/src/widgets/openNativePicker.ts +0 -18
- package/src/widgets/personDisplay.test.ts +0 -113
- package/src/widgets/personDisplay.ts +0 -92
- package/src/widgets/recentLookups.test.ts +0 -45
- package/src/widgets/recentLookups.ts +0 -47
- package/src/widgets/toDomProps.ts +0 -175
- package/src/widgets/types.ts +0 -242
- package/src/widgets/useCascadingOptions.ts +0 -46
- package/src/widgets/useFieldTranslation.ts +0 -150
- package/src/widgets/useRecordQuery.test.ts +0 -174
- package/src/widgets/useRecordQuery.ts +0 -264
- package/src/widgets/useUploadingSignal.test.tsx +0 -62
- package/src/widgets/useUploadingSignal.ts +0 -20
- package/src/withFieldCarrier.tsx +0 -75
package/README.md
CHANGED
|
@@ -115,20 +115,9 @@ Client-side hiding is UX only — gate authorization-sensitive values on the
|
|
|
115
115
|
server too. See
|
|
116
116
|
[`content/docs/fields/select.mdx`](../../content/docs/fields/select.mdx).
|
|
117
117
|
|
|
118
|
-
<!-- release-metadata:v3.3.0 -->
|
|
119
|
-
|
|
120
|
-
## Compatibility
|
|
121
|
-
|
|
122
|
-
- **React:** 18.x or 19.x
|
|
123
|
-
- **Node.js:** ≥ 18
|
|
124
|
-
- **TypeScript:** ≥ 5.0 (strict mode)
|
|
125
|
-
- **`@objectstack/spec`:** ^3.3.0
|
|
126
|
-
- **`@objectstack/client`:** ^3.3.0
|
|
127
|
-
- **Tailwind CSS:** ≥ 3.4 (for packages with UI)
|
|
128
|
-
|
|
129
118
|
## Links
|
|
130
119
|
|
|
131
|
-
- 📚 [Documentation](https://www.objectui.org/docs/fields)
|
|
120
|
+
- 📚 [Documentation](https://www.objectui.org/docs/guide/fields)
|
|
132
121
|
- 📦 [npm package](https://www.npmjs.com/package/@object-ui/fields)
|
|
133
122
|
- 📝 [Changelog](./CHANGELOG.md)
|
|
134
123
|
- 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './widgets/types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './widgets/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Form field types that are deliberately NOT given an inline editor — every
|
|
5
5
|
* other form widget type must be in {@link EDIT_WIDGETS}. This pairing is
|
|
@@ -10,7 +10,21 @@ import { FieldWidgetComponentProps } from './widgets/types';
|
|
|
10
10
|
export declare const INLINE_EXCLUDED_FIELD_TYPES: Set<string>;
|
|
11
11
|
/** Field types whose value is chosen in one discrete gesture (no free typing). */
|
|
12
12
|
export declare const DISCRETE_EDIT_TYPES: Set<string>;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* True when a field type has a dedicated in-place edit widget.
|
|
15
|
+
*
|
|
16
|
+
* A RETIRED spelling answers `false` unconditionally, ahead of every table
|
|
17
|
+
* lookup (objectui#4931). This is the gate the retirement was missing: hosts
|
|
18
|
+
* ask this question to decide whether to hand a cell to {@link FieldEditWidget},
|
|
19
|
+
* and while it answered `true` for a retired spelling the whole tombstone was
|
|
20
|
+
* bypassable by delegation — the grid's inline cell editor rendered a working
|
|
21
|
+
* person picker for a field the record form refuses.
|
|
22
|
+
*
|
|
23
|
+
* Keyed on the retirement TABLE rather than on the raw `type`, and checked
|
|
24
|
+
* BEFORE `resolveInlineEditType`, so it holds even if a future retired spelling
|
|
25
|
+
* is still (or again) a key of {@link EDIT_WIDGETS} — closing the class, not
|
|
26
|
+
* one spelling.
|
|
27
|
+
*/
|
|
14
28
|
export declare function hasFieldEditWidget(type: string | undefined): boolean;
|
|
15
29
|
/**
|
|
16
30
|
* True when a field type is deliberately NOT inline-editable (alias-aware:
|
|
@@ -24,5 +38,11 @@ export declare function isInlineExcludedFieldType(type: string | undefined): boo
|
|
|
24
38
|
* form uses — as a controlled `{ value, onChange, field }` input. Returns
|
|
25
39
|
* `null` for types without a registered widget so the caller can fall back to
|
|
26
40
|
* a plain editor.
|
|
41
|
+
*
|
|
42
|
+
* `autoFocus` is forwarded because an inline-edit host enters edit mode ON a
|
|
43
|
+
* field and expects the caret to land there (objectui#4220 — the detail page's
|
|
44
|
+
* delegation): each widget's own `toDomProps` whitelist already carries it onto
|
|
45
|
+
* the real focusable control, so nothing here needs to know which element that
|
|
46
|
+
* is. A host that passes nothing is unaffected.
|
|
27
47
|
*/
|
|
28
|
-
export declare function FieldEditWidget({ field, value, onChange, readonly, }: FieldWidgetComponentProps<any>): React.ReactElement | null;
|
|
48
|
+
export declare function FieldEditWidget({ field, value, onChange, readonly, autoFocus, }: FieldWidgetComponentProps<any>): React.ReactElement | null;
|
package/dist/currency.d.ts
CHANGED
|
@@ -11,3 +11,49 @@
|
|
|
11
11
|
* every field/cell renderer that already depends on it.
|
|
12
12
|
*/
|
|
13
13
|
export { resolveFieldCurrency } from '@object-ui/i18n';
|
|
14
|
+
/**
|
|
15
|
+
* The number of fraction digits ISO 4217 gives `currency` — 0 for JPY/KRW/CLP,
|
|
16
|
+
* 2 for USD/EUR/CNY, 3 for KWD/BHD/OMR/TND — as ICU reports it.
|
|
17
|
+
*
|
|
18
|
+
* Returns {@link DEFAULT_FRACTION_DIGITS} when the code is not a currency code
|
|
19
|
+
* at all: `Intl` throws `RangeError: Invalid currency code` for those, and the
|
|
20
|
+
* throw must not escape, or a bad code would change the width used by the
|
|
21
|
+
* callers' own bad-currency fallbacks (objectui#4332 pinned those strings). A
|
|
22
|
+
* code that is well-formed but unknown to CLDR (e.g. `ZZZ`) does not throw —
|
|
23
|
+
* ICU answers 2 for anything outside its table, which is the same default.
|
|
24
|
+
*
|
|
25
|
+
* Memoized because the currency cell renderer runs once per grid cell: measured
|
|
26
|
+
* at 24.3us per uncached probe against 0.02us cached (200k iterations, node 22),
|
|
27
|
+
* so a 500-row grid pays ~12ms per render pass for a value that cannot change.
|
|
28
|
+
*/
|
|
29
|
+
export declare function currencyFractionDigits(currency: string): number;
|
|
30
|
+
/**
|
|
31
|
+
* The string ICU renders in place of `currency` for a reader in `locale` — `$`
|
|
32
|
+
* for USD at `en`, `€` for EUR, U+00A5 for JPY — taken from the `currency` part
|
|
33
|
+
* of the very format the display path already uses.
|
|
34
|
+
*
|
|
35
|
+
* This is the ONE channel for the symbol (objectui#4414). It is not an
|
|
36
|
+
* independent opinion about how a currency should look: it is the same
|
|
37
|
+
* `Intl.NumberFormat(locale, { style: 'currency', currency })` that
|
|
38
|
+
* `formatDisplayNumber` formats amounts with, read one part at a time. So a
|
|
39
|
+
* widget that renders an amount in one mode and a bare symbol in another cannot
|
|
40
|
+
* disagree with itself — which is exactly what the hand-written
|
|
41
|
+
* `currency === 'USD' ? '$' : currency` ternary did, showing `JPY` beside a
|
|
42
|
+
* readonly `¥1,235`.
|
|
43
|
+
*
|
|
44
|
+
* Falls back to `currency` itself — the code as given — in the three cases
|
|
45
|
+
* where ICU cannot answer, because a bare code is a legitimate adornment (it is
|
|
46
|
+
* what ICU itself returns for KWD/BHD/CHF/ISK, and what
|
|
47
|
+
* `formatAmount`'s own bad-code branch renders beside it):
|
|
48
|
+
*
|
|
49
|
+
* 1. an invalid currency code — `Intl` throws `RangeError: Invalid currency
|
|
50
|
+
* code`;
|
|
51
|
+
* 2. a malformed locale tag (`en_US` with an underscore, say) — `Intl` throws
|
|
52
|
+
* `RangeError: Incorrect locale information provided`. `currencyFractionDigits`
|
|
53
|
+
* dodged this failure mode by dropping the locale from its probe; this
|
|
54
|
+
* helper needs the locale, so it catches instead. Neither throw may escape:
|
|
55
|
+
* this runs during render, so an escaped `RangeError` is a blank widget.
|
|
56
|
+
* 3. no `currency` part in the output at all — not observed for
|
|
57
|
+
* `style: 'currency'`, but coalesced rather than asserted.
|
|
58
|
+
*/
|
|
59
|
+
export declare function currencySymbol(currency: string, locale: string): string;
|
|
@@ -5,12 +5,46 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* The slice of a field definition the widget decision reads beyond `type`.
|
|
10
|
+
*
|
|
11
|
+
* Structural (not the spec `Field`) for the same reason the spec's own
|
|
12
|
+
* `ValueShapeFieldDef` is: every caller — object-schema metadata, a spec
|
|
13
|
+
* `FormFieldSchema` override, an action param def — can pass its own trimmed
|
|
14
|
+
* shape verbatim. `multiple` is the only key read; nothing else here is
|
|
15
|
+
* consulted, so a caller that has the whole metadata object may hand it over
|
|
16
|
+
* as-is.
|
|
17
|
+
*/
|
|
18
|
+
export interface FieldTypeMappingConfig {
|
|
19
|
+
/** `FieldSchema.multiple` — the field holds zero-or-more values. */
|
|
20
|
+
multiple?: boolean | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The retirement half of this module — the TOMBSTONE table
|
|
24
|
+
* {@link RETIRED_FIELD_TYPES}, the {@link isRetiredFieldType} gate, and the
|
|
25
|
+
* once-per-spelling reporter — now lives in `@object-ui/core`
|
|
26
|
+
* (`utils/retired-field-types.ts`), hoisted there by objectui#4914 so that
|
|
27
|
+
* `@object-ui/components`' filter builder can read the SAME table: `fields`
|
|
28
|
+
* depends on `components`, so the six ruled predicate faces could not all
|
|
29
|
+
* reach a table that lived here. The module's docblock carries the full
|
|
30
|
+
* reasoning, including why a second copy in `components` would have broken the
|
|
31
|
+
* ruling's "fires once" clause on day one.
|
|
32
|
+
*
|
|
33
|
+
* Re-exported from here, and from the `./index` barrel, so `@object-ui/fields`'
|
|
34
|
+
* published surface is exactly what it was plus the newly ruled gate. This file
|
|
35
|
+
* remains the retirement table's first consumer (the `field:text` tail below).
|
|
36
|
+
*/
|
|
37
|
+
export { RETIRED_FIELD_TYPES, isRetiredFieldType, reportRetiredFieldType, resetRetiredFieldTypeReports, } from '@object-ui/core';
|
|
8
38
|
/**
|
|
9
39
|
* Map field type to form component type
|
|
10
40
|
*
|
|
11
41
|
* @param fieldType - The ObjectQL field type identifier to convert
|
|
12
42
|
* (for example: `"text"`, `"number"`, `"date"`, `"lookup"`).
|
|
43
|
+
* @param config - The rest of the field definition, for the types whose widget
|
|
44
|
+
* identity depends on more than the type string. Only `multiple` is read; see
|
|
45
|
+
* {@link MULTI_VALUE_FORM_TYPES}. Omitting it maps the single-value form, which
|
|
46
|
+
* is what every non-multi-capable type resolves to anyway.
|
|
13
47
|
* @returns The normalized form field type string used in the form schema
|
|
14
48
|
* (for example: `"input"`, `"textarea"`, `"date-picker"`, `"select"`).
|
|
15
49
|
*/
|
|
16
|
-
export declare function mapFieldTypeToFormType(fieldType: string): string;
|
|
50
|
+
export declare function mapFieldTypeToFormType(fieldType: string, config?: FieldTypeMappingConfig): string;
|