diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..835cc0c4d4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Contributing + +## Getting started + +*todo* + +## Creating a new package + +- copy `packages/.template` +- replace all `.template` occurrences with your package name +- add your package name to following: + - `tsconfig.json` + - `build/packageList.js` + - `ee/admin-server/Dockerfile` diff --git a/build/api/admin.api.md b/build/api/admin.api.md index 9a7f00a7e9..ac7b08f751 100644 --- a/build/api/admin.api.md +++ b/build/api/admin.api.md @@ -6,28 +6,35 @@ /// -import type { AccessorTreeState } from '@contember/binding'; +import { AccessorErrorsHolder } from '@contember/react-binding-ui'; +import type { AccessorTreeState } from '@contember/react-binding'; +import { AddEntityButtonProps } from '@contember/react-binding-ui'; import { Ancestor } from 'slate'; import { AnchorButtonProps } from '@contember/ui'; import { AnchorHTMLAttributes } from 'react'; -import type { AsyncBatchUpdatesOptions } from '@contember/binding'; +import type { AsyncBatchUpdatesOptions } from '@contember/react-binding'; import { BaseEditor } from 'slate'; import { BaseSyntheticEvent } from 'react'; import { BoxOwnProps } from '@contember/ui'; -import { BoxProps } from '@contember/ui'; import { ButtonProps } from '@contember/ui'; import { ChildrenAnalyzer } from '@contember/react-multipass-rendering'; -import { ColorInputProps } from '@contember/ui'; -import { ComponentProps } from 'react'; +import { ChoiceFieldDictionary } from '@contember/react-choice-field-ui'; import { ComponentType } from 'react'; import { ContemberClientProps } from '@contember/react-client'; -import { ControlProps } from '@contember/ui'; -import { CSSProperties } from 'react'; -import { DataBindingProviderStateComponent } from '@contember/binding'; -import { DataBindingStateComponentProps } from '@contember/binding'; -import { DateInputProps } from '@contember/ui'; -import { DateTimeInputProps } from '@contember/ui'; -import { Default } from '@contember/ui'; +import type { CreateNewEntityButtonProps } from '@contember/react-binding-ui'; +import { DataBindingProviderStateComponent } from '@contember/react-binding'; +import { DataBindingStateComponentProps } from '@contember/react-binding'; +import { DataGridCellsDictionary } from '@contember/react-datagrid-ui'; +import { DataGridColumnHidingPublicProps } from '@contember/react-datagrid-ui'; +import { DataGridContainerProps } from '@contember/react-datagrid-ui'; +import { DataGridContainerPublicProps } from '@contember/react-datagrid-ui'; +import { DataGridDictionary } from '@contember/react-datagrid-ui'; +import { DataGridFullFiltersPublicProps } from '@contember/react-datagrid-ui'; +import { DataGridLayoutControlPublicProps } from '@contember/react-datagrid-ui'; +import { DataGridProps } from '@contember/react-datagrid-ui'; +import { DataGridRenderingCommonProps } from '@contember/react-datagrid-ui'; +import { DataGridTableRowPublicProps } from '@contember/react-datagrid-ui'; +import { DataGridTilesPublicProps } from '@contember/react-datagrid-ui'; import { Descendant } from 'slate'; import type { DetailedHTMLProps } from 'react'; import { Dispatch } from 'react'; @@ -39,117 +46,94 @@ import { EditorInterface } from 'slate'; import { EditorToolbarProps } from '@contember/ui'; import { Transforms as EditorTransforms } from 'slate'; import { Element as Element_2 } from 'slate'; -import { ElementType } from 'react'; -import { EmailInputProps } from '@contember/ui'; -import { EntityAccessor } from '@contember/binding'; -import { EntityId } from '@contember/binding'; -import { EntityListAccessor } from '@contember/binding'; -import { EntityListBaseProps } from '@contember/binding'; -import { EntityListSubTreeAdditionalProps } from '@contember/binding'; -import { EntityName } from '@contember/binding'; -import { EntitySubTreeAdditionalCreationProps } from '@contember/binding'; -import { EntitySubTreeAdditionalProps } from '@contember/binding'; -import { Environment } from '@contember/binding'; -import type { ErrorAccessor } from '@contember/binding'; -import { ErrorListProps } from '@contember/ui'; +import { EmptyMessageOuterProps } from '@contember/react-binding-ui'; +import { EntityAccessor } from '@contember/react-binding'; +import { EntityId } from '@contember/react-binding'; +import { EntityListAccessor } from '@contember/react-binding'; +import { EntityListBaseProps } from '@contember/react-binding'; +import { EntityListSubTreeAdditionalProps } from '@contember/react-binding'; +import { EntitySubTreeAdditionalCreationProps } from '@contember/react-binding'; +import { EntitySubTreeAdditionalProps } from '@contember/react-binding'; +import { Environment } from '@contember/react-binding'; +import { ErrorCodeDictionary } from '@contember/react-binding-ui'; import { FC } from 'react'; -import { FieldAccessor } from '@contember/binding'; -import { FieldBasicProps } from '@contember/binding'; +import { FieldAccessor } from '@contember/react-binding'; +import { FieldBasicProps } from '@contember/react-binding'; import { FieldContainerOwnProps } from '@contember/ui'; import { FieldContainerProps } from '@contember/ui'; -import { FieldErrors } from '@contember/ui'; -import { FieldValue } from '@contember/binding'; +import { FieldValue } from '@contember/react-binding'; +import { FieldValueFormatter } from '@contember/react-form-fields-ui'; +import { FieldViewDictionary } from '@contember/react-binding-ui'; import type { FileUploader } from '@contember/client'; import type { FileUploadError } from '@contember/client'; -import { Filter } from '@contember/binding'; import type { FocusEvent as FocusEvent_2 } from 'react'; import { FunctionComponent } from 'react'; -import { default as Fuse_2 } from 'fuse.js'; import type { GraphQlClient } from '@contember/client'; import { GraphQlClientRequestOptions } from '@contember/react-client'; import { GraphQlClientVariables } from '@contember/react-client'; import { GraphQlClientVariables as GraphQlClientVariables_2 } from '@contember/client'; import { HistoryEditor } from 'slate-history'; -import { HTMLAnchorElementProps } from '@contember/ui'; -import { HTMLImageElementProps } from '@contember/ui'; -import { HTMLVideoElementProps } from '@contember/ui'; -import { IconProps } from '@contember/ui'; import { IconSourceSpecification } from '@contember/ui'; import { InputHTMLAttributes } from 'react'; -import { JsonObject } from '@contember/binding'; +import { JsonObject } from '@contember/react-binding'; import { JsonValue } from '@contember/binding'; -import { Justification } from '@contember/ui'; +import { JsonValue as JsonValue_2 } from '@contember/react-binding'; import type { KeyboardEvent as KeyboardEvent_2 } from 'react'; +import { LabelMiddleware } from '@contember/react-binding'; import { LayoutPageProps } from '@contember/ui'; import { Location as Location_2 } from 'slate'; -import { MapContainerProps } from 'react-leaflet'; -import { MarkerProps } from 'react-leaflet'; +import { MessageDictionaryByLocaleCode } from '@contember/react-i18n'; +import type { MessageFormatter } from '@contember/react-i18n'; import { MouseEvent as MouseEvent_2 } from 'react'; -import type { NamedExoticComponent } from 'react'; import { Node as Node_2 } from 'slate'; import { NodeEntry } from 'slate'; -import type { NonOptionalControlProps } from '@contember/ui'; -import { OptionallyVariableFieldValue } from '@contember/binding'; -import { OrderBy } from '@contember/binding'; +import type { OptionallyVariableFieldValue } from '@contember/react-binding'; import { Path } from 'slate'; import { PathRef } from 'slate'; -import { PersistOptions } from '@contember/binding'; -import type { PersistSuccessOptions } from '@contember/binding'; +import { PersistFeedbackDictionary } from '@contember/react-binding-ui'; +import type { PersistSuccessOptions } from '@contember/react-binding'; import { Point } from 'slate'; -import type { Props } from 'react-select'; import { PropsWithChildren } from 'react'; import { ProvidersProps } from '@contember/ui'; -import { PublicCommonReactSelectStylesProps } from '@contember/ui'; import { PureComponent } from 'react'; -import { QualifiedEntityList } from '@contember/binding'; -import type { RadioProps } from '@contember/ui'; import { Range as Range_2 } from 'slate'; -import { ReactChild } from 'react'; import { ReactEditor } from 'slate-react'; import { ReactElement } from 'react'; import { ReactNode } from 'react'; import { Ref } from 'react'; import { RefObject } from 'react'; -import { RelativeSingleField } from '@contember/binding'; -import { RemovalType } from '@contember/binding'; +import { RelativeSingleField } from '@contember/react-binding'; +import { RemovalType } from '@contember/react-binding'; import { RenderElementProps } from 'slate-react'; import { RenderLeafProps } from 'slate-react'; import { RepeaterItemContainerProps } from '@contember/ui'; import type { S3FileUploader } from '@contember/client'; import { SaveButtonProps } from '@contember/ui'; -import type { Scalar } from '@contember/binding'; -import { Schema } from '@contember/binding'; +import type { Scalar } from '@contember/react-binding'; import { Scheme } from '@contember/ui'; -import { SearchInputProps } from '@contember/ui'; +import { SelectEntityButtonProps } from '@contember/react-binding-ui'; import { Selection as Selection_2 } from 'slate'; -import { Serializable } from '@contember/react-utils'; import { SetStateAction } from 'react'; +import { SimpleRelativeSingleFieldProps } from '@contember/react-form-fields-ui'; import { Size } from '@contember/ui'; import * as Slate from 'slate'; import { SortableContainerProps } from 'react-sortable-hoc'; import { SortableElementProps } from 'react-sortable-hoc'; -import { StaticRenderProvider } from '@contember/binding'; -import { SuccessfulPersistResult } from '@contember/binding'; -import { SugarableRelativeSingleField } from '@contember/binding'; -import { SugaredFieldProps } from '@contember/binding'; -import type { SugaredFilter } from '@contember/binding'; -import type { SugaredOrderBy } from '@contember/binding'; -import { SugaredQualifiedEntityList } from '@contember/binding'; -import { SugaredQualifiedFieldList } from '@contember/binding'; -import { SugaredQualifiedSingleEntity } from '@contember/binding'; -import { SugaredRelativeEntityList } from '@contember/binding'; -import { SugaredRelativeSingleEntity } from '@contember/binding'; -import { SugaredRelativeSingleField } from '@contember/binding'; -import { SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'; +import { StaticRenderProvider } from '@contember/react-binding'; +import { SugarableRelativeSingleField } from '@contember/react-binding'; +import { SugaredFieldProps } from '@contember/react-binding'; +import { SugaredQualifiedEntityList } from '@contember/react-binding'; +import { SugaredQualifiedFieldList } from '@contember/react-binding'; +import { SugaredQualifiedSingleEntity } from '@contember/react-binding'; +import { SugaredRelativeEntityList } from '@contember/react-binding'; +import { SugaredRelativeSingleEntity } from '@contember/react-binding'; +import { SugaredRelativeSingleField } from '@contember/react-binding'; +import { SugaredUnconstrainedQualifiedSingleEntity } from '@contember/react-binding'; import { SyntheticEvent } from 'react'; import { TableProps } from '@contember/ui'; import { TableRowProps } from '@contember/ui'; import { Text as Text_2 } from 'slate'; -import { TextareaInputProps } from '@contember/ui'; -import { TileLayerProps } from 'react-leaflet'; -import { TimeInputProps } from '@contember/ui'; -import { UnsugarableSingleEntityEventListeners } from '@contember/binding'; -import { UrlInputProps } from '@contember/ui'; +import { UnsugarableSingleEntityEventListeners } from '@contember/react-binding'; import { VisuallyDependentControlProps } from '@contember/ui'; // @public (undocumented) @@ -195,42 +179,6 @@ export const acceptImageFile: ({ file }: AcceptFileOptions) => boolean; // @public (undocumented) export const acceptVideoFile: ({ file }: AcceptFileOptions) => boolean; -// @public (undocumented) -export interface AccessorErrorMessage { - // (undocumented) - message: string; -} - -// @public (undocumented) -export type AccessorErrorMessages = [AccessorErrorMessage, ...AccessorErrorMessage[]]; - -// @public (undocumented) -export function AccessorErrors({ accessor, ...errorListProps }: AccessorErrorsProps): ReactElement | null; - -// @public (undocumented) -export interface AccessorErrorsHolder { - // (undocumented) - readonly errors: ErrorAccessor | undefined; -} - -// @public (undocumented) -export interface AccessorErrorsProps extends Omit { - // (undocumented) - accessor: FieldAccessor | EntityAccessor | EntityListAccessor; -} - -// @public (undocumented) -export interface AddEntityButtonProps { - // (undocumented) - addButtonComponent?: ComponentType; - // (undocumented) - addButtonComponentExtraProps?: {}; - // (undocumented) - addButtonProps?: CreateNewEntityButtonProps; - // (undocumented) - addButtonText?: ReactNode; -} - // @internal (undocumented) export const AddNewBlockButton: React.NamedExoticComponent; @@ -390,69 +338,6 @@ export const AudioUploadField: = PublicSingleKindUploadFieldProps & AudioFileDataExtractorProps; -// @public (undocumented) -export const AutoCell: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoCellProps = { - schema: Schema; - entityName: string; - fieldName: string; - createEntityLink?: (entity: string) => RoutingLinkTarget; -}; - -// @public (undocumented) -export const AutoField: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoFieldProps = { - schema: Schema; - entityName: string; - fieldName: string; - createEditLink?: (entity: string) => RoutingLinkTarget; - excludedEntities?: string[]; -}; - -// @public (undocumented) -export const AutoFields: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoFieldsProps = { - createEditLink?: (entity: string) => RoutingLinkTarget; - excludedFields?: string[]; - excludedEntities?: string[]; -}; - -// @public (undocumented) -export const AutoForm: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoFormProps = { - entity: string; - id?: EntityId; - onCreateSuccess?: EntityAccessor.PersistSuccessHandler | Set; - createEditLink?: (entity: string) => RoutingLinkTarget; -}; - -// @public (undocumented) -export const AutoGrid: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoGridProps = DataGridContainerPublicProps & { - entities: DataGridProps['entities']; - createViewLinkTarget?: (entity: string) => RoutingLinkTarget; - createEditLinkTarget?: (entity: string) => RoutingLinkTarget; -}; - -// @public (undocumented) -export const AutoLabel: React.NamedExoticComponent; - -// @public (undocumented) -export type AutoLabelProps = { - field: string; - createLink?: (entity: string) => RoutingLinkTarget; -}; - // @public (undocumented) export const Avatar: FunctionComponent; @@ -466,19 +351,6 @@ export interface AvatarProps { size?: 1 | 2 | 3 | 4 | 5; } -// @public (undocumented) -export type BaseDynamicChoiceField = BaseDynamicChoiceFieldOptions & SelectFuseOptionsProps & { - searchByFields?: ChoiceFieldSearchByFields; - createNewForm?: ReactElement; - lazy?: LazyChoiceFieldSettings; - renderedOptionsLimit?: number; - transformOptions?: (data: ChoiceFieldData.Options, input: string | undefined) => ChoiceFieldData.Options; - sortableBy?: SugaredFieldProps['field']; -}; - -// @public (undocumented) -export type BaseDynamicChoiceFieldOptions = DynamicChoiceFieldOptionProps | DynamicChoiceFieldWithCustomLabelProps | LegacyChoiceFieldWithOptionRenderer; - // @public export const Block: FunctionComponent; @@ -598,33 +470,6 @@ export type BlockRepeaterProps = { // @public (undocumented) export const boldToolbarButton: ToolbarButtonSpec; -// @public -export const BooleanCell: FunctionComponent; - -// @public (undocumented) -export type BooleanCellProps = DataGridColumnPublicProps & BooleanFieldViewProps & { - disableOrder?: boolean; - initialOrder?: DataGridOrderDirection; - initialFilter?: BooleanFilterArtifacts; -}; - -// @public (undocumented) -export const BooleanFieldView: FunctionComponent; - -// @public (undocumented) -export type BooleanFieldViewProps = { - field: SugaredFieldProps['field']; - booleanStyle?: 'yesNo' | 'checkCross' | 'oneZero'; - format?: (date: boolean) => ReactNode; -} & FieldFallbackViewPublicProps; - -// @public (undocumented) -export type BooleanFilterArtifacts = { - includeTrue: boolean; - includeFalse: boolean; - includeNull: boolean; -}; - // @public (undocumented) export type BuiltinEditorPlugins = BuiltinElementBased | BuiltinTextBased; @@ -640,105 +485,6 @@ export const ChangePassword: FC<{}>; // @public (undocumented) export type ChangePasswordErrors = 'TOO_WEAK' | 'NOT_A_PERSON' | 'INVALID_PASSWORD'; -// @public (undocumented) -export const CheckboxField: React.NamedExoticComponent; - -// @public (undocumented) -export type CheckboxFieldProps = SimpleRelativeSingleFieldProps & ControlProps; - -// @public (undocumented) -export const ChoiceField: FunctionComponent; - -// @public (undocumented) -export namespace ChoiceFieldData { - // (undocumented) - export interface BaseChoiceMetadata { - // (undocumented) - data: Options; - // (undocumented) - errors: FieldErrors | undefined; - // (undocumented) - isLoading?: boolean; - // (undocumented) - onAddNew?: () => void; - // (undocumented) - onSearch?: (input: string) => void; - } - // (undocumented) - export interface MultiChoiceFieldProps { - // (undocumented) - children: (metadata: MultipleChoiceFieldMetadata) => ReactElement | null; - } - // (undocumented) - export interface MultipleChoiceFieldMetadata extends BaseChoiceMetadata { - // (undocumented) - currentValues: SingleOption[]; - // (undocumented) - onAdd: (option: SingleOption) => void; - // (undocumented) - onClear: () => void; - // (undocumented) - onMove?: (oldIndex: number, newIndex: number) => void; - // (undocumented) - onRemove: (option: SingleOption) => void; - } - // (undocumented) - export type Options = SingleOption[]; - // (undocumented) - export interface SingleChoiceFieldMetadata extends BaseChoiceMetadata { - // (undocumented) - currentValue: SingleOption | null; - // (undocumented) - onClear: () => void; - // (undocumented) - onSelect: (newValue: SingleOption) => void; - } - // (undocumented) - export interface SingleChoiceFieldProps { - // (undocumented) - children: (metadata: SingleChoiceFieldMetadata) => ReactElement | null; - } - // (undocumented) - export interface SingleOption { - // (undocumented) - description?: ReactNode; - // (undocumented) - key: string; - // (undocumented) - label: ReactNode; - // (undocumented) - searchKeywords: string; - // (undocumented) - value: Value; - } -} - -// @public (undocumented) -export type ChoiceFieldDictionary = typeof choiceFieldDictionary; - -// @public (undocumented) -export const choiceFieldDictionary: { - choiceField: { - createNew: { - confirmButtonText: string; - cancelButtonText: string; - dialogTitle: string; - }; - }; -}; - -// @public (undocumented) -export type ChoiceFieldOptionsAsEntityList = string | (SugaredQualifiedEntityList['entities'] & ForbidKeys) | (SugaredQualifiedEntityList & ForbidKeys); - -// @public (undocumented) -export type ChoiceFieldOptionsAsFieldList = string | (SugaredQualifiedFieldList['fields'] & ForbidKeys) | (SugaredQualifiedFieldList & ForbidKeys); - -// @public (undocumented) -export type ChoiceFieldProps = (ChoiceFieldData.SingleChoiceFieldProps & StaticSingleChoiceFieldProps) | (ChoiceFieldData.SingleChoiceFieldProps & DynamicSingleChoiceFieldProps); - -// @public (undocumented) -export type ChoiceFieldSearchByFields = SugaredRelativeSingleField['field'] | SugaredRelativeSingleField['field'][]; - // @public export const ClearFieldButton: React.NamedExoticComponent; @@ -762,40 +508,9 @@ export type ClearFieldButtonInnerPublicProps = ButtonProps; // @public (undocumented) export type ClearFieldButtonProps = SimpleRelativeSingleFieldProps & ClearFieldButtonInnerPublicProps; -// @public (undocumented) -export const CoalesceFieldView: (props: CoalesceFieldViewProps) => ReactElement; - -// @public (undocumented) -export interface CoalesceFieldViewProps extends FieldFallbackViewPublicProps { - // (undocumented) - fields: (SugarableRelativeSingleField | string)[]; - // (undocumented) - format?: (value: Persisted) => ReactNode; -} - -// @public -export const CoalesceTextCell: FC; - -// @public (undocumented) -export type CoalesceTextCellProps = DataGridColumnPublicProps & FieldFallbackViewPublicProps & CoalesceFieldViewProps & { - initialFilter?: CoalesceTextFilterArtifacts; -}; - -// @public (undocumented) -export type CoalesceTextFilterArtifacts = { - mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch'; - query: string; -}; - // @public (undocumented) export const codeToolbarButton: ToolbarButtonSpec; -// @public (undocumented) -export const ColorField: React.NamedExoticComponent; - -// @public (undocumented) -export type ColorFieldProps = SimpleRelativeSingleFieldProps & Omit; - // @public (undocumented) export type CommonFileKindProps = PublicFileKind & FileUrlDataExtractorProps & GenericFileMetadataExtractorProps & { additionalExtractors?: FileDataExtractor[]; @@ -892,25 +607,6 @@ export interface ContentOutletProps { placeholder?: string; } -// @public -export const ControlledDataGrid: (props: ControlledDataGridProps) => ReactElement; - -// @public (undocumented) -export type ControlledDataGridProps = DataGridContainerPublicProps & { - state: DataGridState; - stateMethods: DataGridStateMethods; - dataGridKey?: string; - entities: SugaredQualifiedEntityList['entities']; - children: ReactNode; - itemsPerPage?: number | null; -} & ({} | { - component: ComponentType; - componentProps: ComponentExtraProps; -}); - -// @public (undocumented) -export type ControlValueParser = (value: ControlVal | null | undefined, field: FieldAccessor) => FieldVal | null; - // @public (undocumented) export const CreateApiKeyForm: FC; @@ -983,15 +679,6 @@ export const createEmptyTableRowElement: (columnCount?: number) => { // @public (undocumented) export const createMarkHtmlDeserializer: (markType: string, tagMatcher: (el: HTMLElement) => boolean, attributeMatcher: (el: HTMLElement) => boolean) => HtmlDeserializerPlugin; -// @public (undocumented) -export const CreateNewEntityButton: React.MemoExoticComponent<({ createNewEntity, iconProps, children, ...buttonProps }: CreateNewEntityButtonProps) => JSX.Element>; - -// @public (undocumented) -export type CreateNewEntityButtonProps = ButtonProps & { - createNewEntity: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; - iconProps?: IconProps; -}; - // @public (undocumented) export const CreatePage: PageComponent<({ pageName, children, rendererProps, redirectOnSuccess, onPersistSuccess, ...entityProps }: CreatePageProps) => JSX.Element>; @@ -1083,390 +770,40 @@ export interface CustomFieldBackedElement { element: ReactNode; } -// @public (undocumented) -export interface CustomMarkPlugin { - // (undocumented) - isHotKey: (e: KeyboardEvent) => boolean; - // (undocumented) - render: FunctionComponent; - // (undocumented) - type: string; -} - -// @public (undocumented) -export const cycleOrderDirection: (direction: DataGridOrderDirection) => DataGridOrderDirection; - -// @public (undocumented) -export const DATA_GRID_DEFAULT_ITEMS_PER_PAGE = 50; - -// @public -export const DataGrid: (props: DataGridProps) => ReactElement; - -// @public (undocumented) -export interface DataGridCellPublicProps { - // (undocumented) - canBeHidden?: boolean; - // (undocumented) - hidden?: boolean; - // (undocumented) - justification?: Justification; - // (undocumented) - shrunk?: boolean; -} - -// @public (undocumented) -export type DataGridCellsDictionary = typeof dataGridCellsDictionary; - -// @public (undocumented) -export const dataGridCellsDictionary: { - dataGridCells: { - includeNull: string; - booleanCell: { - includeTrue: string; - includeFalse: string; - includeNull: string; - }; - dateCell: { - fromLabel: string; - toLabel: string; - }; - textCell: { - matches: string; - doesNotMatch: string; - matchesExactly: string; - startsWith: string; - endsWith: string; - queryPlaceholder: string; - includeNull: string; - excludeNull: string; - }; - numberCell: { - equals: string; - greaterThan: string; - lessThan: string; - }; - }; -}; - -// @public -export const DataGridColumn: (props: DataGridColumnProps) => ReactElement; - -// @public (undocumented) -export type DataGridColumnFiltering = { - enableFiltering: false; -} | { - enableFiltering?: true; - initialFilter?: FA; - getNewFilter: GetNewFilter; - emptyFilter: FA; - filterRenderer: ComponentType>; -}; - -// @public (undocumented) -export type DataGridColumnKey = string; - -// @public (undocumented) -export type DataGridColumnOrdering = { - enableOrdering: false; -} | { - enableOrdering?: true; - initialOrder?: DataGridOrderDirection; - getNewOrderBy: GetNewOrderBy; -}; - -// @public (undocumented) -export type DataGridColumnProps = DataGridColumnPublicProps & DataGridColumnFiltering & DataGridColumnOrdering; - -// @public (undocumented) -export type DataGridColumnPublicProps = DataGridHeaderCellPublicProps & DataGridCellPublicProps & { - columnKey?: string; - children?: ReactNode; -}; - -// @public (undocumented) -export type DataGridColumns = Map; - -// @public (undocumented) -export const DataGridContainer: FunctionComponent; - -// @public (undocumented) -export interface DataGridContainerOwnProps extends DataGridContainerPublicProps { - // (undocumented) - desiredState: DataGridState; - // (undocumented) - displayedState: DataGridState; - // (undocumented) - entityName: EntityName; - // (undocumented) - filter: Filter; - // (undocumented) - setFilter: DataGridSetColumnFilter; - // (undocumented) - setIsColumnHidden: DataGridSetIsColumnHidden; - // (undocumented) - setLayout: SetDataGridView; - // (undocumented) - setOrderBy: DataGridSetColumnOrderBy; - // (undocumented) - updatePaging: (action: GridPagingAction) => void; -} - -// @public (undocumented) -export interface DataGridContainerProps extends DataGridContainerOwnProps, EntityListBaseProps { -} - -// @public (undocumented) -export interface DataGridContainerPublicProps { - // (undocumented) - allowAggregateFilterControls?: boolean; - // (undocumented) - allowColumnVisibilityControls?: boolean; - // (undocumented) - emptyMessage?: ReactNode; - // (undocumented) - emptyMessageComponent?: ComponentType; - // (undocumented) - emptyMessageComponentExtraProps?: {}; - // (undocumented) - onEntityClick?: (entity: EntityAccessor) => void; - // (undocumented) - selectedEntityIds?: EntityId[]; - // (undocumented) - tile?: ReactNode; - // (undocumented) - tileSize?: number; -} - -// @public (undocumented) -export type DataGridDictionary = typeof dataGridDictionary; - -// @public (undocumented) -export const dataGridDictionary: { - dataGrid: { - emptyMessage: { - text: string; - }; - columnFiltering: { - showMenuButton: { - text: string; - }; - heading: string; - emptyMessage: { - text: string; - }; - columnColumn: { - text: string; - }; - filterColumn: { - text: string; - }; - addFilterButton: { - text: string; - }; - }; - columnHiding: { - showMenuButton: { - text: string; - }; - heading: string; - }; - paging: { - first: string; - previous: string; - next: string; - last: string; - status: { - unknownPageTotal: string; - knownPageTotal: string; - itemCount: string; - }; - }; - }; -}; - -// @public (undocumented) -export type DataGridFilterArtifact = Serializable; - -// @public (undocumented) -export type DataGridFilterArtifactStore = Record; - -// @public (undocumented) -export function DataGridHeaderCell({ ascOrderIcon, descOrderIcon, emptyFilterArtifact, environment, filterArtifact, filterRenderer, hasFilter, header, headerJustification, orderState, setFilter, setOrderBy, shrunk, }: DataGridHeaderCellProps): ReactElement; - -// @public (undocumented) -export interface DataGridHeaderCellInternalProps { - // (undocumented) - emptyFilterArtifact: DataGridFilterArtifact; - // (undocumented) - environment: Environment; - // (undocumented) - filterArtifact: DataGridFilterArtifact; - // (undocumented) - filterRenderer: ComponentType> | undefined; - // (undocumented) - hasFilter: boolean; - // (undocumented) - orderState: { - direction: Exclude; - index: number | undefined; - } | undefined; - // (undocumented) - setFilter: DataGridSetFilter; - // (undocumented) - setOrderBy: DataGridSetOrderBy; -} - -// @public (undocumented) -export interface DataGridHeaderCellProps extends DataGridHeaderCellInternalProps, DataGridHeaderCellPublicProps { -} - -// @public (undocumented) -export interface DataGridHeaderCellPublicProps { - // (undocumented) - ascOrderIcon?: ReactNode; - // (undocumented) - descOrderIcon?: ReactNode; - // (undocumented) - header?: ReactNode; - // (undocumented) - headerJustification?: Justification; - // (undocumented) - shrunk?: boolean; -} - -// @public (undocumented) -export type DataGridHiddenColumnsStateStore = Record; - -// @public (undocumented) -export type DataGridLayout = Default | 'tiles'; - -// @public (undocumented) -export type DataGridOrderDirection = 'asc' | 'desc' | null; - -// @public (undocumented) -export type DataGridOrderDirectionStore = Record>; - -// @public (undocumented) -export const DataGridPage: PageComponent<({ children, rendererProps, pageName, ...dataGridProps }: DataGridPageProps) => JSX.Element>; - -// @public (undocumented) -export type DataGridPageProps = DataGridProps<{}> & { - pageName?: string; - children?: ReactNode; - rendererProps?: Omit; -}; - -// @public (undocumented) -export const DataGridPageRenderer: React.NamedExoticComponent; - -// @public (undocumented) -export type DataGridPageRendererProps = LayoutRendererProps & DataGridContainerProps; - -// @public (undocumented) -export type DataGridProps = DataGridContainerPublicProps & { - dataGridKey?: string; - entities: SugaredQualifiedEntityList['entities']; - children: ReactNode; - itemsPerPage?: number | null; -} & ({} | { - component: ComponentType; - componentProps: ComponentExtraProps; -}); - -// @public (undocumented) -export const DataGridScope: ({ stateComponent, stateProps, ...props }: DataGridScopeProps) => JSX.Element; - -// @public (undocumented) -export type DataGridScopeProps = PropsWithChildren> & DataBindingProviderStateComponent; - -// @public (undocumented) -export type DataGridSetColumnFilter = (columnKey: DataGridColumnKey, columnFilter: FA | undefined) => void; - -// @public (undocumented) -export type DataGridSetColumnOrderBy = (columnKey: DataGridColumnKey, columnOrderBy: DataGridOrderDirection, append?: boolean) => void; - -// @public (undocumented) -export type DataGridSetFilter = (filter: FA | undefined) => void; - -// @public (undocumented) -export type DataGridSetIsColumnHidden = (columnKey: DataGridColumnKey, isHidden: boolean) => void; - -// @public (undocumented) -export type DataGridSetOrderBy = (setOrderBy: DataGridOrderDirection, append?: boolean) => void; - -// @public (undocumented) -export interface DataGridState { - columns: DataGridColumns; - entities: QualifiedEntityList; - // (undocumented) - filter: Filter; - // (undocumented) - filterArtifacts: DataGridFilterArtifactStore; - // (undocumented) - hiddenColumns: DataGridHiddenColumnsStateStore; - // (undocumented) - layout: DataGridLayout; - orderBy: OrderBy; - // (undocumented) - orderDirections: DataGridOrderDirectionStore; - paging: GridPagingState; -} - -// @public (undocumented) -export interface DataGridStateMethods { - // (undocumented) - setFilter: DataGridSetColumnFilter; - // (undocumented) - setIsColumnHidden: DataGridSetIsColumnHidden; +// @public (undocumented) +export interface CustomMarkPlugin { // (undocumented) - setLayout: SetDataGridView; + isHotKey: (e: KeyboardEvent) => boolean; // (undocumented) - setOrderBy: DataGridSetColumnOrderBy; + render: FunctionComponent; // (undocumented) - updatePaging: DispatchChangePage; + type: string; } -// @public -export const DateCell: FunctionComponent; - -// @public (undocumented) -export type DateCellProps = DataGridColumnPublicProps & DateFieldViewProps & { - disableOrder?: boolean; - initialOrder?: DataGridOrderDirection; - initialFilter?: DateRange; -}; - -// @public (undocumented) -export const DateField: React.NamedExoticComponent; - // @public (undocumented) -export type DateFieldProps = SimpleRelativeSingleFieldProps & DateInputProps; +export const DataGridPage: PageComponent<({ children, rendererProps, pageName, ...dataGridProps }: DataGridPageProps) => JSX.Element>; // @public (undocumented) -export const DateFieldView: FunctionComponent; +export type DataGridPageProps = DataGridProps & { + pageName?: string; + children?: ReactNode; + rendererProps?: Omit; +}; // @public (undocumented) -export type DateFieldViewProps = { - field: SugaredFieldProps['field']; -} & ({ - format?: ((date: Date) => ReactNode) | Intl.DateTimeFormatOptions; - locale?: never; -} | { - format?: Intl.DateTimeFormatOptions; - locale: string | string[]; -}) & FieldFallbackViewPublicProps; +export const DataGridPageRenderer: React.NamedExoticComponent | undefined; +} & DataGridTableRowPublicProps & EntityListBaseProps & DataGridTilesPublicProps & DataGridRenderingCommonProps>; // @public (undocumented) -export type DateRange = { - start: string | null; - end: string | null; -}; +export type DataGridPageRendererProps = LayoutRendererProps & DataGridContainerProps; // @public (undocumented) -export const DateTimeField: React.NamedExoticComponent; +export const DataGridScope: ({ stateComponent, stateProps, ...props }: DataGridScopeProps) => JSX.Element; // @public (undocumented) -export type DateTimeFieldProps = SimpleRelativeSingleFieldProps & DateTimeInputProps; +export type DataGridScopeProps = PropsWithChildren> & DataBindingProviderStateComponent; // @public (undocumented) export const DefaultElement: FunctionComponent; @@ -1475,15 +812,6 @@ export const DefaultElement: FunctionComponent; export interface DefaultElementProps extends RenderElementProps { } -// @public -export const DeleteEntityButton: React.MemoExoticComponent<(props: DeleteEntityButtonProps) => JSX.Element | null>; - -// @public (undocumented) -export type DeleteEntityButtonProps = { - immediatePersist?: true; - children?: ReactNode; -} & ButtonProps; - // @public (undocumented) export const DerivedFieldLink: FunctionComponent; @@ -1605,9 +933,6 @@ export type DiscriminatedFileKindsProps = SelectFi baseEntity?: string; }; -// @public (undocumented) -export type DispatchChangePage = (action: GridPagingAction) => void; - // @public (undocumented) export const DisplayTextField: React.NamedExoticComponent; @@ -1619,35 +944,9 @@ export type DisplayTextFieldProps = Omit JSX.Element; -// @public (undocumented) -export type DynamicChoiceFieldOptionProps = { - options: ChoiceFieldOptionsAsFieldList; -}; - -// @public (undocumented) -export type DynamicChoiceFieldWithCustomLabelProps = { - options: ChoiceFieldOptionsAsEntityList; - optionLabel: ReactNode; -}; - -// @public (undocumented) -export const DynamicMultiChoiceField: FunctionComponent>; - -// @public (undocumented) -export type DynamicMultipleChoiceFieldProps = SugaredRelativeEntityList & BaseDynamicChoiceField & ({} | DynamicMultipleChoiceWithConnectingEntityFieldProps); - -// @public (undocumented) -export interface DynamicMultipleChoiceWithConnectingEntityFieldProps { - // (undocumented) - connectingEntityField: string | SugaredRelativeSingleEntity; -} - // @public (undocumented) export type DynamicRequestParameters = RequestParameters; -// @public (undocumented) -export type DynamicSingleChoiceFieldProps = SugaredRelativeSingleEntity & BaseDynamicChoiceField; - // @public (undocumented) export const EditIdentity: FC; @@ -1853,12 +1152,6 @@ export interface ElementWithReference extends Element_2 { referenceId: EntityId; } -// @public (undocumented) -export const EmailField: React.NamedExoticComponent; - -// @public (undocumented) -export type EmailFieldProps = SimpleRelativeSingleFieldProps & Omit; - // @public (undocumented) export interface EmbedHandler { // (undocumented) @@ -1884,57 +1177,6 @@ export const EmbedHandlers: { Spotify: typeof SpotifyEmbedHandler; }; -// @public (undocumented) -export const EmptyMessage: React.MemoExoticComponent<({ children, component, padding, ...rest }: EmptyMessageProps) => JSX.Element>; - -// @public (undocumented) -export type EmptyMessageComponentProps = BoxProps & { - children: ReactNode; -}; - -// @public (undocumented) -export interface EmptyMessageOuterProps { - // (undocumented) - emptyMessage?: ReactNode; - // (undocumented) - emptyMessageComponent?: ComponentType; -} - -// @public (undocumented) -export type EmptyMessageProps> = ComponentProps & ComponentProps & { - children: ReactNode; - component?: C; -}; - -// @public -export const EnumCell: React.NamedExoticComponent; - -// @public (undocumented) -export type EnumCellArtifacts = { - values: string[]; - nullCondition: boolean; -}; - -// @public (undocumented) -export type EnumCellProps = DataGridColumnPublicProps & FieldFallbackViewPublicProps & NullConditionFilterPublicProps & { - field: SugaredFieldProps['field']; - options: Record; - format?: (value: string | null) => ReactNode; - initialFilter?: EnumCellArtifacts; -}; - -// @public (undocumented) -export type ErrorCodeDictionary = typeof errorCodeDictionary; - -// @public (undocumented) -export const errorCodeDictionary: { - errorCodes: { - fieldRequired: string; - notUnique: string; - unknownExecutionError: string; - }; -}; - // @public (undocumented) export function FeedbackRenderer({ accessorTreeState, children }: FeedbackRendererProps): JSX.Element | null; @@ -1949,46 +1191,6 @@ export interface FeedbackRendererProps { // @public (undocumented) export type FieldBackedElement = RichTextFieldBackedElement | PlainTextFieldBackedElement | CustomFieldBackedElement; -// @public (undocumented) -export const FieldFallbackView: FunctionComponent; - -// @public (undocumented) -export interface FieldFallbackViewProps { - // (undocumented) - fallback: ReactNode | undefined; - // (undocumented) - fallbackStyle: FieldFallbackViewStyle | undefined; -} - -// @public (undocumented) -export type FieldFallbackViewPublicProps = Partial; - -// @public (undocumented) -export type FieldFallbackViewStyle = 'n/a' | 'nothing' | 'unknown'; - -// @public (undocumented) -export type FieldValueFormatter = (value: FieldVal | null | undefined, field: FieldAccessor) => ControlVal | null; - -// @public (undocumented) -export type FieldValueRenderer = (value: FV | null | undefined, fieldAccessor: FieldAccessor) => ReactElement; - -// @public (undocumented) -export type FieldViewDictionary = typeof fieldViewDictionary; - -// @public (undocumented) -export const fieldViewDictionary: { - fieldView: { - boolean: { - yes: string; - no: string; - }; - fallback: { - unknown: string; - notAvailable: string; - }; - }; -}; - // @public (undocumented) export interface FileDataExtractor { // (undocumented) @@ -2112,14 +1314,6 @@ export interface FileUrlDataExtractorProps { urlField: SugaredFieldProps['field']; } -// @public (undocumented) -export const FileUrlFieldView: FunctionComponent; - -// @public (undocumented) -export type FileUrlFieldViewProps = { - fileUrlField: SugaredFieldProps['field']; -} & HTMLAnchorElementProps; - // @public (undocumented) export const FillResetPasswordTokenForm: FC; @@ -2129,27 +1323,6 @@ export interface FillResetPasswordTokenFormProps { resetLink: RoutingLinkTarget; } -// @public (undocumented) -export interface FilterRendererProps { - // (undocumented) - environment: Environment; - // (undocumented) - filter: FA; - // (undocumented) - setFilter: DataGridSetFilter; -} - -// @public (undocumented) -export const FloatField: React.NamedExoticComponent; - -// @public (undocumented) -export type FloatFieldProps = SimpleRelativeSingleFieldProps & ControlProps; - -// @public (undocumented) -export type ForbidKeys = { - [K in Exclude]?: never; -}; - // @public (undocumented) export type FormErrors = { [K in keyof V]?: string; @@ -2184,12 +1357,6 @@ export type FullFileKind = In extractors: FileDataExtractor[]; }; -// @public -export const GenericCell: FunctionComponent; - -// @public (undocumented) -export type GenericCellProps = DataGridColumnPublicProps; - // @public (undocumented) export interface GenericFileMetadataExtractorProps { // (undocumented) @@ -2227,12 +1394,6 @@ export type GenericToolbarButton = CommonToolbarButton & { // @public (undocumented) export const getAudioFileDataExtractor: (props: AudioFileDataExtractorProps) => FileDataExtractor; -// @public (undocumented) -export const getColumnFilter: (column: DataGridColumnProps, artifact: DataGridFilterArtifact | undefined, environment: Environment) => Filter | undefined; - -// @public (undocumented) -export const getColumnOrderBy: (columns: DataGridColumns, key: DataGridColumnKey, direction: DataGridOrderDirection, environment: Environment) => OrderBy | undefined; - // @public (undocumented) export const getDiscriminatedBlock: (blocks: NormalizedBlocks, field: FieldAccessor | FieldValue) => ResolvedDiscriminatedDatum | undefined; @@ -2248,24 +1409,6 @@ export const getGenericFileMetadataExtractor: (props: GenericFileMetadataExtract // @public (undocumented) export const getImageFileDataExtractor: (props: ImageFileDataExtractorProps) => FileDataExtractor; -// @public (undocumented) -export type GetNewFilter = (filterArtifact: FA, options: GetNewFilterOptions) => SugaredFilter | undefined; - -// @public (undocumented) -export interface GetNewFilterOptions { - // (undocumented) - environment: Environment; -} - -// @public (undocumented) -export type GetNewOrderBy = (newDirection: DataGridOrderDirection, options: GetNewOrderByOptions) => SugaredOrderBy | undefined; - -// @public (undocumented) -export interface GetNewOrderByOptions { - // (undocumented) - environment: Environment; -} - // @public (undocumented) export const getStockAnyFileKind: ({ additionalExtractors, acceptMimeTypes, acceptFile, baseEntity, children, fileSizeField, fileTypeField, lastModifiedField, fileNameField, renderFilePreview, renderUploadedFile, uploader, urlField, childrenOutsideBaseEntity, }: StockAnyFileKindProps) => FullFileKind; @@ -2290,7 +1433,7 @@ export const getVideoFileDataExtractor: (props: VideoFileDataExtractorProps) => // @public (undocumented) export namespace GQLVariable { const // (undocumented) - Json: GQLVariableType, false>; + Json: GQLVariableType, false>; const // (undocumented) String: GQLVariableType; const // (undocumented) @@ -2318,52 +1461,9 @@ export type GQLVariableValues>]?: VariableMap[K] extends GQLVariableType ? Value : never; }; -// @public (undocumented) -export type GridPagingAction = { - type: 'goToPage'; - newPageIndex: number; -} | { - type: 'setItemsPerPage'; - newItemsPerPage: number | null; -} | { - type: 'goToNextPage' | 'goToPreviousPage' | 'goToFirstPage'; -}; - -// @public (undocumented) -export type GridPagingState = { - pageIndex: number; - itemsPerPage: number | null; -}; - // @public (undocumented) export type HandleIdpResponseError = SignInIDPErrors | 'INVALID_LOCAL_STATE'; -// @public -export const HasManyAbsentCell: FunctionComponent; - -// @public (undocumented) -export type HasManyAbsentCellProps = DataGridColumnPublicProps & FieldFallbackViewPublicProps & SugaredRelativeEntityList & { - render: ComponentType; - children: ReactNode; -}; - -// @public -export const HasManySelectCell: FunctionComponent; - -// @public (undocumented) -export type HasManySelectProps = DataGridColumnPublicProps & SugaredRelativeEntityList & BaseDynamicChoiceField & FieldFallbackViewPublicProps & SugaredRelativeSingleEntity & { - renderElements?: (elements: ReactNode[]) => ReactElement; - initialFilter?: SelectCellArtifacts; -}; - -// @public -export const HasOneSelectCell: FunctionComponent; - -// @public (undocumented) -export type HasOneSelectProps = DataGridColumnPublicProps & BaseDynamicChoiceField & FieldFallbackViewPublicProps & SugaredRelativeSingleEntity & { - initialFilter?: SelectCellArtifacts; -}; - // @public (undocumented) export const HasRole: React.NamedExoticComponent; @@ -2443,14 +1543,6 @@ export const headingTwoNumberedToolbarButton: ElementToolbarButton; -// @public -export const HiddenField: React.NamedExoticComponent; - -// @public (undocumented) -export type HiddenFieldProps = FieldBasicProps & { - label?: ReactNode; -}; - // @public (undocumented) export const highlightToolbarButton: ToolbarButtonSpec; @@ -2562,23 +1654,6 @@ export interface HtmlDeserializerPlugin { // @public (undocumented) export type HybridFileKindProps = DiscriminatedFileKindsProps | SingleKindFileProps; -// @public (undocumented) -export class I18nError extends Error { -} - -// @public (undocumented) -export function I18nProvider({ localeCode, dictionaries, children }: I18nProviderProps): JSX.Element; - -// @public (undocumented) -export interface I18nProviderProps { - // (undocumented) - children: ReactNode; - // (undocumented) - dictionaries: MessageDictionaryByLocaleCode | undefined; - // (undocumented) - localeCode: string | undefined; -} - // @public (undocumented) export interface Identity { // @deprecated (undocumented) @@ -2704,17 +1779,6 @@ export type IDPResponseState = { error: HandleIdpResponseError; }; -// @public (undocumented) -export const ImageFieldView: (props: ImageFieldViewProps) => ReactElement; - -// @public (undocumented) -export type ImageFieldViewProps = { - srcField: SugaredFieldProps['field']; - altField?: SugaredFieldProps['field']; - titleField?: SugaredFieldProps['field']; - formatUrl?: (srcFieldValue: SrcField) => string; -} & FieldFallbackViewPublicProps & Omit; - // @public (undocumented) export interface ImageFileDataExtractorProps { // (undocumented) @@ -2964,18 +2028,6 @@ export type LabeledProps = { children?: string | null | undefined; }; -// @public (undocumented) -export type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode; - -// @public (undocumented) -export const LabelMiddlewareContext: React.Context; - -// @public (undocumented) -export const LabelMiddlewareProvider: ({ value, children }: { - value: LabelMiddleware; - children: ReactChild; -}) => JSX.Element; - // @public (undocumented) export const LayoutRenderer: FunctionComponent; @@ -2983,27 +2035,9 @@ export const LayoutRenderer: FunctionComponent; export interface LayoutRendererProps extends LayoutPageProps { } -// @public (undocumented) -export type LazyChoiceFieldSettings = undefined | boolean | { - limit?: number; - initialLimit?: number; - createFilter?: (input: string) => Filter; - inputDebounceDelay?: number; -}; - // @public (undocumented) export type LazyPageModule = () => Promise; -// @public @deprecated (undocumented) -export interface LegacyChoiceFieldWithOptionRenderer { - // (undocumented) - options: string | SugaredQualifiedEntityList['entities'] | SugaredQualifiedEntityList; - // (undocumented) - optionsStaticRender: ReactElement | ((environment: Environment) => ReactElement); - // (undocumented) - renderOption: (entityAccessor: EntityAccessor) => ReactNode; -} - // @public (undocumented) export const LegacyDeprecatedEditorFormerlyKnownAsRichTextField: FunctionComponent; @@ -3124,27 +2158,6 @@ export interface ListUserQueryResult { memberships: Membership[]; } -// @public (undocumented) -export const LocationField: FunctionComponent; - -// @public (undocumented) -export interface LocationFieldProps extends Omit { - // (undocumented) - latitudeField: SugaredFieldProps['field']; - // (undocumented) - longitudeField: SugaredFieldProps['field']; - // (undocumented) - mapCenter?: [number, number]; - // (undocumented) - mapProps?: MapContainerProps; - // (undocumented) - markerProps?: MarkerProps; - // (undocumented) - tileLayerProps?: Partial; - // (undocumented) - zoom?: number; -} - // @public (undocumented) export const Login: ({ onLogin, resetLink }: LoginProps) => JSX.Element; @@ -3284,79 +2297,24 @@ export interface MeResponse { otpEnabled: boolean; }; projects: Array<{ - project: { - slug: string; - name: string; - }; - memberships: Array<{ - role: string; - variables: Array<{ - name: string; - values: string[]; - }>; - }>; - }>; - permissions: { - canCreateProject: boolean; - }; - }; -} - -// @public (undocumented) -export interface MessageDictionary { - // (undocumented) - [Key: string]: MessageDictionary | string; -} - -// @public (undocumented) -export interface MessageDictionaryByLocaleCode { - // (undocumented) - [localeCode: string]: MessageDictionary; -} - -// @public (undocumented) -export type MessageDictionaryKeys = { - [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys2}` : Key; -}[keyof Dict & string]; - -// @public (undocumented) -export type MessageDictionaryKeys2 = { - [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys3}` : Key; -}[keyof Dict & string]; - -// @public (undocumented) -export type MessageDictionaryKeys3 = { - [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys4}` : Key; -}[keyof Dict & string]; - -// @public (undocumented) -export type MessageDictionaryKeys4 = { - [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys5}` : Key; -}[keyof Dict & string]; - -// @public (undocumented) -export type MessageDictionaryKeys5 = { - [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? string : Key; -}[keyof Dict & string]; - -// @public (undocumented) -export interface MessageFormatter { - // (undocumented) - (key: MessageDictionaryKeys, values?: Record): string; - // (undocumented) - (key: MessageDictionaryKeys, values?: Record): ReactNode; - // (undocumented) - (userSpecifiedKey: string | undefined, fallbackKey: MessageDictionaryKeys, values?: Record): string; - // (undocumented) - (userSpecifiedKey: U, fallbackKey: MessageDictionaryKeys, values?: Record): U | string; + project: { + slug: string; + name: string; + }; + memberships: Array<{ + role: string; + variables: Array<{ + name: string; + values: string[]; + }>; + }>; + }>; + permissions: { + canCreateProject: boolean; + }; + }; } -// @public (undocumented) -export type MessageFormatterFormatJSXChunk = (parts: ReactNode) => ReactNode; - -// @public (undocumented) -export type MessageFormatterPrimitiveType = string | number | boolean | null | undefined | Date; - // @public (undocumented) export const MiscPageLayout: React.NamedExoticComponent; @@ -3387,28 +2345,6 @@ export type MultiEditScopeProps, 'accessor' | 'children'>; }; -// @public (undocumented) -export const MultiSelectField: FunctionComponent; - -// @internal (undocumented) -export const MultiSelectFieldInner: ({ currentValues, data, errors, onAdd, onClear, onRemove, reactSelectProps, placeholder, menuZIndex, onAddNew, onMove, onSearch, isLoading, ...fieldContainerProps }: MultiSelectFieldInnerProps) => JSX.Element; - -// @public (undocumented) -export type MultiSelectFieldInnerProps = ChoiceFieldData.MultipleChoiceFieldMetadata & MultiSelectFieldInnerPublicProps & PublicCommonReactSelectStylesProps & { - errors: FieldErrors | undefined; -}; - -// @public (undocumented) -export interface MultiSelectFieldInnerPublicProps extends Omit { - // (undocumented) - placeholder?: string; - // (undocumented) - reactSelectProps?: Partial>; -} - -// @public (undocumented) -export type MultiSelectFieldProps = MultiSelectFieldInnerPublicProps & DynamicMultipleChoiceFieldProps; - // @public (undocumented) export const MutableEntityListPageRenderer: (props: MutableEntityListPageRendererProps) => ReactElement; @@ -3476,70 +2412,6 @@ export type NormalizedDiscriminatedData = Map; -// @public (undocumented) -export interface NormalizedStaticOption extends StaticOption { - // (undocumented) - searchKeywords: string; - // (undocumented) - value: FieldValue; -} - -// @public (undocumented) -export const NotFoundWrapper: React.NamedExoticComponent<{ - children: ReactNode; - title?: ReactNode; -}>; - -// @public (undocumented) -export type NullConditionArtifacts = { - nullCondition: boolean; -}; - -// @public (undocumented) -export const NullConditionFilter: ({ filter, setFilter, field, environment, showNullConditionFilter }: NullConditionFilterProps) => JSX.Element | null; - -// @public (undocumented) -export type NullConditionFilterProps = FilterRendererProps & NullConditionFilterPublicProps & { - field: SugaredFieldProps['field']; -}; - -// @public (undocumented) -export type NullConditionFilterPublicProps = { - showNullConditionFilter?: boolean; -}; - -// @public -export const NumberCell: FunctionComponent; - -// @public (undocumented) -export type NumberCellProps = DataGridHeaderCellPublicProps & DataGridCellPublicProps & FieldFallbackViewPublicProps & SugaredRelativeSingleField & NullConditionFilterPublicProps & { - disableOrder?: boolean; - initialOrder?: DataGridOrderDirection; - format?: (value: number) => ReactNode; - initialFilter?: NumberFilterArtifacts; -}; - -// @public (undocumented) -export const NumberField: React.NamedExoticComponent; - -// @public (undocumented) -export type NumberFieldProps = SimpleRelativeSingleFieldProps & ControlProps; - -// @public (undocumented) -export type NumberFilterArtifacts = { - mode: 'eq' | 'gte' | 'lte'; - query: number | null; - nullCondition: boolean; -}; - -// @public (undocumented) -export interface OptionallyVariableStaticOption extends StaticOption { - // (undocumented) - searchKeywords?: string; - // (undocumented) - value: OptionallyVariableFieldValue; -} - // @public (undocumented) export interface OrderedListElement extends Element_2 { // (undocumented) @@ -3614,11 +2486,6 @@ export const PageLink: React.NamedExoticComponent; // @public @deprecated (undocumented) export const PageLinkButton: React.NamedExoticComponent; -// Warning: (ae-forgotten-export) The symbol "PageLinkByIdProps" needs to be exported by the entry point index.d.ts -// -// @public @deprecated (undocumented) -export const PageLinkById: React.NamedExoticComponent; - // @public (undocumented) export interface PageModule { // (undocumented) @@ -3729,34 +2596,6 @@ export const PersistButton: React.MemoExoticComponent; -// @public (undocumented) -export type PersistFeedbackDictionary = typeof persistFeedbackDictionary; - -// @public (undocumented) -export const persistFeedbackDictionary: { - persistFeedback: { - successMessage: string; - afterPersistErrorMessage: string; - errorMessage: string; - }; -}; - -// @public (undocumented) -export interface PersistWithFeedbackOptions extends PersistOptions { - // (undocumented) - afterPersistErrorDuration?: number; - // (undocumented) - afterPersistErrorMessage?: string; - // (undocumented) - errorDuration?: number; - // (undocumented) - errorMessage?: string; - // (undocumented) - successDuration?: number; - // (undocumented) - successMessage?: string; -} - // @public (undocumented) export interface Person { // (undocumented) @@ -3863,8 +2702,6 @@ export type ProjectUserRoles = Set; // @public (undocumented) export type PublicAnchorProps = Omit, 'href'>; -export { PublicCommonReactSelectStylesProps } - // @public (undocumented) export type PublicFileKind = Partial>; @@ -3892,37 +2729,9 @@ export interface QueryRequestObject { // @public (undocumented) export type QueryRequestState = RequestStateOk | RequestStateError | RequestStateLoading; -// @public (undocumented) -export const RadioField: FunctionComponent; - -// @public (undocumented) -export const RadioFieldInner: React.MemoExoticComponent<(props: RadioFieldInnerProps) => JSX.Element>; - -// @public (undocumented) -export interface RadioFieldInnerProps extends ChoiceFieldData.SingleChoiceFieldMetadata, RadioFieldInnerPublicProps { - // (undocumented) - errors: FieldErrors | undefined; -} - -// @public (undocumented) -export interface RadioFieldInnerPublicProps extends Omit, Pick { -} - -// @public (undocumented) -export type RadioFieldProps = RadioFieldInnerPublicProps & (StaticSingleChoiceFieldProps | SimpleDynamicSingleChoiceFieldProps); - // @public (undocumented) export type ReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void; -// @public (undocumented) -export function readEventStream(lines: AsyncIterable): AsyncIterable<{ - data: string; - lastEventId?: string; -}>; - -// @public (undocumented) -export function readLines(reader: ReadableStreamDefaultReader): AsyncIterable; - // @public (undocumented) export type RedirectOnSuccessHandler = (currentState: PageRequest, persistedId: EntityId, entity: EntityAccessor, options: PersistSuccessOptions) => IncompleteRequestState | string | undefined; @@ -3976,15 +2785,6 @@ export const renderAudioFilePreview: ({ objectUrl }: RenderFilePreviewOptions) = // @public (undocumented) export const renderByJoining: SelectedDimensionRenderer; -// @public (undocumented) -export type RenderedSimpleRelativeSingleFieldProxyExtraPropsKeys = 'className' | 'style'; - -// @public (undocumented) -export type RenderedSimpleRelativeSingleFieldProxyFieldContainerPropsKeys = 'required' | 'size' | 'errors'; - -// @public (undocumented) -export type RenderedSugaredRelativeSingleFieldKeys = 'field'; - // @public (undocumented) export interface RenderFilePreviewOptions { // (undocumented) @@ -4450,18 +3250,6 @@ export interface ScrollTargetRendererProps extends Omit; -// @public (undocumented) -export const SearchField: React.NamedExoticComponent; - -// @public (undocumented) -export type SearchFieldProps = SimpleRelativeSingleFieldProps & Omit; - -// @public (undocumented) -export type SelectCellArtifacts = { - id: EntityId[]; - nullCondition: boolean; -}; - // @public (undocumented) export interface SelectedDimension { // (undocumented) @@ -4471,42 +3259,6 @@ export interface SelectedDimension { // @public (undocumented) export type SelectedDimensionRenderer = (dimensionData: StatefulDimensionDatum[]) => ReactNode; -// @public (undocumented) -export interface SelectEntityButtonProps { - // (undocumented) - selectButtonComponent?: ComponentType; - // (undocumented) - selectButtonComponentExtraProps?: {}; - // (undocumented) - selectButtonProps?: CreateNewEntityButtonProps; - // (undocumented) - selectButtonText?: ReactNode; -} - -// @public (undocumented) -export const SelectField: FunctionComponent; - -// @internal (undocumented) -export const SelectFieldInner: React.MemoExoticComponent<({ placeholder, allowNull, currentValue, data, errors, menuZIndex, onSelect, onClear, reactSelectProps, onAddNew, onSearch, isLoading, ...fieldContainerProps }: SelectFieldInnerProps) => JSX.Element>; - -// @public (undocumented) -export type SelectFieldInnerProps = ChoiceFieldData.SingleChoiceFieldMetadata & SelectFieldInnerPublicProps & PublicCommonReactSelectStylesProps & { - errors: FieldErrors | undefined; -}; - -// @public (undocumented) -export interface SelectFieldInnerPublicProps extends Omit { - // (undocumented) - allowNull?: boolean; - // (undocumented) - placeholder?: string; - // (undocumented) - reactSelectProps?: Partial>; -} - -// @public (undocumented) -export type SelectFieldProps = SelectFieldInnerPublicProps & (StaticSingleChoiceFieldProps | DynamicSingleChoiceFieldProps); - // @public (undocumented) export type SelectFileInputPublicProps = SelectEntityButtonProps & { insertSelectedText?: string; @@ -4522,12 +3274,6 @@ export interface SelectFileInputSelectionComponentProps fileSelectionProps?: SFExtraProps; } -// @public (undocumented) -export interface SelectFuseOptionsProps { - // (undocumented) - fuseOptions?: Fuse_2.IFuseOptions> | boolean; -} - // @public (undocumented) export interface SerializableEditorNode { // (undocumented) @@ -4536,9 +3282,6 @@ export interface SerializableEditorNode { formatVersion: number; } -// @public (undocumented) -export type SetDataGridView = (layout: DataGridLayout) => void; - // @public (undocumented) export class SideDimensions extends PureComponent { // (undocumented) @@ -4642,74 +3385,11 @@ export interface SignOutResponseOk { }; } -// @public (undocumented) -export type SimpleDynamicSingleChoiceFieldProps = SugaredRelativeSingleEntity & BaseDynamicChoiceFieldOptions & Pick; - -// @public (undocumented) -export const SimpleRelativeSingleField:

