@fileverse-dev/fortune-react 1.2.5 → 1.2.6

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.
@@ -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
+ 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,30 @@ 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
+ 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);
195
+ console.log(startRow, endRow);
178
196
  if (context.isFlvReadOnly) return;
179
197
  e.stopPropagation();
180
198
  setContext(function (ctx) {
181
199
  var _a;
182
200
  api.setSelection(ctx, [{
183
- row: [Number(item.row) - 1, Number(item.row) + 1],
201
+ row: [Number(startRow) - 1, Number(endRow) + 1],
184
202
  column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
185
203
  }], {
186
204
  id: context.currentSheetId
@@ -189,6 +207,15 @@ var RowHeader = function RowHeader() {
189
207
  setContext(function (ctx) {
190
208
  showSelected(ctx, "row");
191
209
  });
210
+ setContext(function (ctx) {
211
+ var _a;
212
+ api.setSelection(ctx, [{
213
+ row: [Number(startRow), Number(endRow)],
214
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
215
+ }], {
216
+ id: context.currentSheetId
217
+ });
218
+ });
192
219
  };
193
220
  useEffect(function () {
194
221
  containerRef.current.scrollTop = context.scrollTop;
@@ -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
+ 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,30 @@ 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
+ 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);
204
+ console.log(startRow, endRow);
187
205
  if (context.isFlvReadOnly) return;
188
206
  e.stopPropagation();
189
207
  setContext(function (ctx) {
190
208
  var _a;
191
209
  _fortuneCore.api.setSelection(ctx, [{
192
- row: [Number(item.row) - 1, Number(item.row) + 1],
210
+ row: [Number(startRow) - 1, Number(endRow) + 1],
193
211
  column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
194
212
  }], {
195
213
  id: context.currentSheetId
@@ -198,6 +216,15 @@ var RowHeader = function RowHeader() {
198
216
  setContext(function (ctx) {
199
217
  (0, _fortuneCore.showSelected)(ctx, "row");
200
218
  });
219
+ setContext(function (ctx) {
220
+ var _a;
221
+ _fortuneCore.api.setSelection(ctx, [{
222
+ row: [Number(startRow), Number(endRow)],
223
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
224
+ }], {
225
+ id: context.currentSheetId
226
+ });
227
+ });
201
228
  };
202
229
  (0, _react.useEffect)(function () {
203
230
  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.6",
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.6",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",