{
    "$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
    "data": {
        "properties": {
            "dataSourceType": {
                "x-index": 5,
                "title": "数据源",
                "x-category": "基础属性",
                "type": "string",
                "default": "data-model",
                "enum": [
                    {
                        "label": "数据模型",
                        "value": "data-model"
                    },
                    {
                        "label": "APIs",
                        "value": "custom-connector"
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "*(orderType,where,orderBy,datasource)",
                        "condition": "{{$self.value !='custom-connector'}}",
                        "state": {
                            "display": true
                        },
                        "otherwise": {
                            "display": false
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "*(bindConnectMetadata,connectorMethod,connectorParams)",
                        "condition": "{{$self.value=='custom-connector'}}",
                        "state": {
                            "display": true
                        },
                        "otherwise": {
                            "display": false
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "bindConnectMetadata",
                        "schema": {
                            "x-component-props": "{{{value:$value}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "connectorMethod",
                        "schema": {
                            "x-component-props": "{{{connector:$value}}}"
                        }
                    }
                ],
                "x-component": "dsc-datasource-type-select",
                "x-component-props": {
                    "defaultValue": "data-model",
                    "options": [
                        {
                            "value": "data-model",
                            "text": "数据模型",
                            "label": "数据模型",
                            "icon": "database",
                            "isShow": true
                        },
                        {
                            "value": "custom-connector",
                            "text": "APIs",
                            "label": "APIs",
                            "icon": "custom-connector",
                            "isShow": true
                        }
                    ]
                },
                "x-props": {
                    "data-hidebind": true
                },
                "description": "数据源类型选择"
            },
            "datasource": {
                "x-index": 10,
                "title": "数据模型",
                "type": "object",
                "x-category": "基础属性",
                "required": true,
                "properties": {
                    "name": {
                        "title": "数据模型名",
                        "type": "string"
                    },
                    "extra": {
                        "title": "数据模型属性",
                        "type": "object",
                        "properties": {
                            "viewId": {
                                "title": "数据模型视图id",
                                "type": "string"
                            },
                            "methodName": {
                                "title": "数据模型方法名",
                                "type": "string"
                            }
                        }
                    }
                },
                "x-component": "datasource-selector",
                "x-component-props": {
                    "dataContainerType": "dataView"
                },
                "x-props": {
                    "data-hidebind": true
                },
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "params",
                        "schema": {
                            "x-component-props": "{{$value}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value && $value.name) }}",
                        "target": "where",
                        "schema": {
                            "x-component-props": "{{{selectedDataSourceName: $value && $value.name}}}"
                        }
                    }
                ],
                "description": "展示模型数据的数据来源"
            },
            "bindConnectMetadata": {
                "title": "APIs",
                "type": "object",
                "x-component": "connector-select",
                "x-index": 12,
                "x-category": "基础属性",
                "required": true,
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "connectorMethod",
                        "schema": {
                            "x-component-props": "{{{value:$value}}}"
                        }
                    }
                ],
                "x-props": {
                    "data-hidebind": true
                },
                "description": "展示数据的APIs来源选择"
            },
            "connectorMethod": {
                "title": "调用方法",
                "type": "object",
                "x-component": "connector-method-select",
                "x-index": 16,
                "x-category": "基础属性",
                "required": true,
                "x-props": {
                    "data-hidebind": true
                },
                "description": "展示数据的APIs调用方法选择"
            },
            "connectorParams": {
                "title": "查询入参",
                "type": "string",
                "x-index": 18,
                "x-category": "基础属性",
                "description": "对APIs调用方法获取的数据进行筛选过滤。支持对象类型，例如 {name:'',value:''}",
                "x-component": "property-object-params-field",
                "x-component-props": {
                    "dataSourceKeyName": "bindConnectMetadata",
                    "dataSourceValuePath": "datasource.name",
                    "methodNameKeyName": "connectorMethod",
                    "methodValuePath": "name",
                    "paramsKeyName": "connectorParams"
                }
            },
            "where": {
                "x-index": 20,
                "title": "数据筛选",
                "x-category": "基础属性",
                "type": "array",
                "items": {},
                "x-component": "condition-select",
                "x-component-props": {
                    "selectedDataSourceName": null,
                    "customLogicOptions": [
                        {
                            "text": "且",
                            "value": "and"
                        },
                        {
                            "text": "或",
                            "value": "or"
                        }
                    ],
                    "blackListConfig": {
                        "format": ["related", "father-son", "x-file", "x-image"],
                        "type": ["object", "array"]
                    },
                    "customRelOptions": {
                        "number": [
                            {
                                "value": "equal",
                                "text": "等于",
                                "type": "equal"
                            },
                            {
                                "value": "unequal",
                                "text": "不等于",
                                "type": "unequal"
                            },
                            {
                                "value": "greater",
                                "text": "大于",
                                "type": "greate"
                            },
                            {
                                "value": "greater_or_equal",
                                "text": "大于等于",
                                "type": "greater_or_equal"
                            },
                            {
                                "value": "less",
                                "text": "小于",
                                "type": "less"
                            },
                            {
                                "value": "less_or_equal",
                                "text": "小于等于",
                                "type": "less_or_equal"
                            },
                            {
                                "value": "empty",
                                "text": "为空",
                                "type": "empty"
                            },
                            {
                                "value": "nempty",
                                "text": "不为空",
                                "type": "nempty"
                            }
                        ]
                    }
                },
                "x-props": {
                    "data-hidebind": true,
                    "data-hideBindValue": true,
                    "data-withBindMeta": true
                },
                "description": "对数据进行筛选过滤"
            }
        }
    },
    "events": [
        {
            "name": "queryEmpty",
            "title": "查询为空",
            "description": "数据查询为空时触发"
        },
        {
            "name": "querySuccess",
            "title": "查询成功",
            "description": "数据查询成功时触发"
        },
        {
            "name": "queryFail",
            "title": "查询失败",
            "description": "数据查询失败时触发"
        }
    ],
    "methods": [
        {
            "name": "refresh",
            "label": "刷新"
        },
        {
            "name": "deleteOne",
            "label": "删除单条数据",
            "params": {
                "properties": {
                    "_id": {
                        "title": "删除数据的标识",
                        "type": "string",
                        "default": ""
                    }
                }
            }
        }
    ],
    "compConfig": {
        "isDataContainer": true,
        "componentType": "dataview"
    },
    "isContainer": true,
    "meta": {
        "title": "数据详情",
        "category": "数据容器",
        "description": "适用于从数据源中查询一条数据，并将返回数据展示的场景，如查询访客预约详情。",
        "categoryOrder": 100,
        "componentOrder": 20,
        "icon": "../icons/DataView.svg"
    },
    "configMeta": {
        "docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/DataView",
        "shortcut": {
            "props": [
                "dataSourceType",
                "datasource",
                "where",
                "bindConnectMetadata",
                "connectorMethod",
                "connectorParams"
            ]
        },
        "contextData": {
            "setField": true,
            "setRelated": true
        }
    }
}
