@fileverse-dev/fortune-react 1.2.18 → 1.2.20

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.
@@ -292,7 +292,7 @@ var ContextMenu = function ContextMenu() {
292
292
  className: "context-item"
293
293
  }, /*#__PURE__*/React.createElement(LucideIcon, {
294
294
  name: "ShieldCheck"
295
- }), /*#__PURE__*/React.createElement("p", null, "Data Verification")));
295
+ }), /*#__PURE__*/React.createElement("p", null, "Data Validation")));
296
296
  }
297
297
  if (name === "searchReplace") {
298
298
  return /*#__PURE__*/React.createElement(Menu, {
@@ -1,4 +1,4 @@
1
- import { getCellValue, getDropdownList, getFlowdata, getSheetIndex, mergeBorder, setDropdownValue } from "@fileverse-dev/fortune-core";
1
+ import { getCellValue, getDropdownList, getFlowdata, getSheetIndex, mergeBorder, setDropdownValue, api } from "@fileverse-dev/fortune-core";
2
2
  import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  import { Button, IconButton } from "@fileverse/ui";
4
4
  import WorkbookContext from "../../context";
@@ -160,7 +160,8 @@ var DropDownList = function DropDownList() {
160
160
  },
161
161
  onClick: function onClick() {
162
162
  var _a;
163
- (_a = window === null || window === void 0 ? void 0 : window.dataVerificationClick) === null || _a === void 0 ? void 0 : _a.call(window);
163
+ var selectedCells = api.getSelection(context);
164
+ (_a = window === null || window === void 0 ? void 0 : window.dataVerificationClick) === null || _a === void 0 ? void 0 : _a.call(window, selectedCells);
164
165
  setContext(function (ctx) {
165
166
  ctx.dataVerificationDropDownList = false;
166
167
  });
@@ -27,7 +27,7 @@ var Dialog = function Dialog(_a) {
27
27
  var button = locale(context).button;
28
28
  return /*#__PURE__*/React.createElement("div", {
29
29
  className: "fortune-dialog",
30
- style: __assign(__assign({}, containerStyle), ["Data verification", "Split text to columns", "Resize column"].includes(title) ? {
30
+ style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
31
31
  maxWidth: "unset"
32
32
  } : {})
33
33
  }, /*#__PURE__*/React.createElement("div", {
@@ -186,7 +186,7 @@ var ColumnHeader = function ColumnHeader() {
186
186
  var cod = true;
187
187
  var tempStartPoint = startPoint;
188
188
  while (cod) {
189
- tempStartPoint -= 1;
189
+ tempStartPoint = Number(tempStartPoint) - 1;
190
190
  if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
191
191
  startCol = tempStartPoint;
192
192
  } else {
@@ -196,7 +196,7 @@ var ColumnHeader = function ColumnHeader() {
196
196
  cod = true;
197
197
  tempStartPoint = startPoint;
198
198
  while (cod) {
199
- tempStartPoint += 1;
199
+ tempStartPoint = Number(tempStartPoint) + 1;
200
200
  if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
201
201
  endCol = tempStartPoint;
202
202
  } else {
@@ -184,7 +184,7 @@ var RowHeader = function RowHeader() {
184
184
  var cod = true;
185
185
  var tempStartPoint = startPoint;
186
186
  while (cod) {
187
- tempStartPoint -= 1;
187
+ tempStartPoint = Number(tempStartPoint) - 1;
188
188
  if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
189
189
  startRow = tempStartPoint;
190
190
  } else {
@@ -194,7 +194,7 @@ var RowHeader = function RowHeader() {
194
194
  cod = true;
195
195
  tempStartPoint = startPoint;
196
196
  while (cod) {
197
- tempStartPoint += 1;
197
+ tempStartPoint = Number(tempStartPoint) + 1;
198
198
  if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
199
199
  endRow = tempStartPoint;
200
200
  } else {
@@ -342,7 +342,10 @@ export var CurrencySelector = function CurrencySelector(_a) {
342
342
  }, /*#__PURE__*/React.createElement(CommandInput, {
343
343
  placeholder: "Search by name or code",
344
344
  value: searchTerm,
345
- onValueChange: setSearchTerm
345
+ onValueChange: function onValueChange(value) {
346
+ setSearchTerm(value);
347
+ console.log(value, "djksfgnkjsedfngskjn");
348
+ }
346
349
  })), /*#__PURE__*/React.createElement("div", {
347
350
  className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
348
351
  onClick: function onClick(e) {
@@ -394,6 +397,7 @@ export var CurrencySelector = function CurrencySelector(_a) {
394
397
  return __generator(this, function (_a) {
395
398
  switch (_a.label) {
396
399
  case 0:
400
+ console.log(opt, "kjbdnfgjbksndfjbkdnbksdfjkn");
397
401
  if (!(opt.type === "crypto")) return [3, 2];
398
402
  return [4, convertCellsToCrypto({
399
403
  context: context,
@@ -592,10 +596,10 @@ var Toolbar = function Toolbar(_a) {
592
596
  var _o = useState(false),
593
597
  showDataValidation = _o[0],
594
598
  setShowDataValidation = _o[1];
595
- var dataVerificationClick = function dataVerificationClick() {
599
+ var dataVerificationClick = function dataVerificationClick(selectedCells) {
596
600
  var _a;
597
601
  var selection = api.getSelection(context);
598
- if (!selection) {
602
+ if (!selection && !selectedCells) {
599
603
  setContext(function (ctx) {
600
604
  api.setSelection(ctx, [{
601
605
  row: [0, 0],
@@ -728,6 +732,7 @@ var Toolbar = function Toolbar(_a) {
728
732
  return /*#__PURE__*/React.createElement(Option, {
729
733
  key: value,
730
734
  onClick: function onClick() {
735
+ console.log("format", value);
731
736
  setOpen(false);
732
737
  setContext(function (ctx) {
733
738
  var d = getFlowdata(ctx);
@@ -1649,13 +1654,6 @@ var Toolbar = function Toolbar(_a) {
1649
1654
  }));
1650
1655
  });
1651
1656
  }
1652
- if (name === "currency") {
1653
- return /*#__PURE__*/React.createElement(CurrencySelector, {
1654
- cell: cell,
1655
- defaultTextFormat: defaultFormat[0].text,
1656
- toolTipText: toolbar["currency-format"]
1657
- });
1658
- }
1659
1657
  return /*#__PURE__*/React.createElement(Tooltip, {
1660
1658
  text: tooltip,
1661
1659
  placement: "bottom"
@@ -301,7 +301,7 @@ var ContextMenu = function ContextMenu() {
301
301
  className: "context-item"
302
302
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
303
303
  name: "ShieldCheck"
304
- }), /*#__PURE__*/_react.default.createElement("p", null, "Data Verification")));
304
+ }), /*#__PURE__*/_react.default.createElement("p", null, "Data Validation")));
305
305
  }
306
306
  if (name === "searchReplace") {
307
307
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
@@ -169,7 +169,8 @@ var DropDownList = function DropDownList() {
169
169
  },
170
170
  onClick: function onClick() {
171
171
  var _a;
172
- (_a = window === null || window === void 0 ? void 0 : window.dataVerificationClick) === null || _a === void 0 ? void 0 : _a.call(window);
172
+ var selectedCells = _fortuneCore.api.getSelection(context);
173
+ (_a = window === null || window === void 0 ? void 0 : window.dataVerificationClick) === null || _a === void 0 ? void 0 : _a.call(window, selectedCells);
173
174
  setContext(function (ctx) {
174
175
  ctx.dataVerificationDropDownList = false;
175
176
  });
@@ -36,7 +36,7 @@ var Dialog = function Dialog(_a) {
36
36
  var button = (0, _fortuneCore.locale)(context).button;
37
37
  return /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "fortune-dialog",
39
- style: __assign(__assign({}, containerStyle), ["Data verification", "Split text to columns", "Resize column"].includes(title) ? {
39
+ style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
40
40
  maxWidth: "unset"
41
41
  } : {})
42
42
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -195,7 +195,7 @@ var ColumnHeader = function ColumnHeader() {
195
195
  var cod = true;
196
196
  var tempStartPoint = startPoint;
197
197
  while (cod) {
198
- tempStartPoint -= 1;
198
+ tempStartPoint = Number(tempStartPoint) - 1;
199
199
  if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
200
200
  startCol = tempStartPoint;
201
201
  } else {
@@ -205,7 +205,7 @@ var ColumnHeader = function ColumnHeader() {
205
205
  cod = true;
206
206
  tempStartPoint = startPoint;
207
207
  while (cod) {
208
- tempStartPoint += 1;
208
+ tempStartPoint = Number(tempStartPoint) + 1;
209
209
  if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
210
210
  endCol = tempStartPoint;
211
211
  } else {
@@ -193,7 +193,7 @@ var RowHeader = function RowHeader() {
193
193
  var cod = true;
194
194
  var tempStartPoint = startPoint;
195
195
  while (cod) {
196
- tempStartPoint -= 1;
196
+ tempStartPoint = Number(tempStartPoint) - 1;
197
197
  if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
198
198
  startRow = tempStartPoint;
199
199
  } else {
@@ -203,7 +203,7 @@ var RowHeader = function RowHeader() {
203
203
  cod = true;
204
204
  tempStartPoint = startPoint;
205
205
  while (cod) {
206
- tempStartPoint += 1;
206
+ tempStartPoint = Number(tempStartPoint) + 1;
207
207
  if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
208
208
  endRow = tempStartPoint;
209
209
  } else {
@@ -351,7 +351,10 @@ var CurrencySelector = exports.CurrencySelector = function CurrencySelector(_a)
351
351
  }, /*#__PURE__*/_react.default.createElement(_ui.CommandInput, {
352
352
  placeholder: "Search by name or code",
353
353
  value: searchTerm,
354
- onValueChange: setSearchTerm
354
+ onValueChange: function onValueChange(value) {
355
+ setSearchTerm(value);
356
+ console.log(value, "djksfgnkjsedfngskjn");
357
+ }
355
358
  })), /*#__PURE__*/_react.default.createElement("div", {
356
359
  className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
357
360
  onClick: function onClick(e) {
@@ -403,6 +406,7 @@ var CurrencySelector = exports.CurrencySelector = function CurrencySelector(_a)
403
406
  return __generator(this, function (_a) {
404
407
  switch (_a.label) {
405
408
  case 0:
409
+ console.log(opt, "kjbdnfgjbksndfjbkdnbksdfjkn");
406
410
  if (!(opt.type === "crypto")) return [3, 2];
407
411
  return [4, (0, _convertCellsToCrypto.convertCellsToCrypto)({
408
412
  context: context,
@@ -601,10 +605,10 @@ var Toolbar = function Toolbar(_a) {
601
605
  var _o = (0, _react.useState)(false),
602
606
  showDataValidation = _o[0],
603
607
  setShowDataValidation = _o[1];
604
- var dataVerificationClick = function dataVerificationClick() {
608
+ var dataVerificationClick = function dataVerificationClick(selectedCells) {
605
609
  var _a;
606
610
  var selection = _fortuneCore.api.getSelection(context);
607
- if (!selection) {
611
+ if (!selection && !selectedCells) {
608
612
  setContext(function (ctx) {
609
613
  _fortuneCore.api.setSelection(ctx, [{
610
614
  row: [0, 0],
@@ -737,6 +741,7 @@ var Toolbar = function Toolbar(_a) {
737
741
  return /*#__PURE__*/_react.default.createElement(_Select.Option, {
738
742
  key: value,
739
743
  onClick: function onClick() {
744
+ console.log("format", value);
740
745
  setOpen(false);
741
746
  setContext(function (ctx) {
742
747
  var d = (0, _fortuneCore.getFlowdata)(ctx);
@@ -1658,13 +1663,6 @@ var Toolbar = function Toolbar(_a) {
1658
1663
  }));
1659
1664
  });
1660
1665
  }
1661
- if (name === "currency") {
1662
- return /*#__PURE__*/_react.default.createElement(CurrencySelector, {
1663
- cell: cell,
1664
- defaultTextFormat: defaultFormat[0].text,
1665
- toolTipText: toolbar["currency-format"]
1666
- });
1667
- }
1668
1666
  return /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
1669
1667
  text: tooltip,
1670
1668
  placement: "bottom"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
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.18",
19
+ "@fileverse-dev/fortune-core": "1.2.20",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",