@fileverse-dev/fortune-core 1.2.90-ydoc-9 → 1.2.90-ydoc-11

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.
@@ -1496,7 +1496,7 @@ export function copy(ctx) {
1496
1496
  }
1497
1497
  }
1498
1498
  export function deleteSelectedCellText(ctx) {
1499
- var _a, _b, _c;
1499
+ var _a, _b, _c, _d;
1500
1500
  var allowEdit = isAllowEdit(ctx);
1501
1501
  if (allowEdit === false || ctx.isFlvReadOnly) {
1502
1502
  return "allowEdit";
@@ -1553,6 +1553,9 @@ export function deleteSelectedCellText(ctx) {
1553
1553
  if (hyperlinkMap && hyperlinkMap["".concat(r, "_").concat(c)]) {
1554
1554
  delete hyperlinkMap["".concat(r, "_").concat(c)];
1555
1555
  }
1556
+ if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.afterUpdateCell) {
1557
+ ctx.hooks.afterUpdateCell(r, c, null, d[r][c]);
1558
+ }
1556
1559
  }
1557
1560
  }
1558
1561
  }
@@ -15,8 +15,9 @@ import { showLinkCard } from "./hyperlink";
15
15
  import { cfSplitRange } from "./conditionalFormat";
16
16
  import { clearMeasureTextCache, getCellTextInfo } from "./text";
17
17
  export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
18
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
19
- var _7;
18
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
19
+ var _10;
20
+ console.log("updateFormatCell", row_st, row_ed, col_st, col_ed);
20
21
  if (_.isNil(d) || _.isNil(attr)) {
21
22
  return;
22
23
  }
@@ -72,6 +73,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
72
73
  m: mask
73
74
  };
74
75
  }
76
+ if ((_x = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _x === void 0 ? void 0 : _x.afterUpdateCell) {
77
+ (_z = (_y = ctx.hooks) === null || _y === void 0 ? void 0 : _y.afterUpdateCell) === null || _z === void 0 ? void 0 : _z.call(_y, r, c, null, d[r][c]);
78
+ }
75
79
  }
76
80
  }
