@fileverse-dev/fortune-core 1.3.4-date-format-1 → 1.3.4-viewMode-1
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/canvas.js +1 -1
- package/es/modules/cell.js +6 -8
- package/es/modules/ssf.js +1 -1
- package/es/modules/toolbar.js +9 -30
- package/lib/canvas.js +1 -1
- package/lib/modules/cell.js +6 -8
- package/lib/modules/ssf.js +1 -1
- package/lib/modules/toolbar.js +9 -30
- package/package.json +1 -1
package/es/canvas.js
CHANGED
|
@@ -1012,7 +1012,7 @@ var Canvas = function () {
|
|
|
1012
1012
|
renderCtx.clip();
|
|
1013
1013
|
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
1014
1014
|
var measureText = getMeasureText(value, renderCtx, this.sheetCtx);
|
|
1015
|
-
var textMetrics = measureText.width +
|
|
1015
|
+
var textMetrics = measureText.width + 14;
|
|
1016
1016
|
var oneLineTextHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
|
|
1017
1017
|
var horizonAlignPos = pos_x + space_width;
|
|
1018
1018
|
if (horizonAlign === 0) {
|
package/es/modules/cell.js
CHANGED
|
@@ -110,7 +110,7 @@ export function getCellValue(r, c, data, attr) {
|
|
|
110
110
|
return retv;
|
|
111
111
|
}
|
|
112
112
|
export function setCellValue(ctx, r, c, d, v) {
|
|
113
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
113
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
114
114
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
115
115
|
if (_.isNil(d)) {
|
|
116
116
|
d = getFlowdata(ctx);
|
|
@@ -276,7 +276,10 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
276
276
|
} else if (!_.isNil(cell.ct) && !_.isNil(cell.ct.fa) && cell.ct.fa !== "General") {
|
|
277
277
|
var fa = cell.ct.fa;
|
|
278
278
|
if (isRealNum(vupdate)) {
|
|
279
|
-
if (commaPresent && !fa.includes(",")) {
|
|
279
|
+
if (commaPresent && !fa.includes(",") || String(vupdate).includes(".") && ((_j = (_h = String(vupdate).split(".")) === null || _h === void 0 ? void 0 : _h[1]) === null || _j === void 0 ? void 0 : _j.length) !== ((_l = (_k = fa.split(".")) === null || _k === void 0 ? void 0 : _k[1]) === null || _l === void 0 ? void 0 : _l.length) || fa.includes(",") !== String(vupdate).includes(",")) {
|
|
280
|
+
if (fa.includes(",") !== String(vupdate).includes(",")) {
|
|
281
|
+
commaPresent = true;
|
|
282
|
+
}
|
|
280
283
|
fa = getNumberFormat(String(vupdate), commaPresent);
|
|
281
284
|
}
|
|
282
285
|
vupdate = parseFloat(vupdate);
|
|
@@ -286,9 +289,6 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
286
289
|
t: "n"
|
|
287
290
|
});
|
|
288
291
|
}
|
|
289
|
-
if (_.isNil(cell.ht)) {
|
|
290
|
-
cell.ht = 2;
|
|
291
|
-
}
|
|
292
292
|
}
|
|
293
293
|
var mask = update(fa, vupdate);
|
|
294
294
|
if (mask === vupdate) {
|
|
@@ -317,9 +317,7 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
317
317
|
var strValue = String(vupdate);
|
|
318
318
|
var format = getNumberFormat(strValue, commaPresent);
|
|
319
319
|
cell.m = v.m ? v.m : update(format, cell.v);
|
|
320
|
-
|
|
321
|
-
cell.ht = 2;
|
|
322
|
-
}
|
|
320
|
+
cell.ht = (v === null || v === void 0 ? void 0 : v.ht) ? cell.ht : 2;
|
|
323
321
|
cell.ct = {
|
|
324
322
|
fa: format,
|
|
325
323
|
t: "n"
|
package/es/modules/ssf.js
CHANGED
|
@@ -1364,7 +1364,7 @@ var make_ssf = function make_ssf(SSF) {
|
|
|
1364
1364
|
if (typeof n !== "number" || !Number.isFinite(n)) return null;
|
|
1365
1365
|
if (!Number.isInteger(n)) return null;
|
|
1366
1366
|
if (n < 0) return null;
|
|
1367
|
-
var minSec =
|
|
1367
|
+
var minSec = 0; // 1970-01-01
|
|
1368
1368
|
var maxSec = 4102444800; // ~2100-01-01
|
|
1369
1369
|
var minMs = minSec * 1000;
|
|
1370
1370
|
var maxMs = maxSec * 1000;
|
package/es/modules/toolbar.js
CHANGED
|
@@ -33,42 +33,21 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
33
33
|
} else {
|
|
34
34
|
value = cell;
|
|
35
35
|
}
|
|
36
|
-
var type = "n";
|
|
37
|
-
if (is_date(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
|
|
38
|
-
type = "d";
|
|
39
|
-
} else if (foucsStatus === "@" || foucsStatus === 49) {
|
|
40
|
-
type = "s";
|
|
41
|
-
}
|
|
42
36
|
if (_.isNil(value)) {
|
|
43
|
-
if (!_.isNil(d[r])) {
|
|
44
|
-
if (_.isNil(d[r][c])) {
|
|
45
|
-
d[r][c] = {
|
|
46
|
-
ct: {
|
|
47
|
-
fa: foucsStatus,
|
|
48
|
-
t: type
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
} else if (_.isPlainObject(d[r][c])) {
|
|
52
|
-
if (_.isNil(d[r][c].ct)) d[r][c].ct = {};
|
|
53
|
-
d[r][c].ct.fa = foucsStatus;
|
|
54
|
-
d[r][c].ct.t = type;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
37
|
continue;
|
|
58
38
|
}
|
|
59
39
|
if (foucsStatus !== "@" && isRealNum(value)) {
|
|
60
40
|
value = Number(value);
|
|
61
|
-
} else if (type === "d" && typeof value === "string") {
|
|
62
|
-
var dateMask = genarate(value);
|
|
63
|
-
if (dateMask && dateMask[1].t === "d") {
|
|
64
|
-
var numericSerial = dateMask[2];
|
|
65
|
-
value = numericSerial;
|
|
66
|
-
}
|
|
67
41
|
}
|
|
68
|
-
|
|
42
|
+
var mask = update(foucsStatus, value);
|
|
43
|
+
var type = "n";
|
|
44
|
+
if (is_date(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
|
|
45
|
+
type = "d";
|
|
46
|
+
} else if (foucsStatus === "@" || foucsStatus === 49) {
|
|
47
|
+
type = "s";
|
|
48
|
+
} else if (foucsStatus === "General" || foucsStatus === 0) {
|
|
69
49
|
type = isRealNum(value) ? "n" : "g";
|
|
70
50
|
}
|
|
71
|
-
var mask = update(foucsStatus, value);
|
|
72
51
|
if (cell && _.isPlainObject(cell)) {
|
|
73
52
|
cell.m = "".concat(mask);
|
|
74
53
|
if (_.isNil(cell.ct)) {
|
|
@@ -76,7 +55,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
76
55
|
}
|
|
77
56
|
cell.ct.fa = foucsStatus;
|
|
78
57
|
cell.ct.t = type;
|
|
79
|
-
cell.v =
|
|
58
|
+
cell.v = String(value);
|
|
80
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);
|
|
81
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);
|
|
82
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);
|
|
@@ -89,7 +68,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
89
68
|
fa: foucsStatus,
|
|
90
69
|
t: type
|
|
91
70
|
},
|
|
92
|
-
v:
|
|
71
|
+
v: value,
|
|
93
72
|
m: mask
|
|
94
73
|
};
|
|
95
74
|
}
|
package/lib/canvas.js
CHANGED
|
@@ -1019,7 +1019,7 @@ var Canvas = exports.Canvas = function () {
|
|
|
1019
1019
|
renderCtx.clip();
|
|
1020
1020
|
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
1021
1021
|
var measureText = (0, _text.getMeasureText)(value, renderCtx, this.sheetCtx);
|
|
1022
|
-
var textMetrics = measureText.width +
|
|
1022
|
+
var textMetrics = measureText.width + 14;
|
|
1023
1023
|
var oneLineTextHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
|
|
1024
1024
|
var horizonAlignPos = pos_x + space_width;
|
|
1025
1025
|
if (horizonAlign === 0) {
|
package/lib/modules/cell.js
CHANGED
|
@@ -143,7 +143,7 @@ function getCellValue(r, c, data, attr) {
|
|
|
143
143
|
return retv;
|
|
144
144
|
}
|
|
145
145
|
function setCellValue(ctx, r, c, d, v) {
|
|
146
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
146
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
147
147
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
148
148
|
if (_lodash.default.isNil(d)) {
|
|
149
149
|
d = (0, _context.getFlowdata)(ctx);
|
|
@@ -309,7 +309,10 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
309
309
|
} else if (!_lodash.default.isNil(cell.ct) && !_lodash.default.isNil(cell.ct.fa) && cell.ct.fa !== "General") {
|
|
310
310
|
var fa = cell.ct.fa;
|
|
311
311
|
if ((0, _validation.isRealNum)(vupdate)) {
|
|
312
|
-
if (commaPresent && !fa.includes(",")) {
|
|
312
|
+
if (commaPresent && !fa.includes(",") || String(vupdate).includes(".") && ((_j = (_h = String(vupdate).split(".")) === null || _h === void 0 ? void 0 : _h[1]) === null || _j === void 0 ? void 0 : _j.length) !== ((_l = (_k = fa.split(".")) === null || _k === void 0 ? void 0 : _k[1]) === null || _l === void 0 ? void 0 : _l.length) || fa.includes(",") !== String(vupdate).includes(",")) {
|
|
313
|
+
if (fa.includes(",") !== String(vupdate).includes(",")) {
|
|
314
|
+
commaPresent = true;
|
|
315
|
+
}
|
|
313
316
|
fa = (0, _utils.getNumberFormat)(String(vupdate), commaPresent);
|
|
314
317
|
}
|
|
315
318
|
vupdate = parseFloat(vupdate);
|
|
@@ -319,9 +322,6 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
319
322
|
t: "n"
|
|
320
323
|
});
|
|
321
324
|
}
|
|
322
|
-
if (_lodash.default.isNil(cell.ht)) {
|
|
323
|
-
cell.ht = 2;
|
|
324
|
-
}
|
|
325
325
|
}
|
|
326
326
|
var mask = (0, _format.update)(fa, vupdate);
|
|
327
327
|
if (mask === vupdate) {
|
|
@@ -350,9 +350,7 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
350
350
|
var strValue = String(vupdate);
|
|
351
351
|
var format = (0, _utils.getNumberFormat)(strValue, commaPresent);
|
|
352
352
|
cell.m = v.m ? v.m : (0, _format.update)(format, cell.v);
|
|
353
|
-
|
|
354
|
-
cell.ht = 2;
|
|
355
|
-
}
|
|
353
|
+
cell.ht = (v === null || v === void 0 ? void 0 : v.ht) ? cell.ht : 2;
|
|
356
354
|
cell.ct = {
|
|
357
355
|
fa: format,
|
|
358
356
|
t: "n"
|
package/lib/modules/ssf.js
CHANGED
|
@@ -1370,7 +1370,7 @@ var make_ssf = function make_ssf(SSF) {
|
|
|
1370
1370
|
if (typeof n !== "number" || !Number.isFinite(n)) return null;
|
|
1371
1371
|
if (!Number.isInteger(n)) return null;
|
|
1372
1372
|
if (n < 0) return null;
|
|
1373
|
-
var minSec =
|
|
1373
|
+
var minSec = 0; // 1970-01-01
|
|
1374
1374
|
var maxSec = 4102444800; // ~2100-01-01
|
|
1375
1375
|
var minMs = minSec * 1000;
|
|
1376
1376
|
var maxMs = maxSec * 1000;
|
package/lib/modules/toolbar.js
CHANGED
|
@@ -66,42 +66,21 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
66
66
|
} else {
|
|
67
67
|
value = cell;
|
|
68
68
|
}
|
|
69
|
-
var type = "n";
|
|
70
|
-
if ((0, _format.is_date)(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
|
|
71
|
-
type = "d";
|
|
72
|
-
} else if (foucsStatus === "@" || foucsStatus === 49) {
|
|
73
|
-
type = "s";
|
|
74
|
-
}
|
|
75
69
|
if (_lodash.default.isNil(value)) {
|
|
76
|
-
if (!_lodash.default.isNil(d[r])) {
|
|
77
|
-
if (_lodash.default.isNil(d[r][c])) {
|
|
78
|
-
d[r][c] = {
|
|
79
|
-
ct: {
|
|
80
|
-
fa: foucsStatus,
|
|
81
|
-
t: type
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
} else if (_lodash.default.isPlainObject(d[r][c])) {
|
|
85
|
-
if (_lodash.default.isNil(d[r][c].ct)) d[r][c].ct = {};
|
|
86
|
-
d[r][c].ct.fa = foucsStatus;
|
|
87
|
-
d[r][c].ct.t = type;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
70
|
continue;
|
|
91
71
|
}
|
|
92
72
|
if (foucsStatus !== "@" && (0, _validation.isRealNum)(value)) {
|
|
93
73
|
value = Number(value);
|
|
94
|
-
} else if (type === "d" && typeof value === "string") {
|
|
95
|
-
var dateMask = (0, _format.genarate)(value);
|
|
96
|
-
if (dateMask && dateMask[1].t === "d") {
|
|
97
|
-
var numericSerial = dateMask[2];
|
|
98
|
-
value = numericSerial;
|
|
99
|
-
}
|
|
100
74
|
}
|
|
101
|
-
|
|
75
|
+
var mask = (0, _format.update)(foucsStatus, value);
|
|
76
|
+
var type = "n";
|
|
77
|
+
if ((0, _format.is_date)(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
|
|
78
|
+
type = "d";
|
|
79
|
+
} else if (foucsStatus === "@" || foucsStatus === 49) {
|
|
80
|
+
type = "s";
|
|
81
|
+
} else if (foucsStatus === "General" || foucsStatus === 0) {
|
|
102
82
|
type = (0, _validation.isRealNum)(value) ? "n" : "g";
|
|
103
83
|
}
|
|
104
|
-
var mask = (0, _format.update)(foucsStatus, value);
|
|
105
84
|
if (cell && _lodash.default.isPlainObject(cell)) {
|
|
106
85
|
cell.m = "".concat(mask);
|
|
107
86
|
if (_lodash.default.isNil(cell.ct)) {
|
|
@@ -109,7 +88,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
109
88
|
}
|
|
110
89
|
cell.ct.fa = foucsStatus;
|
|
111
90
|
cell.ct.t = type;
|
|
112
|
-
cell.v =
|
|
91
|
+
cell.v = String(value);
|
|
113
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);
|
|
114
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);
|
|
115
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);
|
|
@@ -122,7 +101,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
122
101
|
fa: foucsStatus,
|
|
123
102
|
t: type
|
|
124
103
|
},
|
|
125
|
-
v:
|
|
104
|
+
v: value,
|
|
126
105
|
m: mask
|
|
127
106
|
};
|
|
128
107
|
}
|