{
    "$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": "自定义连接器",
                        "value": "custom-connector"
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "*(filterType,filterFields,bindMetadata)",
                        "condition": "{{$self.value !='custom-connector'}}",
                        "state": {
                            "display": true
                        },
                        "otherwise": {
                            "display": false
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "*(connectorParams,isOrderBy,bindConnectMetadata,connectorMethod)",
                        "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}}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": "{{{ dataSourceType:$value }}}"
                        }
                    }
                ]
            },
            "bindMetadata": {
                "title": "数据模型",
                "type": "object",
                "x-component": "schema-selector",
                "x-component-props": {
                    "showSystemField": true,
                    "showView": true,
                    "showFieldSelect": false
                },
                "x-props": {
                    "data-hidebind": true,
                    "itemClassName": "ds-bind-form-item"
                },
                "properties": {
                    "datasource": {
                        "title": "数据源",
                        "type": "object",
                        "properties": {}
                    },
                    "enabledFieldNames": {
                        "title": "自定义字段",
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {}
                        }
                    },
                    "disabledFieldNames": {
                        "title": "不展示字段",
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {}
                        }
                    },
                    "isNewData": {
                        "title": "是否为历史数据，新数据用columns管理列",
                        "type": "boolean",
                        "default": "false"
                    }
                },
                "x-index": 10,
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "filterFields",
                        "condition": "{{!!$self.value}}",
                        "state": {
                            "dataSourceId": "{{$self.value && $self.value.datasource && $self.value.datasource.id}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": {
                                "dataSourceType": "{{$form.values.dataSourceType}}",
                                "bindMetadata": "{{$self.value}}"
                            }
                        }
                    }
                ]
            },
            "filterType": {
                "title": "搜索方式",
                "enum": [
                    {
                        "label": "搜索框",
                        "value": "searchbox"
                    },
                    {
                        "label": "条件筛选",
                        "value": "filter"
                    }
                ],
                "type": "string",
                "default": "searchbox",
                "x-component": "segment-radio",
                "x-component-props": {
                    "padding": 10
                },
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "filterFields",
                        "condition": "{{$self.value=='filter'}}"
                    }
                ],
                "x-index": 20,
                "x-props": {
                    "data-hidebind": true
                }
            },
            "filterFields": {
                "title": "筛选字段",
                "x-component": "mutilp-data-source-field-select",
                "x-component-props": {
                    "x-filter": " !(this.type === 'array' && this.format === '') && !(this.format === 'father-son' && this.default === '') && this.type !== 'object' && this.format !== 'x-file' && this.format !== 'x-image' && this.format !== 'x-rtf' "
                },
                "x-props": {
                    "data-hidebind": true
                },
                "x-index": 30
            },
            "bindConnectMetadata": {
                "title": "连接器选择",
                "type": "object",
                "x-component": "connector-select",
                "x-index": 40,
                "x-category": "基础属性",
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "connectorMethod",
                        "schema": {
                            "x-component-props": "{{{value:$value}}}"
                        }
                    }
                ]
            },
            "connectorMethod": {
                "title": "调用方法",
                "type": "object",
                "x-component": "connector-method-select",
                "x-index": 50,
                "x-category": "基础属性",
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": "{{ {dataSourceType:$form.values.dataSourceType, bindConnectMetadata: $form.values.bindConnectMetadata, connectorMethod: $value } }}"
                        }
                    }
                ]
            },
            "connectorParams": {
                "title": "查询入参",
                "type": "string",
                "x-index": 60,
                "x-category": "基础属性"
            },
            "isOrderBy": {
                "title": "显示排序按钮",
                "type": "boolean",
                "x-index": 70,
                "default": true,
                "x-category": "基础属性"
            },
            "columnSets": {
                "type": "array",
                "title": "列管理",
                "items": {
                    "type": "object",
                    "display": "header",
                    "x-image": " this.genre === 'slot' ? 'https://qcloudimg.tencent-cloud.cn/raw/898556b063f82bdda5837ab0bfdf608b.svg' : 'https://qcloudimg.tencent-cloud.cn/raw/3ce8ddbaaae6b9e085fa40e5a64e4909.svg' ",
                    "properties": {
                        "key": {
                            "title": "绑定字段",
                            "default": "",
                            "type": "string",
                            "enum": [],
                            "x-has-init": false,
                            "x-init-key": "",
                            "x-linkages": [
                                {
                                    "type": "value:state",
                                    "target": "dataForm.header",
                                    "state": {
                                        "value": "{{ $self.props['x-has-init'] ? ($self.props.enum.find(item => { return item.value === $self.value }) && $self.props.enum.find(item => { return item.value === $self.value }).header) : $form.values.dataForm.header}}"
                                    }
                                },
                                {
                                    "type": "value:schema",
                                    "target": "dataForm.key",
                                    "schema": {
                                        "x-has-init": true,
                                        "x-init-key": "{{$self.props['x-has-init'] ? $self.props['x-init-key'] : $self.value}}"
                                    }
                                },
                                {
                                    "type": "value:schema",
                                    "target": "dataForm.key",
                                    "schema": {
                                        "enum": "{{$self.props.enum.map(item => {item.value === $self.props['x-init-key'] && (item.disabled = false, item.tooltip = '' ) ;return item;})}}"
                                    }
                                }
                            ]
                        },
                        "header": {
                            "title": "标题",
                            "type": "string",
                            "default": "添加列"
                        },
                        "genre": {
                            "title": "展示内容",
                            "type": "string",
                            "default": "default",
                            "x-component": "radio",
                            "enum": [
                                { "label": "字段值", "value": "default" },
                                { "label": "自定义", "value": "slot" }
                            ]
                        }
                    },
                    "default": {
                        "key": "",
                        "header": "请选择字段",
                        "genre": "default"
                    }
                },
                "default": [],
                "x-component": "column-list",
                "x-component-props": {
                    "changeOnClose": true,
                    "label_add": "添加列",
                    "addDisabledTip": "已添加所有字段"
                },
                "x-props": {
                    "data-hidebind": true
                },
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "bindMetadata",
                        "condition": "{{(Array.isArray($self.value) && $self.value.length !== 0) && !($form.values.bindMetadata && $form.values.bindMetadata.isNewData)}}",
                        "state": {
                            "value": "{{ {...($form.values.bindMetadata || {}), isNewData: true} }}"
                        }
                    }
                ],
                "x-index": 80
            },
            "cell": {
                "title": "自定义单元格",
                "type": "slot",
                "x-slot-auto": {
                    "iterable": "{{ $form.values.columnSets.filter(item => item.genre === 'slot' && item.key) }}",
                    "generator": "{{ {key:$item.key, title: ('自定义列: '+$item.header) } }}"
                },
                "x-slot-scope": {
                    "record": {
                        "title": "行对象",
                        "type": "object"
                    },
                    "rowKey": {
                        "title": "行唯一标识",
                        "type": "string"
                    },
                    "recordIndex": {
                        "title": "行序号",
                        "type": "number"
                    },
                    "column": {
                        "title": "列对象",
                        "type": "object"
                    },
                    "columnIndex": {
                        "title": "列序号",
                        "type": "number"
                    }
                }
            },
            "rowColor": {
                "title": "行背景颜色",
                "type": "string",
                "x-component": "color-string",
                "x-index": 90
            },
            "buttons": {
                "type": "array",
                "x-component": "list",
                "title": "按钮",
                "items": {
                    "type": "object",
                    "title": "按钮",
                    "properties": {
                        "text": {
                            "title": "按钮文字",
                            "default": "按钮标题",
                            "type": "string"
                        },
                        "tooltip": {
                            "title": "提示文字",
                            "default": "",
                            "type": "string"
                        },
                        "htmlType": {
                            "type": "string",
                            "title": "按钮类型",
                            "default": "button",
                            "enum": [
                                {
                                    "label": "button",
                                    "value": "button"
                                },
                                {
                                    "label": "submit",
                                    "value": "submit"
                                },
                                {
                                    "label": "reset",
                                    "value": "reset"
                                }
                            ]
                        },
                        "type": {
                            "title": "样式类型",
                            "type": "string",
                            "default": "primary",
                            "enum": [
                                {
                                    "label": "primary(主要)",
                                    "value": "primary"
                                },
                                {
                                    "label": "weak(白色)",
                                    "value": "weak"
                                },
                                {
                                    "label": "pay(支付)",
                                    "value": "pay"
                                },
                                {
                                    "label": "error(错误)",
                                    "value": "error"
                                },
                                {
                                    "label": "text(文本)",
                                    "value": "text"
                                },
                                {
                                    "label": "link(连接)",
                                    "value": "link"
                                }
                            ]
                        },
                        "action": {
                            "type": "string",
                            "title": "按钮动作",
                            "default": "custom",
                            "enum": [
                                {
                                    "label": "新建",
                                    "value": "create"
                                },
                                {
                                    "label": "删除",
                                    "value": "del"
                                },
                                {
                                    "label": "导出",
                                    "value": "export"
                                },
                                {
                                    "label": "自定义",
                                    "value": "custom"
                                }
                            ]
                        },
                        "show": {
                            "type": "boolean",
                            "default": true,
                            "title": "是否展示"
                        },
                        "loading": {
                            "title": "加载中",
                            "type": "boolean",
                            "default": false
                        },
                        "disabled": {
                            "type": "boolean",
                            "default": false,
                            "title": "是否禁用"
                        }
                    },
                    "default": {
                        "text": "按钮标题",
                        "tooltip": "",
                        "htmlType": "button",
                        "type": "primary",
                        "action": "custom",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    "x-image": "'https://imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Button.svg'",
                    "x-display": "this.text ? this.text : '按钮标题'"
                },
                "default": [
                    {
                        "text": "新建",
                        "tooltip": "",
                        "type": "primary",
                        "htmlType": "button",
                        "action": "create",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    {
                        "text": "删除",
                        "tooltip": "",
                        "type": "weak",
                        "htmlType": "button",
                        "action": "del",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    {
                        "text": "导出",
                        "tooltip": "",
                        "type": "weak",
                        "htmlType": "button",
                        "action": "export",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    }
                ],
                "x-category": "顶部按钮配置",
                "x-index": 140
            },
            "settings": {
                "type": "array",
                "title": "按钮",
                "items": {
                    "type": "object",
                    "title": "按钮",
                    "properties": {
                        "text": {
                            "title": "按钮文字",
                            "default": "按钮标题",
                            "type": "string"
                        },
                        "tooltip": {
                            "title": "提示文字",
                            "default": "",
                            "type": "string"
                        },
                        "htmlType": {
                            "type": "string",
                            "title": "按钮类型",
                            "default": "button",
                            "enum": [
                                {
                                    "label": "button",
                                    "value": "button"
                                },
                                {
                                    "label": "submit",
                                    "value": "submit"
                                },
                                {
                                    "label": "reset",
                                    "value": "reset"
                                }
                            ]
                        },
                        "type": {
                            "title": "样式类型",
                            "type": "string",
                            "default": "link",
                            "enum": [
                                {
                                    "label": "primary(主要)",
                                    "value": "primary"
                                },
                                {
                                    "label": "weak(白色)",
                                    "value": "weak"
                                },
                                {
                                    "label": "pay(支付)",
                                    "value": "pay"
                                },
                                {
                                    "label": "error(错误)",
                                    "value": "error"
                                },
                                {
                                    "label": "text(文本)",
                                    "value": "text"
                                },
                                {
                                    "label": "link(连接)",
                                    "value": "link"
                                }
                            ]
                        },
                        "action": {
                            "type": "string",
                            "title": "按钮动作",
                            "default": "custom",
                            "enum": [
                                {
                                    "label": "查看",
                                    "value": "retrieve"
                                },
                                {
                                    "label": "编辑",
                                    "value": "edit"
                                },
                                {
                                    "label": "删除",
                                    "value": "del"
                                },
                                {
                                    "label": "自定义",
                                    "value": "custom"
                                }
                            ]
                        },
                        "show": {
                            "type": "boolean",
                            "default": true,
                            "title": "是否展示"
                        },
                        "loading": {
                            "title": "加载中",
                            "type": "boolean",
                            "default": false
                        },
                        "disabled": {
                            "type": "boolean",
                            "default": false,
                            "title": "是否禁用"
                        }
                    },
                    "default": {
                        "text": "按钮标题",
                        "tooltip": "",
                        "htmlType": "button",
                        "type": "link",
                        "action": "custom",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    "x-image": "'https://imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Button.svg'",
                    "x-display": "this.text ? this.text : '按钮标题'"
                },
                "x-index": 160,
                "default": [
                    {
                        "text": "查看",
                        "tooltip": "",
                        "type": "link",
                        "htmlType": "button",
                        "action": "retrieve",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    {
                        "text": "编辑",
                        "tooltip": "",
                        "type": "link",
                        "htmlType": "button",
                        "action": "edit",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    },
                    {
                        "text": "删除",
                        "tooltip": "",
                        "type": "link",
                        "htmlType": "button",
                        "action": "del",
                        "show": true,
                        "loading": false,
                        "disabled": false
                    }
                ],
                "x-category": "操作列按钮配置",
                "x-component": "list"
            }
        }
    },
    "events": [
        {
            "title": "选中数据改变",
            "name": "rowsSelect"
        }
    ],
    "platforms": ["web"],
    "meta": {
        "title": "表格组件",
        "description": "表格可以清晰地展示二维数据",
        "icon": "https://imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/ModelTable.svg",
        "category": "模型组件",
        "categoryOrder": 2000,
        "componentOrder": 1,
        "selectableBlock": {
            "events": [
                {
                    "name": "tap",
                    "title": "点击"
                }
            ]
        }
    },
    "methods": [
        {
            "name": "deleteOne",
            "label": "删除单条数据",
            "params": {
                "properties": {
                    "id": {
                        "title": "删除数据的标识",
                        "type": "string",
                        "default": ""
                    }
                }
            }
        }
    ]
}
