@fileverse-dev/fortune-react 1.2.64 → 1.2.66

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.
@@ -135,6 +135,7 @@ import Combo from "./Combo";
135
135
  import Select, { Option } from "./Select";
136
136
  import SVGIcon from "../SVGIcon";
137
137
  import { useDialog } from "../../hooks/useDialog";
138
+ import { useAlert } from "../../hooks/useAlert";
138
139
  import { SplitColumn } from "../SplitColumn";
139
140
  import { LocationCondition } from "../LocationCondition";
140
141
  import ConditionalFormat from "../ConditionFormat";
@@ -481,29 +482,33 @@ var Toolbar = function Toolbar(_a) {
481
482
  var _l = useDialog(),
482
483
  showDialog = _l.showDialog,
483
484
  hideDialog = _l.hideDialog;
485
+ var _m = useAlert(),
486
+ showAlert = _m.showAlert,
487
+ hideAlert = _m.hideAlert;
484
488
  var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
485
489
  var flowdata = getFlowdata(context);
486
490
  contextRef.current = context;
487
491
  var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
488
492
  var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
489
493
  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;
490
- var _m = locale(context),
491
- toolbar = _m.toolbar,
492
- merge = _m.merge,
493
- border = _m.border,
494
- freezen = _m.freezen,
495
- defaultFmt = _m.defaultFmt,
496
- formula = _m.formula,
497
- sort = _m.sort,
498
- align = _m.align,
499
- textWrap = _m.textWrap,
500
- rotation = _m.rotation,
501
- screenshot = _m.screenshot,
502
- filter = _m.filter,
503
- splitText = _m.splitText,
504
- findAndReplace = _m.findAndReplace,
505
- comment = _m.comment,
506
- fontarray = _m.fontarray;
494
+ var _o = locale(context),
495
+ toolbar = _o.toolbar,
496
+ merge = _o.merge,
497
+ border = _o.border,
498
+ freezen = _o.freezen,
499
+ defaultFmt = _o.defaultFmt,
500
+ formula = _o.formula,
501
+ sort = _o.sort,
502
+ align = _o.align,
503
+ textWrap = _o.textWrap,
504
+ rotation = _o.rotation,
505
+ screenshot = _o.screenshot,
506
+ filter = _o.filter,
507
+ splitText = _o.splitText,
508
+ findAndReplace = _o.findAndReplace,
509
+ comment = _o.comment,
510
+ fontarray = _o.fontarray,
511
+ sheetconfig = _o.sheetconfig;
507
512
  var toolbarFormat = locale(context).format;
508
513
  var sheetWidth = context.luckysheetTableContentHW[0];
509
514
  var currency = settings.currency;
@@ -593,9 +598,9 @@ var Toolbar = function Toolbar(_a) {
593
598
  ctx.dataVerification.dataRegulation.value1 = "value1";
594
599
  });
595
600
  }, []);