(render: (fieldMetadata: SimpleRelativeSingleFieldMetadata, props: SimpleRelativeSingleFieldProxyExcludeHandledProps

) => ReactNode, displayName: string, defaultProps?: Partial

| undefined) => NamedExoticComponent

; - -// @public (undocumented) -export interface SimpleRelativeSingleFieldMetadata { - // (undocumented) - environment: Environment; - // (undocumented) - field: FieldAccessor; - // (undocumented) - isMutating: boolean; -} - -// @public (undocumented) -export type SimpleRelativeSingleFieldProps = SimpleRelativeSingleFieldProxyProps; - -// @internal (undocumented) -export const SimpleRelativeSingleFieldProxy: React.MemoExoticComponent<({ render, defaultValue, isNonbearing, onBeforeUpdate, onInitialize, onUpdate, description, display, direction, evenly, footer, horizontal, gap, label, labelDescription, labelPosition, reverse, useLabelElement, width, className, componentClassName, style, errors, field: fieldName, required, size, containerClassName, containerStyle, suppressErrors, ...rest }: SimpleRelativeSingleFieldProxyProps & SimpleRelativeSingleFieldProxyRendererProps) => JSX.Element>; - -// @public (undocumented) -export type SimpleRelativeSingleFieldProxyExcludeHandledProps

= Omit | Exclude | Exclude>; - -// @public (undocumented) -export type SimpleRelativeSingleFieldProxyExtraProps = { - className?: string | undefined; - containerClassName?: string | undefined; - containerStyle?: CSSProperties | undefined; - style?: CSSProperties | undefined; - suppressErrors?: boolean | undefined; -}; - -// @public (undocumented) -export type SimpleRelativeSingleFieldProxyFieldContainerProps = Omit; - -// @public (undocumented) -export type SimpleRelativeSingleFieldProxyProps = SimpleRelativeSingleFieldProxyFieldContainerProps & SugaredRelativeSingleField & SimpleRelativeSingleFieldProxyExtraProps; - -// @public (undocumented) -export type SimpleRelativeSingleFieldProxyRendererProps = { - render: (fieldMetadata: SimpleRelativeSingleFieldMetadata, props: SimpleRelativeSingleFieldProxyExcludeHandledProps) => ReactNode; -}; - // @public (undocumented) export type SingleKindFileProps = FullFileKind & SelectFileInputSelectionComponentProps & { hasUploadedFile: (entity: EntityAccessor) => boolean; }; -// @public (undocumented) -export const SlugField: React.NamedExoticComponent; - -// @public (undocumented) -export const SlugFieldInner: React.NamedExoticComponent; - -// @public (undocumented) -export type SlugFieldProps = SimpleRelativeSingleFieldProps & ControlProps & { - derivedFrom: SugaredRelativeSingleField['field']; - unpersistedHardPrefix?: SlugPrefix; - persistedHardPrefix?: SlugPrefix; - persistedSoftPrefix?: SlugPrefix; - linkToExternalUrl?: boolean; -}; - -// @public (undocumented) -export type SlugPrefix = string | ((environment: Environment) => string); - // @internal (undocumented) export const SortableBlock: React.NamedExoticComponent; @@ -4761,22 +3441,6 @@ export interface StatefulDimensionDatum ex isSelected: IsSelected; } -// @public (undocumented) -export interface StaticOption { - // (undocumented) - description?: ReactNode; - // (undocumented) - label: ReactNode; -} - -// @public (undocumented) -export const StaticSingleChoiceField: FunctionComponent>; - -// @public (undocumented) -export type StaticSingleChoiceFieldProps = SugaredRelativeSingleField & SelectFuseOptionsProps & { - options: OptionallyVariableStaticOption[]; -}; - // @public (undocumented) export type StockAnyFileKindProps = CommonFileKindProps; @@ -4901,45 +3565,12 @@ export interface TenantMutationOkResponse { // @public (undocumented) export type TenantMutationResponse = TenantMutationErrorResponse | TenantMutationOkResponse; -// @public @deprecated (undocumented) -export const TextAreaField: React.NamedExoticComponent; - -// @public -export const TextareaField: React.NamedExoticComponent; - -// @public (undocumented) -export type TextareaFieldProps = Omit & ControlProps & TextareaInputProps; - // @public (undocumented) export interface TextAttrs { // (undocumented) [key: string]: any; } -// @public -export const TextCell: FunctionComponent; - -// @public (undocumented) -export type TextCellProps = DataGridColumnPublicProps & FieldFallbackViewPublicProps & SugaredRelativeSingleField & { - disableOrder?: boolean; - initialOrder?: DataGridOrderDirection; - format?: (value: string | null) => ReactNode; - initialFilter?: TextFilterArtifacts; -}; - -// @public -export const TextField: React.NamedExoticComponent; - -// @public (undocumented) -export type TextFieldProps = SimpleRelativeSingleFieldProps & ControlProps; - -// @public (undocumented) -export type TextFilterArtifacts = { - mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch'; - query: string; - nullCondition: boolean; -}; - // @public (undocumented) export type TextSpecifics = Omit; @@ -4954,12 +3585,6 @@ export const TileList: ({ children }: { // @public (undocumented) export type TileProps = BoxOwnProps; -// @public (undocumented) -export const TimeField: React.NamedExoticComponent; - -// @public (undocumented) -export type TimeFieldProps = SimpleRelativeSingleFieldProps & TimeInputProps; - // @public (undocumented) export type ToolbarButtonSpec = ElementToolbarButton | MarkToolbarButton | InitializeReferenceToolbarButton | GenericToolbarButton; @@ -5051,18 +3676,6 @@ export type UploadFieldProps = FileInputPublicProp children?: ReactNode; }; -// @public (undocumented) -export const UrlField: React.NamedExoticComponent; - -// @public (undocumented) -export type UrlFieldProps = SimpleRelativeSingleFieldProps & Omit; - -// @public (undocumented) -export const useAccessorErrorFormatter: () => (errors: ErrorAccessor.Error[]) => AccessorErrorMessage[]; - -// @public (undocumented) -export const useAccessorErrors: (accessor: AccessorErrorsHolder) => AccessorErrorMessages | undefined; - // @public (undocumented) export const useAuthedContentMutation: (query: string) => UseMutationReturn; @@ -5109,13 +3722,6 @@ export const useConfirmOtp: () => TenantMutationExecutor; }>, TenantMutationResponse>; -// @public (undocumented) -export type UseControlProps = ControlProps & { - fieldMetadata: SimpleRelativeSingleFieldMetadata; - parse: ControlValueParser; - format: FieldValueFormatter; -}; - // @public (undocumented) export const useCreateApiKey: () => TenantMutationExecutor; @@ -5152,24 +3758,12 @@ email: GQLVariableType; // @public (undocumented) export const useCurrentRequest: () => RequestState; -// @public (undocumented) -export const useDataGrid: (props: DataGridProps) => ControlledDataGridProps; - -// @public (undocumented) -export const useDataGridState: (props: Pick, 'children' | 'itemsPerPage' | 'entities' | 'dataGridKey' | 'tile'>) => [DataGridState, DataGridStateMethods]; - // @public (undocumented) export const useDisableOtp: () => TenantMutationExecutor, TenantMutationResponse>; // @public (undocumented) export const useDiscriminatedData: (source: Iterable) => NormalizedDiscriminatedData; -// @public (undocumented) -export const useDynamicMultipleChoiceField: (props: DynamicMultipleChoiceFieldProps) => ChoiceFieldData.MultipleChoiceFieldMetadata; - -// @public (undocumented) -export const useDynamicSingleChoiceField: (props: DynamicSingleChoiceFieldProps) => ChoiceFieldData.SingleChoiceFieldMetadata; - // @public (undocumented) export const useEditor: () => Editor; @@ -5181,17 +3775,9 @@ export const useFetchMe: () => () => Promise<{ data: MeResponse; }>; -// @public (undocumented) -export const useFieldControl: ({ fieldMetadata, parse, format, onBlur, ...props }: UseControlProps) => NonOptionalControlProps & { - ref: Ref; -}; - // @public (undocumented) export const useForm: (initialValues: V, handler?: FormHandler | undefined) => FormMethods; -// @public (undocumented) -export const useGridPagingState: (itemsPerPage: number | null, dataGridKey: string) => [GridPagingState, DispatchChangePage]; - // @public (undocumented) export const useHandleIDPResponse: ({ onLogin, onError }: UseHandleIDPResponseProps) => IDPResponseState; @@ -5246,9 +3832,6 @@ method: GQLVariableType; mailVariant: GQLVariableType; }>, TenantMutationResponse>; -// @public (undocumented) -export const useLabelMiddleware: () => (it: ReactNode) => ReactNode; - // @public (undocumented) export const useListMembersQuery: (projectSlug: string, memberType: ListMembersQueryVariables['memberType']) => QueryRequestObject; @@ -5270,9 +3853,6 @@ export const useLogout: () => ({ noRedirect }?: { noRedirect?: boolean | undefined; }) => Promise; -// @public (undocumented) -export const useMessageFormatter: (defaultDictionary: Dict) => MessageFormatter; - // @public (undocumented) export const useMutation: >(client: GraphQlClient, query: string, apiToken?: string, headers?: Record) => UseMutationReturn; @@ -5293,9 +3873,6 @@ export type UseOnPersistSuccessProps = Pick Identity | undefined; -// @public (undocumented) -export const usePersistWithFeedback: ({ successMessage, successDuration, errorMessage, errorDuration, afterPersistErrorMessage, afterPersistErrorDuration, ...persistOptions }?: PersistWithFeedbackOptions) => () => Promise; - // @public (undocumented) export const usePrepareOtp: () => TenantMutationExecutor; @@ -5470,16 +4047,6 @@ export interface VariableSelectorProps { variable: RoleVariableDefinition; } -// @public (undocumented) -export const VideoFieldView: (props: VideoFieldViewProps) => ReactElement; - -// @public (undocumented) -export type VideoFieldViewProps = { - srcField: SugaredFieldProps['field']; - titleField?: SugaredFieldProps['field']; - formatUrl?: (srcFieldValue: SrcField) => string; -} & FieldFallbackViewPublicProps & Omit; - // @public (undocumented) export interface VideoFileDataExtractorProps { // (undocumented) @@ -5624,8 +4191,15 @@ export const withTables: (editor: E) => E; export const withUnderline: (editor: E) => E; -export * from "@contember/binding"; +export * from "@contember/react-auto"; +export * from "@contember/react-binding"; +export * from "@contember/react-binding-ui"; +export * from "@contember/react-choice-field-ui"; export * from "@contember/react-client"; +export * from "@contember/react-datagrid-ui"; +export * from "@contember/react-form-fields-ui"; +export * from "@contember/react-i18n"; +export * from "@contember/react-leaflet-fields-ui"; export * from "@contember/ui"; // Warnings were encountered during analysis: diff --git a/build/api/binding.api.md b/build/api/binding.api.md index feb595aa51..0fbf51cafb 100644 --- a/build/api/binding.api.md +++ b/build/api/binding.api.md @@ -4,7 +4,6 @@ ```ts -import { ComponentType } from 'react'; import type { CrudQueryBuilder } from '@contember/client'; import { EmbeddedActionsParser } from 'chevrotain'; import { v4 as generateUuid } from 'uuid'; @@ -14,71 +13,10 @@ import type { GraphQlClientFailedRequestMetadata } from '@contember/client'; import type { GraphQlClientRequestOptions } from '@contember/client'; import { GraphQlLiteral } from '@contember/client'; import { Input } from '@contember/client'; -import { NamedExoticComponent } from 'react'; -import { PropsWithChildren } from 'react'; -import { ReactElement } from 'react'; -import { ReactNode } from 'react'; import type { Result } from '@contember/client'; import { TokenType } from 'chevrotain'; import type { TreeFilter } from '@contember/client'; -// @public (undocumented) -export function AccessorProvider(props: EntityProviderProps): JSX.Element; - -// @public (undocumented) -export const AccessorTree: { - ({ state, children }: AccessorTreeProps): JSX.Element; - displayName: string; -}; - -// @public (undocumented) -export interface AccessorTreeProps { - // (undocumented) - children: ReactNode; - // (undocumented) - state: AccessorTreeState; -} - -// @public (undocumented) -export type AccessorTreeState = InitializingAccessorTreeState | InitializedAccessorTreeState | ErrorAccessorTreeState; - -// @public (undocumented) -export type AccessorTreeStateAction = { - type: 'setData'; - data: TreeRootAccessor; - binding: DataBinding; -} | { - type: 'failWithError'; - error: RequestError; - binding: DataBinding; -} | { - type: 'reset'; - binding: DataBinding; - environment: Environment; -}; - -// @public (undocumented) -export interface AccessorTreeStateMetadata { - // (undocumented) - initialize: (() => void) | undefined; -} - -// @public (undocumented) -export interface AccessorTreeStateOptions { - // (undocumented) - children?: ReactNode; - // (undocumented) - refreshOnPersist?: boolean; - // (undocumented) - skipStateUpdateAfterPersist?: boolean; -} - -// @public (undocumented) -export const accessorTreeStateReducer: (previousState: AccessorTreeState, action: AccessorTreeStateAction) => AccessorTreeState; - -// @public (undocumented) -export const addEntityAtIndex: (entityList: EntityListAccessor, sortableByField: RelativeSingleField, index: number, preprocess?: EntityAccessor.BatchUpdatesHandler) => void; - // @public (undocumented) export type Alias = string; @@ -143,34 +81,17 @@ export class BindingError extends Error { } // @public (undocumented) -export interface BindingOperations extends AsyncBatchUpdatesOptions { +export interface BindingOperations extends AsyncBatchUpdatesOptions { // (undocumented) batchDeferredUpdates: (performUpdates: (bindingOperations: BatchUpdatesOptions) => void) => void; // (undocumented) - extendTree: ExtendTree; + extendTree: ExtendTree; // (undocumented) getTreeFilters: () => TreeFilter[]; // (undocumented) persist: Persist; } -// @public (undocumented) -export function BindingOperationsProvider(props: BindingOperationsProviderProps): JSX.Element; - -// @public (undocumented) -export interface BindingOperationsProviderProps { - // (undocumented) - bindingOperations: BindingOperations | undefined; - // (undocumented) - children: ReactNode; -} - -// @public (undocumented) -export interface BranchMarkerProvider { - // (undocumented) - generateBranchMarker: (props: Props, fields: EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer, environment: Environment) => HasOneRelationMarker | HasManyRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker; -} - // @public (undocumented) export class ClientGeneratedUuid implements RuntimeIdSpec { constructor(value: string); @@ -183,73 +104,38 @@ export class ClientGeneratedUuid implements RuntimeIdSpec { } // @public (undocumented) -export type CompleteMarkerProvider = EnvironmentDeltaProvider & LeafMarkerProvider & BranchMarkerProvider & StaticRenderProvider; - -// @public (undocumented) -export function Component(statelessRender: EnvironmentAwareFunctionComponent, displayName?: string): NamedExoticComponent; - -// @public (undocumented) -export function Component(statefulRender: EnvironmentAwareFunctionComponent, staticRender: (props: StaticRenderProviderProps, environment: Environment) => ReactElement | null, displayName?: string): NamedExoticComponent; - -// @public (undocumented) -export function Component(statefulRender: EnvironmentAwareFunctionComponent, markerProvisions: MarkerProvider, displayName?: string): NamedExoticComponent; +export class Config { + constructor(config?: Partial); + // (undocumented) + getValue(name: Name): BindingConfig[Name]; + // (undocumented) + setValue(name: Name, value: BindingConfig[Name]): this; +} // @public (undocumented) -export class DataBinding { - // Warning: (ae-forgotten-export) The symbol "TreeStore" needs to be exported by the entry point index.d.ts - constructor(contentApiClient: GraphQlClient, systemApiClient: GraphQlClient, tenantApiClient: GraphQlClient, treeStore: TreeStore, environment: Environment, onUpdate: (newData: TreeRootAccessor, binding: DataBinding) => void, onError: (error: RequestError, binding: DataBinding) => void, onPersistSuccess: (result: SuccessfulPersistResult, binding: DataBinding) => void, options: { +export class DataBinding { + constructor(contentApiClient: GraphQlClient, systemApiClient: GraphQlClient, tenantApiClient: GraphQlClient, treeStore: TreeStore, environment: Environment, createMarkerTree: (node: Node, environment: Environment) => MarkerTreeRoot, batchedUpdates: (callback: () => any) => void, onUpdate: (newData: TreeRootAccessor, binding: DataBinding) => void, onError: (error: RequestError, binding: DataBinding) => void, onPersistSuccess: (result: SuccessfulPersistResult, binding: DataBinding) => void, options: { skipStateUpdateAfterPersist: boolean; }); // (undocumented) - extendTree(newFragment: ReactNode, options?: ExtendTreeOptions): Promise; + extendTree(newFragment: Node, options?: ExtendTreeOptions): Promise; } // @public (undocumented) export const DataBindingExtendAborted: unique symbol; -// @public -export const DataBindingProvider: (props: DataBindingProviderProps) => ReactElement; - -// @public (undocumented) -export type DataBindingProviderBaseProps = AccessorTreeStateOptions; - // @public (undocumented) -export type DataBindingProviderProps = DataBindingProviderBaseProps & DataBindingProviderStateComponent; - -// @public (undocumented) -export type DataBindingProviderStateComponent = ({ - stateComponent?: never; - stateProps?: never; -} | { - stateComponent: ComponentType; - stateProps?: StateProps; -}); - -// @public (undocumented) -export interface DataBindingStateComponentProps { +export class DirtinessTracker { // (undocumented) - accessorTreeState: AccessorTreeState; + getTotalTouchCount(): number; // (undocumented) - children?: ReactNode; -} - -// @public (undocumented) -export const DeferredSubTrees: React.NamedExoticComponent; - -// @public (undocumented) -export interface DeferredSubTreesProps { + hasChanges(): boolean; // (undocumented) - children: ReactNode; + increaseBy(delta: number): void; // (undocumented) - fallback: ReactNode; + reset(): void; } -// @public (undocumented) -export const DirtinessContext: React.Context; - -// @public (undocumented) -export const Entity: React.NamedExoticComponent; - // @public (undocumented) export class EntityAccessor implements Errorable { // Warning: (ae-forgotten-export) The symbol "EntityRealmState" needs to be exported by the entry point index.d.ts @@ -358,14 +244,6 @@ export namespace EntityAccessor { export type UpdateListener = (accessor: EntityAccessor) => void; } -// @public (undocumented) -export interface EntityBaseProps { - // (undocumented) - accessor: EntityAccessor; - // (undocumented) - children?: ReactNode; -} - // @public (undocumented) export interface EntityCreationParameters { // (undocumented) @@ -426,20 +304,6 @@ export class EntityFieldsWithHoistablesMarker { // @public (undocumented) export type EntityId = string | number; -// @public (undocumented) -export function EntityKeyProvider(props: EntityKeyProviderProps): JSX.Element; - -// @public (undocumented) -export interface EntityKeyProviderProps { - // (undocumented) - children: ReactNode; - // (undocumented) - entityKey: string; -} - -// @public (undocumented) -export const EntityList: (props: EntityListProps) => ReactElement; - // @public (undocumented) export class EntityListAccessor implements Errorable { // (undocumented) @@ -539,14 +403,6 @@ export namespace EntityListAccessor { export type UpdateListener = (accessor: EntityListAccessor) => void; } -// @public (undocumented) -export interface EntityListBaseProps { - // (undocumented) - accessor: EntityListAccessor; - // (undocumented) - children?: ReactNode; -} - // @public (undocumented) export interface EntityListEventListeners { // (undocumented) @@ -584,21 +440,6 @@ export interface EntityListPreferences { // @public (undocumented) export const EntityListPreferencesDefaults: EntityListPreferences; -// @public (undocumented) -export type EntityListProps = EntityListBaseProps & ({} | { - listComponent: ComponentType; - listProps?: ListProps; -}); - -// @public -export const EntityListSubTree: (props: EntityListSubTreeProps) => ReactElement; - -// @public (undocumented) -export interface EntityListSubTreeAdditionalProps { - // (undocumented) - variables?: Environment.ValuesMapWithFactory; -} - // @public (undocumented) export class EntityListSubTreeMarker { constructor(parameters: QualifiedEntityList | UnconstrainedQualifiedEntityList, fields: EntityFieldMarkersContainer, environment: Environment); @@ -614,44 +455,12 @@ export class EntityListSubTreeMarker { readonly placeholderName: string; } -// @public (undocumented) -export type EntityListSubTreeProps = { - treeRootId?: TreeRootId; - children?: ReactNode; -} & EntityListSubTreeAdditionalProps & (SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) & ({} | { - listComponent: ComponentType; - listProps?: ListProps; -}); - // @public (undocumented) export type EntityName = string; -// @public (undocumented) -export type EntityProps = EntityBaseProps; - -// @public (undocumented) -export interface EntityProviderProps { - // (undocumented) - accessor: EntityAccessor; - // (undocumented) - children: ReactNode; -} - // @public (undocumented) export type EntityRealmKey = string; -// @public -export const EntitySubTree: (pros: EntitySubTreeProps) => ReactElement; - -// @public (undocumented) -export type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps; - -// @public (undocumented) -export interface EntitySubTreeAdditionalProps { - // (undocumented) - variables?: Environment.ValuesMapWithFactory; -} - // @public (undocumented) export class EntitySubTreeMarker { constructor(parameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity, fields: EntityFieldMarkersContainer, environment: Environment); @@ -667,23 +476,6 @@ export class EntitySubTreeMarker { readonly placeholderName: string; } -// @public (undocumented) -export type EntitySubTreeProps = { - treeRootId?: TreeRootId; - children?: ReactNode; -} & EntitySubTreeAdditionalProps & (SugaredQualifiedSingleEntity | (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)); - -// @public (undocumented) -export function EntityView(props: EntityViewProps): JSX.Element; - -// @public (undocumented) -export interface EntityViewProps { - // (undocumented) - field?: string | SugaredRelativeSingleEntity; - // (undocumented) - render: (entity: EntityAccessor) => ReactNode; -} - // @public (undocumented) export class Environment { // (undocumented) @@ -818,6 +610,11 @@ export namespace Environment { [K in string]?: string | number; }; // (undocumented) + export type ReactElementLike = { + type: any; + props: any; + }; + // (undocumented) export type ResolvedValue = Value; // (undocumented) export interface SelectedDimensions { @@ -849,7 +646,7 @@ export namespace Environment { // (undocumented) export type SubTreeNode = SubTreeEntityNode | SubTreeEntityListNode; // (undocumented) - export type Value = ReactNode | GraphQlLiteral | Filter; + export type Value = string | number | boolean | undefined | GraphQlLiteral | Filter | ReactElementLike; const // (undocumented) createExtension: (create: (state: S | undefined, environment: Environment) => R, otherMethods?: Omit, "create"> | undefined) => Extension; // (undocumented) @@ -859,47 +656,6 @@ export namespace Environment { } } -// @public (undocumented) -export interface EnvironmentAwareFunctionComponent

