@fileverse-dev/fortune-react 1.1.93 → 1.1.95

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.
@@ -58,13 +58,16 @@ var DataVerification = function DataVerification() {
58
58
  });
59
59
  }, [optionItems]);
60
60
  useEffect(function () {
61
- var _a, _b, _c, _d, _e, _f, _g, _h;
61
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
62
62
  var selectRow = (_c = (_b = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.row) === null || _c === void 0 ? void 0 : _c[0];
63
63
  var selectCol = (_f = (_e = (_d = context.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.column) === null || _f === void 0 ? void 0 : _f[0];
64
64
  var sheetIndex = getSheetIndex();
65
- var dataVerificationInfo = context.luckysheetfile[sheetIndex].dataVerification;
66
- var value = (_g = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _g === void 0 ? void 0 : _g.value1;
67
- var color = (_h = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _h === void 0 ? void 0 : _h.color;
65
+ console.log('sheetIndex', sheetIndex);
66
+ var dataVerificationInfo = (_h = (_g = context.luckysheetfile[sheetIndex]) === null || _g === void 0 ? void 0 : _g.dataVerification) !== null && _h !== void 0 ? _h : {};
67
+ console.log('dataVerificationInfo', dataVerificationInfo);
68
+ if (!dataVerificationInfo) return;
69
+ var value = (_j = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _j === void 0 ? void 0 : _j.value1;
70
+ var color = (_k = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _k === void 0 ? void 0 : _k.color;
68
71
  if (value && color) {
69
72
  var colorValues = color === null || color === void 0 ? void 0 : color.split(",").map(function (v) {
70
73
  return v.trim();
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const DataVerificationPortal: ({ visible }: {
3
+ visible: boolean;
4
+ }) => React.ReactPortal | null;
5
+ export default DataVerificationPortal;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { createPortal } from "react-dom";
3
+ import DataVerification from "../DataVerification";
4
+ var DataVerificationPortal = function DataVerificationPortal(_a) {
5
+ var visible = _a.visible;
6
+ var container = document.getElementById("placeholder-data-validation");
7
+ if (!visible || !container) return null;
8
+ return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(DataVerification, null), container);
9
+ };
10
+ export default DataVerificationPortal;
@@ -123,7 +123,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
123
123
  return to.concat(ar || Array.prototype.slice.call(from));
124
124
  };
125
125
  import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
126
- import ReactDOM from 'react-dom/client';
126
+ import DataVerificationPortal from "./dataVerificationPortal";
127
127
  import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart } from "@fileverse-dev/fortune-core";
128
128
  import _ from "lodash";
129
129
  import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
@@ -137,7 +137,6 @@ import SVGIcon from "../SVGIcon";
137
137
  import { useDialog } from "../../hooks/useDialog";
138
138
  import { SplitColumn } from "../SplitColumn";
139
139
  import { LocationCondition } from "../LocationCondition";
140
- import DataVerification from "../DataVerification";
141
140
  import ConditionalFormat from "../ConditionFormat";
142
141
  import CustomButton from "./CustomButton";
143
142
  import { CustomColor } from "./CustomColor";
@@ -585,6 +584,9 @@ var Toolbar = function Toolbar(_a) {
585
584
  }
586
585
  }
587
586
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
587
+ var _o = useState(false),
588
+ showDataValidation = _o[0],
589
+ setShowDataValidation = _o[1];
588
590
  var getToolbarItem = useCallback(function (name, i) {
589
591
  var _a, _b, _c, _d, _e, _f, _g;
590
592
  var tooltip = toolbar[name];
@@ -961,7 +963,9 @@ var Toolbar = function Toolbar(_a) {
961
963
  });
962
964
  }
963
965
  if (name === "dataVerification") {
964
- return /*#__PURE__*/React.createElement(Button, {
966
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataVerificationPortal, {
967
+ visible: showDataValidation
968
+ }), /*#__PURE__*/React.createElement(Button, {
965
969
  iconId: name,
966
970
  tooltip: tooltip,
967
971
  key: name,
@@ -969,16 +973,10 @@ var Toolbar = function Toolbar(_a) {
969
973
  var _a;
970
974
  (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
971
975
  setTimeout(function () {
972
- var target = document.getElementById('placeholder-data-validation');
973
- console.log("Target for DataValidation:", target);
974
- console.log("DataValidationComponent:", DataVerification);
975
- if (target) {
976
- var root = ReactDOM.createRoot(target);
977
- root.render(/*#__PURE__*/React.createElement(DataVerification, null));
978
- }
976
+ setShowDataValidation(true);
979
977
  }, 100);
980
978
  }
981
- });
979
+ }));
982
980
  }
983
981
  if (name === "locationCondition") {
984
982
  var items_3 = [{
@@ -67,13 +67,16 @@ var DataVerification = function DataVerification() {
67
67
  });
68
68
  }, [optionItems]);
69
69
  (0, _react.useEffect)(function () {
70
- var _a, _b, _c, _d, _e, _f, _g, _h;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
71
71
  var selectRow = (_c = (_b = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.row) === null || _c === void 0 ? void 0 : _c[0];
72
72
  var selectCol = (_f = (_e = (_d = context.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.column) === null || _f === void 0 ? void 0 : _f[0];
73
73
  var sheetIndex = getSheetIndex();
74
- var dataVerificationInfo = context.luckysheetfile[sheetIndex].dataVerification;
75
- var value = (_g = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _g === void 0 ? void 0 : _g.value1;
76
- var color = (_h = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _h === void 0 ? void 0 : _h.color;
74
+ console.log('sheetIndex', sheetIndex);
75
+ var dataVerificationInfo = (_h = (_g = context.luckysheetfile[sheetIndex]) === null || _g === void 0 ? void 0 : _g.dataVerification) !== null && _h !== void 0 ? _h : {};
76
+ console.log('dataVerificationInfo', dataVerificationInfo);
77
+ if (!dataVerificationInfo) return;
78
+ var value = (_j = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _j === void 0 ? void 0 : _j.value1;
79
+ var color = (_k = dataVerificationInfo === null || dataVerificationInfo === void 0 ? void 0 : dataVerificationInfo["".concat(selectRow, "_").concat(selectCol)]) === null || _k === void 0 ? void 0 : _k.color;
77
80
  if (value && color) {
78
81
  var colorValues = color === null || color === void 0 ? void 0 : color.split(",").map(function (v) {
79
82
  return v.trim();
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const DataVerificationPortal: ({ visible }: {
3
+ visible: boolean;
4
+ }) => React.ReactPortal | null;
5
+ export default DataVerificationPortal;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactDom = require("react-dom");
9
+ var _DataVerification = _interopRequireDefault(require("../DataVerification"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ var DataVerificationPortal = function DataVerificationPortal(_a) {
12
+ var visible = _a.visible;
13
+ var container = document.getElementById("placeholder-data-validation");
14
+ if (!visible || !container) return null;
15
+ return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_DataVerification.default, null), container);
16
+ };
17
+ var _default = exports.default = DataVerificationPortal;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getLucideIcon = exports.default = exports.CurrencySelector = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _client = _interopRequireDefault(require("react-dom/client"));
9
+ var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
10
10
  var _fortuneCore = require("@fileverse-dev/fortune-core");
11
11
  var _lodash = _interopRequireDefault(require("lodash"));
12
12
  var _ui = require("@fileverse/ui");
@@ -20,7 +20,6 @@ var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
20
20
  var _useDialog = require("../../hooks/useDialog");
21
21
  var _SplitColumn = require("../SplitColumn");
22
22
  var _LocationCondition = require("../LocationCondition");
23
- var _DataVerification = _interopRequireDefault(require("../DataVerification"));
24
23
  var _ConditionFormat = _interopRequireDefault(require("../ConditionFormat"));
25
24
  var _CustomButton = _interopRequireDefault(require("./CustomButton"));
26
25
  var _CustomColor = require("./CustomColor");
@@ -594,6 +593,9 @@ var Toolbar = function Toolbar(_a) {
594
593
  }
595
594
  }
596
595
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
596
+ var _o = (0, _react.useState)(false),
597
+ showDataValidation = _o[0],
598
+ setShowDataValidation = _o[1];
597
599
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
598
600
  var _a, _b, _c, _d, _e, _f, _g;
599
601
  var tooltip = toolbar[name];
@@ -970,7 +972,9 @@ var Toolbar = function Toolbar(_a) {
970
972
  });
971
973
  }
972
974
  if (name === "dataVerification") {
973
- return /*#__PURE__*/_react.default.createElement(_Button.default, {
975
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_dataVerificationPortal.default, {
976
+ visible: showDataValidation
977
+ }), /*#__PURE__*/_react.default.createElement(_Button.default, {
974
978
  iconId: name,
975
979
  tooltip: tooltip,
976
980
  key: name,
@@ -978,16 +982,10 @@ var Toolbar = function Toolbar(_a) {
978
982
  var _a;
979
983
  (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
980
984
  setTimeout(function () {
981
- var target = document.getElementById('placeholder-data-validation');
982
- console.log("Target for DataValidation:", target);
983
- console.log("DataValidationComponent:", _DataVerification.default);
984
- if (target) {
985
- var root = _client.default.createRoot(target);
986
- root.render(/*#__PURE__*/_react.default.createElement(_DataVerification.default, null));
987
- }
985
+ setShowDataValidation(true);
988
986
  }, 100);
989
987
  }
990
- });
988
+ }));
991
989
  }
992
990
  if (name === "locationCondition") {
993
991
  var items_3 = [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.1.93",
3
+ "version": "1.1.95",
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.1.93",
19
+ "@fileverse-dev/fortune-core": "1.1.95",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",