@fileverse-dev/fortune-react 1.1.99 → 1.2.0-link-ux-2

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.
Files changed (41) hide show
  1. package/es/components/ContextMenu/index.js +2 -2
  2. package/es/components/DataVerification/ColorPicker.js +31 -7
  3. package/es/components/DataVerification/DropdownList.js +20 -1
  4. package/es/components/DataVerification/DropdownOption.js +5 -2
  5. package/es/components/DataVerification/RangeDialog.js +1 -5
  6. package/es/components/DataVerification/index.css +21 -1
  7. package/es/components/DataVerification/index.js +31 -5
  8. package/es/components/LinkEidtCard/index.d.ts +3 -1
  9. package/es/components/LinkEidtCard/index.js +56 -18
  10. package/es/components/SheetOverlay/ColumnHeader.js +88 -5
  11. package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
  12. package/es/components/SheetOverlay/InputBox.js +1 -1
  13. package/es/components/SheetOverlay/RowHeader.js +82 -5
  14. package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
  15. package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
  16. package/es/components/SheetOverlay/helper.js +3 -3
  17. package/es/components/SheetOverlay/index.css +24 -1
  18. package/es/components/Toolbar/index.js +28 -19
  19. package/es/components/Workbook/index.d.ts +1 -1
  20. package/es/components/Workbook/index.js +5 -0
  21. package/lib/components/ContextMenu/index.js +2 -2
  22. package/lib/components/DataVerification/ColorPicker.js +30 -6
  23. package/lib/components/DataVerification/DropdownList.js +20 -1
  24. package/lib/components/DataVerification/DropdownOption.js +5 -2
  25. package/lib/components/DataVerification/RangeDialog.js +1 -5
  26. package/lib/components/DataVerification/index.css +21 -1
  27. package/lib/components/DataVerification/index.js +31 -5
  28. package/lib/components/LinkEidtCard/index.d.ts +3 -1
  29. package/lib/components/LinkEidtCard/index.js +55 -17
  30. package/lib/components/SheetOverlay/ColumnHeader.js +86 -4
  31. package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
  32. package/lib/components/SheetOverlay/InputBox.js +1 -1
  33. package/lib/components/SheetOverlay/RowHeader.js +80 -4
  34. package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
  35. package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
  36. package/lib/components/SheetOverlay/helper.js +3 -3
  37. package/lib/components/SheetOverlay/index.css +24 -1
  38. package/lib/components/Toolbar/index.js +27 -19
  39. package/lib/components/Workbook/index.d.ts +1 -1
  40. package/lib/components/Workbook/index.js +5 -0
  41. package/package.json +3 -2
@@ -32,23 +32,29 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
32
32
  originType = _a.originType,
33
33
  originAddress = _a.originAddress,
34
34
  isEditing = _a.isEditing,
35
- position = _a.position;
35
+ position = _a.position,
36
+ selectionHeight = _a.selectionHeight;
36
37
  var _b = (0, _react.useContext)(_context.default),
37
38
  context = _b.context,
38
39
  setContext = _b.setContext,
39
40
  refs = _b.refs;
40
- var _c = (0, _react.useState)(originText),
41
- linkText = _c[0],
42
- setLinkText = _c[1];
43
- var _d = (0, _react.useState)(originAddress),
44
- linkAddress = _d[0],
45
- setLinkAddress = _d[1];
46
- var _e = (0, _react.useState)(originType),
47
- linkType = _e[0],
48
- setLinkType = _e[1];
49
- var _f = (0, _fortuneCore.locale)(context),
50
- insertLink = _f.insertLink,
51
- linkTypeList = _f.linkTypeList;
41
+ var cardRef = (0, _react.useRef)(null);
42
+ var _c = (0, _react.useState)(position.cellBottom + 8),
43
+ cardTop = _c[0],
44
+ setCardTop = _c[1];
45
+ var cellTop = position.cellBottom - (typeof selectionHeight === "number" ? selectionHeight : 30);
46
+ var _d = (0, _react.useState)(originText),
47
+ linkText = _d[0],
48
+ setLinkText = _d[1];
49
+ var _e = (0, _react.useState)(originAddress),
50
+ linkAddress = _e[0],
51
+ setLinkAddress = _e[1];
52
+ var _f = (0, _react.useState)(originType),
53
+ linkType = _f[0],
54
+ setLinkType = _f[1];
55
+ var _g = (0, _fortuneCore.locale)(context),
56
+ insertLink = _g.insertLink,
57
+ linkTypeList = _g.linkTypeList;
52
58
  var isLinkAddressValid = (0, _fortuneCore.isLinkValid)(context, linkType, linkAddress);
