@fileverse-dev/fortune-react 1.0.2-mod-52 → 1.0.2-mod-54

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.
@@ -8,6 +8,8 @@ type Props = {
8
8
  contentStyle?: React.CSSProperties;
9
9
  children?: React.ReactNode;
10
10
  title?: string | React.ReactNode;
11
+ okLabel?: string;
12
+ cancelLabel?: string;
11
13
  };
12
14
  declare const Dialog: React.FC<Props>;
13
15
  export default Dialog;
@@ -130,7 +130,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
130
130
  partiallyError: string;
131
131
  readOnlyError: string;
132
132
  dataNullError: string;
133
- noSeletionError: string;
133
+ noSelectionError: string;
134
134
  cannotSelectMultiple: string;
135
135
  };
136
136
  functionlist: ({
@@ -424,7 +424,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
424
424
  freezenColumnRange: string;
425
425
  freezenRCRange: string;
426
426
  freezenCancel: string;
427
- noSeletionError: string;
427
+ noSelectionError: string;
428
428
  rangeRCOverErrorTitle: string;
429
429
  rangeRCOverError: string;
430
430
  };
@@ -137,7 +137,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
137
137
  partiallyError: string;
138
138
  readOnlyError: string;
139
139
  dataNullError: string;
140
- noSeletionError: string;
140
+ noSelectionError: string;
141
141
  cannotSelectMultiple: string;
142
142
  };
143
143
  functionlist: ({
@@ -431,7 +431,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
431
431
  freezenColumnRange: string;
432
432
  freezenRCRange: string;
433
433
  freezenCancel: string;
434
- noSeletionError: string;
434
+ noSelectionError: string;
435
435
  rangeRCOverErrorTitle: string;
436
436
  rangeRCOverError: string;
437
437
  };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  export declare function useDialog(): {
3
- showDialog: (content: string | React.ReactNode, type?: "ok" | "yesno", title?: string | React.ReactNode, onOk?: () => void, onCancel?: () => void) => void;
3
+ showDialog: (content: string | React.ReactNode, type?: "ok" | "yesno", title?: string | React.ReactNode, okLabel?: string, cancelLabel?: string, onOk?: () => void, onCancel?: () => void) => void;
4
4
  hideDialog: () => void;
5
5
  };
package/dist/index.esm.js CHANGED
@@ -1532,7 +1532,9 @@ var Dialog = function Dialog(_ref) {
1532
1532
  children = _ref.children,
1533
1533
  containerStyle = _ref.containerStyle,
1534
1534
  contentStyle = _ref.contentStyle,
1535
- title = _ref.title;
1535
+ title = _ref.title,
1536
+ okLabel = _ref.okLabel,
1537
+ cancelLabel = _ref.cancelLabel;
1536
1538
  var _useContext = useContext(WorkbookContext),
1537
1539
  context = _useContext.context;
1538
1540
  var _locale = locale(context),
@@ -1563,21 +1565,21 @@ var Dialog = function Dialog(_ref) {
1563
1565
  },
1564
1566
  onClick: onOk,
1565
1567
  tabIndex: 0
1566
- }, button.confirm)) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button$1, {
1568
+ }, okLabel || button.confirm)) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button$1, {
1567
1569
  variant: "secondary",
1568
1570
  style: {
1569
1571
  minWidth: "80px"
1570
1572
  },
1571
1573
  onClick: onCancel,
1572
1574
  tabIndex: 0
1573
- }, button.cancel), /*#__PURE__*/React.createElement(Button$1, {
1575
+ }, cancelLabel || button.cancel), /*#__PURE__*/React.createElement(Button$1, {
1574
1576
  variant: "default",
1575
1577
  style: {
1576
1578
  minWidth: "80px"
1577
1579
  },
1578
1580
  onClick: onOk,
1579
1581
  tabIndex: 0
1580
- }, button.confirm))))));
1582
+ }, okLabel || button.confirm))))));
1581
1583
  };
1582
1584
 
