@fileverse-dev/fortune-react 1.1.89 → 1.1.91

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 (27) hide show
  1. package/es/components/ContextMenu/index.js +2 -2
  2. package/es/components/DataVerification/ColorPicker.d.ts +9 -0
  3. package/es/components/DataVerification/ColorPicker.js +98 -0
  4. package/es/components/DataVerification/DropdownList.js +22 -7
  5. package/es/components/DataVerification/DropdownOption.d.ts +11 -0
  6. package/es/components/DataVerification/DropdownOption.js +264 -0
  7. package/es/components/DataVerification/index.css +4 -0
  8. package/es/components/DataVerification/index.js +62 -14
  9. package/es/components/SheetOverlay/ColumnHeader.js +8 -2
  10. package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +8 -10
  11. package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +7 -9
  12. package/es/components/SheetOverlay/index.js +1 -6
  13. package/es/components/Toolbar/index.js +47 -44
  14. package/lib/components/ContextMenu/index.js +2 -2
  15. package/lib/components/DataVerification/ColorPicker.d.ts +9 -0
  16. package/lib/components/DataVerification/ColorPicker.js +106 -0
  17. package/lib/components/DataVerification/DropdownList.js +22 -7
  18. package/lib/components/DataVerification/DropdownOption.d.ts +11 -0
  19. package/lib/components/DataVerification/DropdownOption.js +271 -0
  20. package/lib/components/DataVerification/index.css +4 -0
  21. package/lib/components/DataVerification/index.js +61 -13
  22. package/lib/components/SheetOverlay/ColumnHeader.js +8 -2
  23. package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +8 -10
  24. package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +7 -9
  25. package/lib/components/SheetOverlay/index.js +1 -6
  26. package/lib/components/Toolbar/index.js +47 -44
  27. package/package.json +2 -2
@@ -2,7 +2,7 @@ import { useContext, useRef } from "react";
2
2
  import { fixPositionOnFrozenCells, getSheetIndex, getFlowdata, colLocation, colLocationByIndex, updateContextWithSheetData } from "@fileverse-dev/fortune-core";
3
3
  import WorkbookContext from "../../../context";
