@fileverse-dev/fortune-react 1.2.5 → 1.2.7

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.
@@ -633,7 +633,7 @@ var ContextMenu = function ContextMenu() {
633
633
  }), /*#__PURE__*/React.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
634
634
  }
635
635
  if (name === "hide-row") {
636
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
636
+ return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected"].map(function (item) {
637
637
  return /*#__PURE__*/React.createElement(Menu, {
638
638
  key: item,
639
639
  onClick: function onClick() {
@@ -658,7 +658,7 @@ var ContextMenu = function ContextMenu() {
658
658
  });
659
659
  }
660
660
  if (name === "hide-column") {
661
- return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected", "showHide"].map(function (item) {
661
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected"].map(function (item) {
662
662
  return /*#__PURE__*/React.createElement(Menu, {
663
663
  key: item,
664
664
  onClick: function onClick() {
@@ -92,7 +92,6 @@ var RangeDialog = function RangeDialog() {
92
92
  minWidth: "80px"
93
93
  },
94
94
  onClick: function onClick() {
95
- console.log("rangeTxt2", rangeTxt2);
96
95
  setContext(function (ctx) {
97
96
  ctx.rangeDialog.rangeTxt = rangeTxt2;
98
97
  });
@@ -162,6 +162,7 @@ var ColumnHeader = function ColumnHeader() {
162
162
  if (sheetIndex == null) return;
163
163
  var tempPointers = [];
164
164
  var colhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
165
+ console.log(colhidden);
165
166
  if (colhidden) {
166
167
  Object.keys(colhidden).forEach(function (key) {
167
168
  var item = {
@@ -170,20 +171,36 @@ var ColumnHeader = function ColumnHeader() {
170
171
  };
171
172
  tempPointers.push(item);
172
173
  });
173
- console.log(tempPointers);
174
174
  setHiddenPointers(tempPointers);
175
175
  } else {
176
176
  setHiddenPointers([]);
177
177
  }
178
178
  }, [context.visibledatacolumn, sheetIndex]);
179
179
  var showColumn = function showColumn(e, item) {
180
+ var _a, _b;
181
+ if (sheetIndex == null) return;
182
+ var startPoint = item.col;
183
+ var startCol = startPoint;
184
+ var endCol = startPoint;
185
+ var colhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
186
+ var findColBoundary = function findColBoundary(start, direction) {
187
+ var tempPoint = start;
188
+ while (true) {
189
+ var checkColIndex = tempPoint + direction;
190
+ if (!(colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(checkColIndex))) break;
191
+ tempPoint = checkColIndex;
192
+ }
193
+ return tempPoint;
194
+ };
195
+ startCol = findColBoundary(startPoint, -1);
196
+ endCol = findColBoundary(startPoint, 1);
180
197
  if (context.isFlvReadOnly) return;
181
198
  e.stopPropagation();
182
199
  setContext(function (ctx) {
183
200
  var _a;
184
201
  api.setSelection(ctx, [{
185
202
  row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
186
- column: [Number(item.col) - 1, Number(item.col) + 1]
203
+ column: [Number(startCol) - 1, Number(endCol) + 1]
187
204
  }], {
188
205
  id: context.currentSheetId
189
206
  });
@@ -191,6 +208,15 @@ var ColumnHeader = function ColumnHeader() {
191
208
  setContext(function (ctx) {
192
209
  showSelected(ctx, "column");
193
210
  });
211
+ setContext(function (ctx) {
212
+ var _a;
213
+ api.setSelection(ctx, [{
214
+ row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
215
+ column: [Number(startCol), Number(endCol)]
216
+ }], {
217
+ id: context.currentSheetId
218
+ });
219
+ });
194
220
  };
195
221
  useEffect(function () {
196
222
  containerRef.current.scrollLeft = context.scrollLeft;
@@ -195,14 +195,14 @@ var FormulaHint = function FormulaHint(props) {
195
195
  if (param.require === "o") {
196
196
  name = "[".concat(name, "]");
197
197
  }
198
- return /*#__PURE__*/React.createElement("code", {
198
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("code", {
199
199
  className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
200
200
  dir: "auto",
201
201
  key: name,
202
202
  style: {
203
203
  backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
204
204
  }
205
- }, name, i !== fn.p.length - 1 && ", ");
205
+ }, name), i !== fn.p.length - 1 && ", ");
206
206
  })), /*#__PURE__*/React.createElement("code", {
207
207
  className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
208
208
  }, ")")), /*#__PURE__*/React.createElement("div", {
@@ -175,12 +175,29 @@ var RowHeader = function RowHeader() {
175
175
  }
176
176
  }, [context.visibledatarow, sheetIndex]);
177
177
  var showRow = function showRow(e, item) {
178
+ var _a, _b;
179
+ if (sheetIndex == null) return;
180
+ var startPoint = item.row;
181
+ var startRow = startPoint;
182
+ var endRow = startPoint;
183
+ var rowhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
184
+ var findRowBoundary = function findRowBoundary(start, direction) {
185
+ var tempPoint = start;
186
+ while (true) {
187
+ var checkRowIndex = tempPoint + direction;
188
+ if (!(rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(checkRowIndex))) break;
189
+ tempPoint = checkRowIndex;
190
+ }
191
+ return tempPoint;
192
+ };
193
+ startRow = findRowBoundary(startPoint, -1);
194
+ endRow = findRowBoundary(startPoint, 1);
178
195
  if (context.isFlvReadOnly) return;
179
196
  e.stopPropagation();
180
197
  setContext(function (ctx) {
181
198
  var _a;
182
199
  api.setSelection(ctx, [{
183
- row: [Number(item.row) - 1, Number(item.row) + 1],
200
+ row: [Number(startRow) - 1, Number(endRow) + 1],
184
201
  column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
185
202
  }], {
186
203
  id: context.currentSheetId
@@ -189,6 +206,15 @@ var RowHeader = function RowHeader() {
189
206
  setContext(function (ctx) {
190
207
  showSelected(ctx, "row");
191
208
  });
209
+ setContext(function (ctx) {
210
+ var _a;
211
+ api.setSelection(ctx, [{
212
+ row: [Number(startRow), Number(endRow)],
213
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
214
+ }], {
215
+ id: context.currentSheetId
216
+ });
217
+ });
192
218
  };
193
219
  useEffect(function () {
194
220
  containerRef.current.scrollTop = context.scrollTop;
@@ -642,7 +642,7 @@ var ContextMenu = function ContextMenu() {
642
642
  }), /*#__PURE__*/_react.default.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
643
643
  }
644
644
  if (name === "hide-row") {
645
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
645
+ return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected"].map(function (item) {
646
646
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
647
647
  key: item,
648
648
  onClick: function onClick() {
@@ -667,7 +667,7 @@ var ContextMenu = function ContextMenu() {
667
667
  });
668
668
  }
669
669
  if (name === "hide-column") {
670
- return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected", "showHide"].map(function (item) {
670
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected"].map(function (item) {
671
671
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
672
672
  key: item,
673
673
  onClick: function onClick() {
@@ -101,7 +101,6 @@ var RangeDialog = function RangeDialog() {
101
101
  minWidth: "80px"
102
102
  },
103
103
  onClick: function onClick() {
104
- console.log("rangeTxt2", rangeTxt2);
105
104
  setContext(function (ctx) {
106
105
  ctx.rangeDialog.rangeTxt = rangeTxt2;
107
106
  });
@@ -171,6 +171,7 @@ var ColumnHeader = function ColumnHeader() {
171
171
  if (sheetIndex == null) return;
172
172
  var tempPointers = [];
173
173
  var colhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
174
+ console.log(colhidden);
174
175
  if (colhidden) {
175
176
  Object.keys(colhidden).forEach(function (key) {
176
177
  var item = {
@@ -179,20 +180,36 @@ var ColumnHeader = function ColumnHeader() {
179
180
  };
180
181
  tempPointers.push(item);
181
182
  });
182
- console.log(tempPointers);
183
183
  setHiddenPointers(tempPointers);
184
184
  } else {
185
185
  setHiddenPointers([]);
186
186
  }
187
187
  }, [context.visibledatacolumn, sheetIndex]);
188
188
  var showColumn = function showColumn(e, item) {
189
+ var _a, _b;
190
+ if (sheetIndex == null) return;
191
+ var startPoint = item.col;
192
+ var startCol = startPoint;
193
+ var endCol = startPoint;
194
+ var colhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
195
+ var findColBoundary = function findColBoundary(start, direction) {
196
+ var tempPoint = start;
197
+ while (true) {
198
+ var checkColIndex = tempPoint + direction;
199
+ if (!(colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(checkColIndex))) break;
200
+ tempPoint = checkColIndex;
201
+ }
202
+ return tempPoint;
203
+ };
204
+ startCol = findColBoundary(startPoint, -1);
205
+ endCol = findColBoundary(startPoint, 1);
189
206
  if (context.isFlvReadOnly) return;
190
207
  e.stopPropagation();
191
208
  setContext(function (ctx) {
192
209
  var _a;
193
210
  _fortuneCore.api.setSelection(ctx, [{
194
211
  row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
195
- column: [Number(item.col) - 1, Number(item.col) + 1]
212
+ column: [Number(startCol) - 1, Number(endCol) + 1]
196
213
  }], {
197
214
  id: context.currentSheetId
198
215
  });
@@ -200,6 +217,15 @@ var ColumnHeader = function ColumnHeader() {
200
217
  setContext(function (ctx) {
201
218
  (0, _fortuneCore.showSelected)(ctx, "column");
202
219
  });
220
+ setContext(function (ctx) {
221
+ var _a;
222
+ _fortuneCore.api.setSelection(ctx, [{
223
+ row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
224
+ column: [Number(startCol), Number(endCol)]
225
+ }], {
226
+ id: context.currentSheetId
227
+ });
228
+ });
203
229
  };
204
230
  (0, _react.useEffect)(function () {
205
231
  containerRef.current.scrollLeft = context.scrollLeft;
@@ -204,14 +204,14 @@ var FormulaHint = function FormulaHint(props) {
204
204
  if (param.require === "o") {
205
205
  name = "[".concat(name, "]");
206
206
  }
207
- return /*#__PURE__*/_react.default.createElement("code", {
207
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("code", {
208
208
  className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
209
209
  dir: "auto",
210
210
  key: name,
211
211
  style: {
212
212
  backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
213
213
  }
214
- }, name, i !== fn.p.length - 1 && ", ");
214
+ }, name), i !== fn.p.length - 1 && ", ");
215
215
  })), /*#__PURE__*/_react.default.createElement("code", {
216
216
  className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
217
217
  }, ")")), /*#__PURE__*/_react.default.createElement("div", {
@@ -184,12 +184,29 @@ var RowHeader = function RowHeader() {
184
184
  }
185
185
  }, [context.visibledatarow, sheetIndex]);
186
186
  var showRow = function showRow(e, item) {
187
+ var _a, _b;
188
+ if (sheetIndex == null) return;
189
+ var startPoint = item.row;
190
+ var startRow = startPoint;
191
+ var endRow = startPoint;
192
+ var rowhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
193
+ var findRowBoundary = function findRowBoundary(start, direction) {
194
+ var tempPoint = start;
195
+ while (true) {
196
+ var checkRowIndex = tempPoint + direction;
197
+ if (!(rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(checkRowIndex))) break;
198
+ tempPoint = checkRowIndex;
199
+ }
200
+ return tempPoint;
201
+ };
202
+ startRow = findRowBoundary(startPoint, -1);
203
+ endRow = findRowBoundary(startPoint, 1);
187
204
  if (context.isFlvReadOnly) return;
188
205
  e.stopPropagation();
189
206
  setContext(function (ctx) {
190
207
  var _a;
191
208
  _fortuneCore.api.setSelection(ctx, [{
192
- row: [Number(item.row) - 1, Number(item.row) + 1],
209
+ row: [Number(startRow) - 1, Number(endRow) + 1],
193
210
  column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
194
211
  }], {
195
212
  id: context.currentSheetId
@@ -198,6 +215,15 @@ var RowHeader = function RowHeader() {
198
215
  setContext(function (ctx) {
199
216
  (0, _fortuneCore.showSelected)(ctx, "row");
200
217
  });
218
+ setContext(function (ctx) {
219
+ var _a;
220
+ _fortuneCore.api.setSelection(ctx, [{
221
+ row: [Number(startRow), Number(endRow)],
222
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
223
+ }], {
224
+ id: context.currentSheetId
225
+ });
226
+ });
201
227
  };
202
228
  (0, _react.useEffect)(function () {
203
229
  containerRef.current.scrollTop = context.scrollTop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.5",
19
+ "@fileverse-dev/fortune-core": "1.2.7",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",