77
81
  } else {
@@ -127,11 +131,11 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
127
131
  if (value && _.isPlainObject(value)) {
128
132
  updateInlineStringFormatOutside(value, attr, foucsStatus);
129
133
  value[attr] = foucsStatus;
130
- (_7 = ctx.luckysheetfile[sheetIndex]).config || (_7.config = {});
134
+ (_10 = ctx.luckysheetfile[sheetIndex]).config || (_10.config = {});
131
135
  var cfg = ctx.luckysheetfile[sheetIndex].config;
132
- var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
136
+ var cellWidth = ((_0 = cfg.columnlen) === null || _0 === void 0 ? void 0 : _0[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
133
137
  if (attr === "tb" && canvas && foucsStatus === "2") {
134
- var currentColWidth_1 = ((_y = cfg.columnlen) === null || _y === void 0 ? void 0 : _y[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
138
+ var currentColWidth_1 = ((_1 = cfg.columnlen) === null || _1 === void 0 ? void 0 : _1[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
135
139
  var lineCount_1 = 1;
136
140
  var fontString_1 = "10px Arial";
137
141
  if (value.fs) {
@@ -144,9 +148,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
144
148
  lineCount_1 = getLineCount(value.m, currentColWidth_1, fontString_1);
145
149
  var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
146
150
  lineCount_1 = lineCount_1 * hOffset + 1;
147
- } else if ((_1 = (_0 = (_z = value === null || value === void 0 ? void 0 : value.ct) === null || _z === void 0 ? void 0 : _z.s) === null || _0 === void 0 ? void 0 : _0[0]) === null || _1 === void 0 ? void 0 : _1.v) {
151
+ } else if ((_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v) {
148
152
  lineCount_1 -= 1;
149
- var line = (_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v.split("\n");
153
+ var line = (_7 = (_6 = (_5 = value === null || value === void 0 ? void 0 : value.ct) === null || _5 === void 0 ? void 0 : _5.s) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.v.split("\n");
150
154
  line.forEach(function (item) {
151
155
  var subLineCount = getLineCount(item, currentColWidth_1, fontString_1);
152
156
  lineCount_1 += subLineCount;
@@ -166,7 +170,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
166
170
  });
167
171
  if (!textInfo) return "continue";
168
172
  var rowHeight = _.round(textInfo.textHeightAll);
169
- var currentRowHeight = ((_5 = cfg.rowlen) === null || _5 === void 0 ? void 0 : _5[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
173
+ var currentRowHeight = ((_8 = cfg.rowlen) === null || _8 === void 0 ? void 0 : _8[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
170
174
  if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
171
175
  if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
172
176
  _.set(cfg, "rowlen.".concat(r), rowHeight);
@@ -181,7 +185,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
181
185
  });
182
186
  if (!textInfo) return "continue";
183
187
  var newHeight = _.round(textInfo.textHeightAll);
184
- var oldHeight = ((_6 = cfg.rowlen) === null || _6 === void 0 ? void 0 : _6[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
188
+ var oldHeight = ((_9 = cfg.rowlen) === null || _9 === void 0 ? void 0 : _9[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
185
189
  var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
186
190
  if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
187
191
  var padding = 12;
package/es/settings.d.ts CHANGED
@@ -1,7 +1,16 @@
1
1
  import React from "react";
2
2
  import { Sheet, Selection, CellMatrix, Cell } from "./types";
3
3
  export type Hooks = {
4
- flvSheetLengthChange?: () => void;
4
+ calcChainChange?: () => void;
5
+ sheetLengthChange?: () => void;
6
+ dataVerificationChange?: () => void;
7
+ liveQueryChange?: () => void;
8
+ imageListChange?: () => void;
9
+ iframeListChange?: () => void;
10
+ conditionRulesChange?: () => void;
11
+ conditionFormatChange?: () => void;
12
+ cellDataChange?: () => void;
13
+ hyperlinkChange?: () => void;
5
14
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
6
15
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
7
16
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
@@ -1531,7 +1531,7 @@ function copy(ctx) {
1531
1531
  }
1532
1532
  }
1533
1533
  function deleteSelectedCellText(ctx) {
1534
- var _a, _b, _c;
1534
+ var _a, _b, _c, _d;
1535
1535
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1536
1536
  if (allowEdit === false || ctx.isFlvReadOnly) {
1537
1537
  return "allowEdit";
@@ -1588,6 +1588,9 @@ function deleteSelectedCellText(ctx) {
1588
1588
  if (hyperlinkMap && hyperlinkMap["".concat(r, "_").concat(c)]) {
1589
1589
  delete hyperlinkMap["".concat(r, "_").concat(c)];
1590
1590
  }
1591
+ if ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _d === void 0 ? void 0 : _d.afterUpdateCell) {
1592
+ ctx.hooks.afterUpdateCell(r, c, null, d[r][c]);
1593
+ }
1591
1594
  }
1592
1595
  }
1593
1596
  }
@@ -48,8 +48,9 @@ var _conditionalFormat = require("./conditionalFormat");
48
48
  var _text = require("./text");
49
49
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
50
50
  function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
52
- var _7;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
52
+ var _10;
53
+ console.log("updateFormatCell", row_st, row_ed, col_st, col_ed);
53
54
  if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
54
55
  return;
55
56
  }
@@ -105,6 +106,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
105
106
  m: mask
106
107
  };
107
108
  }
109
+ if ((_x = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _x === void 0 ? void 0 : _x.afterUpdateCell) {
110
+ (_z = (_y = ctx.hooks) === null || _y === void 0 ? void 0 : _y.afterUpdateCell) === null || _z === void 0 ? void 0 : _z.call(_y, r, c, null, d[r][c]);
111
+ }
108
112
  }
109
113
  }
110
114
  } else {
@@ -160,11 +164,11 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
160
164
  if (value && _lodash.default.isPlainObject(value)) {
161
165
  (0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
162
166
  value[attr] = foucsStatus;
163
- (_7 = ctx.luckysheetfile[sheetIndex]).config || (_7.config = {});
167
+ (_10 = ctx.luckysheetfile[sheetIndex]).config || (_10.config = {});
164
168
  var cfg = ctx.luckysheetfile[sheetIndex].config;
165
- var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
169
+ var cellWidth = ((_0 = cfg.columnlen) === null || _0 === void 0 ? void 0 : _0[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
166
170
  if (attr === "tb" && canvas && foucsStatus === "2") {
167
- var currentColWidth_1 = ((_y = cfg.columnlen) === null || _y === void 0 ? void 0 : _y[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
171
+ var currentColWidth_1 = ((_1 = cfg.columnlen) === null || _1 === void 0 ? void 0 : _1[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
168
172
  var lineCount_1 = 1;
169
173
  var fontString_1 = "10px Arial";
170
174
  if (value.fs) {
@@ -177,9 +181,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
177
181
  lineCount_1 = (0, _utils.getLineCount)(value.m, currentColWidth_1, fontString_1);
178
182
  var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
179
183
  lineCount_1 = lineCount_1 * hOffset + 1;
180
- } else if ((_1 = (_0 = (_z = value === null || value === void 0 ? void 0 : value.ct) === null || _z === void 0 ? void 0 : _z.s) === null || _0 === void 0 ? void 0 : _0[0]) === null || _1 === void 0 ? void 0 : _1.v) {
184
+ } else if ((_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v) {
181
185
  lineCount_1 -= 1;
182
- var line = (_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v.split("\n");
186
+ var line = (_7 = (_6 = (_5 = value === null || value === void 0 ? void 0 : value.ct) === null || _5 === void 0 ? void 0 : _5.s) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.v.split("\n");
183
187
  line.forEach(function (item) {
184
188
  var subLineCount = (0, _utils.getLineCount)(item, currentColWidth_1, fontString_1);
185
189
  lineCount_1 += subLineCount;
@@ -199,7 +203,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
199
203
  });
200
204
  if (!textInfo) return "continue";
201
205
  var rowHeight = _lodash.default.round(textInfo.textHeightAll);
202
- var currentRowHeight = ((_5 = cfg.rowlen) === null || _5 === void 0 ? void 0 : _5[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
206
+ var currentRowHeight = ((_8 = cfg.rowlen) === null || _8 === void 0 ? void 0 : _8[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
203
207
  if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
204
208
  if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
205
209
  _lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
@@ -214,7 +218,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
214
218
  });
215
219
  if (!textInfo) return "continue";
216
220
  var newHeight = _lodash.default.round(textInfo.textHeightAll);
217
- var oldHeight = ((_6 = cfg.rowlen) === null || _6 === void 0 ? void 0 : _6[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
221
+ var oldHeight = ((_9 = cfg.rowlen) === null || _9 === void 0 ? void 0 : _9[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
218
222
  var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
219
223
  if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
220
224
  var padding = 12;
package/lib/settings.d.ts CHANGED
@@ -1,7 +1,16 @@
1
1
  import React from "react";
2
2
  import { Sheet, Selection, CellMatrix, Cell } from "./types";
3
3
  export type Hooks = {
4
- flvSheetLengthChange?: () => void;
4
+ calcChainChange?: () => void;
5
+ sheetLengthChange?: () => void;
6
+ dataVerificationChange?: () => void;
7
+ liveQueryChange?: () => void;
8
+ imageListChange?: () => void;
9
+ iframeListChange?: () => void;
10
+ conditionRulesChange?: () => void;
11
+ conditionFormatChange?: () => void;
12
+ cellDataChange?: () => void;
13
+ hyperlinkChange?: () => void;
5
14
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
6
15
  afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
7
16
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.90-ydoc-9",
3
+ "version": "1.2.90-ydoc-11",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",