diff --git a/packages/maker/src/info/PartsEdit.tsx b/packages/maker/src/info/PartsEdit.tsx index 06c695a..df33880 100644 --- a/packages/maker/src/info/PartsEdit.tsx +++ b/packages/maker/src/info/PartsEdit.tsx @@ -6,7 +6,7 @@ import { PartsType, createEmptyPartsAttribute } from "../classes/WWAData"; import WWAConsts from "../classes/WWAConsts"; import { ObjectEditTable } from "./editforms/ObjectEditForm"; import { MapEditTable } from "./editforms/MapEditForm"; -import { PartsEditAttributeChange, PartsEditMessageChange } from "./editforms/PartsEditComponent"; +import { PartsEditAttributeChange, PartsEditMessageChange } from "./editforms/definitions"; import { Form, Portal, Button, Icon, Dropdown, DropdownItemProps } from "semantic-ui-react"; import PartsChip from "../common/PartsChip"; import { GraphicSelect } from "../common/GraphicSelect"; diff --git a/packages/maker/src/info/editforms/CommonEditForm.tsx b/packages/maker/src/info/editforms/CommonEditForm.tsx index 59808e7..772ae16 100644 --- a/packages/maker/src/info/editforms/CommonEditForm.tsx +++ b/packages/maker/src/info/editforms/CommonEditForm.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; -import { URLInput, StringInput, CoordInput } from "./EditFormUtils"; -import { PartsEditComponent } from "./PartsEditComponent"; +import { CoordInput, StringInput, URLInput } from "./utils"; +import { PartsEditComponent } from "./definitions"; import WWAConsts from "../../classes/WWAConsts"; import { convertRelativeValueFromCoord } from "../../common/convertRelativeValue"; diff --git a/packages/maker/src/info/editforms/EditFormUtils.tsx b/packages/maker/src/info/editforms/EditFormUtils.tsx deleted file mode 100644 index b345534..0000000 --- a/packages/maker/src/info/editforms/EditFormUtils.tsx +++ /dev/null @@ -1,437 +0,0 @@ -import React from "react"; -import WWAConsts from "../../classes/WWAConsts"; -import { MoveType } from "../../classes/WWAData"; -import { Input, Dropdown, DropdownItemProps, Form, TextArea, Icon, StrictIconProps, Label, Button } from "semantic-ui-react"; -import { RelativeValue, convertDataValueFromRelativeCoord, convertRelativeValueFromStatus, convertDataValueFromRelativeStatus } from "../../common/convertRelativeValue"; -import BrowseMap from "../../common/BrowseMap"; -import { useState } from "react"; -import { ItemPartsBrowse, ObjectPartsBrowse } from "../../common/BrowseParts"; - -/** - * NOTE: - * このファイルは utils ディレクトリに移行します。 - * utils ディレクトリでは、1コンポーネント1ファイルの構成としています。 - * 型定義については utils/index.ts で定義していますが、定義場所はまだ仮の段階のため、後で移動する可能性があります。 - */ - -/** - * テキストボックスやセレクトボックスで変更が生じた際に実行するコールバック関数の型です。 - */ -type InputChangeFunction = (value: string) => void; -type CoordInputChangeFunction = (x: string, y: string) => void; -type InputChangeFunctionWithName = (value: string, name: string) => void; - -/** - * パーツ編集で必要になるステータス入力値のうち、ステータス1つ分で必要なプロパティを示す型です。 - */ -type NumberEditFormItem = { - label?: string, - value: number -}; - -export const NumberInput: React.FunctionComponent<{ - value: number, - label: string, - name?: string - min?: number, - max?: number - onChange: InputChangeFunction -}> = props => ( - - - { - props.onChange(data.value); - }} - /> - -); - -/** - * 数字を入力するコンポーネントを作成します。 - */ -const createNumberInput = (label: string) => { - return (props: { - value: number, - onChange: InputChangeFunction - }) => ( - - ); -}; - -export const SoundNumberInput = createNumberInput("サウンド番号"); -export const WaitTimeInput = createNumberInput("待ち時間"); - -export const SelectInput: React.FunctionComponent<{ - selectableItems: DropdownItemProps[], - value: number, - label: string, - onChange: InputChangeFunction -}> = props => ( - - - { - if (data.value === undefined) { - return; - } - const value = data.value as string; - props.onChange(value); - }} - /> - -); - -/** - * セレクトボックスのコンポーネントを作成します。 - */ -const createSelectInput = (label: string, selectableItems: DropdownItemProps[]) => { - return (props: { - value: number, - onChange: InputChangeFunction - }) => ( - - ); -}; - -export const MoveTypeInput = createSelectInput("動作属性", [ - { - text: "静止", - value: MoveType.STATIC, - }, { - text: "プレイヤー追尾", - value: MoveType.CHASE_PLAYER - }, { - text: "逃げる", - value: MoveType.RUN_OUT - }, { - text: "うろうろする", - value: MoveType.HANG_AROUND - } -]); -export const PassableInput = createSelectInput("通行区分", [ - { - text: "通行不可", - value: 0 - }, { - text: "通行可", - value: WWAConsts.PASSABLE_OBJECT - } -]); - -export const MessageInput: React.FunctionComponent<{ - value: string, - label: string, - onChange: InputChangeFunction -}> = props => ( - - -