4
4
  export function numberToColumnName(num) {
5
- var columnName = '';
5
+ var columnName = "";
6
6
  while (num >= 0) {
7
7
  var remainder = num % 26;
8
8
  columnName = String.fromCharCode(65 + remainder) + columnName;
@@ -174,7 +174,7 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
174
174
  var dragOffset = Math.abs(ev.pageX - dragRef.current.startX);
175
175
  if (!isDragActivated(host, dragOffset)) return;
176
176
  var lineLeftPx = computeInsertionFromPageX(ev.pageX).lineLeftPx;
177
- var ghostPosOffset = dragRef.current.startX > ev.pageX ? 0 : 120;
177
+ var ghostPosOffset = dragRef.current.startX > ev.pageX ? 0 : 80;
178
178
  if (dragRef.current.lineEl) {
179
179
  dragRef.current.lineEl.style.left = "".concat(lineLeftPx, "px");
180
180
  }
@@ -194,7 +194,6 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
194
194
  var sourceIndex_1 = dragRef.current.source;
195
195
  var sheetIdx_1 = getSheetIndex(context, context.currentSheetId);
196
196
  if (sheetIdx_1 != null && sourceIndex_1 >= 0 && Number.isFinite(finalInsertionIndex_1) && finalInsertionIndex_1 >= 0) {
197
- console.log("sourceIndex", sourceIndex_1);
198
197
  setContext(function (draft) {
199
198
  var _a, _b, _c, _d;
200
199
  var _sheet = draft.luckysheetfile[sheetIdx_1];
@@ -222,7 +221,7 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
222
221
  var sourceColName = numberToColumnName(sourceIndex_1);
223
222
  var targetColName_1 = numberToColumnName(targetIndex);
224
223
  if (cell.f) {
225
- cell.f = cell.f.replace(new RegExp("\\b".concat(sourceColName, "(\\d+)\\b"), 'g'), function (match, p1) {
224
+ cell.f = cell.f.replace(new RegExp("\\b".concat(sourceColName, "(\\d+)\\b"), "g"), function (match, p1) {
226
225
  if (/^\d+$/.test(p1)) {
227
226
  return "".concat(targetColName_1).concat(p1);
228
227
  }
@@ -249,7 +248,7 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
249
248
  var formula_1 = cell.f;
250
249
  var replacements_1 = [];
251
250
  otherAffectedCols.forEach(function (col) {
252
- var regex = new RegExp("\\b".concat(col.source, "(\\d+)\\b"), 'g');
251
+ var regex = new RegExp("\\b".concat(col.source, "(\\d+)\\b"), "g");
253
252
  var match;
254
253
  while ((match = regex.exec(formula_1)) !== null) {
255
254
  if (/^\d+$/.test(match[1])) {
@@ -273,16 +272,16 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
273
272
  }
274
273
  });
275
274
  });
276
- (_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.map(function (item) {
275
+ (_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.forEach(function (item) {
277
276
  if (item.c === sourceIndex_1) {
278
277
  item.c = targetIndex;
279
278
  } else if (item.c > sourceIndex_1 && item.c < targetIndex) {
280
- item.c = item.c - 1;
279
+ item.c -= 1;
281
280
  } else if (item.c < sourceIndex_1 && item.c >= targetIndex) {
282
- item.c = item.c + 1;
281
+ item.c += 1;
283
282
  }
284
283
  });
285
- (_d = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _d === void 0 ? void 0 : _d.call(window, sourceIndex_1, targetIndex, 'column', context.currentSheetId);
284
+ (_d = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _d === void 0 ? void 0 : _d.call(window, sourceIndex_1, targetIndex, "column", context.currentSheetId);
286
285
  });
287
286
  }
288
287
  }
@@ -299,7 +298,6 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
299
298
  dragRef.current.startX = startX;
300
299
  dragRef.current.source = clickedColIndex;
301
300
  dragRef.current.active = false;
302
- console.log("initiateDrag", startX);
303
301
  dragRef.current.onDocMove = handleColumnDrag;
304
302
  dragRef.current.onDocUp = handleColumnDragEnd;
305
303
  document.addEventListener("mousemove", handleColumnDrag);
@@ -198,15 +198,14 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
198
198
  rows.splice(targetIndex, 0, rowData);
199
199
  _sheet.data = rows;
200
200
  updateContextWithSheetData(draft, _sheet.data);
201
- console.log("rows", sourceIndex_1);
202
201
  var d = getFlowdata(draft);
203
202
  d === null || d === void 0 ? void 0 : d.forEach(function (row) {
204
- row.forEach(function (cell, index) {
203
+ row.forEach(function (cell) {
205
204
  if (cell) {
206
205
  var startingIndex = sourceIndex_1 + 1;
207
206
  var targetingIndex_1 = targetIndex + 1;
208
207
  if (cell.f) {
209
- cell.f = cell.f.replace(new RegExp("\\b([A-Z]+)".concat(startingIndex, "\\b"), 'g'), function (match, p1) {
208
+ cell.f = cell.f.replace(new RegExp("\\b([A-Z]+)".concat(startingIndex, "\\b"), "g"), function (match, p1) {
210
209
  return "".concat(p1).concat(targetingIndex_1);
211
210
  });
212
211
  }
@@ -232,7 +231,7 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
232
231
  otherAffectedRows.forEach(function (_a) {
233
232
  var source = _a.source,
234
233
  target = _a.target;
235
- var regex = new RegExp("\\b([A-Z]+)".concat(source, "\\b"), 'g');
234
+ var regex = new RegExp("\\b([A-Z]+)".concat(source, "\\b"), "g");
236
235
  var match;
237
236
  while ((match = regex.exec(formula_1)) !== null) {
238
237
  replacements_1.push({
@@ -254,17 +253,16 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
254
253
  }
255
254
  });
256
255
  });
257
- (_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.map(function (item) {
256
+ (_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
258
257
  if (item.r === sourceIndex_1) {
259
258
  item.r = targetIndex;
260
259
  } else if (item.r > sourceIndex_1 && item.r < targetIndex) {
261
- item.r = item.r - 1;
260
+ item.r -= 1;
262
261
  } else if (item.r < sourceIndex_1 && item.r >= targetIndex) {
263
- item.r = item.r + 1;
262
+ item.r += 1;
264
263
  }
265
264
  });
266
- console.log("_sheet.calcChain", _sheet.calcChain);
267
- (_b = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _b === void 0 ? void 0 : _b.call(window, sourceIndex_1, targetIndex, 'row', context.currentSheetId);
265
+ (_b = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _b === void 0 ? void 0 : _b.call(window, sourceIndex_1, targetIndex, "row", context.currentSheetId);
268
266
  });
269
267
  }
270
268
  }
@@ -25,7 +25,6 @@ import ImgBoxs from "../ImgBoxs";
25
25
  import NotationBoxes from "../NotationBoxes";
26
26
  import RangeDialog from "../DataVerification/RangeDialog";
27
27
  import { useDialog } from "../../hooks/useDialog";
28
- import SVGIcon from "../SVGIcon";
29
28
  import DropDownList from "../DataVerification/DropdownList";
30
29
  import IframeBoxs from "../IFrameBoxs/iFrameBoxs";
31
30
  import ErrorBoxes from "../ErrorState";
@@ -482,11 +481,7 @@ var SheetOverlay = function SheetOverlay() {
482
481
  style: {
483
482
  display: "none"
484
483
  }
485
- }, /*#__PURE__*/React.createElement(SVGIcon, {
486
- name: "caret-down-fill",
487
- width: 16,
488
- height: 16
489
- })), context.dataVerificationDropDownList && (context.dataVerification.dataRegulation.value1 !== "" || context.dataVerification.dataRegulation.value2 !== "") && (/*#__PURE__*/React.createElement(DropDownList, null)), /*#__PURE__*/React.createElement("div", {
484
+ }), context.dataVerificationDropDownList && (context.dataVerification.dataRegulation.value1 !== "" || context.dataVerification.dataRegulation.value2 !== "") && (/*#__PURE__*/React.createElement(DropDownList, null)), /*#__PURE__*/React.createElement("div", {
490
485
  id: "luckysheet-dataVerification-showHintBox",
491
486
  ref: dataVerificationHintBoxRef
492
487
  }), /*#__PURE__*/React.createElement("div", {
@@ -448,58 +448,58 @@ export var CurrencySelector = function CurrencySelector(_a) {
448
448
  }));
449
449
  };
450
450
  var Toolbar = function Toolbar(_a) {
451
- var _b, _c, _d;
451
+ var _b, _c, _d, _e;
452
452
  var setMoreItems = _a.setMoreItems,
453
453
  moreItemsOpen = _a.moreItemsOpen,
454
454
  onMoreToolbarItemsClose = _a.onMoreToolbarItemsClose,
455
455
  moreToolbarItems = _a.moreToolbarItems;
456
- var _e = useContext(WorkbookContext),
457
- context = _e.context,
458
- setContext = _e.setContext,
459
- refs = _e.refs,
460
- settings = _e.settings,
461
- handleUndo = _e.handleUndo,
462
- handleRedo = _e.handleRedo;
456
+ var _f = useContext(WorkbookContext),
457
+ context = _f.context,
458
+ setContext = _f.setContext,
459
+ refs = _f.refs,
460
+ settings = _f.settings,
461
+ handleUndo = _f.handleUndo,
462
+ handleRedo = _f.handleRedo;
463
463
  var contextRef = useRef(context);
464
464
  var containerRef = useRef(null);
465
- var _f = useState(-1),
466
- toolbarWrapIndex = _f[0],
467
- setToolbarWrapIndex = _f[1];
468
- var _g = useState([]),
469
- itemLocations = _g[0],
470
- setItemLocations = _g[1];
471
- var _h = useState(false),
472
- showDuneModal = _h[0],
473
- setShowDuneModal = _h[1];
474
- var _j = useState(window.innerWidth >= 1280),
475
- isDesktop = _j[0],
476
- setIsDesktop = _j[1];
477
- var _k = useDialog(),
478
- showDialog = _k.showDialog,
479
- hideDialog = _k.hideDialog;
465
+ var _g = useState(-1),
466
+ toolbarWrapIndex = _g[0],
467
+ setToolbarWrapIndex = _g[1];
468
+ var _h = useState([]),
469
+ itemLocations = _h[0],
470
+ setItemLocations = _h[1];
471
+ var _j = useState(false),
472
+ showDuneModal = _j[0],
473
+ setShowDuneModal = _j[1];
474
+ var _k = useState(window.innerWidth >= 1280),
475
+ isDesktop = _k[0],
476
+ setIsDesktop = _k[1];
477
+ var _l = useDialog(),
478
+ showDialog = _l.showDialog,
479
+ hideDialog = _l.hideDialog;
480
480
  var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
481
481
  var flowdata = getFlowdata(context);
482
482
  contextRef.current = context;
483
483
  var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
484
484
  var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
485
485
  var cell = flowdata && row != null && col != null ? (_c = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row]) === null || _c === void 0 ? void 0 : _c[col] : undefined;
486
- var _l = locale(context),
487
- toolbar = _l.toolbar,
488
- merge = _l.merge,
489
- border = _l.border,
490
- freezen = _l.freezen,
491
- defaultFmt = _l.defaultFmt,
492
- formula = _l.formula,
493
- sort = _l.sort,
494
- align = _l.align,
495
- textWrap = _l.textWrap,
496
- rotation = _l.rotation,
497
- screenshot = _l.screenshot,
498
- filter = _l.filter,
499
- splitText = _l.splitText,
500
- findAndReplace = _l.findAndReplace,
501
- comment = _l.comment,
502
- fontarray = _l.fontarray;
486
+ var _m = locale(context),
487
+ toolbar = _m.toolbar,
488
+ merge = _m.merge,
489
+ border = _m.border,
490
+ freezen = _m.freezen,
491
+ defaultFmt = _m.defaultFmt,
492
+ formula = _m.formula,
493
+ sort = _m.sort,
494
+ align = _m.align,
495
+ textWrap = _m.textWrap,
496
+ rotation = _m.rotation,
497
+ screenshot = _m.screenshot,
498
+ filter = _m.filter,
499
+ splitText = _m.splitText,
500
+ findAndReplace = _m.findAndReplace,
501
+ comment = _m.comment,
502
+ fontarray = _m.fontarray;
503
503
  var toolbarFormat = locale(context).format;
504
504
  var sheetWidth = context.luckysheetTableContentHW[0];
505
505
  var currency = settings.currency;
@@ -534,6 +534,9 @@ var Toolbar = function Toolbar(_a) {
534
534
  subMenu.style.display = "none";
535
535
  }, []);
536
536
  useEffect(function () {
537
+ window.getDataValidationComponent = function () {
538
+ return /*#__PURE__*/React.createElement(DataVerification, null);
539
+ };
537
540
  var handleResize = function handleResize() {
538
541
  setIsDesktop(window.innerWidth >= 1280);
539
542
  };
@@ -965,8 +968,8 @@ var Toolbar = function Toolbar(_a) {
965
968
  tooltip: tooltip,
966
969
  key: name,
967
970
  onClick: function onClick() {
968
- if (context.allowEdit === false) return;
969
- showDialog(/*#__PURE__*/React.createElement(DataVerification, null), undefined, toolbar.dataVerification);
971
+ var _a;
972
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
970
973
  }
971
974
  });
972
975
  }
@@ -1643,7 +1646,7 @@ var Toolbar = function Toolbar(_a) {
1643
1646
  });
1644
1647
  }
1645
1648
  }));
1646
- }, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFormat, align, handleUndo, handleRedo, flowdata, formula, showDuneModal, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle, toolbarFormat.moreCurrency]);
1649
+ }, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFormat, align, handleUndo, handleRedo, flowdata, formula, showDuneModal, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle, toolbarFormat.moreCurrency, (_d = context.dataVerification) === null || _d === void 0 ? void 0 : _d.dataRegulation]);
1647
1650
  return /*#__PURE__*/React.createElement("div", {
1648
1651
  ref: containerRef,
1649
1652
  className: "fortune-toolbar",
@@ -1660,7 +1663,7 @@ var Toolbar = function Toolbar(_a) {
1660
1663
  icon: n.icon,
1661
1664
  iconName: n.iconName
1662
1665
  }, n.children);
1663
- }), ((_d = settings.customToolbarItems) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (/*#__PURE__*/React.createElement(Divider, {
1666
+ }), ((_e = settings.customToolbarItems) === null || _e === void 0 ? void 0 : _e.length) > 0 ? (/*#__PURE__*/React.createElement(Divider, {
1664
1667
  key: "customDivider"
1665
1668
  })) : null, (toolbarWrapIndex === -1 || isDesktop ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
1666
1669
  return getToolbarItem(name, i);
@@ -428,7 +428,7 @@ var ContextMenu = function ContextMenu() {
428
428
  });
429
429
  }
430
430
  if (name === "insert-row-above") {
431
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) ? null : ["left"].map(function (dir) {
431
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) ? null : ["left"].map(function (dir) {
432
432
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
433
433
  key: "add-row-above-".concat(dir),
434
434
  onClick: function onClick() {
@@ -442,7 +442,7 @@ var ContextMenu = function ContextMenu() {
442
442
  });
443
443
  }
444
444
  if (name === "insert-row") {
445
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) ? null : ["left"].map(function (dir) {
445
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) ? null : ["left"].map(function (dir) {
446
446
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
447
447
  key: "add-row-below-".concat(dir),
448
448
  onClick: function onClick() {
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export declare const TEXT_COLORS: {
3
+ name: string;
4
+ value: string;
5
+ }[];
6
+ export declare const ColorSection: ({ onPick, trigerColor, }: {
7
+ onPick: (color: string) => void;
8
+ trigerColor: string;
9
+ }) => React.JSX.Element;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TEXT_COLORS = exports.ColorSection = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _lucideReact = require("lucide-react");
10
+ var _ui = require("@fileverse/ui");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
+ var TEXT_COLORS = exports.TEXT_COLORS = [{
13
+ name: "Light Gray",
14
+ value: "228, 232, 237"
15
+ }, {
16
+ name: "White",
17
+ value: "249, 249, 249"
18
+ }, {
19
+ name: "Pink",
20
+ value: "244, 217, 227"
21
+ }, {
22
+ name: "Peach",
23
+ value: "247, 229, 207"
24
+ }, {
25
+ name: "Blue",
26
+ value: "217, 234, 244"
27
+ }, {
28
+ name: "Green",
29
+ value: "222, 239, 222"
30
+ }, {
31
+ name: "Light Green",
32
+ value: "239, 239, 239"
33
+ }, {
34
+ name: "Rose",
35
+ value: "244, 230, 230"
36
+ }, {
37
+ name: "Yellow",
38
+ value: "247, 239, 217"
39
+ }, {
40
+ name: "Purple",
41
+ value: "230, 230, 244"
42
+ }, {
43
+ name: "Cyan",
44
+ value: "217, 244, 244"
45
+ }, {
46
+ name: "Cream",
47
+ value: "244, 239, 234"
48
+ }];
49
+ var ColorSection = exports.ColorSection = function ColorSection(_a) {
50
+ var onPick = _a.onPick,
51
+ trigerColor = _a.trigerColor;
52
+ var _b = (0, _react.useState)(false),
53
+ isOpen = _b[0],
54
+ setIsOpen = _b[1];
55
+ return /*#__PURE__*/_react.default.createElement(_ui.Popover, {
56
+ open: isOpen,
57
+ onOpenChange: function onOpenChange(open) {
58
+ setIsOpen(open);
59
+ }
60
+ }, /*#__PURE__*/_react.default.createElement(_ui.PopoverTrigger, {
61
+ className: "hover:bg-red",
62
+ style: {
63
+ backgroundColor: "red!important"
64
+ }
65
+ }, /*#__PURE__*/_react.default.createElement("div", {
66
+ className: "flex items-center justify-between color-picker rounded transition-all cursor-pointer border border-gray-300",
67
+ style: {
68
+ padding: "7px"
69
+ }
70
+ }, /*#__PURE__*/_react.default.createElement("div", {
71
+ className: "flex items-center gap-3 color-text-secondary"
72
+ }, /*#__PURE__*/_react.default.createElement("div", {
73
+ className: "w-5 h-5 rounded-full",
74
+ style: {
75
+ backgroundColor: "rgb(".concat(trigerColor, ")")
76
+ }
77
+ }), /*#__PURE__*/_react.default.createElement(_lucideReact.ChevronDown, {
78
+ size: 18,
79
+ className: "transition-transform ".concat(isOpen ? "rotate-180" : "")
80
+ })))), /*#__PURE__*/_react.default.createElement(_ui.PopoverContent, {
81
+ align: "start",
82
+ alignOffset: 0,
83
+ className: "w-[200px] export-content-popover",
84
+ elevation: 2,
85
+ side: "bottom",
86
+ sideOffset: 4
87
+ }, /*#__PURE__*/_react.default.createElement("div", {
88
+ className: "transition-all p-2 duration-200 w-full"
89
+ }, /*#__PURE__*/_react.default.createElement("div", {
90
+ className: "flex gap-2 flex-wrap w-full"
91
+ }, TEXT_COLORS.map(function (color) {
92
+ return /*#__PURE__*/_react.default.createElement("button", {
93
+ type: "button",
94
+ key: color.value,
95
+ onClick: function onClick() {
96
+ onPick(color.value);
97
+ setIsOpen(false);
98
+ },
99
+ className: "w-7 h-7 rounded-full transition-all hover:scale-110 hover:shadow-md",
100
+ style: {
101
+ backgroundColor: "rgb(".concat(color.value, ")")
102
+ },
103
+ title: color.name
104
+ });
105
+ })))));
106
+ };
@@ -30,11 +30,10 @@ var DropDownList = function DropDownList() {
30
30
  var _e = (0, _react.useState)([]),
31
31
  selected = _e[0],
32
32
  setSelected = _e[1];
33
- var close = (0, _react.useCallback)(function () {
34
- setContext(function (ctx) {
35
- ctx.dataVerificationDropDownList = false;
36
- });
37
- }, [setContext]);
33
+ var _f = (0, _react.useState)([]),
34
+ rbgColor = _f[0],
35
+ setRbgColor = _f[1];
36
+ var close = (0, _react.useCallback)(function () {}, [setContext]);
38
37
  (0, _useOutsideClick.useOutsideClick)(containerRef, close, [close]);
39
38
  (0, _react.useEffect)(function () {
40
39
  var _a, _b;
@@ -54,19 +53,30 @@ var DropDownList = function DropDownList() {
54
53
  }
55
54
  var index = (0, _fortuneCore.getSheetIndex)(context, context.currentSheetId);
56
55
  var dataVerification = context.luckysheetfile[index].dataVerification;
56
+ if (!dataVerification) return;
57
57
  var item = dataVerification["".concat(rowIndex, "_").concat(colIndex)];
58
+ if (!item) return;
58
59
  var dropdownList = (0, _fortuneCore.getDropdownList)(context, item.value1);
59
60
  var cellValue = (0, _fortuneCore.getCellValue)(rowIndex, colIndex, d);
60
61
  if (cellValue) {
61
62
  setSelected(cellValue.toString().split(","));
62
63
  }
64
+ var color = item.color;
65
+ var colorValues = color === null || color === void 0 ? void 0 : color.split(",").map(function (v) {
66
+ return v.trim();
67
+ });
68
+ var rbgColorArr = [];
69
+ for (var i = 0; i < colorValues.length; i += 3) {
70
+ rbgColorArr.push(colorValues.slice(i, i + 3).join(", "));
71
+ }
72
+ setRbgColor(rbgColorArr);
63
73
  setList(dropdownList);
64
74
  setPosition({
65
75
  left: col_pre,
66
76
  top: row
67
77
  });
68
78
  setIsMul(item.type2 === "true");
69
- }, []);
79
+ }, [context.luckysheet_select_save]);
70
80
  (0, _react.useEffect)(function () {
71
81
  if (!context.luckysheet_select_save) return;
72
82
  var last = context.luckysheet_select_save[context.luckysheet_select_save.length - 1];
@@ -75,7 +85,9 @@ var DropDownList = function DropDownList() {
75
85
  if (rowIndex == null || colIndex == null) return;
76
86
  var index = (0, _fortuneCore.getSheetIndex)(context, context.currentSheetId);
77
87
  var dataVerification = context.luckysheetfile[index].dataVerification;
88
+ if (!dataVerification) return;
78
89
  var item = dataVerification["".concat(rowIndex, "_").concat(colIndex)];
90
+ if (!item) return;
79
91
  if (item.type2 !== "true") return;
80
92
  var d = (0, _fortuneCore.getFlowdata)(context);
81
93
  if (!d) return;
@@ -106,7 +118,10 @@ var DropDownList = function DropDownList() {
106
118
  tabIndex: 0
107
119
  }, list.map(function (v, i) {
108
120
  return /*#__PURE__*/_react.default.createElement("div", {
109
- className: "dropdown-List-item",
121
+ className: "dropdown-List-item mb-1",
122
+ style: {
123
+ backgroundColor: "rgb(".concat(rbgColor[i], ")") || "red"
124
+ },
110
125
  key: i,
111
126
  onClick: function onClick() {
112
127
  setContext(function (ctx) {
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ type Item = {
3
+ id: string;
4
+ value: string;
5
+ color?: string | null;
6
+ };
7
+ declare const DynamicInputList: ({ optionItems, setOptionItems, }: {
8
+ optionItems: Item[];
9
+ setOptionItems: React.Dispatch<React.SetStateAction<Item[]>>;
10
+ }) => React.JSX.Element;
11
+ export default DynamicInputList;