{ - // (undocumented) - (props: PropsWithChildren

, environment: Environment): ReactElement | null; - // (undocumented) - displayName?: string | undefined; -} - -// @public (undocumented) -export const EnvironmentContext: React.Context; - -// @public (undocumented) -export interface EnvironmentDeltaProvider { - // (undocumented) - generateEnvironment: (props: Props, oldEnvironment: Environment) => Environment; -} - -// @public (undocumented) -export const EnvironmentExtensionProvider: (props: EnvironmentWithExtensionProps) => ReactElement | null; - -// @public (undocumented) -export const EnvironmentMiddleware: React.NamedExoticComponent; - -// @public (undocumented) -export interface EnvironmentMiddlewareProps { - // (undocumented) - children: ReactNode; - // (undocumented) - create: (env: Environment) => Environment; -} - -// @public (undocumented) -export interface EnvironmentWithExtensionProps { - // (undocumented) - children: ReactNode; - // (undocumented) - extension: Environment.Extension; - // (undocumented) - state: S; -} - // @public (undocumented) export interface Errorable { // (undocumented) @@ -949,18 +705,6 @@ export namespace ErrorAccessor { normalizeError: (error: Error | string) => Error; } -// @public (undocumented) -export interface ErrorAccessorTreeState { - // (undocumented) - binding: DataBinding; - // (undocumented) - environment: Environment; - // (undocumented) - error: RequestError; - // (undocumented) - name: 'error'; -} - // @public (undocumented) export type ErrorPathNodeType = FieldPathErrorFragment | IndexPathErrorFragment; @@ -1002,6 +746,48 @@ export class EventListenersStore): void; } +// @public (undocumented) +export class EventManager { + // Warning: (ae-forgotten-export) The symbol "UpdateMetadata" needs to be exported by the entry point index.d.ts + constructor(asyncBatchUpdatesOptions: AsyncBatchUpdatesOptions, batchUpdatesOptions: BatchUpdatesOptions, config: Config, dirtinessTracker: DirtinessTracker, onUpdate: (metadata: UpdateMetadata) => void, treeStore: TreeStore, batchedUpdates: (callback: () => any) => void); + // (undocumented) + asyncOperation(operation: () => Promise): Promise; + // (undocumented) + asyncTransaction(transaction: () => Promise): Promise; + // (undocumented) + getEventDispatchers extends EventListenersStore ? [Keys, Map] : never, EventType extends EventListenerTypes[0]>(state: State, event: { + type: EventType; + key?: string; + }, listenerArgs: Parameters>): Array<() => ReturnType>> | undefined; + // (undocumented) + getEventListeners extends EventListenersStore ? [Keys, Map] : never, EventType extends EventListenerTypes[0]>(state: State, event: { + type: EventType; + key?: string; + }): Set> | undefined; + // (undocumented) + static readonly NO_CHANGES_DIFFERENCE = 0; + // (undocumented) + persistOperation(operation: () => Promise): Promise; + // (undocumented) + registerJustUpdated(justUpdated: StateNode, changesDelta: number): void; + // Warning: (ae-forgotten-export) The symbol "StateNode" needs to be exported by the entry point index.d.ts + // + // (undocumented) + registerNewlyInitialized(newlyInitialized: StateNode): void; + // (undocumented) + registerUpdatedConnection(parentState: EntityRealmState, placeholderName: PlaceholderName): void; + // (undocumented) + syncOperation(operation: () => T): T; + // (undocumented) + syncTransaction(transaction: () => T): T; + // (undocumented) + triggerOnBeforePersist(): Promise; + // (undocumented) + triggerOnPersistError(options: PersistErrorOptions): Promise; + // (undocumented) + triggerOnPersistSuccess(options: PersistSuccessOptions): Promise; +} + // @public (undocumented) export interface ExecutionError { // (undocumented) @@ -1022,7 +808,7 @@ export type ExpectedQualifiedEntityMutation = 'none' | 'anyMutation'; export type ExpectedRelationMutation = 'none' | 'createOrDelete' | 'connectOrDisconnect' | 'anyMutation'; // @public (undocumented) -export type ExtendTree = (newFragment: ReactNode, options?: ExtendTreeOptions) => Promise; +export type ExtendTree = (newFragment: Node, options?: ExtendTreeOptions) => Promise; // @public (undocumented) export interface ExtendTreeOptions { @@ -1032,9 +818,6 @@ export interface ExtendTreeOptions { signal?: AbortSignal; } -// @public (undocumented) -export const Field: (props: FieldProps) => ReactElement; - // @public (undocumented) export class FieldAccessor implements Errorable { // Warning: (ae-forgotten-export) The symbol "FieldState" needs to be exported by the entry point index.d.ts @@ -1118,10 +901,6 @@ export namespace FieldAccessor { } } -// @public (undocumented) -export interface FieldBasicProps extends SugaredRelativeSingleField { -} - // @public (undocumented) export interface FieldEventListeners { // (undocumented) @@ -1160,54 +939,12 @@ export interface FieldPathErrorFragment { field: string; } -// @public (undocumented) -export interface FieldProps extends FieldBasicProps, FieldRuntimeProps { -} - -// @public (undocumented) -export interface FieldRuntimeProps { - // (undocumented) - format?: (value: Persisted | null) => ReactNode; -} - // @public (undocumented) export type FieldValue = JsonValue; -// @public -export const FieldView: { - (props: FieldViewCommonProps & { - field: SRSF; - render: (field1: FieldAccessor) => RN; - }): REN; - (props: FieldViewCommonProps & { - fields: [SRSF]; - render: (field1: FieldAccessor) => RN; - }): REN; - (props: FieldViewCommonProps & { - fields: [SRSF, SRSF]; - render: (field1: FieldAccessor, field2: FieldAccessor) => RN; - }): REN; - (props: FieldViewCommonProps & { - fields: [SRSF, SRSF, SRSF]; - render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor) => RN; - }): REN; - (props: FieldViewCommonProps & { - fields: [SRSF, SRSF, SRSF, SRSF]; - render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor, field4: FieldAccessor) => RN; - }): REN; - (props: FieldViewCommonProps & { - fields: [SRSF, SRSF, SRSF, SRSF, SRSF]; - render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor, field4: FieldAccessor, field5: FieldAccessor) => RN; - }): REN; - (props: FieldViewProps): REN; -}; - // @public (undocumented) export type Filter = Input.Where>>; -// @public (undocumented) -export type ForceAccessorUpdate = () => void; - export { generateUuid } // @public (undocumented) @@ -1232,18 +969,6 @@ export interface GqlError { type: 'gqlError'; } -// @public (undocumented) -export const HasMany: (props: HasManyProps) => ReactElement; - -// @public (undocumented) -export type HasManyProps = SugaredRelativeEntityList & { - children?: ReactNode; - variables?: Environment.ValuesMapWithFactory; -} & ({} | { - listComponent: ComponentType; - listProps?: ListProps; -}); - // @public (undocumented) export interface HasManyRelation extends Relation, EntityListParameters, EntityListEventListeners { } @@ -1263,15 +988,6 @@ export class HasManyRelationMarker { readonly placeholderName: string; } -// @public (undocumented) -export const HasOne: (props: HasOneProps) => ReactElement; - -// @public (undocumented) -export type HasOneProps = SugaredRelativeSingleEntity & { - children?: ReactNode; - variables?: Environment.ValuesMapWithFactory; -}; - // @public (undocumented) export interface HasOneRelation extends Relation, SingleEntityParameters, SingleEntityEventListeners { // (undocumented) @@ -1293,28 +1009,6 @@ export class HasOneRelationMarker { readonly placeholderName: string; } -// @public (undocumented) -export const If: React.NamedExoticComponent; - -// @public (undocumented) -export interface IfCallbackProps { - // (undocumented) - children?: ReactNode; - // (undocumented) - condition: (accessor: EntityAccessor) => boolean; -} - -// @public (undocumented) -export interface IfFilterProps { - // (undocumented) - children?: ReactNode; - // (undocumented) - condition: string | Filter; -} - -// @public (undocumented) -export type IfProps = IfFilterProps | IfCallbackProps; - // @public (undocumented) export interface IndexPathErrorFragment { // (undocumented) @@ -1325,28 +1019,6 @@ export interface IndexPathErrorFragment { index: number; } -// @public (undocumented) -export interface InitializedAccessorTreeState { - // (undocumented) - binding: DataBinding; - // (undocumented) - data: TreeRootAccessor; - // (undocumented) - environment: Environment; - // (undocumented) - name: 'initialized'; -} - -// @public (undocumented) -export interface InitializingAccessorTreeState { - // (undocumented) - binding?: DataBinding; - // (undocumented) - environment: Environment; - // (undocumented) - name: 'initializing'; -} - // @public (undocumented) export interface InvalidInputPersistResult { // (undocumented) @@ -1409,12 +1081,6 @@ export const LeafFieldDefaults: { readonly isNonbearing: false; }; -// @public (undocumented) -export interface LeafMarkerProvider { - // (undocumented) - generateLeafMarker: (props: Props, environment: Environment) => FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer; -} - // @public (undocumented) export type Limit = number; @@ -1476,16 +1142,6 @@ export class MarkerMerger { static mergeSubTreePlaceholdersByAliases(original: Map, fresh: Map): Map; } -// @public (undocumented) -export type MarkerProvider = Partial>; - -// @public (undocumented) -export class MarkerTreeGenerator { - constructor(sourceTree: ReactNode, environment?: Environment); - // (undocumented) - generate(): MarkerTreeRoot; -} - // @public (undocumented) export class MarkerTreeRoot { constructor(subTrees: SubTreeMarkers, placeholdersByAliases: Map); @@ -1501,12 +1157,6 @@ export type MeaningfulMarker = FieldMarker | HasOneRelationMarker | HasManyRelat // @public (undocumented) export const metadataToRequestError: (metadata: GraphQlClientFailedRequestMetadata) => RequestError; -// @public (undocumented) -export const moveEntity: (entityList: EntityListAccessor, sortByField: RelativeSingleField, oldIndex: number, newIndex: number) => void; - -// @public (undocumented) -export const moveEntityInArray: (entities: EntityAccessor[], getAccessor: EntityListAccessor.GetEntityListAccessor, sortByField: RelativeSingleField, oldIndex: number, newIndex: number) => EntityAccessor[]; - // @public (undocumented) export interface MutationDataResponse { // (undocumented) @@ -1544,9 +1194,6 @@ export interface MutationResponse { } | undefined; } -// @public (undocumented) -export const MutationStateContext: React.Context; - // @public (undocumented) export interface MutationTransactionResponse { // (undocumented) @@ -1602,9 +1249,6 @@ export interface OwningRelation extends BaseRelation { side: 'owning'; } -// @public (undocumented) -export const ParentEntity: React.NamedExoticComponent; - // @public (undocumented) export class ParentEntityMarker { constructor(parentEntity: ParentEntityParameters, fields: EntityFieldMarkersContainer); @@ -1618,12 +1262,6 @@ export class ParentEntityMarker { export interface ParentEntityParameters extends SingleEntityEventListeners { } -// @public (undocumented) -export interface ParentEntityProps extends SugaredParentEntityParameters { - // (undocumented) - children?: ReactNode; -} - // @public export class Parser extends EmbeddedActionsParser { // (undocumented) @@ -1833,6 +1471,18 @@ export interface QueryRequestResponse { }[]; } +// @public (undocumented) +export interface RawSchema { + // Warning: (ae-forgotten-export) The symbol "RawSchemaEntity" needs to be exported by the entry point index.d.ts + // + // (undocumented) + entities: RawSchemaEntity[]; + // Warning: (ae-forgotten-export) The symbol "RawSchemaEnum" needs to be exported by the entry point index.d.ts + // + // (undocumented) + enums: RawSchemaEnum[]; +} + // @public (undocumented) export type ReceivedData = ReceivedEntityData | ReceivedEntityData[]; @@ -1886,9 +1536,6 @@ export type RelativeSingleField = AnyField & LeafField & { // @public (undocumented) export type RemovalType = 'disconnect' | 'delete'; -// @public (undocumented) -export const repairEntitiesOrder: (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => void; - // @public (undocumented) export type RequestError = UnauthorizedRequestError | NetworkErrorRequestError | GqlError | UnknownErrorRequestError; @@ -1996,6 +1643,12 @@ export class SchemaLoader { static loadSchema(client: GraphQlClient, options?: GraphQlClientRequestOptions): Promise; } +// @public (undocumented) +export class SchemaPreprocessor { + // (undocumented) + static processRawSchema(rawSchema: RawSchema): SchemaStore; +} + // @public (undocumented) export type SchemaRelation = OwningRelation | InverseRelation; @@ -2039,21 +1692,6 @@ export class ServerId implements RuntimeIdSpec { // @public (undocumented) export type SetOnCreate = UniqueWhere | undefined; -// @public (undocumented) -export const SetOrderFieldOnCreate: React.NamedExoticComponent; - -// @public (undocumented) -export interface SetOrderFieldOnCreateOwnProps { - // (undocumented) - newOrderFieldValue?: number; - // (undocumented) - orderField: SugaredRelativeSingleField | string; -} - -// @public (undocumented) -export interface SetOrderFieldOnCreateProps extends SetOrderFieldOnCreateOwnProps, Pick { -} - // @public (undocumented) export interface SingleEntityEventListeners { // (undocumented) @@ -2070,42 +1708,28 @@ export interface SingleEntityParameters { export type SingleEntityPersistedData = Map; // @public (undocumented) -export interface SortedEntities { - // (undocumented) - addNewAtIndex: (index: number | undefined, preprocess?: EntityAccessor.BatchUpdatesHandler) => void; - // (undocumented) - appendNew: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; +export class StateInitializer { + // Warning: (ae-forgotten-export) The symbol "AccessorErrorManager" needs to be exported by the entry point index.d.ts + constructor(accessorErrorManager: AccessorErrorManager, batchUpdatesOptions: BatchUpdatesOptions, eventManager: EventManager, treeStore: TreeStore); // (undocumented) - entities: EntityAccessor[]; + initializeEntityEventListenerStore(blueprint: EntityRealmBlueprint): EntityEventListenerStore | undefined; + // Warning: (ae-forgotten-export) The symbol "EntityRealmBlueprint" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "EntityRealmStateStub" needs to be exported by the entry point index.d.ts + // // (undocumented) - moveEntity: (oldIndex: number, newIndex: number) => void; + initializeEntityRealm(id: RuntimeId, entityName: EntityName, blueprint: EntityRealmBlueprint, copyFrom?: EntityRealmState | EntityRealmStateStub): EntityRealmState | EntityRealmStateStub; + // Warning: (ae-forgotten-export) The symbol "EntityState" needs to be exported by the entry point index.d.ts + // // (undocumented) - prependNew: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; -} - -// @public (undocumented) -export const sortEntities: (entities: EntityAccessor[], sortByField: RelativeSingleField | undefined) => EntityAccessor[]; - -// @public (undocumented) -export const StaticRender: React.NamedExoticComponent; - -// @public (undocumented) -export interface StaticRenderProps { + initializeEntityState(id: RuntimeId, entityName: EntityName): EntityState; + // Warning: (ae-forgotten-export) The symbol "RootStateNode" needs to be exported by the entry point index.d.ts + // // (undocumented) - children?: ReactNode; -} - -// @public (undocumented) -export interface StaticRenderProvider { + initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode; // (undocumented) - staticRender: (props: StaticRenderProviderProps, environment: Environment) => ReactElement | null; + runImmediateUserInitialization(realm: EntityRealmState | EntityRealmStateStub, initialize: EntityAccessor.BatchUpdatesHandler | undefined): void; } -// @public (undocumented) -export type StaticRenderProviderProps = [ -NonStaticPropNames -] extends [never] ? Props : Omit; - // @public (undocumented) export type SubTreeDataStore = Map; @@ -2207,15 +1831,6 @@ export interface SugarableUnconstrainedQualifiedSingleEntity extends SugarableQu hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation; } -// @public (undocumented) -export const SugaredField: (props: SugaredFieldProps) => ReactElement; - -// @public (undocumented) -export interface SugaredFieldProps extends Omit, 'field'> { - // (undocumented) - field: string | SugaredRelativeSingleField; -} - // @public (undocumented) export type SugaredFilter = Filter | string; @@ -2322,6 +1937,35 @@ export const tokens: { GreaterThan: TokenType; }; +// @public (undocumented) +export class TreeAugmenter { + constructor(eventManager: EventManager, stateInitializer: StateInitializer, treeStore: TreeStore, skipStateUpdateAfterPersist?: boolean); + // (undocumented) + extendPersistedData(newPersistedData: ReceivedDataTree, markerTree: MarkerTreeRoot): void; + // (undocumented) + extendTreeStates(newTreeId: TreeRootId | undefined, newMarkerTree: MarkerTreeRoot): void; + // (undocumented) + resetCreatingSubTrees(): void; + // Warning: (ae-forgotten-export) The symbol "SubMutationOperation" needs to be exported by the entry point index.d.ts + // + // (undocumented) + updatePersistedData(response: ReceivedDataTree, operations: SubMutationOperation[]): void; +} + +// @public (undocumented) +export class TreeNodeEnvironmentFactory { + // (undocumented) + static createEnvironmentForEntity(environment: Environment, sugaredRelativeSingleEntity: SugaredRelativeSingleEntity): Environment; + // (undocumented) + static createEnvironmentForEntityList(environment: Environment, sugaredRelativeEntityList: SugaredRelativeEntityList): Environment; + // (undocumented) + static createEnvironmentForEntityListSubtree(environment: Environment, sugaredEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList): Environment; + // (undocumented) + static createEnvironmentForEntitySubtree(environment: Environment, sugaredEntityList: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity): Environment; + // (undocumented) + static createEnvironmentForField(environment: Environment, sugaredRelativeSingleField: SugaredRelativeSingleField): Environment; +} + // @public (undocumented) export class TreeParameterMerger { // (undocumented) @@ -2351,10 +1995,10 @@ export class TreeParameterMerger { } // @public (undocumented) -export class TreeRootAccessor { - constructor(hasUnpersistedChanges: boolean, isMutating: boolean, bindingOperations: BindingOperations); +export class TreeRootAccessor { + constructor(hasUnpersistedChanges: boolean, isMutating: boolean, bindingOperations: BindingOperations); // (undocumented) - readonly bindingOperations: BindingOperations; + readonly bindingOperations: BindingOperations; // (undocumented) readonly hasUnpersistedChanges: boolean; // (undocumented) @@ -2365,14 +2009,45 @@ export class TreeRootAccessor { export type TreeRootId = string; // @public (undocumented) -export function TreeRootIdProvider(props: TreeRootIdProviderProps): JSX.Element; - -// @public (undocumented) -export interface TreeRootIdProviderProps { +export class TreeStore { + constructor(_schema: Schema); + // (undocumented) + disposeOfEntity(entity: EntityState): void; + // (undocumented) + disposeOfRealm(realmToDisposeOf: EntityRealmState | EntityRealmStateStub): void; + // (undocumented) + effectivelyHasTreeRoot(candidateRoot: MarkerTreeRoot): boolean; // (undocumented) - children: ReactNode; + readonly entityRealmStore: Map; // (undocumented) - treeRootId: TreeRootId | undefined; + readonly entityStore: Map; + // (undocumented) + getEntityListPersistedIds(state: EntityListState): ReadonlySet; + // (undocumented) + getPathBackToParent(entityRealm: EntityRealmState | EntityRealmStateStub): { + fieldBackToParent: FieldName; + parent: EntityRealmState; + } | undefined; + // (undocumented) + getSubTreeState(mode: 'entity', treeRootId: TreeRootId | undefined, aliasOrParameters: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity, environment: Environment): EntityRealmState; + // (undocumented) + getSubTreeState(mode: 'entityList', treeRootId: TreeRootId | undefined, aliasOrParameters: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList, environment: Environment): EntityListState; + // (undocumented) + readonly markerTrees: Map; + // (undocumented) + mergeInMutationResponse(response: ReceivedDataTree, operations: SubMutationOperation[]): void; + // (undocumented) + mergeInQueryResponse(response: ReceivedDataTree, markerTree: MarkerTreeRoot): void; + // (undocumented) + readonly persistedData: NormalizedPersistedData; + // (undocumented) + get persistedEntityData(): PersistedEntityDataStore; + // (undocumented) + get schema(): Schema; + // (undocumented) + get subTreePersistedData(): SubTreeDataStore; + // (undocumented) + readonly subTreeStatesByRoot: Map>; } // @public (undocumented) @@ -2390,6 +2065,8 @@ export interface UnconstrainedQualifiedEntityList extends QualifiedEntityParamet hasOneRelationPath: HasOneRelation[]; // (undocumented) isCreating: true; + // (undocumented) + isUnpersisted: boolean; } // @public (undocumented) @@ -2398,6 +2075,8 @@ export interface UnconstrainedQualifiedSingleEntity extends QualifiedEntityParam hasOneRelationPath: HasOneRelation[]; // (undocumented) isCreating: true; + // (undocumented) + isUnpersisted: boolean; } // @public (undocumented) @@ -2536,189 +2215,18 @@ export type UnsugarableSingleEntityEventListeners = { export interface UnsugarableUnconstrainedQualifiedEntityList extends UnsugarableQualifiedEntityParameters, UnsugarableEntityCreationParameters, UnsugarableEntityListEventListeners, UnsugarableEntityListPreferences { // (undocumented) isCreating: true; + // (undocumented) + isUnpersisted?: boolean; } // @public (undocumented) export interface UnsugarableUnconstrainedQualifiedSingleEntity extends UnsugarableQualifiedEntityParameters, UnsugarableEntityCreationParameters, UnsugarableSingleEntityEventListeners { // (undocumented) isCreating: true; + // (undocumented) + isUnpersisted?: boolean; } -// @public (undocumented) -export const useAccessorTreeState: () => AccessorTreeState; - -// @public -export function useAccessorUpdateSubscription(getFieldAccessor: () => FieldAccessor): FieldAccessor; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor): EntityListAccessor | EntityAccessor; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getFieldAccessor: () => FieldAccessor, withForceUpdate: true): [FieldAccessor, ForceAccessorUpdate]; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor, withForceUpdate: true): [EntityAccessor, ForceAccessorUpdate]; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor, withForceUpdate: true): [EntityListAccessor, ForceAccessorUpdate]; - -// @public (undocumented) -export function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor, withForceUpdate: true): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]; - -// @public (undocumented) -export const useBindingOperations: () => BindingOperations; - -// @public (undocumented) -export const useDataBinding: ({ children, refreshOnPersist, skipStateUpdateAfterPersist, }: AccessorTreeStateOptions) => AccessorTreeState; - -// @public @deprecated -export const useDerivedField: (sourceField: string | SugaredRelativeSingleField, derivedField: string | SugaredRelativeSingleField, transform?: (sourceValue: SourceValue | null) => SourceValue | null, agent?: string) => void; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): RelativeEntityList; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined): RelativeEntityList | undefined; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): RelativeSingleEntity; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined): RelativeSingleEntity | undefined; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeSingleField(sugaredRelativeSingleField: string | SugaredRelativeSingleField): RelativeSingleField; - -// @public @deprecated (undocumented) -export function useDesugaredRelativeSingleField(sugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined): RelativeSingleField | undefined; - -// @public (undocumented) -export const useDirtinessState: () => boolean; - -// @public (undocumented) -export function useEntity(): EntityAccessor; - -// @public (undocumented) -export function useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor; - -// @public (undocumented) -export function useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined): EntityAccessor | undefined; - -// @public (undocumented) -export const useEntityBeforePersist: (listener: EntityAccessor.EntityEventListenerMap['beforePersist']) => void; - -// @public (undocumented) -export const useEntityBeforeUpdate: (listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']) => void; - -// @public (undocumented) -export function useEntityEvent(type: 'beforePersist', listener: EntityAccessor.EntityEventListenerMap['beforePersist']): void; - -// @public (undocumented) -export function useEntityEvent(type: 'beforeUpdate', listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']): void; - -// @public (undocumented) -export function useEntityEvent(type: 'connectionUpdate', hasOneField: FieldName, listener: EntityAccessor.EntityEventListenerMap['connectionUpdate']): void; - -// @public (undocumented) -export function useEntityEvent(type: 'persistError', listener: EntityAccessor.EntityEventListenerMap['persistError']): void; - -// @public (undocumented) -export function useEntityEvent(type: 'persistSuccess', listener: EntityAccessor.EntityEventListenerMap['persistSuccess']): void; - -// @public (undocumented) -export function useEntityEvent(type: 'update', listener: EntityAccessor.EntityEventListenerMap['update']): void; - -// @public (undocumented) -export const useEntityKey: () => string; - -// @public (undocumented) -export function useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor; - -// @public (undocumented) -export function useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined): EntityListAccessor | undefined; - -// @public (undocumented) -export const useEntityListSubTree: (qualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList, ...treeId: [TreeRootId | undefined] | [ -]) => EntityListAccessor; - -// @public (undocumented) -export function useEntityListSubTreeParameters(alias: Alias): Alias; - -// @public (undocumented) -export function useEntityListSubTreeParameters(qualifiedEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList): SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList; - -// @public (undocumented) -export function useEntityListSubTreeParameters(qualifiedEntityListOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList; - -// @public (undocumented) -export const useEntityPersistError: (listener: EntityAccessor.EntityEventListenerMap['persistError']) => void; - -// @public (undocumented) -export const useEntityPersistSuccess: (listener: EntityAccessor.EntityEventListenerMap['persistSuccess']) => void; - -// @public (undocumented) -export const useEntitySubTree: (qualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity, ...treeId: [TreeRootId | undefined] | [ -]) => EntityAccessor; - -// @public (undocumented) -export function useEntitySubTreeParameters(alias: Alias): Alias; - -// @public (undocumented) -export function useEntitySubTreeParameters(qualifiedEntity: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity): SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity; - -// @public (undocumented) -export function useEntitySubTreeParameters(qualifiedSingleEntityOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity; - -// @public (undocumented) -export const useEnvironment: () => Environment; - -// @public (undocumented) -export const useExtendTree: () => (newFragment: ReactNode, options?: Omit) => Promise; - -// @public (undocumented) -export function useField(sugaredRelativeSingleField: string | SugaredRelativeSingleField): FieldAccessor; - -// @public (undocumented) -export function useField(sugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined): FieldAccessor | undefined; - -// @public (undocumented) -export const useGetEntityByKey: () => GetEntityByKey; - -// @public (undocumented) -export const useGetEntityListSubTree: () => (parametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList, ...treeId: [TreeRootId | undefined] | [ -]) => EntityListAccessor; - -// @public (undocumented) -export const useGetEntitySubTree: () => (parametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity, ...treeId: [TreeRootId | undefined] | [ -]) => EntityAccessor; - -// @public (undocumented) -export const useGetTreeFilters: () => (() => TreeFilter[]); - -// @public (undocumented) -export const useHasEntity: () => boolean; - -// @public (undocumented) -export const useMutationState: () => boolean; - -// @public (undocumented) -export const useOnConnectionUpdate: (fieldName: FieldName, listener: EntityAccessor.EntityEventListenerMap['connectionUpdate']) => void; - -// @public (undocumented) -export const usePersist: () => Persist; - -// @public (undocumented) -export const useSortedEntities: (entityList: EntityListAccessor, sortableByField: SugaredFieldProps['field'] | undefined) => SortedEntities; - -// @public (undocumented) -export const useTreeRootId: () => TreeRootId | undefined; - // @public (undocumented) export interface ValidationError { // (undocumented) @@ -2747,14 +2255,6 @@ export class VariableInputTransformer { // @public (undocumented) export const wrapFilterInHasOnes: (path: HasOneRelation[], filter: Filter) => Filter; -// Warnings were encountered during analysis: -// -// src/helperComponents/FieldView.tsx:47:23 - (ae-forgotten-export) The symbol "FieldViewCommonProps" needs to be exported by the entry point index.d.ts -// src/helperComponents/FieldView.tsx:47:23 - (ae-forgotten-export) The symbol "REN" needs to be exported by the entry point index.d.ts -// src/helperComponents/FieldView.tsx:49:1 - (ae-forgotten-export) The symbol "SRSF" needs to be exported by the entry point index.d.ts -// src/helperComponents/FieldView.tsx:108:33 - (ae-forgotten-export) The symbol "RN" needs to be exported by the entry point index.d.ts -// src/helperComponents/FieldView.tsx:141:1 - (ae-forgotten-export) The symbol "FieldViewProps" needs to be exported by the entry point index.d.ts - // (No @packageDocumentation comment for this package) ``` diff --git a/build/api/react-auto.api.md b/build/api/react-auto.api.md new file mode 100644 index 0000000000..4439ec24d4 --- /dev/null +++ b/build/api/react-auto.api.md @@ -0,0 +1,107 @@ +## API Report File for "@contember/react-auto" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { ComponentType } from 'react'; +import { DataGridContainerPublicProps } from '@contember/react-datagrid-ui'; +import { EntityAccessor } from '@contember/react-binding'; +import { EntityId } from '@contember/react-binding'; +import { MouseEvent as MouseEvent_2 } from 'react'; +import { NamedExoticComponent } from 'react'; +import { ReactNode } from 'react'; +import { Schema } from '@contember/react-binding'; +import { SugaredQualifiedEntityList } from '@contember/react-binding'; + +// @public (undocumented) +export const AutoCell: NamedExoticComponent; + +// @public (undocumented) +export type AutoCellProps = { + schema: Schema; + entityName: string; + fieldName: string; + LinkComponent?: LinkComponent; + linkAction?: LinkComponentProps['action']; +}; + +// @public (undocumented) +export const AutoField: NamedExoticComponent; + +// @public (undocumented) +export type AutoFieldProps = { + schema: Schema; + entityName: string; + fieldName: string; + LinkComponent?: LinkComponent; + excludedEntities?: string[]; +}; + +// @public (undocumented) +export const AutoFields: NamedExoticComponent; + +// @public (undocumented) +export type AutoFieldsProps = { + LinkComponent?: LinkComponent; + excludedFields?: string[]; + excludedEntities?: string[]; +}; + +// @public (undocumented) +export const AutoForm: NamedExoticComponent; + +// @public (undocumented) +export type AutoFormProps = { + entity: string; + id?: EntityId; + onCreateSuccess?: EntityAccessor.PersistSuccessHandler | Set; + LinkComponent?: LinkComponent; +}; + +// @public (undocumented) +export const AutoGrid: NamedExoticComponent; + +// @public (undocumented) +export type AutoGridProps = DataGridContainerPublicProps & { + entities: SugaredQualifiedEntityList['entities']; + LinkComponent?: LinkComponent; +}; + +// @public (undocumented) +export const AutoLabel: NamedExoticComponent; + +// @public (undocumented) +export type AutoLabelProps = { + field: string; + LinkComponent?: LinkComponent; + linkAction?: LinkComponentProps['action']; +}; + +// @public (undocumented) +export interface InnerLinkProps { + // (undocumented) + active: boolean; + // (undocumented) + href: string; + // (undocumented) + onClick: (e?: MouseEvent_2) => void; +} + +// @public (undocumented) +export type LinkComponent = ComponentType; + +// @public (undocumented) +export type LinkComponentProps = { + entityName: string; + entityId: string | number; + action: 'edit' | 'view'; + Component?: ComponentType; + children: ReactNode; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-binding-ui.api.md b/build/api/react-binding-ui.api.md new file mode 100644 index 0000000000..a5ae5905ea --- /dev/null +++ b/build/api/react-binding-ui.api.md @@ -0,0 +1,278 @@ +## API Report File for "@contember/react-binding-ui" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { BoxProps } from '@contember/ui'; +import { ButtonProps } from '@contember/ui'; +import { ComponentProps } from 'react'; +import { ComponentType } from 'react'; +import { ElementType } from 'react'; +import { EntityAccessor } from '@contember/react-binding'; +import type { EntityListAccessor } from '@contember/react-binding'; +import type { ErrorAccessor } from '@contember/react-binding'; +import { ErrorListProps } from '@contember/ui'; +import type { FieldAccessor } from '@contember/react-binding'; +import { FieldValue } from '@contember/react-binding'; +import type { FunctionComponent } from 'react'; +import { HTMLAnchorElementProps } from '@contember/ui'; +import { HTMLImageElementProps } from '@contember/ui'; +import { HTMLVideoElementProps } from '@contember/ui'; +import { IconProps } from '@contember/ui'; +import { MemoExoticComponent } from 'react'; +import { NamedExoticComponent } from 'react'; +import { PersistOptions } from '@contember/react-binding'; +import { ReactElement } from 'react'; +import { ReactNode } from 'react'; +import { SuccessfulPersistResult } from '@contember/react-binding'; +import { SugarableRelativeSingleField } from '@contember/react-binding'; +import { SugaredFieldProps } from '@contember/react-binding'; + +// @public (undocumented) +export interface AccessorErrorMessage { + // (undocumented) + message: string; +} + +// @public (undocumented) +export type AccessorErrorMessages = [AccessorErrorMessage, ...AccessorErrorMessage[]]; + +// @public (undocumented) +export function AccessorErrors({ accessor, ...errorListProps }: AccessorErrorsProps): ReactElement | null; + +// @public (undocumented) +export interface AccessorErrorsHolder { + // (undocumented) + readonly errors: ErrorAccessor | undefined; +} + +// @public (undocumented) +export interface AccessorErrorsProps extends Omit { + // (undocumented) + accessor: FieldAccessor | EntityAccessor | EntityListAccessor; +} + +// @public (undocumented) +export interface AddEntityButtonProps { + // (undocumented) + addButtonComponent?: ComponentType; + // (undocumented) + addButtonComponentExtraProps?: {}; + // (undocumented) + addButtonProps?: CreateNewEntityButtonProps; + // (undocumented) + addButtonText?: ReactNode; +} + +// @public (undocumented) +export const BooleanFieldView: FunctionComponent; + +// @public (undocumented) +export type BooleanFieldViewProps = { + field: SugaredFieldProps['field']; + booleanStyle?: 'yesNo' | 'checkCross' | 'oneZero'; + format?: (date: boolean) => ReactNode; +} & FieldFallbackViewPublicProps; + +// @public (undocumented) +export const CoalesceFieldView: (props: CoalesceFieldViewProps) => ReactElement; + +// @public (undocumented) +export interface CoalesceFieldViewProps extends FieldFallbackViewPublicProps { + // (undocumented) + fields: (SugarableRelativeSingleField | string)[]; + // (undocumented) + format?: (value: Persisted) => ReactNode; +} + +// @public (undocumented) +export const CreateNewEntityButton: MemoExoticComponent<({ createNewEntity, iconProps, children, ...buttonProps }: CreateNewEntityButtonProps) => JSX.Element>; + +// @public (undocumented) +export type CreateNewEntityButtonProps = ButtonProps & { + createNewEntity: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; + iconProps?: IconProps; +}; + +// @public (undocumented) +export const DateFieldView: FunctionComponent; + +// @public (undocumented) +export type DateFieldViewFormattingProps = { + format?: ((date: Date) => ReactNode) | Intl.DateTimeFormatOptions; + locale?: never; +} | { + format?: Intl.DateTimeFormatOptions; + locale: string | string[]; +}; + +// @public (undocumented) +export type DateFieldViewProps = { + field: SugaredFieldProps['field']; +} & DateFieldViewFormattingProps & FieldFallbackViewPublicProps; + +// @public +export const DeleteEntityButton: MemoExoticComponent<(props: DeleteEntityButtonProps) => JSX.Element | null>; + +// @public (undocumented) +export type DeleteEntityButtonProps = { + immediatePersist?: true; + children?: ReactNode; +} & ButtonProps; + +// @public (undocumented) +export const EmptyMessage: MemoExoticComponent<({ children, component, padding, ...rest }: EmptyMessageProps) => JSX.Element>; + +// @public (undocumented) +export type EmptyMessageComponentProps = BoxProps & { + children: ReactNode; +}; + +// @public (undocumented) +export interface EmptyMessageOuterProps { + // (undocumented) + emptyMessage?: ReactNode; + // (undocumented) + emptyMessageComponent?: ComponentType; +} + +// @public (undocumented) +export type EmptyMessageProps> = ComponentProps & ComponentProps & { + children: ReactNode; + component?: C; +}; + +// @public (undocumented) +export type ErrorCodeDictionary = typeof errorCodeDictionary; + +// @public (undocumented) +export const errorCodeDictionary: { + errorCodes: { + fieldRequired: string; + notUnique: string; + unknownExecutionError: string; + }; +}; + +// @public (undocumented) +export const FieldFallbackView: FunctionComponent; + +// @public (undocumented) +export interface FieldFallbackViewProps { + // (undocumented) + fallback?: ReactNode | undefined; + // (undocumented) + fallbackStyle?: FieldFallbackViewStyle | undefined; +} + +// @public (undocumented) +export type FieldFallbackViewPublicProps = FieldFallbackViewProps; + +// @public (undocumented) +export type FieldFallbackViewStyle = 'n/a' | 'nothing' | 'unknown'; + +// @public (undocumented) +export type FieldViewDictionary = typeof fieldViewDictionary; + +// @public (undocumented) +export const fieldViewDictionary: { + fieldView: { + boolean: { + yes: string; + no: string; + }; + fallback: { + unknown: string; + notAvailable: string; + }; + }; +}; + +// @public (undocumented) +export const FileUrlFieldView: FunctionComponent; + +// @public (undocumented) +export type FileUrlFieldViewProps = { + fileUrlField: SugaredFieldProps['field']; +} & HTMLAnchorElementProps; + +// @public (undocumented) +export const ImageFieldView: (props: ImageFieldViewProps) => ReactElement; + +// @public (undocumented) +export type ImageFieldViewProps = { + srcField: SugaredFieldProps['field']; + altField?: SugaredFieldProps['field']; + titleField?: SugaredFieldProps['field']; + formatUrl?: (srcFieldValue: SrcField) => string; +} & FieldFallbackViewPublicProps & Omit; + +// @public (undocumented) +export const NotFoundWrapper: NamedExoticComponent< { +children: ReactNode; +title?: ReactNode; +}>; + +// @public (undocumented) +export type PersistFeedbackDictionary = typeof persistFeedbackDictionary; + +// @public (undocumented) +export const persistFeedbackDictionary: { + persistFeedback: { + successMessage: string; + afterPersistErrorMessage: string; + errorMessage: string; + }; +}; + +// @public (undocumented) +export interface PersistWithFeedbackOptions extends PersistOptions { + // (undocumented) + afterPersistErrorDuration?: number; + // (undocumented) + afterPersistErrorMessage?: string; + // (undocumented) + errorDuration?: number; + // (undocumented) + errorMessage?: string; + // (undocumented) + successDuration?: number; + // (undocumented) + successMessage?: string; +} + +// @public (undocumented) +export interface SelectEntityButtonProps { + // (undocumented) + selectButtonComponent?: ComponentType; + // (undocumented) + selectButtonComponentExtraProps?: {}; + // (undocumented) + selectButtonProps?: CreateNewEntityButtonProps; + // (undocumented) + selectButtonText?: ReactNode; +} + +// @public (undocumented) +export const useAccessorErrorFormatter: () => (errors: ErrorAccessor.Error[]) => AccessorErrorMessage[]; + +// @public (undocumented) +export const useAccessorErrors: (errorAccessor: ErrorAccessor.Error[] | undefined) => AccessorErrorMessages | undefined; + +// @public (undocumented) +export const usePersistWithFeedback: ({ successMessage, successDuration, errorMessage, errorDuration, afterPersistErrorMessage, afterPersistErrorDuration, ...persistOptions }?: PersistWithFeedbackOptions) => () => Promise; + +// @public (undocumented) +export const VideoFieldView: (props: VideoFieldViewProps) => ReactElement; + +// @public (undocumented) +export type VideoFieldViewProps = { + srcField: SugaredFieldProps['field']; + titleField?: SugaredFieldProps['field']; + formatUrl?: (srcFieldValue: SrcField) => string; +} & FieldFallbackViewPublicProps & Omit; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-binding.api.md b/build/api/react-binding.api.md new file mode 100644 index 0000000000..7b198c23f0 --- /dev/null +++ b/build/api/react-binding.api.md @@ -0,0 +1,760 @@ +## API Report File for "@contember/react-binding" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Alias } from '@contember/binding'; +import type { BindingOperations } from '@contember/binding'; +import { ComponentType } from 'react'; +import { Context } from 'react'; +import { DataBinding } from '@contember/binding'; +import { EntityAccessor } from '@contember/binding'; +import type { EntityFieldMarkersContainer } from '@contember/binding'; +import type { EntityFieldsWithHoistablesMarker } from '@contember/binding'; +import { EntityListAccessor } from '@contember/binding'; +import { Environment } from '@contember/binding'; +import { ExtendTreeOptions } from '@contember/binding'; +import type { FieldAccessor } from '@contember/binding'; +import type { FieldMarker } from '@contember/binding'; +import type { FieldName } from '@contember/binding'; +import { FieldValue } from '@contember/binding'; +import { Filter } from '@contember/binding'; +import type { GetEntityByKey } from '@contember/binding'; +import type { HasManyRelationMarker } from '@contember/binding'; +import type { HasOneRelationMarker } from '@contember/binding'; +import { MarkerTreeRoot } from '@contember/binding'; +import { NamedExoticComponent } from 'react'; +import type { Persist } from '@contember/binding'; +import { PropsWithChildren } from 'react'; +import { ReactElement } from 'react'; +import { ReactNode } from 'react'; +import type { RelativeEntityList } from '@contember/binding'; +import type { RelativeSingleEntity } from '@contember/binding'; +import { RelativeSingleField } from '@contember/binding'; +import type { RequestError } from '@contember/binding'; +import type { SugaredParentEntityParameters } from '@contember/binding'; +import type { SugaredQualifiedEntityList } from '@contember/binding'; +import type { SugaredQualifiedSingleEntity } from '@contember/binding'; +import type { SugaredRelativeEntityList } from '@contember/binding'; +import type { SugaredRelativeSingleEntity } from '@contember/binding'; +import type { SugaredRelativeSingleField } from '@contember/binding'; +import type { SugaredUnconstrainedQualifiedEntityList } from '@contember/binding'; +import type { SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'; +import type { TreeFilter } from '@contember/client'; +import type { TreeRootAccessor } from '@contember/binding'; +import { TreeRootId } from '@contember/binding'; + +// @public (undocumented) +export function AccessorProvider(props: EntityProviderProps): JSX.Element; + +// @public (undocumented) +export const AccessorTree: { + ({ state, children }: AccessorTreeProps): JSX.Element; + displayName: string; +}; + +// @public (undocumented) +export interface AccessorTreeProps { + // (undocumented) + children: ReactNode; + // (undocumented) + state: AccessorTreeState; +} + +// @public (undocumented) +export type AccessorTreeState = InitializingAccessorTreeState | InitializedAccessorTreeState | ErrorAccessorTreeState; + +// @public (undocumented) +export type AccessorTreeStateAction = { + type: 'setData'; + data: TreeRootAccessor; + binding: DataBinding; +} | { + type: 'failWithError'; + error: RequestError; + binding: DataBinding; +} | { + type: 'reset'; + binding: DataBinding; + environment: Environment; +}; + +// @public (undocumented) +export interface AccessorTreeStateMetadata { + // (undocumented) + initialize: (() => void) | undefined; +} + +// @public (undocumented) +export interface AccessorTreeStateOptions { + // (undocumented) + children?: ReactNode; + // (undocumented) + refreshOnPersist?: boolean; + // (undocumented) + skipStateUpdateAfterPersist?: boolean; +} + +// @public (undocumented) +export const accessorTreeStateReducer: (previousState: AccessorTreeState, action: AccessorTreeStateAction) => AccessorTreeState; + +// @public (undocumented) +export const addEntityAtIndex: (entityList: EntityListAccessor, sortableByField: RelativeSingleField, index: number, preprocess?: EntityAccessor.BatchUpdatesHandler) => void; + +// @public (undocumented) +export function BindingOperationsProvider(props: BindingOperationsProviderProps): JSX.Element; + +// @public (undocumented) +export interface BindingOperationsProviderProps { + // (undocumented) + bindingOperations: BindingOperations | undefined; + // (undocumented) + children: ReactNode; +} + +// @public (undocumented) +export interface BranchMarkerProvider { + // (undocumented) + generateBranchMarker: (props: Props, fields: EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer, environment: Environment) => HasOneRelationMarker | HasManyRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker; +} + +// @public (undocumented) +export type CompleteMarkerProvider = EnvironmentDeltaProvider & LeafMarkerProvider & BranchMarkerProvider & StaticRenderProvider; + +// @public (undocumented) +export function Component(statelessRender: EnvironmentAwareFunctionComponent, displayName?: string): NamedExoticComponent; + +// @public (undocumented) +export function Component(statefulRender: EnvironmentAwareFunctionComponent, staticRender: (props: StaticRenderProviderProps, environment: Environment) => ReactElement | null, displayName?: string): NamedExoticComponent; + +// @public (undocumented) +export function Component(statefulRender: EnvironmentAwareFunctionComponent, markerProvisions: MarkerProvider, displayName?: string): NamedExoticComponent; + +// @public +export const DataBindingProvider: (props: DataBindingProviderProps) => ReactElement; + +// @public (undocumented) +export type DataBindingProviderBaseProps = AccessorTreeStateOptions; + +// @public (undocumented) +export type DataBindingProviderProps = DataBindingProviderBaseProps & DataBindingProviderStateComponent; + +// @public (undocumented) +export type DataBindingProviderStateComponent = ({ + stateComponent?: never; + stateProps?: never; +} | { + stateComponent: ComponentType; + stateProps?: StateProps; +}); + +// @public (undocumented) +export interface DataBindingStateComponentProps { + // (undocumented) + accessorTreeState: AccessorTreeState; + // (undocumented) + children?: ReactNode; +} + +// @public (undocumented) +export const DeferredSubTrees: NamedExoticComponent; + +// @public (undocumented) +export interface DeferredSubTreesProps { + // (undocumented) + children: ReactNode; + // (undocumented) + fallback: ReactNode; +} + +// @public (undocumented) +export const DirtinessContext: Context; + +// @public (undocumented) +export const Entity: NamedExoticComponent; + +// @public (undocumented) +export interface EntityBaseProps { + // (undocumented) + accessor: EntityAccessor; + // (undocumented) + children?: ReactNode; +} + +// @public (undocumented) +export function EntityKeyProvider(props: EntityKeyProviderProps): JSX.Element; + +// @public (undocumented) +export interface EntityKeyProviderProps { + // (undocumented) + children: ReactNode; + // (undocumented) + entityKey: string; +} + +// @public (undocumented) +export const EntityList: (props: EntityListProps) => ReactElement; + +// @public (undocumented) +export interface EntityListBaseProps { + // (undocumented) + accessor: EntityListAccessor; + // (undocumented) + children?: ReactNode; +} + +// @public (undocumented) +export type EntityListProps = EntityListBaseProps & ({} | { + listComponent: ComponentType; + listProps?: ListProps; +}); + +// @public +export const EntityListSubTree: (props: EntityListSubTreeProps) => ReactElement; + +// @public (undocumented) +export interface EntityListSubTreeAdditionalProps { + // (undocumented) + variables?: Environment.ValuesMapWithFactory; +} + +// @public (undocumented) +export type EntityListSubTreeProps = { + treeRootId?: TreeRootId; + children?: ReactNode; +} & EntityListSubTreeAdditionalProps & (SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) & ({} | { + listComponent: ComponentType; + listProps?: ListProps; +}); + +// @public (undocumented) +export type EntityProps = EntityBaseProps; + +// @public (undocumented) +export interface EntityProviderProps { + // (undocumented) + accessor: EntityAccessor; + // (undocumented) + children: ReactNode; +} + +// @public +export const EntitySubTree: (pros: EntitySubTreeProps) => ReactElement; + +// @public (undocumented) +export type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps; + +// @public (undocumented) +export interface EntitySubTreeAdditionalProps { + // (undocumented) + variables?: Environment.ValuesMapWithFactory; +} + +// @public (undocumented) +export type EntitySubTreeProps = { + treeRootId?: TreeRootId; + children?: ReactNode; +} & EntitySubTreeAdditionalProps & (SugaredQualifiedSingleEntity | (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)); + +// @public (undocumented) +export function EntityView(props: EntityViewProps): JSX.Element; + +// @public (undocumented) +export interface EntityViewProps { + // (undocumented) + field?: string | SugaredRelativeSingleEntity; + // (undocumented) + render: (entity: EntityAccessor) => ReactNode; +} + +// @public (undocumented) +export interface EnvironmentAwareFunctionComponent

