{
    "$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
    "data": {
        "properties": {
            "template": {
                "x-index": 4,
                "title": "模板",
                "type": "string",
                "x-category": "基础属性",
                "default": "simpleList",
                "enum": [
                    {
                        "label": "空白",
                        "value": "none",
                        "tooltip": "不使用模板",
                        "src": "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/924e8472-9c52-46bc-bae7-e1ec30b92974.svg"
                    },
                    {
                        "label": "简单列表",
                        "value": "simpleList",
                        "tooltip": "使用简单列表模板",
                        "src": "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/2563df4d-2db0-449f-a545-825f5a66a848.svg"
                    },
                    {
                        "label": "详细列表",
                        "value": "detailList",
                        "tooltip": "使用详细列表模板",
                        "src": "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/c4f78f1c-f93a-4b40-8253-42541a609fa4.svg"
                    },
                    {
                        "label": "图文列表",
                        "value": "imageTextList",
                        "tooltip": "使用图文列表模板",
                        "src": "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/58cad863-a9b6-4c51-b3f3-d6036ef4d0b7.svg"
                    },
                    {
                        "label": "卡片列表",
                        "value": "cardList",
                        "tooltip": "使用卡片列表模板",
                        "src": "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/d92ff460-bc94-4162-9c0e-d04224dd1919.svg"
                    }
                ],
                "x-component": "data-sources-template-selector",
                "x-props": {
                    "data-hidebind": true
                },
                "description": "列表内容样式的预设模板"
            },
            "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": "{{$self.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": "listView"
                },
                "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": "orderBy",
                        "schema": {
                            "enum": "{{getDataSourceValueOptions($value && $value.name)}}"
                        }
                    },
                    {
                        "type": "value:state",
                        "condition": "{{!!$value && !!$value.name && !!$form.values.orderBy && getDataSourceValueOptions($value.name).every(o => o.value !== $form.values.orderBy)}}",
                        "target": "orderBy",
                        "state": {
                            "value": ""
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value && $value.name) }}",
                        "target": "where",
                        "schema": {
                            "x-component-props": "{{{selectedDataSourceName: $value && $value.name}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean(!$value || !$value.name) }}",
                        "target": "orderBy",
                        "schema": {
                            "x-props": "{{{disabled: true, tooltip: '请先选择数据源'}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value && $value.name) }}",
                        "target": "orderBy",
                        "schema": {
                            "x-props": "{{{disabled: false, tooltip: ''}}}"
                        }
                    }
                ],
                "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": "{{$self.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
                },
                "x-component-props": {
                    "docUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/ListView#%E8%B0%83%E7%94%A8-apis-%E7%9A%84%E5%8F%82%E6%95%B0%E8%A6%81%E6%B1%82",
                    "paramsSchema": {
                        "type": "object",
                        "properties": {
                            "outParams": {
                                "type": "object",
                                "properties": {
                                    "properties": {
                                        "type": "object",
                                        "properties": {
                                            "records": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "const": "array"
                                                    },
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "type": {
                                                                "const": "object"
                                                            },
                                                            "properties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "_id": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "type": {
                                                                                "const": "string"
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "required": ["records"]
                                    }
                                }
                            }
                        }
                    }
                },
                "x-helper-text": "方法的出入参需满足组件要求，[查看文档](https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/ListView#%E8%B0%83%E7%94%A8-apis-%E7%9A%84%E5%8F%82%E6%95%B0%E8%A6%81%E6%B1%82)",
                "x-helper-text-color": "#E37318",
                "description": "展示数据的APIs调用方法选择"
            },
            "connectorParams": {
                "title": "查询入参",
                "type": "string",
                "x-index": 18,
                "x-category": "基础属性",
                "description": "对APIs调用方法获取的数据进行筛选过滤。支持对象类型，例如 {name:'',value:''}"
            },
            "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": ["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": "对数据进行筛选过滤"
            },
            "orderBy": {
                "x-index": 30,
                "title": "排序字段",
                "x-category": "基础属性",
                "type": "string",
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value) }}",
                        "target": "orderBy",
                        "schema": {
                            "x-props": "{{{clearable: true}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean(!$value) }}",
                        "target": "orderBy",
                        "schema": {
                            "x-props": "{{{clearable: false}}}"
                        }
                    }
                ],
                "description": "选取对数据进行排序的字段"
            },
            "orderType": {
                "x-index": 40,
                "title": "排序方式",
                "x-category": "基础属性",
                "default": "asc",
                "type": "string",
                "enum": [
                    {
                        "label": "升序",
                        "value": "asc"
                    },
                    {
                        "label": "降序",
                        "value": "desc"
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value) }}",
                        "target": "orderType",
                        "schema": {
                            "x-props": "{{{clearable: true}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean(!$value) }}",
                        "target": "orderType",
                        "schema": {
                            "x-props": "{{{clearable: false}}}"
                        }
                    }
                ],
                "description": "设置升序或降序"
            },
            "pageSize": {
                "x-index": 60,
                "title": "显示条数",
                "type": "number",
                "default": 5,
                "x-category": "基础属性",
                "x-props": {
                    "min": 1
                },
                "description": "设置单次加载的数据条数",
                "display": true
            },
            "pagination": {
                "x-index": 70,
                "title": "分页",
                "type": "string",
                "x-category": "基础属性",
                "default": "loadMoreButton",
                "enum": [
                    {
                        "label": "点击加载更多",
                        "value": "loadMoreButton"
                    },
                    {
                        "label": "触底加载更多",
                        "value": "bottomLoad"
                    },
                    {
                        "label": "分页器",
                        "value": "pagination"
                    },
                    {
                        "label": "不分页",
                        "value": "none"
                    }
                ],
                "x-props": {
                    "data-hidebind": true
                },
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "loadCompletedText",
                        "condition": "{{$self.value == 'loadMoreButton' || $self.value == 'bottomLoad'}}"
                    }
                ],
                "description": "数据分页样式"
            },
            "isSetStatus": {
                "x-index": 80,
                "title": "显示加载状态",
                "x-category": "基础属性",
                "type": "boolean",
                "default": false,
                "description": "是否开启数据列表的加载状态，默认不显示"
            },
            "emptyText": {
                "x-index": 81,
                "type": "string",
                "title": "空状态提示",
                "x-category": "基础属性",
                "default": "暂无数据",
                "description": "无数据时的提示说明，内容为空时则不显示该提示"
            },
            "loadCompletedText": {
                "x-index": 82,
                "title": "加载到底提示",
                "x-category": "基础属性",
                "type": "string",
                "default": "",
                "description": "是否展示数据列表加载全部数据后的提示说明，默认不显示"
            }
        }
    },
    "events": [
        {
            "name": "queryEmpty",
            "title": "查询为空",
            "description": "数据查询为空时触发"
        },
        {
            "name": "querySuccess",
            "title": "查询成功",
            "description": "数据查询成功时触发"
        },
        {
            "name": "queryFail",
            "title": "查询失败",
            "description": "数据查询失败时触发"
        }
    ],
    "methods": [
        {
            "name": "refresh",
            "label": "刷新",
            "params": {
                "properties": {
                    "type": {
                        "title": "刷新方式",
                        "type": "string",
                        "default": "refreshFromStart",
                        "sampleValue": "refreshFromStart",
                        "enum": [
                            {
                                "label": "刷新第一页数据",
                                "value": "refreshFromStart"
                            },
                            {
                                "label": "刷新当前页数据",
                                "value": "refreshKeepPage"
                            }
                        ]
                    }
                }
            }
        },
        {
            "name": "deleteOne",
            "label": "删除单条数据",
            "params": {
                "properties": {
                    "_id": {
                        "title": "删除数据的标识",
                        "type": "string",
                        "default": ""
                    }
                }
            }
        }
    ],
    "compConfig": {
        "isDataContainer": true,
        "componentType": "listview"
    },
    "isContainer": true,
    "meta": {
        "title": "数据列表",
        "category": "数据容器",
        "description": "适用于从数据源中查询多条数据，并将返回列表循环展示的场景，如查询用户列表。",
        "categoryOrder": 100,
        "componentOrder": 10,
        "icon": "../icons/ListView.svg"
    },
    "configMeta": {
        "docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/ListView",
        "shortcut": {
            "props": [
                "dataSourceType",
                "datasource",
                "bindConnectMetadata",
                "connectorMethod",
                "template"
            ]
        },
        "contextData": {
            "setField": true,
            "setRelated": true,
            "extra": {
                "total": {
                    "title": "记录总条数",
                    "type": "number",
                    "x-index": 2
                },
                "pageNo": {
                    "title": "页码",
                    "type": "number",
                    "x-index": 3
                },
                "pageSize": {
                    "title": "每页大小",
                    "type": "number",
                    "x-index": 4
                }
            }
        }
    }
}
