diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue
index 535f6bb1ee..6133842de9 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue
@@ -939,6 +939,9 @@ onMounted(async () => {
{{ t('chart.table_column_custom') }}
+
+ {{ t('chart.table_column_col_adapt') }}
+
{
}
.table-column-mode {
:deep(.ed-radio) {
- margin-right: 10px !important;
+ margin-right: 8px !important;
}
}
.basic-input-number {
diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableCellSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableCellSelector.vue
index 93e9b748fe..c78bea8e70 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableCellSelector.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableCellSelector.vue
@@ -148,10 +148,15 @@ const init = () => {
align
})
})
- const flag = alignConfigOptions.findIndex(item => item.id === alignConfig.id) === -1
- if (flag) {
- alignConfig.id = alignConfigOptions[0].id
- alignConfig.align = alignConfigOptions[0].align
+ if (alignConfigOptions.length) {
+ const exist = alignConfigOptions.findIndex(item => item.id === alignConfig.id) !== -1
+ if (!exist) {
+ alignConfig.id = alignConfigOptions[0].id
+ alignConfig.align = alignConfigOptions[0].align
+ }
+ } else {
+ alignConfig.id = ''
+ alignConfig.align = 'left'
}
}
}
diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderSelector.vue
index 23299af241..f4c98171d1 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderSelector.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderSelector.vue
@@ -189,10 +189,15 @@ const init = () => {
align
})
})
- const flag = alignConfigOptions.findIndex(item => item.id === alignConfig.id) === -1
- if (flag) {
- alignConfig.id = alignConfigOptions[0].id
- alignConfig.align = alignConfigOptions[0].align
+ if (alignConfigOptions.length) {
+ const exist = alignConfigOptions.findIndex(item => item.id === alignConfig.id) !== -1
+ if (!exist) {
+ alignConfig.id = alignConfigOptions[0].id
+ alignConfig.align = alignConfigOptions[0].align
+ }
+ } else {
+ alignConfig.id = ''
+ alignConfig.align = 'left'
}
}
}
diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts
index e588ed00c0..026206408f 100644
--- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts
+++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts
@@ -573,6 +573,14 @@ export class TableInfo extends S2ChartView {
}
}
+ setupDefaultOptions(chart: ChartObj): ChartObj {
+ const customAttr = parseJson(chart.customAttr)
+ if (customAttr.basicStyle.tableColumnMode === 'colAdapt') {
+ customAttr.basicStyle.tableColumnMode = 'adapt'
+ }
+ return chart
+ }
+
constructor() {
super('table-info', [])
}
diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts
index 0c60f978af..7eea36c0e7 100644
--- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts
+++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts
@@ -72,6 +72,10 @@ export class TableNormal extends S2ChartView {
setupDefaultOptions(chart: ChartObj): ChartObj {
chart.xAxis = []
+ const customAttr = parseJson(chart.customAttr)
+ if (customAttr.basicStyle.tableColumnMode === 'colAdapt') {
+ customAttr.basicStyle.tableColumnMode = 'adapt'
+ }
return chart
}
diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts
index 459dcf4c5f..4e0d765c50 100644
--- a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts
+++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts
@@ -563,6 +563,10 @@ export function getStyle(chart: Chart, dataConfig: S2DataConfig): Style {
style.colCfg.width = basicStyle.tableColumnWidth
break
}
+ case 'colAdapt': {
+ style.layoutWidthType = 'colAdaptive'
+ break
+ }
// 查看详情用,均分铺满
default: {
delete style.layoutWidthType