{ + // (undocumented) + (props: PropsWithChildren

, environment: Environment): ReactElement | null; + // (undocumented) + displayName?: string | undefined; +} + +// @public (undocumented) +export const EnvironmentContext: Context; + +// @public (undocumented) +export interface EnvironmentDeltaProvider { + // (undocumented) + generateEnvironment: (props: Props, oldEnvironment: Environment) => Environment; +} + +// @public (undocumented) +export const EnvironmentExtensionProvider: (props: EnvironmentWithExtensionProps) => ReactElement | null; + +// @public (undocumented) +export const EnvironmentMiddleware: NamedExoticComponent; + +// @public (undocumented) +export interface EnvironmentMiddlewareProps { + // (undocumented) + children: ReactNode; + // (undocumented) + create: (env: Environment) => Environment; +} + +// @public (undocumented) +export interface EnvironmentWithExtensionProps { + // (undocumented) + children: ReactNode; + // (undocumented) + extension: Environment.Extension; + // (undocumented) + state: S; +} + +// @public (undocumented) +export interface ErrorAccessorTreeState { + // (undocumented) + binding: DataBinding; + // (undocumented) + environment: Environment; + // (undocumented) + error: RequestError; + // (undocumented) + name: 'error'; +} + +// @public (undocumented) +export const Field: (props: FieldProps) => ReactElement; + +// @public (undocumented) +export interface FieldBasicProps extends SugaredRelativeSingleField { +} + +// @public (undocumented) +export interface FieldProps extends FieldBasicProps, FieldRuntimeProps { +} + +// @public (undocumented) +export interface FieldRuntimeProps { + // (undocumented) + format?: (value: Persisted | null) => ReactNode; +} + +// @public +export const FieldView: FieldViewComponentSignature; + +// @public (undocumented) +export interface FieldViewCommonProps { + // (undocumented) + fallbackIfUnpersisted?: ReactNode; +} + +// @public (undocumented) +export type FieldViewComponentSignature = { + (props: FieldViewCommonProps & { + field: string | SugaredRelativeSingleField; + render: (field1: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewCommonProps & { + fields: [string | SugaredRelativeSingleField]; + render: (field1: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewCommonProps & { + fields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]; + render: (field1: FieldAccessor, field2: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewCommonProps & { + fields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]; + render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewCommonProps & { + fields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]; + render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor, field4: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewCommonProps & { + fields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]; + render: (field1: FieldAccessor, field2: FieldAccessor, field3: FieldAccessor, field4: FieldAccessor, field5: FieldAccessor) => ReactNode; + }): ReactElement | null; + (props: FieldViewProps): ReactElement | null; +}; + +// @public (undocumented) +export type FieldViewProps = FieldViewCommonProps & ({ + render: (...accessors: FieldAccessor[]) => ReactNode; + field: string | SugaredRelativeSingleField; +} | { + render: (...accessors: FieldAccessor[]) => ReactNode; + fields: Array; +}); + +// @public (undocumented) +export type ForceAccessorUpdate = () => void; + +// @public (undocumented) +export const HasMany: (props: HasManyProps) => ReactElement; + +// @public (undocumented) +export type HasManyProps = SugaredRelativeEntityList & { + children?: ReactNode; + variables?: Environment.ValuesMapWithFactory; +} & ({} | { + listComponent: ComponentType; + listProps?: ListProps; +}); + +// @public (undocumented) +export const HasOne: (props: HasOneProps) => ReactElement; + +// @public (undocumented) +export type HasOneProps = SugaredRelativeSingleEntity & { + children?: ReactNode; + variables?: Environment.ValuesMapWithFactory; +}; + +// @public (undocumented) +export const If: NamedExoticComponent; + +// @public (undocumented) +export interface IfCallbackProps { + // (undocumented) + children?: ReactNode; + // (undocumented) + condition: (accessor: EntityAccessor) => boolean; +} + +// @public (undocumented) +export interface IfFilterProps { + // (undocumented) + children?: ReactNode; + // (undocumented) + condition: string | Filter; +} + +// @public (undocumented) +export type IfProps = IfFilterProps | IfCallbackProps; + +// @public (undocumented) +export interface InitializedAccessorTreeState { + // (undocumented) + binding: DataBinding; + // (undocumented) + data: TreeRootAccessor; + // (undocumented) + environment: Environment; + // (undocumented) + name: 'initialized'; +} + +// @public (undocumented) +export interface InitializingAccessorTreeState { + // (undocumented) + binding?: DataBinding; + // (undocumented) + environment: Environment; + // (undocumented) + name: 'initializing'; +} + +// @public (undocumented) +export type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode; + +// @public (undocumented) +export const LabelMiddlewareContext: Context; + +// @public (undocumented) +export const LabelMiddlewareProvider: ({ value, children }: { + value: LabelMiddleware; + children: ReactNode; +}) => JSX.Element; + +// @public (undocumented) +export interface LeafMarkerProvider { + // (undocumented) + generateLeafMarker: (props: Props, environment: Environment) => FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer; +} + +// @public (undocumented) +export type MarkerProvider = Partial>; + +// @public (undocumented) +export class MarkerTreeGenerator { + constructor(sourceTree: ReactNode, environment?: Environment); + // (undocumented) + generate(): MarkerTreeRoot; +} + +// @public (undocumented) +export const moveEntity: (entityList: EntityListAccessor, sortByField: RelativeSingleField, oldIndex: number, newIndex: number) => void; + +// @public (undocumented) +export const moveEntityInArray: (entities: EntityAccessor[], getAccessor: EntityListAccessor.GetEntityListAccessor, sortByField: RelativeSingleField, oldIndex: number, newIndex: number) => EntityAccessor[]; + +// @public (undocumented) +export const MutationStateContext: Context; + +// @public (undocumented) +export const ParentEntity: NamedExoticComponent; + +// @public (undocumented) +export interface ParentEntityProps extends SugaredParentEntityParameters { + // (undocumented) + children?: ReactNode; +} + +// @public (undocumented) +export const repairEntitiesOrder: (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => void; + +// @public (undocumented) +export const SetOrderFieldOnCreate: NamedExoticComponent; + +// @public (undocumented) +export interface SetOrderFieldOnCreateOwnProps { + // (undocumented) + newOrderFieldValue?: number; + // (undocumented) + orderField: SugaredRelativeSingleField | string; +} + +// @public (undocumented) +export interface SetOrderFieldOnCreateProps extends SetOrderFieldOnCreateOwnProps, Pick { +} + +// @public (undocumented) +export interface SortedEntities { + // (undocumented) + addNewAtIndex: (index: number | undefined, preprocess?: EntityAccessor.BatchUpdatesHandler) => void; + // (undocumented) + appendNew: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; + // (undocumented) + entities: EntityAccessor[]; + // (undocumented) + moveEntity: (oldIndex: number, newIndex: number) => void; + // (undocumented) + prependNew: (initialize?: EntityAccessor.BatchUpdatesHandler) => void; +} + +// @public (undocumented) +export const sortEntities: (entities: EntityAccessor[], sortByField: RelativeSingleField | undefined) => EntityAccessor[]; + +// @public (undocumented) +export const StaticRender: NamedExoticComponent; + +// @public (undocumented) +export interface StaticRenderProps { + // (undocumented) + children?: ReactNode; +} + +// @public (undocumented) +export interface StaticRenderProvider { + // (undocumented) + staticRender: (props: StaticRenderProviderProps, environment: Environment) => ReactElement | null; +} + +// @public (undocumented) +export type StaticRenderProviderProps = [ +NonStaticPropNames +] extends [never] ? Props : Omit; + +// @public (undocumented) +export const SugaredField: (props: SugaredFieldProps) => ReactElement; + +// @public (undocumented) +export interface SugaredFieldProps extends Omit, 'field'> { + // (undocumented) + field: string | SugaredRelativeSingleField; +} + +// @public (undocumented) +export function TreeRootIdProvider(props: TreeRootIdProviderProps): JSX.Element; + +// @public (undocumented) +export interface TreeRootIdProviderProps { + // (undocumented) + children: ReactNode; + // (undocumented) + treeRootId: TreeRootId | undefined; +} + +// @public (undocumented) +export const useAccessorTreeState: () => AccessorTreeState; + +// @public +export function useAccessorUpdateSubscription(getFieldAccessor: () => FieldAccessor): FieldAccessor; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor): EntityListAccessor | EntityAccessor; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getFieldAccessor: () => FieldAccessor, withForceUpdate: true): [FieldAccessor, ForceAccessorUpdate]; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor, withForceUpdate: true): [EntityAccessor, ForceAccessorUpdate]; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor, withForceUpdate: true): [EntityListAccessor, ForceAccessorUpdate]; + +// @public (undocumented) +export function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor, withForceUpdate: true): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]; + +// @public (undocumented) +export const useBindingOperations: () => BindingOperations; + +// @public (undocumented) +export const useDataBinding: ({ children, refreshOnPersist, skipStateUpdateAfterPersist, }: AccessorTreeStateOptions) => AccessorTreeState; + +// @public @deprecated +export const useDerivedField: (sourceField: string | SugaredRelativeSingleField, derivedField: string | SugaredRelativeSingleField, transform?: (sourceValue: SourceValue | null) => SourceValue | null, agent?: string) => void; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): RelativeEntityList; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined): RelativeEntityList | undefined; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): RelativeSingleEntity; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined): RelativeSingleEntity | undefined; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeSingleField(sugaredRelativeSingleField: string | SugaredRelativeSingleField): RelativeSingleField; + +// @public @deprecated (undocumented) +export function useDesugaredRelativeSingleField(sugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined): RelativeSingleField | undefined; + +// @public (undocumented) +export const useDirtinessState: () => boolean; + +// @public (undocumented) +export function useEntity(): EntityAccessor; + +// @public (undocumented) +export function useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor; + +// @public (undocumented) +export function useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined): EntityAccessor | undefined; + +// @public (undocumented) +export const useEntityBeforePersist: (listener: EntityAccessor.EntityEventListenerMap['beforePersist']) => void; + +// @public (undocumented) +export const useEntityBeforeUpdate: (listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']) => void; + +// @public (undocumented) +export function useEntityEvent(type: 'beforePersist', listener: EntityAccessor.EntityEventListenerMap['beforePersist']): void; + +// @public (undocumented) +export function useEntityEvent(type: 'beforeUpdate', listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']): void; + +// @public (undocumented) +export function useEntityEvent(type: 'connectionUpdate', hasOneField: FieldName, listener: EntityAccessor.EntityEventListenerMap['connectionUpdate']): void; + +// @public (undocumented) +export function useEntityEvent(type: 'persistError', listener: EntityAccessor.EntityEventListenerMap['persistError']): void; + +// @public (undocumented) +export function useEntityEvent(type: 'persistSuccess', listener: EntityAccessor.EntityEventListenerMap['persistSuccess']): void; + +// @public (undocumented) +export function useEntityEvent(type: 'update', listener: EntityAccessor.EntityEventListenerMap['update']): void; + +// @public (undocumented) +export const useEntityKey: () => string; + +// @public (undocumented) +export function useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor; + +// @public (undocumented) +export function useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined): EntityListAccessor | undefined; + +// @public (undocumented) +export const useEntityListSubTree: (qualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList, ...treeId: [TreeRootId | undefined] | [ +]) => EntityListAccessor; + +// @public (undocumented) +export function useEntityListSubTreeParameters(alias: Alias): Alias; + +// @public (undocumented) +export function useEntityListSubTreeParameters(qualifiedEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList): SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList; + +// @public (undocumented) +export function useEntityListSubTreeParameters(qualifiedEntityListOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList; + +// @public (undocumented) +export const useEntityPersistError: (listener: EntityAccessor.EntityEventListenerMap['persistError']) => void; + +// @public (undocumented) +export const useEntityPersistSuccess: (listener: EntityAccessor.EntityEventListenerMap['persistSuccess']) => void; + +// @public (undocumented) +export const useEntitySubTree: (qualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity, ...treeId: [TreeRootId | undefined] | [ +]) => EntityAccessor; + +// @public (undocumented) +export function useEntitySubTreeParameters(alias: Alias): Alias; + +// @public (undocumented) +export function useEntitySubTreeParameters(qualifiedEntity: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity): SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity; + +// @public (undocumented) +export function useEntitySubTreeParameters(qualifiedSingleEntityOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity; + +// @public (undocumented) +export const useEnvironment: () => Environment; + +// @public (undocumented) +export const useExtendTree: () => (newFragment: ReactNode, options?: Omit) => Promise; + +// @public (undocumented) +export function useField(sugaredRelativeSingleField: string | SugaredRelativeSingleField): FieldAccessor; + +// @public (undocumented) +export function useField(sugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined): FieldAccessor | undefined; + +// @public (undocumented) +export const useGetEntityByKey: () => GetEntityByKey; + +// @public (undocumented) +export const useGetEntityListSubTree: () => (parametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList, ...treeId: [TreeRootId | undefined] | [ +]) => EntityListAccessor; + +// @public (undocumented) +export const useGetEntitySubTree: () => (parametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity, ...treeId: [TreeRootId | undefined] | [ +]) => EntityAccessor; + +// @public (undocumented) +export const useGetTreeFilters: () => (() => TreeFilter[]); + +// @public (undocumented) +export const useHasEntity: () => boolean; + +// @public (undocumented) +export const useLabelMiddleware: () => (it: ReactNode) => ReactNode; + +// @public (undocumented) +export const useMutationState: () => boolean; + +// @public (undocumented) +export const useOnConnectionUpdate: (fieldName: FieldName, listener: EntityAccessor.EntityEventListenerMap['connectionUpdate']) => void; + +// @public (undocumented) +export const usePersist: () => Persist; + +// @public (undocumented) +export const useSortedEntities: (entityList: EntityListAccessor, sortableByField: SugaredFieldProps['field'] | undefined) => SortedEntities; + +// @public (undocumented) +export const useTreeRootId: () => TreeRootId | undefined; + + +export * from "@contember/binding"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-choice-field-ui.api.md b/build/api/react-choice-field-ui.api.md new file mode 100644 index 0000000000..9386564d16 --- /dev/null +++ b/build/api/react-choice-field-ui.api.md @@ -0,0 +1,114 @@ +## API Report File for "@contember/react-choice-field-ui" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { BaseDynamicChoiceField } from '@contember/react-choice-field'; +import { ChoiceFieldProps } from '@contember/react-choice-field'; +import { ComponentType } from 'react'; +import { DynamicMultiChoiceFieldRendererProps } from '@contember/react-choice-field'; +import { DynamicMultipleChoiceFieldProps } from '@contember/react-choice-field'; +import { DynamicSingleChoiceFieldProps } from '@contember/react-choice-field'; +import { FieldContainerProps } from '@contember/ui'; +import { MemoExoticComponent } from 'react'; +import type { Props } from 'react-select'; +import { PublicCommonReactSelectStylesProps } from '@contember/ui'; +import type { RadioProps } from '@contember/ui'; +import { ReactElement } from 'react'; +import { SimpleDynamicSingleChoiceFieldProps } from '@contember/react-choice-field'; +import { SingleChoiceFieldRendererProps } from '@contember/react-choice-field'; +import { StaticSingleChoiceFieldProps } from '@contember/react-choice-field'; + +// @public (undocumented) +export type ChoiceFieldDictionary = typeof choiceFieldDictionary; + +// @public (undocumented) +export const choiceFieldDictionary: { + choiceField: { + createNew: { + confirmButtonText: string; + cancelButtonText: string; + dialogTitle: string; + }; + }; +}; + +// @public (undocumented) +export const MultiSelectField: ComponentType; + +// @internal (undocumented) +export const MultiSelectFieldInner: MemoExoticComponent<({ currentValues, data, errors, onAdd, onClear, onRemove, reactSelectProps, placeholder, menuZIndex, onMove, onSearch, isLoading, createNewForm, onAddNew, ...props }: MultiSelectFieldInnerProps) => JSX.Element>; + +// @public (undocumented) +export type MultiSelectFieldInnerProps = DynamicMultiChoiceFieldRendererProps & MultiSelectFieldRendererPublicProps & { + onAddNew?: () => void; +}; + +// @public (undocumented) +export type MultiSelectFieldProps = MultiSelectFieldRendererPublicProps & DynamicMultipleChoiceFieldProps; + +// @internal (undocumented) +export const MultiSelectFieldRenderer: MemoExoticComponent<(props: MultiSelectFieldRendererProps) => JSX.Element>; + +// @public (undocumented) +export type MultiSelectFieldRendererProps = MultiSelectFieldInnerProps & BaseDynamicChoiceField; + +// @public (undocumented) +export type MultiSelectFieldRendererPublicProps = Pick & PublicCommonReactSelectStylesProps & { + placeholder?: string; + reactSelectProps?: Partial>; + createNewForm?: ReactElement; +}; + +export { PublicCommonReactSelectStylesProps } + +// @public (undocumented) +export const RadioField: ComponentType; + +// @public (undocumented) +export type RadioFieldProps = RadioFieldRendererPublicProps & (StaticSingleChoiceFieldProps | SimpleDynamicSingleChoiceFieldProps); + +// @public (undocumented) +export const RadioFieldRenderer: MemoExoticComponent<((props: RadioFieldRendererProps) => JSX.Element)>; + +// @public (undocumented) +export type RadioFieldRendererProps = SingleChoiceFieldRendererProps & RadioFieldRendererPublicProps; + +// @public (undocumented) +export type RadioFieldRendererPublicProps = Omit & Pick; + +// @public (undocumented) +export const SelectField: ComponentType; + +// @public (undocumented) +export const SelectFieldInner: ({ placeholder, allowNull, currentValue, data, errors, menuZIndex, onSelect, onClear, reactSelectProps, onSearch, isLoading, createNewForm, onAddNew, ...props }: SelectFieldInnerProps) => JSX.Element; + +// @public (undocumented) +export type SelectFieldInnerProps = SingleChoiceFieldRendererProps & SelectFieldRendererPublicProps & { + onAddNew?: () => void; +}; + +// @public (undocumented) +export type SelectFieldProps = SelectFieldRendererPublicProps & (StaticSingleChoiceFieldProps | DynamicSingleChoiceFieldProps); + +// @internal (undocumented) +export const SelectFieldRenderer: MemoExoticComponent<(({ createNewForm, ...props }: SelectFieldRendererProps) => JSX.Element)>; + +// @public (undocumented) +export type SelectFieldRendererProps = SelectFieldInnerProps & ChoiceFieldProps; + +// @public (undocumented) +export type SelectFieldRendererPublicProps = Omit & PublicCommonReactSelectStylesProps & { + placeholder?: string; + allowNull?: boolean; + reactSelectProps?: Partial>; + createNewForm?: ReactElement; +}; + + +export * from "@contember/react-choice-field"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-choice-field.api.md b/build/api/react-choice-field.api.md new file mode 100644 index 0000000000..032e5c8efb --- /dev/null +++ b/build/api/react-choice-field.api.md @@ -0,0 +1,282 @@ +## API Report File for "@contember/react-choice-field" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ComponentType } from 'react'; +import { EntityAccessor } from '@contember/react-binding'; +import { EntityId } from '@contember/react-binding'; +import { Environment } from '@contember/react-binding'; +import { ErrorAccessor } from '@contember/react-binding'; +import { FieldValue } from '@contember/react-binding'; +import { Filter } from '@contember/react-binding'; +import type { FunctionComponent } from 'react'; +import { default as Fuse_2 } from 'fuse.js'; +import { NamedExoticComponent } from 'react'; +import { OptionallyVariableFieldValue } from '@contember/react-binding'; +import { QualifiedEntityList } from '@contember/react-binding'; +import { QualifiedFieldList } from '@contember/react-binding'; +import { ReactElement } from 'react'; +import { ReactNode } from 'react'; +import { SugarableRelativeSingleField } from '@contember/react-binding'; +import { SugaredFieldProps } from '@contember/react-binding'; +import { SugaredQualifiedEntityList } from '@contember/react-binding'; +import { SugaredQualifiedFieldList } from '@contember/react-binding'; +import { SugaredRelativeEntityList } from '@contember/react-binding'; +import { SugaredRelativeSingleEntity } from '@contember/react-binding'; +import { SugaredRelativeSingleField } from '@contember/react-binding'; +import { UnsugarableFieldEventListeners } from '@contember/react-binding'; + +// @public (undocumented) +export type AllDynamicMultiChoiceFieldRendererProps = DynamicMultiChoiceFieldRendererProps & DynamicMultipleChoiceFieldProps & RendererOwnProps; + +// @public (undocumented) +export type AllStaticSingleChoiceFieldRendererProps = StaticSingleChoiceFieldProps & SingleChoiceFieldRendererProps & OwnRendererProps; + +// @public (undocumented) +export interface BaseChoiceFieldRendererProps { + // (undocumented) + data: ChoiceFieldOptions; + // (undocumented) + errors: ErrorAccessor.Error[] | undefined; + // (undocumented) + isLoading?: boolean; + // (undocumented) + onSearch?: (input: string) => void; +} + +// @public (undocumented) +export type BaseDynamicChoiceField = BaseDynamicChoiceFieldOptions & SelectFuseOptionsProps & { + searchByFields?: ChoiceFieldSearchByFields; + lazy?: LazyChoiceFieldSettings; + renderedOptionsLimit?: number; + transformOptions?: (data: ChoiceFieldOptions, input: string | undefined) => ChoiceFieldOptions; + sortableBy?: SugaredFieldProps['field']; +}; + +// @public (undocumented) +export type BaseDynamicChoiceFieldOptions = DynamicChoiceFieldOptionProps | DynamicChoiceFieldWithCustomLabelProps | LegacyChoiceFieldWithOptionRenderer; + +// @public (undocumented) +export namespace ChoiceFieldData { + // @deprecated (undocumented) + export type BaseChoiceFieldMetadata = BaseChoiceFieldRendererProps; + // @deprecated (undocumented) + export type MultiChoiceFieldMetadata = MultiChoiceFieldRendererProps; + // @deprecated (undocumented) + export type Options = ChoiceFieldOptions; + // @deprecated (undocumented) + export type SingleChoiceFieldMetadata = SingleChoiceFieldRendererProps; + // @deprecated (undocumented) + export type SingleOption = ChoiceFieldSingleOption; +} + +// @public (undocumented) +export type ChoiceFieldOptions = ChoiceFieldSingleOption[]; + +// @public (undocumented) +export type ChoiceFieldOptionsAsEntityList = string | (SugaredQualifiedEntityList['entities'] & ForbidKeys) | (SugaredQualifiedEntityList & ForbidKeys); + +// @public (undocumented) +export type ChoiceFieldOptionsAsFieldList = string | (SugaredQualifiedFieldList['fields'] & ForbidKeys) | (SugaredQualifiedFieldList & ForbidKeys); + +// @public (undocumented) +export type ChoiceFieldProps = StaticSingleChoiceFieldProps | DynamicSingleChoiceFieldProps; + +// @public (undocumented) +export type ChoiceFieldSearchByFields = SugaredRelativeSingleField['field'] | SugaredRelativeSingleField['field'][]; + +// @public (undocumented) +export interface ChoiceFieldSingleOption { + // (undocumented) + description?: ReactNode; + // (undocumented) + key: string; + // (undocumented) + label: ReactNode; + // (undocumented) + searchKeywords: string; + // (undocumented) + value: Value; +} + +// @public (undocumented) +export const createChoiceField: ({ FieldRenderer }: { + FieldRenderer: ComponentType | AllStaticSingleChoiceFieldRendererProps>; +}) => FunctionComponent; + +// @public (undocumented) +export const createDynamicMultiChoiceField: ({ FieldRenderer }: { + FieldRenderer: ComponentType>; +}) => NamedExoticComponent>; + +// @public (undocumented) +export const createStaticSingleChoiceField: ({ FieldRenderer }: { + FieldRenderer: ComponentType>; +}) => NamedExoticComponent & { +options: OptionallyVariableStaticOption[]; +} & Omit>>; + +// @public (undocumented) +export type DesugaredOptionPath = QualifiedFieldList | QualifiedEntityList; + +// @public (undocumented) +export type DynamicChoiceFieldOptionProps = { + options: ChoiceFieldOptionsAsFieldList; +}; + +// @public (undocumented) +export type DynamicChoiceFieldWithCustomLabelProps = { + options: ChoiceFieldOptionsAsEntityList; + optionLabel: ReactNode; +}; + +// @public (undocumented) +export type DynamicMultiChoiceFieldRendererProps = MultiChoiceFieldRendererProps; + +// @public (undocumented) +export type DynamicMultipleChoiceFieldProps = SugaredRelativeEntityList & BaseDynamicChoiceField & ({} | DynamicMultipleChoiceWithConnectingEntityFieldProps); + +// @public (undocumented) +export interface DynamicMultipleChoiceWithConnectingEntityFieldProps { + // (undocumented) + connectingEntityField: string | SugaredRelativeSingleEntity; +} + +// @public (undocumented) +export type DynamicSingleChoiceFieldProps = SugaredRelativeSingleEntity & BaseDynamicChoiceField; + +// @public (undocumented) +export type ForbidKeys = { + [K in Exclude]?: never; +}; + +// @public (undocumented) +export type LazyChoiceFieldSettings = undefined | boolean | { + limit?: number; + initialLimit?: number; + createFilter?: (input: string) => Filter; + inputDebounceDelay?: number; +}; + +// @public @deprecated (undocumented) +export interface LegacyChoiceFieldWithOptionRenderer { + // (undocumented) + options: string | SugaredQualifiedEntityList['entities'] | SugaredQualifiedEntityList; + // (undocumented) + optionsStaticRender: ReactElement | ((environment: Environment) => ReactElement); + // (undocumented) + renderOption: (entityAccessor: EntityAccessor) => ReactNode; +} + +// @public (undocumented) +export interface MultiChoiceFieldRendererProps extends BaseChoiceFieldRendererProps { + // (undocumented) + currentValues: ChoiceFieldSingleOption[]; + // (undocumented) + onAdd: (option: Value) => void; + // (undocumented) + onClear: () => void; + // (undocumented) + onMove?: (oldIndex: number, newIndex: number) => void; + // (undocumented) + onRemove: (option: Value) => void; +} + +// @public (undocumented) +export interface NormalizedStaticOption extends StaticOption { + // (undocumented) + searchKeywords: string; + // (undocumented) + value: FieldValue; +} + +// @public (undocumented) +export interface OptionallyVariableStaticOption extends StaticOption { + // (undocumented) + searchKeywords?: string; + // (undocumented) + value: OptionallyVariableFieldValue; +} + +// @public (undocumented) +export const renderDynamicChoiceFieldStatic: (props: BaseDynamicChoiceField, environment: Environment, filter?: Filter | undefined) => { + listSubTree: ReactElement; + renderedOption: ReactElement; +}; + +// @public (undocumented) +export interface SelectFuseOptionsProps { + // (undocumented) + fuseOptions?: Fuse_2.IFuseOptions> | boolean; +} + +// @public (undocumented) +export interface SelectOptions { + // (undocumented) + allOptions: ChoiceFieldOptions; + // (undocumented) + isLoading: boolean; + // (undocumented) + onSearch: (input: string) => void; + // (undocumented) + options: ChoiceFieldOptions; +} + +// @public (undocumented) +export type SimpleDynamicSingleChoiceFieldProps = SugaredRelativeSingleEntity & BaseDynamicChoiceFieldOptions & Pick; + +// @public (undocumented) +export interface SingleChoiceFieldRendererProps extends BaseChoiceFieldRendererProps { + // (undocumented) + currentValue: ChoiceFieldSingleOption | null; + // (undocumented) + onClear: () => void; + // (undocumented) + onSelect: (newValue: Value) => void; +} + +// @public (undocumented) +export interface StaticOption { + // (undocumented) + description?: ReactNode; + // (undocumented) + label: ReactNode; +} + +// @public (undocumented) +export type StaticSingleChoiceFieldProps = SugaredRelativeSingleField & SelectFuseOptionsProps & { + options: OptionallyVariableStaticOption[]; +}; + +// @public (undocumented) +export const useCurrentlyChosenEntities: (optionProps: BaseDynamicChoiceField, ids: EntityId[]) => EntityAccessor[]; + +// @public (undocumented) +export const useDesugaredOptionPath: (props: BaseDynamicChoiceField, filter: Filter | undefined) => DesugaredOptionPath; + +// @public (undocumented) +export const useDynamicMultipleChoiceField: (props: DynamicMultipleChoiceFieldProps) => DynamicMultiChoiceFieldRendererProps; + +// @public (undocumented) +export const useDynamicSingleChoiceField: (props: DynamicSingleChoiceFieldProps) => SingleChoiceFieldRendererProps; + +// @public (undocumented) +export const useSelectOptions: (optionProps: BaseDynamicChoiceField, additionalAccessors?: EntityAccessor[]) => SelectOptions; + +// @public (undocumented) +export const useStaticSingleChoiceField: (props: StaticSingleChoiceFieldProps) => SingleChoiceFieldRendererProps; + +// Warnings were encountered during analysis: +// +// src/ChoiceField.tsx:15:31 - (ae-forgotten-export) The symbol "AllDynamicSingleChoiceFieldRenderer" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-datagrid-ui.api.md b/build/api/react-datagrid-ui.api.md new file mode 100644 index 0000000000..ad772400cb --- /dev/null +++ b/build/api/react-datagrid-ui.api.md @@ -0,0 +1,470 @@ +## API Report File for "@contember/react-datagrid-ui" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { BooleanCellRendererProps } from '@contember/react-datagrid'; +import { BooleanFilterArtifacts } from '@contember/react-datagrid'; +import { CoalesceCellRendererProps } from '@contember/react-datagrid'; +import { CoalesceFieldViewProps } from '@contember/react-binding-ui'; +import { CoalesceTextFilterArtifacts } from '@contember/react-datagrid'; +import { ComponentType } from 'react'; +import { ControlledDataGridProps } from '@contember/react-datagrid'; +import { DataGridColumnCommonProps } from '@contember/react-datagrid'; +import { DataGridColumnProps } from '@contember/react-datagrid'; +import { DataGridOrderDirection } from '@contember/react-datagrid'; +import { DataGridProps } from '@contember/react-datagrid'; +import { DataGridRendererInnerProps } from '@contember/react-datagrid'; +import { DataGridRendererProps } from '@contember/react-datagrid'; +import { DateCellRendererProps } from '@contember/react-datagrid'; +import { DateFieldViewFormattingProps } from '@contember/react-binding-ui'; +import { DateRangeFilterArtifacts } from '@contember/react-datagrid'; +import { EmptyMessageProps } from '@contember/react-binding-ui'; +import { EntityAccessor } from '@contember/react-binding'; +import { EntityId } from '@contember/react-binding'; +import { EntityListBaseProps } from '@contember/react-binding'; +import { EnumCellFilterArtifacts } from '@contember/react-datagrid'; +import { EnumCellRendererProps } from '@contember/react-datagrid'; +import { FieldFallbackViewProps } from '@contember/react-binding-ui'; +import { FieldFallbackViewPublicProps } from '@contember/react-binding-ui'; +import { FieldValue } from '@contember/binding'; +import { FilterRendererProps } from '@contember/react-datagrid'; +import { FunctionComponent } from 'react'; +import { GenericTextCellFilterArtifacts } from '@contember/react-datagrid'; +import { HasManySelectProps } from '@contember/react-datagrid'; +import { HasOneSelectProps } from '@contember/react-datagrid'; +import { Justification } from '@contember/ui'; +import { MemoExoticComponent } from 'react'; +import { NamedExoticComponent } from 'react'; +import { NumberCellRendererProps } from '@contember/react-datagrid'; +import { NumberFilterArtifacts } from '@contember/react-datagrid'; +import { ReactElement } from 'react'; +import { ReactNode } from 'react'; +import { SelectCellArtifacts } from '@contember/react-datagrid'; +import { SelectCellFilterExtraProps } from '@contember/react-datagrid'; +import { Serializable } from '@contember/react-utils'; +import { SugarableRelativeSingleField } from '@contember/react-binding'; +import { SugaredRelativeEntityList } from '@contember/binding'; +import { SugaredRelativeSingleField } from '@contember/react-binding'; +import { TextCellRendererProps } from '@contember/react-datagrid'; +import { TextFilterArtifacts } from '@contember/react-datagrid'; + +// @public +export const BooleanCell: FunctionComponent ReactNode) | undefined; +} & FieldFallbackViewProps>; + +// @public (undocumented) +export const BooleanCellFilter: ({ setFilter, filter }: FilterRendererProps) => JSX.Element; + +// @public +export const CoalesceTextCell: FunctionComponent>; + +// @public +export const ControlledDataGrid: NamedExoticComponent>>>; + +// @public (undocumented) +export const createDataGridContainer: ({ Header, Content, Footer }: { + Header: ComponentType; + Content: ComponentType; + Footer: ComponentType; +}) => NamedExoticComponent; + +// @public (undocumented) +export const createDataGridContent: ({ Table, Grid }: { + Table: ComponentType; + Grid: ComponentType; +}) => ComponentType; + +// @public +export const DataGrid: ComponentType>>>; + +// @public (undocumented) +export interface DataGridCellPublicProps { + // (undocumented) + canBeHidden?: boolean; + // (undocumented) + hidden?: boolean; + // (undocumented) + justification?: Justification; + // (undocumented) + shrunk?: boolean; +} + +// @public (undocumented) +export type DataGridCellsDictionary = typeof dataGridCellsDictionary; + +// @public (undocumented) +export const dataGridCellsDictionary: { + dataGridCells: { + includeNull: string; + booleanCell: { + includeTrue: string; + includeFalse: string; + includeNull: string; + }; + dateCell: { + fromLabel: string; + toLabel: string; + }; + textCell: { + matches: string; + doesNotMatch: string; + matchesExactly: string; + startsWith: string; + endsWith: string; + queryPlaceholder: string; + includeNull: string; + excludeNull: string; + }; + numberCell: { + equals: string; + greaterThan: string; + lessThan: string; + }; + }; +}; + +// @public (undocumented) +export const DataGridColumnHiding: ({ desiredState, displayedState, stateMethods: { setIsColumnHidden }, allowColumnVisibilityControls, }: DataGridColumnHidingProps) => ReactElement | null; + +// @public (undocumented) +export type DataGridColumnHidingProps = DataGridRenderingCommonProps & DataGridColumnHidingPublicProps; + +// @public (undocumented) +export type DataGridColumnHidingPublicProps = { + allowColumnVisibilityControls?: boolean; +}; + +// @public (undocumented) +export type DataGridColumnPublicProps = DataGridCellPublicProps & DataGridHeaderCellPublicProps; + +// @public (undocumented) +export const DataGridContainer: NamedExoticComponent | undefined; +} & DataGridTableRowPublicProps & EntityListBaseProps & DataGridTilesPublicProps & DataGridRenderingCommonProps>; + +// @public (undocumented) +export type DataGridContainerProps = typeof DataGridContainer extends ComponentType ? P : never; + +// @public (undocumented) +export type DataGridContainerPublicProps = Omit; + +// @public (undocumented) +export const DataGridContent: ComponentType<{ + emptyMessage?: ReactNode; + emptyMessageComponent?: ComponentType | undefined; +} & DataGridTableRowPublicProps & EntityListBaseProps & DataGridTilesPublicProps & DataGridRenderingCommonProps>; + +// @public (undocumented) +export type DataGridDictionary = typeof dataGridDictionary; + +// @public (undocumented) +export const dataGridDictionary: { + dataGrid: { + emptyMessage: { + text: string; + }; + columnFiltering: { + showMenuButton: { + text: string; + }; + heading: string; + emptyMessage: { + text: string; + }; + columnColumn: { + text: string; + }; + filterColumn: { + text: string; + }; + addFilterButton: { + text: string; + }; + }; + columnHiding: { + showMenuButton: { + text: string; + }; + heading: string; + }; + paging: { + first: string; + previous: string; + next: string; + last: string; + status: { + unknownPageTotal: string; + knownPageTotal: string; + itemCount: string; + }; + }; + }; +}; + +// @public (undocumented) +export const DataGridFooter: NamedExoticComponent; + +// @public (undocumented) +export type DataGridFooterProps = DataGridFooterPublicProps & DataGridRenderingCommonProps; + +// @public (undocumented) +export type DataGridFooterPublicProps = {}; + +// @public (undocumented) +export function DataGridFullFilters({ desiredState, stateMethods, allowAggregateFilterControls, }: DataGridFullFiltersProps): ReactElement | null; + +// @public (undocumented) +export type DataGridFullFiltersProps = DataGridRenderingCommonProps & DataGridFullFiltersPublicProps; + +// @public (undocumented) +export type DataGridFullFiltersPublicProps = { + allowAggregateFilterControls?: boolean; +}; + +// @public (undocumented) +export const DataGridHeader: NamedExoticComponent; + +// @public (undocumented) +export function DataGridHeaderCell(props: DataGridHeaderCellProps): ReactElement; + +// @public (undocumented) +export const DataGridHeaderCellFilterDropdown: (props: DataGridHeaderCellFilterDropdownProps) => JSX.Element | null; + +// @public (undocumented) +export type DataGridHeaderCellFilterDropdownProps = DataGridRenderingCommonProps & { + columnKey: string; + column: DataGridColumnProps; +}; + +// @public (undocumented) +export type DataGridHeaderCellProps = DataGridRenderingCommonProps & { + columnKey: string; + column: DataGridColumnProps; +}; + +// @public (undocumented) +export interface DataGridHeaderCellPublicProps { + // (undocumented) + ascOrderIcon?: ReactNode; + // (undocumented) + descOrderIcon?: ReactNode; + // (undocumented) + header?: ReactNode; + // (undocumented) + headerJustification?: Justification; + // (undocumented) + shrunk?: boolean; +} + +// @public (undocumented) +export type DataGridHeaderProps = DataGridRenderingCommonProps & DataGridHeaderPublicProps; + +// @public (undocumented) +export type DataGridHeaderPublicProps = DataGridLayoutControlPublicProps & DataGridColumnHidingPublicProps & DataGridFullFiltersPublicProps; + +// @public (undocumented) +export const DataGridLayoutControl: ({ stateMethods: { setLayout }, desiredState: { layout }, tile }: DataGridLayoutControlProps) => JSX.Element | null; + +// @public (undocumented) +export type DataGridLayoutControlProps = DataGridRenderingCommonProps & DataGridLayoutControlPublicProps; + +// @public (undocumented) +export type DataGridLayoutControlPublicProps = { + tile?: ReactNode; +}; + +// @public (undocumented) +export const DataGridPagingSummary: ({ pagingInfo, displayedState: { paging: { pageIndex } } }: DataGridPagingSummaryProps) => JSX.Element; + +// @public (undocumented) +export type DataGridPagingSummaryProps = DataGridRenderingCommonProps; + +// @public (undocumented) +export type DataGridRenderingCommonProps = DataGridRendererInnerProps; + +// @public (undocumented) +export const DataGridTable: NamedExoticComponent; + +// @public (undocumented) +export type DataGridTableHead = DataGridRenderingCommonProps; + +// @public (undocumented) +export const DataGridTableHead: (props: DataGridTableHead) => JSX.Element; + +// @public (undocumented) +export type DataGridTableProps = DataGridRenderingCommonProps & DataGridTablePublicProps & EntityListBaseProps; + +// @public (undocumented) +export type DataGridTablePublicProps = { + emptyMessage?: ReactNode; + emptyMessageComponent?: ComponentType; +} & DataGridTableRowPublicProps; + +// @public (undocumented) +export const DataGridTableRow: ({ desiredState, displayedState, onEntityClick, isEntitySelected, selectedEntityIds }: DataGridTableRowProps) => JSX.Element; + +// @public (undocumented) +export type DataGridTableRowProps = DataGridRenderingCommonProps & DataGridTableRowPublicProps; + +// @public (undocumented) +export type DataGridTableRowPublicProps = { + onEntityClick?: (entity: EntityAccessor) => void; + isEntitySelected?: (entity: EntityAccessor) => boolean; + selectedEntityIds?: EntityId[]; +}; + +// @public (undocumented) +export const DataGridTiles: MemoExoticComponent<({ accessor, tileSize, tile, emptyMessage, emptyMessageComponent }: DataGridTilesProps) => JSX.Element>; + +// @public (undocumented) +export type DataGridTilesProps = DataGridRenderingCommonProps & DataGridTilesPublicProps; + +// @public (undocumented) +export type DataGridTilesPublicProps = { + tile?: ReactNode; + tileSize?: number; + emptyMessage?: ReactNode; + emptyMessageComponent?: ComponentType; +}; + +// @public +export const DateCell: FunctionComponent; + +// @public (undocumented) +export type DateCellValueRendererProps = DateCellRendererProps & DateFieldViewFormattingProps & FieldFallbackViewPublicProps; + +// @public +export const EnumCell: FunctionComponent; +format?: ((value: string | null) => ReactNode) | undefined; +initialFilter?: EnumCellFilterArtifacts | undefined; +} & DataGridCellPublicProps & DataGridHeaderCellPublicProps & FieldFallbackViewProps & { +format?: ((value: string | null) => ReactNode) | undefined; +} & NullConditionFilterPublicProps & { +options: Record; +}>; + +// @public (undocumented) +export const EnumCellFilter: ({ filter, setFilter, environment, field, options, showNullConditionFilter }: FilterRendererProps) => JSX.Element; + +// @public (undocumented) +export type EnumCellFilterExtraProps = NullConditionFilterPublicProps & EnumCellRendererProps & { + options: Record; +}; + +// @public (undocumented) +export type EnumCellValueRendererProps = EnumCellRendererProps & FieldFallbackViewPublicProps & { + format?: (value: string | null) => ReactNode; +}; + +// @public +export const GenericCell: FunctionComponent; + +// @public (undocumented) +export const GenericTextCellFilter: ({ filter, setFilter }: { + filter: Filter; + setFilter: (filter: Filter) => void; +}) => JSX.Element; + +// @public +export const HasManyAbsentCell: FunctionComponent; +children: ReactNode; +} & DataGridCellPublicProps & DataGridHeaderCellPublicProps>; + +// @public (undocumented) +export const HasManyAbsentCellFilter: ({ filter, setFilter }: FilterRendererProps) => JSX.Element; + +// @public +export const HasManySelectCell: FunctionComponent; + +// @public +export const HasOneSelectCell: FunctionComponent; + +// @public (undocumented) +export type NullConditionArtifacts = { + nullCondition: boolean; +}; + +// @public (undocumented) +export const NullConditionFilter: ({ filter, setFilter, field, environment, showNullConditionFilter }: NullConditionFilterProps) => JSX.Element | null; + +// @public (undocumented) +export type NullConditionFilterProps = FilterRendererProps & NullConditionFilterPublicProps & { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type NullConditionFilterPublicProps = { + showNullConditionFilter?: boolean; +}; + +// @public +export const NumberCell: FunctionComponent ReactNode) | undefined; +} & NullConditionFilterPublicProps>; + +// @public (undocumented) +export const NumberCellFilter: ({ filter, setFilter, environment, field, showNullConditionFilter }: FilterRendererProps) => JSX.Element; + +// @public (undocumented) +export type NumberCellFilterExtraProps = NullConditionFilterPublicProps & NumberCellRendererProps; + +// @public (undocumented) +export type NumberCellValueRendererProps = NumberCellRendererProps & FieldFallbackViewPublicProps & { + format?: (value: number | null) => ReactNode; +}; + +// @public +export const SelectCellFilter: ({ filter, setFilter, options, allOptions, onSearch, isLoading }: SelectCellFilterProps) => JSX.Element; + +// @public (undocumented) +export type SelectCellFilterProps = FilterRendererProps & SelectCellFilterExtraProps; + +// @public +export const TextCell: FunctionComponent ReactNode) | undefined; +}>; + +// @public (undocumented) +export const TextCellFilter: ({ filter, setFilter, ...props }: FilterRendererProps) => JSX.Element; + +// @public (undocumented) +export type TextCellValueRendererProps = TextCellRendererProps & FieldFallbackViewPublicProps & { + format?: (value: string | null) => ReactNode; +}; + + +export * from "@contember/react-datagrid"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-datagrid.api.md b/build/api/react-datagrid.api.md new file mode 100644 index 0000000000..f4baa02a6f --- /dev/null +++ b/build/api/react-datagrid.api.md @@ -0,0 +1,503 @@ +## API Report File for "@contember/react-datagrid" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { BaseDynamicChoiceField } from '@contember/react-choice-field'; +import { ComponentType } from 'react'; +import { EntityId } from '@contember/react-binding'; +import { EntityListAccessor } from '@contember/react-binding'; +import { EntityListBaseProps } from '@contember/react-binding'; +import { Environment } from '@contember/react-binding'; +import { Filter } from '@contember/react-binding'; +import { FunctionComponent } from 'react'; +import { Input } from '@contember/client'; +import { NamedExoticComponent } from 'react'; +import { OrderBy } from '@contember/react-binding'; +import { Provider } from 'react'; +import { QualifiedEntityList } from '@contember/react-binding'; +import { ReactElement } from 'react'; +import { ReactNode } from 'react'; +import { SelectOptions } from '@contember/react-choice-field'; +import { Serializable } from '@contember/react-utils'; +import { SugarableRelativeSingleField } from '@contember/react-binding'; +import { SugaredFilter } from '@contember/react-binding'; +import { SugaredOrderBy } from '@contember/react-binding'; +import { SugaredQualifiedEntityList } from '@contember/react-binding'; +import { SugaredRelativeEntityList } from '@contember/react-binding'; +import { SugaredRelativeSingleEntity } from '@contember/react-binding'; +import { TreeRootId } from '@contember/react-binding'; + +// @public (undocumented) +export type BooleanCellProps = DataGridColumnCommonProps & BooleanCellRendererProps & { + disableOrder?: boolean; + initialOrder?: DataGridOrderDirection; + initialFilter?: BooleanFilterArtifacts; +}; + +// @public (undocumented) +export type BooleanCellRendererProps = { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type BooleanFilterArtifacts = { + includeTrue: boolean; + includeFalse: boolean; + includeNull: boolean; +}; + +// @public (undocumented) +export type CoalesceCellRendererProps = { + fields: (SugarableRelativeSingleField | string)[]; + initialFilter?: CoalesceTextFilterArtifacts; +}; + +// @public (undocumented) +export type CoalesceTextCellProps = DataGridColumnCommonProps & CoalesceCellRendererProps & { + initialFilter?: CoalesceTextFilterArtifacts; +}; + +// @public (undocumented) +export type CoalesceTextFilterArtifacts = { + mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch'; + query: string; +}; + +// @public (undocumented) +export type ControlledDataGridProps

