Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headless improvements #680

Merged
merged 40 commits into from Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d96aac1
feat(binding): add "name" to entity list accessor
matej21 Mar 13, 2024
72e2d96
feat(binding): add getMarker to entity list accessor
matej21 Mar 13, 2024
676b651
feat(react-dataview): add DataViewHasFilterType component
matej21 Mar 13, 2024
a25c946
feat(react-select): auto detect options and filter fields
matej21 Mar 13, 2024
d01c2c6
refactor(playground): update selects
matej21 Mar 13, 2024
3d3d5f8
feat(playground): add select or type field
matej21 Mar 14, 2024
ce5aa4e
fix(playground): radio enum default value
matej21 Mar 14, 2024
bdf03fc
feat(react-dataview): debounce input
matej21 Mar 14, 2024
f1cc908
refactor(react-dataview): drop graphql literals in filter resolver
matej21 Mar 15, 2024
a14a317
refactor(playground): rename datagrid components
matej21 Mar 15, 2024
25b60d1
feat(playground): add unified datagrid text filter
matej21 Mar 15, 2024
90407dc
feat(binding): export query generator
matej21 Mar 15, 2024
e41ecca
feat(playground): universal export init
matej21 Mar 15, 2024
4ff53b9
feat(playground): grid settings ui improvements
matej21 Mar 18, 2024
29bf384
feat(playground): support roles in menu
matej21 Mar 18, 2024
f6041f7
refactor(react-utils): change stored state api a bit, introduce local…
matej21 Mar 18, 2024
8c54dac
fix(react-select): set correct expectedMutation
matej21 Mar 18, 2024
890abf9
refactor(react-dataview): use local storage for some state, allow to …
matej21 Mar 18, 2024
1f3e02e
feat(react-select): disable filter / sorting / page store
matej21 Mar 18, 2024
9cf61ff
feat(playground): disable state store for relation filter
matej21 Mar 18, 2024
bbd6d42
refactor(react-dataview): move and refactor auto export
matej21 Mar 19, 2024
7318ead
feat(playground): add grid comments - indirect relation in grid example
matej21 Mar 20, 2024
dfe9b1c
refactor(playground): improve datagrid toolbar wrapping
matej21 Mar 20, 2024
3946d03
feat(playground): sample of custom grid
matej21 Mar 20, 2024
4b15a8e
feat(playground): board autosave
matej21 Mar 21, 2024
4ebd9b7
feat(playground): autoclose left sidebar on request change on mobile
matej21 Mar 22, 2024
786ecb0
feat(react-dataview): add children analyzer to find filters
matej21 Mar 22, 2024
6ea9e05
refactor(react-dataview)!: rename coalesce filter to unionText filter
matej21 Mar 22, 2024
8969292
fix(admin-sandbox): compat fix
matej21 Mar 22, 2024
aa67e2d
refactor(playground): filters analyzer support
matej21 Mar 22, 2024
6ecdc4d
refactor(playground): layout refactoring, extract main ui components
matej21 Mar 22, 2024
e930402
refactor(playground): new menu api
matej21 Mar 22, 2024
677725c
feat(playground): better grid responsivity
matej21 Mar 22, 2024
d11dddc
fix(react-dataview): fix debounced state
matej21 Mar 22, 2024
3107e25
chore: fix deps
matej21 Mar 22, 2024
76910b6
chore: ae up
matej21 Mar 22, 2024
670ad34
refactor(playground): change table cell padding;
matej21 Mar 25, 2024
3ae9375
refactor(playground): change grid tooltip label
matej21 Mar 25, 2024
d92f612
feat(react-upload): export upload client
matej21 Mar 25, 2024
af5ff08
fix: some ae warnings fix
matej21 Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion build/api/binding.api.md
Expand Up @@ -4,6 +4,8 @@

