Components

Resource Components

AdminGuesser

<AdminGuesser> renders automatically an Admin component for resources exposed by a web API documented with any format supported by @api-platform/api-doc-parser (for Hydra documented APIs, use the HydraAdmin component instead, for OpenAPI documented APIs, use the OpenApiAdmin component instead). It also creates a schema analyzer context, where the schemaAnalyzer service (for getting information about the provided API documentation) is stored.

@api-platform/api-doc-parser でサポートされている任意の形式で文書化された Web API によって公開されたリソースの管理コンポーネントを自動的にレンダリングします (Hydra 文書化 API の場合は代わりに HydraAdmin コンポーネントを使用し、OpenAPI 文書化 API の場合は OpenApiAdmin コンポーネントを代わりに使用します)また、(提供された API ドキュメントに関する情報を取得するための) schemaAnalyzer サービスが格納されるスキーマ アナライザー コンテキストも作成します。

<AdminGuesser> renders all exposed resources by default, but you can choose what resource you want to render by passing ResourceGuesser components as children. Deprecated resources are hidden by default, but you can add them back using an explicit <ResourceGuesser> component.

デフォルトではすべての公開されたリソースをレンダリングしますが、ResourceGuesser コンポーネントを子として渡すことで、レンダリングするリソースを選択できます。

// App.js
import { AdminGuesser, ResourceGuesser } from "@api-platform/admin";

const App = () => (
  <AdminGuesser
    dataProvider={dataProvider}
    authProvider={authProvider}>
    <ResourceGuesser
      name="books"
      list={BooksList}
      show={BooksShow}
      edit={BooksEdit}
      create={BooksCreate} />
    <ResourceGuesser name="authors" />
  </AdminGuesser>
)

export default App;

Props

Name Type Value required Description
dataProvider object dataProvider yes communicates with your API
schemaAnalyzer object schemaAnalyzer yes retrieves resource type according to Schema.org vocabulary
theme object theme no theme of your Admin App
includeDeprecated boolean true or false no displays or not deprecated resources

ResourceGuesser

Based on React Admin Resource component, <ResourceGuesser> provides default props CreateGuesser, ListGuesser, EditGuesser and ShowGuesser.

React Admin Resource コンポーネントに基づいて、デフォルトの props CreateGuesser、ListGuesser、EditGuesser、および ShowGuesser を提供します。

Otherwise, you can pass it your own CRUD components using create, list, edit, show props.

それ以外の場合は、create、list、edit、show props を使用して独自の CRUD コンポーネントを渡すことができます。

// App.js
import { AdminGuesser, ResourceGuesser } from "@api-platform/admin";

const App = () => (
  <AdminGuesser
    dataProvider={dataProvider}
    schemaAnalyzer={schemaAnalyzer}
  >
    <ResourceGuesser
      name="books"
      list={BooksList}
      show={BooksShow}
      create={BooksCreate}
      edit={BooksEdit} />
    <ResourceGuesser name="reviews" />
  </AdminGuesser>
);

export default App;

ResourceGuesser Props

Name Type Value required Description
name string - yes endpoint of the resource

You can also use props accepted by React Admin Resource component. For example, the props list, show, create or edit.

React Admin Resource コンポーネントによって受け入れられる props を使用することもできます。たとえば、小道具のリスト、表示、作成、または編集。

Page Components

ListGuesser

Based on React Admin List, <ListGuesser> displays a list of resources in a Datagrid, according to children passed to it (usually FieldGuesser or any field component available in React Admin).

React Admin List に基づいて、渡された子 (通常は FieldGuesser または React Admin で使用可能なフィールド コンポーネント) に従って、Datagrid 内のリソースのリストを表示します。

Use hasShow and hasEdit props if you want to display show and edit buttons (both set to true by default).

表示ボタンと編集ボタンを表示する場合は、 hasShow および hasEdit プロパティを使用します (両方ともデフォルトで true に設定されています)。

By default, <ListGuesser> comes with Pagination.

デフォルトでは、ページネーションが付属しています。

// BooksList.js
import { FieldGuesser, ListGuesser } from "@api-platform/admin";
import { ReferenceField, TextField } from "react-admin";

export const BooksList = props => (
  <ListGuesser {...props}>
    <FieldGuesser source="author" />
    <FieldGuesser source="title" />
    <FieldGuesser source="rating" />
    <FieldGuesser source="description" />
    <FieldGuesser source="publicationDate" />
  </ListGuesser>
);