= { + state: DataGridState; + stateMethods: DataGridStateMethods; +} & P; + +// @public (undocumented) +export const createBooleanCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createCoalesceTextCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createControlledDataGrid:

(Renderer: ComponentType

>) => NamedExoticComponent>>>; + +// @public (undocumented) +export const createDataGrid:

(Renderer: ComponentType & P>) => ComponentType>>>; + +// @public (undocumented) +export const createDataGridRenderer: ({ Fallback, Container, staticRender, columnStaticRender }: { + Fallback: ComponentType<{ + children: ReactNode; + }>; + Container: ComponentType & ContainerProps>; + staticRender?: ((props: DataGridRendererInnerProps & ContainerProps) => ReactNode) | undefined; + columnStaticRender?: ((props: { + column: DataGridColumnProps; + }) => ReactNode) | undefined; +}) => NamedExoticComponent & ContainerProps>; + +// @public (undocumented) +export const createDateCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createEnumCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + format?: ((value: string | null) => ReactNode) | undefined; + initialFilter?: EnumCellFilterArtifacts | undefined; +} & ColumnProps & ValueRendererProps & FilterProps>; + +// @public (undocumented) +export const createGenericCell: () => FunctionComponent; + +// @public (undocumented) +export const createGenericTextCellFilterCondition: (filter: GenericTextCellFilterArtifacts) => Input.Condition; + +// @public (undocumented) +export const createHasManyAbsentCell: ({ FilterRenderer }: { + FilterRenderer: ComponentType>; +}) => FunctionComponent; + children: ReactNode; +} & ColumnProps>; + +// @public (undocumented) +export const createHasManySelectCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createHasManySelectCellRenderer: ({ renderElements, FallbackRenderer }: { + renderElements?: HasManySelectCellElementsRenderer | undefined; + FallbackRenderer?: ComponentType | undefined; +}) => NamedExoticComponent ReactElement) | undefined; +} & FallbackProps>; + +// @public (undocumented) +export const createHasOneSelectCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createHasOneSelectCellRenderer: ({ FallbackRenderer }: { + FallbackRenderer?: ComponentType | undefined; +}) => NamedExoticComponent; + +// @public (undocumented) +export const createNumberCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public (undocumented) +export const createTextCell: ({ FilterRenderer, ValueRenderer }: { + FilterRenderer: ComponentType>; + ValueRenderer: ComponentType; +}) => FunctionComponent; + +// @public +export const DataGridColumn: (props: DataGridColumnProps) => ReactElement; + +// @public (undocumented) +export type DataGridColumnCommonProps = { + columnKey?: string; + children?: ReactNode; +}; + +// @public (undocumented) +export type DataGridColumnFiltering = { + enableFiltering: false; +} | { + enableFiltering?: true; + initialFilter?: FA; + getNewFilter: GetNewFilter; + emptyFilter: FA; + filterRenderer: ComponentType>; +}; + +// @public (undocumented) +export type DataGridColumnKey = string; + +// @public (undocumented) +export type DataGridColumnOrdering = { + enableOrdering: false; +} | { + enableOrdering?: true; + initialOrder?: DataGridOrderDirection; + getNewOrderBy: GetNewOrderBy; +}; + +// @public (undocumented) +export type DataGridColumnProps = DataGridColumnCommonProps & DataGridColumnFiltering & DataGridColumnOrdering & P; + +// @public (undocumented) +export type DataGridColumns

= Map>; + +// @public (undocumented) +export type DataGridFilterArtifact = Serializable; + +// @public (undocumented) +export type DataGridFilterArtifactStore = Record; + +// @public (undocumented) +export type DataGridHiddenColumnsStateStore = Record; + +// @public (undocumented) +export const DataGridKeyProvider: Provider; + +// @public (undocumented) +export type DataGridLayout = 'default' | 'tiles'; + +// @public (undocumented) +export type DataGridOrderDirection = 'asc' | 'desc' | null; + +// @public (undocumented) +export type DataGridOrderDirectionStore = Record>; + +// @public (undocumented) +export type DataGridProps

