@fileverse-dev/fortune-core 1.1.3 → 1.1.5-patch.0
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/keyboard.d.ts +1 -1
- package/es/events/keyboard.js +226 -99
- package/es/locale/en.js +5 -0
- package/es/modules/ConditionFormat.js +28 -28
- package/es/modules/selection.d.ts +2 -0
- package/es/modules/selection.js +86 -0
- package/lib/events/keyboard.d.ts +1 -1
- package/lib/events/keyboard.js +225 -98
- package/lib/locale/en.js +5 -0
- package/lib/modules/ConditionFormat.js +28 -28
- package/lib/modules/selection.d.ts +2 -0
- package/lib/modules/selection.js +88 -0
- package/package.json +2 -2
package/es/events/keyboard.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import { GlobalCache } from "../types";
|
|
|
3
3
|
export declare function handleGlobalEnter(ctx: Context, cellInput: HTMLDivElement, e: KeyboardEvent, canvas?: CanvasRenderingContext2D): void;
|
|
4
4
|
export declare function handleWithCtrlOrMetaKey(ctx: Context, cache: GlobalCache, e: KeyboardEvent, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, handleUndo: () => void, handleRedo: () => void): void;
|
|
5
5
|
export declare function handleArrowKey(ctx: Context, e: KeyboardEvent): void;
|
|
6
|
-
export declare function handleGlobalKeyDown(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, e: KeyboardEvent, cache: GlobalCache, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): void
|
|
6
|
+
export declare function handleGlobalKeyDown(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, e: KeyboardEvent, cache: GlobalCache, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): Promise<void>;
|
package/es/events/keyboard.js
CHANGED
|
@@ -1,9 +1,124 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) {
|
|
9
|
+
try {
|
|
10
|
+
step(generator.next(value));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
reject(e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function rejected(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator["throw"](value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function step(result) {
|
|
23
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
24
|
+
}
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
29
|
+
var _ = {
|
|
30
|
+
label: 0,
|
|
31
|
+
sent: function sent() {
|
|
32
|
+
if (t[0] & 1) throw t[1];
|
|
33
|
+
return t[1];
|
|
34
|
+
},
|
|
35
|
+
trys: [],
|
|
36
|
+
ops: []
|
|
37
|
+
},
|
|
38
|
+
f,
|
|
39
|
+
y,
|
|
40
|
+
t,
|
|
41
|
+
g;
|
|
42
|
+
return g = {
|
|
43
|
+
next: verb(0),
|
|
44
|
+
"throw": verb(1),
|
|
45
|
+
"return": verb(2)
|
|
46
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
47
|
+
return this;
|
|
48
|
+
}), g;
|
|
49
|
+
function verb(n) {
|
|
50
|
+
return function (v) {
|
|
51
|
+
return step([n, v]);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function step(op) {
|
|
55
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
56
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
57
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
58
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
59
|
+
switch (op[0]) {
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
t = op;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
_.label++;
|
|
66
|
+
return {
|
|
67
|
+
value: op[1],
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
case 5:
|
|
71
|
+
_.label++;
|
|
72
|
+
y = op[1];
|
|
73
|
+
op = [0];
|
|
74
|
+
continue;
|
|
75
|
+
case 7:
|
|
76
|
+
op = _.ops.pop();
|
|
77
|
+
_.trys.pop();
|
|
78
|
+
continue;
|
|
79
|
+
default:
|
|
80
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
81
|
+
_ = 0;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
85
|
+
_.label = op[1];
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
89
|
+
_.label = t[1];
|
|
90
|
+
t = op;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (t && _.label < t[2]) {
|
|
94
|
+
_.label = t[2];
|
|
95
|
+
_.ops.push(op);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (t[2]) _.ops.pop();
|
|
99
|
+
_.trys.pop();
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
op = body.call(thisArg, _);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
op = [6, e];
|
|
105
|
+
y = 0;
|
|
106
|
+
} finally {
|
|
107
|
+
f = t = 0;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] & 5) throw op[1];
|
|
110
|
+
return {
|
|
111
|
+
value: op[0] ? op[1] : void 0,
|
|
112
|
+
done: true
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
1
116
|
import _ from "lodash";
|
|
2
117
|
import { hideCRCount, removeActiveImage } from "..";
|
|
3
118
|
import { getFlowdata } from "../context";
|
|
4
119
|
import { updateCell, cancelNormalSelected } from "../modules/cell";
|
|
5
120
|
import { handleFormulaInput } from "../modules/formula";
|
|
6
|
-
import { copy, deleteSelectedCellText, deleteSelectedCellFormat, textFormat, fillDate, fillTime, moveHighlightCell, moveHighlightRange, selectAll, selectionCache } from "../modules/selection";
|
|
121
|
+
import { copy, deleteSelectedCellText, deleteSelectedCellFormat, textFormat, fillDate, fillTime, fillRightData, fillDownData, moveHighlightCell, moveHighlightRange, selectAll, selectionCache } from "../modules/selection";
|
|
7
122
|
import { cancelPaintModel, handleBold, handleItalic, handleUnderline, handleLink } from "../modules/toolbar";
|
|
8
123
|
import { hasPartMC } from "../modules/validation";
|
|
9
124
|
import { getNowDateTime, getSheetIndex, isAllowEdit } from "../utils";
|
|
@@ -256,105 +371,117 @@ export function handleArrowKey(ctx, e) {
|
|
|
256
371
|
}
|
|
257
372
|
export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
|
|
258
373
|
var _a;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyL") {
|
|
268
|
-
textFormat(ctx, "left");
|
|
269
|
-
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
270
|
-
textFormat(ctx, "right");
|
|
271
|
-
}
|
|
272
|
-
if ((e.metaKey || e.ctrlKey) && e.code === "KeyK") {
|
|
273
|
-
handleLink(ctx);
|
|
274
|
-
}
|
|
275
|
-
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === "Semicolon") {
|
|
276
|
-
fillDate(ctx);
|
|
277
|
-
}
|
|
278
|
-
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === "Semicolon") {
|
|
279
|
-
fillTime(ctx);
|
|
280
|
-
}
|
|
281
|
-
ctx.luckysheet_select_status = false;
|
|
282
|
-
var kcode = e.keyCode;
|
|
283
|
-
var kstr = e.key;
|
|
284
|
-
if (!_.isEmpty(ctx.contextMenu) || ctx.filterContextMenu) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (kstr === "Escape" && !!ctx.luckysheet_selection_range) {
|
|
288
|
-
ctx.luckysheet_selection_range = [];
|
|
289
|
-
}
|
|
290
|
-
var allowEdit = isAllowEdit(ctx);
|
|
291
|
-
if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
if (kstr === "Enter") {
|
|
295
|
-
if (!allowEdit) return;
|
|
296
|
-
handleGlobalEnter(ctx, cellInput, e, canvas);
|
|
297
|
-
} else if (kstr === "Tab") {
|
|
298
|
-
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (e.shiftKey) {
|
|
302
|
-
moveHighlightCell(ctx, "right", -1, "rangeOfSelect");
|
|
303
|
-
} else {
|
|
304
|
-
moveHighlightCell(ctx, "right", 1, "rangeOfSelect");
|
|
305
|
-
}
|
|
306
|
-
e.preventDefault();
|
|
307
|
-
} else if (kstr === "F2") {
|
|
308
|
-
if (!allowEdit) return;
|
|
309
|
-
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
|
|
313
|
-
if (!last) return;
|
|
314
|
-
var row_index = last.row_focus;
|
|
315
|
-
var col_index = last.column_focus;
|
|
316
|
-
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
317
|
-
e.preventDefault();
|
|
318
|
-
} else if (kstr === "F4" && ctx.luckysheetCellUpdate.length > 0) {
|
|
319
|
-
e.preventDefault();
|
|
320
|
-
} else if (kstr === "Escape" && ctx.luckysheetCellUpdate.length > 0) {
|
|
321
|
-
cancelNormalSelected(ctx);
|
|
322
|
-
moveHighlightCell(ctx, "down", 0, "rangeOfSelect");
|
|
323
|
-
e.preventDefault();
|
|
324
|
-
} else {
|
|
325
|
-
if (e.ctrlKey || e.metaKey) {
|
|
326
|
-
handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handleUndo, handleRedo);
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
if (e.shiftKey && (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight")) {
|
|
330
|
-
handleShiftWithArrowKey(ctx, e);
|
|
331
|
-
} else if (kstr === "Escape") {
|
|
332
|
-
ctx.contextMenu = {};
|
|
333
|
-
} else if (kstr === "Delete" || kstr === "Backspace") {
|
|
334
|
-
if (!allowEdit) return;
|
|
335
|
-
if (ctx.activeImg != null) {
|
|
336
|
-
removeActiveImage(ctx);
|
|
337
|
-
} else {
|
|
338
|
-
deleteSelectedCellText(ctx);
|
|
374
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
375
|
+
var kcode, kstr, allowEdit, last, row_index, col_index, last, row_index, col_index;
|
|
376
|
+
return __generator(this, function (_b) {
|
|
377
|
+
if (e.shiftKey && e.code === "Space") {
|
|
378
|
+
e.stopImmediatePropagation();
|
|
379
|
+
e.stopPropagation();
|
|
380
|
+
e.preventDefault();
|
|
381
|
+
return [2];
|
|
339
382
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
383
|
+
if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyE") {
|
|
384
|
+
textFormat(ctx, "center");
|
|
385
|
+
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyL") {
|
|
386
|
+
textFormat(ctx, "left");
|
|
387
|
+
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
388
|
+
textFormat(ctx, "right");
|
|
389
|
+
}
|
|
390
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyK") {
|
|
391
|
+
handleLink(ctx);
|
|
392
|
+
}
|
|
393
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === "Semicolon") {
|
|
394
|
+
fillDate(ctx);
|
|
395
|
+
}
|
|
396
|
+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === "Semicolon") {
|
|
397
|
+
fillTime(ctx);
|
|
398
|
+
}
|
|
399
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyR") {
|
|
400
|
+
fillRightData(ctx);
|
|
401
|
+
}
|
|
402
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyD") {
|
|
403
|
+
fillDownData(ctx);
|
|
404
|
+
}
|
|
405
|
+
ctx.luckysheet_select_status = false;
|
|
406
|
+
kcode = e.keyCode;
|
|
407
|
+
kstr = e.key;
|
|
408
|
+
if (!_.isEmpty(ctx.contextMenu) || ctx.filterContextMenu) {
|
|
409
|
+
return [2];
|
|
410
|
+
}
|
|
411
|
+
if (kstr === "Escape" && !!ctx.luckysheet_selection_range) {
|
|
412
|
+
ctx.luckysheet_selection_range = [];
|
|
413
|
+
}
|
|
414
|
+
allowEdit = isAllowEdit(ctx);
|
|
415
|
+
if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
|
|
416
|
+
return [2];
|
|
417
|
+
}
|
|
418
|
+
if (kstr === "Enter") {
|
|
419
|
+
if (!allowEdit) return [2];
|
|
420
|
+
handleGlobalEnter(ctx, cellInput, e, canvas);
|
|
421
|
+
} else if (kstr === "Tab") {
|
|
422
|
+
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
423
|
+
return [2];
|
|
424
|
+
}
|
|
425
|
+
if (e.shiftKey) {
|
|
426
|
+
moveHighlightCell(ctx, "right", -1, "rangeOfSelect");
|
|
427
|
+
} else {
|
|
428
|
+
moveHighlightCell(ctx, "right", 1, "rangeOfSelect");
|
|
429
|
+
}
|
|
430
|
+
e.preventDefault();
|
|
431
|
+
} else if (kstr === "F2") {
|
|
432
|
+
if (!allowEdit) return [2];
|
|
433
|
+
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
434
|
+
return [2];
|
|
435
|
+
}
|
|
436
|
+
last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
|
|
437
|
+
if (!last) return [2];
|
|
438
|
+
row_index = last.row_focus;
|
|
439
|
+
col_index = last.column_focus;
|
|
350
440
|
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
351
|
-
|
|
352
|
-
|
|
441
|
+
e.preventDefault();
|
|
442
|
+
} else if (kstr === "F4" && ctx.luckysheetCellUpdate.length > 0) {
|
|
443
|
+
e.preventDefault();
|
|
444
|
+
} else if (kstr === "Escape" && ctx.luckysheetCellUpdate.length > 0) {
|
|
445
|
+
cancelNormalSelected(ctx);
|
|
446
|
+
moveHighlightCell(ctx, "down", 0, "rangeOfSelect");
|
|
447
|
+
e.preventDefault();
|
|
448
|
+
} else {
|
|
449
|
+
if (e.ctrlKey || e.metaKey) {
|
|
450
|
+
handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handleUndo, handleRedo);
|
|
451
|
+
return [2];
|
|
452
|
+
}
|
|
453
|
+
if (e.shiftKey && (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight")) {
|
|
454
|
+
handleShiftWithArrowKey(ctx, e);
|
|
455
|
+
} else if (kstr === "Escape") {
|
|
456
|
+
ctx.contextMenu = {};
|
|
457
|
+
} else if (kstr === "Delete" || kstr === "Backspace") {
|
|
458
|
+
if (!allowEdit) return [2];
|
|
459
|
+
if (ctx.activeImg != null) {
|
|
460
|
+
removeActiveImage(ctx);
|
|
461
|
+
} else {
|
|
462
|
+
deleteSelectedCellText(ctx);
|
|
463
|
+
}
|
|
464
|
+
jfrefreshgrid(ctx, null, undefined);
|
|
465
|
+
e.preventDefault();
|
|
466
|
+
} else if (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight") {
|
|
467
|
+
handleArrowKey(ctx, e);
|
|
468
|
+
} else if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || kcode === 0 || e.ctrlKey && kcode === 86) {
|
|
469
|
+
if (!allowEdit) return [2];
|
|
470
|
+
if (String.fromCharCode(kcode) != null && !_.isEmpty(ctx.luckysheet_select_save) && kstr !== "CapsLock" && kstr !== "Win" && kcode !== 18) {
|
|
471
|
+
last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
472
|
+
row_index = last.row_focus;
|
|
473
|
+
col_index = last.column_focus;
|
|
474
|
+
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
475
|
+
cache.overwriteCell = true;
|
|
476
|
+
handleFormulaInput(ctx, fxInput, cellInput, kcode);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
353
479
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
480
|
+
if (cellInput !== document.activeElement) {
|
|
481
|
+
cellInput === null || cellInput === void 0 ? void 0 : cellInput.focus();
|
|
482
|
+
}
|
|
483
|
+
e.stopPropagation();
|
|
484
|
+
return [2];
|
|
485
|
+
});
|
|
486
|
+
});
|
|
360
487
|
}
|
package/es/locale/en.js
CHANGED
|
@@ -23,20 +23,20 @@ function compareGreaterThan(cellValue, conditionValue, symbol) {
|
|
|
23
23
|
var cellStr = String(cellValue);
|
|
24
24
|
var conditionStr = String(conditionValue);
|
|
25
25
|
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
26
|
-
if (symbol ===
|
|
26
|
+
if (symbol === ">=") {
|
|
27
27
|
return cellStr.localeCompare(conditionStr) >= 0;
|
|
28
28
|
}
|
|
29
29
|
return cellStr.localeCompare(conditionStr) > 0;
|
|
30
30
|
}
|
|
31
31
|
var cellNum = Number(cellValue);
|
|
32
32
|
var conditionNum = Number(conditionValue);
|
|
33
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
33
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === ">=") {
|
|
34
34
|
return cellNum >= conditionNum;
|
|
35
35
|
}
|
|
36
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
36
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === ">") {
|
|
37
37
|
return cellNum > conditionNum;
|
|
38
38
|
}
|
|
39
|
-
if (symbol ===
|
|
39
|
+
if (symbol === ">=") {
|
|
40
40
|
return cellStr.localeCompare(conditionStr) >= 0;
|
|
41
41
|
}
|
|
42
42
|
return cellStr.localeCompare(conditionStr) > 0;
|
|
@@ -45,20 +45,20 @@ function compareLessThan(cellValue, conditionValue, symbol) {
|
|
|
45
45
|
var cellStr = String(cellValue);
|
|
46
46
|
var conditionStr = String(conditionValue);
|
|
47
47
|
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
48
|
-
if (symbol ===
|
|
48
|
+
if (symbol === "<=") {
|
|
49
49
|
return cellStr.localeCompare(conditionStr) <= 0;
|
|
50
50
|
}
|
|
51
51
|
return cellStr.localeCompare(conditionStr) < 0;
|
|
52
52
|
}
|
|
53
53
|
var cellNum = Number(cellValue);
|
|
54
54
|
var conditionNum = Number(conditionValue);
|
|
55
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
55
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === "<=") {
|
|
56
56
|
return cellNum <= conditionNum;
|
|
57
57
|
}
|
|
58
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum)) {
|
|
58
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum)) {
|
|
59
59
|
return cellNum < conditionNum;
|
|
60
60
|
}
|
|
61
|
-
if (symbol ===
|
|
61
|
+
if (symbol === "<=") {
|
|
62
62
|
return cellStr.localeCompare(conditionStr) <= 0;
|
|
63
63
|
}
|
|
64
64
|
return cellStr.localeCompare(conditionStr) < 0;
|
|
@@ -67,7 +67,8 @@ function compareBetween(cellValue, value1, value2) {
|
|
|
67
67
|
var cellStr = String(cellValue);
|
|
68
68
|
var val1Str = String(value1);
|
|
69
69
|
var val2Str = String(value2);
|
|
70
|
-
var smallerValue
|
|
70
|
+
var smallerValue;
|
|
71
|
+
var biggerValue;
|
|
71
72
|
if (hasAlphabeticChars(value1) || hasAlphabeticChars(value2) || hasAlphabeticChars(cellValue)) {
|
|
72
73
|
if (val1Str.localeCompare(val2Str) > 0) {
|
|
73
74
|
biggerValue = val1Str;
|
|
@@ -77,24 +78,23 @@ function compareBetween(cellValue, value1, value2) {
|
|
|
77
78
|
smallerValue = val1Str;
|
|
78
79
|
}
|
|
79
80
|
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
81
|
+
}
|
|
82
|
+
var cellNum = Number(cellValue);
|
|
83
|
+
var val1Num = Number(value1);
|
|
84
|
+
var val2Num = Number(value2);
|
|
85
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(val1Num) && !Number.isNaN(val2Num)) {
|
|
86
|
+
var smallerNum = Math.min(val1Num, val2Num);
|
|
87
|
+
var biggerNum = Math.max(val1Num, val2Num);
|
|
88
|
+
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
89
|
+
}
|
|
90
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
91
|
+
biggerValue = val1Str;
|
|
92
|
+
smallerValue = val2Str;
|
|
80
93
|
} else {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var val2Num = Number(value2);
|
|
84
|
-
if (!isNaN(cellNum) && !isNaN(val1Num) && !isNaN(val2Num)) {
|
|
85
|
-
var smallerNum = Math.min(val1Num, val2Num);
|
|
86
|
-
var biggerNum = Math.max(val1Num, val2Num);
|
|
87
|
-
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
88
|
-
}
|
|
89
|
-
if (val1Str.localeCompare(val2Str) > 0) {
|
|
90
|
-
biggerValue = val1Str;
|
|
91
|
-
smallerValue = val2Str;
|
|
92
|
-
} else {
|
|
93
|
-
biggerValue = val2Str;
|
|
94
|
-
smallerValue = val1Str;
|
|
95
|
-
}
|
|
96
|
-
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
94
|
+
biggerValue = val2Str;
|
|
95
|
+
smallerValue = val1Str;
|
|
97
96
|
}
|
|
97
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
98
98
|
}
|
|
99
99
|
export function getHistoryRules(fileH) {
|
|
100
100
|
var historyRules = [];
|
|
@@ -558,7 +558,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
558
558
|
if (_.isNil(cell) || _.isNil(cell.v) || isRealNull(cell.v)) {
|
|
559
559
|
continue;
|
|
560
560
|
}
|
|
561
|
-
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0,
|
|
561
|
+
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0, ">")) {
|
|
562
562
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
563
563
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
564
564
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -568,7 +568,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
568
568
|
cellColor: cellColor_1
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0,
|
|
571
|
+
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0, ">=")) {
|
|
572
572
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
573
573
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
574
574
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -588,7 +588,7 @@ export function compute(ctx, ruleArr, d) {
|
|
|
588
588
|
cellColor: cellColor_1
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0,
|
|
591
|
+
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0, "<=")) {
|
|
592
592
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
593
593
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
594
594
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -25,6 +25,8 @@ export declare function rangeValueToHtml(ctx: Context, sheetId: string, ranges?:
|
|
|
25
25
|
export declare function copy(ctx: Context): void;
|
|
26
26
|
export declare function deleteSelectedCellText(ctx: Context): string;
|
|
27
27
|
export declare function deleteSelectedCellFormat(ctx: Context): string;
|
|
28
|
+
export declare function fillRightData(ctx: Context): string;
|
|
29
|
+
export declare function fillDownData(ctx: Context): string;
|
|
28
30
|
export declare function textFormat(ctx: Context, type: "left" | "center" | "right"): string;
|
|
29
31
|
export declare function fillDate(ctx: Context): string;
|
|
30
32
|
export declare function fillTime(ctx: Context): string;
|
package/es/modules/selection.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var __assign = this && this.__assign || function () {
|
|
3
|
+
__assign = Object.assign || function (t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
2
12
|
import _, { isPlainObject } from "lodash";
|
|
3
13
|
import { getFlowdata } from "../context";
|
|
4
14
|
import { getCellValue, getdatabyselection, getDataBySelectionNoCopy, getStyleByCell, mergeBorder, mergeMoveMain } from "./cell";
|
|
@@ -1586,6 +1596,82 @@ export function deleteSelectedCellFormat(ctx) {
|
|
|
1586
1596
|
}
|
|
1587
1597
|
return "success";
|
|
1588
1598
|
}
|
|
1599
|
+
export function fillRightData(ctx) {
|
|
1600
|
+
var allowEdit = isAllowEdit(ctx);
|
|
1601
|
+
if (allowEdit === false) {
|
|
1602
|
+
return "allowEdit";
|
|
1603
|
+
}
|
|
1604
|
+
var selection = ctx.luckysheet_select_save;
|
|
1605
|
+
if (selection && !_.isEmpty(selection)) {
|
|
1606
|
+
var d = getFlowdata(ctx);
|
|
1607
|
+
if (!d) return "dataNullError";
|
|
1608
|
+
var has_PartMC = false;
|
|
1609
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1610
|
+
var r1 = selection[s].row[0];
|
|
1611
|
+
var r2 = selection[s].row[1];
|
|
1612
|
+
var c1 = selection[s].column[0];
|
|
1613
|
+
var c2 = selection[s].column[1];
|
|
1614
|
+
if (hasPartMC(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1615
|
+
has_PartMC = true;
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
if (has_PartMC) {
|
|
1620
|
+
return "partMC";
|
|
1621
|
+
}
|
|
1622
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1623
|
+
var r1 = selection[s].row[0];
|
|
1624
|
+
var r2 = selection[s].row[1];
|
|
1625
|
+
var c1 = selection[s].column[0];
|
|
1626
|
+
var c2 = selection[s].column[1];
|
|
1627
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1628
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1629
|
+
var previousCell = d[r][c - 1];
|
|
1630
|
+
d[r][c] = __assign({}, previousCell);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return "success";
|
|
1636
|
+
}
|
|
1637
|
+
export function fillDownData(ctx) {
|
|
1638
|
+
var allowEdit = isAllowEdit(ctx);
|
|
1639
|
+
if (allowEdit === false) {
|
|
1640
|
+
return "allowEdit";
|
|
1641
|
+
}
|
|
1642
|
+
var selection = ctx.luckysheet_select_save;
|
|
1643
|
+
if (selection && !_.isEmpty(selection)) {
|
|
1644
|
+
var d = getFlowdata(ctx);
|
|
1645
|
+
if (!d) return "dataNullError";
|
|
1646
|
+
var has_PartMC = false;
|
|
1647
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1648
|
+
var r1 = selection[s].row[0];
|
|
1649
|
+
var r2 = selection[s].row[1];
|
|
1650
|
+
var c1 = selection[s].column[0];
|
|
1651
|
+
var c2 = selection[s].column[1];
|
|
1652
|
+
if (hasPartMC(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1653
|
+
has_PartMC = true;
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (has_PartMC) {
|
|
1658
|
+
return "partMC";
|
|
1659
|
+
}
|
|
1660
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1661
|
+
var r1 = selection[s].row[0];
|
|
1662
|
+
var r2 = selection[s].row[1];
|
|
1663
|
+
var c1 = selection[s].column[0];
|
|
1664
|
+
var c2 = selection[s].column[1];
|
|
1665
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1666
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1667
|
+
var previousCell = d[r - 1][c];
|
|
1668
|
+
d[r][c] = __assign({}, previousCell);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return "success";
|
|
1674
|
+
}
|
|
1589
1675
|
export function textFormat(ctx, type) {
|
|
1590
1676
|
var allowEdit = isAllowEdit(ctx);
|
|
1591
1677
|
if (allowEdit === false) {
|
package/lib/events/keyboard.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import { GlobalCache } from "../types";
|
|
|
3
3
|
export declare function handleGlobalEnter(ctx: Context, cellInput: HTMLDivElement, e: KeyboardEvent, canvas?: CanvasRenderingContext2D): void;
|
|
4
4
|
export declare function handleWithCtrlOrMetaKey(ctx: Context, cache: GlobalCache, e: KeyboardEvent, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, handleUndo: () => void, handleRedo: () => void): void;
|
|
5
5
|
export declare function handleArrowKey(ctx: Context, e: KeyboardEvent): void;
|
|
6
|
-
export declare function handleGlobalKeyDown(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, e: KeyboardEvent, cache: GlobalCache, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): void
|
|
6
|
+
export declare function handleGlobalKeyDown(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, e: KeyboardEvent, cache: GlobalCache, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): Promise<void>;
|
package/lib/events/keyboard.js
CHANGED
|
@@ -19,6 +19,121 @@ var _utils = require("../utils");
|
|
|
19
19
|
var _copy = require("./copy");
|
|
20
20
|
var _refresh = require("../modules/refresh");
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
23
|
+
function adopt(value) {
|
|
24
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
25
|
+
resolve(value);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.next(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function rejected(value) {
|
|
37
|
+
try {
|
|
38
|
+
step(generator["throw"](value));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function step(result) {
|
|
44
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
45
|
+
}
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
50
|
+
var _ = {
|
|
51
|
+
label: 0,
|
|
52
|
+
sent: function sent() {
|
|
53
|
+
if (t[0] & 1) throw t[1];
|
|
54
|
+
return t[1];
|
|
55
|
+
},
|
|
56
|
+
trys: [],
|
|
57
|
+
ops: []
|
|
58
|
+
},
|
|
59
|
+
f,
|
|
60
|
+
y,
|
|
61
|
+
t,
|
|
62
|
+
g;
|
|
63
|
+
return g = {
|
|
64
|
+
next: verb(0),
|
|
65
|
+
"throw": verb(1),
|
|
66
|
+
"return": verb(2)
|
|
67
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
68
|
+
return this;
|
|
69
|
+
}), g;
|
|
70
|
+
function verb(n) {
|
|
71
|
+
return function (v) {
|
|
72
|
+
return step([n, v]);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function step(op) {
|
|
76
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
77
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
78
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
79
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
80
|
+
switch (op[0]) {
|
|
81
|
+
case 0:
|
|
82
|
+
case 1:
|
|
83
|
+
t = op;
|
|
84
|
+
break;
|
|
85
|
+
case 4:
|
|
86
|
+
_.label++;
|
|
87
|
+
return {
|
|
88
|
+
value: op[1],
|
|
89
|
+
done: false
|
|
90
|
+
};
|
|
91
|
+
case 5:
|
|
92
|
+
_.label++;
|
|
93
|
+
y = op[1];
|
|
94
|
+
op = [0];
|
|
95
|
+
continue;
|
|
96
|
+
case 7:
|
|
97
|
+
op = _.ops.pop();
|
|
98
|
+
_.trys.pop();
|
|
99
|
+
continue;
|
|
100
|
+
default:
|
|
101
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
102
|
+
_ = 0;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
106
|
+
_.label = op[1];
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
110
|
+
_.label = t[1];
|
|
111
|
+
t = op;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (t && _.label < t[2]) {
|
|
115
|
+
_.label = t[2];
|
|
116
|
+
_.ops.push(op);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
if (t[2]) _.ops.pop();
|
|
120
|
+
_.trys.pop();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
op = body.call(thisArg, _);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
op = [6, e];
|
|
126
|
+
y = 0;
|
|
127
|
+
} finally {
|
|
128
|
+
f = t = 0;
|
|
129
|
+
}
|
|
130
|
+
if (op[0] & 5) throw op[1];
|
|
131
|
+
return {
|
|
132
|
+
value: op[0] ? op[1] : void 0,
|
|
133
|
+
done: true
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
};
|
|
22
137
|
function handleGlobalEnter(ctx, cellInput, e, canvas) {
|
|
23
138
|
var _a, _b, _c;
|
|
24
139
|
if ((e.altKey || e.metaKey) && ctx.luckysheetCellUpdate.length > 0) {
|
|
@@ -266,105 +381,117 @@ function handleArrowKey(ctx, e) {
|
|
|
266
381
|
}
|
|
267
382
|
function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
|
|
268
383
|
var _a;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyL") {
|
|
278
|
-
(0, _selection.textFormat)(ctx, "left");
|
|
279
|
-
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
280
|
-
(0, _selection.textFormat)(ctx, "right");
|
|
281
|
-
}
|
|
282
|
-
if ((e.metaKey || e.ctrlKey) && e.code === "KeyK") {
|
|
283
|
-
(0, _toolbar.handleLink)(ctx);
|
|
284
|
-
}
|
|
285
|
-
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === "Semicolon") {
|
|
286
|
-
(0, _selection.fillDate)(ctx);
|
|
287
|
-
}
|
|
288
|
-
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === "Semicolon") {
|
|
289
|
-
(0, _selection.fillTime)(ctx);
|
|
290
|
-
}
|
|
291
|
-
ctx.luckysheet_select_status = false;
|
|
292
|
-
var kcode = e.keyCode;
|
|
293
|
-
var kstr = e.key;
|
|
294
|
-
if (!_lodash.default.isEmpty(ctx.contextMenu) || ctx.filterContextMenu) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (kstr === "Escape" && !!ctx.luckysheet_selection_range) {
|
|
298
|
-
ctx.luckysheet_selection_range = [];
|
|
299
|
-
}
|
|
300
|
-
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
301
|
-
if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (kstr === "Enter") {
|
|
305
|
-
if (!allowEdit) return;
|
|
306
|
-
handleGlobalEnter(ctx, cellInput, e, canvas);
|
|
307
|
-
} else if (kstr === "Tab") {
|
|
308
|
-
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
if (e.shiftKey) {
|
|
312
|
-
(0, _selection.moveHighlightCell)(ctx, "right", -1, "rangeOfSelect");
|
|
313
|
-
} else {
|
|
314
|
-
(0, _selection.moveHighlightCell)(ctx, "right", 1, "rangeOfSelect");
|
|
315
|
-
}
|
|
316
|
-
e.preventDefault();
|
|
317
|
-
} else if (kstr === "F2") {
|
|
318
|
-
if (!allowEdit) return;
|
|
319
|
-
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
|
|
323
|
-
if (!last) return;
|
|
324
|
-
var row_index = last.row_focus;
|
|
325
|
-
var col_index = last.column_focus;
|
|
326
|
-
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
327
|
-
e.preventDefault();
|
|
328
|
-
} else if (kstr === "F4" && ctx.luckysheetCellUpdate.length > 0) {
|
|
329
|
-
e.preventDefault();
|
|
330
|
-
} else if (kstr === "Escape" && ctx.luckysheetCellUpdate.length > 0) {
|
|
331
|
-
(0, _cell.cancelNormalSelected)(ctx);
|
|
332
|
-
(0, _selection.moveHighlightCell)(ctx, "down", 0, "rangeOfSelect");
|
|
333
|
-
e.preventDefault();
|
|
334
|
-
} else {
|
|
335
|
-
if (e.ctrlKey || e.metaKey) {
|
|
336
|
-
handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handleUndo, handleRedo);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (e.shiftKey && (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight")) {
|
|
340
|
-
handleShiftWithArrowKey(ctx, e);
|
|
341
|
-
} else if (kstr === "Escape") {
|
|
342
|
-
ctx.contextMenu = {};
|
|
343
|
-
} else if (kstr === "Delete" || kstr === "Backspace") {
|
|
344
|
-
if (!allowEdit) return;
|
|
345
|
-
if (ctx.activeImg != null) {
|
|
346
|
-
(0, _2.removeActiveImage)(ctx);
|
|
347
|
-
} else {
|
|
348
|
-
(0, _selection.deleteSelectedCellText)(ctx);
|
|
384
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
385
|
+
var kcode, kstr, allowEdit, last, row_index, col_index, last, row_index, col_index;
|
|
386
|
+
return __generator(this, function (_b) {
|
|
387
|
+
if (e.shiftKey && e.code === "Space") {
|
|
388
|
+
e.stopImmediatePropagation();
|
|
389
|
+
e.stopPropagation();
|
|
390
|
+
e.preventDefault();
|
|
391
|
+
return [2];
|
|
349
392
|
}
|
|
350
|
-
(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
393
|
+
if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyE") {
|
|
394
|
+
(0, _selection.textFormat)(ctx, "center");
|
|
395
|
+
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyL") {
|
|
396
|
+
(0, _selection.textFormat)(ctx, "left");
|
|
397
|
+
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
398
|
+
(0, _selection.textFormat)(ctx, "right");
|
|
399
|
+
}
|
|
400
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyK") {
|
|
401
|
+
(0, _toolbar.handleLink)(ctx);
|
|
402
|
+
}
|
|
403
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === "Semicolon") {
|
|
404
|
+
(0, _selection.fillDate)(ctx);
|
|
405
|
+
}
|
|
406
|
+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === "Semicolon") {
|
|
407
|
+
(0, _selection.fillTime)(ctx);
|
|
408
|
+
}
|
|
409
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyR") {
|
|
410
|
+
(0, _selection.fillRightData)(ctx);
|
|
411
|
+
}
|
|
412
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "KeyD") {
|
|
413
|
+
(0, _selection.fillDownData)(ctx);
|
|
414
|
+
}
|
|
415
|
+
ctx.luckysheet_select_status = false;
|
|
416
|
+
kcode = e.keyCode;
|
|
417
|
+
kstr = e.key;
|
|
418
|
+
if (!_lodash.default.isEmpty(ctx.contextMenu) || ctx.filterContextMenu) {
|
|
419
|
+
return [2];
|
|
420
|
+
}
|
|
421
|
+
if (kstr === "Escape" && !!ctx.luckysheet_selection_range) {
|
|
422
|
+
ctx.luckysheet_selection_range = [];
|
|
423
|
+
}
|
|
424
|
+
allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
425
|
+
if (ctx.luckysheetCellUpdate.length > 0 && kstr !== "Enter" && kstr !== "Tab" && kstr !== "ArrowUp" && kstr !== "ArrowDown" && kstr !== "ArrowLeft" && kstr !== "ArrowRight") {
|
|
426
|
+
return [2];
|
|
427
|
+
}
|
|
428
|
+
if (kstr === "Enter") {
|
|
429
|
+
if (!allowEdit) return [2];
|
|
430
|
+
handleGlobalEnter(ctx, cellInput, e, canvas);
|
|
431
|
+
} else if (kstr === "Tab") {
|
|
432
|
+
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
433
|
+
return [2];
|
|
434
|
+
}
|
|
435
|
+
if (e.shiftKey) {
|
|
436
|
+
(0, _selection.moveHighlightCell)(ctx, "right", -1, "rangeOfSelect");
|
|
437
|
+
} else {
|
|
438
|
+
(0, _selection.moveHighlightCell)(ctx, "right", 1, "rangeOfSelect");
|
|
439
|
+
}
|
|
440
|
+
e.preventDefault();
|
|
441
|
+
} else if (kstr === "F2") {
|
|
442
|
+
if (!allowEdit) return [2];
|
|
443
|
+
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
444
|
+
return [2];
|
|
445
|
+
}
|
|
446
|
+
last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
|
|
447
|
+
if (!last) return [2];
|
|
448
|
+
row_index = last.row_focus;
|
|
449
|
+
col_index = last.column_focus;
|
|
360
450
|
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
361
|
-
|
|
362
|
-
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
} else if (kstr === "F4" && ctx.luckysheetCellUpdate.length > 0) {
|
|
453
|
+
e.preventDefault();
|
|
454
|
+
} else if (kstr === "Escape" && ctx.luckysheetCellUpdate.length > 0) {
|
|
455
|
+
(0, _cell.cancelNormalSelected)(ctx);
|
|
456
|
+
(0, _selection.moveHighlightCell)(ctx, "down", 0, "rangeOfSelect");
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
} else {
|
|
459
|
+
if (e.ctrlKey || e.metaKey) {
|
|
460
|
+
handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handleUndo, handleRedo);
|
|
461
|
+
return [2];
|
|
462
|
+
}
|
|
463
|
+
if (e.shiftKey && (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight")) {
|
|
464
|
+
handleShiftWithArrowKey(ctx, e);
|
|
465
|
+
} else if (kstr === "Escape") {
|
|
466
|
+
ctx.contextMenu = {};
|
|
467
|
+
} else if (kstr === "Delete" || kstr === "Backspace") {
|
|
468
|
+
if (!allowEdit) return [2];
|
|
469
|
+
if (ctx.activeImg != null) {
|
|
470
|
+
(0, _2.removeActiveImage)(ctx);
|
|
471
|
+
} else {
|
|
472
|
+
(0, _selection.deleteSelectedCellText)(ctx);
|
|
473
|
+
}
|
|
474
|
+
(0, _refresh.jfrefreshgrid)(ctx, null, undefined);
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
} else if (kstr === "ArrowUp" || kstr === "ArrowDown" || kstr === "ArrowLeft" || kstr === "ArrowRight") {
|
|
477
|
+
handleArrowKey(ctx, e);
|
|
478
|
+
} else if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || kcode === 0 || e.ctrlKey && kcode === 86) {
|
|
479
|
+
if (!allowEdit) return [2];
|
|
480
|
+
if (String.fromCharCode(kcode) != null && !_lodash.default.isEmpty(ctx.luckysheet_select_save) && kstr !== "CapsLock" && kstr !== "Win" && kcode !== 18) {
|
|
481
|
+
last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
482
|
+
row_index = last.row_focus;
|
|
483
|
+
col_index = last.column_focus;
|
|
484
|
+
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
485
|
+
cache.overwriteCell = true;
|
|
486
|
+
(0, _formula.handleFormulaInput)(ctx, fxInput, cellInput, kcode);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
363
489
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
490
|
+
if (cellInput !== document.activeElement) {
|
|
491
|
+
cellInput === null || cellInput === void 0 ? void 0 : cellInput.focus();
|
|
492
|
+
}
|
|
493
|
+
e.stopPropagation();
|
|
494
|
+
return [2];
|
|
495
|
+
});
|
|
496
|
+
});
|
|
370
497
|
}
|
package/lib/locale/en.js
CHANGED
|
@@ -9081,6 +9081,11 @@ var _default = exports.default = {
|
|
|
9081
9081
|
pos: "before",
|
|
9082
9082
|
value: "CLP$",
|
|
9083
9083
|
geckoId: "clp"
|
|
9084
|
+
}, {
|
|
9085
|
+
name: "Czech Koruna",
|
|
9086
|
+
pos: "after",
|
|
9087
|
+
value: "CZK",
|
|
9088
|
+
geckoId: "czk"
|
|
9084
9089
|
}, {
|
|
9085
9090
|
name: "Danish Krone",
|
|
9086
9091
|
pos: "after",
|
|
@@ -38,20 +38,20 @@ function compareGreaterThan(cellValue, conditionValue, symbol) {
|
|
|
38
38
|
var cellStr = String(cellValue);
|
|
39
39
|
var conditionStr = String(conditionValue);
|
|
40
40
|
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
41
|
-
if (symbol ===
|
|
41
|
+
if (symbol === ">=") {
|
|
42
42
|
return cellStr.localeCompare(conditionStr) >= 0;
|
|
43
43
|
}
|
|
44
44
|
return cellStr.localeCompare(conditionStr) > 0;
|
|
45
45
|
}
|
|
46
46
|
var cellNum = Number(cellValue);
|
|
47
47
|
var conditionNum = Number(conditionValue);
|
|
48
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
48
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === ">=") {
|
|
49
49
|
return cellNum >= conditionNum;
|
|
50
50
|
}
|
|
51
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
51
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === ">") {
|
|
52
52
|
return cellNum > conditionNum;
|
|
53
53
|
}
|
|
54
|
-
if (symbol ===
|
|
54
|
+
if (symbol === ">=") {
|
|
55
55
|
return cellStr.localeCompare(conditionStr) >= 0;
|
|
56
56
|
}
|
|
57
57
|
return cellStr.localeCompare(conditionStr) > 0;
|
|
@@ -60,20 +60,20 @@ function compareLessThan(cellValue, conditionValue, symbol) {
|
|
|
60
60
|
var cellStr = String(cellValue);
|
|
61
61
|
var conditionStr = String(conditionValue);
|
|
62
62
|
if (hasAlphabeticChars(cellValue) || hasAlphabeticChars(conditionValue)) {
|
|
63
|
-
if (symbol ===
|
|
63
|
+
if (symbol === "<=") {
|
|
64
64
|
return cellStr.localeCompare(conditionStr) <= 0;
|
|
65
65
|
}
|
|
66
66
|
return cellStr.localeCompare(conditionStr) < 0;
|
|
67
67
|
}
|
|
68
68
|
var cellNum = Number(cellValue);
|
|
69
69
|
var conditionNum = Number(conditionValue);
|
|
70
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum) && symbol ===
|
|
70
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum) && symbol === "<=") {
|
|
71
71
|
return cellNum <= conditionNum;
|
|
72
72
|
}
|
|
73
|
-
if (!isNaN(cellNum) && !isNaN(conditionNum)) {
|
|
73
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(conditionNum)) {
|
|
74
74
|
return cellNum < conditionNum;
|
|
75
75
|
}
|
|
76
|
-
if (symbol ===
|
|
76
|
+
if (symbol === "<=") {
|
|
77
77
|
return cellStr.localeCompare(conditionStr) <= 0;
|
|
78
78
|
}
|
|
79
79
|
return cellStr.localeCompare(conditionStr) < 0;
|
|
@@ -82,7 +82,8 @@ function compareBetween(cellValue, value1, value2) {
|
|
|
82
82
|
var cellStr = String(cellValue);
|
|
83
83
|
var val1Str = String(value1);
|
|
84
84
|
var val2Str = String(value2);
|
|
85
|
-
var smallerValue
|
|
85
|
+
var smallerValue;
|
|
86
|
+
var biggerValue;
|
|
86
87
|
if (hasAlphabeticChars(value1) || hasAlphabeticChars(value2) || hasAlphabeticChars(cellValue)) {
|
|
87
88
|
if (val1Str.localeCompare(val2Str) > 0) {
|
|
88
89
|
biggerValue = val1Str;
|
|
@@ -92,24 +93,23 @@ function compareBetween(cellValue, value1, value2) {
|
|
|
92
93
|
smallerValue = val1Str;
|
|
93
94
|
}
|
|
94
95
|
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
96
|
+
}
|
|
97
|
+
var cellNum = Number(cellValue);
|
|
98
|
+
var val1Num = Number(value1);
|
|
99
|
+
var val2Num = Number(value2);
|
|
100
|
+
if (!Number.isNaN(cellNum) && !Number.isNaN(val1Num) && !Number.isNaN(val2Num)) {
|
|
101
|
+
var smallerNum = Math.min(val1Num, val2Num);
|
|
102
|
+
var biggerNum = Math.max(val1Num, val2Num);
|
|
103
|
+
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
104
|
+
}
|
|
105
|
+
if (val1Str.localeCompare(val2Str) > 0) {
|
|
106
|
+
biggerValue = val1Str;
|
|
107
|
+
smallerValue = val2Str;
|
|
95
108
|
} else {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var val2Num = Number(value2);
|
|
99
|
-
if (!isNaN(cellNum) && !isNaN(val1Num) && !isNaN(val2Num)) {
|
|
100
|
-
var smallerNum = Math.min(val1Num, val2Num);
|
|
101
|
-
var biggerNum = Math.max(val1Num, val2Num);
|
|
102
|
-
return cellNum >= smallerNum && cellNum <= biggerNum;
|
|
103
|
-
}
|
|
104
|
-
if (val1Str.localeCompare(val2Str) > 0) {
|
|
105
|
-
biggerValue = val1Str;
|
|
106
|
-
smallerValue = val2Str;
|
|
107
|
-
} else {
|
|
108
|
-
biggerValue = val2Str;
|
|
109
|
-
smallerValue = val1Str;
|
|
110
|
-
}
|
|
111
|
-
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
109
|
+
biggerValue = val2Str;
|
|
110
|
+
smallerValue = val1Str;
|
|
112
111
|
}
|
|
112
|
+
return cellStr.localeCompare(smallerValue) >= 0 && cellStr.localeCompare(biggerValue) <= 0;
|
|
113
113
|
}
|
|
114
114
|
function getHistoryRules(fileH) {
|
|
115
115
|
var historyRules = [];
|
|
@@ -573,7 +573,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
573
573
|
if (_lodash.default.isNil(cell) || _lodash.default.isNil(cell.v) || (0, _validation.isRealNull)(cell.v)) {
|
|
574
574
|
continue;
|
|
575
575
|
}
|
|
576
|
-
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0,
|
|
576
|
+
if (conditionName === "greaterThan" && compareGreaterThan(cell.v, conditionValue0, ">")) {
|
|
577
577
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
578
578
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
579
579
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -583,7 +583,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
583
583
|
cellColor: cellColor_1
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0,
|
|
586
|
+
} else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0, ">=")) {
|
|
587
587
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
588
588
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
589
589
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -603,7 +603,7 @@ function compute(ctx, ruleArr, d) {
|
|
|
603
603
|
cellColor: cellColor_1
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
|
-
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0,
|
|
606
|
+
} else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0, "<=")) {
|
|
607
607
|
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
608
608
|
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
609
609
|
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
@@ -25,6 +25,8 @@ export declare function rangeValueToHtml(ctx: Context, sheetId: string, ranges?:
|
|
|
25
25
|
export declare function copy(ctx: Context): void;
|
|
26
26
|
export declare function deleteSelectedCellText(ctx: Context): string;
|
|
27
27
|
export declare function deleteSelectedCellFormat(ctx: Context): string;
|
|
28
|
+
export declare function fillRightData(ctx: Context): string;
|
|
29
|
+
export declare function fillDownData(ctx: Context): string;
|
|
28
30
|
export declare function textFormat(ctx: Context, type: "left" | "center" | "right"): string;
|
|
29
31
|
export declare function fillDate(ctx: Context): string;
|
|
30
32
|
export declare function fillTime(ctx: Context): string;
|
package/lib/modules/selection.js
CHANGED
|
@@ -9,6 +9,8 @@ exports.copy = copy;
|
|
|
9
9
|
exports.deleteSelectedCellFormat = deleteSelectedCellFormat;
|
|
10
10
|
exports.deleteSelectedCellText = deleteSelectedCellText;
|
|
11
11
|
exports.fillDate = fillDate;
|
|
12
|
+
exports.fillDownData = fillDownData;
|
|
13
|
+
exports.fillRightData = fillRightData;
|
|
12
14
|
exports.fillTime = fillTime;
|
|
13
15
|
exports.fixColumnStyleOverflowInFreeze = fixColumnStyleOverflowInFreeze;
|
|
14
16
|
exports.fixRowStyleOverflowInFreeze = fixRowStyleOverflowInFreeze;
|
|
@@ -43,6 +45,16 @@ var _ConditionFormat = require("./ConditionFormat");
|
|
|
43
45
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
44
46
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
45
47
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
48
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
49
|
+
__assign = Object.assign || function (t) {
|
|
50
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
51
|
+
s = arguments[i];
|
|
52
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
return __assign.apply(this, arguments);
|
|
57
|
+
};
|
|
46
58
|
var selectionCache = exports.selectionCache = {
|
|
47
59
|
isPasteAction: false
|
|
48
60
|
};
|
|
@@ -1619,6 +1631,82 @@ function deleteSelectedCellFormat(ctx) {
|
|
|
1619
1631
|
}
|
|
1620
1632
|
return "success";
|
|
1621
1633
|
}
|
|
1634
|
+
function fillRightData(ctx) {
|
|
1635
|
+
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1636
|
+
if (allowEdit === false) {
|
|
1637
|
+
return "allowEdit";
|
|
1638
|
+
}
|
|
1639
|
+
var selection = ctx.luckysheet_select_save;
|
|
1640
|
+
if (selection && !_lodash.default.isEmpty(selection)) {
|
|
1641
|
+
var d = (0, _context.getFlowdata)(ctx);
|
|
1642
|
+
if (!d) return "dataNullError";
|
|
1643
|
+
var has_PartMC = false;
|
|
1644
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1645
|
+
var r1 = selection[s].row[0];
|
|
1646
|
+
var r2 = selection[s].row[1];
|
|
1647
|
+
var c1 = selection[s].column[0];
|
|
1648
|
+
var c2 = selection[s].column[1];
|
|
1649
|
+
if ((0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1650
|
+
has_PartMC = true;
|
|
1651
|
+
break;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
if (has_PartMC) {
|
|
1655
|
+
return "partMC";
|
|
1656
|
+
}
|
|
1657
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1658
|
+
var r1 = selection[s].row[0];
|
|
1659
|
+
var r2 = selection[s].row[1];
|
|
1660
|
+
var c1 = selection[s].column[0];
|
|
1661
|
+
var c2 = selection[s].column[1];
|
|
1662
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1663
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1664
|
+
var previousCell = d[r][c - 1];
|
|
1665
|
+
d[r][c] = __assign({}, previousCell);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return "success";
|
|
1671
|
+
}
|
|
1672
|
+
function fillDownData(ctx) {
|
|
1673
|
+
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1674
|
+
if (allowEdit === false) {
|
|
1675
|
+
return "allowEdit";
|
|
1676
|
+
}
|
|
1677
|
+
var selection = ctx.luckysheet_select_save;
|
|
1678
|
+
if (selection && !_lodash.default.isEmpty(selection)) {
|
|
1679
|
+
var d = (0, _context.getFlowdata)(ctx);
|
|
1680
|
+
if (!d) return "dataNullError";
|
|
1681
|
+
var has_PartMC = false;
|
|
1682
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1683
|
+
var r1 = selection[s].row[0];
|
|
1684
|
+
var r2 = selection[s].row[1];
|
|
1685
|
+
var c1 = selection[s].column[0];
|
|
1686
|
+
var c2 = selection[s].column[1];
|
|
1687
|
+
if ((0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1688
|
+
has_PartMC = true;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
if (has_PartMC) {
|
|
1693
|
+
return "partMC";
|
|
1694
|
+
}
|
|
1695
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1696
|
+
var r1 = selection[s].row[0];
|
|
1697
|
+
var r2 = selection[s].row[1];
|
|
1698
|
+
var c1 = selection[s].column[0];
|
|
1699
|
+
var c2 = selection[s].column[1];
|
|
1700
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1701
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1702
|
+
var previousCell = d[r - 1][c];
|
|
1703
|
+
d[r][c] = __assign({}, previousCell);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
return "success";
|
|
1709
|
+
}
|
|
1622
1710
|
function textFormat(ctx, type) {
|
|
1623
1711
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1624
1712
|
if (allowEdit === false) {
|
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.5-patch.0",
|
|
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.60-patch.0",
|
|
19
19
|
"dayjs": "^1.11.0",
|
|
20
20
|
"immer": "^9.0.12",
|
|
21
21
|
"lodash": "^4.17.21",
|