596
- var _o = useState(false),
597
- showDataValidation = _o[0],
598
- setShowDataValidation = _o[1];
601
+ var _p = useState(false),
602
+ showDataValidation = _p[0],
603
+ setShowDataValidation = _p[1];
599
604
  var dataVerificationClick = function dataVerificationClick(selectedCells) {
600
605
  var _a;
601
606
  var selection = api.getSelection(context);
@@ -1283,8 +1288,12 @@ var Toolbar = function Toolbar(_a) {
1283
1288
  tooltip: tooltip,
1284
1289
  text: "\u5408\u5E76\u5355\u5143\u683C",
1285
1290
  onClick: function onClick() {
1286
- return setContext(function (ctx) {
1287
- handleMerge(ctx, "merge-all");
1291
+ var confirmMessage = sheetconfig.confirmMerge;
1292
+ showAlert(confirmMessage, "yesno", function () {
1293
+ setContext(function (ctx) {
1294
+ handleMerge(ctx, "merge-all");
1295
+ });
1296
+ hideAlert();
1288
1297
  });
1289
1298
  }
1290
1299
  }, function (setOpen) {
@@ -1295,10 +1304,21 @@ var Toolbar = function Toolbar(_a) {
1295
1304
  return /*#__PURE__*/React.createElement(Option, {
1296
1305
  key: value,
1297
1306
  onClick: function onClick() {
1298
- setContext(function (ctx) {
1299
- handleMerge(ctx, value);
1300
- });
1301
- setOpen(false);
1307
+ if (value === "merge-cancel") {
1308
+ setContext(function (ctx) {
1309
+ handleMerge(ctx, value);
1310
+ });
1311
+ setOpen(false);
1312
+ } else {
1313
+ setOpen(false);
1314
+ var confirmMessage = sheetconfig.confirmMerge;
1315
+ showAlert(confirmMessage, "yesno", function () {
1316
+ setContext(function (ctx) {
1317
+ handleMerge(ctx, value);
1318
+ });
1319
+ hideAlert();
1320
+ });
1321
+ }
1302
1322
  }
1303
1323
  }, /*#__PURE__*/React.createElement("div", {
1304
1324
  style: {
@@ -714,6 +714,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
714
714
  chartEditNoOpt: string;
715
715
  sheetNameSpecCharError: string;
716
716
  sheetNamecannotIsEmptyError: string;
717
+ confirmMerge: string;
717
718
  };
718
719
  conditionformat: {
719
720
  conditionformat_greaterThan: string;
@@ -721,6 +721,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
721
721
  chartEditNoOpt: string;
722
722
  sheetNameSpecCharError: string;
723
723
  sheetNamecannotIsEmptyError: string;
724
+ confirmMerge: string;
724
725
  };
725
726
  conditionformat: {
726
727
  conditionformat_greaterThan: string;
@@ -18,6 +18,7 @@ var _Combo = _interopRequireDefault(require("./Combo"));
18
18
  var _Select = _interopRequireWildcard(require("./Select"));
19
19
  var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
20
20
  var _useDialog = require("../../hooks/useDialog");
21
+ var _useAlert = require("../../hooks/useAlert");
21
22
  var _SplitColumn = require("../SplitColumn");
22
23
  var _LocationCondition = require("../LocationCondition");
23
24
  var _ConditionFormat = _interopRequireDefault(require("../ConditionFormat"));
@@ -490,29 +491,33 @@ var Toolbar = function Toolbar(_a) {
490
491
  var _l = (0, _useDialog.useDialog)(),
491
492
  showDialog = _l.showDialog,
492
493
  hideDialog = _l.hideDialog;
494
+ var _m = (0, _useAlert.useAlert)(),
495
+ showAlert = _m.showAlert,
496
+ hideAlert = _m.hideAlert;
493
497
  var firstSelection = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
494
498
  var flowdata = (0, _fortuneCore.getFlowdata)(context);
495
499
  contextRef.current = context;
496
500
  var row = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
497
501
  var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
498
502
  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;
499
- var _m = (0, _fortuneCore.locale)(context),
500
- toolbar = _m.toolbar,
501
- merge = _m.merge,
502
- border = _m.border,
503
- freezen = _m.freezen,
504
- defaultFmt = _m.defaultFmt,
505
- formula = _m.formula,
506
- sort = _m.sort,
507
- align = _m.align,
508
- textWrap = _m.textWrap,
509
- rotation = _m.rotation,
510
- screenshot = _m.screenshot,
511
- filter = _m.filter,
512
- splitText = _m.splitText,
513
- findAndReplace = _m.findAndReplace,
514
- comment = _m.comment,
515
- fontarray = _m.fontarray;
503
+ var _o = (0, _fortuneCore.locale)(context),
504
+ toolbar = _o.toolbar,
505
+ merge = _o.merge,
506
+ border = _o.border,
507
+ freezen = _o.freezen,
508
+ defaultFmt = _o.defaultFmt,
509
+ formula = _o.formula,
510
+ sort = _o.sort,
511
+ align = _o.align,
512
+ textWrap = _o.textWrap,
513
+ rotation = _o.rotation,
514
+ screenshot = _o.screenshot,
515
+ filter = _o.filter,
516
+ splitText = _o.splitText,
517
+ findAndReplace = _o.findAndReplace,
518
+ comment = _o.comment,
519
+ fontarray = _o.fontarray,
520
+ sheetconfig = _o.sheetconfig;
516
521
  var toolbarFormat = (0, _fortuneCore.locale)(context).format;
517
522
  var sheetWidth = context.luckysheetTableContentHW[0];
518
523
  var currency = settings.currency;
@@ -602,9 +607,9 @@ var Toolbar = function Toolbar(_a) {
602
607
  ctx.dataVerification.dataRegulation.value1 = "value1";
603
608
  });
604
609
  }, []);
605
- var _o = (0, _react.useState)(false),
606
- showDataValidation = _o[0],
607
- setShowDataValidation = _o[1];
610
+ var _p = (0, _react.useState)(false),
611
+ showDataValidation = _p[0],
612
+ setShowDataValidation = _p[1];
608
613
  var dataVerificationClick = function dataVerificationClick(selectedCells) {
609
614
  var _a;
610
615
  var selection = _fortuneCore.api.getSelection(context);
@@ -1292,8 +1297,12 @@ var Toolbar = function Toolbar(_a) {
1292
1297
  tooltip: tooltip,
1293
1298
  text: "\u5408\u5E76\u5355\u5143\u683C",
1294
1299
  onClick: function onClick() {
1295
- return setContext(function (ctx) {
1296
- (0, _fortuneCore.handleMerge)(ctx, "merge-all");
1300
+ var confirmMessage = sheetconfig.confirmMerge;
1301
+ showAlert(confirmMessage, "yesno", function () {
1302
+ setContext(function (ctx) {
1303
+ (0, _fortuneCore.handleMerge)(ctx, "merge-all");
1304
+ });
1305
+ hideAlert();
1297
1306
  });
1298
1307
  }
1299
1308
  }, function (setOpen) {
@@ -1304,10 +1313,21 @@ var Toolbar = function Toolbar(_a) {
1304
1313
  return /*#__PURE__*/_react.default.createElement(_Select.Option, {
1305
1314
  key: value,
1306
1315
  onClick: function onClick() {
1307
- setContext(function (ctx) {
1308
- (0, _fortuneCore.handleMerge)(ctx, value);
1309
- });
1310
- setOpen(false);
1316
+ if (value === "merge-cancel") {
1317
+ setContext(function (ctx) {
1318
+ (0, _fortuneCore.handleMerge)(ctx, value);
1319
+ });
1320
+ setOpen(false);
1321
+ } else {
1322
+ setOpen(false);
1323
+ var confirmMessage = sheetconfig.confirmMerge;
1324
+ showAlert(confirmMessage, "yesno", function () {
1325
+ setContext(function (ctx) {
1326
+ (0, _fortuneCore.handleMerge)(ctx, value);
1327
+ });
1328
+ hideAlert();
1329
+ });
1330
+ }
1311
1331
  }
1312
1332
  }, /*#__PURE__*/_react.default.createElement("div", {
1313
1333
  style: {
@@ -714,6 +714,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
714
714
  chartEditNoOpt: string;
715
715
  sheetNameSpecCharError: string;
716
716
  sheetNamecannotIsEmptyError: string;
717
+ confirmMerge: string;
717
718
  };
718
719
  conditionformat: {
719
720
  conditionformat_greaterThan: string;
@@ -721,6 +721,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
721
721
  chartEditNoOpt: string;
722
722
  sheetNameSpecCharError: string;
723
723
  sheetNamecannotIsEmptyError: string;
724
+ confirmMerge: string;
724
725
  };
725
726
  conditionformat: {
726
727
  conditionformat_greaterThan: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.64",
3
+ "version": "1.2.66",
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.64",
19
+ "@fileverse-dev/fortune-core": "1.2.66",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",