@fileverse-dev/fortune-core 1.1.26 → 1.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/modules/selection.js +9 -5
- package/es/modules/toolbar.js +12 -6
- package/lib/modules/selection.js +9 -5
- package/lib/modules/toolbar.js +12 -6
- package/package.json +1 -1
package/es/modules/selection.js
CHANGED
|
@@ -1899,7 +1899,7 @@ export function fixColumnStyleOverflowInFreeze(ctx, c1, c2, freeze) {
|
|
|
1899
1899
|
return ret;
|
|
1900
1900
|
}
|
|
1901
1901
|
export function calcSelectionInfo(ctx, lang) {
|
|
1902
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1902
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1903
1903
|
var selection = ctx.luckysheet_select_save;
|
|
1904
1904
|
var numberC = 0;
|
|
1905
1905
|
var count = 0;
|
|
@@ -1914,10 +1914,14 @@ export function calcSelectionInfo(ctx, lang) {
|
|
|
1914
1914
|
var ct = (_b = (_a = data[r][c]) === null || _a === void 0 ? void 0 : _a.ct) === null || _b === void 0 ? void 0 : _b.t;
|
|
1915
1915
|
var value = (_c = data[r][c]) === null || _c === void 0 ? void 0 : _c.m;
|
|
1916
1916
|
if ((_f = (_e = (_d = data[r][c]) === null || _d === void 0 ? void 0 : _d.ct) === null || _e === void 0 ? void 0 : _e.fa) === null || _f === void 0 ? void 0 : _f.includes("#,##0")) {
|
|
1917
|
-
|
|
1917
|
+
if ((_h = (_g = data[r][c]) === null || _g === void 0 ? void 0 : _g.ct) === null || _h === void 0 ? void 0 : _h.s) {
|
|
1918
|
+
value = (_l = (_k = (_j = data[r][c]) === null || _j === void 0 ? void 0 : _j.ct) === null || _k === void 0 ? void 0 : _k.s[0]) === null || _l === void 0 ? void 0 : _l.v;
|
|
1919
|
+
} else {
|
|
1920
|
+
value = (_m = data[r][c]) === null || _m === void 0 ? void 0 : _m.v;
|
|
1921
|
+
}
|
|
1918
1922
|
}
|
|
1919
|
-
if (ct === "n" || ct === "g" && parseFloat(value).toString() !== "NaN"
|
|
1920
|
-
var removeComma = value.replace(/,/g,
|
|
1923
|
+
if (ct === "n" || ct === "g" && parseFloat(value).toString() !== "NaN") {
|
|
1924
|
+
var removeComma = (value === null || value === void 0 ? void 0 : value.replace(/,/g, "")) || "0";
|
|
1921
1925
|
var valueNumber = parseFloat(removeComma);
|
|
1922
1926
|
count += 1;
|
|
1923
1927
|
sum += valueNumber;
|
|
@@ -1930,7 +1934,7 @@ export function calcSelectionInfo(ctx, lang) {
|
|
|
1930
1934
|
}
|
|
1931
1935
|
}
|
|
1932
1936
|
}
|
|
1933
|
-
var formatString = lang && !["zh", "zh_tw"].includes(lang) ? "0.00" : "
|
|
1937
|
+
var formatString = lang && !["zh", "zh_tw"].includes(lang) ? "0.00" : "w0.00";
|
|
1934
1938
|
var average = SSF.format(formatString, sum / numberC);
|
|
1935
1939
|
sum = SSF.format(formatString, sum);
|
|
1936
1940
|
max = SSF.format(formatString, max);
|
package/es/modules/toolbar.js
CHANGED
|
@@ -15,8 +15,8 @@ import { showLinkCard } from "./hyperlink";
|
|
|
15
15
|
import { cfSplitRange } from "./conditionalFormat";
|
|
16
16
|
import { getCellTextInfo } from "./text";
|
|
17
17
|
export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
18
|
-
var _a, _b;
|
|
19
|
-
var
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
var _e;
|
|
20
20
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -29,7 +29,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
29
29
|
var cell = d[r][c];
|
|
30
30
|
var value = void 0;
|
|
31
31
|
if (_.isPlainObject(cell)) {
|
|
32
|
-
value = cell === null || cell === void 0 ? void 0 : cell.v;
|
|
32
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null || _b === void 0 ? void 0 : _b.v);
|
|
33
33
|
} else {
|
|
34
34
|
value = cell;
|
|
35
35
|
}
|
|
@@ -52,6 +52,12 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
52
52
|
}
|
|
53
53
|
cell.ct.fa = foucsStatus;
|
|
54
54
|
cell.ct.t = type;
|
|
55
|
+
cell.fc = cell.fc || cell.ct.s[0].fc;
|
|
56
|
+
cell.bl = cell.bl || cell.ct.s[0].bl;
|
|
57
|
+
cell.it = cell.it || cell.ct.s[0].it;
|
|
58
|
+
cell.un = cell.un || cell.ct.s[0].un;
|
|
59
|
+
cell.fs = cell.fs || cell.ct.s[0].fs;
|
|
60
|
+
cell.cl = cell.cl || cell.ct.s[0].cl;
|
|
55
61
|
} else {
|
|
56
62
|
d[r][c] = {
|
|
57
63
|
ct: {
|
|
@@ -117,9 +123,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
117
123
|
if (value && _.isPlainObject(value)) {
|
|
118
124
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
119
125
|
value[attr] = foucsStatus;
|
|
120
|
-
(
|
|
126
|
+
(_e = ctx.luckysheetfile[sheetIndex]).config || (_e.config = {});
|
|
121
127
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
122
|
-
var cellWidth = ((
|
|
128
|
+
var cellWidth = ((_c = cfg.columnlen) === null || _c === void 0 ? void 0 : _c[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
123
129
|
if (attr === "fs" && canvas) {
|
|
124
130
|
var textInfo = getCellTextInfo(d[r][c], canvas, ctx, {
|
|
125
131
|
r: r,
|
|
@@ -128,7 +134,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
128
134
|
});
|
|
129
135
|
if (!textInfo) continue;
|
|
130
136
|
var rowHeight = _.round(textInfo.textHeightAll);
|
|
131
|
-
var currentRowHeight = ((
|
|
137
|
+
var currentRowHeight = ((_d = cfg.rowlen) === null || _d === void 0 ? void 0 : _d[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
132
138
|
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
133
139
|
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
134
140
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
package/lib/modules/selection.js
CHANGED
|
@@ -1934,7 +1934,7 @@ function fixColumnStyleOverflowInFreeze(ctx, c1, c2, freeze) {
|
|
|
1934
1934
|
return ret;
|
|
1935
1935
|
}
|
|
1936
1936
|
function calcSelectionInfo(ctx, lang) {
|
|
1937
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1937
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1938
1938
|
var selection = ctx.luckysheet_select_save;
|
|
1939
1939
|
var numberC = 0;
|
|
1940
1940
|
var count = 0;
|
|
@@ -1949,10 +1949,14 @@ function calcSelectionInfo(ctx, lang) {
|
|
|
1949
1949
|
var ct = (_b = (_a = data[r][c]) === null || _a === void 0 ? void 0 : _a.ct) === null || _b === void 0 ? void 0 : _b.t;
|
|
1950
1950
|
var value = (_c = data[r][c]) === null || _c === void 0 ? void 0 : _c.m;
|
|
1951
1951
|
if ((_f = (_e = (_d = data[r][c]) === null || _d === void 0 ? void 0 : _d.ct) === null || _e === void 0 ? void 0 : _e.fa) === null || _f === void 0 ? void 0 : _f.includes("#,##0")) {
|
|
1952
|
-
|
|
1952
|
+
if ((_h = (_g = data[r][c]) === null || _g === void 0 ? void 0 : _g.ct) === null || _h === void 0 ? void 0 : _h.s) {
|
|
1953
|
+
value = (_l = (_k = (_j = data[r][c]) === null || _j === void 0 ? void 0 : _j.ct) === null || _k === void 0 ? void 0 : _k.s[0]) === null || _l === void 0 ? void 0 : _l.v;
|
|
1954
|
+
} else {
|
|
1955
|
+
value = (_m = data[r][c]) === null || _m === void 0 ? void 0 : _m.v;
|
|
1956
|
+
}
|
|
1953
1957
|
}
|
|
1954
|
-
if (ct === "n" || ct === "g" && parseFloat(value).toString() !== "NaN"
|
|
1955
|
-
var removeComma = value.replace(/,/g,
|
|
1958
|
+
if (ct === "n" || ct === "g" && parseFloat(value).toString() !== "NaN") {
|
|
1959
|
+
var removeComma = (value === null || value === void 0 ? void 0 : value.replace(/,/g, "")) || "0";
|
|
1956
1960
|
var valueNumber = parseFloat(removeComma);
|
|
1957
1961
|
count += 1;
|
|
1958
1962
|
sum += valueNumber;
|
|
@@ -1965,7 +1969,7 @@ function calcSelectionInfo(ctx, lang) {
|
|
|
1965
1969
|
}
|
|
1966
1970
|
}
|
|
1967
1971
|
}
|
|
1968
|
-
var formatString = lang && !["zh", "zh_tw"].includes(lang) ? "0.00" : "
|
|
1972
|
+
var formatString = lang && !["zh", "zh_tw"].includes(lang) ? "0.00" : "w0.00";
|
|
1969
1973
|
var average = _ssf.default.format(formatString, sum / numberC);
|
|
1970
1974
|
sum = _ssf.default.format(formatString, sum);
|
|
1971
1975
|
max = _ssf.default.format(formatString, max);
|
package/lib/modules/toolbar.js
CHANGED
|
@@ -48,8 +48,8 @@ var _conditionalFormat = require("./conditionalFormat");
|
|
|
48
48
|
var _text = require("./text");
|
|
49
49
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
50
|
function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
var
|
|
51
|
+
var _a, _b, _c, _d;
|
|
52
|
+
var _e;
|
|
53
53
|
if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -62,7 +62,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
62
62
|
var cell = d[r][c];
|
|
63
63
|
var value = void 0;
|
|
64
64
|
if (_lodash.default.isPlainObject(cell)) {
|
|
65
|
-
value = cell === null || cell === void 0 ? void 0 : cell.v;
|
|
65
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null || _b === void 0 ? void 0 : _b.v);
|
|
66
66
|
} else {
|
|
67
67
|
value = cell;
|
|
68
68
|
}
|
|
@@ -85,6 +85,12 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
85
85
|
}
|
|
86
86
|
cell.ct.fa = foucsStatus;
|
|
87
87
|
cell.ct.t = type;
|
|
88
|
+
cell.fc = cell.fc || cell.ct.s[0].fc;
|
|
89
|
+
cell.bl = cell.bl || cell.ct.s[0].bl;
|
|
90
|
+
cell.it = cell.it || cell.ct.s[0].it;
|
|
91
|
+
cell.un = cell.un || cell.ct.s[0].un;
|
|
92
|
+
cell.fs = cell.fs || cell.ct.s[0].fs;
|
|
93
|
+
cell.cl = cell.cl || cell.ct.s[0].cl;
|
|
88
94
|
} else {
|
|
89
95
|
d[r][c] = {
|
|
90
96
|
ct: {
|
|
@@ -150,9 +156,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
150
156
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
151
157
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
152
158
|
value[attr] = foucsStatus;
|
|
153
|
-
(
|
|
159
|
+
(_e = ctx.luckysheetfile[sheetIndex]).config || (_e.config = {});
|
|
154
160
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
155
|
-
var cellWidth = ((
|
|
161
|
+
var cellWidth = ((_c = cfg.columnlen) === null || _c === void 0 ? void 0 : _c[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
156
162
|
if (attr === "fs" && canvas) {
|
|
157
163
|
var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
|
|
158
164
|
r: r,
|
|
@@ -161,7 +167,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
161
167
|
});
|
|
162
168
|
if (!textInfo) continue;
|
|
163
169
|
var rowHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
164
|
-
var currentRowHeight = ((
|
|
170
|
+
var currentRowHeight = ((_d = cfg.rowlen) === null || _d === void 0 ? void 0 : _d[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
165
171
|
if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
166
172
|
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
167
173
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|