```ts

import { ContentEntitySelection } from '@contember/client';
import { ContentQuery } from '@contember/client';
import { ContentQueryBuilder } from '@contember/client';
import type { CrudQueryBuilder } from '@contember/client';
import { EmbeddedActionsParser } from 'chevrotain';
Expand Down Expand Up @@ -319,7 +321,7 @@ export class EntityListAccessor implements Errorable {
[Symbol.iterator](): IterableIterator<EntityAccessor>;
// Warning: (ae-forgotten-export) The symbol "EntityListState" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ListOperations" needs to be exported by the entry point index.d.ts
constructor(state: EntityListState, operations: ListOperations, _children: ReadonlyMap<EntityId, {
constructor(state: EntityListState, operations: ListOperations, name: EntityName, _children: ReadonlyMap<EntityId, {
getAccessor: EntityAccessor.GetEntityAccessor;
}>, _idsPersistedOnServer: ReadonlySet<EntityId>, hasUnpersistedChanges: boolean, errors: ErrorAccessor | undefined, environment: Environment, getAccessor: EntityListAccessor.GetEntityListAccessor);
// (undocumented)
Expand Down Expand Up @@ -357,6 +359,8 @@ export class EntityListAccessor implements Errorable {
// (undocumented)
getChildEntityById(id: EntityId): EntityAccessor;
// (undocumented)
getMarker(): EntityListSubTreeMarker | HasManyRelationMarker;
// (undocumented)
getParent(): EntityAccessor | undefined;
// (undocumented)
hasEntityId(id: EntityId): boolean;
Expand All @@ -372,6 +376,8 @@ export class EntityListAccessor implements Errorable {
keys(): IterableIterator<EntityRealmKey>;
// (undocumented)
get length(): number;
// (undocumented)
readonly name: EntityName;
}

// @public (undocumented)
Expand Down Expand Up @@ -1339,6 +1345,15 @@ export interface QualifiedSingleEntityParameters {
where: UniqueWhere;
}

// @public (undocumented)
export class QueryGenerator {
constructor(tree: MarkerTreeRoot, qb: ContentQueryBuilder);
// (undocumented)
getReadQuery(): Record<string, ContentQuery<any>>;
// (undocumented)
static registerQueryPart(fields: EntityFieldMarkers, selection: ContentEntitySelection): ContentEntitySelection;
}

// @public (undocumented)
export class QueryLanguage {
// (undocumented)
Expand Down
3 changes: 1 addition & 2 deletions build/api/react-datagrid-ui.api.md
Expand Up @@ -8,7 +8,6 @@ import { BooleanCellRendererProps } from '@contember/react-datagrid';
import { BooleanFilterArtifacts } from '@contember/react-dataview';
import { CoalesceCellRendererProps } from '@contember/react-datagrid';
import { CoalesceFieldViewProps } from '@contember/react-binding-ui';
import { CoalesceTextFilterArtifacts } from '@contember/react-dataview';
import { ComponentType } from 'react';
import { DataGridColumnCommonProps } from '@contember/react-datagrid';
import { DataGridColumnProps } from '@contember/react-datagrid';
Expand Down Expand Up @@ -68,7 +67,7 @@ export const BooleanCellFilter: ({ setFilter, filter }: FilterRendererProps<Bool

// @public
export const CoalesceTextCell: FunctionComponent<DataGridColumnCommonProps & CoalesceCellRendererProps & {
initialFilter?: CoalesceTextFilterArtifacts | undefined;
initialFilter?: TextFilterArtifacts | undefined;
} & DataGridCellPublicProps & DataGridHeaderCellPublicProps & CoalesceFieldViewProps<FieldValue>>;

// @public
Expand Down
9 changes: 4 additions & 5 deletions build/api/react-datagrid.api.md
Expand Up @@ -6,7 +6,6 @@

import { BaseDynamicChoiceField } from '@contember/react-choice-field';
import { BooleanFilterArtifacts } from '@contember/react-dataview';
import { CoalesceTextFilterArtifacts } from '@contember/react-dataview';
import { ComponentType } from 'react';
import { DataViewFilterArtifact } from '@contember/react-dataview';
import { DataViewFilterHandler } from '@contember/react-dataview';
Expand Down Expand Up @@ -48,12 +47,12 @@ export type BooleanCellRendererProps = {
// @public (undocumented)
export type CoalesceCellRendererProps = {
fields: (SugarableRelativeSingleField | string)[];
initialFilter?: CoalesceTextFilterArtifacts;
initialFilter?: TextFilterArtifacts;
};

// @public (undocumented)
export type CoalesceTextCellProps = DataGridColumnCommonProps & CoalesceCellRendererProps & {
initialFilter?: CoalesceTextFilterArtifacts;
initialFilter?: TextFilterArtifacts;
};

// @public (undocumented)
Expand All @@ -76,10 +75,10 @@ export const createBooleanCell: <ColumnProps extends {}, ValueRendererProps exte

// @public (undocumented)
export const createCoalesceTextCell: <ColumnProps extends {}, ValueRendererProps extends {}>({ FilterRenderer, ValueRenderer }: {
FilterRenderer: ComponentType<FilterRendererProps<CoalesceTextFilterArtifacts>>;
FilterRenderer: ComponentType<FilterRendererProps<TextFilterArtifacts>>;
ValueRenderer: ComponentType<CoalesceCellRendererProps & ValueRendererProps>;
}) => FunctionComponent<DataGridColumnCommonProps & CoalesceCellRendererProps & {
initialFilter?: CoalesceTextFilterArtifacts | undefined;
initialFilter?: TextFilterArtifacts | undefined;
} & ColumnProps & ValueRendererProps>;

// @public (undocumented)
Expand Down
128 changes: 116 additions & 12 deletions build/api/react-dataview.api.md
Expand Up @@ -5,16 +5,22 @@
```ts