= { + dataGridKey?: string; + entities: SugaredQualifiedEntityList['entities']; + children: ReactNode; + itemsPerPage?: number | null; +} & P; + +// @public (undocumented) +export type DataGridRendererInnerProps = { + desiredState: DataGridState; + displayedState: DataGridState; + stateMethods: DataGridStateMethods; + pagingInfo: GridPagingInfo; + environment: Environment; + accessor: EntityListAccessor; + children?: ReactNode; +}; + +// @public (undocumented) +export interface DataGridRendererProps { + // (undocumented) + desiredState: DataGridState; + // (undocumented) + displayedState: DataGridState | undefined; + // (undocumented) + environment: Environment; + // (undocumented) + pagingInfo: GridPagingInfo; + // (undocumented) + stateMethods: DataGridStateMethods; + // (undocumented) + treeRootId: TreeRootId | undefined; +} + +// @public (undocumented) +export type DataGridSetColumnFilter = (columnKey: DataGridColumnKey, columnFilter: FA | undefined) => void; + +// @public (undocumented) +export type DataGridSetColumnOrderBy = (columnKey: DataGridColumnKey, columnOrderBy: DataGridOrderDirection | 'next', append?: boolean) => void; + +// @public (undocumented) +export type DataGridSetFilter = (filter: FA | undefined) => void; + +// @public (undocumented) +export type DataGridSetIsColumnHidden = (columnKey: DataGridColumnKey, isHidden: boolean) => void; + +// @public (undocumented) +export type DataGridSetOrderBy = (setOrderBy: DataGridOrderDirection | 'next', append?: boolean) => void; + +// @public (undocumented) +export interface DataGridState { + columns: DataGridColumns; + entities: QualifiedEntityList; + // (undocumented) + filter: Filter; + // (undocumented) + filterArtifacts: DataGridFilterArtifactStore; + // (undocumented) + hiddenColumns: DataGridHiddenColumnsStateStore; + // (undocumented) + layout: DataGridLayout; + orderBy: OrderBy; + // (undocumented) + orderDirections: DataGridOrderDirectionStore; + paging: GridPagingState; +} + +// @public (undocumented) +export interface DataGridStateMethods { + // (undocumented) + setFilter: DataGridSetColumnFilter; + // (undocumented) + setIsColumnHidden: DataGridSetIsColumnHidden; + // (undocumented) + setLayout: SetDataGridView; + // (undocumented) + setOrderBy: DataGridSetColumnOrderBy; + // (undocumented) + updatePaging: DispatchChangePage; +} + +// @public (undocumented) +export type DateCellProps = DateCellRendererProps & DataGridColumnCommonProps & { + disableOrder?: boolean; + initialOrder?: DataGridOrderDirection; + initialFilter?: DateRangeFilterArtifacts; +}; + +// @public (undocumented) +export type DateCellRendererProps = { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type DateRangeFilterArtifacts = { + start: string | null; + end: string | null; +}; + +// @public (undocumented) +export type DispatchChangePage = (action: GridPagingAction) => void; + +// @public (undocumented) +export type EnumCellFilterArtifacts = { + values: string[]; + nullCondition: boolean; +}; + +// @public (undocumented) +export type EnumCellProps = DataGridColumnCommonProps & EnumCellRendererProps & { + options: Record; + format?: (value: string | null) => ReactNode; + initialFilter?: EnumCellFilterArtifacts; +}; + +// @public (undocumented) +export type EnumCellRendererProps = { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type FilterRendererProps = { + filter: FA; + setFilter: DataGridSetFilter; + environment: Environment; +} & FilterProps; + +// @public (undocumented) +export type GenericCellProps = DataGridColumnCommonProps; + +// @public (undocumented) +export type GenericTextCellFilterArtifacts = { + mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch'; + query: string; +}; + +// @public (undocumented) +export type GetNewFilter = (filterArtifact: FA, options: GetNewFilterOptions) => SugaredFilter | undefined; + +// @public (undocumented) +export interface GetNewFilterOptions { + // (undocumented) + environment: Environment; +} + +// @public (undocumented) +export type GetNewOrderBy = (newDirection: DataGridOrderDirection, options: GetNewOrderByOptions) => SugaredOrderBy | undefined; + +// @public (undocumented) +export interface GetNewOrderByOptions { + // (undocumented) + environment: Environment; +} + +// @public (undocumented) +export type GridPagingAction = { + type: 'goToPage'; + newPageIndex: number; +} | { + type: 'setItemsPerPage'; + newItemsPerPage: number | null; +} | { + type: 'goToNextPage' | 'goToPreviousPage' | 'goToFirstPage'; +}; + +// @public (undocumented) +export type GridPagingInfo = { + totalCount: number | undefined; + pagesCount: number | undefined; +}; + +// @public (undocumented) +export type GridPagingState = { + pageIndex: number; + itemsPerPage: number | null; +}; + +// @public (undocumented) +export type HasManyAbsentCellProps = DataGridColumnCommonProps & SugaredRelativeEntityList & { + render: ComponentType; + children: ReactNode; +}; + +// @public (undocumented) +export type HasManySelectCellElementsRenderer = (elements: ReactNode[]) => ReactElement; + +// @public (undocumented) +export type HasManySelectProps = HasManySelectRendererProps & DataGridColumnCommonProps; + +// @public (undocumented) +export type HasManySelectRendererProps = SugaredRelativeEntityList & BaseDynamicChoiceField & { + initialFilter?: SelectCellArtifacts; +}; + +// @public (undocumented) +export type HasOneSelectProps = HasOneSelectRendererProps & DataGridColumnCommonProps; + +// @public (undocumented) +export type HasOneSelectRendererProps = BaseDynamicChoiceField & SugaredRelativeSingleEntity & { + initialFilter?: SelectCellArtifacts; +}; + +// @public (undocumented) +export type NumberCellProps = DataGridColumnCommonProps & NumberCellRendererProps & { + disableOrder?: boolean; + initialOrder?: DataGridOrderDirection; + initialFilter?: NumberFilterArtifacts; +}; + +// @public (undocumented) +export type NumberCellRendererProps = { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type NumberFilterArtifacts = { + mode: 'eq' | 'gte' | 'lte'; + query: number | null; + nullCondition: boolean; +}; + +// @public (undocumented) +export type SelectCellArtifacts = { + id: EntityId[]; + nullCondition: boolean; +}; + +// @public (undocumented) +export type SelectCellFilterExtraProps = SelectOptions; + +// @public (undocumented) +export type SetDataGridView = (layout: DataGridLayout) => void; + +// @public (undocumented) +export type TextCellProps = TextCellRendererProps & DataGridColumnCommonProps & { + disableOrder?: boolean; + initialOrder?: DataGridOrderDirection; + initialFilter?: TextFilterArtifacts; +}; + +// @public (undocumented) +export type TextCellRendererProps = { + field: SugarableRelativeSingleField | string; +}; + +// @public (undocumented) +export type TextFilterArtifacts = { + mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch'; + query: string; + nullCondition: boolean; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-form-fields-ui.api.md b/build/api/react-form-fields-ui.api.md new file mode 100644 index 0000000000..b61dafd293 --- /dev/null +++ b/build/api/react-form-fields-ui.api.md @@ -0,0 +1,201 @@ +## API Report File for "@contember/react-form-fields-ui" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ColorInputProps } from '@contember/ui'; +import { ControlProps } from '@contember/ui'; +import { CSSProperties } from 'react'; +import { DateInputProps } from '@contember/ui'; +import { DateTimeInputProps } from '@contember/ui'; +import { EmailInputProps } from '@contember/ui'; +import { Environment } from '@contember/react-binding'; +import { FieldAccessor } from '@contember/react-binding'; +import { FieldBasicProps } from '@contember/react-binding'; +import { FieldContainerProps } from '@contember/ui'; +import { FieldValue } from '@contember/react-binding'; +import { MemoExoticComponent } from 'react'; +import { NamedExoticComponent } from 'react'; +import type { NonOptionalControlProps } from '@contember/ui'; +import { ReactNode } from 'react'; +import { Ref } from 'react'; +import { SearchInputProps } from '@contember/ui'; +import { SugaredRelativeSingleField } from '@contember/react-binding'; +import { TextareaInputProps } from '@contember/ui'; +import { TimeInputProps } from '@contember/ui'; +import { UrlInputProps } from '@contember/ui'; + +// @public (undocumented) +export const CheckboxField: NamedExoticComponent; + +// @public (undocumented) +export type CheckboxFieldProps = SimpleRelativeSingleFieldProps & ControlProps; + +// @public (undocumented) +export const ColorField: NamedExoticComponent; + +// @public (undocumented) +export type ColorFieldProps = SimpleRelativeSingleFieldProps & Omit; + +// @public (undocumented) +export type ControlValueParser = (value: ControlVal | null | undefined, field: FieldAccessor) => FieldVal | null; + +// @public (undocumented) +export const DateField: NamedExoticComponent; + +// @public (undocumented) +export type DateFieldProps = SimpleRelativeSingleFieldProps & DateInputProps; + +// @public (undocumented) +export const DateTimeField: NamedExoticComponent; + +// @public (undocumented) +export type DateTimeFieldProps = SimpleRelativeSingleFieldProps & DateTimeInputProps; + +// @public (undocumented) +export const EmailField: NamedExoticComponent; + +// @public (undocumented) +export type EmailFieldProps = SimpleRelativeSingleFieldProps & Omit; + +// @public (undocumented) +export type FieldValueFormatter = (value: FieldVal | null | undefined, field: FieldAccessor) => ControlVal | null; + +// @public (undocumented) +export const FloatField: NamedExoticComponent; + +// @public (undocumented) +export type FloatFieldProps = SimpleRelativeSingleFieldProps & ControlProps; + +// @public +export const HiddenField: NamedExoticComponent; + +// @public (undocumented) +export type HiddenFieldProps = FieldBasicProps & { + label?: ReactNode; +}; + +// @public (undocumented) +export const NumberField: NamedExoticComponent; + +// @public (undocumented) +export type NumberFieldProps = SimpleRelativeSingleFieldProps & ControlProps; + +// @public (undocumented) +export type RenderedSimpleRelativeSingleFieldProxyExtraPropsKeys = 'className' | 'style'; + +// @public (undocumented) +export type RenderedSimpleRelativeSingleFieldProxyFieldContainerPropsKeys = 'required' | 'size' | 'errors'; + +// @public (undocumented) +export type RenderedSugaredRelativeSingleFieldKeys = 'field'; + +// @public (undocumented) +export const SearchField: NamedExoticComponent; + +// @public (undocumented) +export type SearchFieldProps = SimpleRelativeSingleFieldProps & Omit; + +// @public (undocumented) +export const SimpleRelativeSingleField:

(render: (fieldMetadata: SimpleRelativeSingleFieldMetadata, props: SimpleRelativeSingleFieldProxyExcludeHandledProps

) => ReactNode, displayName: string, defaultProps?: Partial

| undefined) => NamedExoticComponent

; + +// @public (undocumented) +export interface SimpleRelativeSingleFieldMetadata { + // (undocumented) + environment: Environment; + // (undocumented) + field: FieldAccessor; + // (undocumented) + isMutating: boolean; +} + +// @public (undocumented) +export type SimpleRelativeSingleFieldProps = SimpleRelativeSingleFieldProxyProps; + +// @internal (undocumented) +export const SimpleRelativeSingleFieldProxy: MemoExoticComponent<({ render, defaultValue, isNonbearing, onBeforeUpdate, onInitialize, onUpdate, description, display, direction, evenly, footer, horizontal, gap, label, labelDescription, labelPosition, reverse, useLabelElement, width, className, componentClassName, style, errors, field: fieldName, required, size, containerClassName, containerStyle, suppressErrors, ...rest }: SimpleRelativeSingleFieldProxyProps & SimpleRelativeSingleFieldProxyRendererProps) => JSX.Element>; + +// @public (undocumented) +export type SimpleRelativeSingleFieldProxyExcludeHandledProps

= Omit | Exclude | Exclude>; + +// @public (undocumented) +export type SimpleRelativeSingleFieldProxyExtraProps = { + className?: string | undefined; + containerClassName?: string | undefined; + containerStyle?: CSSProperties | undefined; + style?: CSSProperties | undefined; + suppressErrors?: boolean | undefined; +}; + +// @public (undocumented) +export type SimpleRelativeSingleFieldProxyFieldContainerProps = Omit; + +// @public (undocumented) +export type SimpleRelativeSingleFieldProxyProps = SimpleRelativeSingleFieldProxyFieldContainerProps & SugaredRelativeSingleField & SimpleRelativeSingleFieldProxyExtraProps; + +// @public (undocumented) +export type SimpleRelativeSingleFieldProxyRendererProps = { + render: (fieldMetadata: SimpleRelativeSingleFieldMetadata, props: SimpleRelativeSingleFieldProxyExcludeHandledProps) => ReactNode; +}; + +// @public (undocumented) +export const SlugField: NamedExoticComponent; + +// @public (undocumented) +export const SlugFieldInner: NamedExoticComponent; + +// @public (undocumented) +export type SlugFieldProps = SimpleRelativeSingleFieldProps & ControlProps & { + derivedFrom: SugaredRelativeSingleField['field']; + unpersistedHardPrefix?: SlugPrefix; + persistedHardPrefix?: SlugPrefix; + persistedSoftPrefix?: SlugPrefix; + linkToExternalUrl?: boolean; +}; + +// @public (undocumented) +export type SlugPrefix = string | ((environment: Environment) => string); + +// @public @deprecated (undocumented) +export const TextAreaField: NamedExoticComponent; + +// @public +export const TextareaField: NamedExoticComponent; + +// @public (undocumented) +export type TextareaFieldProps = Omit & ControlProps & TextareaInputProps; + +// @public +export const TextField: NamedExoticComponent; + +// @public (undocumented) +export type TextFieldProps = SimpleRelativeSingleFieldProps & ControlProps; + +// @public (undocumented) +export const TimeField: NamedExoticComponent; + +// @public (undocumented) +export type TimeFieldProps = SimpleRelativeSingleFieldProps & TimeInputProps; + +// @public (undocumented) +export const UrlField: NamedExoticComponent; + +// @public (undocumented) +export type UrlFieldProps = SimpleRelativeSingleFieldProps & Omit; + +// @public (undocumented) +export type UseControlProps = ControlProps & { + fieldMetadata: SimpleRelativeSingleFieldMetadata; + parse: ControlValueParser; + format: FieldValueFormatter; +}; + +// @public (undocumented) +export const useFieldControl: ({ fieldMetadata, parse, format, onBlur, ...props }: UseControlProps) => NonOptionalControlProps & { + ref: Ref; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-i18n.api.md b/build/api/react-i18n.api.md new file mode 100644 index 0000000000..460b4b056c --- /dev/null +++ b/build/api/react-i18n.api.md @@ -0,0 +1,86 @@ +## API Report File for "@contember/react-i18n" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ReactNode } from 'react'; + +// @public (undocumented) +export class I18nError extends Error { +} + +// @public (undocumented) +export function I18nProvider({ localeCode, dictionaries, children }: I18nProviderProps): JSX.Element; + +// @public (undocumented) +export interface I18nProviderProps { + // (undocumented) + children: ReactNode; + // (undocumented) + dictionaries: MessageDictionaryByLocaleCode | undefined; + // (undocumented) + localeCode: string | undefined; +} + +// @public (undocumented) +export interface MessageDictionary { + // (undocumented) + [Key: string]: MessageDictionary | string; +} + +// @public (undocumented) +export interface MessageDictionaryByLocaleCode { + // (undocumented) + [localeCode: string]: MessageDictionary; +} + +// @public (undocumented) +export type MessageDictionaryKeys = { + [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys2}` : Key; +}[keyof Dict & string]; + +// @public (undocumented) +export type MessageDictionaryKeys2 = { + [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys3}` : Key; +}[keyof Dict & string]; + +// @public (undocumented) +export type MessageDictionaryKeys3 = { + [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys4}` : Key; +}[keyof Dict & string]; + +// @public (undocumented) +export type MessageDictionaryKeys4 = { + [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? `${Key}.${MessageDictionaryKeys5}` : Key; +}[keyof Dict & string]; + +// @public (undocumented) +export type MessageDictionaryKeys5 = { + [Key in keyof Dict & string]: Dict[Key] extends MessageDictionary ? string : Key; +}[keyof Dict & string]; + +// @public (undocumented) +export interface MessageFormatter { + // (undocumented) + (key: MessageDictionaryKeys, values?: Record): string; + // (undocumented) + (key: MessageDictionaryKeys, values?: Record): ReactNode; + // (undocumented) + (userSpecifiedKey: string | undefined, fallbackKey: MessageDictionaryKeys, values?: Record): string; + // (undocumented) + (userSpecifiedKey: U, fallbackKey: MessageDictionaryKeys, values?: Record): U | string; +} + +// @public (undocumented) +export type MessageFormatterFormatJSXChunk = (parts: ReactNode) => ReactNode; + +// @public (undocumented) +export type MessageFormatterPrimitiveType = string | number | boolean | null | undefined | Date; + +// @public (undocumented) +export const useMessageFormatter: (defaultDictionary: Dict) => MessageFormatter; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/react-leaflet-fields-ui.api.md b/build/api/react-leaflet-fields-ui.api.md new file mode 100644 index 0000000000..018f306575 --- /dev/null +++ b/build/api/react-leaflet-fields-ui.api.md @@ -0,0 +1,37 @@ +## API Report File for "@contember/react-leaflet-fields-ui" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FieldContainerProps } from '@contember/ui'; +import { FunctionComponent } from 'react'; +import { MapContainerProps } from 'react-leaflet'; +import { MarkerProps } from 'react-leaflet'; +import { SugaredFieldProps } from '@contember/react-binding'; +import { TileLayerProps } from 'react-leaflet'; + +// @public (undocumented) +export const LocationField: FunctionComponent; + +// @public (undocumented) +export interface LocationFieldProps extends Omit { + // (undocumented) + latitudeField: SugaredFieldProps['field']; + // (undocumented) + longitudeField: SugaredFieldProps['field']; + // (undocumented) + mapCenter?: [number, number]; + // (undocumented) + mapProps?: MapContainerProps; + // (undocumented) + markerProps?: MarkerProps; + // (undocumented) + tileLayerProps?: Partial; + // (undocumented) + zoom?: number; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/build/api/ui.api.md b/build/api/ui.api.md index a49e0bbb6d..33e82adfff 100644 --- a/build/api/ui.api.md +++ b/build/api/ui.api.md @@ -2804,7 +2804,7 @@ export interface TableProps { } // @public (undocumented) -export const TableRow: MemoExoticComponent<({ active, children, id, justification, onClick: onClickProp }: TableRowProps) => JSX.Element>; +export const TableRow: MemoExoticComponent<({ active, children, justification, onClick: onClick }: TableRowProps) => JSX.Element>; // @public (undocumented) export interface TableRowProps { @@ -2813,11 +2813,9 @@ export interface TableRowProps { // (undocumented) children?: ReactNode; // (undocumented) - id?: string | number; - // (undocumented) justification?: Justification; // (undocumented) - onClick?: (id: number | string) => void; + onClick?: MouseEventHandler; } // @internal diff --git a/build/api/utilities.api.md b/build/api/utilities.api.md index 839878d33b..726e3b9d2c 100644 --- a/build/api/utilities.api.md +++ b/build/api/utilities.api.md @@ -80,6 +80,11 @@ export function controlsThemeClassName = // @public (undocumented) export function dataAttribute(value: unknown): string | true | undefined; +// @public (undocumented) +export const dateToStringWithoutTimezone: (date: Date, { includeTime }?: { + includeTime?: boolean | undefined; +}) => string; + // @public (undocumented) export function deduplicateClassName(classNameArray: string[]): string[]; @@ -317,6 +322,11 @@ export type SemverString = `${number}.${number}.${number}`; // @public (undocumented) export function setHasOneOf(set: Set, values: T[]): boolean; +// @public (undocumented) +export const shouldCancelStart: (event: { + target?: unknown; +}) => boolean; + export { Simplify } // @public (undocumented) diff --git a/build/packageList.js b/build/packageList.js index de55690367..f44c2fe92c 100644 --- a/build/packageList.js +++ b/build/packageList.js @@ -23,7 +23,17 @@ export const list = { 'client', 'interface-tester', 'layout', + 'react-auto', + 'react-binding', + 'react-binding-ui', + 'react-choice-field', + 'react-choice-field-ui', 'react-client', + 'react-datagrid', + 'react-datagrid-ui', + 'react-form-fields-ui', + 'react-i18n', + 'react-leaflet-fields-ui', 'react-multipass-rendering', 'react-utils', 'ui', diff --git a/ee/admin-server/Dockerfile b/ee/admin-server/Dockerfile index 4d98a65cb0..799bb9a973 100644 --- a/ee/admin-server/Dockerfile +++ b/ee/admin-server/Dockerfile @@ -8,21 +8,31 @@ COPY .yarn ./.yarn COPY ee/admin-server/package.json ./ee/admin-server/package.json # Community Edition -COPY packages/admin/package.json ./packages/admin/package.json -COPY packages/admin-i18n/package.json ./packages/admin-i18n/package.json -COPY packages/admin-sandbox/package.json ./packages/admin-sandbox/package.json -COPY packages/binding/package.json ./packages/binding/package.json -COPY packages/brand/package.json ./packages/brand/package.json -COPY packages/client/package.json ./packages/client/package.json -COPY packages/interface-tester/package.json ./packages/interface-tester/package.json -COPY packages/layout/package.json ./packages/layout/package.json -COPY packages/react-client/package.json ./packages/react-client/package.json -COPY packages/react-multipass-rendering/package.json ./packages/react-multipass-rendering/package.json -COPY packages/react-utils/package.json ./packages/react-utils/package.json -COPY packages/ui/package.json ./packages/ui/package.json -COPY packages/utilities/package.json ./packages/utilities/package.json -COPY packages/vimeo-file-uploader/package.json ./packages/vimeo-file-uploader/package.json -COPY packages/vite-plugin/package.json ./packages/vite-plugin/package.json +COPY packages/admin/package.json ./packages/admin/package.json +COPY packages/admin-i18n/package.json ./packages/admin-i18n/package.json +COPY packages/admin-sandbox/package.json ./packages/admin-sandbox/package.json +COPY packages/binding/package.json ./packages/binding/package.json +COPY packages/brand/package.json ./packages/brand/package.json +COPY packages/client/package.json ./packages/client/package.json +COPY packages/interface-tester/package.json ./packages/interface-tester/package.json +COPY packages/layout/package.json ./packages/layout/package.json +COPY packages/react-auto/package.json ./packages/react-auto/package.json +COPY packages/react-binding/package.json ./packages/react-binding/package.json +COPY packages/react-binding-ui/package.json ./packages/react-binding-ui/package.json +COPY packages/react-client/package.json ./packages/react-client/package.json +COPY packages/react-choice-field/package.json ./packages/react-choice-field/package.json +COPY packages/react-choice-field-ui/package.json ./packages/react-choice-field-ui/package.json +COPY packages/react-datagrid/package.json ./packages/react-datagrid/package.json +COPY packages/react-datagrid-ui/package.json ./packages/react-datagrid-ui/package.json +COPY packages/react-form-fields-ui/package.json ./packages/react-form-fields-ui/package.json +COPY packages/react-i18n/package.json ./packages/react-i18n/package.json +COPY packages/react-leaflet-fields-ui/package.json ./packages/react-leaflet-fields-ui/package.json +COPY packages/react-multipass-rendering/package.json ./packages/react-multipass-rendering/package.json +COPY packages/react-utils/package.json ./packages/react-utils/package.json +COPY packages/ui/package.json ./packages/ui/package.json +COPY packages/utilities/package.json ./packages/utilities/package.json +COPY packages/vimeo-file-uploader/package.json ./packages/vimeo-file-uploader/package.json +COPY packages/vite-plugin/package.json ./packages/vite-plugin/package.json RUN yarn install diff --git a/ee/admin-server/public/_panel/components/StudioEntityLink.tsx b/ee/admin-server/public/_panel/components/StudioEntityLink.tsx new file mode 100644 index 0000000000..2a7c53001e --- /dev/null +++ b/ee/admin-server/public/_panel/components/StudioEntityLink.tsx @@ -0,0 +1,9 @@ +import { Link, LinkComponent } from '@contember/admin' + +export const createStudioLinkComponent = (project: string): LinkComponent => ({ action, Component, children, entityId, entityName }) => ( + + {children} + +) diff --git a/ee/admin-server/public/_panel/pages/studioForm.tsx b/ee/admin-server/public/_panel/pages/studioForm.tsx index 346e990a1e..a418ad9453 100644 --- a/ee/admin-server/public/_panel/pages/studioForm.tsx +++ b/ee/admin-server/public/_panel/pages/studioForm.tsx @@ -11,6 +11,7 @@ import { useCurrentRequest, useOnPersistSuccess, } from '@contember/admin' +import { createStudioLinkComponent } from '../components/StudioEntityLink' export default function StudioForm() { const request = useCurrentRequest()! @@ -21,7 +22,7 @@ export default function StudioForm() { const redirectOnSuccess = { pageName: 'studioForm', parameters: { project, entity, id: new RoutingParameter('entity.id') } } const onCreateSuccess = useOnPersistSuccess({ redirectOnSuccess }) - const createEditLink = (entity: string) => ({ pageName: 'studioForm', parameters: { project, entity, id: new RoutingParameter('entity.id') } }) + const LinkComponent = createStudioLinkComponent(project) const actions = ( <> @@ -33,7 +34,7 @@ export default function StudioForm() { return ( {title}} actions={actions}> - + ) diff --git a/ee/admin-server/public/_panel/pages/studioGrid.tsx b/ee/admin-server/public/_panel/pages/studioGrid.tsx index a1d0155054..9f9b9733b1 100644 --- a/ee/admin-server/public/_panel/pages/studioGrid.tsx +++ b/ee/admin-server/public/_panel/pages/studioGrid.tsx @@ -11,6 +11,7 @@ import { SugaredFilter, useCurrentRequest, } from '@contember/admin' +import { createStudioLinkComponent } from '../components/StudioEntityLink' export default function StudioGrid() { const request = useCurrentRequest()! @@ -18,8 +19,7 @@ export default function StudioGrid() { const entity = request.parameters.entity as string const id = request.parameters.id as EntityId | undefined - const createViewLinkTarget = (entity: string) => ({ pageName: 'studioGrid', parameters: { project, entity, id: new RoutingParameter('entity.id') } }) - const createEditLinkTarget = (entity: string) => ({ pageName: 'studioForm', parameters: { project, entity, id: new RoutingParameter('entity.id') } }) + const LinkComponent = createStudioLinkComponent(project) const actions = ( <> @@ -37,7 +37,7 @@ export default function StudioGrid() { return ( List {entity}} actions={actions} pageContentLayout="stretch"> - + ) diff --git a/packages/admin-sandbox/admin/pages/auto.tsx b/packages/admin-sandbox/admin/pages/auto.tsx index e21139a96d..7b63e50f28 100644 --- a/packages/admin-sandbox/admin/pages/auto.tsx +++ b/packages/admin-sandbox/admin/pages/auto.tsx @@ -11,6 +11,7 @@ import { RoutingParameter, useCurrentRequest, useEnvironment, + LinkComponent, useOnPersistSuccess, } from '@contember/admin' import { Directive } from '../components/Directives' @@ -40,14 +41,20 @@ export default ( ) +const AutoLink: LinkComponent = ({ action, Component, children, entityId, entityName }) => ( + + {children} + +) + + export function Grid() { const request = useCurrentRequest()! const entity = request.parameters.entity as string const filter = request.parameters.id ? `[id = '${request.parameters.id}']` : '' - const createViewLinkTarget = (entity: string) => ({ pageName: 'auto/grid', parameters: { entity, id: new RoutingParameter('entity.id') } }) - const createEditLinkTarget = (entity: string) => ({ pageName: 'auto/form', parameters: { entity, id: new RoutingParameter('entity.id') } }) - const actions = ( <> Create @@ -66,7 +73,7 @@ export function Grid() { {`List ${entity}`} {actions} - + ) @@ -93,7 +100,7 @@ export function Form() { - + ) diff --git a/packages/admin/package.json b/packages/admin/package.json index acb48c9f2e..69fbef1142 100644 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -50,28 +50,28 @@ "test": "vitest --environment jsdom tests/vitest" }, "dependencies": { - "@contember/binding": "workspace:*", "@contember/client": "workspace:*", + "@contember/react-auto": "workspace:*", + "@contember/react-binding": "workspace:*", + "@contember/react-binding-ui": "workspace:*", + "@contember/react-choice-field-ui": "workspace:*", "@contember/react-client": "workspace:*", + "@contember/react-datagrid-ui": "workspace:*", + "@contember/react-form-fields-ui": "workspace:*", + "@contember/react-i18n": "workspace:*", + "@contember/react-leaflet-fields-ui": "workspace:*", "@contember/react-multipass-rendering": "workspace:*", "@contember/react-utils": "workspace:*", "@contember/ui": "workspace:*", "@contember/utilities": "workspace:*", - "@formatjs/icu-messageformat-parser": "2.0.11", - "@sindresorhus/slugify": "0.11.0", "blueimp-md5": "2.18.0", "buffer": "6.0.3", - "fuse.js": "6.4.6", - "intl-messageformat": "9.9.1", "is-hotkey": "0.1.8", - "leaflet": "^1.9.2", "lucide-react": "^0.268.0", "path-to-regexp": "6.2.0", "qrcode-generator": "^1.4.4", "react-dropzone": "10.2.2", "react-error-boundary": "3.1.3", - "react-leaflet": "^4.1.0", - "react-select": "5.3.2", "react-sortable-hoc": "2.0.0", "slate": "0.73.1", "slate-history": "0.66.0", diff --git a/packages/admin/playwright.config.js b/packages/admin/playwright.config.js index a15f30fdb3..d8f9019e24 100644 --- a/packages/admin/playwright.config.js +++ b/packages/admin/playwright.config.js @@ -8,8 +8,8 @@ const config = { expect: { toMatchSnapshot: { - threshold: process.env.CI ? 0.05 : 0, - maxDiffPixelRatio: process.env.CI ? 0.05 : 0, + threshold: process.env.CI ? 0.03 : 0, + maxDiffPixelRatio: process.env.CI ? 0.0005 : 0, }, }, diff --git a/packages/admin/src/adminDictionary.ts b/packages/admin/src/adminDictionary.ts index 6a31c047c0..9a30ca49e3 100644 --- a/packages/admin/src/adminDictionary.ts +++ b/packages/admin/src/adminDictionary.ts @@ -1,16 +1,13 @@ import type { BlockRepeaterDictionary, - ChoiceFieldDictionary, - DataGridCellsDictionary, - DataGridDictionary, EditorDictionary, - ErrorCodeDictionary, - FieldViewDictionary, OutdatedApplicationDictionary, - PersistFeedbackDictionary, RepeaterDictionary, UploadDictionary, } from './components' +import { DataGridCellsDictionary, DataGridDictionary } from '@contember/react-datagrid-ui' +import { ErrorCodeDictionary, FieldViewDictionary, PersistFeedbackDictionary } from '@contember/react-binding-ui' +import { ChoiceFieldDictionary } from '@contember/react-choice-field-ui' // This isn't in i18n in order to avoid unnecessary circular imports. diff --git a/packages/admin/src/components/Application/OutdatedApplicationChecker.tsx b/packages/admin/src/components/Application/OutdatedApplicationChecker.tsx index 0b5f2ea0c5..22b57b2579 100644 --- a/packages/admin/src/components/Application/OutdatedApplicationChecker.tsx +++ b/packages/admin/src/components/Application/OutdatedApplicationChecker.tsx @@ -1,7 +1,7 @@ import { useIsMounted } from '@contember/react-utils' import { Button, Heading, Stack, useDialog } from '@contember/ui' import { ComponentType, useCallback, useEffect, useRef, useState } from 'react' -import { useMessageFormatter } from '../../i18n' +import { useMessageFormatter } from '@contember/react-i18n' import { outdatedApplicationDictionary } from './outdatedApplicationDictionary' const postponeTimeoutMs = 60_000 * 5 diff --git a/packages/admin/src/components/ApplicationEntrypoint.tsx b/packages/admin/src/components/ApplicationEntrypoint.tsx index fa872a00fb..ffaa4d20c3 100644 --- a/packages/admin/src/components/ApplicationEntrypoint.tsx +++ b/packages/admin/src/components/ApplicationEntrypoint.tsx @@ -1,14 +1,15 @@ -import { Environment, EnvironmentContext, EnvironmentExtensionProvider } from '@contember/binding' +import { Environment, EnvironmentContext, EnvironmentExtensionProvider } from '@contember/react-binding' import { ContemberClient, ContemberClientProps } from '@contember/react-client' import { Providers as InterfaceProviders, ProvidersProps } from '@contember/ui' import { ComponentType, PropsWithChildren, ReactNode } from 'react' -import { I18nProvider, MessageDictionaryByLocaleCode } from '../i18n' +import { I18nProvider, MessageDictionaryByLocaleCode } from '@contember/react-i18n' import { RequestProvider, RouteMap, RoutingContext, RoutingContextValue, SelectedDimension } from '../routing' import { OutdatedApplicationChecker } from './Application/OutdatedApplicationChecker' import { ApplicationDevBar } from './Dev/DevBar' import { IdentityProvider } from './Identity' import { NavigationProvider } from './NavigationProvider' import { projectEnvironmentExtension } from './Project' +import { DataGridPageNameKeyProvider } from './DataGridPageNameKeyProvider' export interface ApplicationEntrypointProps extends ContemberClientProps, Omit { basePath?: string @@ -67,15 +68,17 @@ export const ApplicationEntrypoint = (props: ApplicationEntrypointProps) => { stage={props.stage} > - - - - - {props.children} - - - - + + + + + + {props.children} + + + + + diff --git a/packages/admin/src/components/Auto/AutoGrid.tsx b/packages/admin/src/components/Auto/AutoGrid.tsx deleted file mode 100644 index ba387b2957..0000000000 --- a/packages/admin/src/components/Auto/AutoGrid.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Component, QueryLanguage, Schema } from '@contember/binding' -import { Stack } from '@contember/ui' -import { LinkButton, RoutingLinkTarget } from '../../routing' -import { DataGrid, DataGridContainerPublicProps, DataGridProps, DeleteEntityButton, GenericCell } from '../bindingFacade' -import { AutoCell } from './AutoCell' - -export type AutoGridProps = - & DataGridContainerPublicProps - & { - entities: DataGridProps['entities'] - createViewLinkTarget?: (entity: string) => RoutingLinkTarget - createEditLinkTarget?: (entity: string) => RoutingLinkTarget - } - -/** - * @group Auto Admin - */ -export const AutoGrid = Component( - (props: AutoGridProps, env) => { - const schema = env.getSchema() - const entities = QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, env) - const { createViewLinkTarget, createEditLinkTarget, ...dataGridProps } = props - const columns = createDataGridColumns(schema, entities.entityName, createViewLinkTarget, createEditLinkTarget) - - return - }, -) - -const createDataGridColumns = ( - schema: Schema, - entityName: string, - createViewLinkTarget?: (entity: string) => RoutingLinkTarget, - createEditLinkTarget?: (entity: string) => RoutingLinkTarget, -) => { - const entitySchema = schema.getEntity(entityName) - - const fieldColumns = Array.from(entitySchema.fields.values()).map(it => ( - - )) - - const actionColumn = ( - - - {createEditLinkTarget && ( - - edit - - )} - - - - ) - - return [...fieldColumns, actionColumn] -} diff --git a/packages/admin/src/components/Auto/AutoLabel.tsx b/packages/admin/src/components/Auto/AutoLabel.tsx deleted file mode 100644 index 822b91ccbe..0000000000 --- a/packages/admin/src/components/Auto/AutoLabel.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Component, Field } from '@contember/binding' -import { Link, RoutingLinkTarget } from '../../routing' -import { formatString } from './utils' - -export type AutoLabelProps = { - field: string - createLink?: (entity: string) => RoutingLinkTarget -} - -/** - * @group Auto Admin - */ -export const AutoLabel = Component( - ({ field, createLink }, env) => { - const entity = env.getSubTreeNode().entity - const humanFieldSchema = entity.fields.get(field)! - - const optionLabel = formatString(humanFieldSchema.type, it)} /> - return createLink ? {optionLabel} : optionLabel - }, -) diff --git a/packages/admin/src/components/Auto/utils.tsx b/packages/admin/src/components/Auto/utils.tsx deleted file mode 100644 index a3ae566576..0000000000 --- a/packages/admin/src/components/Auto/utils.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { PRIMARY_KEY_NAME, Schema, SchemaColumnType, SchemaEntity, SchemaRelation } from '@contember/binding' - -export const getHumanFriendlyField = (entitySchema: SchemaEntity) => { - for (const field of ['name', 'title', 'heading', 'label', 'caption', 'slug', 'code', 'description']) { - if (entitySchema.fields.has(field)) { - return field - } - } - - return PRIMARY_KEY_NAME -} - - -export const formatString = (type: SchemaColumnType, value: any) => { - if (typeof value !== 'string') { - return value - - } else if (type === 'Uuid') { - return {value.slice(0, 8)} - - } else if (type === 'String') { - return value.length > 100 ? {value.slice(0, 100) + '...'} : value - - } else { - return value - } -} - -export const resolveSortableBy = (schema: Schema, field: SchemaRelation) => { - if (field.type !== 'OneHasMany' || field.side !== 'inverse') { - return undefined - } - - if (field.orderBy === null || field.orderBy.length !== 1 || field.orderBy[0].path.length !== 1) { - return undefined - } - - const sortableBy = schema.getEntityField(field.targetEntity, field.orderBy[0].path[0]) - return sortableBy.type === 'Integer' ? sortableBy.name : undefined -} - -export const resolveConnectingEntity = (schema: Schema, field: SchemaRelation, sortableBy: string | undefined) => { - if (field.type !== 'OneHasMany' || field.side !== 'inverse') { - return undefined - } - - const excludedFields = ['id', field.ownedBy, ...sortableBy ? [sortableBy] : []] - const connectingEntity = schema.getEntity(field.targetEntity) - const connectingEntityFields = Array.from(connectingEntity.fields.values()).filter(it => !excludedFields.includes(it.name)) - - if (connectingEntityFields.length !== 1 || connectingEntityFields[0].__typename !== '_Relation' || connectingEntityFields[0].type !== 'ManyHasOne') { - return undefined - } - - return { - entity: connectingEntity, - field: connectingEntityFields[0], - } -} diff --git a/packages/admin/src/components/DataGridPageNameKeyProvider.tsx b/packages/admin/src/components/DataGridPageNameKeyProvider.tsx new file mode 100644 index 0000000000..eb9178babb --- /dev/null +++ b/packages/admin/src/components/DataGridPageNameKeyProvider.tsx @@ -0,0 +1,13 @@ +import { useCurrentRequest } from '../routing' +import { DataGridKeyProvider } from '@contember/react-datagrid-ui' +import { ReactNode } from 'react' + +export const DataGridPageNameKeyProvider = ({ children }: { children: ReactNode }) => { + const pageName = useCurrentRequest()?.pageName + + return ( + + {children} + + ) +} diff --git a/packages/admin/src/components/Identity/HasRole.tsx b/packages/admin/src/components/Identity/HasRole.tsx index b161337fb1..bce570342b 100644 --- a/packages/admin/src/components/Identity/HasRole.tsx +++ b/packages/admin/src/components/Identity/HasRole.tsx @@ -1,4 +1,4 @@ -import { Component } from '@contember/binding' +import { Component } from '@contember/react-binding' import { ReactNode } from 'react' import { identityEnvironmentExtension } from './IdentityEnvironmentExtension' import { useProjectUserRoles } from '../../acl' diff --git a/packages/admin/src/components/Identity/IdentityEnvironmentExtension.ts b/packages/admin/src/components/Identity/IdentityEnvironmentExtension.ts index 20fa6c6086..40973437a1 100644 --- a/packages/admin/src/components/Identity/IdentityEnvironmentExtension.ts +++ b/packages/admin/src/components/Identity/IdentityEnvironmentExtension.ts @@ -1,4 +1,4 @@ -import { BindingError, Environment } from '@contember/binding' +import { BindingError, Environment } from '@contember/react-binding' import { Identity } from './IdentityProvider' export const identityEnvironmentExtension = Environment.createExtension((state: Identity | null | undefined) => { diff --git a/packages/admin/src/components/Identity/IdentityProvider.tsx b/packages/admin/src/components/Identity/IdentityProvider.tsx index 941625ce4e..1c34653af9 100644 --- a/packages/admin/src/components/Identity/IdentityProvider.tsx +++ b/packages/admin/src/components/Identity/IdentityProvider.tsx @@ -1,12 +1,12 @@ -import { EnvironmentExtensionProvider } from '@contember/binding' import { useSessionToken } from '@contember/react-client' import { Message, SpinnerContainer } from '@contember/ui' import { ReactNode, createContext, useCallback, useEffect, useMemo, useState } from 'react' import { useFetchMe } from '../../tenant' import { MiscPageLayout } from '../MiscPageLayout' -import { identityEnvironmentExtension } from './IdentityEnvironmentExtension' import { InvalidIdentityFallback } from './InvalidIdentityFallback' import { useLogout } from './useLogout' +import { EnvironmentExtensionProvider } from '@contember/react-binding' +import { identityEnvironmentExtension } from './IdentityEnvironmentExtension' export interface Identity { id: string diff --git a/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx b/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx index 13a9ba491e..61cc1222a1 100644 --- a/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx +++ b/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx @@ -1,7 +1,7 @@ import { NavigationContext } from '@contember/ui' import { ReactNode } from 'react' import { isRoutingLinkTarget, PageNotFound, parseLinkTarget, useRoutingLinkFactory } from '../../routing' -import { useEnvironment } from '@contember/binding' +import { useEnvironment } from '@contember/react-binding' export interface NavigationProviderProps { children?: ReactNode diff --git a/packages/admin/src/components/Project/ProjectEnvironmentExtension.tsx b/packages/admin/src/components/Project/ProjectEnvironmentExtension.tsx index 6e7bf13f3a..b26da3cf65 100644 --- a/packages/admin/src/components/Project/ProjectEnvironmentExtension.tsx +++ b/packages/admin/src/components/Project/ProjectEnvironmentExtension.tsx @@ -1,4 +1,4 @@ -import { BindingError, Environment } from '@contember/binding' +import { BindingError, Environment } from '@contember/react-binding' export const projectEnvironmentExtension = Environment.createExtension((slug: string | null | undefined) => { if (slug === undefined) { diff --git a/packages/admin/src/components/Project/ProjectList.tsx b/packages/admin/src/components/Project/ProjectList.tsx index 4440c43d86..ec918b2d34 100644 --- a/packages/admin/src/components/Project/ProjectList.tsx +++ b/packages/admin/src/components/Project/ProjectList.tsx @@ -1,6 +1,6 @@ import { AnchorButton, ButtonList } from '@contember/ui' +import { EmptyMessage } from '@contember/react-binding-ui' import { MiscPageLayout } from '../MiscPageLayout' -import { EmptyMessage } from '../bindingFacade' export interface Project { slug: string diff --git a/packages/admin/src/components/bindingFacade/blocks/Block.tsx b/packages/admin/src/components/bindingFacade/blocks/Block.tsx index 322d24f11e..f6a66fa332 100644 --- a/packages/admin/src/components/bindingFacade/blocks/Block.tsx +++ b/packages/admin/src/components/bindingFacade/blocks/Block.tsx @@ -1,4 +1,4 @@ -import { Component } from '@contember/binding' +import { Component } from '@contember/react-binding' import type { FunctionComponent, ReactNode } from 'react' import type { SugaredDiscriminateBy } from '../discrimination' diff --git a/packages/admin/src/components/bindingFacade/blocks/DiscriminatedBlocks.tsx b/packages/admin/src/components/bindingFacade/blocks/DiscriminatedBlocks.tsx index 3fbca907f9..1dbbc52890 100644 --- a/packages/admin/src/components/bindingFacade/blocks/DiscriminatedBlocks.tsx +++ b/packages/admin/src/components/bindingFacade/blocks/DiscriminatedBlocks.tsx @@ -1,8 +1,7 @@ -import { Component, SugaredRelativeSingleField } from '@contember/binding' +import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding' import type { FieldContainerProps } from '@contember/ui' import { FunctionComponent, ReactNode, useMemo } from 'react' -import { ChoiceFieldData, NormalizedStaticOption, SelectFieldInner, StaticSingleChoiceField } from '../fields' -import { useStaticSingleChoiceField } from '../fields/ChoiceField/hooks/useStaticSingleChoiceField' +import { useStaticSingleChoiceField, SingleChoiceFieldRendererProps, NormalizedStaticOption, SelectFieldInner } from '@contember/react-choice-field-ui' import { useNormalizedBlocks } from './useNormalizedBlocks' export type DiscriminatedBlocksProps = @@ -44,7 +43,7 @@ export const DiscriminatedBlocks: FunctionComponent = })), [blocksArray], ) - const metadata: ChoiceFieldData.SingleChoiceFieldMetadata = useStaticSingleChoiceField({ + const metadata: SingleChoiceFieldRendererProps = useStaticSingleChoiceField({ ...props, options: transformedBlockList, }) @@ -63,7 +62,7 @@ export const DiscriminatedBlocks: FunctionComponent = }, props => ( <> - + {props.children} ), diff --git a/packages/admin/src/components/bindingFacade/blocks/blockAnalyzer.ts b/packages/admin/src/components/bindingFacade/blocks/blockAnalyzer.ts index ec5d999305..57e76a4120 100644 --- a/packages/admin/src/components/bindingFacade/blocks/blockAnalyzer.ts +++ b/packages/admin/src/components/bindingFacade/blocks/blockAnalyzer.ts @@ -1,4 +1,4 @@ -import type { Environment } from '@contember/binding' +import type { Environment } from '@contember/react-binding' import { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering' import { Block, BlockProps } from './Block' diff --git a/packages/admin/src/components/bindingFacade/blocks/getDiscriminatedBlock.ts b/packages/admin/src/components/bindingFacade/blocks/getDiscriminatedBlock.ts index 978b291c38..536fa521fa 100644 --- a/packages/admin/src/components/bindingFacade/blocks/getDiscriminatedBlock.ts +++ b/packages/admin/src/components/bindingFacade/blocks/getDiscriminatedBlock.ts @@ -1,4 +1,4 @@ -import type { FieldAccessor, FieldValue } from '@contember/binding' +import type { FieldAccessor, FieldValue } from '@contember/react-binding' import { getDiscriminatedDatum } from '../discrimination' import type { NormalizedBlocks } from './useNormalizedBlocks' diff --git a/packages/admin/src/components/bindingFacade/blocks/useBlockProps.ts b/packages/admin/src/components/bindingFacade/blocks/useBlockProps.ts index 74670f6701..f36b68b7b1 100644 --- a/packages/admin/src/components/bindingFacade/blocks/useBlockProps.ts +++ b/packages/admin/src/components/bindingFacade/blocks/useBlockProps.ts @@ -1,4 +1,4 @@ -import { useEnvironment } from '@contember/binding' +import { useEnvironment } from '@contember/react-binding' import { ReactNode, useMemo } from 'react' import type { BlockProps } from './Block' import { blockAnalyzer } from './blockAnalyzer' diff --git a/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButton.tsx b/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButton.tsx index 9e3f1d3d18..2df2fd0182 100644 --- a/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButton.tsx +++ b/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButton.tsx @@ -1,4 +1,4 @@ -import { SimpleRelativeSingleField, SimpleRelativeSingleFieldProps } from '../../auxiliary' +import { SimpleRelativeSingleField, SimpleRelativeSingleFieldProps } from '@contember/react-form-fields-ui' import { ClearFieldButtonInner, ClearFieldButtonInnerPublicProps } from './ClearFieldButtonInner' export type ClearFieldButtonProps = diff --git a/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButtonInner.tsx b/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButtonInner.tsx index b25a25fbd0..4d41c8f2cd 100644 --- a/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButtonInner.tsx +++ b/packages/admin/src/components/bindingFacade/buttons/ClearFieldButton/ClearFieldButtonInner.tsx @@ -1,4 +1,4 @@ -import type { FieldAccessor } from '@contember/binding' +import type { FieldAccessor } from '@contember/react-binding' import { Button, ButtonProps, Icon } from '@contember/ui' import { useCallback } from 'react' diff --git a/packages/admin/src/components/bindingFacade/buttons/PageLinkById.tsx b/packages/admin/src/components/bindingFacade/buttons/PageLinkById.tsx deleted file mode 100644 index 2ad9e14d47..0000000000 --- a/packages/admin/src/components/bindingFacade/buttons/PageLinkById.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { EntityAccessor, useEntity } from '@contember/binding' -import { ComponentType, memo, ReactNode, useMemo } from 'react' -import { InnerRoutingLinkProps, Link, RequestState } from '../../../routing' - -interface BasePageLinkByIdProps { - Component?: ComponentType - children?: ReactNode -} - -interface SimplePageLinkByIdTarget { - to: string - idParameterName?: string -} - -interface CustomPageLinkByIdTarget { - change: (id: string, entity: EntityAccessor) => RequestState -} - -type PageLinkByIdProps = - & BasePageLinkByIdProps - & ( - | CustomPageLinkByIdTarget - | SimplePageLinkByIdTarget - ) - -/** @deprecated Use PageLinkButton instead */ -export const PageLinkById = memo(function (props: PageLinkByIdProps) { - const parentEntity = useEntity() - const id = parentEntity.id - const target = useMemo(() => { - if (typeof id !== 'string') { - return null - } - if ('to' in props) { - return { - pageName: props.to, - parameters: { - [props.idParameterName ?? 'id']: id, - }, - } - } - return () => props.change(id, parentEntity) - }, [id, parentEntity, props]) - - if (target !== null) { - return ( - - {props.children} - - ) - } - return null -}) diff --git a/packages/admin/src/components/bindingFacade/buttons/PersistButton.tsx b/packages/admin/src/components/bindingFacade/buttons/PersistButton.tsx index 322fb107f7..b4876e8e9f 100644 --- a/packages/admin/src/components/bindingFacade/buttons/PersistButton.tsx +++ b/packages/admin/src/components/bindingFacade/buttons/PersistButton.tsx @@ -1,8 +1,8 @@ -import { useDirtinessState, useMutationState } from '@contember/binding' +import { useDirtinessState, useMutationState } from '@contember/react-binding' import { useClassName } from '@contember/react-utils' import { SaveButton, SaveButtonProps } from '@contember/ui' import { forwardRef, memo, useCallback } from 'react' -import { usePersistWithFeedback } from '../../ui' +import { usePersistWithFeedback } from '@contember/react-binding-ui' export type PersistButtonProps = Omit diff --git a/packages/admin/src/components/bindingFacade/buttons/index.ts b/packages/admin/src/components/bindingFacade/buttons/index.ts index d0105f7144..c7714acd7b 100644 --- a/packages/admin/src/components/bindingFacade/buttons/index.ts +++ b/packages/admin/src/components/bindingFacade/buttons/index.ts @@ -1,3 +1,2 @@ export * from './ClearFieldButton' -export * from './PageLinkById' export * from './PersistButton' diff --git a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx index cfc1b33c0a..e703c907b4 100644 --- a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx +++ b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx @@ -1,6 +1,6 @@ import { Dropdown, DropdownProps, FieldContainer, Icon } from '@contember/ui' import { memo, useMemo } from 'react' -import { useMessageFormatter } from '../../../../i18n' +import { useMessageFormatter } from '@contember/react-i18n' import { AddNewBlockButtonInner, AddNewBlockButtonInnerProps } from './AddNewBlockButtonInner' import { blockRepeaterDictionary } from './Dictionary' diff --git a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx index 34d4c7dc79..d92230746e 100644 --- a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx +++ b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx @@ -1,8 +1,8 @@ -import { SugaredRelativeSingleField, useDesugaredRelativeSingleField } from '@contember/binding' +import { SugaredRelativeSingleField, useDesugaredRelativeSingleField } from '@contember/react-binding' import { Button, ButtonGroup, DropdownRenderProps } from '@contember/ui' import { memo } from 'react' import type { NormalizedBlocks } from '../../blocks' -import type { CreateNewEntityButtonProps } from '../helpers' +import type { CreateNewEntityButtonProps } from '@contember/react-binding-ui' export interface AddNewBlockButtonInnerProps extends DropdownRenderProps, CreateNewEntityButtonProps { normalizedBlocks: NormalizedBlocks diff --git a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx index 23bc9e42f3..1fa8bc7fdc 100644 --- a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx +++ b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx @@ -1,4 +1,4 @@ -import { Component, SugaredFieldProps } from '@contember/binding' +import { Component, SugaredFieldProps } from '@contember/react-binding' import type { FunctionComponent } from 'react' import { DiscriminatedBlocks, useNormalizedBlocks } from '../../blocks' import { Repeater, RepeaterProps } from '../Repeater' diff --git a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/SortableBlock.tsx b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/SortableBlock.tsx index a27f5648b8..4b70215703 100644 --- a/packages/admin/src/components/bindingFacade/collections/BlockRepeater/SortableBlock.tsx +++ b/packages/admin/src/components/bindingFacade/collections/BlockRepeater/SortableBlock.tsx @@ -1,4 +1,4 @@ -import { SugaredRelativeSingleField, useField } from '@contember/binding' +import { SugaredRelativeSingleField, useField } from '@contember/react-binding' import { memo } from 'react' import { getDiscriminatedBlock, NormalizedBlocks } from '../../blocks' import { RepeaterItem, RepeaterItemProps } from '../Repeater' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridCellPublicProps.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridCellPublicProps.ts deleted file mode 100644 index 67249a56d8..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridCellPublicProps.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Justification } from '@contember/ui' - -export interface DataGridCellPublicProps { - justification?: Justification - shrunk?: boolean - hidden?: boolean - canBeHidden?: boolean -} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumn.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumn.ts deleted file mode 100644 index caf9e73efb..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumn.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { BindingError, Environment } from '@contember/binding' -import type { ComponentType, ReactElement, ReactNode } from 'react' -import type { DataGridCellPublicProps } from './DataGridCellPublicProps' -import type { DataGridColumnKey } from './DataGridColumnKey' -import type { DataGridFilterArtifact } from './DataGridFilterArtifact' -import type { DataGridHeaderCellPublicProps } from './DataGridHeaderCell' -import type { DataGridOrderDirection } from './DataGridOrderDirection' -import type { DataGridSetFilter } from './DataGridSetFilter' -import type { GetNewFilter } from './GetNewFilter' -import type { GetNewOrderBy } from './GetNewOrderBy' - -export interface FilterRendererProps { - filter: FA - setFilter: DataGridSetFilter - environment: Environment -} - -export type DataGridColumnFiltering = - | { - enableFiltering: false - } - | { - enableFiltering?: true - initialFilter?: FA - getNewFilter: GetNewFilter - emptyFilter: FA - filterRenderer: ComponentType> - } - -export type DataGridColumnOrdering = - | { - enableOrdering: false - } - | { - enableOrdering?: true - initialOrder?: DataGridOrderDirection - getNewOrderBy: GetNewOrderBy - } - -export type DataGridColumnPublicProps = - & DataGridHeaderCellPublicProps - & DataGridCellPublicProps - & { - columnKey?: string - children?: ReactNode - } - -export type DataGridColumnProps = - & DataGridColumnPublicProps - & DataGridColumnFiltering - & DataGridColumnOrdering - -export type DataGridColumns = Map - -// This is deliberately not a Contember Component! -/** - * Constructor for custom DataGrid cell. - * - * @group Data grid - */ -export const DataGridColumn: ( - props: DataGridColumnProps, -) => ReactElement = ( - props: DataGridColumnProps, -): ReactElement => { - throw new BindingError() -} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnKey.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnKey.ts deleted file mode 100644 index e00516ff10..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnKey.ts +++ /dev/null @@ -1 +0,0 @@ -export type DataGridColumnKey = string diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainer.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainer.tsx deleted file mode 100644 index 3bf11102d4..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainer.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { Component } from '@contember/binding' -import { useClassName } from '@contember/react-utils' -import { Stack } from '@contember/ui' -import { FunctionComponent } from 'react' -import { useMessageFormatter } from '../../../../../../i18n' -import { dataGridDictionary } from '../dataGridDictionary' -import { useDataGridTotalCount } from '../useDataGridTotalCount' -import { DataGridContainerFooter } from './DataGridContainerFooter' -import { DataGridContainerGrid } from './DataGridContainerGrid' -import { DataGridContainerHeader } from './DataGridContainerHeader' -import { DataGridContainerTable } from './DataGridContainerTable' -import type { DataGridContainerProps } from './Types' - -export const DataGridContainer: FunctionComponent = Component( - ({ - accessor, - allowAggregateFilterControls, - allowColumnVisibilityControls, - desiredState, - displayedState, - emptyMessage, - emptyMessageComponent, - entityName, - filter, - onEntityClick, - selectedEntityIds, - setFilter, - setIsColumnHidden, - setLayout, - setOrderBy, - tile, - tileSize, - updatePaging, - }) => { - const { - paging: { pageIndex, itemsPerPage }, - layout, - } = desiredState - const formatMessage = useMessageFormatter(dataGridDictionary) - const totalCount = useDataGridTotalCount(entityName, filter) - const normalizedItemCount = itemsPerPage === null ? accessor.length : totalCount - const pagesCount = - totalCount !== undefined && itemsPerPage !== null ? Math.ceil(totalCount / itemsPerPage) : undefined - - const pagingSummary = ( - <> - {pagesCount === undefined - ? formatMessage('dataGrid.paging.status.unknownPageTotal', { pageNumber: pageIndex + 1 }) - : formatMessage('dataGrid.paging.status.knownPageTotal', { - pageNumber: pageIndex + 1, - totalPageCount: pagesCount, - })} - {normalizedItemCount !== undefined && - ` ${formatMessage('dataGrid.paging.status.itemCount', { itemCount: normalizedItemCount })}`} - - ) - - return ( - - - {tile && layout === 'tiles' - ? - : - } - {!!normalizedItemCount && ( - - )} - - ) - }, - props => <>{props.children}, - 'DataGridContainer', -) diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerGrid.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerGrid.tsx deleted file mode 100644 index f233e1c1e5..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerGrid.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { Entity } from '@contember/binding' -import { useClassName } from '@contember/react-utils' -import { Grid } from '@contember/ui' -import { memo } from 'react' -import { useMessageFormatter } from '../../../../../../i18n' -import { EmptyMessage } from '../../../helpers' -import { dataGridDictionary } from '../dataGridDictionary' -import { DataGridContainerProps } from './Types' - -export type DataGridContainerGridProps = - Pick - -export const DataGridContainerGrid = memo(({ - accessor, - emptyMessage, - emptyMessageComponent, - tile, - tileSize = 160, -}: DataGridContainerGridProps) => { - const formatMessage = useMessageFormatter(dataGridDictionary) - - return ( -