53
59
  var isButtonDisabled = (0, _react.useMemo)(function () {
54
60
  if (!linkText.trim()) return true;
@@ -84,13 +90,20 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
84
90
  return e.stopPropagation();
85
91
  },
86
92
  onKeyDown: function onKeyDown(e) {
87
- return e.stopPropagation();
93
+ e.stopPropagation();
94
+ if (isButtonDisabled) return;
95
+ if (e.key === "Enter") {
96
+ _lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
97
+ setContext(function (draftCtx) {
98
+ return (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
99
+ });
100
+ }
88
101
  },
89
102
  onDoubleClick: function onDoubleClick(e) {
90
103
  return e.stopPropagation();
91
104
  }
92
105
  };
93
- }, [refs.globalCache]);
106
+ }, [refs.globalCache, isButtonDisabled]);
94
107
  var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
95
108
  return /*#__PURE__*/_react.default.createElement("div", {
96
109
  className: "fortune-toolbar-button",
@@ -109,6 +122,26 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
109
122
  setLinkText(originText);
110
123
  setLinkType(originType);
111
124
  }, [rc, originAddress, originText, originType]);
125
+ (0, _react.useEffect)(function () {
126
+ var dragHandle = document.querySelector(".luckysheet-cs-draghandle-top.luckysheet-cs-draghandle");
127
+ var card = cardRef.current;
128
+ if (!dragHandle || !card) {
129
+ setCardTop(position.cellBottom + 8);
130
+ return;
131
+ }
132
+ var dragRect = dragHandle.getBoundingClientRect();
133
+ var cardRect = card.getBoundingClientRect();
134
+ var viewportHeight = window.innerHeight;
135
+ var spaceBelow = viewportHeight - dragRect.bottom;
136
+ var spaceAbove = dragRect.top;
137
+ var newTop;
138
+ if (spaceBelow < cardRect.height + 16 && spaceAbove > cardRect.height + 16) {
139
+ newTop = cellTop - cardRect.height - 8;
140
+ } else {
141
+ newTop = position.cellBottom + 8;
142
+ }
143
+ setCardTop(newTop);
144
+ }, [cellTop, position.cellBottom, isEditing, originText, originAddress, originType]);
112
145
  if (!isEditing) {
113
146
  return /*#__PURE__*/_react.default.createElement("div", __assign({}, containerEvent, {
114
147
  onKeyDown: function onKeyDown(e) {
@@ -151,9 +184,12 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
151
184
  }
152
185
  return /*#__PURE__*/_react.default.createElement("div", __assign({
153
186
  className: "fortune-link-card",
187
+ ref: cardRef,
154
188
  style: {
155
189
  left: position.cellLeft + 20,
156
- top: position.cellBottom
190
+ top: cardTop,
191
+ position: "absolute",
192
+ zIndex: 1000
157
193
  }
158
194
  }, containerEvent), /*#__PURE__*/_react.default.createElement(_ui.Select, {
159
195
  value: linkType,
@@ -191,7 +227,8 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
191
227
  onChange: function onChange(e) {
192
228
  return setLinkText(e.target.value);
193
229
  },
194
- className: "fortune-link-input"
230
+ className: "fortune-link-input",
231
+ autoFocus: !linkText
195
232
  })), linkType === "webpage" && (/*#__PURE__*/_react.default.createElement("div", {
196
233
  className: "fortune-input-with-icon"
197
234
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -203,6 +240,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
203
240
  })), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
204
241
  placeholder: "Paste URL",
205
242
  value: linkAddress,
243
+ autoFocus: !!linkText,
206
244
  onChange: function onChange(e) {
207
245
  return setLinkAddress(e.target.value);
208
246
  },
@@ -82,13 +82,13 @@ var ColumnHeader = function ColumnHeader() {
82
82
  }]);
83
83
  }, [context, hoverLocation.col_index, refs.globalCache.freezen]);
