From 5b974f6e0ee17c16f55a83d8022a1c16db75cd79 Mon Sep 17 00:00:00 2001 From: wisonic Date: Thu, 27 Feb 2025 16:49:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E5=B1=9E=E6=80=A7=E6=A8=A1=E5=BC=8F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E5=B1=95=E5=BC=80=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=20#14460?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/en.ts | 17 ++++---- core/core-frontend/src/locales/tw.ts | 17 ++++---- core/core-frontend/src/locales/zh-CN.ts | 5 ++- .../src/models/chart/chart-attr.d.ts | 4 ++ .../components/BasicStyleSelector.vue | 39 ++++++++++++++++++- .../chart/components/editor/util/chart.ts | 1 + .../js/panel/charts/table/table-pivot.ts | 18 ++++++++- .../components/js/panel/common/common_antv.ts | 23 +++++++++++ 8 files changed, 107 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index f93be7c536..4a425ebfa4 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -1814,12 +1814,12 @@ export default { axis_tip: 'Minimum value, maximum value, and interval are all numeric types; if not filled in, this item will be considered automatic.
Please make sure that the filled value can be calculated correctly, otherwise the axis value will not be displayed normally. ', format_tip: `The template variables are {a}, {b}, {c}, {d}, which represent the series name, data name, data value, etc.
-When the trigger position is 'coordinate axis', there will be multiple series of data. At this time, the index of the series can be represented by {a0}, {a1}, {a2} followed by an index.
-The meanings of {a}, {b}, {c}, {d} in different chart types are different. The variables {a}, {b}, {c}, {d} represent the data meanings in different chart types:

-Line (area) chart, column (bar) chart, dashboard: {a} (series name), {b} (category value), {c} (value)
-Pie chart, funnel chart: {a} (series name), {b} (data item name), {c} (value), {d} (percentage)
-Map: {a} (series name), {b} (area name), {c} (combined value), {d} (none)
-Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value array), {d} (none)`, + When the trigger position is 'coordinate axis', there will be multiple series of data. At this time, the index of the series can be represented by {a0}, {a1}, {a2} followed by an index.
+ The meanings of {a}, {b}, {c}, {d} in different chart types are different. The variables {a}, {b}, {c}, {d} represent the data meanings in different chart types:

+ Line (area) chart, column (bar) chart, dashboard: {a} (series name), {b} (category value), {c} (value)
+ Pie chart, funnel chart: {a} (series name), {b} (data item name), {c} (value), {d} (percentage)
+ Map: {a} (series name), {b} (area name), {c} (combined value), {d} (none)
+ Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value array), {d} (none)`, h_position: 'Horizontal position', v_position: 'Vertical position', p_left: 'Left alignment', @@ -2035,7 +2035,10 @@ Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value arr pivot_export_invalid_field: 'The row dimension or indicator dimension is empty and can not be exported !', pivot_export_invalid_col_exceed: - 'Table can not be exported cause the number of columns exceeds the maximum limit!' + 'Table can not be exported cause the number of columns exceeds the maximum limit!', + expand_all: 'Expand all', + level_label: 'Level {num}', + default_expand_level: 'Default expand level' }, dataset: { field_value: 'Field Value', diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index 56c4adf6ce..00c745a99d 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -1771,12 +1771,12 @@ export default { axis_tip: '最小值、最大值、間隔均為數值類型;若不填,則該項視為自動。
請確保填入數值能正確計算,否則將無法正常顯示軸值。 ', format_tip: `模板變數有{a}, {b},{c},{d},分別表示系列名,資料名,資料值等。
-在觸發位置為'座標軸' 的時候,會有多個系列的數據,此時可以透過{a0}, {a1}, {a2} 這種後面加索引的方式表示系列的索引。
-不同圖表類型下的{a},{b},{c},{d} 意義不一樣。 其中變數{a}, {b}, {c}, {d}在不同圖表類型下代表資料意義為:

-折線(區域)圖、柱狀(長條)圖、儀錶板: {a}(系列名稱),{b}(類目值),{c}(數值)
-圓餅圖、漏斗圖: {a}(系列名稱),{b}(資料項名稱),{c}(數值), {d}(百分比)
-地圖: {a}(系列名稱),{b}(區域名稱),{c}(合併數值), {d}(無)
-散佈圖(氣泡)圖: {a}(系列名稱),{b}(資料名稱),{c}(數值陣列), {d}(無)`, + 在觸發位置為'座標軸' 的時候,會有多個系列的數據,此時可以透過{a0}, {a1}, {a2} 這種後面加索引的方式表示系列的索引。
+ 不同圖表類型下的{a},{b},{c},{d} 意義不一樣。 其中變數{a}, {b}, {c}, {d}在不同圖表類型下代表資料意義為:

+ 折線(區域)圖、柱狀(長條)圖、儀錶板: {a}(系列名稱),{b}(類目值),{c}(數值)
+ 圓餅圖、漏斗圖: {a}(系列名稱),{b}(資料項名稱),{c}(數值), {d}(百分比)
+ 地圖: {a}(系列名稱),{b}(區域名稱),{c}(合併數值), {d}(無)
+ 散佈圖(氣泡)圖: {a}(系列名稱),{b}(資料名稱),{c}(數值陣列), {d}(無)`, h_position: '水平位置', v_position: '垂直位置', p_left: '左對齊', @@ -1979,7 +1979,10 @@ export default { accumulate: '累加', table_cross_bg_tip: '合併儲存格後,不支持斑馬紋', pivot_export_invalid_field: '行維度或指標維度為空不可導出!', - pivot_export_invalid_col_exceed: '表格列數超過最大限制不可導出!' + pivot_export_invalid_col_exceed: '表格列數超過最大限制不可導出!', + expand_all: '全展開', + level_label: '第{num}層級', + default_expand_level: '默認展開層級' }, dataset: { field_value: '欄位值', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 1f8765d577..fda1321b5f 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1985,7 +1985,10 @@ export default { accumulate: '累加', table_cross_bg_tip: '合并单元格后,不支持班马纹', pivot_export_invalid_field: '行维度或指标维度为空不可导出!', - pivot_export_invalid_col_exceed: '表格列数超过最大限制不可导出!' + pivot_export_invalid_col_exceed: '表格列数超过最大限制不可导出!', + expand_all: '全展开', + level_label: '第{num}层级', + default_expand_level: '默认展开层级' }, dataset: { field_value: '字段值', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 2c916ef832..a796d99c6f 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -104,6 +104,10 @@ declare interface ChartBasicStyle { * 表格展示形式,平铺和树形 */ tableLayoutMode: 'grid' | 'tree' + /** + * 表格默认展开层级 + */ + defaultExpandLevel: number | 'all' /** * 仪表盘样式 */ 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 ba9a2480d5..c7a1d75b22 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 @@ -12,11 +12,14 @@ import { cloneDeep, debounce, defaultsDeep } from 'lodash-es' import { SERIES_NUMBER_FIELD } from '@antv/s2' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' -import { isNumber } from 'mathjs' +import { isNumber } from 'lodash-es' import { ElFormItem, ElInputNumber, ElMessage } from 'element-plus-secondary' import { svgStrToUrl } from '../../../js/util' +import { numberToChineseUnderHundred } from '../../../js/panel/common/common_antv' +import { useLocaleStoreWithOut } from '@/store/modules/locale' const dvMainStore = dvMainStoreWithOut() +const localeStore = useLocaleStoreWithOut() const { batchOptStatus, mobileInPc } = storeToRefs(dvMainStore) const { t } = useI18n() const props = defineProps({ @@ -33,6 +36,7 @@ const props = defineProps({ } }) const showProperty = prop => props.propertyInner?.includes(prop) +const tableExpandLevelOptions = reactive([{ name: t('chart.expand_all'), value: 'all' }]) const predefineColors = COLOR_PANEL const state = reactive({ basicStyleForm: JSON.parse(JSON.stringify(DEFAULT_BASIC_STYLE)) as ChartBasicStyle, @@ -106,6 +110,20 @@ const init = () => { state.customColor = state.basicStyleForm.colors[0] state.colorIndex = 0 } + if (basicStyle.tableLayoutMode === 'tree') { + tableExpandLevelOptions.splice(1) + let maxLevel = props.chart.xAxis?.length + if (isNumber(basicStyle.defaultExpandLevel)) { + maxLevel = Math.max(maxLevel, basicStyle.defaultExpandLevel) + } + for (let i = 1; i <= maxLevel; i++) { + let name = t('chart.level_label', { num: i }) + if (localeStore.getCurrentLocale.lang !== 'en') { + name = t('chart.level_label', { num: numberToChineseUnderHundred(i) }) + } + tableExpandLevelOptions.push({ name, value: i }) + } + } initTableColumnWidth() } const debouncedInit = debounce(init, 500) @@ -307,6 +325,25 @@ onMounted(() => { {{ t('chart.table_layout_tree') }} + + + + +