import { ChangeEvent } from 'react';
import { ChildrenAnalyzer } from '@contember/react-multipass-rendering';
import { EntityAccessor } from '@contember/react-binding';
import { EntityAccessor as EntityAccessor_2 } from '@contember/binding';
import { EntityId } from '@contember/react-binding';
import { EntityId as EntityId_2 } from '@contember/binding';
import { EntityListAccessor } from '@contember/binding';
import { EntityListSubTreeLoaderState } from '@contember/react-binding';
import { EntityListSubTreeMarker } from '@contember/binding';
import { EntityListSubTreeMarker as EntityListSubTreeMarker_2 } from '@contember/react-binding';
import { Environment } from '@contember/react-binding';
import { Environment as Environment_2 } from '@contember/binding';
import { FieldMarker } from '@contember/binding';
import { Filter } from '@contember/binding';
import { ForwardRefExoticComponent } from 'react';
import { HasManyRelationMarker } from '@contember/binding';
import { HasOneRelationMarker } from '@contember/binding';
import { Input } from '@contember/client';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { JSXElementConstructor } from 'react';
Expand All @@ -28,6 +34,7 @@ import { ReactNode } from 'react';
import { RefAttributes } from 'react';
import { Serializable } from '@contember/react-utils';
import { SetStateAction } from 'react';
import { StateStorageOrName } from '@contember/react-utils';
import { SugaredOrderBy } from '@contember/binding';
import { SugaredQualifiedEntityList } from '@contember/binding';
import { SugaredRelativeEntityList } from '@contember/binding';
Expand All @@ -42,12 +49,6 @@ export type BooleanFilterArtifacts = {
nullCondition?: boolean;
};

// @public (undocumented)
export type CoalesceTextFilterArtifacts = {
mode?: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch';
query?: string;
};