84
84
  var onMouseDown = (0, _react.useCallback)(function (e) {
85
- if (e.button === 0 && e.target.tagName === "use") {
85
+ if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
86
86
  var nativeEvent_1 = e.nativeEvent;
87
87
  setContext(function (draft) {
88
88
  (0, _fortuneCore.handleColumnHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
89
89
  });
90
90
  }
91
- if (e.button !== 0) return;
91
+ if (e.button !== 0 || context.isFlvReadOnly) return;
92
92
  var targetEl = e.target;
93
93
  if (targetEl.closest(".fortune-cols-change-size") || targetEl.closest(".fortune-cols-freeze-handle") || targetEl.closest(".header-arrow")) return;
94
94
  var headerEl = containerRef.current;
@@ -163,6 +163,44 @@ var ColumnHeader = function ColumnHeader() {
163
163
  }
164
164
  setSelectedLocation(selects);
165
165
  }, [context.luckysheet_select_save, context.visibledatacolumn]);
166
+ var _g = (0, _react.useState)([]),
167
+ hiddenPointers = _g[0],
168
+ setHiddenPointers = _g[1];
169
+ (0, _react.useEffect)(function () {
170
+ var _a, _b;
171
+ if (sheetIndex == null) return;
172
+ var tempPointers = [];
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
+ if (colhidden) {
175
+ Object.keys(colhidden).forEach(function (key) {
176
+ var item = {
177
+ col: key,
178
+ left: context.visibledatacolumn[Number(key) - 1]
179
+ };
180
+ tempPointers.push(item);
181
+ });
182
+ console.log(tempPointers);
183
+ setHiddenPointers(tempPointers);
184
+ } else {
185
+ setHiddenPointers([]);
186
+ }
187
+ }, [context.visibledatacolumn, sheetIndex]);
188
+ var showColumn = function showColumn(e, item) {
189
+ if (context.isFlvReadOnly) return;
190
+ e.stopPropagation();
191
+ setContext(function (ctx) {
192
+ var _a;
193
+ _fortuneCore.api.setSelection(ctx, [{
194
+ row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
195
+ column: [Number(item.col) - 1, Number(item.col) + 1]
196
+ }], {
197
+ id: context.currentSheetId
198
+ });
199
+ });
200
+ setContext(function (ctx) {
201
+ (0, _fortuneCore.showSelected)(ctx, "column");
202
+ });
203
+ };
166
204
  (0, _react.useEffect)(function () {
167
205
  containerRef.current.scrollLeft = context.scrollLeft;
168
206
  }, [context.scrollLeft]);
@@ -185,7 +223,51 @@ var ColumnHeader = function ColumnHeader() {
185
223
  };
186
224
  });
187
225
  }