- - {!!accessor.length - ? Array.from(accessor, entity => ( - - {tile} - - )) - : ( - - {formatMessage(emptyMessage, 'dataGrid.emptyMessage.text')} - - )} - -
- ) -}) -DataGridContainerGrid.displayName = 'DataGridContainerGrid' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerHeader.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerHeader.tsx deleted file mode 100644 index 1da7319dfe..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerHeader.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { Button, ButtonList, Divider, LayoutPageStickyContainer, Stack, TableRowsIcon } from '@contember/ui' -import { LayoutGridIcon } from 'lucide-react' -import { ReactNode, memo, useCallback } from 'react' -import { useMessageFormatter } from '../../../../../../i18n' -import { DataGridColumnHiding } from '../DataGridColumnHiding' -import { DataGridFullFilters } from '../DataGridFullFilters' -import { dataGridDictionary } from '../dataGridDictionary' -import { DataGridContainerProps } from './Types' - -interface DataGridContainerHeaderProps - extends Pick< - DataGridContainerProps, - | 'accessor' - | 'allowAggregateFilterControls' - | 'allowColumnVisibilityControls' - | 'desiredState' - | 'setFilter' - | 'setIsColumnHidden' - | 'setLayout' - > { - hasTile: boolean - pagingSummary: ReactNode - } - -export const DataGridContainerHeader = memo(({ - accessor, - allowAggregateFilterControls, - allowColumnVisibilityControls, - desiredState, - hasTile, - pagingSummary, - setFilter, - setIsColumnHidden, - setLayout, -}) => { - const { layout } = desiredState - const formatMessage = useMessageFormatter(dataGridDictionary) - - const setDefaultView = useCallback(() => setLayout('default'), [setLayout]) - const setTileView = useCallback(() => setLayout('tiles'), [setLayout]) - - return ( - - - - {hasTile && <> - - - - - - - } - {layout !== 'tiles' && allowColumnVisibilityControls !== false && ( - - ) - } - {allowAggregateFilterControls !== false && ( - - )} - -
{pagingSummary}
-
-
- ) -}) -DataGridContainerHeader.displayName = 'DataGridContainerHeader' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerTable.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerTable.tsx deleted file mode 100644 index c3d0b19e94..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/DataGridContainerTable.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { Entity, EntityId } from '@contember/binding' -import { useClassName } from '@contember/react-utils' -import { Table, TableCell, TableRow } from '@contember/ui' -import { memo, useMemo } from 'react' -import { useMessageFormatter } from '../../../../../../i18n' -import { EmptyMessage } from '../../../helpers' -import { DataGridHeaderCell } from '../DataGridHeaderCell' -import { dataGridDictionary } from '../dataGridDictionary' -import { getColumnFilter } from '../getColumnFilter' -import type { DataGridContainerProps } from './Types' - -type DataGridContainerTableProps = - Pick - -export const DataGridContainerTable = memo(({ - accessor, - desiredState, - displayedState, - emptyMessage, - emptyMessageComponent, - onEntityClick, - selectedEntityIds, - setFilter, - setOrderBy, -}) => { - const { - filterArtifacts, - orderDirections, - columns, - } = desiredState - - const formatMessage = useMessageFormatter(dataGridDictionary) - - const onRowClick = useMemo(() => { - if (!onEntityClick) { - return undefined - } - return (id: EntityId) => { - const entity = accessor.getChildEntityById(id) - - if (entity) { - onEntityClick(entity) - } - } - }, [accessor, onEntityClick]) - - return ( - - {Array.from(columns) - // We use desired state here to give immediate feedback about column changes. - .filter(([columnKey]) => !desiredState.hiddenColumns[columnKey]) - .map(([columnKey, column]) => { - const filterArtifact = filterArtifacts[columnKey] - const orderDirection = orderDirections[columnKey] - const orderColumns = Object.keys(orderDirections) - return ( - 1 ? orderColumns.indexOf(columnKey) : undefined, - } : undefined} - setFilter={newFilter => setFilter(columnKey, newFilter)} - setOrderBy={(newOrderBy, append = false) => setOrderBy(columnKey, newOrderBy, append)} - headerJustification={column.headerJustification || column.justification} - shrunk={column.shrunk} - hasFilter={getColumnFilter(column, filterArtifact, accessor.environment) !== undefined} - header={column.header} - ascOrderIcon={column.ascOrderIcon} - descOrderIcon={column.descOrderIcon} - filterRenderer={column.enableFiltering !== false ? column.filterRenderer : undefined} - /> - ) - })} - - } - > - {!!accessor.length && - Array.from(accessor, entity => ( - - - {Array.from(columns) - .filter(([columnKey]) => !desiredState.hiddenColumns[columnKey]) - .map(([columnKey, column]) => { - // This is tricky. We need to render a table cell from here no matter what so that the cell count - // matches that of the headers. However, there might be a header displayed for a column whose data - // has not yet been fetched. Displaying its cell contents from here would cause an error. Also, the - // column may have just been hidden but the information hasn't made it to displayed sate yet. - // For these, we just display an empty cell then. - if (displayedState.hiddenColumns[columnKey]) { - return - } - return ( - - {column.children} - - ) - })} - - - ))} - {!accessor.length && ( - - - - {formatMessage(emptyMessage, 'dataGrid.emptyMessage.text')} - - - - )} -
- ) -}) -DataGridContainerTable.displayName = 'DataGridContainerTable' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/Types.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/Types.ts deleted file mode 100644 index 1ccf85d313..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/Types.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { EntityAccessor, EntityId, EntityListBaseProps, EntityName, Filter } from '@contember/binding' -import { ComponentType, ReactNode } from 'react' -import { EmptyMessageProps } from '../../../helpers' -import type { GridPagingAction } from '../../paging' -import { SetDataGridView } from '../DataGridLayout' -import type { DataGridSetColumnFilter } from '../DataGridSetFilter' -import type { DataGridSetIsColumnHidden } from '../DataGridSetIsColumnHidden' -import type { DataGridSetColumnOrderBy } from '../DataGridSetOrderBy' -import type { DataGridState } from '../DataGridState' - -export interface DataGridContainerPublicProps { - allowAggregateFilterControls?: boolean - allowColumnVisibilityControls?: boolean - emptyMessage?: ReactNode - emptyMessageComponent?: ComponentType // This can override 'emptyMessage' - emptyMessageComponentExtraProps?: {} - onEntityClick?: (entity: EntityAccessor) => void - selectedEntityIds?: EntityId[] - tile?: ReactNode - tileSize?: number -} - -export interface DataGridContainerOwnProps extends DataGridContainerPublicProps { - desiredState: DataGridState - displayedState: DataGridState - entityName: EntityName - filter: Filter - setFilter: DataGridSetColumnFilter - setIsColumnHidden: DataGridSetIsColumnHidden - setLayout: SetDataGridView - setOrderBy: DataGridSetColumnOrderBy - updatePaging: (action: GridPagingAction) => void -} - -export interface DataGridContainerProps extends DataGridContainerOwnProps, EntityListBaseProps {} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/index.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/index.ts deleted file mode 100644 index da8966884e..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridContainer/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DataGridContainer' -export * from './Types' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifact.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifact.ts deleted file mode 100644 index d254fcc5bd..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifact.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Serializable } from '@contember/react-utils' - -export type DataGridFilterArtifact = Serializable diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifactStore.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifactStore.ts deleted file mode 100644 index 80b3cdeecf..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridFilterArtifactStore.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' -import type { DataGridFilterArtifact } from './DataGridFilterArtifact' - -export type DataGridFilterArtifactStore = Record diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHeaderCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHeaderCell.tsx deleted file mode 100644 index 5969ee763e..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHeaderCell.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import type { Environment } from '@contember/binding' -import { ActionableBox, Box, Dropdown, DropdownProps, Justification, TableHeaderCell } from '@contember/ui' -import { ChevronDownIcon, ChevronUpIcon, FilterIcon } from 'lucide-react' -import { ComponentType, ReactElement, ReactNode, createElement, useMemo } from 'react' -import type { FilterRendererProps } from './DataGridColumn' -import type { DataGridFilterArtifact } from './DataGridFilterArtifact' -import { DataGridOrderDirection, cycleOrderDirection } from './DataGridOrderDirection' -import type { DataGridSetFilter } from './DataGridSetFilter' -import type { DataGridSetOrderBy } from './DataGridSetOrderBy' - -export interface DataGridHeaderCellPublicProps { - header?: ReactNode - shrunk?: boolean - headerJustification?: Justification - ascOrderIcon?: ReactNode - descOrderIcon?: ReactNode -} - -export interface DataGridHeaderCellInternalProps { - environment: Environment - hasFilter: boolean - emptyFilterArtifact: DataGridFilterArtifact - filterArtifact: DataGridFilterArtifact - orderState: { direction: Exclude, index: number | undefined } | undefined - setFilter: DataGridSetFilter - setOrderBy: DataGridSetOrderBy - filterRenderer: ComponentType> | undefined -} - -export interface DataGridHeaderCellProps extends DataGridHeaderCellInternalProps, DataGridHeaderCellPublicProps { } - -export function DataGridHeaderCell({ - ascOrderIcon, - descOrderIcon, - emptyFilterArtifact, - environment, - filterArtifact, - filterRenderer, - hasFilter, - header, - headerJustification, - orderState, - setFilter, - setOrderBy, - shrunk, -}: DataGridHeaderCellProps): ReactElement { - const buttonProps: DropdownProps['buttonProps'] = useMemo(() => ({ - intent: hasFilter ? undefined : 'default', - distinction: 'seamless', - size: 'small', - children: ( - - ), - }), [hasFilter]) - - return ( - - - setOrderBy(cycleOrderDirection(orderState?.direction ?? null), e.ctrlKey || e.metaKey)} style={{ cursor: 'pointer' }}> - {header} -   - {orderState && - <> - {{ - asc: ascOrderIcon ?? defaultAscIcon, - desc: descOrderIcon ?? defaultDescIcon, - }[orderState.direction]} - {orderState.index !== undefined ? `(${orderState.index + 1})` : null} - } - - {filterRenderer && ( - ( - { - setFilter(undefined) - requestClose() - }} - > - Filter: {header}}> - {createElement(filterRenderer, { - filter: filterArtifact === undefined ? emptyFilterArtifact : filterArtifact, - setFilter: setFilter, - environment: environment, - })} - - - )} - /> - )} - - - ) -} - -const defaultAscIcon = -const defaultDescIcon = diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHiddenColumnsStateStore.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHiddenColumnsStateStore.ts deleted file mode 100644 index 7fb0939efb..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridHiddenColumnsStateStore.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' - -export type DataGridHiddenColumnsStateStore = Record diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridLayout.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridLayout.ts deleted file mode 100644 index 817f6e2474..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridLayout.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Default } from '@contember/ui' - -export type DataGridLayout = Default | 'tiles' -export type SetDataGridView = (layout: DataGridLayout) => void diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridOrderDirectionStore.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridOrderDirectionStore.ts deleted file mode 100644 index 14cef81381..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridOrderDirectionStore.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' -import type { DataGridOrderDirection } from './DataGridOrderDirection' - -export type DataGridOrderDirectionStore = Record> diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetFilter.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetFilter.ts deleted file mode 100644 index 26685d104f..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetFilter.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' -import type { DataGridFilterArtifact } from './DataGridFilterArtifact' - -export type DataGridSetFilter = ( - filter: FA | undefined, -) => void - -export type DataGridSetColumnFilter = ( - columnKey: DataGridColumnKey, - columnFilter: FA | undefined, -) => void diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetIsColumnHidden.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetIsColumnHidden.ts deleted file mode 100644 index 9a25a120fb..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetIsColumnHidden.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' - -export type DataGridSetIsColumnHidden = (columnKey: DataGridColumnKey, isHidden: boolean) => void diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetOrderBy.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetOrderBy.ts deleted file mode 100644 index 83b0671e13..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridSetOrderBy.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { DataGridColumnKey } from './DataGridColumnKey' -import type { DataGridOrderDirection } from './DataGridOrderDirection' - -export type DataGridSetOrderBy = (setOrderBy: DataGridOrderDirection, append?: boolean) => void - -export type DataGridSetColumnOrderBy = (columnKey: DataGridColumnKey, columnOrderBy: DataGridOrderDirection, append?: boolean) => void diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridState.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridState.ts deleted file mode 100644 index 38ee319d9e..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridState.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Filter, OrderBy, QualifiedEntityList } from '@contember/binding' -import type { DispatchChangePage, GridPagingState } from '../paging' -import type { DataGridColumns } from './DataGridColumn' -import type { DataGridFilterArtifactStore } from './DataGridFilterArtifactStore' -import type { DataGridHiddenColumnsStateStore } from './DataGridHiddenColumnsStateStore' -import { DataGridLayout, SetDataGridView } from './DataGridLayout' -import type { DataGridOrderDirectionStore } from './DataGridOrderDirectionStore' -import { DataGridSetColumnFilter } from './DataGridSetFilter' -import { DataGridSetIsColumnHidden } from './DataGridSetIsColumnHidden' -import { DataGridSetColumnOrderBy } from './DataGridSetOrderBy' - -export interface DataGridState { - /** - * input entities, does not include applied filters - */ - entities: QualifiedEntityList - - /** - * collected columns - */ - columns: DataGridColumns - - /** - * raw grid state - */ - paging: GridPagingState - hiddenColumns: DataGridHiddenColumnsStateStore - filterArtifacts: DataGridFilterArtifactStore - orderDirections: DataGridOrderDirectionStore - layout: DataGridLayout - - /** - * constructed structs - */ - orderBy: OrderBy - filter: Filter -} - -export interface DataGridStateMethods { - setIsColumnHidden: DataGridSetIsColumnHidden - setOrderBy: DataGridSetColumnOrderBy - setFilter: DataGridSetColumnFilter - updatePaging: DispatchChangePage - setLayout: SetDataGridView -} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewFilter.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewFilter.ts deleted file mode 100644 index 500c12e460..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewFilter.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Environment, SugaredFilter } from '@contember/binding' -import type { DataGridFilterArtifact } from './DataGridFilterArtifact' - -export interface GetNewFilterOptions { - environment: Environment -} - -export type GetNewFilter = ( - filterArtifact: FA, - options: GetNewFilterOptions, -) => SugaredFilter | undefined diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewOrderBy.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewOrderBy.ts deleted file mode 100644 index 08193181a8..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/GetNewOrderBy.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Environment, SugaredOrderBy } from '@contember/binding' -import type { DataGridOrderDirection } from './DataGridOrderDirection' - -export interface GetNewOrderByOptions { - environment: Environment -} - -export type GetNewOrderBy = ( - newDirection: DataGridOrderDirection, - options: GetNewOrderByOptions, -) => SugaredOrderBy | undefined diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/index.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/index.ts deleted file mode 100644 index 7dfd16de1e..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -export type { DataGridCellPublicProps } from './DataGridCellPublicProps' -export * from './DataGridColumn' -export * from './DataGridColumnKey' -export * from './DataGridContainer' -export * from './dataGridDictionary' -export * from './DataGridFilterArtifact' -export * from './DataGridFilterArtifactStore' -export * from './DataGridHeaderCell' -export * from './DataGridHiddenColumnsStateStore' -export * from './DataGridLayout' -export * from './DataGridOrderDirection' -export * from './DataGridOrderDirectionStore' -export * from './DataGridSetFilter' -export * from './DataGridSetIsColumnHidden' -export * from './DataGridSetOrderBy' -export * from './DataGridState' -export * from './getColumnFilter' -export * from './getColumnOrderBy' -export * from './GetNewFilter' -export * from './GetNewOrderBy' -export * from './useDataGrid' -export * from './useDataGridState' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGrid.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGrid.ts deleted file mode 100644 index 121549d8c2..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGrid.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ControlledDataGridProps, DataGridProps } from '../grid' -import { useDataGridState } from './useDataGridState' - -export const useDataGrid = (props: DataGridProps): ControlledDataGridProps => { - const [state, stateMethods] = useDataGridState(props) - return { ...props, state, stateMethods } -} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGridDisplayedState.ts b/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGridDisplayedState.ts deleted file mode 100644 index cd4ae9fa15..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/useDataGridDisplayedState.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ReactNode, useEffect, useState } from 'react' -import { DataGridState, DataGridStateMethods } from './DataGridState' -import { renderGrid } from '../grid/renderGrid' -import { TreeRootId, useEnvironment, useExtendTree } from '@contember/binding' - -export const useDataGridDisplayedState = (stateMethods: DataGridStateMethods, desiredState: DataGridState, tile?: ReactNode): { - gridState: DataGridState | undefined - treeRootId: TreeRootId | undefined -} => { - const [displayedState, setDisplayedState] = useState<{ - gridState: DataGridState | undefined - treeRootId: TreeRootId | undefined - }>({ - gridState: undefined, - treeRootId: undefined, - }) - - const environment = useEnvironment() - const extendTree = useExtendTree() - useEffect(() => { - (async () => { - if (displayedState.gridState === desiredState) { - return - } - const newTreeRootId = await extendTree( - renderGrid(stateMethods, undefined, desiredState, desiredState, environment, { - tile, - }), - ) - if (newTreeRootId) { - setDisplayedState({ - gridState: desiredState, - treeRootId: newTreeRootId, - }) - } - })() - }, [desiredState, displayedState, environment, extendTree, stateMethods, tile]) - - return displayedState -} diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/BooleanCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/BooleanCell.tsx deleted file mode 100644 index 2b7bfbab1f..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/BooleanCell.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { Component, QueryLanguage, wrapFilterInHasOnes } from '@contember/binding' -import type { Input } from '@contember/client' -import { Checkbox, FieldContainer, Stack } from '@contember/ui' -import type { FunctionComponent } from 'react' -import { useMessageFormatter } from '../../../../../i18n' -import { BooleanFieldView, BooleanFieldViewProps } from '../../../fieldViews' -import { DataGridColumn, DataGridColumnPublicProps, DataGridOrderDirection } from '../base' -import { dataGridCellsDictionary } from './dataGridCellsDictionary' - -export type BooleanCellProps = - & DataGridColumnPublicProps - & BooleanFieldViewProps - & { - disableOrder?: boolean - initialOrder?: DataGridOrderDirection - initialFilter?: BooleanFilterArtifacts - } - -export type BooleanFilterArtifacts = { - includeTrue: boolean - includeFalse: boolean - includeNull: boolean -} - -/** - * DataGrid cell for displaying a content of boolean field. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const BooleanCell: FunctionComponent = Component(props => { - return ( - - shrunk - {...props} - enableOrdering={!props.disableOrder as true} - getNewOrderBy={(newDirection, { environment }) => - newDirection ? QueryLanguage.desugarOrderBy(`${props.field as string} ${newDirection}`, environment) : undefined - } - getNewFilter={(filterArtifact, { environment }) => { - const conditions: Input.Condition[] = [] - - if (filterArtifact.includeTrue) { - conditions.push({ eq: true }) - } - if (filterArtifact.includeFalse) { - conditions.push({ eq: false }) - } - if (filterArtifact.includeNull) { - conditions.push({ isNull: true }) - } - if (conditions.length === 0 || conditions.length === 3) { - return undefined - } - - const desugared = QueryLanguage.desugarRelativeSingleField(props.field, environment) - return wrapFilterInHasOnes(desugared.hasOneRelationPath, { - [desugared.field]: conditions.length > 1 ? { or: conditions } : conditions[0], - }) - }} - emptyFilter={{ - includeFalse: false, - includeTrue: false, - includeNull: false, - }} - filterRenderer={({ filter, setFilter }) => { - const formatMessage = useMessageFormatter(dataGridCellsDictionary) - return ( - - {( - [ - ['includeTrue', formatMessage('dataGridCells.booleanCell.includeTrue')], - ['includeFalse', formatMessage('dataGridCells.booleanCell.includeFalse')], - ['includeNull', formatMessage('dataGridCells.booleanCell.includeNull')], - ] as const - ).map(([item, label], index) => ( - - { - setFilter({ ...filter, [item]: checked }) - }} - /> - - ))} - - ) - }} - > - - - ) -}, 'BooleanCell') diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/CoalesceTextCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/CoalesceTextCell.tsx deleted file mode 100644 index 87cd1d958c..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/CoalesceTextCell.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { Component, FieldValue, Filter, QueryLanguage, wrapFilterInHasOnes } from '@contember/binding' -import { Stack } from '@contember/ui' -import { FC, ReactElement } from 'react' -import { CoalesceFieldView, CoalesceFieldViewProps, FieldFallbackViewPublicProps } from '../../../fieldViews' -import { DataGridColumn, DataGridColumnPublicProps } from '../base' -import { GenericTextCellFilter, createGenericTextCellFilterCondition } from './GenericTextCellFilter' - -export type CoalesceTextCellProps = - & DataGridColumnPublicProps - & FieldFallbackViewPublicProps - & CoalesceFieldViewProps - & { - initialFilter?: CoalesceTextFilterArtifacts - } - -export type CoalesceTextFilterArtifacts = { - mode: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch' - query: string -} - -/** - * DataGrid cells with for text fields with a fallback support. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const CoalesceTextCell: FC = Component(props => { - return ( - - {...props} - enableOrdering={false} - getNewFilter={(filter, { environment }): Filter | undefined => { - if (filter.query === '') { - return undefined - } - const condition = createGenericTextCellFilterCondition(filter) - const parts: Filter[] = [] - for (const field of props.fields) { - const desugared = QueryLanguage.desugarRelativeSingleField({ field: field }, environment) - const fieldCondition = wrapFilterInHasOnes(desugared.hasOneRelationPath, { - [desugared.field]: condition, - }) - parts.push(fieldCondition) - } - return filter.mode === 'doesNotMatch' ? { and: parts } : { or: parts } - }} - emptyFilter={{ - mode: 'matches', - query: '', - }} - filterRenderer={props => { - return ( - - - - ) - }} - > - - - ) -}, 'CoalesceTextCell') as ( - props: CoalesceTextCellProps, -) => ReactElement diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/DateCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/DateCell.tsx deleted file mode 100644 index c576b14ad6..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/DateCell.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { Component, QueryLanguage, wrapFilterInHasOnes } from '@contember/binding' -import type { Input } from '@contember/client' -import { DateInput, FieldContainer, Stack, toDateString } from '@contember/ui' -import { FunctionComponent, ReactNode, forwardRef, memo, useCallback } from 'react' -import { useMessageFormatter } from '../../../../../i18n' -import { dateToStringWithoutTimezone } from '../../../../../utils' -import { DateFieldView, DateFieldViewProps } from '../../../fieldViews' -import { DataGridColumn, DataGridColumnPublicProps, DataGridOrderDirection } from '../base' -import { dataGridCellsDictionary } from './dataGridCellsDictionary' - -export type DateCellProps = - & DataGridColumnPublicProps - & DateFieldViewProps - & { - disableOrder?: boolean - initialOrder?: DataGridOrderDirection - initialFilter?: DateRange - } - -export type DateRange = { - start: string | null - end: string | null -} - -/** - * DataGrid cell for displaying a date field value. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const DateCell: FunctionComponent = Component(props => { - return ( - - {...props} - enableOrdering={!props.disableOrder as true} - getNewOrderBy={(newDirection, { environment }) => - newDirection ? QueryLanguage.desugarOrderBy(`${props.field as string} ${newDirection}`, environment) : undefined - } - getNewFilter={(filterArtifact, { environment }) => { - if (!filterArtifact.start && !filterArtifact.end) { - return undefined - } - const desugared = QueryLanguage.desugarRelativeSingleField(props.field, environment) - - const conditions: Input.Condition[] = [] - - if (filterArtifact.start) { - conditions.push({ gte: filterArtifact.start }) - } - if (filterArtifact.end) { - conditions.push({ lte: filterArtifact.end }) - } - - return wrapFilterInHasOnes(desugared.hasOneRelationPath, { - [desugared.field]: conditions.length > 1 ? { and: conditions } : conditions[0], - }) - }} - emptyFilter={{ - start: null, - end: null, - }} - filterRenderer={({ filter, setFilter }) => { - const formatMessage = useMessageFormatter(dataGridCellsDictionary) - - const start = toDateString(filter.start) ?? '' - const end = toDateString(filter.end) ?? '' - - const onDateStartChange = useCallback((value?: string | null) => { - setFilter({ - ...filter, - start: value ? dateToStringWithoutTimezone(new Date(value)) : null, - }) - }, [filter, setFilter]) - const onDateEndChange = useCallback((value?: string | null) => { - setFilter({ - ...filter, - end: value ? dateToStringWithoutTimezone(new Date(value)) : null, - }) - }, [filter, setFilter]) - - return ( - - - - - - - - - ) - }} - > - - - ) -}, 'DateCell') - -const DateBoundInput = memo( - forwardRef(({ label, children }: { label: string, children: ReactNode }, ref: any) => ( - - {children} - - )), -) diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/EnumCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/EnumCell.tsx deleted file mode 100644 index 9d395dc06e..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/EnumCell.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { Component, QueryLanguage, SugaredField, SugaredFieldProps, wrapFilterInHasOnes } from '@contember/binding' -import { GraphQlLiteral, Input } from '@contember/client' -import { Checkbox, FieldContainer, Stack } from '@contember/ui' -import { ReactNode, useMemo } from 'react' -import { FieldFallbackView, FieldFallbackViewPublicProps } from '../../../fieldViews' -import { DataGridColumn, DataGridColumnPublicProps } from '../base' -import { NullConditionFilter, NullConditionFilterPublicProps } from './NullConditionFilter' - -export type EnumCellProps = - & DataGridColumnPublicProps - & FieldFallbackViewPublicProps - & NullConditionFilterPublicProps - & { - field: SugaredFieldProps['field'] - options: Record - format?: (value: string | null) => ReactNode - initialFilter?: EnumCellArtifacts - } - -export type EnumCellArtifacts = { - values: string[] - nullCondition: boolean -} - -/** @deprecated */ -type LegacyEnumCellArtifacts = string[] - -/** - * DataGrid cells for enums fields. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const EnumCell = Component(props => { - return ( - - {...props} - enableOrdering={true} - getNewOrderBy={(newDirection, { environment }) => - newDirection ? QueryLanguage.desugarOrderBy(`${props.field as string} ${newDirection}`, environment) : undefined - } - enableFiltering={true} - getNewFilter={(filter, { environment }) => { - const { values, nullCondition = false } = Array.isArray(filter) ? { - values: filter, - } : filter - - if (values.length === 0 && !nullCondition) { - return undefined - } - const desugared = QueryLanguage.desugarRelativeSingleField(props.field, environment) - - const conditions: Input.Condition[] = [] - - if (nullCondition) { - conditions.push({ isNull: true }) - } - - conditions.push({ - in: values.map(it => new GraphQlLiteral(it)), - }) - - return wrapFilterInHasOnes(desugared.hasOneRelationPath, { - [desugared.field]: { or: conditions }, - }) - }} - emptyFilter={{ nullCondition: false, values: [] }} - filterRenderer={({ filter: inFilter, setFilter, environment }) => { - const filter = useMemo(() => Array.isArray(inFilter) ? { nullCondition: false, values: inFilter } : inFilter, [inFilter]) - const values = filter.values - - const checkboxList = Object.entries(props.options).map(([value, label]) => ( - - { - setFilter({ ...filter, values: checked ? [...values, value] : values.filter(it => it !== value) }) - }} - /> - - )) - - return ( - - {checkboxList} - - - ) - }} - > - field={props.field} format={value => { - if (value === null) { - return - } - if (props.format) { - return props.format(props.options[value]) - } - return props.options[value] - }} /> - - ) -}, 'EnumCell') diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/GenericCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/GenericCell.tsx deleted file mode 100644 index 8d73364f04..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/GenericCell.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Component } from '@contember/binding' -import type { FunctionComponent } from 'react' -import { DataGridColumn, DataGridColumnPublicProps } from '../base' - -export type GenericCellProps = DataGridColumnPublicProps - -/** - * Cell for displaying arbitrary content such as buttons. This cell does not support sorting or filtering. - * - * @example - * ``` - * - * Edit - * - * - * ``` - * - * @group Data grid - */ -export const GenericCell: FunctionComponent = Component(props => { - return ( - {...props} enableOrdering={false} enableFiltering={false}> - {props.children} - - ) -}, 'GenericCell') diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasOneSelectCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasOneSelectCell.tsx deleted file mode 100644 index 9ea11326ed..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasOneSelectCell.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { - Component, - HasOne, - QueryLanguage, - SugaredRelativeSingleEntity, - useEntity, - wrapFilterInHasOnes, -} from '@contember/binding' -import type { FunctionComponent } from 'react' -import { DataGridColumn, DataGridColumnPublicProps } from '../base' -import { renderDynamicChoiceFieldStatic } from '../../../fields/ChoiceField/renderDynamicChoiceFieldStatic' -import { BaseDynamicChoiceField } from '../../../fields' -import { FieldFallbackView, FieldFallbackViewPublicProps } from '../../../fieldViews' -import { SelectCellArtifacts, SelectCellFilter } from './SelectCellFilter' -import { useDesugaredOptionPath } from '../../../fields/ChoiceField/hooks/useDesugaredOptionPath' - -export type HasOneSelectProps = - & DataGridColumnPublicProps - & BaseDynamicChoiceField - & FieldFallbackViewPublicProps - & SugaredRelativeSingleEntity - & { - initialFilter?: SelectCellArtifacts - } - -/** - * DataGrid cell which allows displaying and filtering by has-one relations. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const HasOneSelectCell: FunctionComponent = Component(props => { - return ( - - {...props} - enableOrdering={false} - getNewFilter={(filter, { environment }) => { - if (filter.id.length === 0 && filter.nullCondition === false) { - return undefined - } - const desugared = QueryLanguage.desugarRelativeSingleEntity(props, environment) - const conditions = [] - if (filter.id.length > 0) { - conditions.push({ in: filter.id }) - } - if (filter.nullCondition === true) { - conditions.push({ isNull: true }) - } - - return wrapFilterInHasOnes(desugared.hasOneRelationPath, { - id: { or: conditions }, - }) - }} - emptyFilter={{ - id: [], - nullCondition: false, - }} - filterRenderer={filterProps => } - > - - - ) -}, 'HasOneSelectField') - -const HasOneSelectCellContent = Component( - props => { - const desugaredOptionPath = useDesugaredOptionPath(props, undefined) - const entity = useEntity(props).getEntity({ field: desugaredOptionPath.hasOneRelationPath }) - - if ('renderOption' in props) { - return <>{props.renderOption(entity)} - } - - if ('field' in desugaredOptionPath) { - const val = entity.getField(desugaredOptionPath).value - if (val !== null) { - return <>{val} - } - return - } - - if ('optionLabel' in props) { - return {props.optionLabel} - } - - return <> - - }, - (props, environment) => { - const { subTree, renderedOption } = renderDynamicChoiceFieldStatic(props, environment) - const { subTree: currentValuesSubtree } = renderDynamicChoiceFieldStatic(props, environment, { id: { in: [] } }) - - return ( - <> - {subTree} - {currentValuesSubtree} - - {renderedOption} - - - ) - }) diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NumberCell.tsx b/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NumberCell.tsx deleted file mode 100644 index 38f3a0b96d..0000000000 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NumberCell.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { Component, Field, QueryLanguage, SugaredRelativeSingleField, wrapFilterInHasOnes } from '@contember/binding' -import { Input } from '@contember/client' -import { NumberInput, Select, Stack } from '@contember/ui' -import type { FunctionComponent, ReactNode } from 'react' -import { useMessageFormatter } from '../../../../../i18n' -import { FieldFallbackView, FieldFallbackViewPublicProps } from '../../../fieldViews' -import { DataGridCellPublicProps, DataGridColumn, DataGridHeaderCellPublicProps, DataGridOrderDirection } from '../base' -import { NullConditionFilter, NullConditionFilterPublicProps } from './NullConditionFilter' -import { dataGridCellsDictionary } from './dataGridCellsDictionary' - -export type NumberCellProps = - & DataGridHeaderCellPublicProps - & DataGridCellPublicProps - & FieldFallbackViewPublicProps - & SugaredRelativeSingleField - & NullConditionFilterPublicProps - & { - disableOrder?: boolean - initialOrder?: DataGridOrderDirection - format?: (value: number) => ReactNode - initialFilter?: NumberFilterArtifacts - } - -export type NumberFilterArtifacts = { - mode: 'eq' | 'gte' | 'lte' - query: number | null - nullCondition: boolean -} - -/** - * DataGrid cell for displaying a content of number field. - * - * @example - * ``` - * - * ``` - * - * @group Data grid - */ -export const NumberCell: FunctionComponent = Component(props => { - return ( - - {...props} - enableOrdering={!props.disableOrder as true} - getNewOrderBy={(newDirection, { environment }) => - newDirection ? QueryLanguage.desugarOrderBy(`${props.field as string} ${newDirection}`, environment) : undefined - } - getNewFilter={(filter, { environment }) => { - if (filter.query === null && !filter.nullCondition) { - return undefined - } - - const baseOperators = { - eq: 'eq', - gte: 'gte', - lte: 'lte', - } - - const conditions: Input.Condition[] = [] - if (filter.query !== null) { - conditions.push({ - [baseOperators[filter.mode]]: filter.query, - }) - } - if (filter.nullCondition) { - conditions.push({ isNull: true }) - } - - const desugared = QueryLanguage.desugarRelativeSingleField(props, environment) - return wrapFilterInHasOnes(desugared.hasOneRelationPath, { - [desugared.field]: { or: conditions }, - }) - }} - emptyFilter={{ - mode: 'eq', - query: null, - nullCondition: false, - }} - filterRenderer={({ filter, setFilter, environment }) => { - const formatMessage = useMessageFormatter(dataGridCellsDictionary) - const options: Array<{ - value: NumberFilterArtifacts['mode'] - label: string - }> = [ - { value: 'eq', label: formatMessage('dataGridCells.numberCell.equals') }, - { value: 'gte', label: formatMessage('dataGridCells.numberCell.greaterThan') }, - { value: 'lte', label: formatMessage('dataGridCells.numberCell.lessThan') }, - ] - return ( - - - - } - - - ) - }, -) - - -const SortableSelect = SortableContainer(Select) as React.ComponentClass, boolean, never> & SortableContainerProps> -const SortableMultiValue = SortableElement( - (props: MultiValueProps) => { - // this prevents the menu from being opened/closed when the user clicks - // on a value to begin dragging it. ideally, detecting a click (instead of - // a drag) would still focus the control and toggle the menu, but that - // requires some magic with refs that are out of scope for this example - const onMouseDown: MouseEventHandler = e => { - e.preventDefault() - e.stopPropagation() - } - const innerProps = { ...props.innerProps, onMouseDown } - return - }, -) - -const SortableMultiValueLabel = SortableHandle( - (props: MultiValueGenericProps) => , -) diff --git a/packages/admin/src/components/bindingFacade/fields/SelectField/SelectField.tsx b/packages/admin/src/components/bindingFacade/fields/SelectField/SelectField.tsx deleted file mode 100644 index 52e7396e72..0000000000 --- a/packages/admin/src/components/bindingFacade/fields/SelectField/SelectField.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { Component } from '@contember/binding' -import { FieldContainer, FieldContainerProps, FieldErrors, PublicCommonReactSelectStylesProps, SelectCreateNewWrapper, usePortalProvider } from '@contember/ui' -import { FunctionComponent, memo } from 'react' -import type { Props as SelectProps } from 'react-select' -import Select from 'react-select' -import { useLabelMiddleware } from '../../environment/LabelMiddleware' -import { - ChoiceField, - ChoiceFieldData, - DynamicSingleChoiceFieldProps, - StaticSingleChoiceFieldProps, -} from '../ChoiceField' -import { useCommonReactSelectProps } from './useCommonReactSelectProps' - -export type SelectFieldProps = - & SelectFieldInnerPublicProps - & ( - | StaticSingleChoiceFieldProps - | DynamicSingleChoiceFieldProps - ) - -/** - * @group Form Fields - */ -export const SelectField: FunctionComponent = Component( - props => ( - - {(choiceProps: ChoiceFieldData.SingleChoiceFieldMetadata) => ( - - )} - - ), - 'SelectField', -) - -export interface SelectFieldInnerPublicProps extends Omit { - placeholder?: string - allowNull?: boolean - reactSelectProps?: Partial> -} - -export type SelectFieldInnerProps = - & ChoiceFieldData.SingleChoiceFieldMetadata - & SelectFieldInnerPublicProps - & PublicCommonReactSelectStylesProps - & { errors: FieldErrors | undefined } - -/** - * @internal - */ -export const SelectFieldInner = memo( - ({ - placeholder, - allowNull, - currentValue, - data, - errors, - // supressErrors, - menuZIndex, - onSelect, - onClear, - reactSelectProps, - onAddNew, - onSearch, - isLoading, - ...fieldContainerProps - }: SelectFieldInnerProps) => { - const selectProps = useCommonReactSelectProps({ - reactSelectProps, - placeholder, - data, - isInvalid: (errors?.length ?? 0) > 0, - onSearch, - menuZIndex, - }) - - const labelMiddleware = useLabelMiddleware() - - return ( - - - + } + + + ) +}) + +const SortableSelect = SortableContainer(Select) as React.ComponentClass, boolean, never> & SortableContainerProps> +const SortableMultiValue = SortableElement( + (props: MultiValueProps) => { + // this prevents the menu from being opened/closed when the user clicks + // on a value to begin dragging it. ideally, detecting a click (instead of + // a drag) would still focus the control and toggle the menu, but that + // requires some magic with refs that are out of scope for this example + const onMouseDown: MouseEventHandler = e => { + e.preventDefault() + e.stopPropagation() + } + const innerProps = { ...props.innerProps, onMouseDown } + return + }, +) + +const SortableMultiValueLabel = SortableHandle( + (props: MultiValueGenericProps) => , +) diff --git a/packages/react-choice-field-ui/src/components/rendering/RadioFieldRenderer.tsx b/packages/react-choice-field-ui/src/components/rendering/RadioFieldRenderer.tsx new file mode 100644 index 0000000000..182410bc9d --- /dev/null +++ b/packages/react-choice-field-ui/src/components/rendering/RadioFieldRenderer.tsx @@ -0,0 +1,51 @@ +import { EntityAccessor, FieldValue, useLabelMiddleware } from '@contember/react-binding' +import type { RadioProps } from '@contember/ui' +import { FieldContainer, FieldContainerProps, Radio } from '@contember/ui' +import { memo, ReactNode, useMemo } from 'react' +import { ChoiceFieldSingleOption, SingleChoiceFieldRendererProps } from '@contember/react-choice-field' +import { useAccessorErrors } from '@contember/react-binding-ui' + + +export type RadioFieldRendererPublicProps = + & Omit + & Pick + +export type RadioFieldRendererProps = + & SingleChoiceFieldRendererProps + & RadioFieldRendererPublicProps + +export const RadioFieldRenderer = memo((props: RadioFieldRendererProps) => { + const formattedErrors = useAccessorErrors(props.errors) + const labelMiddleware = useLabelMiddleware() + const [options, optionsByKey] = useMemo(() => { + const options: { value: string, label: ReactNode, labelDescription?: ReactNode }[] = [] + const optionsByKey = new Map>() + for (const option of props.data) { + const value = option.key.toString() + options.push({ + value: value, + label: option.label, + labelDescription: option.description, + }) + optionsByKey.set(value, option) + } + return [options, optionsByKey] + }, [props.data]) + + return ( + + props.onSelect(optionsByKey.get(it)?.value as T)} + options={options} + size={props.size} + orientation={props.orientation} + value={props.currentValue?.key} + /> + + ) +}) diff --git a/packages/react-choice-field-ui/src/components/rendering/SelectFieldRenderer.tsx b/packages/react-choice-field-ui/src/components/rendering/SelectFieldRenderer.tsx new file mode 100644 index 0000000000..13b94b19b1 --- /dev/null +++ b/packages/react-choice-field-ui/src/components/rendering/SelectFieldRenderer.tsx @@ -0,0 +1,118 @@ +import { EntityAccessor, useLabelMiddleware } from '@contember/react-binding' +import { + FieldContainer, + FieldContainerProps, + PublicCommonReactSelectStylesProps, + SelectCreateNewWrapper, + usePortalProvider, +} from '@contember/ui' +import { ComponentType, memo, ReactElement } from 'react' +import type { Props as SelectProps } from 'react-select' +import Select from 'react-select' +import { useAccessorErrors } from '@contember/react-binding-ui' +import { ChoiceFieldSingleOption, SingleChoiceFieldRendererProps, ChoiceFieldProps, BaseDynamicChoiceField } from '@contember/react-choice-field' +import { useCommonReactSelectProps } from '../../hooks/useCommonReactSelectProps' +import { useOpenCreateNewDialog } from '../../hooks/useOpenCreateNewDialog' + + +export type SelectFieldRendererPublicProps = + & Omit + & PublicCommonReactSelectStylesProps + & { + placeholder?: string + allowNull?: boolean + reactSelectProps?: Partial> + createNewForm?: ReactElement + } + +export type SelectFieldRendererProps = + & SelectFieldInnerProps + & ChoiceFieldProps + + +const typedMemo: (component: T) => T = memo + +/** + * @internal + */ +export const SelectFieldRenderer = memo(({ + createNewForm, + ...props +}: SelectFieldRendererProps) => { + let onAddNew: undefined | (() => void) = undefined + if (!Array.isArray(props.options)) { + // eslint-disable-next-line react-hooks/rules-of-hooks + onAddNew = useOpenCreateNewDialog({ + ...(props as BaseDynamicChoiceField), + createNewForm, + connect: props.onSelect as SingleChoiceFieldRendererProps['onSelect'], + }) + } + return {...props} onAddNew={onAddNew} /> +}) +SelectFieldRenderer.displayName = 'SelectFieldRenderer' + + +export type SelectFieldInnerProps = + & SingleChoiceFieldRendererProps + & SelectFieldRendererPublicProps + & { + onAddNew?: () => void + } + +export const SelectFieldInner = typedMemo(({ + placeholder, + allowNull, + currentValue, + data, + errors, + // supressErrors, + menuZIndex, + onSelect, + onClear, + reactSelectProps, + onSearch, + isLoading, + createNewForm, + onAddNew, + ...props +}: SelectFieldInnerProps) => { + const errorsFormatted = useAccessorErrors(errors) + const selectProps = useCommonReactSelectProps({ + reactSelectProps, + placeholder, + data, + isInvalid: (errors?.length ?? 0) > 0, + onSearch, + menuZIndex, + }) + + const labelMiddleware = useLabelMiddleware() + return ( + + + { + if (!value) { + return + } + + setFilter({ + ...filter, + mode: value, + }) + }} + /> + { + setFilter({ + ...filter, + query: value ?? null, + }) + }} + /> + + + + ) +} diff --git a/packages/react-datagrid-ui/src/filters/SelectCellFilter.tsx b/packages/react-datagrid-ui/src/filters/SelectCellFilter.tsx new file mode 100644 index 0000000000..cb2e014648 --- /dev/null +++ b/packages/react-datagrid-ui/src/filters/SelectCellFilter.tsx @@ -0,0 +1,64 @@ +import { Checkbox, FieldContainer, Stack } from '@contember/ui' +import { useMemo } from 'react' +import { ChoiceFieldOptions } from '@contember/react-choice-field' +import { MultiSelectFieldInner } from '@contember/react-choice-field-ui' +import { dataGridCellsDictionary } from '../dict/dataGridCellsDictionary' +import { EntityAccessor } from '@contember/react-binding' + +import { FilterRendererProps, SelectCellArtifacts, SelectCellFilterExtraProps } from '@contember/react-datagrid' +import { useMessageFormatter } from '@contember/react-i18n' + +export type SelectCellFilterProps = + & FilterRendererProps + & SelectCellFilterExtraProps + +/** + * DataGrid filter component for rendering selects in custom cells. Usually, you just use {@link HasManySelectCell} or {@link HasOneSelectCell} + * + * @group Data grid + */ +export const SelectCellFilter = ({ filter, setFilter, options, allOptions, onSearch, isLoading }: SelectCellFilterProps) => { + const currentValues = useMemo>(() => { + return allOptions.filter(it => filter.id.includes(it.value.id)) + }, [filter.id, allOptions]) + const formatMessage = useMessageFormatter(dataGridCellsDictionary) + + return ( + + setFilter({ ...filter, id: [...filter.id, val.id] })} + onRemove={val => setFilter({ ...filter, id: filter.id.filter(it => it !== val.id) })} + errors={undefined} + currentValues={currentValues} + onClear={() => { + setFilter({ ...filter, id: [] }) + }} + onSearch={onSearch} + isLoading={isLoading} + /> + + + {formatMessage('dataGridCells.textCell.includeNull', { + strong: chunks => {chunks}, + })} + } + labelPosition="right" + > + { + setFilter({ + ...filter, + nullCondition: !!checked, + }) + }} + /> + + + ) +} diff --git a/packages/react-datagrid-ui/src/filters/TextCellFilter.tsx b/packages/react-datagrid-ui/src/filters/TextCellFilter.tsx new file mode 100644 index 0000000000..6b7d017cc3 --- /dev/null +++ b/packages/react-datagrid-ui/src/filters/TextCellFilter.tsx @@ -0,0 +1,37 @@ +import { dataGridCellsDictionary } from '../dict/dataGridCellsDictionary' +import { GenericTextCellFilter } from './GenericTextCellFilter' +import { FilterRendererProps, TextFilterArtifacts } from '@contember/react-datagrid' +import { Checkbox, FieldContainer, Stack } from '@contember/ui' +import { useMessageFormatter } from '@contember/react-i18n' + +export const TextCellFilter = ({ filter, setFilter, ...props }: FilterRendererProps) => { + const formatMessage = useMessageFormatter(dataGridCellsDictionary) + const label = ( + + {filter.mode === 'doesNotMatch' + ? formatMessage('dataGridCells.textCell.excludeNull', { + strong: chunks => {chunks}, + }) + : formatMessage('dataGridCells.textCell.includeNull', { + strong: chunks => {chunks}, + })} + + ) + return ( + + + + { + setFilter({ + ...filter, + nullCondition: !!checked, + }) + }} + /> + + + ) +} diff --git a/packages/react-datagrid-ui/src/filters/index.ts b/packages/react-datagrid-ui/src/filters/index.ts new file mode 100644 index 0000000000..5ab873200e --- /dev/null +++ b/packages/react-datagrid-ui/src/filters/index.ts @@ -0,0 +1,8 @@ +export * from './BooleanCellFilter' +export * from './EnumCellFilter' +export * from './GenericTextCellFilter' +export * from './HasManyAbsentCellFilter' +export * from './NullConditionFilter' +export * from './NumberCellFilter' +export * from './SelectCellFilter' +export * from './TextCellFilter' diff --git a/packages/react-datagrid-ui/src/index.ts b/packages/react-datagrid-ui/src/index.ts new file mode 100644 index 0000000000..d12df7e351 --- /dev/null +++ b/packages/react-datagrid-ui/src/index.ts @@ -0,0 +1,12 @@ +export * from './cells' +export * from './dict/dataGridCellsDictionary' +export * from './dict/dataGridDictionary' +export * from './filters' +export * from './rendering' + +export * from './DataGrid' + +export * from './types' + + +export * from '@contember/react-datagrid' diff --git a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx b/packages/react-datagrid-ui/src/rendering/DataGridColumnHiding.tsx similarity index 63% rename from packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx rename to packages/react-datagrid-ui/src/rendering/DataGridColumnHiding.tsx index 7070e33f99..db38e97709 100644 --- a/packages/admin/src/components/bindingFacade/collections/DataGrid/base/DataGridColumnHiding.tsx +++ b/packages/react-datagrid-ui/src/rendering/DataGridColumnHiding.tsx @@ -1,21 +1,24 @@ import { Box, Checkbox, Dropdown, DropdownProps, FieldContainer, TableColumnsIcon, Text } from '@contember/ui' import { Fragment, ReactElement, useMemo } from 'react' -import type { MessageFormatter } from '../../../../../i18n' -import type { DataGridSetIsColumnHidden } from './DataGridSetIsColumnHidden' -import type { DataGridState } from './DataGridState' -import type { DataGridDictionary } from './dataGridDictionary' +import { useMessageFormatter } from '@contember/react-i18n' +import { dataGridDictionary } from '../dict/dataGridDictionary' +import { DataGridRenderingCommonProps } from '../types' -export interface DataGridColumnHidingProps { - desiredState: DataGridState - formatMessage: MessageFormatter - setIsColumnHidden: DataGridSetIsColumnHidden +export type DataGridColumnHidingPublicProps = { + allowColumnVisibilityControls?: boolean } -export function DataGridColumnHiding({ +export type DataGridColumnHidingProps = + & DataGridRenderingCommonProps + & DataGridColumnHidingPublicProps + +export const DataGridColumnHiding = ({ desiredState, - formatMessage, - setIsColumnHidden, -}: DataGridColumnHidingProps): ReactElement | null { + displayedState, + stateMethods: { setIsColumnHidden }, + allowColumnVisibilityControls, +}: DataGridColumnHidingProps): ReactElement | null => { + const formatMessage = useMessageFormatter(dataGridDictionary) const buttonProps: DropdownProps['buttonProps'] = useMemo(() => ({ intent: 'default', distinction: 'seamless', @@ -28,6 +31,10 @@ export function DataGridColumnHiding({ size: 'small', }), [formatMessage]) + if (allowColumnVisibilityControls === false || displayedState.layout === 'tiles') { + return null + } + return ( dataGrid.columnHiding.heading}> diff --git a/packages/react-datagrid-ui/src/rendering/DataGridContainer.tsx b/packages/react-datagrid-ui/src/rendering/DataGridContainer.tsx new file mode 100644 index 0000000000..fbaaba326c --- /dev/null +++ b/packages/react-datagrid-ui/src/rendering/DataGridContainer.tsx @@ -0,0 +1,32 @@ +import { ComponentType, memo } from 'react' +import { Stack } from '@contember/ui' +import { DataGridHeader } from './DataGridHeader' +import { DataGridContent } from './DataGridContent' +import { DataGridFooter } from './DataGridFooter' +import { DataGridRenderingCommonProps } from '../types' +import { useClassName } from '@contember/react-utils' + + +export const createDataGridContainer = ({ Header, Content, Footer }: { + Header: ComponentType, + Content: ComponentType, + Footer: ComponentType, +}) => memo(props => { + return ( + +
+ +