// @public (undocumented)
export const ControlledDataView: NamedExoticComponent< {
children: ReactNode;
Expand All @@ -69,9 +70,6 @@ export type ControlledDataViewProps = {
// @public (undocumented)
export const createBooleanFilter: (field: SugaredRelativeSingleField['field']) => DataViewFilterHandler<BooleanFilterArtifacts>;

// @public (undocumented)
export const createCoalesceFilter: (fields: SugaredRelativeSingleField['field'][]) => DataViewFilterHandler<TextFilterArtifacts>;

// @public (undocumented)
export const createDateFilter: (field: SugaredRelativeSingleField['field']) => DataViewFilterHandler<DateRangeFilterArtifacts>;

Expand All @@ -96,6 +94,27 @@ export const createNumberRangeFilter: (field: SugaredRelativeSingleField['field'
// @public (undocumented)
export const createTextFilter: (field: SugaredRelativeSingleField['field']) => DataViewFilterHandler<TextFilterArtifacts>;

// @public (undocumented)
export const createUnionTextFilter: (fields: SugaredRelativeSingleField['field'][]) => DataViewFilterHandler<TextFilterArtifacts>;

// @public (undocumented)
export class CsvExportFactory implements ExportFactory {
// (undocumented)
create(args: ExportFormatterCreateOutputArgs): ExportResult;
// (undocumented)
protected createData(data: DataViewDataForExport): string[][];
// (undocumented)
protected createHeader(data: DataViewDataForExport): string[];
// (undocumented)
protected filterData(data: DataViewDataForExport): DataViewDataForExport;
// (undocumented)
protected flattenData(data: any[], marker: EntityListSubTreeMarker | HasOneRelationMarker | HasManyRelationMarker): DataViewDataForExport;
// (undocumented)
protected formatOutput(data: DataViewDataForExport): string;
// (undocumented)
protected formatValue(value: any): string;
}

// @public (undocumented)
const DataView_2: NamedExoticComponent<DataViewProps>;
export { DataView_2 as DataView }
Expand Down Expand Up @@ -125,6 +144,12 @@ export interface DataViewChangePageTriggerProps {
// @internal (undocumented)
export const DataViewCurrentKeyContext: React_2.Context<string>;

// @public (undocumented)
export type DataViewDataForExport = {
markerPath: (EntityListSubTreeMarker | HasOneRelationMarker | HasManyRelationMarker | FieldMarker)[];
values: any[];
}[];

// @public (undocumented)
export const DataViewDateFilterInput: ({ name, type, ...props }: {
name: string;
Expand Down Expand Up @@ -191,6 +216,27 @@ export const DataViewEnumFilterTrigger: ({ name, action, value, ...props }: {
action?: DataViewSetEnumFilterAction | undefined;
}) => JSX_2.Element;

// @public (undocumented)
export const DataViewExportTrigger: ({ fields, children, baseName, exportFactory }: DataViewExportTriggerProps) => JSX_2.Element;

// @public (undocumented)
export interface DataViewExportTriggerProps {
// (undocumented)
baseName?: string;
// (undocumented)
children: ReactElement;
// (undocumented)
exportFactory?: ExportFactory;
// (undocumented)
fields: ReactNode;
}

// @public (undocumented)
export const DataViewFilter: ({}: DataViewFilterProps) => never;

// @public (undocumented)
export const dataViewFilterAnalyzer: ChildrenAnalyzer<DataViewFilterProps, never, Environment_2<Environment_2.AnyNode | undefined>>;

// @public (undocumented)
export type DataViewFilterArtifact = Serializable;

Expand Down Expand Up @@ -224,21 +270,39 @@ export const DataViewFilteringMethodsContext: React_2.Context<DataViewFilteringM
export type DataViewFilteringProps = {
filterTypes?: DataViewFilterHandlerRegistry;
initialFilters?: DataViewFilteringArtifacts | ((stored: DataViewFilteringArtifacts) => DataViewFilteringArtifacts);
filteringStateStorage?: StateStorageOrName;
};

// @public (undocumented)
export type DataViewFilteringState = {
artifact: DataViewFilteringArtifacts;
filter: Filter;
filter: Filter<never>;
filterTypes: DataViewFilterHandlerRegistry;
};

// @internal (undocumented)
export const DataViewFilteringStateContext: React_2.Context<DataViewFilteringState>;

// @public (undocumented)
export type DataViewFilterProps = {
name: string;
filterHandler: DataViewFilterHandler<any>;
};

// @internal (undocumented)
export const DataViewGlobalKeyContext: React_2.Context<string>;

// @public (undocumented)
export const DataViewHasFilterType: ({ name, children }: DataViewHasFilterTypeProps) => JSX_2.Element | null;

// @public (undocumented)
export interface DataViewHasFilterTypeProps {
// (undocumented)
children: React.ReactNode;
// (undocumented)
name: string;
}

// @public (undocumented)
export const DataViewHasSelection: NamedExoticComponent<DataViewHasSelectionProps>;

Expand Down Expand Up @@ -358,8 +422,12 @@ export const DataViewPagingMethodsContext: React_2.Context<DataViewPagingMethods

// @public (undocumented)
export interface DataViewPagingProps {
// (undocumented)
currentPageStateStorage?: StateStorageOrName;
// (undocumented)
initialItemsPerPage?: number | null;
// (undocumented)
pagingSettingsStorage?: StateStorageOrName;
}

// @public (undocumented)
Expand Down Expand Up @@ -428,6 +496,7 @@ export const DataViewSelectionMethodsContext: React_2.Context<DataViewSelectionM
export type DataViewSelectionProps = {
initialSelection?: DataViewSelectionValues | ((stored: DataViewSelectionValues) => DataViewSelectionValues);
selectionFallback?: DataViewSelectionValue;
selectionStateStorage?: StateStorageOrName;
};

// @public (undocumented)
Expand Down Expand Up @@ -523,6 +592,7 @@ export const DataViewSortingMethodsContext: React_2.Context<DataViewSortingMetho
// @public (undocumented)
export type DataViewSortingProps = {
initialSorting?: DataViewSortingDirections;
sortingStateStorage?: StateStorageOrName;
};

// @public (undocumented)
Expand Down Expand Up @@ -575,8 +645,9 @@ export type DataViewState = {
};

// @public (undocumented)
export const DataViewTextFilterInput: ({ name, ...props }: {
export const DataViewTextFilterInput: ({ name, debounceMs, ...props }: {
name: string;
debounceMs?: number | undefined;
children: ReactElement;
}) => JSX_2.Element;

Expand Down Expand Up @@ -622,6 +693,28 @@ export type EnumFilterArtifacts = {
nullCondition?: boolean;
};

// @public (undocumented)
export interface ExportFactory {
// (undocumented)
create(args: ExportFormatterCreateOutputArgs): ExportResult;
}

// @public (undocumented)
export interface ExportFormatterCreateOutputArgs {
// (undocumented)
data: any[];
// (undocumented)
marker: EntityListSubTreeMarker | HasOneRelationMarker | HasManyRelationMarker;
}

// @public (undocumented)
export interface ExportResult {
// (undocumented)
blob: Blob;
// (undocumented)
extension: string;
}

// @public (undocumented)
export type GenericTextCellFilterArtifacts = {
mode?: 'matches' | 'matchesExactly' | 'startsWith' | 'endsWith' | 'doesNotMatch';
Expand Down Expand Up @@ -733,6 +826,14 @@ export const useDataViewEnumFilter: (name: string, value: string) => UseDataView
// @public (undocumented)
export const useDataViewEnumFilterFactory: (name: string) => (value: string) => UseDataViewEnumFilter;

// @public (undocumented)
export const useDataViewFetchAllData: ({ children }: {
children: ReactNode;
}) => () => Promise<{
data: any;
marker: EntityListSubTreeMarker_2;
}>;

// @public (undocumented)
export const useDataViewFilter: <T extends Serializable>(key: string) => [T | undefined, (filter: SetStateAction<T | undefined>) => void];

Expand Down Expand Up @@ -835,7 +936,10 @@ export const useDataViewSortingMethods: () => DataViewSortingMethods;
export const useDataViewSortingState: () => DataViewSortingState;

// @public (undocumented)
export const useDataViewTextFilterInput: (name: string) => UseDataViewTextFilterInputResult;
export const useDataViewTextFilterInput: ({ name, debounceMs }: {
name: string;
debounceMs?: number | undefined;
}) => UseDataViewTextFilterInputResult;

// @public (undocumented)
export interface UseDataViewTextFilterInputResult {
Expand Down