ListGuesser Props

Name Type Value required Description
filters element - no filters that can be applied to the list

You can also use props accepted by React Admin List.

React Admin List で承認された props を使用することもできます。

CreateGuesser

Displays a creation page for a single item. Uses React Admin Create and SimpleForm components. For simple inputs, you can pass as children API Platform Admin InputGuesser, or any React Admin Input components for more complex inputs.

単一のアイテムの作成ページを表示します。 React Admin Create および SimpleForm コンポーネントを使用します。単純な入力の場合は、子 API Platform Admin InputGuesser、またはより複雑な入力の React Admin Input コンポーネントとして渡すことができます。

// BooksCreate.js
import { CreateGuesser, InputGuesser } from "@api-platform/admin";

export const BooksCreate = props => (
  <CreateGuesser {...props}>
    <InputGuesser source="author" />
    <InputGuesser source="title" />
    <InputGuesser source="rating" />
    <InputGuesser source="description" />
    <InputGuesser source="publicationDate" />
  </CreateGuesser>
);

CreateGuesser Props

You can use props accepted by React Admin Create.

React Admin Create で承認された props を使用できます。

EditGuesser

Displays an edition page for a single item. Uses React Admin Edit and SimpleForm components. For simple inputs, you can use API Platform Admin InputGuesser, or any React Admin Input components for more complex inputs.

単一のアイテムのエディション ページを表示します。 React Admin Edit および SimpleForm コンポーネントを使用します。単純な入力については、API Platform Admin InputGuesser を使用するか、より複雑な入力については任意の React Admin Input コンポーネントを使用できます。

// BooksEdit.js
import { EditGuesser, InputGuesser } from "@api-platform/admin";

export const BooksEdit = props => (
  <EditGuesser {...props}>
    <InputGuesser source="author" />
    <InputGuesser source="title" />
    <InputGuesser source="rating" />
    <InputGuesser source="description" />
    <InputGuesser source="publicationDate" />
  </EditGuesser>
);

EditGuesser Props

You can use props accepted by React Admin Edit.

React Admin Edit で受け入れられた props を使用できます。

ShowGuesser

Displays a detailed page for one item. Based on React Admin Show component. You can pass FieldGuesser as children for simple fields, or use any of React Admin basic fields for more complex fields.

1項目の詳細ページを表示します。 React Admin Show コンポーネントに基づいています。単純なフィールドの子として FieldGuesser を渡すか、より複雑なフィールドに React Admin の基本フィールドのいずれかを使用できます。

// BooksShow.js
import { FieldGuesser, ShowGuesser } from "@api-platform/admin";

export const BooksShow = props => (
  <ShowGuesser {...props}>
    <FieldGuesser source="author" />
    <FieldGuesser source="title" />
    <FieldGuesser source="rating" />
    <FieldGuesser source="description" />
    <FieldGuesser source="publicationDate" />
  </ShowGuesser>
);

ShowGuesser Props

You can use props accepted by React Admin Show component.

React Admin Show コンポーネントで受け入れられる props を使用できます。

Hydra

HydraAdmin

Creates a complete Admin, as AdminGuesser, but configured specially for Hydra. If you want to use other formats (see supported formats: @api-platform/api-doc-parser) use AdminGuesser instead.

AdminGuesser として完全な Admin を作成しますが、Hydra 用に特別に構成されています。他の形式を使用する場合 (サポートされている形式を参照してください: @api-platform/api-doc-parser)、代わりに AdminGuesser を使用してください。

// App.js
import { HydraAdmin, ResourceGuesser } from "@api-platform/admin";

const App = () => (
  <HydraAdmin
    entrypoint={entrypoint}
    dataProvider={dataProvider}
    authProvider={authProvider}
   >
     <ResourceGuesser name="books" />
     { /* ... */ }
  </HydraAdmin>
);

export default App;

HydraAdmin Props

Name Type Value required Description
entrypoint string - yes entrypoint of the API
mercure object|boolean * no configuration to use Mercure
dataProvider object dataProvider no hydra data provider to use

* false to explicitly disable, true to enable with default parameters or an object with the following properties: - hub: the URL to your Mercure hub - jwt: a subscriber JWT to access your Mercure hub - topicUrl: the topic URL of your resources

* 明示的に無効にする場合は false、デフォルト パラメータまたは次のプロパティを持つオブジェクトで有効にする場合は true:- hub: Mercure ハブへの URL- jwt: Mercure ハブにアクセスするサブスクライバー JWT- topicUrl: リソースのトピック URL

