{
    "$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",
                "x-runtime-default": "data-model",
                "enum": [
                    {
                        "label": "数据模型",
                        "value": "data-model"
                    },
                    {
                        "label": "APIs",
                        "value": "custom-connector"
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "*(filterType,filterFields,bindMetadata,where,orderBy,orderType)",
                        "condition": "{{$self.value !='custom-connector'}}",
                        "state": {
                            "display": true
                        },
                        "otherwise": {
                            "display": false
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "*(connectorParams,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": "{{$self.value}}"
                            }
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": "{{{ dataSourceType:$value }}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "schema": {
                            "x-component-props": {
                                "datasourceType": "{{$self.value}}"
                            }
                        },
                        "target": "*(bindMetadata)"
                    },
                    {
                        "type": "value:schema",
                        "target": "*(fixedFront,fixedEnd)",
                        "schema": {
                            "enum": []
                        }
                    }
                ],
                "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
                        }
                    ]
                },
                "description": "数据源类型选择"
            },
            "bindMetadata": {
                "title": "数据模型",
                "type": "object",
                "x-component": "schema-selector",
                "required": true,
                "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}}",
                            "dataSourceName": "{{$self.value && $self.value.datasource && $self.value.datasource.name}}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": {
                                "dataSourceType": "{{$form.values.dataSourceType}}",
                                "bindMetadata": "{{$self.value}}"
                            }
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "*(fixedFront,fixedEnd)",
                        "schema": {
                            "enum": []
                        }
                    },
                    {
                        "type": "value:visible",
                        "target": "where",
                        "condition": "{{ $self.value && $self.value.isNewData }}"
                    },
                    {
                        "type": "value:visible",
                        "target": "*(orderBy,orderType)",
                        "condition": "{{ $value && (!$value.selectedViewIds || ($value.selectedViewIds && $value.selectedViewIds.length === 0)) }}"
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ Boolean($value && $value.datasource) }}",
                        "target": "orderBy",
                        "schema": {
                            "enum": "{{getDataSourceValueOptions($value.datasource.name)}}"
                        }
                    },
                    {
                        "type": "value:state",
                        "condition": "{{!!$value && !!$value.datasource && !!$value.datasource.name && !!$form.values.orderBy && getDataSourceValueOptions($value.datasource.name).every(o => o.value !== $form.values.orderBy)}}",
                        "target": "orderBy",
                        "state": {
                            "value": ""
                        }
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ $value!=null && typeof($value)!=undefined && $value.datasource!=null && typeof($value.datasource)!=undefined}}",
                        "target": "where",
                        "schema": {
                            "x-component-props": "{{{selectedDataSourceName: $value.datasource.name}}}"
                        }
                    }
                ],
                "description": "展示数据的数据来源，包括数据模型/视图"
            },
            "where": {
                "x-index": 15,
                "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": 16,
                "title": "排序字段",
                "x-category": "基础属性",
                "type": "string",
                "x-runtime-default": "updatedAt",
                "x-props": {
                    "clearable": true
                },
                "description": "选取对数据进行排序的字段"
            },
            "orderType": {
                "x-index": 17,
                "title": "排序方式",
                "x-category": "基础属性",
                "type": "string",
                "x-runtime-default": "desc",
                "enum": [
                    {
                        "label": "升序",
                        "value": "asc"
                    },
                    {
                        "label": "降序",
                        "value": "desc"
                    }
                ],
                "x-props": {
                    "clearable": true
                },
                "description": "设置升序或降序"
            },
            "filterType": {
                "title": "搜索方式",
                "enum": [
                    {
                        "label": "搜索框",
                        "value": "searchbox"
                    },
                    {
                        "label": "条件筛选",
                        "value": "filter"
                    }
                ],
                "type": "string",
                "x-runtime-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
                },
                "description": " '搜索框'或'条件筛选' "
            },
            "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,
                "description": "设置用于筛选的字段显隐/顺序 "
            },
            "bindConnectMetadata": {
                "title": "APIs",
                "type": "object",
                "x-component": "connector-select",
                "x-index": 40,
                "x-category": "基础属性",
                "required": true,
                "x-props": {
                    "data-hidebind": true
                },
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "connectorMethod",
                        "schema": {
                            "x-component-props": {
                                "value": "{{$self.value}}"
                            }
                        }
                    }
                ],
                "description": "展示数据的 APIs 来源选择"
            },
            "connectorMethod": {
                "title": "调用方法",
                "type": "object",
                "x-component": "connector-method-select",
                "x-index": 50,
                "x-category": "基础属性",
                "required": true,
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "columnSets",
                        "schema": {
                            "x-component-props": "{{ {dataSourceType:$form.values.dataSourceType, bindConnectMetadata: $form.values.bindConnectMetadata, connectorMethod: $value } }}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "*(fixedFront,fixedEnd)",
                        "schema": {
                            "enum": []
                        }
                    }
                ],
                "x-component-props": {
                    "docUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/ModelTable#%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/ModelTable#%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": 60,
                "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"
                }
            },
            "isOrderBy": {
                "title": "显示排序按钮",
                "type": "boolean",
                "x-index": 70,
                "x-runtime-default": true,
                "x-category": "基础属性",
                "x-platforms": ["PCWEB"],
                "description": "对 APIs 调用方法填充的表格列头排序图标进行显隐控制 "
            },
            "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"
                    }
                },
                "x-runtime-default": [],
                "x-component": "column-list",
                "x-component-props": {
                    "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} }}"
                        }
                    },
                    {
                        "type": "value:schema",
                        "target": "*(fixedFront,fixedEnd)",
                        "schema": {
                            "enum": "{{ (($self.value|| []).filter((item)=>item.key && item.key.length>0)).map(item=>{return {'label':item.header,'value':item.key}}) }}"
                        }
                    },
                    {
                        "type": "value:state",
                        "condition": "{{ !Array.isArray($self.value) || $self.value.length === 0 || ($self.value.filter((item)=>item.key===$form.values.fixedFront)).length===0  }}",
                        "target": "fixedFront",
                        "state": {
                            "value": ""
                        }
                    },
                    {
                        "type": "value:state",
                        "condition": "{{ !Array.isArray($self.value) || $self.value.length === 0 || ($self.value.filter((item)=>item.key===$form.values.fixedEnd)).length===0  }}",
                        "target": "fixedEnd",
                        "state": {
                            "value": ""
                        }
                    }
                ],
                "x-index": 80,
                "description": "设置表格列的显隐/顺序，若设置该列为自定义，可实现单元格内插入任意组件替换其默认展示"
            },
            "fixedFront": {
                "title": "冻结首列至本列",
                "type": "string",
                "enum": [],
                "x-props": {
                    "clearable": true
                },
                "x-index": 82
            },
            "fixedEnd": {
                "title": "冻结本列至尾列",
                "type": "string",
                "enum": [],
                "x-props": {
                    "clearable": true
                },
                "description": "请注意：以上两个属性配置的冻结列出现交叉重复时，为避免表格的横向滚动锁定，冻结属性会自动失效",
                "x-index": 84
            },
            "rowColor": {
                "title": "行背景颜色",
                "type": "string",
                "x-component": "color-string",
                "x-index": 90,
                "description": "设置固定值或绑定低码方法，实现行背景颜色的改变"
            },
            "emptyText": {
                "x-index": 91,
                "type": "string",
                "title": "空状态提示",
                "x-runtime-default": "暂无数据",
                "description": "无数据时的提示说明，内容为空时则不显示该提示"
            },
            "enableCellCustomOption": {
                "title": "操作列",
                "type": "boolean",
                "x-index": 100,
                "default": true,
                "x-category": "基础属性",
                "description": "开启后，可拖拽按钮等组件，放入大纲树的操作列节点或表格的操作列区域"
            },
            "enableGlobalButton": {
                "title": "全局按钮",
                "type": "boolean",
                "x-index": 110,
                "default": true,
                "x-category": "基础属性",
                "description": "开启后，可拖拽按钮等组件，放入大纲树的全局按钮节点或表格的全局按钮区域"
            },
            "globalButton": {
                "title": "全局按钮",
                "type": "slot"
            },
            "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"
                    }
                }
            },
            "cell__custom__option": {
                "title": "操作列",
                "type": "slot",
                "x-slot-scope": {
                    "record": {
                        "title": "行对象",
                        "type": "object"
                    },
                    "rowKey": {
                        "title": "行唯一标识",
                        "type": "string"
                    },
                    "recordIndex": {
                        "title": "行序号",
                        "type": "number"
                    },
                    "column": {
                        "title": "列对象",
                        "type": "object"
                    },
                    "columnIndex": {
                        "title": "列序号",
                        "type": "number"
                    }
                }
            }
        }
    },
    "events": [
        {
            "title": "选中数据改变",
            "name": "rowsSelect",
            "description": "可将当前选中的行记录，作为数组传参出去",
            "x-platforms": ["MOBILEWEB", "PCWEB"]
        },
        {
            "title": "查询成功",
            "name": "querySuccess",
            "description": "查询成功的回调事件",
            "x-platforms": ["MOBILEWEB", "PCWEB"]
        }
    ],
    "platforms": ["web"],
    "meta": {
        "title": "数据表格(旧)",
        "componentName": "Table",
        "description": "表格可以清晰地展示二维数据",
        "icon": "https://imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/ModelTable.svg",
        "category": "数据容器",
        "categoryOrder": 100,
        "componentOrder": 40,
        "platform": ["MOBILEWEB", "PCWEB"],
        "visible": [],
        "selectableBlock": {
            "events": [
                {
                    "name": "tap",
                    "title": "点击"
                }
            ]
        },
        "deprecated": true,
        "renderMode": [
            {
                "component": "WdTable",
                "props": {},
                "renderType": "update",
                "materialName": "gsd-h5-react",
                "description": "- 本次升级提供全新的PC端/移动端表格样式  - 完善筛选器、表格列配置能力  - 新增点击表格行事件  - 规范组件属性名称与分类"
            }
        ]
    },
    "configMeta": {
        "shortcut": {
            "props": [
                "dataSourceType",
                "bindMetadata",
                "bindConnectMetadata",
                "connectorMethod",
                "connectorParams"
            ]
        },
        "docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/database/ModelTable",
        "contextData": {
            "setField": true,
            "setRelated": true,
            "extra": {
                "selectedRecords": {
                    "title": "已选中的记录",
                    "type": "array",
                    "description": "适用于表格多选操作",
                    "x-index": 1
                },
                "total": {
                    "title": "记录总条数",
                    "type": "number",
                    "x-index": 2
                },
                "pageNo": {
                    "title": "页码",
                    "type": "number",
                    "x-index": 3
                },
                "pageSize": {
                    "title": "每页大小",
                    "type": "number",
                    "x-index": 4
                }
            }
        }
    },
    "compConfig": {
        "isDataContainer": true
    },
    "methods": [
        {
            "name": "import",
            "label": "数据导入",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "仅当数据源为数据模型场景时支持导入，可按照模版，上传 excel 文件，录入数据"
        },
        {
            "name": "exportOptionalMode",
            "label": "数据导出(可选导出模式)",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "支持将当前选中数据导出为 excel"
        },
        {
            "name": "export",
            "label": "数据导出(导出选中数据)",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "支持将当前选中数据导出为 excel"
        },
        {
            "name": "deleteOne",
            "label": "删除单条数据",
            "params": {
                "properties": {
                    "id": {
                        "title": "删除数据的标识",
                        "type": "string",
                        "default": ""
                    }
                }
            },
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "仅当数据源为数据模型场景时，支持删除行数据"
        },
        {
            "name": "deleteSelected",
            "label": "删除选中数据",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "仅当数据源为数据模型场景时，支持删除当前选中的行记录"
        },
        {
            "name": "refresh",
            "label": "刷新表格(查看第1页数据)",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "刷新表格(查看第 1 页数据)"
        },
        {
            "name": "refreshKeepPage",
            "label": "刷新表格(查看当前页数据)",
            "x-platforms": ["MOBILEWEB", "PCWEB"],
            "description": "刷新表格(查看当前页数据)"
        }
    ]
}
