@extend-ai__react-xlsx@0.16.0.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. diff --git a/dist/index.cjs b/dist/index.cjs
  2. index 254378b7f5f915cfcae74c8ade9bd9f8927f79a5..1f3802fbe7e74cb5046c7c88f2d4f39f804e85dd 100644
  3. --- a/dist/index.cjs
  4. +++ b/dist/index.cjs
  5. @@ -23055,6 +23055,7 @@ function XlsxGrid({
  6. getCellStyle,
  7. loadingComponent,
  8. loadingState,
  9. + onOpenLink,
  10. onFormControlAction,
  11. onFormControlChange,
  12. renderChartLoading,
  13. @@ -24990,10 +24991,12 @@ function XlsxGrid({
  14. }
  15. }
  16. const externalTarget = target && !target.startsWith("#") ? target : null;
  17. - if (externalTarget && typeof window !== "undefined") {
  18. - window.open(externalTarget, "_blank", "noopener,noreferrer");
  19. + if (externalTarget) {
  20. + // Canvas 单元格、图片、形状共用此出口;宿主回调处理后不得回落到原生弹窗。
  21. + if (onOpenLink) onOpenLink(externalTarget);
  22. + else if (typeof window !== "undefined") window.open(externalTarget, "_blank", "noopener,noreferrer");
  23. }
  24. - }, [activeSheetIndex, selectCell, setActiveSheetIndex, sheets]);
  25. + }, [activeSheetIndex, onOpenLink, selectCell, setActiveSheetIndex, sheets]);
  26. const startEditing = React4.useCallback(
  27. (cell, initialValue) => {
  28. if (readOnly) {
  29. @@ -30745,6 +30748,7 @@ function XlsxViewerInner({
  30. isDark = false,
  31. loadingComponent,
  32. loadingState,
  33. + onOpenLink,
  34. onFormControlAction,
  35. onFormControlChange,
  36. renderChartLoading,
  37. @@ -30810,6 +30814,7 @@ function XlsxViewerInner({
  38. getCellStyle,
  39. loadingComponent,
  40. loadingState,
  41. + onOpenLink,
  42. onFormControlAction,
  43. onFormControlChange,
  44. palette,
  45. diff --git a/dist/index.d.cts b/dist/index.d.cts
  46. index 9e88be3b8059526ca085346ba80eef92aeea8b29..8954a4deafdba61ac60ac7a5200d3c88d2f5893e 100644
  47. --- a/dist/index.d.cts
  48. +++ b/dist/index.d.cts
  49. @@ -1422,6 +1422,8 @@ interface XlsxViewerProviderProps extends UseXlsxViewerControllerOptions {
  50. isDark?: boolean;
  51. }
  52. interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
  53. + /** 外部超链接交给宿主校验;内部工作表定位仍由查看器处理。 */
  54. + onOpenLink?: (url: string) => void;
  55. /**
  56. * Allows row and column resizing even while editing is disabled by `readOnly`.
  57. *
  58. diff --git a/dist/index.d.ts b/dist/index.d.ts
  59. index 9e88be3b8059526ca085346ba80eef92aeea8b29..8954a4deafdba61ac60ac7a5200d3c88d2f5893e 100644
  60. --- a/dist/index.d.ts
  61. +++ b/dist/index.d.ts
  62. @@ -1422,6 +1422,8 @@ interface XlsxViewerProviderProps extends UseXlsxViewerControllerOptions {
  63. isDark?: boolean;
  64. }
  65. interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
  66. + /** 外部超链接交给宿主校验;内部工作表定位仍由查看器处理。 */
  67. + onOpenLink?: (url: string) => void;
  68. /**
  69. * Allows row and column resizing even while editing is disabled by `readOnly`.
  70. *
  71. diff --git a/dist/index.js b/dist/index.js
  72. index e7eb59367f8c1f99d992ff6d518405f298191a83..83fd25a80b6ccdcfeeea075b25cb72aa9ac02e62 100644
  73. --- a/dist/index.js
  74. +++ b/dist/index.js
  75. @@ -23021,6 +23021,7 @@ function XlsxGrid({
  76. getCellStyle,
  77. loadingComponent,
  78. loadingState,
  79. + onOpenLink,
  80. onFormControlAction,
  81. onFormControlChange,
  82. renderChartLoading,
  83. @@ -24956,10 +24957,12 @@ function XlsxGrid({
  84. }
  85. }
  86. const externalTarget = target && !target.startsWith("#") ? target : null;
  87. - if (externalTarget && typeof window !== "undefined") {
  88. - window.open(externalTarget, "_blank", "noopener,noreferrer");
  89. + if (externalTarget) {
  90. + // Canvas 单元格、图片、形状共用此出口;宿主回调处理后不得回落到原生弹窗。
  91. + if (onOpenLink) onOpenLink(externalTarget);
  92. + else if (typeof window !== "undefined") window.open(externalTarget, "_blank", "noopener,noreferrer");
  93. }
  94. - }, [activeSheetIndex, selectCell, setActiveSheetIndex, sheets]);
  95. + }, [activeSheetIndex, onOpenLink, selectCell, setActiveSheetIndex, sheets]);
  96. const startEditing = React4.useCallback(
  97. (cell, initialValue) => {
  98. if (readOnly) {
  99. @@ -30711,6 +30714,7 @@ function XlsxViewerInner({
  100. isDark = false,
  101. loadingComponent,
  102. loadingState,
  103. + onOpenLink,
  104. onFormControlAction,
  105. onFormControlChange,
  106. renderChartLoading,
  107. @@ -30776,6 +30780,7 @@ function XlsxViewerInner({
  108. getCellStyle,
  109. loadingComponent,
  110. loadingState,
  111. + onOpenLink,
  112. onFormControlAction,
  113. onFormControlChange,
  114. palette,