Untitled

 avatar
unknown
plain_text
12 days ago
2.5 kB
10
Indexable
export type FormElementInstance = {
  id: string;
  type?: ElementsType; //loại element-trường hợp element bọc cả 1 hàng thì 0 cótype
  extraAttributes?: Record<string, any>; // các attribute riêng của từng element
  hasSameRow?: boolean; // trường hợp nếu có nhiều hơn 1 element trên 1 hàng
  parent?: string; // nếu có hasSameRow thì lưu id của element chứa cả hàng
  row?:FormElementInstance[];// nếu có hasSameRow thì sẽ gồm các element trên hàng
};

const values: FormElementInstance[]= [
    {
        "id": "4630",
        "type": "TitleField",
        "extraAttributes": {
            "title": "Test Form Builder"
        }
    },
    {
        "id": "8436",
        "type": "SubTitleField",
        "extraAttributes": {
            "subTitle": "code by EdogawaCoTrung"
        }
    },
    {
        "id": "6835",
        "type": "ParagraphField",
        "extraAttributes": {
            "text": "Paragraph Field"
        },
        "parent": "5084"
    },
    {
        "id": "879",
        "hasSameRow": true,
        "row": [
            {
                "id": "4536",
                "type": "DateField",
                "extraAttributes": {
                    "label": "CreatedDate",
                    "required": false,
                    "helperText": "13/11/2004"
                },
                "parent": "879"
            },
            {
                "id": "4809",
                "type": "TextField",
                "extraAttributes": {
                    "label": "Name",
                    "required": true,
                    "placeHolder": "Trung",
                    "helperText": "Enter your text here"
                },
                "parent": "879"
            },
            {
                "id": "3744",
                "type": "SelectField",
                "extraAttributes": {
                    "label": "Ur field",
                    "required": false,
                    "placeHolder": "Hi",
                    "helperText": "Enter your text here",
                    "options": [
                        "Yasuo",
                        "Yone"
                    ]
                },
                "parent": "879"
            }
        ]
    },
    {
        "id": "6274",
        "type": "ParagraphField",
        "extraAttributes": {
            "text": "Paragraph Field"
        }
    }
]
Editor is loading...
Leave a Comment