@object-ui/fields 17.5.0 → 17.7.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 +6150 -0
- package/README.md +108 -8
- package/dist/FieldEditWidget.d.ts +70 -8
- package/dist/coerceToSafeValue.d.ts +54 -0
- package/dist/currency.d.ts +1 -1
- package/dist/field-type-alias.d.ts +16 -0
- package/dist/index.cjs +5 -5
- package/dist/index.css +53 -11
- package/dist/index.d.ts +653 -128
- package/dist/index.js +4275 -3171
- package/dist/widgets/AddressField.d.ts +3 -3
- package/dist/widgets/AutoNumberField.d.ts +1 -1
- package/dist/widgets/AvatarField.d.ts +20 -4
- package/dist/widgets/BooleanField.d.ts +2 -2
- 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 +2 -2
- package/dist/widgets/DateTimeField.d.ts +2 -2
- package/dist/widgets/EmailField.d.ts +1 -1
- package/dist/widgets/FileField.d.ts +18 -2
- package/dist/widgets/FilterConditionField.d.ts +43 -2
- package/dist/widgets/FormulaField.d.ts +1 -1
- package/dist/widgets/FullscreenFieldEditor.d.ts +9 -2
- package/dist/widgets/GeolocationField.d.ts +10 -4
- package/dist/widgets/GridField.d.ts +102 -86
- package/dist/widgets/ImageField.d.ts +1 -1
- package/dist/widgets/LocationField.d.ts +31 -4
- package/dist/widgets/LookupField.d.ts +9 -1
- package/dist/widgets/MasterDetailField.d.ts +1 -1
- package/dist/widgets/MultiSelectField.d.ts +1 -1
- package/dist/widgets/NumberField.d.ts +2 -2
- package/dist/widgets/ObjectField.d.ts +10 -3
- package/dist/widgets/ObjectRefField.d.ts +1 -1
- package/dist/widgets/OptionsEmptyState.d.ts +38 -8
- package/dist/widgets/PasswordField.d.ts +15 -1
- package/dist/widgets/PeoplePicker.d.ts +17 -2
- package/dist/widgets/PercentField.d.ts +3 -2
- package/dist/widgets/PersonRow.d.ts +13 -2
- 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 +44 -1
- package/dist/widgets/RecordPickerDialog.d.ts +33 -16
- package/dist/widgets/RichTextField.d.ts +37 -1
- package/dist/widgets/SelectField.d.ts +1 -1
- package/dist/widgets/SelectionTray.d.ts +13 -2
- 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 +2 -2
- package/dist/widgets/TimeField.d.ts +2 -2
- 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 +27 -7
- package/dist/widgets/file-affordance.d.ts +33 -0
- package/dist/widgets/file-size-guard.d.ts +5 -23
- package/dist/widgets/file-value.d.ts +38 -9
- package/dist/widgets/lookupColumnDisplay.d.ts +110 -0
- package/dist/widgets/nativeDateValue.d.ts +9 -27
- package/dist/widgets/number-format.d.ts +137 -0
- package/dist/widgets/numberBadInput.d.ts +135 -0
- package/dist/widgets/personDisplay.d.ts +22 -4
- package/dist/widgets/richTextDisplay.d.ts +116 -0
- package/dist/widgets/toDomProps.d.ts +10 -1
- package/dist/widgets/toHostGroupProps.d.ts +172 -21
- package/dist/widgets/toHostProps.d.ts +105 -0
- package/dist/widgets/types.d.ts +19 -6
- package/dist/widgets/upload-error-message.d.ts +6 -0
- package/dist/widgets/uploadingScope.d.ts +142 -0
- package/dist/widgets/useCascadingOptions.d.ts +3 -2
- package/dist/widgets/useRecordQuery.d.ts +4 -2
- package/dist/widgets/useUploadingSignal.d.ts +8 -0
- package/package.json +11 -13
- package/dist/widgets/CharacterCount.d.ts +0 -56
- package/src/FieldEditWidget.test.ts +0 -133
- package/src/FieldEditWidget.tsx +0 -207
- package/src/__tests__/AddressCellRenderer.test.tsx +0 -166
- package/src/__tests__/CurrencyField.minorUnits.test.tsx +0 -191
- package/src/__tests__/CurrencyField.symbol.test.tsx +0 -198
- package/src/__tests__/DateCellRenderer.test.tsx +0 -82
- package/src/__tests__/NumberCellRenderer.grouping.test.tsx +0 -146
- package/src/__tests__/NumberCellRenderer.test.tsx +0 -60
- package/src/__tests__/PercentCellRenderer.locale.test.tsx +0 -152
- package/src/__tests__/PercentCellRenderer.test.tsx +0 -115
- package/src/__tests__/boolean-label-association-e2e.test.tsx +0 -298
- package/src/__tests__/capability-multiselect-retired.test.ts +0 -109
- package/src/__tests__/cell-truncation.test.tsx +0 -96
- package/src/__tests__/composite-group-label-e2e.test.tsx +0 -436
- package/src/__tests__/composite-group-label-readonly-e2e.test.tsx +0 -403
- package/src/__tests__/date-formatter-residue-4272.test.ts +0 -120
- package/src/__tests__/date-locale-channel.test.tsx +0 -305
- package/src/__tests__/field-carrier-sdui.test.tsx +0 -169
- package/src/__tests__/formatCurrency.centsDigit.test.tsx +0 -158
- package/src/__tests__/formatCurrency.minorUnits.test.tsx +0 -221
- package/src/__tests__/group-labelling-declaration.test.ts +0 -148
- package/src/__tests__/lookupCellDisplayField.test.tsx +0 -107
- package/src/__tests__/lookupCellDisplayName.test.tsx +0 -119
- package/src/__tests__/lookupCellRecordLink.test.tsx +0 -171
- package/src/__tests__/lookupCellReferenceKey.test.tsx +0 -57
- package/src/__tests__/percent-cell-vs-measure-4576.test.ts +0 -115
- package/src/__tests__/percent-formatter-locale-4553.test.ts +0 -147
- package/src/__tests__/percent-tie-halfup-4590.test.ts +0 -224
- package/src/__tests__/registry-collision.test.ts +0 -91
- package/src/__tests__/resolveFieldCurrency.test.ts +0 -20
- package/src/__tests__/select-label-association-e2e.test.tsx +0 -199
- 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 -357
- 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 -924
- package/src/currency.ts +0 -144
- package/src/datetime-widgets.test.tsx +0 -185
- package/src/field-type-alias.multiple.test.ts +0 -81
- package/src/field-type-alias.ts +0 -156
- package/src/field-type-coverage.test.ts +0 -67
- package/src/index.css +0 -44
- package/src/index.tsx +0 -2745
- package/src/standard-widgets.test.tsx +0 -364
- package/src/widgets/AddressField.postalCode.test.tsx +0 -257
- package/src/widgets/AddressField.tsx +0 -182
- package/src/widgets/AddressField.uniqueIds.test.tsx +0 -93
- package/src/widgets/AutoNumberField.tsx +0 -18
- package/src/widgets/AvatarField.tsx +0 -117
- package/src/widgets/BooleanField.tsx +0 -86
- package/src/widgets/CapabilityMultiSelectField.test.tsx +0 -168
- package/src/widgets/CapabilityMultiSelectField.tsx +0 -241
- package/src/widgets/CharacterCount.tsx +0 -263
- package/src/widgets/CheckboxesField.cascade.test.tsx +0 -143
- package/src/widgets/CheckboxesField.tsx +0 -169
- package/src/widgets/CodeField.tsx +0 -41
- package/src/widgets/ColorField.tsx +0 -53
- package/src/widgets/CurrencyField.tsx +0 -135
- package/src/widgets/DateField.tsx +0 -40
- package/src/widgets/DateTimeField.tsx +0 -46
- package/src/widgets/EmailField.tsx +0 -37
- package/src/widgets/FileField.tsx +0 -512
- package/src/widgets/FilterConditionField.tsx +0 -454
- package/src/widgets/FormulaField.tsx +0 -38
- package/src/widgets/FullscreenFieldEditor.tsx +0 -60
- package/src/widgets/GeolocationField.tsx +0 -193
- package/src/widgets/GeolocationField.uniqueIds.test.tsx +0 -88
- package/src/widgets/GridField.test.tsx +0 -632
- package/src/widgets/GridField.tsx +0 -1070
- package/src/widgets/ImageCropperDialog.tsx +0 -245
- package/src/widgets/ImageField.maxSize.test.tsx +0 -154
- package/src/widgets/ImageField.tsx +0 -305
- 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 -1295
- 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 -196
- 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 -99
- 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 -143
- package/src/widgets/RatingField.tsx +0 -94
- package/src/widgets/RecipientPickerField.test.tsx +0 -157
- package/src/widgets/RecipientPickerField.tsx +0 -188
- package/src/widgets/RecordPickerDialog.baseFilterShapes.test.tsx +0 -191
- package/src/widgets/RecordPickerDialog.dateLocale.test.tsx +0 -124
- package/src/widgets/RecordPickerDialog.filterOptions.test.tsx +0 -611
- package/src/widgets/RecordPickerDialog.selectLabel.test.tsx +0 -112
- package/src/widgets/RecordPickerDialog.tsx +0 -1365
- package/src/widgets/RichTextField.tsx +0 -176
- package/src/widgets/SelectField.cascade.test.tsx +0 -138
- package/src/widgets/SelectField.tsx +0 -193
- 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 -59
- 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 -166
- 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/address-format.ts +0 -120
- package/src/widgets/deriveLookupColumns.test.ts +0 -112
- package/src/widgets/deriveLookupColumns.ts +0 -108
- package/src/widgets/file-size-guard.ts +0 -55
- package/src/widgets/file-value.test.ts +0 -230
- package/src/widgets/file-value.ts +0 -246
- package/src/widgets/nativeDateValue.test.ts +0 -115
- package/src/widgets/nativeDateValue.ts +0 -112
- package/src/widgets/openNativePicker.ts +0 -18
- package/src/widgets/optionWidgets.gatedOptions.test.tsx +0 -267
- package/src/widgets/optionWidgets.unconfiguredOptions.test.tsx +0 -150
- 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 -204
- package/src/widgets/toHostGroupProps.ts +0 -102
- package/src/widgets/types.ts +0 -242
- package/src/widgets/useCascadingOptions.ts +0 -46
- package/src/widgets/useFieldTranslation.ts +0 -132
- package/src/widgets/useRecordQuery.test.ts +0 -174
- package/src/widgets/useRecordQuery.ts +0 -291
- package/src/widgets/useUploadingSignal.test.tsx +0 -62
- package/src/widgets/useUploadingSignal.ts +0 -20
- package/src/withFieldCarrier.tsx +0 -75
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
3
|
-
import { AddressValue } from './address-format';
|
|
4
|
-
export type { AddressValue } from './address-format';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
|
+
import { AddressValue } from './address-format.js';
|
|
4
|
+
export type { AddressValue } from './address-format.js';
|
|
5
5
|
/**
|
|
6
6
|
* Address field widget - provides a structured address input
|
|
7
7
|
* Supports street, city, state, postal code, and country
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* AutoNumberField - Read-only auto-generated field
|
|
5
5
|
* Values are automatically generated by the system and cannot be edited
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Avatar field widget - provides an avatar/profile picture uploader
|
|
5
|
-
*
|
|
4
|
+
* Avatar field widget - provides an avatar/profile picture uploader.
|
|
5
|
+
*
|
|
6
|
+
* `avatar` is a member of the file-reference family, so its stored value is
|
|
7
|
+
* the bare `sys_file` id, exactly as for `file` and `image` (see
|
|
8
|
+
* `file-value`'s "Submitting"). A pick uploads through the ambient
|
|
9
|
+
* `UploadProvider` (`useUpload()`), and the id the adapter surfaced in
|
|
10
|
+
* `meta.fileId` is what `onChange` receives, through `fileValueForSubmit` —
|
|
11
|
+
* the one submit rule the file and image widgets use. A pick whose adapter
|
|
12
|
+
* surfaced no id (the object-URL default `useUpload()` falls back to when no
|
|
13
|
+
* provider is mounted, an S3/Azure-style adapter that mints no `sys_file`
|
|
14
|
+
* row) is refused with the same translated "did not complete" row, and the
|
|
15
|
+
* field is not changed. ⛔ The widget used to read the pick into a `data:` URL
|
|
16
|
+
* and store that string, inlining the whole image into the record row as a
|
|
17
|
+
* value the stored contract refuses (objectui#10785).
|
|
18
|
+
*
|
|
19
|
+
* Reading is `readFileValue`'s: a bare id renders from the storage endpoint,
|
|
20
|
+
* and a legacy `data:` or http(s) URL already on a record still renders as
|
|
21
|
+
* itself — ADR-0104's dual-read window is a read rule.
|
|
6
22
|
*/
|
|
7
|
-
export declare function AvatarField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
23
|
+
export declare function AvatarField({ value, onChange, field, readonly, onUploadingChange, error, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* BooleanField - Toggle input supporting switch and checkbox variants
|
|
5
5
|
* Renders as Switch or Checkbox based on field widget configuration
|
|
6
6
|
*/
|
|
7
|
-
export declare function BooleanField({ value, onChange, field, readonly, ...props }: FieldWidgetComponentProps<boolean>): React.JSX.Element;
|
|
7
|
+
export declare function BooleanField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<boolean>): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Parse the stored value into the selected capability-name list. The canonical
|
|
5
5
|
* storage is a JSON-string array; we also tolerate an already-parsed array (in
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* CheckboxesField - select zero or more values from a fixed option set, rendered
|
|
5
5
|
* as a list of checkboxes. The stored value is a string[]. Used for the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Code field widget - provides a code editor with syntax highlighting
|
|
5
5
|
* Uses a simple textarea with monospace font
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
export declare function CurrencyField({ value, onChange, field, readonly, error, className, ...props }: FieldWidgetComponentProps<number>): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* DateField - Date picker input widget
|
|
5
5
|
* Uses native date input and displays locale-formatted date in readonly mode
|
|
6
6
|
*/
|
|
7
|
-
export declare function DateField({ value, onChange, field, readonly, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
7
|
+
export declare function DateField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* DateTimeField - Combined date and time picker widget
|
|
5
5
|
* Displays both date and time in locale format when readonly
|
|
6
6
|
*/
|
|
7
|
-
export declare function DateTimeField({ value, onChange, field, readonly, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
7
|
+
export declare function DateTimeField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<string>): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* EmailField - Email address input with mailto link in readonly mode
|
|
5
5
|
* Renders as a clickable mailto link when readonly, standard email input otherwise
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* FileField - File upload widget with drag-and-drop support
|
|
5
5
|
* Supports single and multiple file uploads with configurable accepted file types.
|
|
@@ -15,7 +15,7 @@ export declare function FileField({ value, onChange, field, readonly, onUploadin
|
|
|
15
15
|
* drag-and-drop zone — a grid cell has no room for one; the per-row expand
|
|
16
16
|
* form still offers the full-size FileField.
|
|
17
17
|
*/
|
|
18
|
-
export declare function FileCell({ value, onChange, disabled, multiple, accept, maxSize, 'aria-label': ariaLabel, 'data-cell': dataCell, }: {
|
|
18
|
+
export declare function FileCell({ value, onChange, disabled, multiple, accept, maxSize, error, 'aria-label': ariaLabel, 'data-cell': dataCell, }: {
|
|
19
19
|
value: any;
|
|
20
20
|
onChange: (value: any) => void;
|
|
21
21
|
disabled?: boolean;
|
|
@@ -24,6 +24,22 @@ export declare function FileCell({ value, onChange, disabled, multiple, accept,
|
|
|
24
24
|
accept?: string;
|
|
25
25
|
/** Max file size in bytes (oversize picks are rejected with an inline error). */
|
|
26
26
|
maxSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The active validation message for this cell, named as
|
|
29
|
+
* `@objectstack/spec/ui`'s `FieldWidgetPropsSchema` names it — the same
|
|
30
|
+
* published slot `FieldWidgetComponentProps` declares and `LookupField` /
|
|
31
|
+
* `FileField` above already consume (objectui#5431, completing #3318's
|
|
32
|
+
* per-cell delivery). NOT the per-pick upload `errors` this component
|
|
33
|
+
* computes itself — this is the HOST's verdict on the cell's value.
|
|
34
|
+
*
|
|
35
|
+
* **Producer**: `GridField`, for a required-but-empty `file` cell.
|
|
36
|
+
* **Consumer**: drives `aria-invalid` on the picker button — the focusable
|
|
37
|
+
* control assistive tech reads a control state from (objectui#5223; a mark
|
|
38
|
+
* on the non-focusable wrapper is exactly what the registry sweep forbids).
|
|
39
|
+
* The message TEXT stays with the cell's `title` in `GridField`; rendering
|
|
40
|
+
* it here would double-display it.
|
|
41
|
+
*/
|
|
42
|
+
error?: string;
|
|
27
43
|
'aria-label'?: string;
|
|
28
44
|
/** Focus-grid coordinate (see GridField keyboard navigation). */
|
|
29
45
|
'data-cell'?: string;
|
|
@@ -1,22 +1,63 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
interface BuilderCondition {
|
|
4
4
|
id: string;
|
|
5
5
|
field: string;
|
|
6
6
|
operator: string;
|
|
7
7
|
value: any;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Opt-in FilterBuilder operators this widget offers (objectui#4736).
|
|
11
|
+
*
|
|
12
|
+
* The shared dropdown withholds these because two of its three consumers
|
|
13
|
+
* persist into dialects that cannot carry them (see `OPT_IN_OPERATORS` in
|
|
14
|
+
* `@object-ui/components`'s `filter-builder.tsx`). THIS widget can: its value
|
|
15
|
+
* is a MongoDB-style `FieldOperatorsSchema` criteria that the server's engine
|
|
16
|
+
* evaluates directly — never lowered through the array/triplet AST and never
|
|
17
|
+
* folded into a `ViewFilterRule` — so the spec's `FILTER_OPERATORS` is the only
|
|
18
|
+
* vocabulary it has to satisfy.
|
|
19
|
+
*
|
|
20
|
+
* - `exists` / `notExists` author `$exists`, which `condToMongo` has emitted
|
|
21
|
+
* and `kvToCondition` has read back since objectui#2942. Naming them here
|
|
22
|
+
* is what KEEPS them reachable now that the shared dropdown no longer
|
|
23
|
+
* offers them to the list and view surfaces, whose dialects have no
|
|
24
|
+
* existence operator at all (objectui#4736). They are NOT folded onto
|
|
25
|
+
* `is_not_null` / `is_null` (objectui#9559 ruling B, objectui#9306): on the
|
|
26
|
+
* key-presence drivers that would change which records a stored sharing
|
|
27
|
+
* rule matches.
|
|
28
|
+
*
|
|
29
|
+
* The case-insensitive contains used to be named here too, as
|
|
30
|
+
* `containsCaseInsensitive`. Since objectui#9306 it is the protocol's own
|
|
31
|
+
* `icontains` and an ordinary operator every consumer is offered, so there is
|
|
32
|
+
* nothing to opt into; it still authors `$icontains`, exactly as before.
|
|
33
|
+
*
|
|
34
|
+
* Module scope, not an inline literal: a fresh array each render would reset
|
|
35
|
+
* `FilterBuilder`'s memo inputs on every keystroke.
|
|
36
|
+
*
|
|
37
|
+
* @internal exported for tests
|
|
38
|
+
*/
|
|
39
|
+
export declare const FILTER_CONDITION_EXTRA_OPERATORS: readonly string[];
|
|
9
40
|
/**
|
|
10
41
|
* Builder condition → `$`-operator criteria. Exported for tests: this is the
|
|
11
42
|
* chokepoint where a builder token becomes a spec `FieldOperatorsSchema` key,
|
|
12
43
|
* and a wrong spelling here is rejected downstream by `convertFiltersToAST`
|
|
13
44
|
* rather than at authoring time. @internal
|
|
45
|
+
*
|
|
46
|
+
* ⚠️ The arms are keyed on the builder's PROTOCOL ids (objectui#9306), and the
|
|
47
|
+
* `default` arm stores an EQUALITY. So an operator id with no arm here is not
|
|
48
|
+
* refused — it silently becomes `{ [field]: value }`, which for a
|
|
49
|
+
* `greater_than_or_equal` row would share a different set of records than the
|
|
50
|
+
* one on screen. Every id the dropdown can draw has its own arm, and
|
|
51
|
+
* `filter-builder-protocol-ids-census-9306.test.ts` (app-shell) pins each one's
|
|
52
|
+
* stored predicate, so a missing arm is a red test rather than a quiet `$eq`.
|
|
14
53
|
*/
|
|
15
54
|
export declare function condToMongo(c: BuilderCondition, typeOf: (f: string) => string | undefined): Record<string, any> | null;
|
|
16
55
|
/**
|
|
17
56
|
* Criteria → builder condition (the reverse of {@link condToMongo}). Returning
|
|
18
57
|
* `null` makes the builder refuse to load the rule ("criteria can't be
|
|
19
58
|
* represented"), so this must keep accepting spellings previously written.
|
|
59
|
+
* The rows it produces carry the builder's protocol ids (objectui#9306); the
|
|
60
|
+
* stored criteria are `$`-tokens, which that change did not touch.
|
|
20
61
|
* @internal
|
|
21
62
|
*/
|
|
22
63
|
export declare function kvToCondition(field: string, v: any, idx: number): BuilderCondition | null;
|
|
@@ -24,7 +65,7 @@ export declare function kvToCondition(field: string, v: any, idx: number): Build
|
|
|
24
65
|
* Would this criteria select EVERY record of the object?
|
|
25
66
|
*
|
|
26
67
|
* Mirrors the server's `isMatchAllCriteria` (objectstack `plugin-sharing`,
|
|
27
|
-
* #3896) closely enough to warn before the round-trip: blank, `{}`, `[]`, and
|
|
68
|
+
* objectstack-ai/objectstack#3896) closely enough to warn before the round-trip: blank, `{}`, `[]`, and
|
|
28
69
|
* the vacuous combinators. Deliberately conservative in the same direction —
|
|
29
70
|
* the cost of a false positive is one extra hint, the cost of a false negative
|
|
30
71
|
* is a save that fails with a toast. The server stays authoritative.
|
|
@@ -36,8 +36,15 @@ import { FullscreenEditorProps } from '@object-ui/components';
|
|
|
36
36
|
* primitive already answers it (no affordance at all).
|
|
37
37
|
*
|
|
38
38
|
* Everything else — `value` / `onCommit` / `label` / `testIdPrefix` /
|
|
39
|
-
* `disabled` / `children` / `footer` — passes straight through, so the
|
|
40
|
-
* their pins are unchanged. `
|
|
39
|
+
* `disabled` / `error` / `children` / `footer` — passes straight through, so the
|
|
40
|
+
* hosts and their pins are unchanged. `error` is REQUIRED by the primitive
|
|
41
|
+
* (objectui#4824) and stays required here: both hosts already destructure it off
|
|
42
|
+
* the widget props contract (objectui#3222), and it is what the primitive turns
|
|
43
|
+
* into the dialog control's `aria-invalid` / `aria-errormessage` and into the
|
|
44
|
+
* dialog-local message node. A host that omits it gets a dialog announcing
|
|
45
|
+
* `aria-invalid="false"` for an invalid field, which is the defect #4824
|
|
46
|
+
* measured — so the type system asks for it rather than trusting the next
|
|
47
|
+
* author to remember. `testIdPrefix` still namespaces this package's ids
|
|
41
48
|
* (`textarea-`, `richtext-`), distinct from the built-in branch's
|
|
42
49
|
* `form-textarea-`, so a test can still say which render path it found.
|
|
43
50
|
*/
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Geolocation data structure
|
|
5
5
|
*/
|
|
6
6
|
export interface GeolocationValue {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* `number | null` since objectui#6848. `null` is what an emptied box emits —
|
|
9
|
+
* the spelling `CurrencyField` / `PercentField` / `NumberField` already used
|
|
10
|
+
* for the same user action — so the type has to admit it. `undefined` stays
|
|
11
|
+
* admissible because an untouched coordinate is genuinely absent.
|
|
12
|
+
*/
|
|
13
|
+
latitude?: number | null;
|
|
14
|
+
longitude?: number | null;
|
|
15
|
+
accuracy?: number | null;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Geolocation field widget - provides a location picker with coordinates
|
|
@@ -1,99 +1,110 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
|
+
import { InlineGridColumn } from '@objectstack/spec/data';
|
|
3
4
|
/**
|
|
4
5
|
* GridField / LineItemsField — editable child-grid ("line items") widget.
|
|
5
6
|
*
|
|
7
|
+
* ## Where the host's label and help text land, and why (objectui#4857)
|
|
8
|
+
*
|
|
9
|
+
* This widget forwarded nothing a host handed it, so the field's visible label
|
|
10
|
+
* pointed `for` at an id no element carried and the help text had zero
|
|
11
|
+
* consumers. Measured on `origin/main` at `e71c854ce`, a real form, editable
|
|
12
|
+
* state, `description` set:
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* bare (no columns) for=DANGLING hostIdEl=NONE consumers=0 focusables=[button]
|
|
16
|
+
* columns + one row for=DANGLING hostIdEl=NONE consumers=0 focusables=[drag,
|
|
17
|
+
* input(Item), input(Qty), button(Duplicate row),
|
|
18
|
+
* button(Remove row), input(Item), input(Qty), button(Add)]
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The bare row's single focusable is the auxiliary "Add line" BUTTON — labelable,
|
|
22
|
+
* but routing the host id (and so the label's `for`) onto it would make the
|
|
23
|
+
* field's label NAME the add-row action and make a click on the label insert a
|
|
24
|
+
* row. Every realistic config is a composite: many cell inputs, each with its
|
|
25
|
+
* own `aria-label`, under one container. So this widget declares
|
|
26
|
+
* `labelling: 'group'` (see `FIELD_WIDGET_LABELLING` in `../index`) — the
|
|
27
|
+
* objectui#3961 composite shape, like `address` — and the CONTAINER consumes the
|
|
28
|
+
* host's keys:
|
|
29
|
+
*
|
|
30
|
+
* - editable / list mode: the root div takes the DOM pass-through minus `name`
|
|
31
|
+
* (DOM-legal on form controls only — the objectui#3291 leak) and minus
|
|
32
|
+
* `aria-invalid` (control-channel state; this grid reports validity per CELL,
|
|
33
|
+
* with its own inline marks), answering `role="group"` only when a host
|
|
34
|
+
* actually named it — `CheckboxesField`'s split, key for key.
|
|
35
|
+
*
|
|
36
|
+
* That strip STANDS (objectui#3318 upheld it rather than overturning it):
|
|
37
|
+
* the container is not a control, so the host's state is not re-routed onto
|
|
38
|
+
* it. What #3318 added is the other half the strip implied but nobody had
|
|
39
|
+
* built — the host's failure now DRIVES the per-cell channel this comment
|
|
40
|
+
* already claimed as the reporting path. See `hostFailedEmpty`.
|
|
41
|
+
* - readonly: the table replaces the inputs entirely, so that surface takes the
|
|
42
|
+
* name AND the description via `toHostGroupProps` — `'instead-of-the-inputs'`.
|
|
43
|
+
*
|
|
6
44
|
* A controlled component: `value` is an array of row objects, `onChange`
|
|
7
45
|
* receives the next array. It renders one editable cell per configured
|
|
8
46
|
* column, supports add / delete row, and shows a running total of a numeric
|
|
9
47
|
* column. This is the renderer for the `field:grid` widget and the cell
|
|
10
48
|
* engine behind the master-detail subform (see ADR-0001).
|
|
11
49
|
*
|
|
12
|
-
* Column config
|
|
13
|
-
*
|
|
14
|
-
* type ∈ 'text' | 'number' | 'currency' | 'date' | 'datetime' | 'time'
|
|
15
|
-
* | 'select' | 'lookup' | 'file'
|
|
50
|
+
* Column config: `@objectstack/spec`'s inline grid column, by reference —
|
|
51
|
+
* see {@link GridColumn}.
|
|
16
52
|
*
|
|
17
|
-
* Field-level config
|
|
18
|
-
*
|
|
53
|
+
* Field-level config: the keys `GridFieldMetadata` (`@object-ui/types`)
|
|
54
|
+
* declares, each read under that one spelling (objectui#11070 round 8), and
|
|
55
|
+
* no other key: `sort_field`, the last key read before any face declared it,
|
|
56
|
+
* is declared there too (objectui#11070 round 9).
|
|
19
57
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/** Decimal places to round a computed numeric/currency result to. */
|
|
71
|
-
scale?: number;
|
|
72
|
-
/** For `type: 'lookup'` — when a record is picked, copy its fields into any
|
|
73
|
-
* sibling columns of the same name (e.g. a product's unit_price/description).
|
|
74
|
-
* On by default for lookup columns; set `false` to disable the auto-fill. */
|
|
75
|
-
autofill?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* CEL predicate: when TRUE for this row, the cell is **read-only** (B2 field
|
|
78
|
-
* rules, generalized to grid cells). Evaluated per row against the row as
|
|
79
|
-
* `record` plus the header as `parent` (so a line locks when
|
|
80
|
-
* `parent.status == 'paid'` *or* on an intra-row condition like
|
|
81
|
-
* `record.kind == 'auto'`). Client-side UX; fails open (stays editable).
|
|
82
|
-
*/
|
|
83
|
-
readonlyWhen?: string | {
|
|
84
|
-
dialect?: string;
|
|
85
|
-
source: string;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* CEL predicate: when TRUE for this row, the cell is **required** (flagged
|
|
89
|
-
* inline-invalid while empty). Same `record` + `parent` scope as
|
|
90
|
-
* {@link readonlyWhen}.
|
|
91
|
-
*/
|
|
92
|
-
requiredWhen?: string | {
|
|
93
|
-
dialect?: string;
|
|
94
|
-
source: string;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
58
|
+
/**
|
|
59
|
+
* One grid column — `@objectstack/spec`'s inline grid column
|
|
60
|
+
* (`InlineGridColumn`, the element of `FieldSchema.inlineColumns`), BY
|
|
61
|
+
* REFERENCE (objectui#11070). The spec declares that shape as the strict
|
|
62
|
+
* mirror of this widget's column, so the widget's type IS the spec's: one
|
|
63
|
+
* declaration, the same one `GridFieldMetadata.columns` and
|
|
64
|
+
* `FormField.columns` (`@object-ui/types`) carry. This widget reads each
|
|
65
|
+
* column by exactly the spec's keys — every key below is one the spec
|
|
66
|
+
* declares, and there is no second spelling of any of them.
|
|
67
|
+
*
|
|
68
|
+
* How the widget reads the keys (the spec's own descriptions say what each
|
|
69
|
+
* MEANS; these are the renderer's notes):
|
|
70
|
+
*
|
|
71
|
+
* - `name` — the key a column reads and writes on each row object. There is
|
|
72
|
+
* deliberately no tolerant alias bridging the spelling objectui#3951
|
|
73
|
+
* retired to this one: a single spelling, enforced at the producer —
|
|
74
|
+
* AGENTS.md #0.1 (the spec refuses the retired spelling by name).
|
|
75
|
+
* (Wording note: do not restate that rule as an alternation expression over
|
|
76
|
+
* the two key names. `column-identity.ratchet.test.ts` (objectui#3104) scans
|
|
77
|
+
* these files line by line and cannot tell prose from code, so spelling the
|
|
78
|
+
* shape out here registers as a new dual read and fails the gate.)
|
|
79
|
+
* - `type` — the cell control and its read/write adapter. `date` /
|
|
80
|
+
* `datetime` / `time` are three DISTINCT controls, not one
|
|
81
|
+
* (objectui#3569): `<input type="date">` hands back a bare `YYYY-MM-DD` on
|
|
82
|
+
* change, so collapsing `datetime` onto it silently DELETED the time
|
|
83
|
+
* component from the record.
|
|
84
|
+
* - `prefix` — a symbol shown in a `currency` cell IN PLACE OF the resolved
|
|
85
|
+
* currency's own symbol. When absent, the cell shows the symbol of the
|
|
86
|
+
* currency it resolves (objectui#10355); there is no default symbol.
|
|
87
|
+
* - `defaultHidden` — collapsed into the column chooser, not dropped
|
|
88
|
+
* (`deriveColumns` sets it beyond the default-visible budget). Required
|
|
89
|
+
* columns are never default-hidden.
|
|
90
|
+
* - `computed` + `expr` — a read-only column recomputed live from sibling
|
|
91
|
+
* cells by this file's own safe arithmetic evaluator (`+ - * / %`,
|
|
92
|
+
* parentheses, numeric literals, `record.qty` or bare `qty`), and written
|
|
93
|
+
* back into the row so it persists and any running total reflects it.
|
|
94
|
+
* - `scale` — decimal places for a computed `number` result. ⛔ Not read on
|
|
95
|
+
* a `currency` column (objectui#10783): the resolved currency's ISO 4217
|
|
96
|
+
* minor unit decides both the stored and the shown width
|
|
97
|
+
* (`currencyWidth`), and the spec refuses `scale` on a column declaring
|
|
98
|
+
* `type: 'currency'`. A column that takes `currency` from its child field
|
|
99
|
+
* at render time is reported by `hydrateColumns` in
|
|
100
|
+
* `@object-ui/plugin-form` instead of being read in silence.
|
|
101
|
+
* - `autofill` — for a `lookup` column: picking a record copies its fields
|
|
102
|
+
* into sibling columns of the same name. On unless set `false`.
|
|
103
|
+
* - `readonlyWhen` / `requiredWhen` — CEL predicates evaluated per row
|
|
104
|
+
* against the row as `record` plus the header as `parent`. Client-side UX;
|
|
105
|
+
* a predicate that faults fails open.
|
|
106
|
+
*/
|
|
107
|
+
export type GridColumn = InlineGridColumn;
|
|
97
108
|
type Row = Record<string, any>;
|
|
98
109
|
/** Evaluate an arithmetic `expr` against `row`. null when blank/unparseable. */
|
|
99
110
|
export declare function evalArith(expr: string, row: Row): number | null;
|
|
@@ -111,10 +122,15 @@ export declare function evalArith(expr: string, row: Row): number | null;
|
|
|
111
122
|
* it is unit-testable independent of the picker UI.
|
|
112
123
|
*/
|
|
113
124
|
export declare function lookupAutofillPatch(columns: GridColumn[], col: GridColumn, record: any): Row;
|
|
114
|
-
|
|
125
|
+
/**
|
|
126
|
+
* @param tenantCurrency the tenant's default currency (`useLocalization()`),
|
|
127
|
+
* the resolver's last step for a `currency` column — see
|
|
128
|
+
* {@link storedFractionScale}.
|
|
129
|
+
*/
|
|
130
|
+
export declare function computeRow(columns: GridColumn[], row: Row, tenantCurrency?: string): Row;
|
|
115
131
|
/** Sum a numeric column across rows (ignoring blanks/NaN). */
|
|
116
132
|
export declare function sumColumn(rows: Row[], field: string): number;
|
|
117
|
-
export declare function GridField({ value, onChange, field, readonly, disabled, className, onRowExpand, displayMode, onAdd, ...props }: FieldWidgetComponentProps<Row[]> & {
|
|
133
|
+
export declare function GridField({ value, onChange, field, readonly, disabled, className, error, onRowExpand, displayMode, onAdd, ...props }: FieldWidgetComponentProps<Row[]> & {
|
|
118
134
|
/** When provided, each row shows an "expand" button that opens the row in a
|
|
119
135
|
* full form (the host — e.g. MasterDetailForm — renders the drawer/modal and
|
|
120
136
|
* writes the edited values back). Lets a "fat" child be edited in a real form
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* ImageField - Image upload widget with preview thumbnails
|
|
5
5
|
* Supports single and multiple image uploads with drag-and-drop and preview display
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LocationValue } from '@objectstack/spec/data';
|
|
3
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* The stored shape of a `type: 'location'` value — RE-EXPORTED from
|
|
6
|
+
* `@objectstack/spec/data`, never re-declared here (objectui#6272).
|
|
7
|
+
*
|
|
8
|
+
* `LocationValue` is `z.input` of the spec's `LocationValueSchema`
|
|
9
|
+
* (`{ lat, lng, altitude?, accuracy? }`), which is what `valueSchemaFor({ type:
|
|
10
|
+
* 'location' })` validates a stored location against. A second local
|
|
11
|
+
* declaration under the spec's own name is objectstack#4115's failure class and
|
|
12
|
+
* is refused by `scripts/check-spec-symbol-derivation.mjs` — it was refused on
|
|
13
|
+
* the closed PR #6418, which is why this is a bare re-export.
|
|
6
14
|
*/
|
|
7
|
-
export
|
|
15
|
+
export type { LocationValue } from '@objectstack/spec/data';
|
|
16
|
+
/**
|
|
17
|
+
* LocationField - Geographic coordinate input for a `type: 'location'` value.
|
|
18
|
+
*
|
|
19
|
+
* Reads and writes `@objectstack/spec`'s `LocationValue` (`{ lat, lng }`) and
|
|
20
|
+
* displays it as the comma-separated pair a user types. The coordinates are
|
|
21
|
+
* still called latitude and longitude to a human — only the STORED key names
|
|
22
|
+
* are the spec's (objectui#6272), which is why the placeholder names the two
|
|
23
|
+
* coordinates rather than the `lat`/`lng` keys. That is a statement about KEY
|
|
24
|
+
* NAMES, not about language: the placeholder's words are the reader's, from
|
|
25
|
+
* the locale packs (objectui#8149, {@link placeholderPair}).
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ BREAKING (objectui#6272): a record stored in the deprecated
|
|
28
|
+
* `{ latitude, longitude }` spelling — including one this widget itself wrote
|
|
29
|
+
* before the flip — now renders EMPTY here until it is re-saved or fixed at the
|
|
30
|
+
* data layer. It keeps rendering correctly in detail views and on the map,
|
|
31
|
+
* which read the spec spelling first. That cost was presented and accepted as
|
|
32
|
+
* part of the A1 ruling; it is not an oversight to route around with a shim.
|
|
33
|
+
*/
|
|
34
|
+
export declare function LocationField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<LocationValue | null>): React.JSX.Element;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
export interface LookupOption {
|
|
4
4
|
value: string | number;
|
|
5
5
|
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Secondary text: searched by the popover typeahead alongside the label, and
|
|
8
|
+
* rendered as supporting text. For AUTHORED static options this is the
|
|
9
|
+
* declared `SelectOptionMetadata.description` (objectui#6153 — declared
|
|
10
|
+
* there, and on `@objectstack/spec`'s `SelectOptionSchema`, precisely
|
|
11
|
+
* because this widget consumes it); for fetched records `recordToOption`
|
|
12
|
+
* derives it from `descriptionField`.
|
|
13
|
+
*/
|
|
6
14
|
description?: string;
|
|
7
15
|
[key: string]: any;
|
|
8
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* NumberField - Numeric input with optional decimal precision
|
|
5
5
|
* Supports min/max/step constraints and configurable decimal precision
|
|
6
6
|
*/
|
|
7
|
-
export declare function NumberField({ value, onChange, field, readonly, ...props }: FieldWidgetComponentProps<number>): React.JSX.Element;
|
|
7
|
+
export declare function NumberField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<number>): React.JSX.Element;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FieldWidgetComponentProps } from './types';
|
|
2
|
+
import { FieldWidgetComponentProps } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* ObjectField - JSON
|
|
5
|
-
*
|
|
4
|
+
* ObjectField - JSON editor for a structured value.
|
|
5
|
+
*
|
|
6
|
+
* The form face of the free-form JSON types: `object`, `composite`, `record`, and
|
|
7
|
+
* since objectui#11448 `json`, which used to alias the raw-text code editor and
|
|
8
|
+
* so showed a stored object as `[object Object]` and saved an edit as a string.
|
|
9
|
+
* A json value need not be an object — an array, a number, a string, a boolean
|
|
10
|
+
* and `null` are all JSON — and this editor shows and parses each of them as
|
|
11
|
+
* itself: the box holds `JSON.stringify(value, null, 2)` and an edit emits
|
|
12
|
+
* `JSON.parse(text)`.
|
|
6
13
|
*/
|
|
7
14
|
export declare function ObjectField({ value, onChange, field, readonly, error, ...props }: FieldWidgetComponentProps<any>): React.JSX.Element;
|