diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap index 399a402915..6102d0339f 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap @@ -1323,6 +1323,1586 @@ Array [ ] `; +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "province", + "actualTextHeight": 16, + "actualTextWidth": 51, + "height": 20, + "multiLineActualTexts": Array [ + "province", + ], + "originalText": "province", + "width": 119.66, + }, + Object { + "actualText": "city", + "actualTextHeight": 16, + "actualTextWidth": 21, + "height": 20, + "multiLineActualTexts": Array [ + "city", + ], + "originalText": "city", + "width": 119.66, + }, + Object { + "actualText": "type", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "type", + ], + "originalText": "type", + "width": 319.32, + }, + Object { + "actualText": "sub_type", + "actualTextHeight": 16, + "actualTextWidth": 53, + "height": 20, + "multiLineActualTexts": Array [ + "sub_type", + ], + "originalText": "sub_type", + "width": 319.32, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 189, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 212, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 239.34, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 239.34, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 189, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 119.66, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 119.66, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 119.66, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 119.66, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 119.66, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 212, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 119.66, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 119.66, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 119.66, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 119.66, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 119.66, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 5`] = ` +Array [ + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": "3877", + "width": 119.67, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": "4342", + "width": 119.67, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 119.67, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 119.67, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": "1723", + "width": 119.67, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": "1822", + "width": 119.67, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": "1943", + "width": 119.67, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": "2330", + "width": 119.67, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": "7234", + "width": 119.67, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": "834", + "width": 119.67, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": "5343", + "width": 119.67, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": "632", + "width": 119.67, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": "2451", + "width": 119.67, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": "2244", + "width": 119.67, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": "2333", + "width": 119.67, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": "2445", + "width": 119.67, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": "1145", + "width": 119.67, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": "1432", + "width": 119.67, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": "945", + "width": 119.67, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": "1304", + "width": 119.67, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": "2335", + "width": 119.67, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": "245", + "width": 119.67, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": "2457", + "width": 119.67, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": "2458", + "width": 119.67, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": "1523", + "width": 119.67, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": "1634", + "width": 119.67, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": "1343", + "width": 119.67, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": "1354", + "width": 119.67, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": "4004", + "width": 119.67, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": "3077", + "width": 119.67, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": "3551", + "width": 119.67, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": "352", + "width": 119.67, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 53, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 53, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 102.57, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 102.57, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 56, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 285.14, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 56, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 285.14, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 163, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 259, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 56, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 205.14, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 56, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 56, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 56, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 102.57, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 56, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 56, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 205.14, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 56, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 56, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 53, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 163, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 102.57, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 102.57, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 102.57, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 60, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 102.57, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 102.57, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 102.57, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 20, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 102.57, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 259, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 102.57, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 100, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 102.57, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 102.57, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 102.57, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 53, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 30, + "multiLineActualTexts": Array [ + "236723672361", + "111", + ], + "originalText": "236723672361111", + "width": 102.57, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": "3877", + "width": 102.57, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 60, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": "4342", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": "1723", + "width": 102.57, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": "1822", + "width": 102.57, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": "1943", + "width": 102.57, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": "2330", + "width": 102.57, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": "632", + "width": 102.57, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": "7234", + "width": 102.57, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 60, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": "834", + "width": 102.57, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": "5343", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": "2451", + "width": 102.57, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": "2244", + "width": 102.57, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": "2333", + "width": 102.57, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": "2445", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 60, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 20, + "multiLineActualTexts": Array [ + "778977897789", + "778977897789", + "7789", + ], + "originalText": "7789778977897789778977897789", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 100, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 53, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": "1304", + "width": 102.57, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 20, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": "1145", + "width": 102.57, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 60, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": "1432", + "width": 102.57, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": "945", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": "2335", + "width": 102.57, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": "245", + "width": 102.57, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": "2457", + "width": 102.57, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": "2458", + "width": 102.57, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": "1354", + "width": 102.57, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": "1523", + "width": 102.57, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 60, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": "1634", + "width": 102.57, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": "1343", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": "4004", + "width": 102.57, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": "3077", + "width": 102.57, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 53, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": "3551", + "width": 102.57, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 53, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": "352", + "width": 102.57, + }, +] +`; + exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 1`] = ` Array [ Object { @@ -2198,7 +3778,7 @@ Array [ "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -2209,7 +3789,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -2220,7 +3800,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -2298,7 +3878,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "浙江省", ], @@ -2309,7 +3889,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -2321,7 +3901,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "四川省", ], @@ -2349,7 +3929,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "3877", ], @@ -2360,7 +3940,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "4342", ], @@ -2371,7 +3951,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2382,7 +3962,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2393,7 +3973,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1723", ], @@ -2404,7 +3984,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1822", ], @@ -2415,13 +3995,24 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1943", ], "originalText": "1943", "width": 96, }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": "2330", + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, @@ -2437,7 +4028,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "7234", ], @@ -2448,7 +4039,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "834", ], @@ -2459,7 +4050,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "5343", ], @@ -2470,7 +4061,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2481,7 +4072,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2451", ], @@ -2492,7 +4083,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2244", ], @@ -2503,13 +4094,24 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2333", ], "originalText": "2333", "width": 96, }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": "2445", + "width": 96, + }, ] `; @@ -2580,7 +4182,7 @@ Array [ "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -2591,7 +4193,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -2602,7 +4204,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -2680,7 +4282,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "浙江省", ], @@ -2691,7 +4293,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -2703,7 +4305,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "四川省", ], @@ -2731,7 +4333,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "3877", ], @@ -2742,7 +4344,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "4342", ], @@ -2753,7 +4355,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2764,7 +4366,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2775,7 +4377,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1723", ], @@ -2786,7 +4388,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1822", ], @@ -2797,13 +4399,24 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1943", ], "originalText": "1943", "width": 96, }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": "2330", + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, @@ -2819,7 +4432,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "7234", ], @@ -2830,7 +4443,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "834", ], @@ -2841,7 +4454,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "5343", ], @@ -2852,7 +4465,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -2863,7 +4476,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2451", ], @@ -2874,7 +4487,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2244", ], @@ -2885,13 +4498,24 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2333", ], "originalText": "2333", "width": 96, }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": "2445", + "width": 96, + }, ] `; @@ -2962,7 +4586,7 @@ Array [ "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -2973,7 +4597,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -2984,7 +4608,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -3062,7 +4686,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 134, + "height": 80, "multiLineActualTexts": Array [ "浙江省", ], @@ -3073,7 +4697,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -3085,7 +4709,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 152, + "height": 80, "multiLineActualTexts": Array [ "四川省", ], @@ -3113,7 +4737,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "3877", ], @@ -3124,7 +4748,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "4342", ], @@ -3135,7 +4759,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -3146,7 +4770,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -3157,7 +4781,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1723", ], @@ -3168,7 +4792,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1822", ], @@ -3179,13 +4803,24 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "1943", ], "originalText": "1943", "width": 96, }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": "2330", + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, @@ -3201,7 +4836,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "7234", ], @@ -3212,7 +4847,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "834", ], @@ -3223,7 +4858,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "5343", ], @@ -3234,7 +4869,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -3245,7 +4880,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2451", ], @@ -3256,7 +4891,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2244", ], @@ -3267,13 +4902,24 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "2333", ], "originalText": "2333", "width": 96, }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": "2445", + "width": 96, + }, ] `; @@ -3774,7 +5420,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 35, "multiLineActualTexts": Array [ "2", ], @@ -3874,7 +5520,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 35, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -3947,7 +5593,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 35, "multiLineActualTexts": Array [ "-", ], @@ -4035,7 +5681,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 35, "multiLineActualTexts": Array [ "-", ], diff --git a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts index 8307bdac28..5098e390a9 100644 --- a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts @@ -146,7 +146,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }); afterEach(() => { - s2.destroy(); + // s2.destroy(); }); test('should default render one line text', () => { @@ -474,6 +474,50 @@ describe('SpreadSheet Multi Line Text Tests', () => { matchCellStyleSnapshot(); expect(s2.facet.getLayoutResult().rowsHierarchy.height).toEqual(760); }); + + // https://github.com/antvis/S2/issues/2678 + test('should get correctly row cell height priority if actual text not wrap', async () => { + updateStyle(3); + + s2.setOptions({ + style: { + rowCell: { + heightByField: { + 'root[&]浙江省[&]宁波市': 20, + 'root[&]浙江省[&]舟山市': 60, + 'root[&]浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省[&]杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市': 20, + 'root[&]四川省[&]成都市': 100, + }, + }, + }, + }); + s2.changeSheetSize(800, 600); + await s2.render(); + + matchCellStyleSnapshot(); + }); + + test('should get correctly col cell height priority if actual text not wrap', async () => { + updateStyle(3); + + // 清空多行文本 + s2.setDataCfg({ meta: [], data: s2.dataCfg.data.slice(3) }); + s2.setOptions({ + style: { + colCell: { + heightByField: { + type: 20, + sub_type: 20, + [EXTRA_FIELD]: 20, + }, + }, + }, + }); + s2.changeSheetSize(800, 600); + await s2.render(); + + matchCellStyleSnapshot(); + }); }); describe('TableSheet', () => { diff --git a/packages/s2-core/src/facet/base-facet.ts b/packages/s2-core/src/facet/base-facet.ts index 51180845e6..679837ad6b 100644 --- a/packages/s2-core/src/facet/base-facet.ts +++ b/packages/s2-core/src/facet/base-facet.ts @@ -283,18 +283,32 @@ export abstract class BaseFacet { ); } - protected getRowCellHeight(node: Node): number { - const { rowCell, dataCell } = this.spreadsheet.options.style!; + protected isCustomRowCellHeight(node: Node) { + const { dataCell } = this.spreadsheet.options.style!; + const defaultDataCellHeight = DEFAULT_STYLE.dataCell?.height; + + return ( + isNumber(this.getCustomRowCellHeight(node)) || + dataCell?.height !== defaultDataCellHeight + ); + } + + protected getCustomRowCellHeight(node: Node) { + const { rowCell } = this.spreadsheet.options.style!; - // 优先级: 行头拖拽 > 行头自定义高度 > 通用单元格高度 return ( this.getRowCellDraggedHeight(node) ?? - this.getCellCustomSize(node, rowCell?.height) ?? - dataCell?.height ?? - 0 + this.getCellCustomSize(node, rowCell?.height) ); } + protected getRowCellHeight(node: Node): number | undefined { + const { dataCell } = this.spreadsheet.options.style!; + + // 优先级: 行头拖拽 > 行头自定义高度 > 通用单元格高度 + return this.getCustomRowCellHeight(node) ?? dataCell?.height; + } + protected getColCellDraggedWidth(node: Node): number | undefined { const { colCell } = this.spreadsheet.options.style!; @@ -364,7 +378,7 @@ export abstract class BaseFacet { return Math.max(defaultHeight, sampleMaxHeight); } - protected getCellAdaptiveHeight(cell: S2CellType, defaultHeight: number) { + protected getCellAdaptiveHeight(cell: S2CellType, defaultHeight: number = 0) { if (!cell) { return defaultHeight; } diff --git a/packages/s2-core/src/facet/frozen-facet.ts b/packages/s2-core/src/facet/frozen-facet.ts index a2b137790d..d87531cc70 100644 --- a/packages/s2-core/src/facet/frozen-facet.ts +++ b/packages/s2-core/src/facet/frozen-facet.ts @@ -681,7 +681,7 @@ export abstract class FrozenFacet extends BaseFacet { }; protected getDefaultCellHeight(): number { - return this.getRowCellHeight(null as unknown as Node); + return this.getRowCellHeight(null as unknown as Node) ?? 0; } protected getShadowFill = (angle: number) => { diff --git a/packages/s2-core/src/facet/pivot-facet.ts b/packages/s2-core/src/facet/pivot-facet.ts index 49e552cf0a..8696499a16 100644 --- a/packages/s2-core/src/facet/pivot-facet.ts +++ b/packages/s2-core/src/facet/pivot-facet.ts @@ -402,10 +402,15 @@ export class PivotFacet extends FrozenFacet { return 0; } + const defaultHeight = this.getRowCellHeight(rowNode); + + if (this.isCustomRowCellHeight(rowNode)) { + return defaultHeight || 0; + } + const rowCell = new RowCell(rowNode, this.spreadsheet, { shallowRender: true, }); - const defaultHeight = this.getRowCellHeight(rowNode); return this.getCellAdaptiveHeight(rowCell, defaultHeight); } @@ -499,9 +504,13 @@ export class PivotFacet extends FrozenFacet { const currentBranchNodeHeights = Node.getBranchNodes(currentNode).map( (rowNode) => this.getRowNodeHeight(rowNode), ); - // 父节点的高度是叶子节点的高度之和, 由于存在多行文本, 叶子节点的高度以当前路径下节点高度最大的为准 - const nodeHeight = - max(currentBranchNodeHeights) || this.getRowNodeHeight(currentNode); + + const defaultHeight = this.getRowNodeHeight(currentNode); + // 父节点的高度是叶子节点的高度之和, 由于存在多行文本, 叶子节点的高度以当前路径下节点高度最大的为准: https://github.com/antvis/S2/issues/2678 + // 自定义高度除外: https://github.com/antvis/S2/issues/2594 + const nodeHeight = this.isCustomRowCellHeight(currentNode) + ? defaultHeight + : max(currentBranchNodeHeights) ?? defaultHeight; currentNode.rowIndex ??= rowIndex; currentNode.colIndex ??= i; @@ -560,7 +569,7 @@ export class PivotFacet extends FrozenFacet { */ private autoCalculateRowNodeHeightAndY(rowLeafNodes: Node[]) { // 3、in grid type, all no-leaf node's height, y are auto calculated - let prevRowParent = null; + let prevRowParent: Node | null = null; let i = 0; const leafNodes = rowLeafNodes.slice(0); diff --git a/packages/s2-core/src/facet/table-facet.ts b/packages/s2-core/src/facet/table-facet.ts index d8ac1ea67b..3a20de8abe 100644 --- a/packages/s2-core/src/facet/table-facet.ts +++ b/packages/s2-core/src/facet/table-facet.ts @@ -11,7 +11,6 @@ import { } from 'lodash'; import { TableDataCell, TableSeriesNumberCell } from '../cell'; import { - DEFAULT_STYLE, KEY_GROUP_FROZEN_ROW_RESIZE_AREA, KEY_GROUP_ROW_RESIZE_AREA, LayoutWidthType, @@ -61,22 +60,11 @@ export class TableFacet extends FrozenFacet { } private getDataCellAdaptiveHeight(viewMeta: ViewMeta): number { - const { rowCell: rowCellStyle, dataCell: dataCellStyle } = - this.spreadsheet.options.style!; const node = { id: String(viewMeta?.rowIndex) } as Node; + const rowHeight = this.getRowCellHeight(node); - // 优先级: 行头拖拽 > 行头自定义高度 > 多行文本自适应高度 > 通用单元格高度 - const rowHeight = - this.getRowCellDraggedHeight(node) ?? - this.getCellCustomSize(node, rowCellStyle?.height) ?? - dataCellStyle?.height; - - if ( - isNumber(rowHeight) && - rowHeight !== DEFAULT_STYLE.rowCell?.height && - rowHeight !== DEFAULT_STYLE.dataCell?.height - ) { - return rowHeight; + if (this.isCustomRowCellHeight(node)) { + return rowHeight || 0; } const dataCell = new TableDataCell(viewMeta, this.spreadsheet, { @@ -89,7 +77,7 @@ export class TableFacet extends FrozenFacet { private getCellHeightByRowIndex(rowIndex: number) { if (this.rowOffsets) { - return this.getRowCellHeight({ id: String(rowIndex) } as Node); + return this.getRowCellHeight({ id: String(rowIndex) } as Node) ?? 0; } return this.getDefaultCellHeight(); @@ -443,7 +431,7 @@ export class TableFacet extends FrozenFacet { * @param colLeafNodes */ private autoCalculateColNodeWidthAndX(colLeafNodes: Node[]) { - let prevColParent = null; + let prevColParent: Node | null = null; const leafNodes = colLeafNodes.slice(0); while (leafNodes.length) {