@fileverse-dev/fortune-core 1.0.83 → 1.0.84
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.js
CHANGED
|
@@ -3,9 +3,10 @@ import { hideCRCount, removeActiveImage } from "..";
|
|
|
3
3
|
import { getFlowdata } from "../context";
|
|
4
4
|
import { updateCell, cancelNormalSelected } from "../modules/cell";
|
|
5
5
|
import { handleFormulaInput } from "../modules/formula";
|
|
6
|
-
import { copy, deleteSelectedCellText, deleteSelectedCellFormat, textFormat, moveHighlightCell, moveHighlightRange, selectAll, selectionCache } from "../modules/selection";
|
|
6
|
+
import { copy, deleteSelectedCellText, deleteSelectedCellFormat, textFormat, fillDate, fillTime, moveHighlightCell, moveHighlightRange, selectAll, selectionCache } from "../modules/selection";
|
|
7
7
|
import { cancelPaintModel, handleBold, handleItalic, handleUnderline } from "../modules/toolbar";
|
|
8
8
|
import { hasPartMC } from "../modules/validation";
|
|
9
|
+
import { handleLink } from "../modules/toolbar";
|
|
9
10
|
import { getNowDateTime, getSheetIndex, isAllowEdit } from "../utils";
|
|
10
11
|
import { handleCopy } from "./copy";
|
|
11
12
|
import { jfrefreshgrid } from "../modules/refresh";
|
|
@@ -127,7 +128,7 @@ export function handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handl
|
|
|
127
128
|
ctx.luckysheet_shiftkeydown = true;
|
|
128
129
|
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
|
|
129
130
|
handleControlPlusArrowKey(ctx, e, true);
|
|
130
|
-
} else if (_.includes([
|
|
131
|
+
} else if (_.includes(['"', ":", "'"], e.key)) {
|
|
131
132
|
var last = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[ctx.luckysheet_select_save.length - 1];
|
|
132
133
|
if (!last) return;
|
|
133
134
|
var row_index = last.row_focus;
|
|
@@ -257,6 +258,7 @@ export function handleArrowKey(ctx, e) {
|
|
|
257
258
|
}
|
|
258
259
|
export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
|
|
259
260
|
var _a;
|
|
261
|
+
console.log(e.code);
|
|
260
262
|
if (e.shiftKey && e.code === "Space") {
|
|
261
263
|
e.stopImmediatePropagation();
|
|
262
264
|
e.stopPropagation();
|
|
@@ -270,6 +272,15 @@ export function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUnd
|
|
|
270
272
|
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
271
273
|
textFormat(ctx, "right");
|
|
272
274
|
}
|
|
275
|
+
if ((e.metaKey || e.ctrlKey) && e.code === 'KeyK') {
|
|
276
|
+
handleLink(ctx);
|
|
277
|
+
}
|
|
278
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === 'Semicolon') {
|
|
279
|
+
fillDate(ctx);
|
|
280
|
+
}
|
|
281
|
+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === 'Semicolon') {
|
|
282
|
+
fillTime(ctx);
|
|
283
|
+
}
|
|
273
284
|
ctx.luckysheet_select_status = false;
|
|
274
285
|
var kcode = e.keyCode;
|
|
275
286
|
var kstr = e.key;
|
|
@@ -26,6 +26,8 @@ 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
28
|
export declare function textFormat(ctx: Context, type: "left" | "center" | "right"): string;
|
|
29
|
+
export declare function fillDate(ctx: Context): string;
|
|
30
|
+
export declare function fillTime(ctx: Context): string;
|
|
29
31
|
export declare function selectIsOverlap(ctx: Context, range?: any): boolean;
|
|
30
32
|
export declare function selectAll(ctx: Context): void;
|
|
31
33
|
export declare function fixRowStyleOverflowInFreeze(ctx: Context, r1: number, r2: number, freeze: Freezen | undefined): {
|
package/es/modules/selection.js
CHANGED
|
@@ -1635,6 +1635,88 @@ export function textFormat(ctx, type) {
|
|
|
1635
1635
|
}
|
|
1636
1636
|
return "success";
|
|
1637
1637
|
}
|
|
1638
|
+
export function fillDate(ctx) {
|
|
1639
|
+
var allowEdit = isAllowEdit(ctx);
|
|
1640
|
+
if (allowEdit === false) {
|
|
1641
|
+
return "allowEdit";
|
|
1642
|
+
}
|
|
1643
|
+
var selection = ctx.luckysheet_select_save;
|
|
1644
|
+
if (selection && !_.isEmpty(selection)) {
|
|
1645
|
+
var d = getFlowdata(ctx);
|
|
1646
|
+
if (!d) return "dataNullError";
|
|
1647
|
+
var has_PartMC = false;
|
|
1648
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1649
|
+
var r1 = selection[s].row[0];
|
|
1650
|
+
var r2 = selection[s].row[1];
|
|
1651
|
+
var c1 = selection[s].column[0];
|
|
1652
|
+
var c2 = selection[s].column[1];
|
|
1653
|
+
if (hasPartMC(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1654
|
+
has_PartMC = true;
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
if (has_PartMC) {
|
|
1659
|
+
return "partMC";
|
|
1660
|
+
}
|
|
1661
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1662
|
+
var r1 = selection[s].row[0];
|
|
1663
|
+
var r2 = selection[s].row[1];
|
|
1664
|
+
var c1 = selection[s].column[0];
|
|
1665
|
+
var c2 = selection[s].column[1];
|
|
1666
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1667
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1668
|
+
var today = new Date();
|
|
1669
|
+
var formattedDate = "".concat(String(today.getDate()).padStart(2, '0'), "/").concat(String(today.getMonth() + 1).padStart(2, '0'), "/").concat(today.getFullYear());
|
|
1670
|
+
d[r][c] = {
|
|
1671
|
+
v: formattedDate
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
return "success";
|
|
1678
|
+
}
|
|
1679
|
+
export function fillTime(ctx) {
|
|
1680
|
+
var allowEdit = isAllowEdit(ctx);
|
|
1681
|
+
if (allowEdit === false) {
|
|
1682
|
+
return "allowEdit";
|
|
1683
|
+
}
|
|
1684
|
+
var selection = ctx.luckysheet_select_save;
|
|
1685
|
+
if (selection && !_.isEmpty(selection)) {
|
|
1686
|
+
var d = getFlowdata(ctx);
|
|
1687
|
+
if (!d) return "dataNullError";
|
|
1688
|
+
var has_PartMC = false;
|
|
1689
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1690
|
+
var r1 = selection[s].row[0];
|
|
1691
|
+
var r2 = selection[s].row[1];
|
|
1692
|
+
var c1 = selection[s].column[0];
|
|
1693
|
+
var c2 = selection[s].column[1];
|
|
1694
|
+
if (hasPartMC(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1695
|
+
has_PartMC = true;
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (has_PartMC) {
|
|
1700
|
+
return "partMC";
|
|
1701
|
+
}
|
|
1702
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1703
|
+
var r1 = selection[s].row[0];
|
|
1704
|
+
var r2 = selection[s].row[1];
|
|
1705
|
+
var c1 = selection[s].column[0];
|
|
1706
|
+
var c2 = selection[s].column[1];
|
|
1707
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1708
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1709
|
+
var now = new Date();
|
|
1710
|
+
var formattedTime = "".concat(String(now.getHours()).padStart(2, '0'), ":").concat(String(now.getMinutes()).padStart(2, '0'), ":").concat(String(now.getSeconds()).padStart(2, '0'));
|
|
1711
|
+
d[r][c] = {
|
|
1712
|
+
v: formattedTime
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return "success";
|
|
1719
|
+
}
|
|
1638
1720
|
export function selectIsOverlap(ctx, range) {
|
|
1639
1721
|
return false;
|
|
1640
1722
|
}
|
package/lib/events/keyboard.js
CHANGED
|
@@ -137,7 +137,7 @@ function handleWithCtrlOrMetaKey(ctx, cache, e, cellInput, fxInput, handleUndo,
|
|
|
137
137
|
ctx.luckysheet_shiftkeydown = true;
|
|
138
138
|
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
|
|
139
139
|
handleControlPlusArrowKey(ctx, e, true);
|
|
140
|
-
} else if (_lodash.default.includes([
|
|
140
|
+
} else if (_lodash.default.includes(['"', ":", "'"], e.key)) {
|
|
141
141
|
var last = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[ctx.luckysheet_select_save.length - 1];
|
|
142
142
|
if (!last) return;
|
|
143
143
|
var row_index = last.row_focus;
|
|
@@ -267,6 +267,7 @@ function handleArrowKey(ctx, e) {
|
|
|
267
267
|
}
|
|
268
268
|
function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
|
|
269
269
|
var _a;
|
|
270
|
+
console.log(e.code);
|
|
270
271
|
if (e.shiftKey && e.code === "Space") {
|
|
271
272
|
e.stopImmediatePropagation();
|
|
272
273
|
e.stopPropagation();
|
|
@@ -280,6 +281,15 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
|
|
|
280
281
|
} else if ((e.ctrlKey || e.metaKey && e.shiftKey) && e.code === "KeyR") {
|
|
281
282
|
(0, _selection.textFormat)(ctx, "right");
|
|
282
283
|
}
|
|
284
|
+
if ((e.metaKey || e.ctrlKey) && e.code === 'KeyK') {
|
|
285
|
+
(0, _toolbar.handleLink)(ctx);
|
|
286
|
+
}
|
|
287
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.code === 'Semicolon') {
|
|
288
|
+
(0, _selection.fillDate)(ctx);
|
|
289
|
+
}
|
|
290
|
+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === 'Semicolon') {
|
|
291
|
+
(0, _selection.fillTime)(ctx);
|
|
292
|
+
}
|
|
283
293
|
ctx.luckysheet_select_status = false;
|
|
284
294
|
var kcode = e.keyCode;
|
|
285
295
|
var kstr = e.key;
|
|
@@ -26,6 +26,8 @@ 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
28
|
export declare function textFormat(ctx: Context, type: "left" | "center" | "right"): string;
|
|
29
|
+
export declare function fillDate(ctx: Context): string;
|
|
30
|
+
export declare function fillTime(ctx: Context): string;
|
|
29
31
|
export declare function selectIsOverlap(ctx: Context, range?: any): boolean;
|
|
30
32
|
export declare function selectAll(ctx: Context): void;
|
|
31
33
|
export declare function fixRowStyleOverflowInFreeze(ctx: Context, r1: number, r2: number, freeze: Freezen | undefined): {
|
package/lib/modules/selection.js
CHANGED
|
@@ -8,6 +8,8 @@ exports.colHasMerged = colHasMerged;
|
|
|
8
8
|
exports.copy = copy;
|
|
9
9
|
exports.deleteSelectedCellFormat = deleteSelectedCellFormat;
|
|
10
10
|
exports.deleteSelectedCellText = deleteSelectedCellText;
|
|
11
|
+
exports.fillDate = fillDate;
|
|
12
|
+
exports.fillTime = fillTime;
|
|
11
13
|
exports.fixColumnStyleOverflowInFreeze = fixColumnStyleOverflowInFreeze;
|
|
12
14
|
exports.fixRowStyleOverflowInFreeze = fixRowStyleOverflowInFreeze;
|
|
13
15
|
exports.getColMerge = getColMerge;
|
|
@@ -1666,6 +1668,88 @@ function textFormat(ctx, type) {
|
|
|
1666
1668
|
}
|
|
1667
1669
|
return "success";
|
|
1668
1670
|
}
|
|
1671
|
+
function fillDate(ctx) {
|
|
1672
|
+
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1673
|
+
if (allowEdit === false) {
|
|
1674
|
+
return "allowEdit";
|
|
1675
|
+
}
|
|
1676
|
+
var selection = ctx.luckysheet_select_save;
|
|
1677
|
+
if (selection && !_lodash.default.isEmpty(selection)) {
|
|
1678
|
+
var d = (0, _context.getFlowdata)(ctx);
|
|
1679
|
+
if (!d) return "dataNullError";
|
|
1680
|
+
var has_PartMC = false;
|
|
1681
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1682
|
+
var r1 = selection[s].row[0];
|
|
1683
|
+
var r2 = selection[s].row[1];
|
|
1684
|
+
var c1 = selection[s].column[0];
|
|
1685
|
+
var c2 = selection[s].column[1];
|
|
1686
|
+
if ((0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1687
|
+
has_PartMC = true;
|
|
1688
|
+
break;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
if (has_PartMC) {
|
|
1692
|
+
return "partMC";
|
|
1693
|
+
}
|
|
1694
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1695
|
+
var r1 = selection[s].row[0];
|
|
1696
|
+
var r2 = selection[s].row[1];
|
|
1697
|
+
var c1 = selection[s].column[0];
|
|
1698
|
+
var c2 = selection[s].column[1];
|
|
1699
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1700
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1701
|
+
var today = new Date();
|
|
1702
|
+
var formattedDate = "".concat(String(today.getDate()).padStart(2, '0'), "/").concat(String(today.getMonth() + 1).padStart(2, '0'), "/").concat(today.getFullYear());
|
|
1703
|
+
d[r][c] = {
|
|
1704
|
+
v: formattedDate
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return "success";
|
|
1711
|
+
}
|
|
1712
|
+
function fillTime(ctx) {
|
|
1713
|
+
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1714
|
+
if (allowEdit === false) {
|
|
1715
|
+
return "allowEdit";
|
|
1716
|
+
}
|
|
1717
|
+
var selection = ctx.luckysheet_select_save;
|
|
1718
|
+
if (selection && !_lodash.default.isEmpty(selection)) {
|
|
1719
|
+
var d = (0, _context.getFlowdata)(ctx);
|
|
1720
|
+
if (!d) return "dataNullError";
|
|
1721
|
+
var has_PartMC = false;
|
|
1722
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1723
|
+
var r1 = selection[s].row[0];
|
|
1724
|
+
var r2 = selection[s].row[1];
|
|
1725
|
+
var c1 = selection[s].column[0];
|
|
1726
|
+
var c2 = selection[s].column[1];
|
|
1727
|
+
if ((0, _validation.hasPartMC)(ctx, ctx.config, r1, r2, c1, c2)) {
|
|
1728
|
+
has_PartMC = true;
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
if (has_PartMC) {
|
|
1733
|
+
return "partMC";
|
|
1734
|
+
}
|
|
1735
|
+
for (var s = 0; s < selection.length; s += 1) {
|
|
1736
|
+
var r1 = selection[s].row[0];
|
|
1737
|
+
var r2 = selection[s].row[1];
|
|
1738
|
+
var c1 = selection[s].column[0];
|
|
1739
|
+
var c2 = selection[s].column[1];
|
|
1740
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
1741
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
1742
|
+
var now = new Date();
|
|
1743
|
+
var formattedTime = "".concat(String(now.getHours()).padStart(2, '0'), ":").concat(String(now.getMinutes()).padStart(2, '0'), ":").concat(String(now.getSeconds()).padStart(2, '0'));
|
|
1744
|
+
d[r][c] = {
|
|
1745
|
+
v: formattedTime
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
return "success";
|
|
1752
|
+
}
|
|
1669
1753
|
function selectIsOverlap(ctx, range) {
|
|
1670
1754
|
return false;
|
|
1671
1755
|
}
|