1583
1585
  var MessageBox = function MessageBox(_ref) {
@@ -2596,14 +2598,16 @@ function useDialog() {
2596
2598
  var _useContext = useContext(ModalContext),
2597
2599
  showModal = _useContext.showModal,
2598
2600
  hideModal = _useContext.hideModal;
2599
- var showDialog = useCallback(function (content, type, title) {
2600
- var onOk = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : hideModal;
2601
- var onCancel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : hideModal;
2601
+ var showDialog = useCallback(function (content, type, title, okLabel, cancelLabel) {
2602
+ var onOk = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : hideModal;
2603
+ var onCancel = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : hideModal;
2602
2604
  showModal(/*#__PURE__*/React.createElement(Dialog, {
2603
2605
  type: type,
2604
2606
  onOk: onOk,
2605
2607
  onCancel: onCancel,
2606
- title: title
2608
+ title: title,
2609
+ okLabel: okLabel,
2610
+ cancelLabel: cancelLabel
2607
2611
  }, content));
2608
2612
  }, [hideModal, showModal]);
2609
2613
  return {
@@ -2689,7 +2693,7 @@ var DataVerification = function DataVerification() {
2689
2693
  var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2;
2690
2694
  var range = getRangeByTxt(ctx, (_ctx$dataVerification3 = ctx.dataVerification) === null || _ctx$dataVerification3 === void 0 ? void 0 : (_ctx$dataVerification4 = _ctx$dataVerification3.dataRegulation) === null || _ctx$dataVerification4 === void 0 ? void 0 : _ctx$dataVerification4.rangeTxt);
2691
2695
  if (range.length === 0) {
2692
- showDialog(generalDialog.noSeletionError, "ok");
2696
+ showDialog(generalDialog.noSelectionError, "ok");
2693
2697
  return;
2694
2698
  }
2695
2699
  var currentDataVerification = (_ctx$luckysheetfile$g2 = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g2 !== void 0 ? _ctx$luckysheetfile$g2 : {};
@@ -3842,10 +3846,13 @@ var SheetOverlay = function SheetOverlay() {
3842
3846
  useEffect(function () {
3843
3847
  if (context.warnDialog) {
3844
3848
  setTimeout(function () {
3845
- showDialog(context.warnDialog, "ok");
3849
+ showDialog(context.warnDialog, "yesno", "Invalid data", "Retry");
3850
+ setContext(function (ctx) {
3851
+ ctx.warnDialog = undefined;
3852
+ });
3846
3853
  }, 240);
3847
3854
  }
3848
- }, [context.warnDialog]);
3855
+ }, [context.warnDialog, setContext, showDialog]);
3849
3856
  useEffect(function () {
3850
3857
  refs.cellArea.current.scrollLeft = context.scrollLeft;
3851
3858
  refs.cellArea.current.scrollTop = context.scrollTop;
@@ -4160,9 +4167,8 @@ var SheetOverlay = function SheetOverlay() {
4160
4167
  name: "caret-down-fill",
4161
4168
  width: 16,
4162
4169
  height: 16
4163
- })), context.dataVerificationDropDownList && /*#__PURE__*/React.createElement(DropDownList, null), /*#__PURE__*/React.createElement("div", {
4170
+ })), context.dataVerificationDropDownList && (context.dataVerification.dataRegulation.value1 !== "" || context.dataVerification.dataRegulation.value2 !== "") && (/*#__PURE__*/React.createElement(DropDownList, null)), /*#__PURE__*/React.createElement("div", {
4164
4171
  id: "luckysheet-dataVerification-showHintBox",
4165
- className: "luckysheet-mousedown-cancel",
4166
4172
  ref: dataVerificationHintBoxRef
4167
4173
  }), /*#__PURE__*/React.createElement("div", {
4168
4174
  className: "luckysheet-cell-copy"
@@ -4638,7 +4644,7 @@ var SplitColumn = function SplitColumn() {
4638
4644
  }
4639
4645
  }
4640
4646
  if (dataCover) {
4641
- showDialog(splitText.splitConfirmToExe, "yesno", undefined, function () {
4647
+ showDialog(splitText.splitConfirmToExe, "yesno", undefined, undefined, undefined, function () {
4642
4648
  hideDialog();
4643
4649
  setContext(function (ctx) {
4644
4650
  updateMoreCell(r, c, dataArr, ctx);
@@ -5853,8 +5859,24 @@ var Toolbar = function Toolbar(_ref) {
5853
5859
  tooltip: tooltip,
5854
5860
  showArrow: false
5855
5861
  }, function (setOpen) {
5856
- return /*#__PURE__*/React.createElement(Select, null, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
5857
- return /*#__PURE__*/React.createElement(Option, {
5862
+ return /*#__PURE__*/React.createElement(Select, {
5863
+ style: {
5864
+ minWidth: "fit-content",
5865
+ width: "50px"
5866
+ }
5867
+ }, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
5868
+ return /*#__PURE__*/React.createElement("div", {
5869
+ className: "fortune-toolbar-select-option text-body-sm text-center color-text-default",
5870
+ style: {
5871
+ minWidth: "fit-content",
5872
+ padding: "0px",
5873
+ width: "36px",
5874
+ height: "36px",
5875
+ display: "flex",
5876
+ alignItems: "center",
5877
+ justifyContent: "center",
5878
+ fontSize: "14px"
5879
+ },
5858
5880
  key: num,
5859
5881
  onClick: function onClick() {
5860
5882
  setContext(function (draftContext) {
@@ -6087,7 +6109,7 @@ var Toolbar = function Toolbar(_ref) {
6087
6109
  onClick: function onClick() {
6088
6110
  var _context$luckysheet_s2, _context$luckysheet_s3;
6089
6111
  if (context.luckysheet_select_save == null) {
6090
- showDialog(freezen.noSeletionError, "ok");
6112
+ showDialog(freezen.noSelectionError, "ok");
6091
6113
  return;
6092
6114
  }
6093
6115
  var last = context.luckysheet_select_save[0];
package/dist/index.js CHANGED
@@ -1544,7 +1544,9 @@ var Dialog = function Dialog(_ref) {
1544
1544
  children = _ref.children,
1545
1545
  containerStyle = _ref.containerStyle,
1546
1546
  contentStyle = _ref.contentStyle,
1547
- title = _ref.title;
1547
+ title = _ref.title,
1548
+ okLabel = _ref.okLabel,
1549
+ cancelLabel = _ref.cancelLabel;
1548
1550
  var _useContext = React.useContext(WorkbookContext),
1549
1551
  context = _useContext.context;
1550
1552
  var _locale = fortuneCore.locale(context),
@@ -1575,21 +1577,21 @@ var Dialog = function Dialog(_ref) {
1575
1577
  },
1576
1578
  onClick: onOk,
1577
1579
  tabIndex: 0
1578
- }, button.confirm)) : (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ui.Button, {
1580
+ }, okLabel || button.confirm)) : (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ui.Button, {
1579
1581
  variant: "secondary",
1580
1582
  style: {
1581
1583
  minWidth: "80px"
1582
1584
  },
1583
1585
  onClick: onCancel,
1584
1586
  tabIndex: 0
1585
- }, button.cancel), /*#__PURE__*/React__default['default'].createElement(ui.Button, {
1587
+ }, cancelLabel || button.cancel), /*#__PURE__*/React__default['default'].createElement(ui.Button, {
1586
1588
  variant: "default",
1587
1589
  style: {
1588
1590
  minWidth: "80px"
1589
1591
  },
1590
1592
  onClick: onOk,
1591
1593
  tabIndex: 0
1592
- }, button.confirm))))));
1594
+ }, okLabel || button.confirm))))));
1593
1595
  };
1594
1596
 
1595
1597
  var MessageBox = function MessageBox(_ref) {
@@ -2608,14 +2610,16 @@ function useDialog() {
2608
2610
  var _useContext = React.useContext(ModalContext),
2609
2611
  showModal = _useContext.showModal,
2610
2612
  hideModal = _useContext.hideModal;
2611
- var showDialog = React.useCallback(function (content, type, title) {
2612
- var onOk = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : hideModal;
2613
- var onCancel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : hideModal;
2613
+ var showDialog = React.useCallback(function (content, type, title, okLabel, cancelLabel) {
2614
+ var onOk = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : hideModal;
2615
+ var onCancel = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : hideModal;
2614
2616
  showModal(/*#__PURE__*/React__default['default'].createElement(Dialog, {
2615
2617
  type: type,
2616
2618
  onOk: onOk,
2617
2619
  onCancel: onCancel,
2618
- title: title
2620
+ title: title,
2621
+ okLabel: okLabel,
2622
+ cancelLabel: cancelLabel
2619
2623
  }, content));
2620
2624
  }, [hideModal, showModal]);
2621
2625
  return {
@@ -2701,7 +2705,7 @@ var DataVerification = function DataVerification() {
2701
2705
  var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2;
2702
2706
  var range = fortuneCore.getRangeByTxt(ctx, (_ctx$dataVerification3 = ctx.dataVerification) === null || _ctx$dataVerification3 === void 0 ? void 0 : (_ctx$dataVerification4 = _ctx$dataVerification3.dataRegulation) === null || _ctx$dataVerification4 === void 0 ? void 0 : _ctx$dataVerification4.rangeTxt);
2703
2707
  if (range.length === 0) {
2704
- showDialog(generalDialog.noSeletionError, "ok");
2708
+ showDialog(generalDialog.noSelectionError, "ok");
2705
2709
  return;
2706
2710
  }
2707
2711
  var currentDataVerification = (_ctx$luckysheetfile$g2 = ctx.luckysheetfile[fortuneCore.getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g2 !== void 0 ? _ctx$luckysheetfile$g2 : {};
@@ -3854,10 +3858,13 @@ var SheetOverlay = function SheetOverlay() {
3854
3858
  React.useEffect(function () {
3855
3859
  if (context.warnDialog) {
3856
3860
  setTimeout(function () {
3857
- showDialog(context.warnDialog, "ok");
3861
+ showDialog(context.warnDialog, "yesno", "Invalid data", "Retry");
3862
+ setContext(function (ctx) {
3863
+ ctx.warnDialog = undefined;
3864
+ });
3858
3865
  }, 240);
3859
3866
  }
3860
- }, [context.warnDialog]);
3867
+ }, [context.warnDialog, setContext, showDialog]);
3861
3868
  React.useEffect(function () {
3862
3869
  refs.cellArea.current.scrollLeft = context.scrollLeft;
3863
3870
  refs.cellArea.current.scrollTop = context.scrollTop;
@@ -4172,9 +4179,8 @@ var SheetOverlay = function SheetOverlay() {
4172
4179
  name: "caret-down-fill",
4173
4180
  width: 16,
4174
4181
  height: 16
4175
- })), context.dataVerificationDropDownList && /*#__PURE__*/React__default['default'].createElement(DropDownList, null), /*#__PURE__*/React__default['default'].createElement("div", {
4182
+ })), context.dataVerificationDropDownList && (context.dataVerification.dataRegulation.value1 !== "" || context.dataVerification.dataRegulation.value2 !== "") && (/*#__PURE__*/React__default['default'].createElement(DropDownList, null)), /*#__PURE__*/React__default['default'].createElement("div", {
4176
4183
  id: "luckysheet-dataVerification-showHintBox",
4177
- className: "luckysheet-mousedown-cancel",
4178
4184
  ref: dataVerificationHintBoxRef
4179
4185
  }), /*#__PURE__*/React__default['default'].createElement("div", {
4180
4186
  className: "luckysheet-cell-copy"
@@ -4650,7 +4656,7 @@ var SplitColumn = function SplitColumn() {
4650
4656
  }
4651
4657
  }
4652
4658
  if (dataCover) {
4653
- showDialog(splitText.splitConfirmToExe, "yesno", undefined, function () {
4659
+ showDialog(splitText.splitConfirmToExe, "yesno", undefined, undefined, undefined, function () {
4654
4660
  hideDialog();
4655
4661
  setContext(function (ctx) {
4656
4662
  fortuneCore.updateMoreCell(r, c, dataArr, ctx);
@@ -5865,8 +5871,24 @@ var Toolbar = function Toolbar(_ref) {
5865
5871
  tooltip: tooltip,
5866
5872
  showArrow: false
5867
5873
  }, function (setOpen) {
5868
- return /*#__PURE__*/React__default['default'].createElement(Select, null, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
5869
- return /*#__PURE__*/React__default['default'].createElement(Option, {
5874
+ return /*#__PURE__*/React__default['default'].createElement(Select, {
5875
+ style: {
5876
+ minWidth: "fit-content",
5877
+ width: "50px"
5878
+ }
5879
+ }, [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72].map(function (num) {
5880
+ return /*#__PURE__*/React__default['default'].createElement("div", {
5881
+ className: "fortune-toolbar-select-option text-body-sm text-center color-text-default",
5882
+ style: {
5883
+ minWidth: "fit-content",
5884
+ padding: "0px",
5885
+ width: "36px",
5886
+ height: "36px",
5887
+ display: "flex",
5888
+ alignItems: "center",
5889
+ justifyContent: "center",
5890
+ fontSize: "14px"
5891
+ },
5870
5892
  key: num,
5871
5893
  onClick: function onClick() {
5872
5894
  setContext(function (draftContext) {
@@ -6099,7 +6121,7 @@ var Toolbar = function Toolbar(_ref) {
6099
6121
  onClick: function onClick() {
6100
6122
  var _context$luckysheet_s2, _context$luckysheet_s3;
6101
6123
  if (context.luckysheet_select_save == null) {
6102
- showDialog(freezen.noSeletionError, "ok");
6124
+ showDialog(freezen.noSelectionError, "ok");
6103
6125
  return;
6104
6126
  }
6105
6127
  var last = context.luckysheet_select_save[0];