基础表格 basic-table
基础表格 basic-table
功能最全的表格:多列、分页、序号 / 单选 / 操作列、行选中、联动。
- 类型串:
basic-table默认尺寸:[480, 320]分类:图表与表格
实时预览
下面渲染的是真实组件(与编辑器 / 运行时同源)。修改右侧「样式参数」,左侧预览实时更新;点击底部「全页面查看」可放大。
属性
下表为本组件特有的属性;
position/size/opacity/background/border/ 联动选中 / 筛选等通用参数见组件手册总览。
basic
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
event-can-cancel-time | 检测间隔 | number(unit=ms) | 500 | |
virtual-scroll-limit | 滚动限制 | vector<行数,列数> | [100,20] | |
row-count | 行数 | number(min=1) | 5 | |
table-row-height | 表格行高 | number(unit=px,min=0) | 30 | |
row-spacing | 行间距 | number(unit=px) | 0 | |
autoWidth | 列宽自适应 | boolean | false | |
hide-empty-tip | 隐藏空数据提示 | boolean | false | |
select-first-row | 默认选中首行 | boolean | false | |
keep-row-selected | 数据更新后保持选中 | boolean | false | |
show-scrollbar | 显示滚动条 | boolean | false | |
show-scrollbar-vertical | 纵向滚动 | boolean | true | |
show-scrollbar-horizontal | 横向滚动 | boolean | true | |
scrollbar-size | 滚动条宽度 | number(min=0,unit=px) | 3 | |
scrollbar-border-radius | 滚动条圆角 | number(min=0,unit=px) | 3 | |
scrollbar-color | 滚动条颜色 | color | #a5a5a5 | |
scrollbar-bg-color | 滚动条背景颜色 | color | transparent |
rowSetting
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
header-height | 高度 | number(min=0,unit=px) | 36 | |
header-margin-bottom | 间距 | number(unit=px) | 0 | |
header-font | 文字 | font | {"color":"#E6F1FF","size":14,"bold":true,"italic":false} | |
header-bg-color | 背景颜色 | color(gradient) | #1087E433 | |
header-bg-image | 背景图片 | file(format=image) | — | |
header-bg-image-fill-type | 填充方式 | select(radioGroup) | stretch | 可选:stretch / tile / none |
header-bg-image-size | 图片比例 | number(unit=%) | 100 | |
header-bg-image-position | 图片位置 | vector<X,Y>(unit=px) | [0,0] | |
header-bg-image-use-nine-patch | 是否使用点九 | boolean | false | |
header-bg-image-nine-patch | 点九编辑 | nine-patch | {} | |
header-text-overflow | 内容过长策略 | select | ellipsis | 可选:ellipsis / clip / marquee / normal |
header-align | 对齐方式 | select(radioGroup) | center | 可选:left / center / right |
table-row-body-cluster | `` | — | ||
table-count-height | 高度 | number(min=0,unit=px) | 0 | |
table-count-margin-top | 间距 | number(unit=px) | 0 | |
table-count-text | 文本 | string | 总计 | |
table-count-text-style | 文本样式 | font | {"color":"#E6F1FF","size":14,"bold":false,"italic":false} | |
table-count-bg-color | 背景颜色 | color(gradient) | #1087E433 | |
table-count-bg-image | 背景图片 | file(format=image) | — | |
table-count-bg-image-fill-type | 填充方式 | select(radioGroup) | stretch | 可选:stretch / tile / none |
table-count-bg-image-size | 图片比例 | number(unit=%) | 100 | |
table-count-bg-image-position | 图片位置 | vector<X,Y>(unit=px) | [0,0] | |
table-count-bg-image-use-nine-patch | 是否使用点九 | boolean | false | |
table-count-bg-image-nine-patch | 点九编辑 | nine-patch | {} | |
table-count-text-overflow | 内容过长策略 | select | ellipsis | 可选:ellipsis / clip / marquee / normal |
table-count-align | 对齐方式 | select(radioGroup) | center | 可选:left / center / right |
colSetting
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
order-fixed | 固定序号列 | select(radioGroup) | left | 可选:left / right / none |
order-width | 序号列列宽 | number(min=0,unit=px) | 0 | |
order-name | 序号列名称 | string | 序号 | |
order-format | 序号格式 | string | {index} | |
order-type | 类型 | select(radioGroup) | number | 可选:number / roman |
order-text-align | 对齐方式 | select(radioGroup) | center | 可选:left / center / right |
order-bg-color | 背景颜色 | color(gradient) | transparent | |
order-bg-image | 背景图片 | file(format=image) | — | |
order-bg-image-fill-type | 填充方式 | select(radioGroup) | stretch | 可选:stretch / tile / none |
order-bg-image-size | 图片比例 | number(unit=%) | 100 | |
order-bg-image-position | 图片位置 | vector<X,Y>(unit=px) | [0,0] | |
order-bg-image-use-nine-patch | 是否使用点九 | boolean | false | |
order-bg-image-nine-patch | 点九编辑 | nine-patch | {} | |
order-font-setting | 字体设置 | boolean | false | |
order-text-font | 字体 | font | {"color":"#d7e6ff","size":12,"bold":false,"italic":false} | |
order-icon | 图标 | file(format=image,multiple) | [] | |
order-icon-show-row | 图标显示行数 | select(radioGroup) | all | 可选:all / diy |
order-icon-diy-row | 自定义行数 | number(unit=行) | 0 | |
order-icon-size | 图标尺寸 | vector<W,H>(min=0,unit=px) | [20,20] | |
order-icon-zindex | 图标显示方式 | select(radioGroup) | down | 可选:up / down |
order-condition-setting | 条件样式 | boolean | false | |
order-condition | `` | — | ||
table-col-body-cluster | `` | — | ||
col-condition-setting | 条件样式 | boolean | false | |
col-condition | `` | — | ||
operate-click-selected-row | 点击选中 | boolean | false | |
operate-fixed | 固定操作列 | select(radioGroup) | right | 可选:left / right / none |
operate-width | 操作列列宽 | number(min=0,unit=px) | 0 | |
operate-name | 操作列名称 | string | 操作 | |
operate-text-align | 对齐方式 | select(radioGroup) | center | 可选:left / center / right |
operate-font-setting | 字体设置 | boolean | false | |
operate-font | 操作项字体 | font | {"color":"#fff","size":12,"bold":false,"italic":false} | |
operate-separator-font | 分隔符字体 | font | {"color":"#fff","size":12,"bold":false,"italic":false} | |
operate-text-list | 操作项列表 | string(multiple,draggable,defaultString=操作) | [] | |
operate-separator | 分隔符 | string | | | |
operate-condition-setting | 条件样式 | boolean | false | |
operate-condition | `` | — | ||
radio-fixed | 固定选框列 | select(radioGroup) | left | 可选:left / right / none |
radio-width | 选框列列宽 | number(min=0,unit=px) | 0 | |
radio-name | 选框列名称 | string | — | |
radio-text-align | 对齐方式 | select(radioGroup) | center | 可选:left / center / right |
radio-bg-color | 背景颜色 | color(gradient) | transparent | |
radio-bg-image | 背景图片 | file(format=image) | — | |
radio-bg-image-fill-type | 填充方式 | select(radioGroup) | stretch | 可选:stretch / tile / none |
radio-bg-image-size | 图片比例 | number(unit=%) | 100 | |
radio-bg-image-position | 图片位置 | vector<X,Y>(unit=px) | [0,0] | |
radio-bg-image-use-nine-patch | 是否使用点九 | boolean | false | |
radio-bg-image-nine-patch | 点九编辑 | nine-patch | {} | |
radio-style | 选框样式 | select(radioGroup) | default | 可选:default / image |
radio-image-default | 默认图标 | file(format=image) | — | |
radio-image-hover | 悬停图标 | file(format=image) | — | |
radio-image-checked | 选中图标 | file(format=image) | — | |
radio-font-size | 选框大小 | number(min=0,unit=px) | 10 | |
radio-font-color | 选框颜色 | color | #ccc |
gridLine
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
table-header-line-horizontal-width | 水平线宽 | number(min=0,unit=px) | 2 | |
table-header-line-horizontal-color | 水平线颜色 | color | #1087E4B3 | |
table-header-line-vertical-width | 垂直线宽 | number(min=0,unit=px) | 1 | |
table-header-line-vertical-color | 垂直线颜色 | color | #1087E400 | |
table-cell-line-horizontal-width | 水平线宽 | number(min=0,unit=px) | 1 | |
table-cell-line-horizontal-color | 水平线颜色 | color | #1087E42E | |
table-cell-line-vertical-width | 垂直线宽 | number(min=0,unit=px) | 1 | |
table-cell-line-vertical-color | 垂直线颜色 | color | #1087E400 |
pagination
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
pagination-height | 高度 | number(min=0,unit=px) | 0 | |
connection-pagination | 数据库分页 | boolean | false | |
pagination-layout | 功能项配置 | select(multiple) | ["total","prev","pager","next","jumper"] | 可选:total / sizes / prev / pager / next / jumper |
pagination-button-size | 按钮尺寸 | vector<宽,高>(min=0,unit=px) | [28,28] | |
pager-count | 最大按钮数 | number(min=2,unit=个) | 9 | |
page-size | 每页数据条数 | number(unit=条) | 10 | |
pagination-font | 字体 | font | {"color":"#D7E6FF","size":13,"bold":false,"italic":false} | |
pagination-button-bg-color | 按钮背景色 | color | #1087E426 | |
pagination-button-active-bg-color | 按钮选中背景色 | color | #1087E4 | |
pagination-button-font | 页码按钮字体 | font | {"color":"#D7E6FF","size":13,"bold":false,"italic":false} | |
pagination-button-active-font-color | 页码选中字体色 | color | #ffffff | |
pagination-switch-button-font | 切换按钮字体 | font | {"color":"#D7E6FF","size":13,"bold":false,"italic":false} | |
pagination-button-disabled-bg-color | 按钮禁用背景色 | color | #FFFFFF14 | |
pagination-button-disabled-font-color | 按钮禁用字体色 | color | #6B7C93 | |
pagination-input-size | 输入框尺寸 | vector<宽,高>(min=0,unit=px) | [48,26] | |
pagination-input-font | 输入框字体 | font | {"color":"#fff","size":13,"bold":false,"italic":false} | |
pagination-input-bg-color | 输入框背景色 | color | #0F2947 | |
pagination-input-border-color | 输入框边框色 | color | #1087E466 |
animation-display
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
animation-display | 播放动画 | boolean | false | |
animation-display-delay | 动画延迟时长 | number<float>(unit=s) | 1 | |
animation-display-type | 动画类型 | select(radioGroup) | row | 可选:row / page |
animation-display-type-page-items | 衔接方式 | select(radioGroup) | showType2 | 可选:showType1 / showType2 |
animation-display-type-row-items | 衔接方式 | select(radioGroup) | showType4 | 可选:showType3 / showType4 |
animation-display-duration | 单次动画持续 | number<float>(unit=s) | 1 | |
animation-display-interval | 单次动画停留 | number<float>(unit=s) | 1 | |
animation-display-loop | 循环播放动画 | boolean | true | |
animation-display-loop-interval | 循环间隔 | number<float>(unit=s) | 2 | |
animation-display-select-stop | 选中行后暂停 | boolean | false |
fields
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
remove-trailing-empty-line | 去除末尾空行 | boolean | true |
sort
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
sort-object | 排序对象 | select | toChoose | |
sort-type | 排序方式 | select(radioGroup) | normal | 可选:normal / ASC / DESC |
post-sort-filter | 排序后数据筛选 | boolean | false | |
post-sort-filter-mode | 筛选条件 | select | no-condition | 可选:no-condition / data-row / data-rows / data-rule |
post-sort-filter-row-index | 筛选行号 | number(min=1) | 1 | |
post-sort-filter-start-index | 筛选起始行号 | number(min=1) | 1 | |
post-sort-filter-row-count | 筛选条数 | number(min=1) | 1 | |
post-sort-row-filter-mode-id | 数据规则 | select(condition) | — |
数据绑定
| 字段槽 | 类型 / 约束 | 说明 |
|---|---|---|
cross-filter-key-field | field(max=1) | 选择字段 |
select-sync-fields | field | 选中字段 |
table-data-fields | field | 数据字段 |
table-key-fields | field | 关键字段 |
事件
触发器
触发器在预览 / 播放态生效(编辑态点击 = 选中组件)。写在本组件
options.interactions的groups[].trigger里。
| 触发器 | 名称 | 触发时机 | payload(供动作公式 {:字段} 取值) |
|---|---|---|---|
click-row | 点击行 | 点击表格某行时触发 | 整行:{rowNumber, value, row:{别名:值}} |
select-row | 选中行 | 行被选中时触发 | 同 click-row |
unselect-row | 取消选中行 | 行取消选中时触发 | 同 click-row |
click-operate | 点击操作列 | 点击操作列按钮时触发 | 行数据 + 操作项 |
itemClicked | 点击某项 | 点击表格某项时触发 | 该项类目维度,如 {城市:"北京"}(仅类目,不含数值) |
click | 点击 | 点击本组件时触发 | 无 |
mouseEnter | 鼠标移入 | 指针移入组件时触发 | 无 |
mouseLeave | 鼠标移出 | 指针移出组件时触发 | 无 |
appear | 入场 | 组件出现时触发(配合进场动画) | 无 |
disappear | 离场 | 组件消失时触发(配合退场动画) | 无 |
receiveBehaviorEvent | 接收行为事件 | 收到 sendBehaviorEvent 动作或宿主 ctx.emit 投递的事件时触发(按 eventName 匹配) | 发送方携带的 data |
动作
触发器命中后执行的动作。本组件既可发起动作(配在自己的交互里),也可作为其它组件动作的目标。
| 动作 | 名称 | 说明 |
|---|---|---|
changeOption | 修改设置 | 把本组件(或其它组件)的某个属性改为静态值 / 公式动态值 |
switchState | 切换状态 | 切到多状态里的某个状态(state:"" 回默认态) |
appear / disappear | 进 / 退场动画 | 对目标 opacity 做 0↔100 插值的显隐动画 |
完整动作清单(switchScreen / switchWindow / openUrl / sendBehaviorEvent / transfer / executeScript / requestApi 等)与持久化写法见事件交互。
示例
{
"type": "basic-table",
"uid": "w_basic_table",
"options": {
"position": [40, 40],
"size": [480, 320],
"cross-filter-key-field": [["conn_demo", "tbl_demo", "字段名"]],
"select-sync-fields": [["conn_demo", "tbl_demo", "字段名"]],
"table-data-fields": [["conn_demo", "tbl_demo", "字段名"]]
}
}绑定三元组
[连接uid, 表uid, 字段uid]指向工程connections里的真实字段,见数据系统。
变体示例:分页 + 序号 + 操作列
pagination-height > 0出分页条、order-width > 0出序号列、operate-width > 0出操作列(operate-text-list定义操作项,点击派发click-operate)。
变体示例:整页轮播(无人值守大屏)
animation-display: true+animation-display-type: page让表格按页自动轮播。
组合示例:表格接收饼图选中
见饼图页的组合示例:饼图
select-sync-emit→ 本表格select-sync-receive+select-sync-fields高亮对应行。