@leankylin-sheet/react 5.2.29 → 5.2.30

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.
package/dist/index.js CHANGED
@@ -3726,6 +3726,133 @@ var CellTipRender = function CellTipRender() {
3726
3726
  }));
3727
3727
  };
3728
3728
 
3729
+ var CircularReferenceDialog = function CircularReferenceDialog() {
3730
+ var _useContext = React.useContext(WorkbookContext),
3731
+ context = _useContext.context,
3732
+ setContext = _useContext.setContext;
3733
+ var _locale = core.locale(context),
3734
+ formulaMore = _locale.formulaMore;
3735
+ var cells = context.circularReference || [];
3736
+ var _useState = React.useState({
3737
+ x: 0,
3738
+ y: 0
3739
+ }),
3740
+ _useState2 = _slicedToArray(_useState, 2),
3741
+ offset = _useState2[0],
3742
+ setOffset = _useState2[1];
3743
+ var dragRef = React.useRef({
3744
+ dragging: false,
3745
+ startX: 0,
3746
+ startY: 0,
3747
+ initialOffsetX: 0,
3748
+ initialOffsetY: 0
3749
+ });
3750
+ var handleDragStart = React.useCallback(function (e) {
3751
+ dragRef.current = {
3752
+ dragging: true,
3753
+ startX: e.pageX,
3754
+ startY: e.pageY,
3755
+ initialOffsetX: offset.x,
3756
+ initialOffsetY: offset.y
3757
+ };
3758
+ }, [offset]);
3759
+ var handleDragMove = React.useCallback(function (e) {
3760
+ if (!dragRef.current.dragging) return;
3761
+ var dx = e.pageX - dragRef.current.startX;
3762
+ var dy = e.pageY - dragRef.current.startY;
3763
+ setOffset({
3764
+ x: dragRef.current.initialOffsetX + dx,
3765
+ y: dragRef.current.initialOffsetY + dy
3766
+ });
3767
+ }, []);
3768
+ var handleDragEnd = React.useCallback(function () {
3769
+ dragRef.current.dragging = false;
3770
+ }, []);
3771
+ var handleNavigate = function handleNavigate(r, c, sheetId) {
3772
+ setContext(function (draftCtx) {
3773
+ if (sheetId !== draftCtx.currentSheetId) {
3774
+ core.changeSheet(draftCtx, sheetId);
3775
+ }
3776
+ draftCtx.luckysheet_select_save = core.normalizeSelection(draftCtx, [{
3777
+ row: [r, r],
3778
+ column: [c, c]
3779
+ }]);
3780
+ core.scrollToHighlightCell(draftCtx, r, c);
3781
+ });
3782
+ };
3783
+ var handleDismiss = function handleDismiss() {
3784
+ setContext(function (ctx) {
3785
+ delete ctx.circularReference;
3786
+ });
3787
+ };
3788
+ return /*#__PURE__*/React__default['default'].createElement("div", {
3789
+ className: "leankylin-circular-ref-dialog",
3790
+ style: {
3791
+ transform: "translate(".concat(offset.x, "px, ").concat(offset.y, "px)")
3792
+ },
3793
+ onMouseMove: handleDragMove,
3794
+ onMouseUp: handleDragEnd,
3795
+ onMouseLeave: handleDragEnd,
3796
+ onWheelCapture: function onWheelCapture(e) {
3797
+ return e.stopPropagation();
3798
+ }
3799
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
3800
+ className: "leankylin-circular-ref-dialog-title",
3801
+ onMouseDown: handleDragStart
3802
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
3803
+ className: "leankylin-circular-ref-dialog-title-icon"
3804
+ }, /*#__PURE__*/React__default['default'].createElement("svg", {
3805
+ viewBox: "0 0 24 24",
3806
+ fill: "none",
3807
+ stroke: "currentColor",
3808
+ strokeWidth: "2",
3809
+ strokeLinecap: "round",
3810
+ strokeLinejoin: "round"
3811
+ }, /*#__PURE__*/React__default['default'].createElement("circle", {
3812
+ cx: "12",
3813
+ cy: "12",
3814
+ r: "10"
3815
+ }), /*#__PURE__*/React__default['default'].createElement("line", {
3816
+ x1: "12",
3817
+ y1: "8",
3818
+ x2: "12",
3819
+ y2: "12"
3820
+ }), /*#__PURE__*/React__default['default'].createElement("line", {
3821
+ x1: "12",
3822
+ y1: "16",
3823
+ x2: "12.01",
3824
+ y2: "16"
3825
+ }))), /*#__PURE__*/React__default['default'].createElement("span", {
3826
+ className: "leankylin-circular-ref-dialog-title-text"
3827
+ }, formulaMore.circularReferenceTitle)), /*#__PURE__*/React__default['default'].createElement("div", {
3828
+ className: "leankylin-circular-ref-dialog-desc"
3829
+ }, formulaMore.circularReferenceDescription), /*#__PURE__*/React__default['default'].createElement("div", {
3830
+ className: "leankylin-circular-ref-dialog-table-wrap"
3831
+ }, /*#__PURE__*/React__default['default'].createElement("table", {
3832
+ className: "leankylin-circular-ref-dialog-table"
3833
+ }, /*#__PURE__*/React__default['default'].createElement("thead", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", null, formulaMore.circularReferenceSheet), /*#__PURE__*/React__default['default'].createElement("th", null, formulaMore.circularReferenceCell), /*#__PURE__*/React__default['default'].createElement("th", null, formulaMore.circularReferenceFormula))), /*#__PURE__*/React__default['default'].createElement("tbody", null, cells.map(function (cell, index) {
3834
+ return /*#__PURE__*/React__default['default'].createElement("tr", {
3835
+ key: index,
3836
+ className: "leankylin-circular-ref-dialog-table-row",
3837
+ onClick: function onClick() {
3838
+ return handleNavigate(cell.r, cell.c, cell.sheetId);
3839
+ }
3840
+ }, /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
3841
+ className: "leankylin-circular-ref-dialog-table-cell-sheet"
3842
+ }, cell.sheetName || "-")), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
3843
+ className: "leankylin-circular-ref-dialog-table-cell-position"
3844
+ }, cell.cellPosition)), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
3845
+ className: "leankylin-circular-ref-dialog-table-cell-formula"
3846
+ }, cell.formulaContent)));
3847
+ })))), /*#__PURE__*/React__default['default'].createElement("div", {
3848
+ className: "leankylin-circular-ref-dialog-footer"
3849
+ }, /*#__PURE__*/React__default['default'].createElement("button", {
3850
+ type: "button",
3851
+ className: "leankylin-circular-ref-dialog-footer-btn",
3852
+ onClick: handleDismiss
3853
+ }, core.locale(context).button.confirm)));
3854
+ };
3855
+
3729
3856
  var SheetOverlay = function SheetOverlay() {
3730
3857
  var _refs$cellArea$curren, _refs$cellArea$curren2, _context$luckysheet_s, _context$luckysheet_s2, _context$luckysheet_s3, _context$luckysheet_s4, _context$luckysheet_s5, _context$luckysheet_s6, _context$presences$le, _context$presences, _context$linkCard, _context$rangeDialog;
3731
3858
  var _useContext = React.useContext(WorkbookContext),
@@ -4228,7 +4355,21 @@ var SheetOverlay = function SheetOverlay() {
4228
4355
  style: {
4229
4356
  left: context.scrollLeft
4230
4357
  }
4231
- }, settings.Footer)))))));
4358
+ }, settings.Footer)))))), context.circularReference && context.circularReference.length > 0 && ( /*#__PURE__*/React__default['default'].createElement("div", {
4359
+ className: "leankylin-circular-ref-overlay",
4360
+ onMouseDown: function onMouseDown(e) {
4361
+ return e.stopPropagation();
4362
+ },
4363
+ onMouseMove: function onMouseMove(e) {
4364
+ return e.stopPropagation();
4365
+ },
4366
+ onMouseUp: function onMouseUp(e) {
4367
+ return e.stopPropagation();
4368
+ },
4369
+ onContextMenu: function onContextMenu(e) {
4370
+ return e.stopPropagation();
4371
+ }
4372
+ }, /*#__PURE__*/React__default['default'].createElement(CircularReferenceDialog, null))));
4232
4373
  };
