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

datagrid fixes #650

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build/api/admin.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,13 @@ export const DataGridPageRenderer: React.NamedExoticComponent<LayoutRendererProp
export type DataGridPageRendererProps = LayoutRendererProps & DataGridContainerProps;

// @public (undocumented)
export const DataGridScope: <StateProps>({ stateComponent, stateProps, ...props }: DataGridScopeProps<StateProps>) => JSX.Element;
export const DataGridScope: <StateProps>({ stateComponent, stateProps, skipBindingStateUpdateAfterPersist, refreshDataBindingOnPersist, ...props }: DataGridScopeProps<StateProps>) => JSX.Element;

// @public (undocumented)
export type DataGridScopeProps<StateProps> = PropsWithChildren<DataGridProps<DataGridContainerPublicProps>> & DataBindingProviderStateComponent<StateProps>;
export type DataGridScopeProps<StateProps> = PropsWithChildren<DataGridProps<DataGridContainerPublicProps>> & DataBindingProviderStateComponent<StateProps> & {
refreshDataBindingOnPersist?: boolean;
skipBindingStateUpdateAfterPersist?: boolean;
};

// @public (undocumented)
export const DefaultElement: FunctionComponent<DefaultElementProps>;
Expand Down
13 changes: 11 additions & 2 deletions packages/admin/src/components/pageRouting/Scopes/DataGridScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import { scopeComponent } from './scopeComponent'
export type DataGridScopeProps<StateProps> =
& PropsWithChildren<DataGridProps<DataGridContainerPublicProps>>
& DataBindingProviderStateComponent<StateProps>
& {
refreshDataBindingOnPersist?: boolean
skipBindingStateUpdateAfterPersist?: boolean
}

/**
* @group Scopes
*/
export const DataGridScope = scopeComponent(
<StateProps, /*JSX FIX*/>({ stateComponent, stateProps, ...props }: DataGridScopeProps<StateProps>) => (
<DataBindingProvider stateComponent={stateComponent ?? FeedbackRenderer} stateProps={stateProps}>
<StateProps, >({ stateComponent, stateProps, skipBindingStateUpdateAfterPersist, refreshDataBindingOnPersist, ...props }: DataGridScopeProps<StateProps>) => (
<DataBindingProvider
stateComponent={stateComponent ?? FeedbackRenderer}
stateProps={stateProps}
skipStateUpdateAfterPersist={skipBindingStateUpdateAfterPersist}
refreshOnPersist={refreshDataBindingOnPersist ?? true}
>
<DataGrid {...props} />
</DataBindingProvider>
),
Expand Down
6 changes: 4 additions & 2 deletions packages/react-datagrid/src/grid/createDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const dummyStateMethods: DataGridStateMethods = {

const createInitialState = (props: DataGridProps<{}>, environment: Environment): DataGridState<any> => {
const columns = extractDataGridColumns(props.children, environment)
const entities = QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, environment)
const filter = { and: [entities.filter ?? {}] }
return {
columns,
paging: {
Expand All @@ -46,8 +48,8 @@ const createInitialState = (props: DataGridProps<{}>, environment: Environment):
filterArtifacts: {},
orderDirections: {},
orderBy: [],
entities: QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, environment),
filter: { and: [{}] },
entities: entities,
filter,
layout: 'default',
}
}
Loading