@fileverse-dev/fortune-core 1.1.73-patch-1 → 1.1.74
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/events/paste.js +3 -3
- package/es/modules/formula.js +2 -2
- package/es/utils/index.js +4 -6
- package/lib/events/paste.js +3 -3
- package/lib/modules/formula.js +2 -2
- package/lib/utils/index.js +4 -6
- package/package.json +2 -2
package/es/events/paste.js
CHANGED
|
@@ -683,7 +683,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
|
|
|
683
683
|
function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
684
684
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
685
685
|
var allowEdit = isAllowEdit(ctx);
|
|
686
|
-
if (!allowEdit) return;
|
|
686
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
687
687
|
if (!copyRange) return;
|
|
688
688
|
var cfg = ctx.config;
|
|
689
689
|
if (_.isNil(cfg.merge)) {
|
|
@@ -1026,7 +1026,7 @@ function resizePastedCellsToContent(ctx) {
|
|
|
1026
1026
|
export function handlePaste(ctx, e) {
|
|
1027
1027
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
1028
1028
|
var allowEdit = isAllowEdit(ctx);
|
|
1029
|
-
if (!allowEdit) return;
|
|
1029
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
1030
1030
|
if (selectionCache.isPasteAction) {
|
|
1031
1031
|
ctx.luckysheetCellUpdate = [];
|
|
1032
1032
|
selectionCache.isPasteAction = false;
|
|
@@ -1171,7 +1171,7 @@ export function handlePaste(ctx, e) {
|
|
|
1171
1171
|
export function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
1172
1172
|
var _a, _b, _c;
|
|
1173
1173
|
var allowEdit = isAllowEdit(ctx);
|
|
1174
|
-
if (!allowEdit) return;
|
|
1174
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
1175
1175
|
if (clipboardData) {
|
|
1176
1176
|
var htmlWithPreservedNewlines = "<pre style=\"white-space: pre-wrap;\">".concat(clipboardData, "</pre>");
|
|
1177
1177
|
clipboard.writeHtml(htmlWithPreservedNewlines);
|
package/es/modules/formula.js
CHANGED
|
@@ -130,11 +130,11 @@ var FormulaCache = function () {
|
|
|
130
130
|
var splitedNumberString = cell.m.split(" ")[0];
|
|
131
131
|
return Number(splitedNumberString);
|
|
132
132
|
}
|
|
133
|
-
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n") {
|
|
133
|
+
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n" && !String(cell === null || cell === void 0 ? void 0 : cell.m).includes('%')) {
|
|
134
134
|
var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
|
|
135
135
|
return Number.isNaN(n) ? cell.v : n;
|
|
136
136
|
}
|
|
137
|
-
return cell === null || cell === void 0 ? void 0 : cell.v;
|
|
137
|
+
return String(cell === null || cell === void 0 ? void 0 : cell.m).includes('%') ? cell === null || cell === void 0 ? void 0 : cell.m : cell === null || cell === void 0 ? void 0 : cell.v;
|
|
138
138
|
};
|
|
139
139
|
return FormulaCache;
|
|
140
140
|
}();
|
package/es/utils/index.js
CHANGED
|
@@ -290,15 +290,13 @@ export function processArray(cellReferences, d, flowData) {
|
|
|
290
290
|
});
|
|
291
291
|
var formated;
|
|
292
292
|
coordinates.forEach(function (coord) {
|
|
293
|
-
var _a, _b, _c, _d
|
|
293
|
+
var _a, _b, _c, _d;
|
|
294
294
|
var row = coord[0],
|
|
295
295
|
col = coord[1];
|
|
296
296
|
if (row >= 0 && row < d.length && col >= 0 && col < d[row].length) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (((_j = (_h = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _h === void 0 ? void 0 : _h.ct) === null || _j === void 0 ? void 0 : _j.fa) && ((_m = (_l = (_k = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _k === void 0 ? void 0 : _k.ct) === null || _l === void 0 ? void 0 : _l.fa) === null || _m === void 0 ? void 0 : _m.includes("#,##0."))) {
|
|
301
|
-
formated = (_p = (_o = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _o === void 0 ? void 0 : _o.ct) === null || _p === void 0 ? void 0 : _p.fa;
|
|
297
|
+
var fa = (_b = (_a = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _a === void 0 ? void 0 : _a.ct) === null || _b === void 0 ? void 0 : _b.fa;
|
|
298
|
+
if (fa && ((fa === null || fa === void 0 ? void 0 : fa.includes("#,##0")) || (fa === null || fa === void 0 ? void 0 : fa.includes("#,##0.")) || (fa === null || fa === void 0 ? void 0 : fa.includes("%")))) {
|
|
299
|
+
formated = (_d = (_c = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _c === void 0 ? void 0 : _c.ct) === null || _d === void 0 ? void 0 : _d.fa;
|
|
302
300
|
}
|
|
303
301
|
}
|
|
304
302
|
});
|
package/lib/events/paste.js
CHANGED
|
@@ -692,7 +692,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
|
|
|
692
692
|
function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
693
693
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
694
694
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
695
|
-
if (!allowEdit) return;
|
|
695
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
696
696
|
if (!copyRange) return;
|
|
697
697
|
var cfg = ctx.config;
|
|
698
698
|
if (_lodash.default.isNil(cfg.merge)) {
|
|
@@ -1035,7 +1035,7 @@ function resizePastedCellsToContent(ctx) {
|
|
|
1035
1035
|
function handlePaste(ctx, e) {
|
|
1036
1036
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
1037
1037
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1038
|
-
if (!allowEdit) return;
|
|
1038
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
1039
1039
|
if (_selection.selectionCache.isPasteAction) {
|
|
1040
1040
|
ctx.luckysheetCellUpdate = [];
|
|
1041
1041
|
_selection.selectionCache.isPasteAction = false;
|
|
@@ -1180,7 +1180,7 @@ function handlePaste(ctx, e) {
|
|
|
1180
1180
|
function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
1181
1181
|
var _a, _b, _c;
|
|
1182
1182
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1183
|
-
if (!allowEdit) return;
|
|
1183
|
+
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
1184
1184
|
if (clipboardData) {
|
|
1185
1185
|
var htmlWithPreservedNewlines = "<pre style=\"white-space: pre-wrap;\">".concat(clipboardData, "</pre>");
|
|
1186
1186
|
_clipboard.default.writeHtml(htmlWithPreservedNewlines);
|
package/lib/modules/formula.js
CHANGED
|
@@ -161,11 +161,11 @@ var FormulaCache = exports.FormulaCache = function () {
|
|
|
161
161
|
var splitedNumberString = cell.m.split(" ")[0];
|
|
162
162
|
return Number(splitedNumberString);
|
|
163
163
|
}
|
|
164
|
-
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n") {
|
|
164
|
+
if (((_d = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _d === void 0 ? void 0 : _d.t) === "n" && !String(cell === null || cell === void 0 ? void 0 : cell.m).includes('%')) {
|
|
165
165
|
var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
|
|
166
166
|
return Number.isNaN(n) ? cell.v : n;
|
|
167
167
|
}
|
|
168
|
-
return cell === null || cell === void 0 ? void 0 : cell.v;
|
|
168
|
+
return String(cell === null || cell === void 0 ? void 0 : cell.m).includes('%') ? cell === null || cell === void 0 ? void 0 : cell.m : cell === null || cell === void 0 ? void 0 : cell.v;
|
|
169
169
|
};
|
|
170
170
|
return FormulaCache;
|
|
171
171
|
}();
|
package/lib/utils/index.js
CHANGED
|
@@ -362,15 +362,13 @@ function processArray(cellReferences, d, flowData) {
|
|
|
362
362
|
});
|
|
363
363
|
var formated;
|
|
364
364
|
coordinates.forEach(function (coord) {
|
|
365
|
-
var _a, _b, _c, _d
|
|
365
|
+
var _a, _b, _c, _d;
|
|
366
366
|
var row = coord[0],
|
|
367
367
|
col = coord[1];
|
|
368
368
|
if (row >= 0 && row < d.length && col >= 0 && col < d[row].length) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
if (((_j = (_h = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _h === void 0 ? void 0 : _h.ct) === null || _j === void 0 ? void 0 : _j.fa) && ((_m = (_l = (_k = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _k === void 0 ? void 0 : _k.ct) === null || _l === void 0 ? void 0 : _l.fa) === null || _m === void 0 ? void 0 : _m.includes("#,##0."))) {
|
|
373
|
-
formated = (_p = (_o = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _o === void 0 ? void 0 : _o.ct) === null || _p === void 0 ? void 0 : _p.fa;
|
|
369
|
+
var fa = (_b = (_a = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _a === void 0 ? void 0 : _a.ct) === null || _b === void 0 ? void 0 : _b.fa;
|
|
370
|
+
if (fa && ((fa === null || fa === void 0 ? void 0 : fa.includes("#,##0")) || (fa === null || fa === void 0 ? void 0 : fa.includes("#,##0.")) || (fa === null || fa === void 0 ? void 0 : fa.includes("%")))) {
|
|
371
|
+
formated = (_d = (_c = flowData === null || flowData === void 0 ? void 0 : flowData[row][col]) === null || _c === void 0 ? void 0 : _c.ct) === null || _d === void 0 ? void 0 : _d.fa;
|
|
374
372
|
}
|
|
375
373
|
}
|
|
376
374
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.74",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dev": "father-build --watch"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fileverse-dev/formula-parser": "0.2.
|
|
18
|
+
"@fileverse-dev/formula-parser": "0.2.72",
|
|
19
19
|
"dayjs": "^1.11.0",
|
|
20
20
|
"immer": "^9.0.12",
|
|
21
21
|
"lodash": "^4.17.21",
|