@leankylin-sheet/react 5.2.36 → 5.2.38

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/index.esm.js CHANGED
@@ -1165,6 +1165,7 @@ var InputBox = function InputBox() {
1165
1165
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
1166
1166
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
1167
1167
  var preText = useRef("");
1168
+ var prevCellRef = useRef();
1168
1169
  useLayoutEffect(function () {
1169
1170
  if (!context.allowEdit) {
1170
1171
  setContext(function (ctx) {
@@ -1181,11 +1182,18 @@ var InputBox = function InputBox() {
1181
1182
  delete refs.globalCache.doNotUpdateCell;
1182
1183
  return;
1183
1184
  }
1184
- if (_.isEqual(prevCellUpdate, context.luckysheetCellUpdate) && prevSheetId === context.currentSheetId) {
1185
- return;
1186
- }
1187
1185
  var flowdata = getFlowdata(context);
1188
1186
  var cell = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : _flowdata$row_index[col_index];
1187
+ var selectionChanged = !_.isEqual(prevCellUpdate, context.luckysheetCellUpdate) || prevSheetId !== context.currentSheetId;
1188
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== row_index || prevCellRef.current.c !== col_index || prevCellRef.current.cell !== cell;
1189
+ if (!selectionChanged && !cellChanged) {
1190
+ return;
1191
+ }
1192
+ prevCellRef.current = {
1193
+ r: row_index,
1194
+ c: col_index,
1195
+ cell: cell
1196
+ };
1189
1197
  var value = "";
1190
1198
  if (cell && !refs.globalCache.overwriteCell) {
1191
1199
  if (isInlineStringCell(cell)) {
@@ -7222,11 +7230,9 @@ var FxEditor = function FxEditor() {
7222
7230
  var prevFirstSelection = usePrevious(firstSelection);
7223
7231
  var prevSheetId = usePrevious(context.currentSheetId);
7224
7232
  var recentText = useRef("");
7233
+ var prevCellRef = useRef();
7225
7234
  useEffect(function () {
7226
7235
  setIsHidenRC(isShowHidenCR(context));
7227
- if (_.isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
7228
- return;
7229
- }
7230
7236
  var d = getFlowdata(context);
7231
7237
  if (context.active_f) {
7232
7238
  return;
@@ -7238,6 +7244,16 @@ var FxEditor = function FxEditor() {
7238
7244
  var c = firstSelection.column_focus;
7239
7245
  if (_.isNil(r) || _.isNil(c)) return;
7240
7246
  var cell = d === null || d === void 0 ? void 0 : (_d$r = d[r]) === null || _d$r === void 0 ? void 0 : _d$r[c];
7247
+ var selectionChanged = !_.isEqual(prevFirstSelection, firstSelection) || context.currentSheetId !== prevSheetId;
7248
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== r || prevCellRef.current.c !== c || prevCellRef.current.cell !== cell;
7249
+ if (!selectionChanged && !cellChanged) {
7250
+ return;
7251
+ }
7252
+ prevCellRef.current = {
7253
+ r: r,
7254
+ c: c,
7255
+ cell: cell
7256
+ };
7241
7257
  if (cell) {
7242
7258
  if (isInlineStringCell(cell)) {
7243
7259
  value = getInlineStringNoStyle(r, c, d);
@@ -7249,6 +7265,7 @@ var FxEditor = function FxEditor() {
7249
7265
  }
7250
7266
  refs.fxInput.current.innerHTML = escapeHTMLTag(escapeScriptTag(value));
7251
7267
  } else {
7268
+ prevCellRef.current = undefined;
7252
7269
  refs.fxInput.current.innerHTML = "";
7253
7270
  }
7254
7271
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
package/dist/index.js CHANGED
@@ -1175,6 +1175,7 @@ var InputBox = function InputBox() {
1175
1175
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
1176
1176
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
1177
1177
  var preText = React.useRef("");
1178
+ var prevCellRef = React.useRef();
1178
1179
  React.useLayoutEffect(function () {
1179
1180
  if (!context.allowEdit) {
1180
1181
  setContext(function (ctx) {
@@ -1191,11 +1192,18 @@ var InputBox = function InputBox() {
1191
1192
  delete refs.globalCache.doNotUpdateCell;
1192
1193
  return;
1193
1194
  }
1194
- if (___default['default'].isEqual(prevCellUpdate, context.luckysheetCellUpdate) && prevSheetId === context.currentSheetId) {
1195
- return;
1196
- }
1197
1195
  var flowdata = core.getFlowdata(context);
1198
1196
  var cell = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : _flowdata$row_index[col_index];
1197
+ var selectionChanged = !___default['default'].isEqual(prevCellUpdate, context.luckysheetCellUpdate) || prevSheetId !== context.currentSheetId;
1198
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== row_index || prevCellRef.current.c !== col_index || prevCellRef.current.cell !== cell;
1199
+ if (!selectionChanged && !cellChanged) {
1200
+ return;
1201
+ }
1202
+ prevCellRef.current = {
1203
+ r: row_index,
1204
+ c: col_index,
1205
+ cell: cell
1206
+ };
1199
1207
  var value = "";
1200
1208
  if (cell && !refs.globalCache.overwriteCell) {
1201
1209
  if (core.isInlineStringCell(cell)) {
@@ -7232,11 +7240,9 @@ var FxEditor = function FxEditor() {
7232
7240
  var prevFirstSelection = usePrevious(firstSelection);
7233
7241
  var prevSheetId = usePrevious(context.currentSheetId);
7234
7242
  var recentText = React.useRef("");
7243
+ var prevCellRef = React.useRef();
7235
7244
  React.useEffect(function () {
7236
7245
  setIsHidenRC(core.isShowHidenCR(context));
7237
- if (___default['default'].isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
7238
- return;
7239
- }
7240
7246
  var d = core.getFlowdata(context);
7241
7247
  if (context.active_f) {
7242
7248
  return;
@@ -7248,6 +7254,16 @@ var FxEditor = function FxEditor() {
7248
7254
  var c = firstSelection.column_focus;
7249
7255
  if (___default['default'].isNil(r) || ___default['default'].isNil(c)) return;
7250
7256
  var cell = d === null || d === void 0 ? void 0 : (_d$r = d[r]) === null || _d$r === void 0 ? void 0 : _d$r[c];
7257
+ var selectionChanged = !___default['default'].isEqual(prevFirstSelection, firstSelection) || context.currentSheetId !== prevSheetId;
7258
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== r || prevCellRef.current.c !== c || prevCellRef.current.cell !== cell;
7259
+ if (!selectionChanged && !cellChanged) {
7260
+ return;
7261
+ }
7262
+ prevCellRef.current = {
7263
+ r: r,
7264
+ c: c,
7265
+ cell: cell
7266
+ };
7251
7267
  if (cell) {
7252
7268
  if (core.isInlineStringCell(cell)) {
7253
7269
  value = core.getInlineStringNoStyle(r, c, d);
@@ -7259,6 +7275,7 @@ var FxEditor = function FxEditor() {
7259
7275
  }
7260
7276
  refs.fxInput.current.innerHTML = core.escapeHTMLTag(core.escapeScriptTag(value));
7261
7277
  } else {
7278
+ prevCellRef.current = undefined;
7262
7279
  refs.fxInput.current.innerHTML = "";
7263
7280
  }
7264
7281
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
package/dist/index.umd.js CHANGED
@@ -106196,6 +106196,7 @@
106196
106196
  var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
106197
106197
  var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
106198
106198
  var preText = React.useRef("");
106199
+ var prevCellRef = React.useRef();
106199
106200
  React.useLayoutEffect(function () {
106200
106201
  if (!context.allowEdit) {
106201
106202
  setContext(function (ctx) {
@@ -106212,11 +106213,18 @@
106212
106213
  delete refs.globalCache.doNotUpdateCell;
106213
106214
  return;
106214
106215
  }
106215
- if (lodash.isEqual(prevCellUpdate, context.luckysheetCellUpdate) && prevSheetId === context.currentSheetId) {
106216
- return;
106217
- }
106218
106216
  var flowdata = getFlowdata(context);
106219
106217
  var cell = flowdata === null || flowdata === void 0 ? void 0 : (_flowdata$row_index = flowdata[row_index]) === null || _flowdata$row_index === void 0 ? void 0 : _flowdata$row_index[col_index];
106218
+ var selectionChanged = !lodash.isEqual(prevCellUpdate, context.luckysheetCellUpdate) || prevSheetId !== context.currentSheetId;
106219
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== row_index || prevCellRef.current.c !== col_index || prevCellRef.current.cell !== cell;
106220
+ if (!selectionChanged && !cellChanged) {
106221
+ return;
106222
+ }
106223
+ prevCellRef.current = {
106224
+ r: row_index,
106225
+ c: col_index,
106226
+ cell: cell
106227
+ };
106220
106228
  var value = "";
106221
106229
  if (cell && !refs.globalCache.overwriteCell) {
106222
106230
  if (isInlineStringCell(cell)) {
@@ -112253,11 +112261,9 @@
112253
112261
  var prevFirstSelection = usePrevious(firstSelection);
112254
112262
  var prevSheetId = usePrevious(context.currentSheetId);
112255
112263
  var recentText = React.useRef("");
112264
+ var prevCellRef = React.useRef();
112256
112265
  React.useEffect(function () {
112257
112266
  setIsHidenRC(isShowHidenCR(context));
112258
- if (lodash.isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
112259
- return;
112260
- }
112261
112267
  var d = getFlowdata(context);
112262
112268
  if (context.active_f) {
112263
112269
  return;
@@ -112269,6 +112275,16 @@
112269
112275
  var c = firstSelection.column_focus;
112270
112276
  if (lodash.isNil(r) || lodash.isNil(c)) return;
112271
112277
  var cell = d === null || d === void 0 ? void 0 : (_d$r = d[r]) === null || _d$r === void 0 ? void 0 : _d$r[c];
112278
+ var selectionChanged = !lodash.isEqual(prevFirstSelection, firstSelection) || context.currentSheetId !== prevSheetId;
112279
+ var cellChanged = !prevCellRef.current || prevCellRef.current.r !== r || prevCellRef.current.c !== c || prevCellRef.current.cell !== cell;
112280
+ if (!selectionChanged && !cellChanged) {
112281
+ return;
112282
+ }
112283
+ prevCellRef.current = {
112284
+ r: r,
112285
+ c: c,
112286
+ cell: cell
112287
+ };
112272
112288
  if (cell) {
112273
112289
  if (isInlineStringCell(cell)) {
112274
112290
  value = getInlineStringNoStyle(r, c, d);
@@ -112280,6 +112296,7 @@
112280
112296
  }
112281
112297
  refs.fxInput.current.innerHTML = escapeHTMLTag(escapeScriptTag(value));
112282
112298
  } else {
112299
+ prevCellRef.current = undefined;
112283
112300
  refs.fxInput.current.innerHTML = "";
112284
112301
  }
112285
112302
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);