@fileverse-dev/fortune-react 1.1.98 → 1.1.99-patch-3
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/es/components/ContextMenu/index.js +2 -2
- package/es/components/DataVerification/ColorPicker.js +31 -7
- package/es/components/DataVerification/DropdownList.js +20 -1
- package/es/components/DataVerification/DropdownOption.js +8 -2
- package/es/components/DataVerification/RangeDialog.js +0 -2
- package/es/components/DataVerification/index.css +20 -0
- package/es/components/DataVerification/index.js +29 -5
- package/es/components/SheetOverlay/ColumnHeader.js +88 -5
- package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/es/components/SheetOverlay/InputBox.js +1 -1
- package/es/components/SheetOverlay/RowHeader.js +82 -5
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
- package/es/components/SheetOverlay/helper.d.ts +0 -1
- package/es/components/SheetOverlay/helper.js +3 -16
- package/es/components/SheetOverlay/index.css +24 -1
- package/es/components/Toolbar/index.d.ts +1 -1
- package/es/components/Toolbar/index.js +23 -19
- package/es/components/Workbook/api.d.ts +1 -1
- package/es/components/Workbook/index.d.ts +10 -10
- package/es/components/Workbook/index.js +5 -0
- package/lib/components/ContextMenu/index.js +2 -2
- package/lib/components/DataVerification/ColorPicker.js +30 -6
- package/lib/components/DataVerification/DropdownList.js +20 -1
- package/lib/components/DataVerification/DropdownOption.js +8 -2
- package/lib/components/DataVerification/RangeDialog.js +0 -2
- package/lib/components/DataVerification/index.css +20 -0
- package/lib/components/DataVerification/index.js +29 -5
- package/lib/components/SheetOverlay/ColumnHeader.js +87 -4
- package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/lib/components/SheetOverlay/InputBox.js +1 -1
- package/lib/components/SheetOverlay/RowHeader.js +81 -4
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
- package/lib/components/SheetOverlay/helper.d.ts +0 -1
- package/lib/components/SheetOverlay/helper.js +3 -17
- package/lib/components/SheetOverlay/index.css +24 -1
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/components/Toolbar/index.js +23 -19
- package/lib/components/Workbook/api.d.ts +1 -1
- package/lib/components/Workbook/index.d.ts +10 -10
- package/lib/components/Workbook/index.js +5 -0
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
9
|
+
var _api = require("@fileverse-dev/fortune-core/src/api");
|
|
9
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _context = _interopRequireDefault(require("../../context"));
|
|
@@ -82,13 +83,13 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
82
83
|
}]);
|
|
83
84
|
}, [context, hoverLocation.col_index, refs.globalCache.freezen]);
|
|
84
85
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
85
|
-
if (e.button === 0 && e.target.tagName === "use") {
|
|
86
|
+
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
86
87
|
var nativeEvent_1 = e.nativeEvent;
|
|
87
88
|
setContext(function (draft) {
|
|
88
89
|
(0, _fortuneCore.handleColumnHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
|
-
if (e.button !== 0) return;
|
|
92
|
+
if (e.button !== 0 || context.isFlvReadOnly) return;
|
|
92
93
|
var targetEl = e.target;
|
|
93
94
|
if (targetEl.closest(".fortune-cols-change-size") || targetEl.closest(".fortune-cols-freeze-handle") || targetEl.closest(".header-arrow")) return;
|
|
94
95
|
var headerEl = containerRef.current;
|
|
@@ -163,6 +164,44 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
163
164
|
}
|
|
164
165
|
setSelectedLocation(selects);
|
|
165
166
|
}, [context.luckysheet_select_save, context.visibledatacolumn]);
|
|
167
|
+
var _g = (0, _react.useState)([]),
|
|
168
|
+
hiddenPointers = _g[0],
|
|
169
|
+
setHiddenPointers = _g[1];
|
|
170
|
+
(0, _react.useEffect)(function () {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
if (sheetIndex == null) return;
|
|
173
|
+
var tempPointers = [];
|
|
174
|
+
var colhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
|
|
175
|
+
if (colhidden) {
|
|
176
|
+
Object.keys(colhidden).forEach(function (key) {
|
|
177
|
+
var item = {
|
|
178
|
+
col: key,
|
|
179
|
+
left: context.visibledatacolumn[Number(key) - 1]
|
|
180
|
+
};
|
|
181
|
+
tempPointers.push(item);
|
|
182
|
+
});
|
|
183
|
+
console.log(tempPointers);
|
|
184
|
+
setHiddenPointers(tempPointers);
|
|
185
|
+
} else {
|
|
186
|
+
setHiddenPointers([]);
|
|
187
|
+
}
|
|
188
|
+
}, [context.visibledatacolumn, sheetIndex]);
|
|
189
|
+
var showColumn = function showColumn(e, item) {
|
|
190
|
+
if (context.isFlvReadOnly) return;
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
setContext(function (ctx) {
|
|
193
|
+
var _a;
|
|
194
|
+
(0, _api.setSelection)(ctx, [{
|
|
195
|
+
row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
|
|
196
|
+
column: [Number(item.col) - 1, Number(item.col) + 1]
|
|
197
|
+
}], {
|
|
198
|
+
id: context.currentSheetId
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
setContext(function (ctx) {
|
|
202
|
+
(0, _fortuneCore.showSelected)(ctx, "column");
|
|
203
|
+
});
|
|
204
|
+
};
|
|
166
205
|
(0, _react.useEffect)(function () {
|
|
167
206
|
containerRef.current.scrollLeft = context.scrollLeft;
|
|
168
207
|
}, [context.scrollLeft]);
|
|
@@ -185,7 +224,51 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
185
224
|
};
|
|
186
225
|
});
|
|
187
226
|
}
|
|
188
|
-
},
|
|
227
|
+
}, hiddenPointers.map(function (item) {
|
|
228
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
229
|
+
className: "flex gap-4 cursor-pointer hide-btn align-center",
|
|
230
|
+
style: {
|
|
231
|
+
height: context.columnHeaderHeight - 12,
|
|
232
|
+
left: "".concat(item.left - 12, "px")
|
|
233
|
+
},
|
|
234
|
+
onClick: function onClick(e) {
|
|
235
|
+
return showColumn(e, item);
|
|
236
|
+
}
|
|
237
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
238
|
+
className: ""
|
|
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
|
+
}), hiddenPointers.map(function (item) {
|
|
250
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
251
|
+
className: "flex gap-4 cursor-pointer hide-btn align-center",
|
|
252
|
+
style: {
|
|
253
|
+
height: context.columnHeaderHeight - 12,
|
|
254
|
+
left: "".concat(item.left + 6, "px")
|
|
255
|
+
},
|
|
256
|
+
onClick: function onClick(e) {
|
|
257
|
+
return showColumn(e, item);
|
|
258
|
+
}
|
|
259
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
260
|
+
className: ""
|
|
261
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
262
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
263
|
+
width: "5",
|
|
264
|
+
height: "8",
|
|
265
|
+
viewBox: "0 0 5 8",
|
|
266
|
+
fill: "none"
|
|
267
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
268
|
+
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",
|
|
269
|
+
fill: "#363B3F"
|
|
270
|
+
}))));
|
|
271
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
189
272
|
className: "fortune-cols-freeze-handle",
|
|
190
273
|
onMouseDown: onColFreezeHandleMouseDown,
|
|
191
274
|
style: {
|
|
@@ -208,7 +291,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
208
291
|
display: "block"
|
|
209
292
|
}, (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, hoverLocation.col_index, hoverLocation.col_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
210
293
|
}, allowEditRef.current && (/*#__PURE__*/_react.default.createElement("span", {
|
|
211
|
-
className: "header-arrow",
|
|
294
|
+
className: "header-arrow mr-2",
|
|
212
295
|
onClick: function onClick(e) {
|
|
213
296
|
setContext(function (ctx) {
|
|
214
297
|
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
|
|
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
|
|
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(
|
|
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
|
},
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
9
|
+
var _api = require("@fileverse-dev/fortune-core/src/api");
|
|
9
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _context = _interopRequireDefault(require("../../context"));
|
|
@@ -76,7 +77,13 @@ var RowHeader = function RowHeader() {
|
|
|
76
77
|
getRowIndexClicked = _f.getRowIndexClicked,
|
|
77
78
|
isRowDoubleClicked = _f.isRowDoubleClicked;
|
|
78
79
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
79
|
-
if (e.button
|
|
80
|
+
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
81
|
+
var nativeEvent_1 = e.nativeEvent;
|
|
82
|
+
setContext(function (draft) {
|
|
83
|
+
(0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (e.button !== 0 || context.isFlvReadOnly) return;
|
|
80
87
|
var targetEl = e.target;
|
|
81
88
|
if (targetEl.closest(".fortune-rows-change-size") || targetEl.closest(".fortune-rows-freeze-handle")) return;
|
|
82
89
|
var headerEl = containerRef.current;
|
|
@@ -88,9 +95,9 @@ var RowHeader = function RowHeader() {
|
|
|
88
95
|
draft.luckysheet_scroll_status = true;
|
|
89
96
|
});
|
|
90
97
|
} else {
|
|
91
|
-
var
|
|
98
|
+
var nativeEvent_2 = e.nativeEvent;
|
|
92
99
|
setContext(function (draft) {
|
|
93
|
-
(0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache,
|
|
100
|
+
(0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
94
101
|
});
|
|
95
102
|
return;
|
|
96
103
|
}
|
|
@@ -156,6 +163,43 @@ var RowHeader = function RowHeader() {
|
|
|
156
163
|
}
|
|
157
164
|
setSelectedLocation(selects);
|
|
158
165
|
}, [context.luckysheet_select_save, context.visibledatarow]);
|
|
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 rowhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
|
|
174
|
+
if (rowhidden) {
|
|
175
|
+
Object.keys(rowhidden).forEach(function (key) {
|
|
176
|
+
var item = {
|
|
177
|
+
row: key,
|
|
178
|
+
top: context.visibledatarow[Number(key) - 1]
|
|
179
|
+
};
|
|
180
|
+
tempPointers.push(item);
|
|
181
|
+
});
|
|
182
|
+
setHiddenPointers(tempPointers);
|
|
183
|
+
} else {
|
|
184
|
+
setHiddenPointers([]);
|
|
185
|
+
}
|
|
186
|
+
}, [context.visibledatarow, sheetIndex]);
|
|
187
|
+
var showRow = function showRow(e, item) {
|
|
188
|
+
if (context.isFlvReadOnly) return;
|
|
189
|
+
e.stopPropagation();
|
|
190
|
+
setContext(function (ctx) {
|
|
191
|
+
var _a;
|
|
192
|
+
(0, _api.setSelection)(ctx, [{
|
|
193
|
+
row: [Number(item.row) - 1, Number(item.row) + 1],
|
|
194
|
+
column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
|
|
195
|
+
}], {
|
|
196
|
+
id: context.currentSheetId
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
setContext(function (ctx) {
|
|
200
|
+
(0, _fortuneCore.showSelected)(ctx, "row");
|
|
201
|
+
});
|
|
202
|
+
};
|
|
159
203
|
(0, _react.useEffect)(function () {
|
|
160
204
|
containerRef.current.scrollTop = context.scrollTop;
|
|
161
205
|
}, [context.scrollTop]);
|
|
@@ -170,7 +214,40 @@ var RowHeader = function RowHeader() {
|
|
|
170
214
|
onMouseDown: onMouseDown,
|
|
171
215
|
onMouseLeave: onMouseLeave,
|
|
172
216
|
onContextMenu: onContextMenu
|
|
173
|
-
},
|
|
217
|
+
}, hiddenPointers.map(function (item) {
|
|
218
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
219
|
+
className: "flex flex-col gap-4 cursor-pointer align-center hide-btn-row hide-btn",
|
|
220
|
+
style: {
|
|
221
|
+
top: "".concat(item.top - 16, "px"),
|
|
222
|
+
zIndex: 100
|
|
223
|
+
},
|
|
224
|
+
onClick: function onClick(e) {
|
|
225
|
+
return showRow(e, item);
|
|
226
|
+
}
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
228
|
+
className: "rotate-row-icon"
|
|
229
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
230
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
231
|
+
width: "5",
|
|
232
|
+
height: "8",
|
|
233
|
+
viewBox: "0 0 5 8",
|
|
234
|
+
fill: "none"
|
|
235
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
236
|
+
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",
|
|
237
|
+
fill: "#363B3F"
|
|
238
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
239
|
+
className: "rotate-90"
|
|
240
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
+
width: "5",
|
|
243
|
+
height: "8",
|
|
244
|
+
viewBox: "0 0 5 8",
|
|
245
|
+
fill: "none"
|
|
246
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
247
|
+
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",
|
|
248
|
+
fill: "#363B3F"
|
|
249
|
+
}))));
|
|
250
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
174
251
|
className: "fortune-rows-freeze-handle",
|
|
175
252
|
onMouseDown: onRowFreezeHandleMouseDown,
|
|
176
253
|
style: {
|
|
@@ -280,24 +280,26 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
|
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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;
|
|
@@ -6,5 +6,4 @@ export declare function incrementColumn(cell: string): string;
|
|
|
6
6
|
export declare function decrementColumn(cell: string): string;
|
|
7
7
|
export declare function incrementRow(cell: string): string;
|
|
8
8
|
export declare function decrementRow(cell: string): string;
|
|
9
|
-
export declare function countCommasOutsideQuotes(str: string): number;
|
|
10
9
|
export declare function countCommasBeforeCursor(editableDiv: HTMLDivElement): number;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.countCommasBeforeCursor = countCommasBeforeCursor;
|
|
7
|
-
exports.countCommasOutsideQuotes = countCommasOutsideQuotes;
|
|
8
7
|
exports.decrementColumn = decrementColumn;
|
|
9
8
|
exports.decrementRow = decrementRow;
|
|
10
9
|
exports.getCursorPosition = getCursorPosition;
|
|
@@ -99,19 +98,6 @@ function decrementRow(cell) {
|
|
|
99
98
|
var newRowPart = Math.max(1, parsed.rowPart - 1);
|
|
100
99
|
return parsed.colPart + newRowPart;
|
|
101
100
|
}
|
|
102
|
-
function countCommasOutsideQuotes(str) {
|
|
103
|
-
var inQuotes = false;
|
|
104
|
-
var count = 0;
|
|
105
|
-
for (var i = 0; i < str.length; i++) {
|
|
106
|
-
var char = str[i];
|
|
107
|
-
if (char === '"') {
|
|
108
|
-
inQuotes = !inQuotes;
|
|
109
|
-
} else if (char === ',' && !inQuotes) {
|
|
110
|
-
count++;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return count;
|
|
114
|
-
}
|
|
115
101
|
function countCommasBeforeCursor(editableDiv) {
|
|
116
102
|
var selection = window.getSelection();
|
|
117
103
|
if (!(selection === null || selection === void 0 ? void 0 : selection.rangeCount)) return 0;
|
|
@@ -122,12 +108,12 @@ function countCommasBeforeCursor(editableDiv) {
|
|
|
122
108
|
var textBeforeCursor = preCaretRange.toString();
|
|
123
109
|
var inQuotes = false;
|
|
124
110
|
var count = 0;
|
|
125
|
-
for (var i = 0; i < textBeforeCursor.length; i
|
|
111
|
+
for (var i = 0; i < textBeforeCursor.length; i += 1) {
|
|
126
112
|
var char = textBeforeCursor[i];
|
|
127
113
|
if (char === '"') {
|
|
128
114
|
inQuotes = !inQuotes;
|
|
129
|
-
} else if (char ===
|
|
130
|
-
count
|
|
115
|
+
} else if (char === "," && !inQuotes) {
|
|
116
|
+
count += 1;
|
|
131
117
|
}
|
|
132
118
|
}
|
|
133
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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Cell } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import "./index.css";
|
|
4
|
-
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "
|
|
4
|
+
export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "" | "Percent" | "ChevronDown" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "MergeHorizontal" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "DuneChart" | "Ellipsis";
|
|
5
5
|
export declare const CurrencySelector: ({ cell, defaultTextFormat, toolTipText, }: {
|
|
6
6
|
cell: Cell | null | undefined;
|
|
7
7
|
defaultTextFormat: string;
|
|
@@ -7,7 +7,7 @@ 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/
|
|
10
|
+
var _api = require("@fileverse-dev/fortune-core/src/api");
|
|
11
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
12
|
var _ui = require("@fileverse/ui");
|
|
13
13
|
var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
|
|
@@ -597,6 +597,27 @@ var Toolbar = function Toolbar(_a) {
|
|
|
597
597
|
var _o = (0, _react.useState)(false),
|
|
598
598
|
showDataValidation = _o[0],
|
|
599
599
|
setShowDataValidation = _o[1];
|
|
600
|
+
var dataVerificationClick = function dataVerificationClick() {
|
|
601
|
+
var _a;
|
|
602
|
+
var selection = (0, _api.getSelection)(context);
|
|
603
|
+
if (!selection) {
|
|
604
|
+
setContext(function (ctx) {
|
|
605
|
+
(0, _api.setSelection)(ctx, [{
|
|
606
|
+
row: [0, 0],
|
|
607
|
+
column: [0, 0]
|
|
608
|
+
}], {
|
|
609
|
+
id: context.currentSheetId
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
(_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
614
|
+
setTimeout(function () {
|
|
615
|
+
setShowDataValidation(true);
|
|
616
|
+
}, 100);
|
|
617
|
+
};
|
|
618
|
+
(0, _react.useEffect)(function () {
|
|
619
|
+
window.dataVerificationClick = dataVerificationClick;
|
|
620
|
+
}, []);
|
|
600
621
|
var getToolbarItem = (0, _react.useCallback)(function (name, i) {
|
|
601
622
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
602
623
|
var tooltip = toolbar[name];
|
|
@@ -979,24 +1000,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
979
1000
|
iconId: name,
|
|
980
1001
|
tooltip: tooltip,
|
|
981
1002
|
key: name,
|
|
982
|
-
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
|
-
}
|
|
1003
|
+
onClick: dataVerificationClick
|
|
1000
1004
|
}));
|
|
1001
1005
|
}
|
|
1002
1006
|
if (name === "locationCondition") {
|
|
@@ -109,7 +109,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
109
109
|
dynamicArray_compute?: any;
|
|
110
110
|
dynamicArray?: any[] | undefined;
|
|
111
111
|
frozen?: {
|
|
112
|
-
type: "
|
|
112
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
113
113
|
range?: {
|
|
114
114
|
row_focus: number;
|
|
115
115
|
column_focus: number;
|
|
@@ -12,30 +12,30 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
12
12
|
applyOp: (ops: Op[]) => void;
|
|
13
13
|
getCryptoPrice: typeof getCryptoPrice;
|
|
14
14
|
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
15
|
-
type?: "
|
|
15
|
+
type?: "m" | "mc" | "rt" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
16
16
|
}) => any;
|
|
17
17
|
onboardingActiveCell: (functionName: string) => void;
|
|
18
18
|
initializeComment: (row: number, column: number) => void;
|
|
19
19
|
updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
|
|
20
20
|
removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
|
|
21
21
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
22
|
-
type?: "
|
|
22
|
+
type?: "m" | "mc" | "rt" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
23
23
|
}) => void;
|
|
24
24
|
setCellError: (row: number, column: number, errorMessage: {
|
|
25
25
|
title: string;
|
|
26
26
|
message: string;
|
|
27
27
|
}) => void;
|
|
28
28
|
clearCell: (row: number, column: number, options?: api.CommonOptions) => void;
|
|
29
|
-
setCellFormat: (row: number, column: number, attr: "
|
|
29
|
+
setCellFormat: (row: number, column: number, attr: "m" | "mc" | "rt" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, options?: api.CommonOptions) => void;
|
|
30
30
|
autoFillCell: (copyRange: import("@fileverse-dev/fortune-core").SingleRange, applyRange: import("@fileverse-dev/fortune-core").SingleRange, direction: "left" | "right" | "down" | "up") => void;
|
|
31
|
-
freeze: (type: "
|
|
31
|
+
freeze: (type: "row" | "column" | "both", range: {
|
|
32
32
|
row: number;
|
|
33
33
|
column: number;
|
|
34
34
|
}, options?: api.CommonOptions) => void;
|
|
35
|
-
insertRowOrColumn: (type: "
|
|
36
|
-
deleteRowOrColumn: (type: "
|
|
37
|
-
hideRowOrColumn: (rowOrColInfo: string[], type: "
|
|
38
|
-
showRowOrColumn: (rowOrColInfo: string[], type: "
|
|
35
|
+
insertRowOrColumn: (type: "row" | "column", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: api.CommonOptions) => void;
|
|
36
|
+
deleteRowOrColumn: (type: "row" | "column", start: number, end: number, options?: api.CommonOptions) => void;
|
|
37
|
+
hideRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
|
|
38
|
+
showRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
|
|
39
39
|
setRowHeight: (rowInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
|
|
40
40
|
setColumnWidth: (columnInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
|
|
41
41
|
getRowHeight: (rows: number[], options?: api.CommonOptions) => Record<number, number>;
|
|
@@ -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: "
|
|
60
|
+
setCellFormatByRange: (attr: "m" | "mc" | "rt" | "v" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | 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;
|
|
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[];
|
|
@@ -116,7 +116,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
116
116
|
dynamicArray_compute?: any;
|
|
117
117
|
dynamicArray?: any[] | undefined;
|
|
118
118
|
frozen?: {
|
|
119
|
-
type: "
|
|
119
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
120
120
|
range?: {
|
|
121
121
|
row_focus: number;
|
|
122
122
|
column_focus: number;
|
|
@@ -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);
|