188
- }, /*#__PURE__*/_react.default.createElement("div", {
226
+ }, hiddenPointers.map(function (item) {
227
+ return /*#__PURE__*/_react.default.createElement("div", {
228
+ className: "flex gap-4 cursor-pointer hide-btn align-center",
229
+ style: {
230
+ height: context.columnHeaderHeight - 12,
231
+ left: "".concat(item.left - 12, "px")
232
+ },
233
+ onClick: function onClick(e) {
234
+ return showColumn(e, item);
235
+ }
236
+ }, /*#__PURE__*/_react.default.createElement("div", {
237
+ className: ""
238
+ }, /*#__PURE__*/_react.default.createElement("svg", {
239
+ xmlns: "http://www.w3.org/2000/svg",
240
+ width: "5",
241
+ height: "8",
242
+ viewBox: "0 0 5 8",
243
+ fill: "none"
244
+ }, /*#__PURE__*/_react.default.createElement("path", {
245
+ d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
246
+ fill: "#363B3F"
247
+ }))));
248
+ }), hiddenPointers.map(function (item) {
249
+ return /*#__PURE__*/_react.default.createElement("div", {
250
+ className: "flex gap-4 cursor-pointer hide-btn align-center",
251
+ style: {
252
+ height: context.columnHeaderHeight - 12,
253
+ left: "".concat(item.left + 6, "px")
254
+ },
255
+ onClick: function onClick(e) {
256
+ return showColumn(e, item);
257
+ }
258
+ }, /*#__PURE__*/_react.default.createElement("div", {
259
+ className: ""
260
+ }, /*#__PURE__*/_react.default.createElement("svg", {
261
+ xmlns: "http://www.w3.org/2000/svg",
262
+ width: "5",
263
+ height: "8",
264
+ viewBox: "0 0 5 8",
265
+ fill: "none"
266
+ }, /*#__PURE__*/_react.default.createElement("path", {
267
+ d: "M4.68811 4.35359L1.81188 7.22982C1.4969 7.5448 0.958328 7.32172 0.958328 6.87627L0.958328 1.12381C0.958328 0.678362 1.4969 0.455279 1.81188 0.770261L4.68811 3.64649C4.88337 3.84175 4.88337 4.15833 4.68811 4.35359Z",
268
+ fill: "#363B3F"
269
+ }))));
270
+ }), /*#__PURE__*/_react.default.createElement("div", {
189
271
  className: "fortune-cols-freeze-handle",
190
272
  onMouseDown: onColFreezeHandleMouseDown,
191
273
  style: {
@@ -208,7 +290,7 @@ var ColumnHeader = function ColumnHeader() {
208
290
  display: "block"
209
291
  }, (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, hoverLocation.col_index, hoverLocation.col_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
210
292
  }, allowEditRef.current && (/*#__PURE__*/_react.default.createElement("span", {
211
- className: "header-arrow",
293
+ className: "header-arrow mr-2",
212
294
  onClick: function onClick(e) {
213
295
  setContext(function (ctx) {
214
296
  ctx.contextMenu = {
@@ -75,6 +75,17 @@ var FormulaHint = function FormulaHint(props) {
75
75
  var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
76
76
  setTop(hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4);
77
77
  };
78
+ var hexToRgbString = function hexToRgbString(hex) {
79
+ hex = hex.replace("#", "");
80
+ var r = parseInt(hex.substring(0, 2), 16);
81
+ var g = parseInt(hex.substring(2, 4), 16);
82
+ var b = parseInt(hex.substring(4, 6), 16);
83
+ return "".concat(r, ", ").concat(g, ", ").concat(b);
84
+ };
85
+ var bgColor = function bgColor(BRAND_SECONDARY_COLOR) {
86
+ var bg = BRAND_SECONDARY_COLOR ? "rgb(".concat(hexToRgbString(BRAND_SECONDARY_COLOR), ", 0.4)") : "#FFDF0A";
87
+ return bg;
88
+ };
78
89
  (0, _react.useEffect)(function () {
79
90
  calcuatePopUpPlacement();
80
91
  }, []);
@@ -198,7 +209,7 @@ var FormulaHint = function FormulaHint(props) {
198
209
  dir: "auto",
199
210
  key: name,
200
211
  style: {
201
- backgroundColor: commaCount === i ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
212
+ backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
202
213
  }
203
214
  }, name, i !== fn.p.length - 1 && ", ");
204
215
  })), /*#__PURE__*/_react.default.createElement("code", {
@@ -374,7 +385,7 @@ var FormulaHint = function FormulaHint(props) {
374
385
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
375
386
  className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
376
387
  style: {
377
- backgroundColor: commaCount === index ? (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) || "#FFDF0A" : "transparent"
388
+ backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
378
389
  }
379
390
  }, param.name, param.repeat === "y" && (/*#__PURE__*/_react.default.createElement("span", {
380
391
  className: "luckysheet-arguments-help-argument-info example-value",
@@ -504,7 +504,7 @@ var InputBox = function InputBox() {
504
504
  minHeight: firstSelection.height
505
505
  }, inputBoxStyle) : {}
506
506
  }, /*#__PURE__*/_react.default.createElement(_ContentEditable.default, {
507
- onMouseUp: function onMouseUp(e) {
507
+ onMouseUp: function onMouseUp() {
508
508
  var currentCommaCount = (0, _helper.countCommasBeforeCursor)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
509
509
  setCommaCount(currentCommaCount);
510
510
  },
@@ -76,7 +76,13 @@ var RowHeader = function RowHeader() {
76
76
  getRowIndexClicked = _f.getRowIndexClicked,
77
77
  isRowDoubleClicked = _f.isRowDoubleClicked;
78
78
  var onMouseDown = (0, _react.useCallback)(function (e) {
79
- if (e.button !== 0) return;
79
+ if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
80
+ var nativeEvent_1 = e.nativeEvent;
81
+ setContext(function (draft) {
82
+ (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
83
+ });
84
+ }
85
+ if (e.button !== 0 || context.isFlvReadOnly) return;
80
86
  var targetEl = e.target;
81
87
  if (targetEl.closest(".fortune-rows-change-size") || targetEl.closest(".fortune-rows-freeze-handle")) return;
82
88
  var headerEl = containerRef.current;
@@ -88,9 +94,9 @@ var RowHeader = function RowHeader() {
88
94
  draft.luckysheet_scroll_status = true;
89
95
  });
90
96
  } else {
91
- var nativeEvent_1 = e.nativeEvent;
97
+ var nativeEvent_2 = e.nativeEvent;
92
98
  setContext(function (draft) {
93
- (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
99
+ (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
94
100
  });
95
101
  return;
96
102
  }
@@ -156,6 +162,43 @@ var RowHeader = function RowHeader() {
156
162
  }
157
163
  setSelectedLocation(selects);
158
164
  }, [context.luckysheet_select_save, context.visibledatarow]);
165
+ var _g = (0, _react.useState)([]),
166
+ hiddenPointers = _g[0],
167
+ setHiddenPointers = _g[1];
168
+ (0, _react.useEffect)(function () {
169
+ var _a, _b;
170
+ if (sheetIndex == null) return;
171
+ var tempPointers = [];
172
+ var rowhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
173
+ if (rowhidden) {
174
+ Object.keys(rowhidden).forEach(function (key) {
175
+ var item = {
176
+ row: key,
177
+ top: context.visibledatarow[Number(key) - 1]
178
+ };
179
+ tempPointers.push(item);
180
+ });
181
+ setHiddenPointers(tempPointers);
182
+ } else {
183
+ setHiddenPointers([]);
184
+ }
185
+ }, [context.visibledatarow, sheetIndex]);
186
+ var showRow = function showRow(e, item) {
187
+ if (context.isFlvReadOnly) return;
188
+ e.stopPropagation();
189
+ setContext(function (ctx) {
190
+ var _a;
191
+ _fortuneCore.api.setSelection(ctx, [{
192
+ row: [Number(item.row) - 1, Number(item.row) + 1],
193
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
194
+ }], {
195
+ id: context.currentSheetId
196
+ });
197
+ });
198
+ setContext(function (ctx) {
199
+ (0, _fortuneCore.showSelected)(ctx, "row");
200
+ });
201
+ };
159
202
  (0, _react.useEffect)(function () {
160
203
  containerRef.current.scrollTop = context.scrollTop;
161
204
  }, [context.scrollTop]);
@@ -170,7 +213,40 @@ var RowHeader = function RowHeader() {
170
213
  onMouseDown: onMouseDown,
171
214
  onMouseLeave: onMouseLeave,
172
215
  onContextMenu: onContextMenu
173
- }, /*#__PURE__*/_react.default.createElement("div", {
216
+ }, hiddenPointers.map(function (item) {
217
+ return /*#__PURE__*/_react.default.createElement("div", {
218
+ className: "flex flex-col gap-4 cursor-pointer align-center hide-btn-row hide-btn",
219
+ style: {
220
+ top: "".concat(item.top - 16, "px"),
221
+ zIndex: 100
222
+ },
223
+ onClick: function onClick(e) {
224
+ return showRow(e, item);
225
+ }
226
+ }, /*#__PURE__*/_react.default.createElement("div", {
227
+ className: "rotate-row-icon"
228
+ }, /*#__PURE__*/_react.default.createElement("svg", {
229
+ xmlns: "http://www.w3.org/2000/svg",
230
+ width: "5",
231
+ height: "8",
232
+ viewBox: "0 0 5 8",
233
+ fill: "none"
234
+ }, /*#__PURE__*/_react.default.createElement("path", {
235
+ d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
236
+ fill: "#363B3F"
237
+ }))), /*#__PURE__*/_react.default.createElement("div", {
238
+ className: "rotate-90"
239
+ }, /*#__PURE__*/_react.default.createElement("svg", {
240
+ xmlns: "http://www.w3.org/2000/svg",
241
+ width: "5",
242
+ height: "8",
243
+ viewBox: "0 0 5 8",
244
+ fill: "none"
245
+ }, /*#__PURE__*/_react.default.createElement("path", {
246
+ d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
247
+ fill: "#363B3F"
248
+ }))));
249
+ }), /*#__PURE__*/_react.default.createElement("div", {
174
250
  className: "fortune-rows-freeze-handle",
175
251
  onMouseDown: onRowFreezeHandleMouseDown,
176
252
  style: {
@@ -280,24 +280,26 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
280
280
  }
281
281
  });
282
282
  });
283
- var newDataVerification = {};
284
- Object.keys(_sheet.dataVerification).forEach(function (item) {
285
- var _a;
286
- var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
287
- var colRow = item.split("_");
288
- if (colRow.length !== 2) return;
289
- var presentcol = parseInt(colRow[1], 10);
290
- var updatedCol = presentcol;
291
- if (presentcol === sourceIndex_1) {
292
- updatedCol = targetIndex;
293
- } else if (presentcol > sourceIndex_1 && presentcol < targetIndex) {
294
- updatedCol -= 1;
295
- } else if (presentcol < sourceIndex_1 && presentcol >= targetIndex) {
296
- updatedCol += 1;
297
- }
298
- newDataVerification["".concat(colRow[0], "_").concat(updatedCol)] = itemData;
299
- });
300
- _sheet.dataVerification = newDataVerification;
283
+ if (_sheet.dataVerification) {
284
+ var newDataVerification_1 = {};
285
+ Object.keys(_sheet.dataVerification).forEach(function (item) {
286
+ var _a;
287
+ var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
288
+ var colRow = item.split("_");
289
+ if (colRow.length !== 2) return;
290
+ var presentcol = parseInt(colRow[1], 10);
291
+ var updatedCol = presentcol;
292
+ if (presentcol === sourceIndex_1) {
293
+ updatedCol = targetIndex;
294
+ } else if (presentcol > sourceIndex_1 && presentcol < targetIndex) {
295
+ updatedCol -= 1;
296
+ } else if (presentcol < sourceIndex_1 && presentcol >= targetIndex) {
297
+ updatedCol += 1;
298
+ }
299
+ newDataVerification_1["".concat(colRow[0], "_").concat(updatedCol)] = itemData;
300
+ });
301
+ _sheet.dataVerification = newDataVerification_1;
302
+ }
301
303
  (_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.forEach(function (item) {
302
304
  if (item.c === sourceIndex_1) {
303
305
  item.c = targetIndex;
@@ -260,24 +260,26 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
260
260
  }
261
261
  });
262
262
  });
263
- var newDataVerification = {};
264
- Object.keys(_sheet.dataVerification).forEach(function (item) {
265
- var _a;
266
- var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
267
- var colRow = item.split("_");
268
- if (colRow.length !== 2) return;
269
- var presentRow = parseInt(colRow[0], 10);
270
- var updatedRow = presentRow;
271
- if (presentRow === sourceIndex_1) {
272
- updatedRow = targetIndex;
273
- } else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
274
- updatedRow -= 1;
275
- } else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
276
- updatedRow += 1;
277
- }
278
- newDataVerification["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
279
- });
280
- _sheet.dataVerification = newDataVerification;
263
+ if (_sheet.dataVerification) {
264
+ var newDataVerification_1 = {};
265
+ Object.keys(_sheet.dataVerification).forEach(function (item) {
266
+ var _a;
267
+ var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
268
+ var colRow = item.split("_");
269
+ if (colRow.length !== 2) return;
270
+ var presentRow = parseInt(colRow[0], 10);
271
+ var updatedRow = presentRow;
272
+ if (presentRow === sourceIndex_1) {
273
+ updatedRow = targetIndex;
274
+ } else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
275
+ updatedRow -= 1;
276
+ } else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
277
+ updatedRow += 1;
278
+ }
279
+ newDataVerification_1["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
280
+ });
281
+ _sheet.dataVerification = newDataVerification_1;
282
+ }
281
283
  (_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
282
284
  if (item.r === sourceIndex_1) {
283
285
  item.r = targetIndex;
@@ -108,12 +108,12 @@ function countCommasBeforeCursor(editableDiv) {
108
108
  var textBeforeCursor = preCaretRange.toString();
109
109
  var inQuotes = false;
110
110
  var count = 0;
111
- for (var i = 0; i < textBeforeCursor.length; i++) {
111
+ for (var i = 0; i < textBeforeCursor.length; i += 1) {
112
112
  var char = textBeforeCursor[i];
113
113
  if (char === '"') {
114
114
  inQuotes = !inQuotes;
115
- } else if (char === ',' && !inQuotes) {
116
- count++;
115
+ } else if (char === "," && !inQuotes) {
116
+ count += 1;
117
117
  }
118
118
  }
119
119
  return count;
@@ -1010,4 +1010,27 @@
1010
1010
  background: #555;
1011
1011
  /* darker on hover */
1012
1012
  /* scrollbar */
1013
- }
1013
+ }
1014
+
1015
+ .hide-btn {
1016
+ padding-top: 1px;
1017
+ position: absolute;
1018
+ right: 5;
1019
+ top: 5px;
1020
+ z-index: 200;
1021
+ width: 9px;
1022
+ }
1023
+
1024
+ .hide-btn:hover {
1025
+ border: 1px solid #0188fb;
1026
+ }
1027
+
1028
+ .rotate-row-icon {
1029
+ transform: rotate(-90deg);
1030
+ }
1031
+
1032
+ .hide-btn-row {
1033
+ position: absolute;
1034
+ left: 4px;
1035
+ z-index: 200;
1036
+ }
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getLucideIcon = exports.default = exports.CurrencySelector = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _fortuneCore = require("@fileverse-dev/fortune-core");
10
- var _api = require("@fileverse-dev/fortune-core/lib/api");
11
10
  var _lodash = _interopRequireDefault(require("lodash"));
12
11
  var _ui = require("@fileverse/ui");
13
12
  var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
@@ -594,9 +593,35 @@ var Toolbar = function Toolbar(_a) {
594
593
  }
595
594
  }
596
595
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
596
+ (0, _react.useEffect)(function () {
597
+ setContext(function (ctx) {
598
+ ctx.dataVerification.dataRegulation.value1 = "value1";
599
+ });
600
+ }, []);
597
601
  var _o = (0, _react.useState)(false),
598
602
  showDataValidation = _o[0],
599
603
  setShowDataValidation = _o[1];
604
+ var dataVerificationClick = function dataVerificationClick() {
605
+ var _a;
606
+ var selection = _fortuneCore.api.getSelection(context);
607
+ if (!selection) {
608
+ setContext(function (ctx) {
609
+ _fortuneCore.api.setSelection(ctx, [{
610
+ row: [0, 0],
611
+ column: [0, 0]
612
+ }], {
613
+ id: context.currentSheetId
614
+ });
615
+ });
616
+ }
617
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
618
+ setTimeout(function () {
619
+ setShowDataValidation(true);
620
+ }, 100);
621
+ };
622
+ (0, _react.useEffect)(function () {
623
+ window.dataVerificationClick = dataVerificationClick;
624
+ }, []);
600
625
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
601
626
  var _a, _b, _c, _d, _e, _f, _g;
602
627
  var tooltip = toolbar[name];
@@ -979,24 +1004,7 @@ var Toolbar = function Toolbar(_a) {
979
1004
  iconId: name,
980
1005
  tooltip: tooltip,
981
1006
  key: name,
982
- onClick: function onClick() {
983
- var _a;
984
- var selection = (0, _api.getSelection)(context);
985
- if (!selection) {
986
- setContext(function (ctx) {
987
- (0, _api.setSelection)(ctx, [{
988
- row: [0, 0],
989
- column: [0, 0]
990
- }], {
991
- id: context.currentSheetId
992
- });
993
- });
994
- }
995
- (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
996
- setTimeout(function () {
997
- setShowDataValidation(true);
998
- }, 100);
999
- }
1007
+ onClick: dataVerificationClick
1000
1008
  }));
1001
1009
  }
1002
1010
  if (name === "locationCondition") {
@@ -57,7 +57,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
57
57
  getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
58
58
  setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
59
59
  setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
60
- setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").SingleRange | import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
60
+ setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").Range | import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
61
61
  mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
62
62
  cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
63
63
  getAllSheets: () => SheetType[];
@@ -656,6 +656,11 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
656
656
  }
657
657
  });
658
658
  }
659
+ setContextWithProduce(function (ctx) {
660
+ if (ctx.luckysheet_selection_range) {
661
+ ctx.luckysheet_selection_range = [];
662
+ }
663
+ });
659
664
  }, [context, setContextWithProduce]);
660
665
  var onMoreToolbarItemsClose = (0, _react.useCallback)(function () {
661
666
  setMoreToolbarItems(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.1.99",
3
+ "version": "1.2.0-link-ux-2",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,12 +16,13 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.1.99",
19
+ "@fileverse-dev/fortune-core": "1.2.0-link-ux-2",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",
23
23
  "immer": "^9.0.12",
24
24
  "lodash": "^4.17.21",
25
+ "react-intersection-observer": "^9.16.0",
25
26
  "regenerator-runtime": "^0.14.1"
26
27
  },
27
28
  "peerDependencies": {