Hydra Data Provider

Based on React Admin create, delete, getList, getManyReference, getOne, update methods, the dataProvider is used by API Platform Admin to communicate with the API. In addition, the specific introspect method parses your API documentation. Note that the dataProvider can be overridden to fit your API needs.

React Admin の create、delete、getList、getManyReference、getOne、update メソッドに基づいて、dataProvider は API Platform Admin によって API と通信するために使用されます。さらに、特定の introspect メソッドが API ドキュメントを解析します。dataProvider はオーバーライドできることに注意してください。 API のニーズに合わせてください。

Hydra Schema Analyzer

Analyses your resources and retrieves their types according to the Schema.org vocabulary.

リソースを分析し、Schema.org の語彙に従ってそのタイプを取得します。

OpenAPI

OpenApiAdmin

Creates a complete Admin, as AdminGuesser, but configured specially for OpenAPI. If you want to use other formats (see supported formats: @api-platform/api-doc-parser) use AdminGuesser instead.

AdminGuesser として完全な Admin を作成しますが、OpenAPI 用に特別に構成されています。他の形式を使用する場合は (サポートされている形式を参照してください: @api-platform/api-doc-parser)、代わりに AdminGuesser を使用してください。

// App.js
import { OpenApiAdmin, ResourceGuesser } from "@api-platform/admin";

const App = () => (
  <OpenApiAdmin
    entrypoint={entrypoint}
    docEntrypoint={docEntrypoint}
    dataProvider={dataProvider}
    authProvider={authProvider}
   >
     <ResourceGuesser name="books" />
     { /* ... */ }
  </OpenApiAdmin>
);

export default App;

OpenApiAdmin Props

Name Type Value required Description
dataProvider dataProvider - yes data provider to use
docEntrypoint string - yes doc entrypoint of the API
entrypoint string - yes entrypoint of the API
mercure object|boolean * no configuration to use Mercure

* false to explicitly disable, true to enable with default parameters or an object with the following properties: - hub: the URL to your Mercure hub - jwt: a subscriber JWT to access your Mercure hub - topicUrl: the topic URL of your resources

* 明示的に無効にする場合は false、デフォルト パラメータまたは次のプロパティを持つオブジェクトで有効にする場合は true:- hub: Mercure ハブへの URL- jwt: Mercure ハブにアクセスするサブスクライバー JWT- topicUrl: リソースのトピック URL

Open API Data Provider

Based on React Admin create, delete, getList, getManyReference, getOne, update methods, the dataProvider is used by API Platform Admin to communicate with the API. In addition, the specific introspect method parses your API documentation. Note that the dataProvider can be overridden to fit your API needs.

React Admin の create、delete、getList、getManyReference、getOne、update メソッドに基づいて、dataProvider は API Platform Admin によって API と通信するために使用されます。さらに、特定の introspect メソッドが API ドキュメントを解析します。dataProvider はオーバーライドできることに注意してください。 API のニーズに合わせてください。

Open API Schema Analyzer

Analyses your resources and retrieves their types according to the Schema.org vocabulary.

リソースを分析し、Schema.org の語彙に従ってそのタイプを取得します。

Other Components

FieldGuesser

Renders fields according to their types, using the schema analyzer. Based on React Admin field components.

スキーマ アナライザーを使用して、タイプに応じてフィールドをレンダリングします。React Admin フィールド コンポーネントに基づいています。

// BooksShow.js
import { FieldGuesser, ShowGuesser } from "@api-platform/admin";

export const BooksShow = props => (
  <ShowGuesser {...props}>
    <FieldGuesser source="author" />
    <FieldGuesser source="title" />
    <FieldGuesser source="rating" />
    <FieldGuesser source="description" />
    <FieldGuesser source="publicationDate" />
  </ShowGuesser>
)

FieldGuesser Props

Name Type Value required Description
source string - yes name of the property of the resource

You can also use props accepted by React Admin basic fields.

React Admin の基本フィールドで受け入れられる props を使用することもできます。

InputGuesser

Uses React Admin input components to generate inputs according to your API documentation (e.g. number HTML input for numbers, checkbox for booleans, selectbox for relationships...).

React Admin 入力コンポーネントを使用して、API ドキュメントに従って入力を生成します (例: 数値の HTML 入力、ブール値のチェックボックス、関係の選択ボックスなど)。

InputGuesser Props

Name Type Value required Description
source string - yes name of the property of the resource