@fileverse-dev/fortune-core 1.1.54-patch-4 → 1.1.55-smooth-scroll-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/events/paste.js +25 -0
- package/es/modules/toolbar.js +12 -15
- package/es/modules/validation.js +1 -1
- package/lib/events/paste.js +25 -0
- package/lib/modules/toolbar.js +12 -15
- package/lib/modules/validation.js +1 -1
- package/package.json +1 -1
package/es/events/paste.js
CHANGED
|
@@ -1154,6 +1154,7 @@ export function handlePaste(ctx, e) {
|
|
|
1154
1154
|
rowHeightList_1[targetR] = targetRowHeight;
|
|
1155
1155
|
}
|
|
1156
1156
|
_.forEach(tr.querySelectorAll("td, th"), function (element) {
|
|
1157
|
+
var _a, _b;
|
|
1157
1158
|
var td = element;
|
|
1158
1159
|
var className = td.className;
|
|
1159
1160
|
var cell = {};
|
|
@@ -1173,6 +1174,27 @@ export function handlePaste(ctx, e) {
|
|
|
1173
1174
|
cell.v = txt;
|
|
1174
1175
|
}
|
|
1175
1176
|
}
|
|
1177
|
+
var pendingLink = null;
|
|
1178
|
+
var anchor = td.querySelector("a[href]");
|
|
1179
|
+
var urlRegex = /^(https?:\/\/[^\s]+)$/i;
|
|
1180
|
+
if (anchor) {
|
|
1181
|
+
var hrefAttr = ((_a = anchor.getAttribute("href")) === null || _a === void 0 ? void 0 : _a.trim()) || "";
|
|
1182
|
+
var display = ((_b = anchor.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || hrefAttr;
|
|
1183
|
+
if (hrefAttr && urlRegex.test(hrefAttr)) {
|
|
1184
|
+
pendingLink = {
|
|
1185
|
+
href: hrefAttr,
|
|
1186
|
+
display: display
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
} else {
|
|
1190
|
+
var raw = (td.textContent || "").trim();
|
|
1191
|
+
if (urlRegex.test(raw)) {
|
|
1192
|
+
pendingLink = {
|
|
1193
|
+
href: raw,
|
|
1194
|
+
display: raw
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1176
1198
|
var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
|
|
1177
1199
|
var styles = {};
|
|
1178
1200
|
_.forEach(styleString, function (s) {
|
|
@@ -1244,6 +1266,9 @@ export function handlePaste(ctx, e) {
|
|
|
1244
1266
|
}
|
|
1245
1267
|
var r_ab = ctx.luckysheet_select_save[0].row[0] + r_1;
|
|
1246
1268
|
var c_ab = ctx.luckysheet_select_save[0].column[0] + c;
|
|
1269
|
+
if (pendingLink) {
|
|
1270
|
+
saveHyperlink(ctx, r_ab, c_ab, pendingLink.href, "webpage", pendingLink.display);
|
|
1271
|
+
}
|
|
1247
1272
|
for (var rp = 0; rp < rowspan; rp += 1) {
|
|
1248
1273
|
for (var cp = 0; cp < colspan; cp += 1) {
|
|
1249
1274
|
if (rp === 0) {
|
package/es/modules/toolbar.js
CHANGED
|
@@ -15,8 +15,8 @@ import { showLinkCard } from "./hyperlink";
|
|
|
15
15
|
import { cfSplitRange } from "./conditionalFormat";
|
|
16
16
|
import { getCellTextInfo } from "./text";
|
|
17
17
|
export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
19
|
-
var
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
19
|
+
var _y;
|
|
20
20
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -29,13 +29,10 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
29
29
|
var cell = d[r][c];
|
|
30
30
|
var value = void 0;
|
|
31
31
|
if (_.isPlainObject(cell)) {
|
|
32
|
-
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((
|
|
32
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null || _b === void 0 ? void 0 : _b.v);
|
|
33
33
|
} else {
|
|
34
34
|
value = cell;
|
|
35
35
|
}
|
|
36
|
-
if (_.isNil(value)) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
36
|
if (foucsStatus !== "@" && isRealNum(value)) {
|
|
40
37
|
value = Number(value);
|
|
41
38
|
}
|
|
@@ -56,12 +53,12 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
56
53
|
cell.ct.fa = foucsStatus;
|
|
57
54
|
cell.ct.t = type;
|
|
58
55
|
cell.v = String(value);
|
|
59
|
-
cell.fc = cell.fc || ((
|
|
60
|
-
cell.bl = cell.bl || ((
|
|
61
|
-
cell.it = cell.it || ((
|
|
62
|
-
cell.un = cell.un || ((
|
|
63
|
-
cell.fs = cell.fs || ((
|
|
64
|
-
cell.cl = cell.cl || ((
|
|
56
|
+
cell.fc = cell.fc || ((_e = (_d = (_c = cell.ct) === null || _c === void 0 ? void 0 : _c.s) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.fc);
|
|
57
|
+
cell.bl = cell.bl || ((_h = (_g = (_f = cell.ct) === null || _f === void 0 ? void 0 : _f.s) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.bl);
|
|
58
|
+
cell.it = cell.it || ((_l = (_k = (_j = cell.ct) === null || _j === void 0 ? void 0 : _j.s) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.it);
|
|
59
|
+
cell.un = cell.un || ((_p = (_o = (_m = cell.ct) === null || _m === void 0 ? void 0 : _m.s) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.un);
|
|
60
|
+
cell.fs = cell.fs || ((_s = (_r = (_q = cell.ct) === null || _q === void 0 ? void 0 : _q.s) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.fs);
|
|
61
|
+
cell.cl = cell.cl || ((_v = (_u = (_t = cell.ct) === null || _t === void 0 ? void 0 : _t.s) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.cl);
|
|
65
62
|
} else {
|
|
66
63
|
d[r][c] = {
|
|
67
64
|
ct: {
|
|
@@ -127,9 +124,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
127
124
|
if (value && _.isPlainObject(value)) {
|
|
128
125
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
129
126
|
value[attr] = foucsStatus;
|
|
130
|
-
(
|
|
127
|
+
(_y = ctx.luckysheetfile[sheetIndex]).config || (_y.config = {});
|
|
131
128
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
132
|
-
var cellWidth = ((
|
|
129
|
+
var cellWidth = ((_w = cfg.columnlen) === null || _w === void 0 ? void 0 : _w[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
133
130
|
if (attr === "fs" && canvas) {
|
|
134
131
|
var textInfo = getCellTextInfo(d[r][c], canvas, ctx, {
|
|
135
132
|
r: r,
|
|
@@ -138,7 +135,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
138
135
|
});
|
|
139
136
|
if (!textInfo) continue;
|
|
140
137
|
var rowHeight = _.round(textInfo.textHeightAll);
|
|
141
|
-
var currentRowHeight = ((
|
|
138
|
+
var currentRowHeight = ((_x = cfg.rowlen) === null || _x === void 0 ? void 0 : _x[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
142
139
|
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
143
140
|
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
144
141
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
package/es/modules/validation.js
CHANGED
|
@@ -22,7 +22,7 @@ export function isHexValue(str) {
|
|
|
22
22
|
return /^0x?[a-fA-F0-9]+$/.test(str);
|
|
23
23
|
}
|
|
24
24
|
export function isRealNum(val) {
|
|
25
|
-
if (isHexValue(val
|
|
25
|
+
if (isHexValue(val.toString())) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (_.isNil(val) || val.toString().replace(/\s/g, "") === "") {
|
package/lib/events/paste.js
CHANGED
|
@@ -1163,6 +1163,7 @@ function handlePaste(ctx, e) {
|
|
|
1163
1163
|
rowHeightList_1[targetR] = targetRowHeight;
|
|
1164
1164
|
}
|
|
1165
1165
|
_lodash.default.forEach(tr.querySelectorAll("td, th"), function (element) {
|
|
1166
|
+
var _a, _b;
|
|
1166
1167
|
var td = element;
|
|
1167
1168
|
var className = td.className;
|
|
1168
1169
|
var cell = {};
|
|
@@ -1182,6 +1183,27 @@ function handlePaste(ctx, e) {
|
|
|
1182
1183
|
cell.v = txt;
|
|
1183
1184
|
}
|
|
1184
1185
|
}
|
|
1186
|
+
var pendingLink = null;
|
|
1187
|
+
var anchor = td.querySelector("a[href]");
|
|
1188
|
+
var urlRegex = /^(https?:\/\/[^\s]+)$/i;
|
|
1189
|
+
if (anchor) {
|
|
1190
|
+
var hrefAttr = ((_a = anchor.getAttribute("href")) === null || _a === void 0 ? void 0 : _a.trim()) || "";
|
|
1191
|
+
var display = ((_b = anchor.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || hrefAttr;
|
|
1192
|
+
if (hrefAttr && urlRegex.test(hrefAttr)) {
|
|
1193
|
+
pendingLink = {
|
|
1194
|
+
href: hrefAttr,
|
|
1195
|
+
display: display
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
} else {
|
|
1199
|
+
var raw = (td.textContent || "").trim();
|
|
1200
|
+
if (urlRegex.test(raw)) {
|
|
1201
|
+
pendingLink = {
|
|
1202
|
+
href: raw,
|
|
1203
|
+
display: raw
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1185
1207
|
var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
|
|
1186
1208
|
var styles = {};
|
|
1187
1209
|
_lodash.default.forEach(styleString, function (s) {
|
|
@@ -1253,6 +1275,9 @@ function handlePaste(ctx, e) {
|
|
|
1253
1275
|
}
|
|
1254
1276
|
var r_ab = ctx.luckysheet_select_save[0].row[0] + r_1;
|
|
1255
1277
|
var c_ab = ctx.luckysheet_select_save[0].column[0] + c;
|
|
1278
|
+
if (pendingLink) {
|
|
1279
|
+
(0, _modules.saveHyperlink)(ctx, r_ab, c_ab, pendingLink.href, "webpage", pendingLink.display);
|
|
1280
|
+
}
|
|
1256
1281
|
for (var rp = 0; rp < rowspan; rp += 1) {
|
|
1257
1282
|
for (var cp = 0; cp < colspan; cp += 1) {
|
|
1258
1283
|
if (rp === 0) {
|
package/lib/modules/toolbar.js
CHANGED
|
@@ -48,8 +48,8 @@ var _conditionalFormat = require("./conditionalFormat");
|
|
|
48
48
|
var _text = require("./text");
|
|
49
49
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
50
|
function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
51
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
52
|
-
var
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
52
|
+
var _y;
|
|
53
53
|
if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -62,13 +62,10 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
62
62
|
var cell = d[r][c];
|
|
63
63
|
var value = void 0;
|
|
64
64
|
if (_lodash.default.isPlainObject(cell)) {
|
|
65
|
-
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((
|
|
65
|
+
value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null || _b === void 0 ? void 0 : _b.v);
|
|
66
66
|
} else {
|
|
67
67
|
value = cell;
|
|
68
68
|
}
|
|
69
|
-
if (_lodash.default.isNil(value)) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
69
|
if (foucsStatus !== "@" && (0, _validation.isRealNum)(value)) {
|
|
73
70
|
value = Number(value);
|
|
74
71
|
}
|
|
@@ -89,12 +86,12 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
89
86
|
cell.ct.fa = foucsStatus;
|
|
90
87
|
cell.ct.t = type;
|
|
91
88
|
cell.v = String(value);
|
|
92
|
-
cell.fc = cell.fc || ((
|
|
93
|
-
cell.bl = cell.bl || ((
|
|
94
|
-
cell.it = cell.it || ((
|
|
95
|
-
cell.un = cell.un || ((
|
|
96
|
-
cell.fs = cell.fs || ((
|
|
97
|
-
cell.cl = cell.cl || ((
|
|
89
|
+
cell.fc = cell.fc || ((_e = (_d = (_c = cell.ct) === null || _c === void 0 ? void 0 : _c.s) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.fc);
|
|
90
|
+
cell.bl = cell.bl || ((_h = (_g = (_f = cell.ct) === null || _f === void 0 ? void 0 : _f.s) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.bl);
|
|
91
|
+
cell.it = cell.it || ((_l = (_k = (_j = cell.ct) === null || _j === void 0 ? void 0 : _j.s) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.it);
|
|
92
|
+
cell.un = cell.un || ((_p = (_o = (_m = cell.ct) === null || _m === void 0 ? void 0 : _m.s) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.un);
|
|
93
|
+
cell.fs = cell.fs || ((_s = (_r = (_q = cell.ct) === null || _q === void 0 ? void 0 : _q.s) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.fs);
|
|
94
|
+
cell.cl = cell.cl || ((_v = (_u = (_t = cell.ct) === null || _t === void 0 ? void 0 : _t.s) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.cl);
|
|
98
95
|
} else {
|
|
99
96
|
d[r][c] = {
|
|
100
97
|
ct: {
|
|
@@ -160,9 +157,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
160
157
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
161
158
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
162
159
|
value[attr] = foucsStatus;
|
|
163
|
-
(
|
|
160
|
+
(_y = ctx.luckysheetfile[sheetIndex]).config || (_y.config = {});
|
|
164
161
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
165
|
-
var cellWidth = ((
|
|
162
|
+
var cellWidth = ((_w = cfg.columnlen) === null || _w === void 0 ? void 0 : _w[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
166
163
|
if (attr === "fs" && canvas) {
|
|
167
164
|
var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
|
|
168
165
|
r: r,
|
|
@@ -171,7 +168,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
171
168
|
});
|
|
172
169
|
if (!textInfo) continue;
|
|
173
170
|
var rowHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
174
|
-
var currentRowHeight = ((
|
|
171
|
+
var currentRowHeight = ((_x = cfg.rowlen) === null || _x === void 0 ? void 0 : _x[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
175
172
|
if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
176
173
|
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
177
174
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -38,7 +38,7 @@ function isHexValue(str) {
|
|
|
38
38
|
return /^0x?[a-fA-F0-9]+$/.test(str);
|
|
39
39
|
}
|
|
40
40
|
function isRealNum(val) {
|
|
41
|
-
if (isHexValue(val
|
|
41
|
+
if (isHexValue(val.toString())) {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
if (_lodash.default.isNil(val) || val.toString().replace(/\s/g, "") === "") {
|