@fileverse-dev/fortune-core 1.0.2-mod-36 → 1.0.2-mod-37
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/dist/api/common.d.ts +8 -0
- package/dist/context.d.ts +16 -0
- package/dist/index.esm.js +272 -1
- package/dist/index.js +281 -0
- package/dist/modules/iframe.d.ts +12 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/types.d.ts +16 -0
- package/package.json +1 -1
package/dist/api/common.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ export declare function getSheetWithLatestCelldata(ctx: Context, options?: Commo
|
|
|
16
16
|
data?: CellMatrix | undefined;
|
|
17
17
|
id?: string | undefined;
|
|
18
18
|
images?: import("../types").Image[] | undefined;
|
|
19
|
+
iframes?: {
|
|
20
|
+
id: string;
|
|
21
|
+
src: string;
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}[] | undefined;
|
|
19
27
|
zoomRatio?: number | undefined;
|
|
20
28
|
column?: number | undefined;
|
|
21
29
|
row?: number | undefined;
|
package/dist/context.d.ts
CHANGED
|
@@ -26,6 +26,15 @@ export type Context = {
|
|
|
26
26
|
insertedImgs?: Image[];
|
|
27
27
|
editingInsertedImgs?: Image;
|
|
28
28
|
activeImg?: string;
|
|
29
|
+
insertedIframes?: {
|
|
30
|
+
id: string;
|
|
31
|
+
src: string;
|
|
32
|
+
left: number;
|
|
33
|
+
top: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}[];
|
|
37
|
+
activeIframe?: string;
|
|
29
38
|
presences?: Presence[];
|
|
30
39
|
showSearch?: boolean;
|
|
31
40
|
showReplace?: boolean;
|
|
@@ -170,6 +179,13 @@ export type Context = {
|
|
|
170
179
|
showSheetList?: Boolean;
|
|
171
180
|
forceFormulaRef?: Boolean;
|
|
172
181
|
getRefs: () => RefValues;
|
|
182
|
+
showDunePreview?: {
|
|
183
|
+
url: string;
|
|
184
|
+
position: {
|
|
185
|
+
left: number;
|
|
186
|
+
top: number;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
173
189
|
};
|
|
174
190
|
export declare function defaultContext(refs: RefValues): Context;
|
|
175
191
|
export declare function getFlowdata(ctx?: Context, id?: string | null): import("./types").CellMatrix | null | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -62828,6 +62828,13 @@ function defaultContext(refs) {
|
|
|
62828
62828
|
addDefaultRows: 50,
|
|
62829
62829
|
fullscreenmode: true,
|
|
62830
62830
|
devicePixelRatio: (globalThis || window).devicePixelRatio,
|
|
62831
|
+
showDunePreview: {
|
|
62832
|
+
url: "",
|
|
62833
|
+
position: {
|
|
62834
|
+
left: 0,
|
|
62835
|
+
top: 0
|
|
62836
|
+
}
|
|
62837
|
+
},
|
|
62831
62838
|
contextMenu: {},
|
|
62832
62839
|
sheetTabContextMenu: {},
|
|
62833
62840
|
currentSheetId: "",
|
|
@@ -63030,6 +63037,8 @@ function defaultContext(refs) {
|
|
|
63030
63037
|
luckysheet_shiftpositon: undefined,
|
|
63031
63038
|
iscopyself: true,
|
|
63032
63039
|
activeImg: undefined,
|
|
63040
|
+
insertedIframes: [],
|
|
63041
|
+
activeIframe: undefined,
|
|
63033
63042
|
orderbyindex: 0,
|
|
63034
63043
|
luckysheet_model_move_state: false,
|
|
63035
63044
|
luckysheet_model_xy: [0, 0],
|
|
@@ -75104,6 +75113,248 @@ function handleKeydownForZoom(ev, currentZoom) {
|
|
|
75104
75113
|
return parseFloat(zoom.toFixed(1));
|
|
75105
75114
|
}
|
|
75106
75115
|
|
|
75116
|
+
function sanitizeDuneUrl(input) {
|
|
75117
|
+
var trimmed = input.trim();
|
|
75118
|
+
var iframeMatch = trimmed.match(/src=["']?(https:\/\/dune\.com\/embeds\/\d+\/\d+)/);
|
|
75119
|
+
if (iframeMatch) {
|
|
75120
|
+
return iframeMatch[1];
|
|
75121
|
+
}
|
|
75122
|
+
var queryMatch = trimmed.match(/^https:\/\/dune\.com\/queries\/(\d+)\/(\d+)/);
|
|
75123
|
+
if (queryMatch) {
|
|
75124
|
+
var _queryMatch = _slicedToArray(queryMatch, 3),
|
|
75125
|
+
queryId = _queryMatch[1],
|
|
75126
|
+
vizId = _queryMatch[2];
|
|
75127
|
+
return "https://dune.com/embeds/".concat(queryId, "/").concat(vizId);
|
|
75128
|
+
}
|
|
75129
|
+
return null;
|
|
75130
|
+
}
|
|
75131
|
+
var sharedCtx;
|
|
75132
|
+
var sharedGlobalCache;
|
|
75133
|
+
function saveIframe(ctx) {
|
|
75134
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
75135
|
+
if (index == null) return;
|
|
75136
|
+
var file = ctx.luckysheetfile[index];
|
|
75137
|
+
file.iframes = ctx.insertedIframes;
|
|
75138
|
+
}
|
|
75139
|
+
function insertIframe(ctx, src) {
|
|
75140
|
+
try {
|
|
75141
|
+
var _ctx$luckysheet_selec, _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
|
|
75142
|
+
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
75143
|
+
var rowIndex = (_ref = (_last$row_focus = last === null || last === void 0 ? void 0 : last.row_focus) !== null && _last$row_focus !== void 0 ? _last$row_focus : last === null || last === void 0 ? void 0 : (_last$row = last.row) === null || _last$row === void 0 ? void 0 : _last$row[0]) !== null && _ref !== void 0 ? _ref : 0;
|
|
75144
|
+
var colIndex = (_ref2 = (_last$column_focus = last === null || last === void 0 ? void 0 : last.column_focus) !== null && _last$column_focus !== void 0 ? _last$column_focus : last === null || last === void 0 ? void 0 : (_last$column = last.column) === null || _last$column === void 0 ? void 0 : _last$column[0]) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
75145
|
+
var flowdata = getFlowdata(ctx);
|
|
75146
|
+
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
75147
|
+
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex - 1];
|
|
75148
|
+
if (flowdata) {
|
|
75149
|
+
var margeset = mergeBorder(ctx, flowdata, rowIndex, colIndex);
|
|
75150
|
+
if (margeset) {
|
|
75151
|
+
var _margeset$row = _slicedToArray(margeset.row, 1);
|
|
75152
|
+
top = _margeset$row[0];
|
|
75153
|
+
var _margeset$column = _slicedToArray(margeset.column, 1);
|
|
75154
|
+
left = _margeset$column[0];
|
|
75155
|
+
}
|
|
75156
|
+
}
|
|
75157
|
+
var iframe = {
|
|
75158
|
+
id: generateRandomId("iframe"),
|
|
75159
|
+
src: src,
|
|
75160
|
+
left: left,
|
|
75161
|
+
top: top,
|
|
75162
|
+
width: 400,
|
|
75163
|
+
height: 300
|
|
75164
|
+
};
|
|
75165
|
+
ctx.insertedIframes = (ctx.insertedIframes || []).concat(iframe);
|
|
75166
|
+
saveIframe(ctx);
|
|
75167
|
+
} catch (err) {
|
|
75168
|
+
console.info(err);
|
|
75169
|
+
}
|
|
75170
|
+
}
|
|
75171
|
+
function insertDuneChart(ctx, input) {
|
|
75172
|
+
var embedUrl = sanitizeDuneUrl(input);
|
|
75173
|
+
if (!embedUrl) {
|
|
75174
|
+
console.warn("Unsupported Dune chart URL:", input);
|
|
75175
|
+
return;
|
|
75176
|
+
}
|
|
75177
|
+
insertIframe(ctx, embedUrl);
|
|
75178
|
+
}
|
|
75179
|
+
function getIframePosition() {
|
|
75180
|
+
var box = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75181
|
+
if (!box) return undefined;
|
|
75182
|
+
var _box$getBoundingClien = box.getBoundingClientRect(),
|
|
75183
|
+
width = _box$getBoundingClien.width,
|
|
75184
|
+
height = _box$getBoundingClien.height;
|
|
75185
|
+
var left = box.offsetLeft;
|
|
75186
|
+
var top = box.offsetTop;
|
|
75187
|
+
return {
|
|
75188
|
+
left: left,
|
|
75189
|
+
top: top,
|
|
75190
|
+
width: width,
|
|
75191
|
+
height: height
|
|
75192
|
+
};
|
|
75193
|
+
}
|
|
75194
|
+
function onIframeResizeEnd(ctx, globalCache) {
|
|
75195
|
+
var _globalCache$iframe;
|
|
75196
|
+
if ((_globalCache$iframe = globalCache.iframe) === null || _globalCache$iframe === void 0 ? void 0 : _globalCache$iframe.resizingSide) {
|
|
75197
|
+
globalCache.iframe = undefined;
|
|
75198
|
+
var position = getIframePosition();
|
|
75199
|
+
if (position) {
|
|
75200
|
+
var iframe = _.find(ctx.insertedIframes, function (v) {
|
|
75201
|
+
return v.id === ctx.activeIframe;
|
|
75202
|
+
});
|
|
75203
|
+
if (iframe) {
|
|
75204
|
+
iframe.left = position.left / ctx.zoomRatio;
|
|
75205
|
+
iframe.top = position.top / ctx.zoomRatio;
|
|
75206
|
+
iframe.width = position.width / ctx.zoomRatio;
|
|
75207
|
+
iframe.height = position.height / ctx.zoomRatio;
|
|
75208
|
+
saveIframe(ctx);
|
|
75209
|
+
}
|
|
75210
|
+
}
|
|
75211
|
+
}
|
|
75212
|
+
}
|
|
75213
|
+
function onIframeMove(ctx, globalCache, e) {
|
|
75214
|
+
if (ctx.allowEdit === false) return false;
|
|
75215
|
+
var iframe = globalCache === null || globalCache === void 0 ? void 0 : globalCache.iframe;
|
|
75216
|
+
var el = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75217
|
+
if (el && iframe && !iframe.resizingSide) {
|
|
75218
|
+
var _iframe$cursorMoveSta = iframe.cursorMoveStartPosition,
|
|
75219
|
+
startX = _iframe$cursorMoveSta.x,
|
|
75220
|
+
startY = _iframe$cursorMoveSta.y;
|
|
75221
|
+
var _iframe$iframeInitial = iframe.iframeInitialPosition,
|
|
75222
|
+
top = _iframe$iframeInitial.top,
|
|
75223
|
+
left = _iframe$iframeInitial.left;
|
|
75224
|
+
left += e.pageX - startX;
|
|
75225
|
+
top += e.pageY - startY;
|
|
75226
|
+
if (top < 0) top = 0;
|
|
75227
|
+
el.style.left = "".concat(left, "px");
|
|
75228
|
+
el.style.top = "".concat(top, "px");
|
|
75229
|
+
return true;
|
|
75230
|
+
}
|
|
75231
|
+
return false;
|
|
75232
|
+
}
|
|
75233
|
+
function onIframeMoveEnd(ctx, globalCache) {
|
|
75234
|
+
var _globalCache$iframe2;
|
|
75235
|
+
var position = getIframePosition();
|
|
75236
|
+
if (!((_globalCache$iframe2 = globalCache.iframe) === null || _globalCache$iframe2 === void 0 ? void 0 : _globalCache$iframe2.resizingSide)) {
|
|
75237
|
+
globalCache.iframe = undefined;
|
|
75238
|
+
if (position) {
|
|
75239
|
+
var iframe = _.find(ctx.insertedIframes, function (v) {
|
|
75240
|
+
return v.id === ctx.activeIframe;
|
|
75241
|
+
});
|
|
75242
|
+
if (iframe) {
|
|
75243
|
+
iframe.left = position.left / ctx.zoomRatio;
|
|
75244
|
+
iframe.top = position.top / ctx.zoomRatio;
|
|
75245
|
+
saveIframe(ctx);
|
|
75246
|
+
}
|
|
75247
|
+
}
|
|
75248
|
+
}
|
|
75249
|
+
}
|
|
75250
|
+
function onIframeMoveWrapped(e) {
|
|
75251
|
+
onIframeMove(sharedCtx, sharedGlobalCache, e);
|
|
75252
|
+
}
|
|
75253
|
+
function onIframeMoveEndWrapped() {
|
|
75254
|
+
onIframeMoveEnd(sharedCtx, sharedGlobalCache);
|
|
75255
|
+
document.removeEventListener("mousemove", onIframeMoveWrapped);
|
|
75256
|
+
document.removeEventListener("mouseup", onIframeMoveEndWrapped);
|
|
75257
|
+
}
|
|
75258
|
+
function onIframeMoveStart(ctx, globalCache, e) {
|
|
75259
|
+
var position = getIframePosition();
|
|
75260
|
+
if (position) {
|
|
75261
|
+
var top = position.top,
|
|
75262
|
+
left = position.left;
|
|
75263
|
+
_.set(globalCache, "iframe", {
|
|
75264
|
+
cursorMoveStartPosition: {
|
|
75265
|
+
x: e.pageX,
|
|
75266
|
+
y: e.pageY
|
|
75267
|
+
},
|
|
75268
|
+
iframeInitialPosition: {
|
|
75269
|
+
left: left,
|
|
75270
|
+
top: top
|
|
75271
|
+
}
|
|
75272
|
+
});
|
|
75273
|
+
sharedCtx = ctx;
|
|
75274
|
+
sharedGlobalCache = globalCache;
|
|
75275
|
+
document.addEventListener("mousemove", onIframeMoveWrapped);
|
|
75276
|
+
document.addEventListener("mouseup", onIframeMoveEndWrapped);
|
|
75277
|
+
}
|
|
75278
|
+
}
|
|
75279
|
+
function onIframeResize(ctx, globalCache, e) {
|
|
75280
|
+
if (ctx.allowEdit === false) return false;
|
|
75281
|
+
var iframe = globalCache === null || globalCache === void 0 ? void 0 : globalCache.iframe;
|
|
75282
|
+
if (!(iframe === null || iframe === void 0 ? void 0 : iframe.resizingSide)) return false;
|
|
75283
|
+
var container = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75284
|
+
var content = container === null || container === void 0 ? void 0 : container.querySelector(".luckysheet-modal-dialog-content");
|
|
75285
|
+
if (!container || !content) return false;
|
|
75286
|
+
var _iframe$cursorMoveSta2 = iframe.cursorMoveStartPosition,
|
|
75287
|
+
startX = _iframe$cursorMoveSta2.x,
|
|
75288
|
+
startY = _iframe$cursorMoveSta2.y;
|
|
75289
|
+
var _iframe$iframeInitial2 = iframe.iframeInitialPosition,
|
|
75290
|
+
top = _iframe$iframeInitial2.top,
|
|
75291
|
+
left = _iframe$iframeInitial2.left,
|
|
75292
|
+
width = _iframe$iframeInitial2.width,
|
|
75293
|
+
height = _iframe$iframeInitial2.height;
|
|
75294
|
+
var dx = e.pageX - startX;
|
|
75295
|
+
var dy = e.pageY - startY;
|
|
75296
|
+
var minHeight = 60 * ctx.zoomRatio;
|
|
75297
|
+
var minWidth = 90 * ctx.zoomRatio;
|
|
75298
|
+
if (["lm", "lt", "lb"].includes(iframe.resizingSide)) {
|
|
75299
|
+
if (width - dx < minWidth) {
|
|
75300
|
+
left += width - minWidth;
|
|
75301
|
+
width = minWidth;
|
|
75302
|
+
} else {
|
|
75303
|
+
left += dx;
|
|
75304
|
+
width -= dx;
|
|
75305
|
+
}
|
|
75306
|
+
if (left < 0) left = 0;
|
|
75307
|
+
container.style.left = "".concat(left, "px");
|
|
75308
|
+
}
|
|
75309
|
+
if (["rm", "rt", "rb"].includes(iframe.resizingSide)) {
|
|
75310
|
+
width = width + dx < minWidth ? minWidth : width + dx;
|
|
75311
|
+
}
|
|
75312
|
+
if (["mt", "lt", "rt"].includes(iframe.resizingSide)) {
|
|
75313
|
+
if (height - dy < minHeight) {
|
|
75314
|
+
top += height - minHeight;
|
|
75315
|
+
height = minHeight;
|
|
75316
|
+
} else {
|
|
75317
|
+
top += dy;
|
|
75318
|
+
height -= dy;
|
|
75319
|
+
}
|
|
75320
|
+
if (top < 0) top = 0;
|
|
75321
|
+
container.style.top = "".concat(top, "px");
|
|
75322
|
+
}
|
|
75323
|
+
if (["mb", "lb", "rb"].includes(iframe.resizingSide)) {
|
|
75324
|
+
height = height + dy < minHeight ? minHeight : height + dy;
|
|
75325
|
+
}
|
|
75326
|
+
container.style.width = "".concat(width, "px");
|
|
75327
|
+
container.style.height = "".concat(height, "px");
|
|
75328
|
+
content.style.width = "".concat(width, "px");
|
|
75329
|
+
content.style.height = "".concat(height, "px");
|
|
75330
|
+
return true;
|
|
75331
|
+
}
|
|
75332
|
+
function onIframeResizeWrapped(e) {
|
|
75333
|
+
onIframeResize(sharedCtx, sharedGlobalCache, e);
|
|
75334
|
+
}
|
|
75335
|
+
function onIframeResizeEndWrapped() {
|
|
75336
|
+
onIframeResizeEnd(sharedCtx, sharedGlobalCache);
|
|
75337
|
+
document.removeEventListener("mousemove", onIframeResizeWrapped);
|
|
75338
|
+
document.removeEventListener("mouseup", onIframeResizeEndWrapped);
|
|
75339
|
+
}
|
|
75340
|
+
function onIframeResizeStart(ctx, globalCache, e, resizingSide) {
|
|
75341
|
+
var position = getIframePosition();
|
|
75342
|
+
if (position) {
|
|
75343
|
+
_.set(globalCache, "iframe", {
|
|
75344
|
+
cursorMoveStartPosition: {
|
|
75345
|
+
x: e.pageX,
|
|
75346
|
+
y: e.pageY
|
|
75347
|
+
},
|
|
75348
|
+
resizingSide: resizingSide,
|
|
75349
|
+
iframeInitialPosition: position
|
|
75350
|
+
});
|
|
75351
|
+
sharedCtx = ctx;
|
|
75352
|
+
sharedGlobalCache = globalCache;
|
|
75353
|
+
document.addEventListener("mousemove", onIframeResizeWrapped);
|
|
75354
|
+
document.addEventListener("mouseup", onIframeResizeEndWrapped);
|
|
75355
|
+
}
|
|
75356
|
+
}
|
|
75357
|
+
|
|
75107
75358
|
var addtionalMergeOps = function addtionalMergeOps(ops, id) {
|
|
75108
75359
|
var merge_new = {};
|
|
75109
75360
|
ops.some(function (op) {
|
|
@@ -79892,6 +80143,26 @@ function handlePaste(ctx, e) {
|
|
|
79892
80143
|
handleFormulaStringPaste(ctx, txtdata);
|
|
79893
80144
|
} else {
|
|
79894
80145
|
pasteHandler(ctx, txtdata);
|
|
80146
|
+
var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
|
|
80147
|
+
var embedUrl = sanitizeDuneUrl(_txtdata);
|
|
80148
|
+
if (embedUrl) {
|
|
80149
|
+
var _ctx$luckysheet_selec8;
|
|
80150
|
+
var last = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[ctx.luckysheet_select_save.length - 1];
|
|
80151
|
+
if (last) {
|
|
80152
|
+
var _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
|
|
80153
|
+
var rowIndex = (_ref = (_last$row_focus = last.row_focus) !== null && _last$row_focus !== void 0 ? _last$row_focus : (_last$row = last.row) === null || _last$row === void 0 ? void 0 : _last$row[0]) !== null && _ref !== void 0 ? _ref : 0;
|
|
80154
|
+
var colIndex = (_ref2 = (_last$column_focus = last.column_focus) !== null && _last$column_focus !== void 0 ? _last$column_focus : (_last$column = last.column) === null || _last$column === void 0 ? void 0 : _last$column[0]) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
80155
|
+
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
80156
|
+
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
|
|
80157
|
+
ctx.showDunePreview = {
|
|
80158
|
+
url: txtdata,
|
|
80159
|
+
position: {
|
|
80160
|
+
left: left,
|
|
80161
|
+
top: top
|
|
80162
|
+
}
|
|
80163
|
+
};
|
|
80164
|
+
}
|
|
80165
|
+
}
|
|
79895
80166
|
}
|
|
79896
80167
|
}
|
|
79897
80168
|
}
|
|
@@ -79936,4 +80207,4 @@ function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
|
79936
80207
|
} else ;
|
|
79937
80208
|
}
|
|
79938
80209
|
|
|
79939
|
-
export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFreezeState, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, removeOverShowComment, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropdownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toggleFreeze, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
|
|
80210
|
+
export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFreezeState, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertDuneChart, insertIframe, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onIframeMove, onIframeMoveEnd, onIframeMoveStart, onIframeResize, onIframeResizeEnd, onIframeResizeStart, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, removeOverShowComment, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, sanitizeDuneUrl, saveFilter, saveHyperlink, saveIframe, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropdownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toggleFreeze, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
|
package/dist/index.js
CHANGED
|
@@ -62838,6 +62838,13 @@ function defaultContext(refs) {
|
|
|
62838
62838
|
addDefaultRows: 50,
|
|
62839
62839
|
fullscreenmode: true,
|
|
62840
62840
|
devicePixelRatio: (globalThis || window).devicePixelRatio,
|
|
62841
|
+
showDunePreview: {
|
|
62842
|
+
url: "",
|
|
62843
|
+
position: {
|
|
62844
|
+
left: 0,
|
|
62845
|
+
top: 0
|
|
62846
|
+
}
|
|
62847
|
+
},
|
|
62841
62848
|
contextMenu: {},
|
|
62842
62849
|
sheetTabContextMenu: {},
|
|
62843
62850
|
currentSheetId: "",
|
|
@@ -63040,6 +63047,8 @@ function defaultContext(refs) {
|
|
|
63040
63047
|
luckysheet_shiftpositon: undefined,
|
|
63041
63048
|
iscopyself: true,
|
|
63042
63049
|
activeImg: undefined,
|
|
63050
|
+
insertedIframes: [],
|
|
63051
|
+
activeIframe: undefined,
|
|
63043
63052
|
orderbyindex: 0,
|
|
63044
63053
|
luckysheet_model_move_state: false,
|
|
63045
63054
|
luckysheet_model_xy: [0, 0],
|
|
@@ -75114,6 +75123,248 @@ function handleKeydownForZoom(ev, currentZoom) {
|
|
|
75114
75123
|
return parseFloat(zoom.toFixed(1));
|
|
75115
75124
|
}
|
|
75116
75125
|
|
|
75126
|
+
function sanitizeDuneUrl(input) {
|
|
75127
|
+
var trimmed = input.trim();
|
|
75128
|
+
var iframeMatch = trimmed.match(/src=["']?(https:\/\/dune\.com\/embeds\/\d+\/\d+)/);
|
|
75129
|
+
if (iframeMatch) {
|
|
75130
|
+
return iframeMatch[1];
|
|
75131
|
+
}
|
|
75132
|
+
var queryMatch = trimmed.match(/^https:\/\/dune\.com\/queries\/(\d+)\/(\d+)/);
|
|
75133
|
+
if (queryMatch) {
|
|
75134
|
+
var _queryMatch = _slicedToArray(queryMatch, 3),
|
|
75135
|
+
queryId = _queryMatch[1],
|
|
75136
|
+
vizId = _queryMatch[2];
|
|
75137
|
+
return "https://dune.com/embeds/".concat(queryId, "/").concat(vizId);
|
|
75138
|
+
}
|
|
75139
|
+
return null;
|
|
75140
|
+
}
|
|
75141
|
+
var sharedCtx;
|
|
75142
|
+
var sharedGlobalCache;
|
|
75143
|
+
function saveIframe(ctx) {
|
|
75144
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
75145
|
+
if (index == null) return;
|
|
75146
|
+
var file = ctx.luckysheetfile[index];
|
|
75147
|
+
file.iframes = ctx.insertedIframes;
|
|
75148
|
+
}
|
|
75149
|
+
function insertIframe(ctx, src) {
|
|
75150
|
+
try {
|
|
75151
|
+
var _ctx$luckysheet_selec, _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
|
|
75152
|
+
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
75153
|
+
var rowIndex = (_ref = (_last$row_focus = last === null || last === void 0 ? void 0 : last.row_focus) !== null && _last$row_focus !== void 0 ? _last$row_focus : last === null || last === void 0 ? void 0 : (_last$row = last.row) === null || _last$row === void 0 ? void 0 : _last$row[0]) !== null && _ref !== void 0 ? _ref : 0;
|
|
75154
|
+
var colIndex = (_ref2 = (_last$column_focus = last === null || last === void 0 ? void 0 : last.column_focus) !== null && _last$column_focus !== void 0 ? _last$column_focus : last === null || last === void 0 ? void 0 : (_last$column = last.column) === null || _last$column === void 0 ? void 0 : _last$column[0]) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
75155
|
+
var flowdata = getFlowdata(ctx);
|
|
75156
|
+
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
75157
|
+
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex - 1];
|
|
75158
|
+
if (flowdata) {
|
|
75159
|
+
var margeset = mergeBorder(ctx, flowdata, rowIndex, colIndex);
|
|
75160
|
+
if (margeset) {
|
|
75161
|
+
var _margeset$row = _slicedToArray(margeset.row, 1);
|
|
75162
|
+
top = _margeset$row[0];
|
|
75163
|
+
var _margeset$column = _slicedToArray(margeset.column, 1);
|
|
75164
|
+
left = _margeset$column[0];
|
|
75165
|
+
}
|
|
75166
|
+
}
|
|
75167
|
+
var iframe = {
|
|
75168
|
+
id: generateRandomId("iframe"),
|
|
75169
|
+
src: src,
|
|
75170
|
+
left: left,
|
|
75171
|
+
top: top,
|
|
75172
|
+
width: 400,
|
|
75173
|
+
height: 300
|
|
75174
|
+
};
|
|
75175
|
+
ctx.insertedIframes = (ctx.insertedIframes || []).concat(iframe);
|
|
75176
|
+
saveIframe(ctx);
|
|
75177
|
+
} catch (err) {
|
|
75178
|
+
console.info(err);
|
|
75179
|
+
}
|
|
75180
|
+
}
|
|
75181
|
+
function insertDuneChart(ctx, input) {
|
|
75182
|
+
var embedUrl = sanitizeDuneUrl(input);
|
|
75183
|
+
if (!embedUrl) {
|
|
75184
|
+
console.warn("Unsupported Dune chart URL:", input);
|
|
75185
|
+
return;
|
|
75186
|
+
}
|
|
75187
|
+
insertIframe(ctx, embedUrl);
|
|
75188
|
+
}
|
|
75189
|
+
function getIframePosition() {
|
|
75190
|
+
var box = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75191
|
+
if (!box) return undefined;
|
|
75192
|
+
var _box$getBoundingClien = box.getBoundingClientRect(),
|
|
75193
|
+
width = _box$getBoundingClien.width,
|
|
75194
|
+
height = _box$getBoundingClien.height;
|
|
75195
|
+
var left = box.offsetLeft;
|
|
75196
|
+
var top = box.offsetTop;
|
|
75197
|
+
return {
|
|
75198
|
+
left: left,
|
|
75199
|
+
top: top,
|
|
75200
|
+
width: width,
|
|
75201
|
+
height: height
|
|
75202
|
+
};
|
|
75203
|
+
}
|
|
75204
|
+
function onIframeResizeEnd(ctx, globalCache) {
|
|
75205
|
+
var _globalCache$iframe;
|
|
75206
|
+
if ((_globalCache$iframe = globalCache.iframe) === null || _globalCache$iframe === void 0 ? void 0 : _globalCache$iframe.resizingSide) {
|
|
75207
|
+
globalCache.iframe = undefined;
|
|
75208
|
+
var position = getIframePosition();
|
|
75209
|
+
if (position) {
|
|
75210
|
+
var iframe = ___default['default'].find(ctx.insertedIframes, function (v) {
|
|
75211
|
+
return v.id === ctx.activeIframe;
|
|
75212
|
+
});
|
|
75213
|
+
if (iframe) {
|
|
75214
|
+
iframe.left = position.left / ctx.zoomRatio;
|
|
75215
|
+
iframe.top = position.top / ctx.zoomRatio;
|
|
75216
|
+
iframe.width = position.width / ctx.zoomRatio;
|
|
75217
|
+
iframe.height = position.height / ctx.zoomRatio;
|
|
75218
|
+
saveIframe(ctx);
|
|
75219
|
+
}
|
|
75220
|
+
}
|
|
75221
|
+
}
|
|
75222
|
+
}
|
|
75223
|
+
function onIframeMove(ctx, globalCache, e) {
|
|
75224
|
+
if (ctx.allowEdit === false) return false;
|
|
75225
|
+
var iframe = globalCache === null || globalCache === void 0 ? void 0 : globalCache.iframe;
|
|
75226
|
+
var el = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75227
|
+
if (el && iframe && !iframe.resizingSide) {
|
|
75228
|
+
var _iframe$cursorMoveSta = iframe.cursorMoveStartPosition,
|
|
75229
|
+
startX = _iframe$cursorMoveSta.x,
|
|
75230
|
+
startY = _iframe$cursorMoveSta.y;
|
|
75231
|
+
var _iframe$iframeInitial = iframe.iframeInitialPosition,
|
|
75232
|
+
top = _iframe$iframeInitial.top,
|
|
75233
|
+
left = _iframe$iframeInitial.left;
|
|
75234
|
+
left += e.pageX - startX;
|
|
75235
|
+
top += e.pageY - startY;
|
|
75236
|
+
if (top < 0) top = 0;
|
|
75237
|
+
el.style.left = "".concat(left, "px");
|
|
75238
|
+
el.style.top = "".concat(top, "px");
|
|
75239
|
+
return true;
|
|
75240
|
+
}
|
|
75241
|
+
return false;
|
|
75242
|
+
}
|
|
75243
|
+
function onIframeMoveEnd(ctx, globalCache) {
|
|
75244
|
+
var _globalCache$iframe2;
|
|
75245
|
+
var position = getIframePosition();
|
|
75246
|
+
if (!((_globalCache$iframe2 = globalCache.iframe) === null || _globalCache$iframe2 === void 0 ? void 0 : _globalCache$iframe2.resizingSide)) {
|
|
75247
|
+
globalCache.iframe = undefined;
|
|
75248
|
+
if (position) {
|
|
75249
|
+
var iframe = ___default['default'].find(ctx.insertedIframes, function (v) {
|
|
75250
|
+
return v.id === ctx.activeIframe;
|
|
75251
|
+
});
|
|
75252
|
+
if (iframe) {
|
|
75253
|
+
iframe.left = position.left / ctx.zoomRatio;
|
|
75254
|
+
iframe.top = position.top / ctx.zoomRatio;
|
|
75255
|
+
saveIframe(ctx);
|
|
75256
|
+
}
|
|
75257
|
+
}
|
|
75258
|
+
}
|
|
75259
|
+
}
|
|
75260
|
+
function onIframeMoveWrapped(e) {
|
|
75261
|
+
onIframeMove(sharedCtx, sharedGlobalCache, e);
|
|
75262
|
+
}
|
|
75263
|
+
function onIframeMoveEndWrapped() {
|
|
75264
|
+
onIframeMoveEnd(sharedCtx, sharedGlobalCache);
|
|
75265
|
+
document.removeEventListener("mousemove", onIframeMoveWrapped);
|
|
75266
|
+
document.removeEventListener("mouseup", onIframeMoveEndWrapped);
|
|
75267
|
+
}
|
|
75268
|
+
function onIframeMoveStart(ctx, globalCache, e) {
|
|
75269
|
+
var position = getIframePosition();
|
|
75270
|
+
if (position) {
|
|
75271
|
+
var top = position.top,
|
|
75272
|
+
left = position.left;
|
|
75273
|
+
___default['default'].set(globalCache, "iframe", {
|
|
75274
|
+
cursorMoveStartPosition: {
|
|
75275
|
+
x: e.pageX,
|
|
75276
|
+
y: e.pageY
|
|
75277
|
+
},
|
|
75278
|
+
iframeInitialPosition: {
|
|
75279
|
+
left: left,
|
|
75280
|
+
top: top
|
|
75281
|
+
}
|
|
75282
|
+
});
|
|
75283
|
+
sharedCtx = ctx;
|
|
75284
|
+
sharedGlobalCache = globalCache;
|
|
75285
|
+
document.addEventListener("mousemove", onIframeMoveWrapped);
|
|
75286
|
+
document.addEventListener("mouseup", onIframeMoveEndWrapped);
|
|
75287
|
+
}
|
|
75288
|
+
}
|
|
75289
|
+
function onIframeResize(ctx, globalCache, e) {
|
|
75290
|
+
if (ctx.allowEdit === false) return false;
|
|
75291
|
+
var iframe = globalCache === null || globalCache === void 0 ? void 0 : globalCache.iframe;
|
|
75292
|
+
if (!(iframe === null || iframe === void 0 ? void 0 : iframe.resizingSide)) return false;
|
|
75293
|
+
var container = document.getElementById("fortune-modal-dialog-activeIframe");
|
|
75294
|
+
var content = container === null || container === void 0 ? void 0 : container.querySelector(".luckysheet-modal-dialog-content");
|
|
75295
|
+
if (!container || !content) return false;
|
|
75296
|
+
var _iframe$cursorMoveSta2 = iframe.cursorMoveStartPosition,
|
|
75297
|
+
startX = _iframe$cursorMoveSta2.x,
|
|
75298
|
+
startY = _iframe$cursorMoveSta2.y;
|
|
75299
|
+
var _iframe$iframeInitial2 = iframe.iframeInitialPosition,
|
|
75300
|
+
top = _iframe$iframeInitial2.top,
|
|
75301
|
+
left = _iframe$iframeInitial2.left,
|
|
75302
|
+
width = _iframe$iframeInitial2.width,
|
|
75303
|
+
height = _iframe$iframeInitial2.height;
|
|
75304
|
+
var dx = e.pageX - startX;
|
|
75305
|
+
var dy = e.pageY - startY;
|
|
75306
|
+
var minHeight = 60 * ctx.zoomRatio;
|
|
75307
|
+
var minWidth = 90 * ctx.zoomRatio;
|
|
75308
|
+
if (["lm", "lt", "lb"].includes(iframe.resizingSide)) {
|
|
75309
|
+
if (width - dx < minWidth) {
|
|
75310
|
+
left += width - minWidth;
|
|
75311
|
+
width = minWidth;
|
|
75312
|
+
} else {
|
|
75313
|
+
left += dx;
|
|
75314
|
+
width -= dx;
|
|
75315
|
+
}
|
|
75316
|
+
if (left < 0) left = 0;
|
|
75317
|
+
container.style.left = "".concat(left, "px");
|
|
75318
|
+
}
|
|
75319
|
+
if (["rm", "rt", "rb"].includes(iframe.resizingSide)) {
|
|
75320
|
+
width = width + dx < minWidth ? minWidth : width + dx;
|
|
75321
|
+
}
|
|
75322
|
+
if (["mt", "lt", "rt"].includes(iframe.resizingSide)) {
|
|
75323
|
+
if (height - dy < minHeight) {
|
|
75324
|
+
top += height - minHeight;
|
|
75325
|
+
height = minHeight;
|
|
75326
|
+
} else {
|
|
75327
|
+
top += dy;
|
|
75328
|
+
height -= dy;
|
|
75329
|
+
}
|
|
75330
|
+
if (top < 0) top = 0;
|
|
75331
|
+
container.style.top = "".concat(top, "px");
|
|
75332
|
+
}
|
|
75333
|
+
if (["mb", "lb", "rb"].includes(iframe.resizingSide)) {
|
|
75334
|
+
height = height + dy < minHeight ? minHeight : height + dy;
|
|
75335
|
+
}
|
|
75336
|
+
container.style.width = "".concat(width, "px");
|
|
75337
|
+
container.style.height = "".concat(height, "px");
|
|
75338
|
+
content.style.width = "".concat(width, "px");
|
|
75339
|
+
content.style.height = "".concat(height, "px");
|
|
75340
|
+
return true;
|
|
75341
|
+
}
|
|
75342
|
+
function onIframeResizeWrapped(e) {
|
|
75343
|
+
onIframeResize(sharedCtx, sharedGlobalCache, e);
|
|
75344
|
+
}
|
|
75345
|
+
function onIframeResizeEndWrapped() {
|
|
75346
|
+
onIframeResizeEnd(sharedCtx, sharedGlobalCache);
|
|
75347
|
+
document.removeEventListener("mousemove", onIframeResizeWrapped);
|
|
75348
|
+
document.removeEventListener("mouseup", onIframeResizeEndWrapped);
|
|
75349
|
+
}
|
|
75350
|
+
function onIframeResizeStart(ctx, globalCache, e, resizingSide) {
|
|
75351
|
+
var position = getIframePosition();
|
|
75352
|
+
if (position) {
|
|
75353
|
+
___default['default'].set(globalCache, "iframe", {
|
|
75354
|
+
cursorMoveStartPosition: {
|
|
75355
|
+
x: e.pageX,
|
|
75356
|
+
y: e.pageY
|
|
75357
|
+
},
|
|
75358
|
+
resizingSide: resizingSide,
|
|
75359
|
+
iframeInitialPosition: position
|
|
75360
|
+
});
|
|
75361
|
+
sharedCtx = ctx;
|
|
75362
|
+
sharedGlobalCache = globalCache;
|
|
75363
|
+
document.addEventListener("mousemove", onIframeResizeWrapped);
|
|
75364
|
+
document.addEventListener("mouseup", onIframeResizeEndWrapped);
|
|
75365
|
+
}
|
|
75366
|
+
}
|
|
75367
|
+
|
|
75117
75368
|
var addtionalMergeOps = function addtionalMergeOps(ops, id) {
|
|
75118
75369
|
var merge_new = {};
|
|
75119
75370
|
ops.some(function (op) {
|
|
@@ -79902,6 +80153,26 @@ function handlePaste(ctx, e) {
|
|
|
79902
80153
|
handleFormulaStringPaste(ctx, txtdata);
|
|
79903
80154
|
} else {
|
|
79904
80155
|
pasteHandler(ctx, txtdata);
|
|
80156
|
+
var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
|
|
80157
|
+
var embedUrl = sanitizeDuneUrl(_txtdata);
|
|
80158
|
+
if (embedUrl) {
|
|
80159
|
+
var _ctx$luckysheet_selec8;
|
|
80160
|
+
var last = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[ctx.luckysheet_select_save.length - 1];
|
|
80161
|
+
if (last) {
|
|
80162
|
+
var _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
|
|
80163
|
+
var rowIndex = (_ref = (_last$row_focus = last.row_focus) !== null && _last$row_focus !== void 0 ? _last$row_focus : (_last$row = last.row) === null || _last$row === void 0 ? void 0 : _last$row[0]) !== null && _ref !== void 0 ? _ref : 0;
|
|
80164
|
+
var colIndex = (_ref2 = (_last$column_focus = last.column_focus) !== null && _last$column_focus !== void 0 ? _last$column_focus : (_last$column = last.column) === null || _last$column === void 0 ? void 0 : _last$column[0]) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
80165
|
+
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
80166
|
+
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
|
|
80167
|
+
ctx.showDunePreview = {
|
|
80168
|
+
url: txtdata,
|
|
80169
|
+
position: {
|
|
80170
|
+
left: left,
|
|
80171
|
+
top: top
|
|
80172
|
+
}
|
|
80173
|
+
};
|
|
80174
|
+
}
|
|
80175
|
+
}
|
|
79905
80176
|
}
|
|
79906
80177
|
}
|
|
79907
80178
|
}
|
|
@@ -80142,6 +80413,8 @@ exports.initFreeze = initFreeze;
|
|
|
80142
80413
|
exports.initSheetIndex = initSheetIndex;
|
|
80143
80414
|
exports.inlineStyleAffectAttribute = inlineStyleAffectAttribute;
|
|
80144
80415
|
exports.inlineStyleAffectCssName = inlineStyleAffectCssName;
|
|
80416
|
+
exports.insertDuneChart = insertDuneChart;
|
|
80417
|
+
exports.insertIframe = insertIframe;
|
|
80145
80418
|
exports.insertImage = insertImage;
|
|
80146
80419
|
exports.insertRowCol = insertRowCol;
|
|
80147
80420
|
exports.insertUpdateFunctionGroup = insertUpdateFunctionGroup;
|
|
@@ -80188,6 +80461,12 @@ exports.onCommentBoxResizeStart = onCommentBoxResizeStart;
|
|
|
80188
80461
|
exports.onDropCellSelect = onDropCellSelect;
|
|
80189
80462
|
exports.onDropCellSelectEnd = onDropCellSelectEnd;
|
|
80190
80463
|
exports.onFormulaRangeDragEnd = onFormulaRangeDragEnd;
|
|
80464
|
+
exports.onIframeMove = onIframeMove;
|
|
80465
|
+
exports.onIframeMoveEnd = onIframeMoveEnd;
|
|
80466
|
+
exports.onIframeMoveStart = onIframeMoveStart;
|
|
80467
|
+
exports.onIframeResize = onIframeResize;
|
|
80468
|
+
exports.onIframeResizeEnd = onIframeResizeEnd;
|
|
80469
|
+
exports.onIframeResizeStart = onIframeResizeStart;
|
|
80191
80470
|
exports.onImageMove = onImageMove;
|
|
80192
80471
|
exports.onImageMoveEnd = onImageMoveEnd;
|
|
80193
80472
|
exports.onImageMoveStart = onImageMoveStart;
|
|
@@ -80223,8 +80502,10 @@ exports.rgbToHex = rgbToHex;
|
|
|
80223
80502
|
exports.rowHasMerged = rowHasMerged;
|
|
80224
80503
|
exports.rowLocation = rowLocation;
|
|
80225
80504
|
exports.rowLocationByIndex = rowLocationByIndex;
|
|
80505
|
+
exports.sanitizeDuneUrl = sanitizeDuneUrl;
|
|
80226
80506
|
exports.saveFilter = saveFilter;
|
|
80227
80507
|
exports.saveHyperlink = saveHyperlink;
|
|
80508
|
+
exports.saveIframe = saveIframe;
|
|
80228
80509
|
exports.saveImage = saveImage;
|
|
80229
80510
|
exports.scrollToFrozenRowCol = scrollToFrozenRowCol;
|
|
80230
80511
|
exports.scrollToHighlightCell = scrollToHighlightCell;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
import { GlobalCache } from "../types";
|
|
3
|
+
export declare function sanitizeDuneUrl(input: string): string | null;
|
|
4
|
+
export declare function saveIframe(ctx: Context): void;
|
|
5
|
+
export declare function insertIframe(ctx: Context, src: string): void;
|
|
6
|
+
export declare function insertDuneChart(ctx: Context, input: string): void;
|
|
7
|
+
export declare function onIframeResizeEnd(ctx: Context, globalCache: GlobalCache): void;
|
|
8
|
+
export declare function onIframeMove(ctx: Context, globalCache: GlobalCache, e: MouseEvent): boolean;
|
|
9
|
+
export declare function onIframeMoveEnd(ctx: Context, globalCache: GlobalCache): void;
|
|
10
|
+
export declare function onIframeMoveStart(ctx: Context, globalCache: GlobalCache, e: MouseEvent): void;
|
|
11
|
+
export declare function onIframeResize(ctx: Context, globalCache: GlobalCache, e: MouseEvent): boolean;
|
|
12
|
+
export declare function onIframeResizeStart(ctx: Context, globalCache: GlobalCache, e: MouseEvent, resizingSide: string): void;
|
package/dist/modules/index.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -130,6 +130,14 @@ export type Sheet = {
|
|
|
130
130
|
celldata?: CellWithRowAndCol[];
|
|
131
131
|
id?: string;
|
|
132
132
|
images?: Image[];
|
|
133
|
+
iframes?: {
|
|
134
|
+
id: string;
|
|
135
|
+
src: string;
|
|
136
|
+
left: number;
|
|
137
|
+
top: number;
|
|
138
|
+
width: number;
|
|
139
|
+
height: number;
|
|
140
|
+
}[];
|
|
133
141
|
zoomRatio?: number;
|
|
134
142
|
column?: number;
|
|
135
143
|
row?: number;
|
|
@@ -295,6 +303,14 @@ export type GlobalCache = {
|
|
|
295
303
|
} | undefined;
|
|
296
304
|
resizingSide: string | undefined;
|
|
297
305
|
};
|
|
306
|
+
iframe?: {
|
|
307
|
+
iframeInitialPosition: Rect | undefined;
|
|
308
|
+
cursorMoveStartPosition: {
|
|
309
|
+
x: number;
|
|
310
|
+
y: number;
|
|
311
|
+
} | undefined;
|
|
312
|
+
resizingSide: string | undefined;
|
|
313
|
+
};
|
|
298
314
|
commentBox?: {
|
|
299
315
|
movingId: string | undefined;
|
|
300
316
|
resizingId: string | undefined;
|