@fileverse-dev/fortune-core 1.0.2-mod-40 → 1.0.2-mod-41-patch-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.
@@ -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
@@ -3739,21 +3739,21 @@ var en = {
3739
3739
  p: [{
3740
3740
  name: "start_date",
3741
3741
  detail: "The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.",
3742
- example: "DATE(1969",
3742
+ example: "\"1969-07-16\"",
3743
3743
  require: "m",
3744
3744
  repeat: "n",
3745
3745
  type: "rangeall"
3746
3746
  }, {
3747
3747
  name: "end_date",
3748
3748
  detail: "The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.",
3749
- example: "7",
3749
+ example: "\"1969-07-24\"",
3750
3750
  require: "m",
3751
3751
  repeat: "n",
3752
3752
  type: "rangeall"
3753
3753
  }, {
3754
3754
  name: "unit",
3755
3755
  detail: 'A string abbreviation for unit of time. For example, "M" for month. Accepted values are "Y","M","D","MD","YM","YD".',
3756
- example: "16)",
3756
+ example: "\"D\"",
3757
3757
  require: "m",
3758
3758
  repeat: "n",
3759
3759
  type: "rangeall"
@@ -10415,7 +10415,7 @@ var en = {
10415
10415
  selectCellRange2: "Please select a range of cells",
10416
10416
  verificationCondition: "Verification condition",
10417
10417
  allowMultiSelect: "Allow multiple selection",
10418
- dropdown: "drop-down list",
10418
+ dropdown: "Dropdown list",
10419
10419
  checkbox: "Checkbox",
10420
10420
  number: "Number",
10421
10421
  number_integer: "Number-integer",
@@ -10424,10 +10424,10 @@ var en = {
10424
10424
  text_length: "Text-length",
10425
10425
  date: "Date",
10426
10426
  validity: "Effectiveness",
10427
- placeholder1: "Please enter the options, separated by commas, such as 1,2,3,4,5",
10428
- placeholder2: "Please enter content",
10427
+ placeholder1: "Enter the options, separated by comma",
10428
+ placeholder2: "Enter content",
10429
10429
  placeholder3: "Numeric value, such as 10",
10430
- placeholder4: "Please enter the specified text",
10430
+ placeholder4: "Enter the specified text",
10431
10431
  placeholder5: "Please enter the prompt displayed when the cell is selected",
10432
10432
  selected: "Selected",
10433
10433
  notSelected: "Not selected",
@@ -10502,7 +10502,7 @@ var en = {
10502
10502
  Date: "Date",
10503
10503
  Engineering: "Engineering",
10504
10504
  Filter: "Filter",
10505
- Crypto: "Crypto",
10505
+ Crypto: "Datablock",
10506
10506
  Financial: "Financial",
10507
10507
  luckysheet: "Luckysheet",
10508
10508
  other: "Other",
@@ -59659,26 +59659,26 @@ function getFailureText(ctx, item) {
59659
59659
  var _ctx$dataVerification5;
59660
59660
  var optionLabel_en = (_ctx$dataVerification5 = ctx.dataVerification) === null || _ctx$dataVerification5 === void 0 ? void 0 : _ctx$dataVerification5.optionLabel_en;
59661
59661
  if (type === "dropdown") {
59662
- failureText += "what you selected is not an option in the drop-down list";
59662
+ failureText += "What you selected is not an option in the drop-down list";
59663
59663
  } else if (type === "checkbox") ; else if (type === "number" || type === "number_integer" || type === "number_decimal") {
59664
- failureText += "what you entered is not a ".concat(optionLabel_en[item.type], " ").concat(optionLabel_en[item.type2], " ").concat(item.value1);
59664
+ failureText += "What you entered is not a ".concat(optionLabel_en[item.type], " ").concat(optionLabel_en[item.type2], " ").concat(item.value1);
59665
59665
  if (item.type2 === "between" || item.type2 === "notBetween") {
59666
59666
  failureText += " and ".concat(item.value2);
59667
59667
  }
59668
59668
  } else if (type === "text_content") {
59669
- failureText += "what you entered is not text that ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59669
+ failureText += "What you entered is not text that ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59670
59670
  } else if (type === "text_length") {
59671
- failureText += "the text you entered is not length ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59671
+ failureText += "The text you entered is not length ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59672
59672
  if (item.type2 === "between" || item.type2 === "notBetween") {
59673
59673
  failureText += " and ".concat(item.value2);
59674
59674
  }
59675
59675
  } else if (type === "date") {
59676
- failureText += "the date you entered is not ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59676
+ failureText += "The date you entered is not ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59677
59677
  if (type2 === "between" || type2 === "notBetween") {
59678
59678
  failureText += " and ".concat(item.value2);
59679
59679
  }
59680
59680
  } else if (type === "validity") {
59681
- failureText += "what you entered is not a correct ".concat(optionLabel_en[item.type2]);
59681
+ failureText += "What you entered is not a correct ".concat(optionLabel_en[item.type2]);
59682
59682
  }
59683
59683
  }
59684
59684
  return failureText;
@@ -59867,6 +59867,7 @@ function cellFocus(ctx, r, c, clickMode) {
59867
59867
  if (!validate) {
59868
59868
  var failureText = "";
59869
59869
  var _lang = ctx.lang;
59870
+ var invalidText = '<div style="color:#F4874A;font-weight:500;font-size:14px;margin-bottom:4px;">Invalid</div>';
59870
59871
  if (_lang === "en") {
59871
59872
  failureText = '<span style="color:#f72626;">Failure: </span>';
59872
59873
  } else if (_lang === "zh" || _lang === "zh-CN") {
@@ -59878,14 +59879,14 @@ function cellFocus(ctx, r, c, clickMode) {
59878
59879
  } else if (_lang === "hi") {
59879
59880
  failureText = '<span style="color:#f72626;">असफलता: </span>';
59880
59881
  }
59881
- failureText += getFailureText(ctx, item);
59882
+ failureText = invalidText + failureText + getFailureText(ctx, item);
59882
59883
  showHintBox.innerHTML = failureText;
59883
59884
  showHintBox.style.display = "block";
59884
59885
  showHintBox.style.left = "".concat(col_pre, "px");
59885
59886
  showHintBox.style.top = "".concat(row, "px");
59886
59887
  }
59887
59888
  }
59888
- function setDropcownValue(ctx, value, arr) {
59889
+ function setDropdownValue(ctx, value, arr) {
59889
59890
  if (!ctx.luckysheet_select_save) return;
59890
59891
  var d = getFlowdata(ctx);
59891
59892
  if (!d) return;
@@ -62827,6 +62828,13 @@ function defaultContext(refs) {
62827
62828
  addDefaultRows: 50,
62828
62829
  fullscreenmode: true,
62829
62830
  devicePixelRatio: (globalThis || window).devicePixelRatio,
62831
+ showDunePreview: {
62832
+ url: "",
62833
+ position: {
62834
+ left: 0,
62835
+ top: 0
62836
+ }
62837
+ },
62830
62838
  contextMenu: {},
62831
62839
  sheetTabContextMenu: {},
62832
62840
  currentSheetId: "",
@@ -63029,6 +63037,8 @@ function defaultContext(refs) {
63029
63037
  luckysheet_shiftpositon: undefined,
63030
63038
  iscopyself: true,
63031
63039
  activeImg: undefined,
63040
+ insertedIframes: [],
63041
+ activeIframe: undefined,
63032
63042
  orderbyindex: 0,
63033
63043
  luckysheet_model_move_state: false,
63034
63044
  luckysheet_model_xy: [0, 0],
@@ -73042,9 +73052,9 @@ var Canvas = /*#__PURE__*/function () {
73042
73052
  horizonAlignPos /= this.sheetCtx.zoomRatio;
73043
73053
  verticalAlignPos_text /= this.sheetCtx.zoomRatio;
73044
73054
  verticalAlignPos_checkbox /= this.sheetCtx.zoomRatio;
73045
- renderCtx.lineWidth = 1;
73055
+ renderCtx.lineWidth = 2;
73046
73056
  renderCtx.strokeStyle = "#000";
73047
- renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 10, 10);
73057
+ renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 12, 12);
73048
73058
  if (dataVerification["".concat(r, "_").concat(c)].checked) {
73049
73059
  renderCtx.beginPath();
73050
73060
  renderCtx.lineTo(horizonAlignPos + 1, verticalAlignPos_checkbox + 6);
@@ -73054,7 +73064,7 @@ var Canvas = /*#__PURE__*/function () {
73054
73064
  renderCtx.closePath();
73055
73065
  }
73056
73066
  renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
73057
- renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos + 14, verticalAlignPos_text);
73067
+ renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos + 18, verticalAlignPos_text);
73058
73068
  renderCtx.restore();
73059
73069
  } else {
73060
73070
  var _checksCF$dataBar, _checksCF$dataBar2, _checksCF$dataBar2$va, _cell$ct$fa$indexOf, _cell$ct, _cell$ct$fa, _cell$ct2;
@@ -75103,6 +75113,248 @@ function handleKeydownForZoom(ev, currentZoom) {
75103
75113
  return parseFloat(zoom.toFixed(1));
75104
75114
  }
75105
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
+
75106
75358
  var addtionalMergeOps = function addtionalMergeOps(ops, id) {
75107
75359
  var merge_new = {};
75108
75360
  ops.some(function (op) {
@@ -77258,9 +77510,8 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
77258
77510
  }
77259
77511
  function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
77260
77512
  var _globalCache$freezen2;
77261
- console.log("handleCellAreaDoubleClick");
77262
77513
  var flowdata = getFlowdata(ctx);
77263
- if (!flowdata) return;
77514
+ if (!flowdata || ctx.formulaCache.functionlistMap[ctx.functionHint || ""]) return;
77264
77515
  if (ctx.luckysheetCellUpdate.length > 0 && ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
77265
77516
  return;
77266
77517
  }
@@ -79891,6 +80142,26 @@ function handlePaste(ctx, e) {
79891
80142
  handleFormulaStringPaste(ctx, txtdata);
79892
80143
  } else {
79893
80144
  pasteHandler(ctx, txtdata);
80145
+ var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
80146
+ var embedUrl = sanitizeDuneUrl(_txtdata);
80147
+ if (embedUrl) {
80148
+ var _ctx$luckysheet_selec8;
80149
+ 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];
80150
+ if (last) {
80151
+ var _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
80152
+ 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;
80153
+ 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;
80154
+ var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
80155
+ var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
80156
+ ctx.showDunePreview = {
80157
+ url: txtdata,
80158
+ position: {
80159
+ left: left,
80160
+ top: top
80161
+ }
80162
+ };
80163
+ }
80164
+ }
79894
80165
  }
79895
80166
  }
79896
80167
  }
@@ -79935,4 +80206,4 @@ function handlePasteByClick(ctx, clipboardData, triggerType) {
79935
80206
  } else ;
79936
80207
  }
79937
80208
 
79938
- 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, setDropcownValue, 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 };
80209
+ 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
@@ -3749,21 +3749,21 @@ var en = {
3749
3749
  p: [{
3750
3750
  name: "start_date",
3751
3751
  detail: "The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.",
3752
- example: "DATE(1969",
3752
+ example: "\"1969-07-16\"",
3753
3753
  require: "m",
3754
3754
  repeat: "n",
3755
3755
  type: "rangeall"
3756
3756
  }, {
3757
3757
  name: "end_date",
3758
3758
  detail: "The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.",
3759
- example: "7",
3759
+ example: "\"1969-07-24\"",
3760
3760
  require: "m",
3761
3761
  repeat: "n",
3762
3762
  type: "rangeall"
3763
3763
  }, {
3764
3764
  name: "unit",
3765
3765
  detail: 'A string abbreviation for unit of time. For example, "M" for month. Accepted values are "Y","M","D","MD","YM","YD".',
3766
- example: "16)",
3766
+ example: "\"D\"",
3767
3767
  require: "m",
3768
3768
  repeat: "n",
3769
3769
  type: "rangeall"
@@ -10425,7 +10425,7 @@ var en = {
10425
10425
  selectCellRange2: "Please select a range of cells",
10426
10426
  verificationCondition: "Verification condition",
10427
10427
  allowMultiSelect: "Allow multiple selection",
10428
- dropdown: "drop-down list",
10428
+ dropdown: "Dropdown list",
10429
10429
  checkbox: "Checkbox",
10430
10430
  number: "Number",
10431
10431
  number_integer: "Number-integer",
@@ -10434,10 +10434,10 @@ var en = {
10434
10434
  text_length: "Text-length",
10435
10435
  date: "Date",
10436
10436
  validity: "Effectiveness",
10437
- placeholder1: "Please enter the options, separated by commas, such as 1,2,3,4,5",
10438
- placeholder2: "Please enter content",
10437
+ placeholder1: "Enter the options, separated by comma",
10438
+ placeholder2: "Enter content",
10439
10439
  placeholder3: "Numeric value, such as 10",
10440
- placeholder4: "Please enter the specified text",
10440
+ placeholder4: "Enter the specified text",
10441
10441
  placeholder5: "Please enter the prompt displayed when the cell is selected",
10442
10442
  selected: "Selected",
10443
10443
  notSelected: "Not selected",
@@ -10512,7 +10512,7 @@ var en = {
10512
10512
  Date: "Date",
10513
10513
  Engineering: "Engineering",
10514
10514
  Filter: "Filter",
10515
- Crypto: "Crypto",
10515
+ Crypto: "Datablock",
10516
10516
  Financial: "Financial",
10517
10517
  luckysheet: "Luckysheet",
10518
10518
  other: "Other",
@@ -59669,26 +59669,26 @@ function getFailureText(ctx, item) {
59669
59669
  var _ctx$dataVerification5;
59670
59670
  var optionLabel_en = (_ctx$dataVerification5 = ctx.dataVerification) === null || _ctx$dataVerification5 === void 0 ? void 0 : _ctx$dataVerification5.optionLabel_en;
59671
59671
  if (type === "dropdown") {
59672
- failureText += "what you selected is not an option in the drop-down list";
59672
+ failureText += "What you selected is not an option in the drop-down list";
59673
59673
  } else if (type === "checkbox") ; else if (type === "number" || type === "number_integer" || type === "number_decimal") {
59674
- failureText += "what you entered is not a ".concat(optionLabel_en[item.type], " ").concat(optionLabel_en[item.type2], " ").concat(item.value1);
59674
+ failureText += "What you entered is not a ".concat(optionLabel_en[item.type], " ").concat(optionLabel_en[item.type2], " ").concat(item.value1);
59675
59675
  if (item.type2 === "between" || item.type2 === "notBetween") {
59676
59676
  failureText += " and ".concat(item.value2);
59677
59677
  }
59678
59678
  } else if (type === "text_content") {
59679
- failureText += "what you entered is not text that ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59679
+ failureText += "What you entered is not text that ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59680
59680
  } else if (type === "text_length") {
59681
- failureText += "the text you entered is not length ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59681
+ failureText += "The text you entered is not length ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59682
59682
  if (item.type2 === "between" || item.type2 === "notBetween") {
59683
59683
  failureText += " and ".concat(item.value2);
59684
59684
  }
59685
59685
  } else if (type === "date") {
59686
- failureText += "the date you entered is not ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59686
+ failureText += "The date you entered is not ".concat(optionLabel_en[item.type2], " ").concat(item.value1);
59687
59687
  if (type2 === "between" || type2 === "notBetween") {
59688
59688
  failureText += " and ".concat(item.value2);
59689
59689
  }
59690
59690
  } else if (type === "validity") {
59691
- failureText += "what you entered is not a correct ".concat(optionLabel_en[item.type2]);
59691
+ failureText += "What you entered is not a correct ".concat(optionLabel_en[item.type2]);
59692
59692
  }
59693
59693
  }
59694
59694
  return failureText;
@@ -59877,6 +59877,7 @@ function cellFocus(ctx, r, c, clickMode) {
59877
59877
  if (!validate) {
59878
59878
  var failureText = "";
59879
59879
  var _lang = ctx.lang;
59880
+ var invalidText = '<div style="color:#F4874A;font-weight:500;font-size:14px;margin-bottom:4px;">Invalid</div>';
59880
59881
  if (_lang === "en") {
59881
59882
  failureText = '<span style="color:#f72626;">Failure: </span>';
59882
59883
  } else if (_lang === "zh" || _lang === "zh-CN") {
@@ -59888,14 +59889,14 @@ function cellFocus(ctx, r, c, clickMode) {
59888
59889
  } else if (_lang === "hi") {
59889
59890
  failureText = '<span style="color:#f72626;">असफलता: </span>';
59890
59891
  }
59891
- failureText += getFailureText(ctx, item);
59892
+ failureText = invalidText + failureText + getFailureText(ctx, item);
59892
59893
  showHintBox.innerHTML = failureText;
59893
59894
  showHintBox.style.display = "block";
59894
59895
  showHintBox.style.left = "".concat(col_pre, "px");
59895
59896
  showHintBox.style.top = "".concat(row, "px");
59896
59897
  }
59897
59898
  }
59898
- function setDropcownValue(ctx, value, arr) {
59899
+ function setDropdownValue(ctx, value, arr) {
59899
59900
  if (!ctx.luckysheet_select_save) return;
59900
59901
  var d = getFlowdata(ctx);
59901
59902
  if (!d) return;
@@ -62837,6 +62838,13 @@ function defaultContext(refs) {
62837
62838
  addDefaultRows: 50,
62838
62839
  fullscreenmode: true,
62839
62840
  devicePixelRatio: (globalThis || window).devicePixelRatio,
62841
+ showDunePreview: {
62842
+ url: "",
62843
+ position: {
62844
+ left: 0,
62845
+ top: 0
62846
+ }
62847
+ },
62840
62848
  contextMenu: {},
62841
62849
  sheetTabContextMenu: {},
62842
62850
  currentSheetId: "",
@@ -63039,6 +63047,8 @@ function defaultContext(refs) {
63039
63047
  luckysheet_shiftpositon: undefined,
63040
63048
  iscopyself: true,
63041
63049
  activeImg: undefined,
63050
+ insertedIframes: [],
63051
+ activeIframe: undefined,
63042
63052
  orderbyindex: 0,
63043
63053
  luckysheet_model_move_state: false,
63044
63054
  luckysheet_model_xy: [0, 0],
@@ -73052,9 +73062,9 @@ var Canvas = /*#__PURE__*/function () {
73052
73062
  horizonAlignPos /= this.sheetCtx.zoomRatio;
73053
73063
  verticalAlignPos_text /= this.sheetCtx.zoomRatio;
73054
73064
  verticalAlignPos_checkbox /= this.sheetCtx.zoomRatio;
73055
- renderCtx.lineWidth = 1;
73065
+ renderCtx.lineWidth = 2;
73056
73066
  renderCtx.strokeStyle = "#000";
73057
- renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 10, 10);
73067
+ renderCtx.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 12, 12);
73058
73068
  if (dataVerification["".concat(r, "_").concat(c)].checked) {
73059
73069
  renderCtx.beginPath();
73060
73070
  renderCtx.lineTo(horizonAlignPos + 1, verticalAlignPos_checkbox + 6);
@@ -73064,7 +73074,7 @@ var Canvas = /*#__PURE__*/function () {
73064
73074
  renderCtx.closePath();
73065
73075
  }
73066
73076
  renderCtx.fillStyle = normalizedAttr(flowdata, r, c, "fc");
73067
- renderCtx.fillText(___default['default'].isNil(value) ? "" : value, horizonAlignPos + 14, verticalAlignPos_text);
73077
+ renderCtx.fillText(___default['default'].isNil(value) ? "" : value, horizonAlignPos + 18, verticalAlignPos_text);
73068
73078
  renderCtx.restore();
73069
73079
  } else {
73070
73080
  var _checksCF$dataBar, _checksCF$dataBar2, _checksCF$dataBar2$va, _cell$ct$fa$indexOf, _cell$ct, _cell$ct$fa, _cell$ct2;
@@ -75113,6 +75123,248 @@ function handleKeydownForZoom(ev, currentZoom) {
75113
75123
  return parseFloat(zoom.toFixed(1));
75114
75124
  }
75115
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
+
75116
75368
  var addtionalMergeOps = function addtionalMergeOps(ops, id) {
75117
75369
  var merge_new = {};
75118
75370
  ops.some(function (op) {
@@ -77268,9 +77520,8 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
77268
77520
  }
77269
77521
  function handleCellAreaDoubleClick(ctx, globalCache, settings, e, container) {
77270
77522
  var _globalCache$freezen2;
77271
- console.log("handleCellAreaDoubleClick");
77272
77523
  var flowdata = getFlowdata(ctx);
77273
- if (!flowdata) return;
77524
+ if (!flowdata || ctx.formulaCache.functionlistMap[ctx.functionHint || ""]) return;
77274
77525
  if (ctx.luckysheetCellUpdate.length > 0 && ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) {
77275
77526
  return;
77276
77527
  }
@@ -79901,6 +80152,26 @@ function handlePaste(ctx, e) {
79901
80152
  handleFormulaStringPaste(ctx, txtdata);
79902
80153
  } else {
79903
80154
  pasteHandler(ctx, txtdata);
80155
+ var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
80156
+ var embedUrl = sanitizeDuneUrl(_txtdata);
80157
+ if (embedUrl) {
80158
+ var _ctx$luckysheet_selec8;
80159
+ 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];
80160
+ if (last) {
80161
+ var _ref, _last$row_focus, _last$row, _ref2, _last$column_focus, _last$column;
80162
+ 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;
80163
+ 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;
80164
+ var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
80165
+ var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
80166
+ ctx.showDunePreview = {
80167
+ url: txtdata,
80168
+ position: {
80169
+ left: left,
80170
+ top: top
80171
+ }
80172
+ };
80173
+ }
80174
+ }
79904
80175
  }
79905
80176
  }
79906
80177
  }
@@ -80141,6 +80412,8 @@ exports.initFreeze = initFreeze;
80141
80412
  exports.initSheetIndex = initSheetIndex;
80142
80413
  exports.inlineStyleAffectAttribute = inlineStyleAffectAttribute;
80143
80414
  exports.inlineStyleAffectCssName = inlineStyleAffectCssName;
80415
+ exports.insertDuneChart = insertDuneChart;
80416
+ exports.insertIframe = insertIframe;
80144
80417
  exports.insertImage = insertImage;
80145
80418
  exports.insertRowCol = insertRowCol;
80146
80419
  exports.insertUpdateFunctionGroup = insertUpdateFunctionGroup;
@@ -80187,6 +80460,12 @@ exports.onCommentBoxResizeStart = onCommentBoxResizeStart;
80187
80460
  exports.onDropCellSelect = onDropCellSelect;
80188
80461
  exports.onDropCellSelectEnd = onDropCellSelectEnd;
80189
80462
  exports.onFormulaRangeDragEnd = onFormulaRangeDragEnd;
80463
+ exports.onIframeMove = onIframeMove;
80464
+ exports.onIframeMoveEnd = onIframeMoveEnd;
80465
+ exports.onIframeMoveStart = onIframeMoveStart;
80466
+ exports.onIframeResize = onIframeResize;
80467
+ exports.onIframeResizeEnd = onIframeResizeEnd;
80468
+ exports.onIframeResizeStart = onIframeResizeStart;
80190
80469
  exports.onImageMove = onImageMove;
80191
80470
  exports.onImageMoveEnd = onImageMoveEnd;
80192
80471
  exports.onImageMoveStart = onImageMoveStart;
@@ -80222,8 +80501,10 @@ exports.rgbToHex = rgbToHex;
80222
80501
  exports.rowHasMerged = rowHasMerged;
80223
80502
  exports.rowLocation = rowLocation;
80224
80503
  exports.rowLocationByIndex = rowLocationByIndex;
80504
+ exports.sanitizeDuneUrl = sanitizeDuneUrl;
80225
80505
  exports.saveFilter = saveFilter;
80226
80506
  exports.saveHyperlink = saveHyperlink;
80507
+ exports.saveIframe = saveIframe;
80227
80508
  exports.saveImage = saveImage;
80228
80509
  exports.scrollToFrozenRowCol = scrollToFrozenRowCol;
80229
80510
  exports.scrollToHighlightCell = scrollToHighlightCell;
@@ -80241,7 +80522,7 @@ exports.seletedHighlistByindex = seletedHighlistByindex;
80241
80522
  exports.setCaretPosition = setCaretPosition;
80242
80523
  exports.setCellValue = setCellValue;
80243
80524
  exports.setConditionRules = setConditionRules;
80244
- exports.setDropcownValue = setDropcownValue;
80525
+ exports.setDropdownValue = setDropdownValue;
80245
80526
  exports.setEditingComment = setEditingComment;
80246
80527
  exports.showComments = showComments;
80247
80528
  exports.showDropCellSelection = showDropCellSelection;
@@ -7,5 +7,5 @@ export declare function checkboxChange(ctx: Context, r: number, c: number): void
7
7
  export declare function getFailureText(ctx: Context, item: any): string;
8
8
  export declare function getHintText(ctx: Context, item: any): any;
9
9
  export declare function cellFocus(ctx: Context, r: number, c: number, clickMode: boolean): void;
10
- export declare function setDropcownValue(ctx: Context, value: string, arr: any): void;
10
+ export declare function setDropdownValue(ctx: Context, value: string, arr: any): void;
11
11
  export declare function confirmMessage(ctx: Context, generalDialog: any, dataVerification: any): boolean;
@@ -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;
@@ -33,3 +33,4 @@ export * from "./dataVerification";
33
33
  export * from "./ConditionFormat";
34
34
  export * from "./zoom";
35
35
  export * from "./refresh";
36
+ export * from "./iframe";
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.0.2-mod-40",
3
+ "version": "1.0.2-mod-41-patch-1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",