@fileverse-dev/fortune-core 1.1.63 → 1.1.65
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/toolbar.js +15 -12
- package/es/modules/validation.js +1 -1
- package/lib/modules/toolbar.js +15 -12
- package/lib/modules/validation.js +1 -1
- package/package.json +1 -1
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, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
19
|
-
var
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
19
|
+
var _z;
|
|
20
20
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -29,10 +29,13 @@ 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) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null ||
|
|
32
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_c = (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.v);
|
|
33
33
|
} else {
|
|
34
34
|
value = cell;
|
|
35
35
|
}
|
|
36
|
+
if (_.isNil(value)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
36
39
|
if (foucsStatus !== "@" && isRealNum(value)) {
|
|
37
40
|
value = Number(value);
|
|
38
41
|
}
|
|
@@ -53,12 +56,12 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
53
56
|
cell.ct.fa = foucsStatus;
|
|
54
57
|
cell.ct.t = type;
|
|
55
58
|
cell.v = String(value);
|
|
56
|
-
cell.fc = cell.fc || ((
|
|
57
|
-
cell.bl = cell.bl || ((
|
|
58
|
-
cell.it = cell.it || ((
|
|
59
|
-
cell.un = cell.un || ((
|
|
60
|
-
cell.fs = cell.fs || ((
|
|
61
|
-
cell.cl = cell.cl || ((
|
|
59
|
+
cell.fc = cell.fc || ((_f = (_e = (_d = cell.ct) === null || _d === void 0 ? void 0 : _d.s) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.fc);
|
|
60
|
+
cell.bl = cell.bl || ((_j = (_h = (_g = cell.ct) === null || _g === void 0 ? void 0 : _g.s) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.bl);
|
|
61
|
+
cell.it = cell.it || ((_m = (_l = (_k = cell.ct) === null || _k === void 0 ? void 0 : _k.s) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.it);
|
|
62
|
+
cell.un = cell.un || ((_q = (_p = (_o = cell.ct) === null || _o === void 0 ? void 0 : _o.s) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.un);
|
|
63
|
+
cell.fs = cell.fs || ((_t = (_s = (_r = cell.ct) === null || _r === void 0 ? void 0 : _r.s) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.fs);
|
|
64
|
+
cell.cl = cell.cl || ((_w = (_v = (_u = cell.ct) === null || _u === void 0 ? void 0 : _u.s) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.cl);
|
|
62
65
|
} else {
|
|
63
66
|
d[r][c] = {
|
|
64
67
|
ct: {
|
|
@@ -124,9 +127,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
124
127
|
if (value && _.isPlainObject(value)) {
|
|
125
128
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
126
129
|
value[attr] = foucsStatus;
|
|
127
|
-
(
|
|
130
|
+
(_z = ctx.luckysheetfile[sheetIndex]).config || (_z.config = {});
|
|
128
131
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
129
|
-
var cellWidth = ((
|
|
132
|
+
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
130
133
|
if (attr === "fs" && canvas) {
|
|
131
134
|
var textInfo = getCellTextInfo(d[r][c], canvas, ctx, {
|
|
132
135
|
r: r,
|
|
@@ -135,7 +138,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
135
138
|
});
|
|
136
139
|
if (!textInfo) continue;
|
|
137
140
|
var rowHeight = _.round(textInfo.textHeightAll);
|
|
138
|
-
var currentRowHeight = ((
|
|
141
|
+
var currentRowHeight = ((_y = cfg.rowlen) === null || _y === void 0 ? void 0 : _y[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
139
142
|
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
140
143
|
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
141
144
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
package/es/modules/validation.js
CHANGED
|
@@ -22,7 +22,7 @@ export function isHexValue(str) {
|
|
|
22
22
|
return /^0x?[a-fA-F0-9]+$/.test(str);
|
|
23
23
|
}
|
|
24
24
|
export function isRealNum(val) {
|
|
25
|
-
if (isHexValue(val.toString())) {
|
|
25
|
+
if (isHexValue(val === null || val === void 0 ? void 0 : val.toString())) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (_.isNil(val) || val.toString().replace(/\s/g, "") === "") {
|
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, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
52
|
-
var
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
52
|
+
var _z;
|
|
53
53
|
if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -62,10 +62,13 @@ 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) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null ||
|
|
65
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_c = (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.v);
|
|
66
66
|
} else {
|
|
67
67
|
value = cell;
|
|
68
68
|
}
|
|
69
|
+
if (_lodash.default.isNil(value)) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
69
72
|
if (foucsStatus !== "@" && (0, _validation.isRealNum)(value)) {
|
|
70
73
|
value = Number(value);
|
|
71
74
|
}
|
|
@@ -86,12 +89,12 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
86
89
|
cell.ct.fa = foucsStatus;
|
|
87
90
|
cell.ct.t = type;
|
|
88
91
|
cell.v = String(value);
|
|
89
|
-
cell.fc = cell.fc || ((
|
|
90
|
-
cell.bl = cell.bl || ((
|
|
91
|
-
cell.it = cell.it || ((
|
|
92
|
-
cell.un = cell.un || ((
|
|
93
|
-
cell.fs = cell.fs || ((
|
|
94
|
-
cell.cl = cell.cl || ((
|
|
92
|
+
cell.fc = cell.fc || ((_f = (_e = (_d = cell.ct) === null || _d === void 0 ? void 0 : _d.s) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.fc);
|
|
93
|
+
cell.bl = cell.bl || ((_j = (_h = (_g = cell.ct) === null || _g === void 0 ? void 0 : _g.s) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.bl);
|
|
94
|
+
cell.it = cell.it || ((_m = (_l = (_k = cell.ct) === null || _k === void 0 ? void 0 : _k.s) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.it);
|
|
95
|
+
cell.un = cell.un || ((_q = (_p = (_o = cell.ct) === null || _o === void 0 ? void 0 : _o.s) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.un);
|
|
96
|
+
cell.fs = cell.fs || ((_t = (_s = (_r = cell.ct) === null || _r === void 0 ? void 0 : _r.s) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.fs);
|
|
97
|
+
cell.cl = cell.cl || ((_w = (_v = (_u = cell.ct) === null || _u === void 0 ? void 0 : _u.s) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.cl);
|
|
95
98
|
} else {
|
|
96
99
|
d[r][c] = {
|
|
97
100
|
ct: {
|
|
@@ -157,9 +160,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
157
160
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
158
161
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
159
162
|
value[attr] = foucsStatus;
|
|
160
|
-
(
|
|
163
|
+
(_z = ctx.luckysheetfile[sheetIndex]).config || (_z.config = {});
|
|
161
164
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
162
|
-
var cellWidth = ((
|
|
165
|
+
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
163
166
|
if (attr === "fs" && canvas) {
|
|
164
167
|
var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
|
|
165
168
|
r: r,
|
|
@@ -168,7 +171,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
168
171
|
});
|
|
169
172
|
if (!textInfo) continue;
|
|
170
173
|
var rowHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
171
|
-
var currentRowHeight = ((
|
|
174
|
+
var currentRowHeight = ((_y = cfg.rowlen) === null || _y === void 0 ? void 0 : _y[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
172
175
|
if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
173
176
|
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
174
177
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -38,7 +38,7 @@ function isHexValue(str) {
|
|
|
38
38
|
return /^0x?[a-fA-F0-9]+$/.test(str);
|
|
39
39
|
}
|
|
40
40
|
function isRealNum(val) {
|
|
41
|
-
if (isHexValue(val.toString())) {
|
|
41
|
+
if (isHexValue(val === null || val === void 0 ? void 0 : val.toString())) {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
if (_lodash.default.isNil(val) || val.toString().replace(/\s/g, "") === "") {
|