@fileverse-dev/fortune-core 1.1.73 → 1.1.75
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/cell.js +2 -3
- package/es/modules/formula.js +2 -3
- package/es/modules/sheet.js +1 -1
- package/es/utils/index.js +4 -6
- package/lib/events/paste.js +3 -3
- package/lib/modules/cell.js +2 -3
- package/lib/modules/formula.js +2 -3
- package/lib/modules/sheet.js +1 -1
- 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/cell.js
CHANGED
|
@@ -104,7 +104,6 @@ export function getCellValue(r, c, data, attr) {
|
|
|
104
104
|
}
|
|
105
105
|
export function setCellValue(ctx, r, c, d, v) {
|
|
106
106
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
107
|
-
console.log("setCellValue", r, c, v);
|
|
108
107
|
if (_.isNil(d)) {
|
|
109
108
|
d = getFlowdata(ctx);
|
|
110
109
|
}
|
|
@@ -216,7 +215,8 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
216
215
|
t: "n"
|
|
217
216
|
};
|
|
218
217
|
}
|
|
219
|
-
|
|
218
|
+
var isDigit = /^\d+$/.test(vupdate);
|
|
219
|
+
if (isDigit) {
|
|
220
220
|
var flowdata = getFlowdata(ctx);
|
|
221
221
|
var args = (_g = getContentInParentheses(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _g === void 0 ? void 0 : _g.split(",");
|
|
222
222
|
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
@@ -525,7 +525,6 @@ export function cancelNormalSelected(ctx) {
|
|
|
525
525
|
}
|
|
526
526
|
export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
527
527
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
528
|
-
console.log("updateCell", ctx, r, c, $input, value, canvas);
|
|
529
528
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
530
529
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
531
530
|
var flowdata = getFlowdata(ctx);
|
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
|
}();
|
|
@@ -812,7 +812,6 @@ export function execFunctionGroup(ctx, origin_r, origin_c, value, id, data, isFo
|
|
|
812
812
|
var cellCache = [[{
|
|
813
813
|
v: undefined
|
|
814
814
|
}]];
|
|
815
|
-
console.log("cellCache hhaahahah setCell value", cellCache);
|
|
816
815
|
setCellValue(ctx, 0, 0, cellCache, value);
|
|
817
816
|
ctx.formulaCache.execFunctionGlobalData["".concat(origin_r, "_").concat(origin_c, "_").concat(id)] = cellCache[0][0];
|
|
818
817
|
}
|
package/es/modules/sheet.js
CHANGED
|
@@ -184,7 +184,7 @@ export function editSheetName(ctx, editable) {
|
|
|
184
184
|
editable.innerText = oldtxt;
|
|
185
185
|
throw new Error(sheetconfig.sheetNamecannotIsEmptyError);
|
|
186
186
|
}
|
|
187
|
-
if (txt.
|
|
187
|
+
if (txt.charAt(0) === "'" || txt.charAt(txt.length - 1) === "'" || /[::\\/??*[\]]+/.test(txt)) {
|
|
188
188
|
editable.innerText = oldtxt;
|
|
189
189
|
throw new Error(sheetconfig.sheetNameSpecCharError);
|
|
190
190
|
}
|
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/cell.js
CHANGED
|
@@ -137,7 +137,6 @@ function getCellValue(r, c, data, attr) {
|
|
|
137
137
|
}
|
|
138
138
|
function setCellValue(ctx, r, c, d, v) {
|
|
139
139
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
140
|
-
console.log("setCellValue", r, c, v);
|
|
141
140
|
if (_lodash.default.isNil(d)) {
|
|
142
141
|
d = (0, _context.getFlowdata)(ctx);
|
|
143
142
|
}
|
|
@@ -249,7 +248,8 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
249
248
|
t: "n"
|
|
250
249
|
};
|
|
251
250
|
}
|
|
252
|
-
|
|
251
|
+
var isDigit = /^\d+$/.test(vupdate);
|
|
252
|
+
if (isDigit) {
|
|
253
253
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
254
254
|
var args = (_g = (0, _utils.getContentInParentheses)(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _g === void 0 ? void 0 : _g.split(",");
|
|
255
255
|
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
@@ -558,7 +558,6 @@ function cancelNormalSelected(ctx) {
|
|
|
558
558
|
}
|
|
559
559
|
function updateCell(ctx, r, c, $input, value, canvas) {
|
|
560
560
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
561
|
-
console.log("updateCell", ctx, r, c, $input, value, canvas);
|
|
562
561
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
563
562
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
564
563
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
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
|
}();
|
|
@@ -842,7 +842,6 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data, isForce) {
|
|
|
842
842
|
var cellCache = [[{
|
|
843
843
|
v: undefined
|
|
844
844
|
}]];
|
|
845
|
-
console.log("cellCache hhaahahah setCell value", cellCache);
|
|
846
845
|
(0, _cell.setCellValue)(ctx, 0, 0, cellCache, value);
|
|
847
846
|
ctx.formulaCache.execFunctionGlobalData["".concat(origin_r, "_").concat(origin_c, "_").concat(id)] = cellCache[0][0];
|
|
848
847
|
}
|
package/lib/modules/sheet.js
CHANGED
|
@@ -197,7 +197,7 @@ function editSheetName(ctx, editable) {
|
|
|
197
197
|
editable.innerText = oldtxt;
|
|
198
198
|
throw new Error(sheetconfig.sheetNamecannotIsEmptyError);
|
|
199
199
|
}
|
|
200
|
-
if (txt.
|
|
200
|
+
if (txt.charAt(0) === "'" || txt.charAt(txt.length - 1) === "'" || /[::\\/??*[\]]+/.test(txt)) {
|
|
201
201
|
editable.innerText = oldtxt;
|
|
202
202
|
throw new Error(sheetconfig.sheetNameSpecCharError);
|
|
203
203
|
}
|
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.75",
|
|
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",
|