4233
4374
 
4234
4375
  var Sheet = function Sheet(_ref) {
@@ -2303,6 +2303,207 @@ html::-webkit-scrollbar-button {
2303
2303
  .leankylin-cell-tip-item{
2304
2304
  pointer-events: none;
2305
2305
  }
2306
+ .leankylin-circular-ref-overlay {
2307
+ position: absolute;
2308
+ top: 0;
2309
+ left: 0;
2310
+ width: 100%;
2311
+ height: 100%;
2312
+ z-index: 1004;
2313
+ display: flex;
2314
+ align-items: center;
2315
+ justify-content: center;
2316
+ pointer-events: none;
2317
+ }
2318
+
2319
+ .leankylin-circular-ref-dialog {
2320
+ min-width: 520px;
2321
+ max-width: 650px;
2322
+ max-height: 480px;
2323
+ background: #fff;
2324
+ border-radius: 6px;
2325
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
2326
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
2327
+ padding: 24px;
2328
+ -webkit-user-select: none;
2329
+ -moz-user-select: none;
2330
+ user-select: none;
2331
+ pointer-events: all;
2332
+ }
2333
+
2334
+ .leankylin-circular-ref-dialog-title {
2335
+ display: flex;
2336
+ align-items: center;
2337
+ gap: 10px;
2338
+ padding-bottom: 12px;
2339
+ border-bottom: 1px solid #f0f0f0;
2340
+ margin-bottom: 14px;
2341
+ cursor: move;
2342
+ }
2343
+
2344
+ .leankylin-circular-ref-dialog-title-icon {
2345
+ display: flex;
2346
+ align-items: center;
2347
+ justify-content: center;
2348
+ width: 28px;
2349
+ height: 28px;
2350
+ border-radius: 50%;
2351
+ background: #fff3e0;
2352
+ flex-shrink: 0;
2353
+ }
2354
+
2355
+ .leankylin-circular-ref-dialog-title-icon svg {
2356
+ width: 16px;
2357
+ height: 16px;
2358
+ color: #e65100;
2359
+ }
2360
+
2361
+ .leankylin-circular-ref-dialog-title-text {
2362
+ font-size: 16px;
2363
+ font-weight: 600;
2364
+ color: #1a1a1a;
2365
+ line-height: 1.4;
2366
+ }
2367
+
2368
+ .leankylin-circular-ref-dialog-desc {
2369
+ font-size: 13px;
2370
+ color: #666;
2371
+ line-height: 1.7;
2372
+ margin-bottom: 16px;
2373
+ padding: 10px 14px;
2374
+ background: #fff8e1;
2375
+ border-radius: 6px;
2376
+ border-left: 3px solid #ffb300;
2377
+ }
2378
+
2379
+ .leankylin-circular-ref-dialog-table-wrap {
2380
+ max-height: 280px;
2381
+ overflow-y: auto;
2382
+ border: 1px solid #e8e8e8;
2383
+ border-radius: 8px;
2384
+ }
2385
+
2386
+ .leankylin-circular-ref-dialog-table-wrap::-webkit-scrollbar {
2387
+ width: 6px;
2388
+ }
2389
+
2390
+ .leankylin-circular-ref-dialog-table-wrap::-webkit-scrollbar-thumb {
2391
+ background: #d0d0d0;
2392
+ border-radius: 3px;
2393
+ }
2394
+
2395
+ .leankylin-circular-ref-dialog-table-wrap::-webkit-scrollbar-track {
2396
+ background: transparent;
2397
+ }
2398
+
2399
+ .leankylin-circular-ref-dialog-table {
2400
+ width: 100%;
2401
+ border-collapse: collapse;
2402
+ table-layout: auto;
2403
+ }
2404
+
2405
+ .leankylin-circular-ref-dialog-table thead th {
2406
+ position: sticky;
2407
+ top: 0;
2408
+ background: #fafafa;
2409
+ color: #555;
2410
+ font-size: 12px;
2411
+ font-weight: 600;
2412
+ text-transform: none;
2413
+ padding: 10px 14px;
2414
+ text-align: left;
2415
+ border-bottom: 2px solid #e8e8e8;
2416
+ letter-spacing: 0.3px;
2417
+ }
2418
+
2419
+ .leankylin-circular-ref-dialog-table thead th:first-child {
2420
+ width: 25%;
2421
+ }
2422
+
2423
+ .leankylin-circular-ref-dialog-table thead th:nth-child(2) {
2424
+ width: 18%;
2425
+ }
2426
+
2427
+ .leankylin-circular-ref-dialog-table thead th:last-child {
2428
+ width: 57%;
2429
+ }
2430
+
2431
+ .leankylin-circular-ref-dialog-table tbody td {
2432
+ padding: 10px 14px;
2433
+ font-size: 13px;
2434
+ color: #333;
2435
+ border-bottom: 1px solid #f5f5f5;
2436
+ vertical-align: middle;
2437
+ }
2438
+
2439
+ .leankylin-circular-ref-dialog-table tbody tr:last-child td {
2440
+ border-bottom: none;
2441
+ }
2442
+
2443
+ .leankylin-circular-ref-dialog-table tbody tr:hover {
2444
+ background: #f9fafb;
2445
+ }
2446
+
2447
+ .leankylin-circular-ref-dialog-table-row {
2448
+ cursor: pointer;
2449
+ transition: background 0.15s;
2450
+ }
2451
+
2452
+ .leankylin-circular-ref-dialog-table-row:hover {
2453
+ background: #e8f0fe !important;
2454
+ }
2455
+
2456
+ .leankylin-circular-ref-dialog-table-cell-sheet {
2457
+ color: #888;
2458
+ font-style: italic;
2459
+ }
2460
+
2461
+ .leankylin-circular-ref-dialog-table-cell-position {
2462
+ display: inline-flex;
2463
+ align-items: center;
2464
+ justify-content: center;
2465
+ padding: 2px 8px;
2466
+ background: #e3f2fd;
2467
+ color: #1565c0;
2468
+ border-radius: 3px;
2469
+ font-weight: 600;
2470
+ font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
2471
+ font-size: 12px;
2472
+ }
2473
+
2474
+ .leankylin-circular-ref-dialog-table-cell-formula {
2475
+ font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
2476
+ font-size: 12px;
2477
+ color: #555;
2478
+ word-break: break-all;
2479
+ }
2480
+
2481
+ .leankylin-circular-ref-dialog-footer {
2482
+ display: flex;
2483
+ justify-content: flex-end;
2484
+ margin-top: 16px;
2485
+ padding-top: 12px;
2486
+ border-top: 1px solid #f0f0f0;
2487
+ }
2488
+
2489
+ .leankylin-circular-ref-dialog-footer-btn {
2490
+ display: inline-flex;
2491
+ align-items: center;
2492
+ padding: 7px 20px;
2493
+ font-size: 13px;
2494
+ font-weight: 500;
2495
+ border: none;
2496
+ border-radius: 5px;
2497
+ cursor: pointer;
2498
+ background: #0188FB;
2499
+ color: #fff;
2500
+ transition: background 0.15s;
2501
+ }
2502
+
2503
+ .leankylin-circular-ref-dialog-footer-btn:hover {
2504
+ background: #006fd6;
2505
+ }
2506
+
2306
2507
  .leankylin-toolbar {
2307
2508
  display: flex;
2308
2509
  flex-direction: row;