{
    "$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
    "data": {
        "type": "object",
        "properties": {
            "dataSource": {
                "type": "string",
                "title": "数据源",
                "x-index": 10,
                "x-component": "chart-datasource-select",
                "x-helper-text": "方法的出入参需满足组件要求，[查看文档](https://cloud.tencent.com/document/product/1301/71197#.E7.BB.9F.E8.AE.A1.E5.8D.A1.E7.89.87)",
                "x-helper-text-color": "#E37318",
                "x-component-props": {
                    "postChange": {
                        "addOrUpdateComponentDataBinds": {
                            "dataBind": {
                                "propertyPath": "filterData",
                                "bindDataPath": "[]",
                                "type": "expression",
                                "extra": {}
                            }
                        }
                    },
                    "docUrl": "https://cloud.tencent.com/document/product/1301/71197#.E7.BB.9F.E8.AE.A1.E5.8D.A1.E7.89.87",
                    "paramsSchema": {
                        "type": "object",
                        "properties": {
                            "outParams": {
                                "type": "object",
                                "properties": {
                                    "properties": {
                                        "type": "object",
                                        "properties": {
                                            "result": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "const": "array"
                                                    },
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "type": {
                                                                "const": "object"
                                                            },
                                                            "properties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "Name": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "type": {
                                                                                "const": "string"
                                                                            }
                                                                        }
                                                                    },
                                                                    "Value": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "type": {
                                                                                "const": "number"
                                                                            }
                                                                        }
                                                                    }
                                                                },
                                                                "required": ["Value"]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "required": ["result"]
                                    }
                                }
                            }
                        }
                    }
                },
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(filterData,field,operationType,isCountEmpty)",
                        "condition": "{{ $self.value && $self.value.type === 'database' }}"
                    },
                    {
                        "type": "value:schema",
                        "target": "filterData",
                        "schema": {
                            "x-component-props": {
                                "selectedDataSourceName": "{{ $self.value && $self.value.name }}"
                            }
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "*(operationType,field,filterData)",
                        "condition": "{{ $self.inputed }}",
                        "state": {
                            "value": ""
                        }
                    }
                ]
            },
            "filterData": {
                "title": "数据筛选",
                "x-index": 20,
                "x-category": "基础属性",
                "x-component": "condition-select",
                "x-component-props": {
                    "dataSourceNamePropKey": "dataSource",
                    "blackListConfig": {
                        "type": ["object", "array"]
                    },
                    "customRelOptions": {
                        "string": [
                            {
                                "text": "等于",
                                "value": "eq"
                            },
                            {
                                "text": "不等于",
                                "value": "neq"
                            },
                            {
                                "text": "包含",
                                "value": "in"
                            },
                            {
                                "text": "不包含",
                                "value": "nin"
                            }
                        ],
                        "boolean": [
                            {
                                "text": "等于",
                                "value": "eq"
                            }
                        ],
                        "keyVarType": [
                            {
                                "value": "eq",
                                "text": "等于"
                            },
                            {
                                "value": "neq",
                                "text": "不等于"
                            },
                            {
                                "value": "gt",
                                "text": "大于"
                            },
                            {
                                "value": "lt",
                                "text": "小于"
                            }
                        ],
                        "number": [
                            {
                                "text": "等于",
                                "value": "eq",
                                "type": "equal"
                            },
                            {
                                "text": "不等于",
                                "value": "neq",
                                "type": "unequal"
                            },
                            {
                                "text": "小于",
                                "value": "lt",
                                "type": "less"
                            },
                            {
                                "text": "小于或等于",
                                "value": "lte",
                                "type": "less_or_equal"
                            },
                            {
                                "text": "大于",
                                "value": "gt",
                                "type": "greater"
                            },
                            {
                                "text": "大于或等于",
                                "value": "gte",
                                "type": "greater_or_equal"
                            }
                        ]
                    }
                },
                "x-props": {
                    "data-hidebind": true,
                    "data-hideBindValue": true,
                    "data-withBindMeta": true
                }
            },
            "field": {
                "type": "string",
                "title": "字段选择",
                "x-index": 30,
                "x-category": "基础属性",
                "x-component": "data-source-field-select",
                "x-datasource-method-reset": "",
                "x-component-props": {
                    "dataSourceNamePropKey": "dataSource",
                    "isMethod": true
                },
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "operationType",
                        "condition": "{{  $self.value && ($self.value.type !=='number' || ['datetime','date','time'].includes($self.value.format)) }}",
                        "schema": {
                            "enum": [
                                {
                                    "label": "计数",
                                    "value": "count"
                                }
                            ]
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "operationType",
                        "condition": "{{ $self.inputed }}",
                        "state": {
                            "value": ""
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "operationType",
                        "condition": "{{ !$self.value || ($self.value.type ==='number' && !(['datetime','date','time'].includes($self.value.format)) ) }}",
                        "schema": {
                            "enum": [
                                {
                                    "label": "计数",
                                    "value": "count"
                                },
                                {
                                    "label": "求和",
                                    "value": "sum"
                                },
                                {
                                    "label": "最大值",
                                    "value": "max"
                                },
                                {
                                    "label": "最小值",
                                    "value": "min"
                                },
                                {
                                    "label": "平均值",
                                    "value": "avg"
                                }
                            ]
                        }
                    }
                ]
            },
            "operationType": {
                "type": "string",
                "title": "统计方式",
                "x-category": "基础属性",
                "x-index": 40,
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "label",
                        "condition": "{{ $self.inputed && !!$form.values.field && !!$self.value }}",
                        "state": {
                            "value": "{{  $form.values.field.title + ['计数','最大值','最小值','平均值'][['count','max','min','avg'].indexOf($self.value)] }}"
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "label",
                        "condition": "{{ $self.inputed && !!$form.values.field && $self.value==='sum' }}",
                        "state": {
                            "value": "{{  $form.values.field.title + '总和' }}"
                        }
                    }
                ]
            },
            "label": {
                "type": "string",
                "title": "字段展示名称",
                "x-category": "基础属性",
                "x-index": 50,
                "x-props": {
                    "placeholder": "根据字段选择自动填充"
                },
                "default": "今日活跃用户数"
            },
            "isCountEmpty": {
                "type": "boolean",
                "title": "是否统计空值",
                "x-category": "基础属性",
                "x-index": 60,
                "default": false
            },
            "isShowUnit": {
                "type": "boolean",
                "title": "是否显示单位",
                "x-category": "高级属性",
                "x-index": 70,
                "default": true,
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(unit,decimalDigits,suffix)",
                        "condition": "{{ $self.value }}"
                    }
                ]
            },
            "unit": {
                "type": "number",
                "title": "数值量级",
                "x-category": "高级属性",
                "x-index": 80,
                "default": 1,
                "enum": [
                    {
                        "label": "个",
                        "value": 1
                    },
                    {
                        "label": "十",
                        "value": 10
                    },
                    {
                        "label": "百",
                        "value": 100
                    },
                    {
                        "label": "千",
                        "value": 1000
                    },
                    {
                        "label": "万",
                        "value": 10000
                    },
                    {
                        "label": "十万",
                        "value": 100000
                    },
                    {
                        "label": "百万",
                        "value": 1000000
                    },
                    {
                        "label": "千万",
                        "value": 10000000
                    },
                    {
                        "label": "亿",
                        "value": 100000000
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "suffix",
                        "condition": "{{  $self.inputed && $self.value!==1 }}",
                        "state": {
                            "value": "{{$self.props.enum.find(s=>s.value===$self.value) ? $self.props.enum.find(s=>s.value===$self.value).label: '' }}"
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "suffix",
                        "condition": "{{  $self.inputed && $self.value===1 }}",
                        "state": {
                            "value": ""
                        }
                    }
                ]
            },
            "decimalDigits": {
                "type": "number",
                "title": "小数位数",
                "x-category": "高级属性",
                "x-index": 90,
                "default": 0,
                "x-props": {
                    "max": 10,
                    "min": 0
                },
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "decimalDigits",
                        "condition": "{{ $self.value == '' || isNaN($self.value) || $self.value < 0 }}",
                        "state": {
                            "value": 0
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "decimalDigits",
                        "condition": "{{ $self.value > 10  }}",
                        "state": {
                            "value": 10
                        }
                    }
                ]
            },
            "suffix": {
                "type": "string",
                "title": "后缀",
                "x-category": "高级属性",
                "x-index": 100
            }
        }
    },
    "events": [
        {
            "title": "点击",
            "name": "tap"
        }
    ],
    "meta": {
        "title": "统计卡片",
        "description": "提供报表场景下的指标数据统计并展示功能。",
        "icon": "../../icons/StatisticsCard.svg",
        "category": "图表",
        "categoryOrder": 600,
        "componentOrder": 530
    },
    "configMeta": {
        "docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/chart/statisticsCard"
    }
}
