@rowsncolumns/grid 9.0.4 → 13.2.32

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 (208) hide show
  1. package/LICENSE.md +100 -0
  2. package/Readme.md +53 -59
  3. package/dist/cjs/Cell.d.ts +35 -0
  4. package/dist/cjs/Cell.d.ts.map +1 -0
  5. package/dist/cjs/Cell.js +29 -0
  6. package/dist/{CellOverlay.d.ts → cjs/CellOverlay.d.ts} +5 -5
  7. package/dist/cjs/CellOverlay.d.ts.map +1 -0
  8. package/dist/cjs/CellOverlay.js +126 -0
  9. package/dist/cjs/Context.d.ts +8 -0
  10. package/dist/cjs/Context.d.ts.map +1 -0
  11. package/dist/cjs/Context.js +13 -0
  12. package/dist/{FillHandle.d.ts → cjs/FillHandle.d.ts} +2 -1
  13. package/dist/cjs/FillHandle.d.ts.map +1 -0
  14. package/dist/cjs/FillHandle.js +26 -0
  15. package/dist/cjs/Grid.d.ts +558 -0
  16. package/dist/cjs/Grid.d.ts.map +1 -0
  17. package/dist/cjs/Grid.js +2446 -0
  18. package/dist/{GridLine.d.ts → cjs/GridLine.d.ts} +2 -1
  19. package/dist/cjs/GridLine.d.ts.map +1 -0
  20. package/dist/cjs/GridLine.js +10 -0
  21. package/dist/cjs/Image.d.ts +11 -0
  22. package/dist/cjs/Image.d.ts.map +1 -0
  23. package/dist/cjs/Image.js +57 -0
  24. package/dist/cjs/MemoizedGrid.d.ts +49 -0
  25. package/dist/cjs/MemoizedGrid.d.ts.map +1 -0
  26. package/dist/cjs/MemoizedGrid.js +105 -0
  27. package/dist/cjs/Selection.d.ts +5 -0
  28. package/dist/cjs/Selection.d.ts.map +1 -0
  29. package/dist/cjs/Selection.js +10 -0
  30. package/dist/{helpers.d.ts → cjs/helpers.d.ts} +59 -39
  31. package/dist/cjs/helpers.d.ts.map +1 -0
  32. package/dist/cjs/helpers.js +1409 -0
  33. package/dist/{hooks → cjs/hooks}/useCopyPaste.d.ts +3 -2
  34. package/dist/cjs/hooks/useCopyPaste.d.ts.map +1 -0
  35. package/dist/cjs/hooks/useCopyPaste.js +230 -0
  36. package/dist/{hooks → cjs/hooks}/useEditable.d.ts +21 -8
  37. package/dist/cjs/hooks/useEditable.d.ts.map +1 -0
  38. package/dist/cjs/hooks/useEditable.js +491 -0
  39. package/dist/{hooks → cjs/hooks}/useFilter.d.ts +3 -2
  40. package/dist/cjs/hooks/useFilter.d.ts.map +1 -0
  41. package/dist/cjs/hooks/useFilter.js +97 -0
  42. package/dist/{hooks → cjs/hooks}/useImage.d.ts +1 -0
  43. package/dist/cjs/hooks/useImage.d.ts.map +1 -0
  44. package/dist/cjs/hooks/useImage.js +80 -0
  45. package/dist/{hooks → cjs/hooks}/usePagination.d.ts +3 -2
  46. package/dist/cjs/hooks/usePagination.d.ts.map +1 -0
  47. package/dist/cjs/hooks/usePagination.js +53 -0
  48. package/dist/{hooks → cjs/hooks}/useSizer.d.ts +28 -29
  49. package/dist/cjs/hooks/useSizer.d.ts.map +1 -0
  50. package/dist/cjs/hooks/useSizer.js +176 -0
  51. package/dist/{hooks → cjs/hooks}/useTooltip.d.ts +2 -1
  52. package/dist/cjs/hooks/useTooltip.d.ts.map +1 -0
  53. package/dist/cjs/hooks/useTooltip.js +82 -0
  54. package/dist/{hooks → cjs/hooks}/useUndo.d.ts +2 -1
  55. package/dist/cjs/hooks/useUndo.d.ts.map +1 -0
  56. package/dist/cjs/hooks/useUndo.js +87 -0
  57. package/dist/cjs/index.d.ts +19 -0
  58. package/dist/cjs/index.d.ts.map +1 -0
  59. package/dist/cjs/index.js +29 -0
  60. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  61. package/dist/{types.d.ts → cjs/types.d.ts} +8 -3
  62. package/dist/cjs/types.d.ts.map +1 -0
  63. package/dist/{types.js → cjs/types.js} +7 -8
  64. package/dist/cjs/utils.d.ts +9 -0
  65. package/dist/cjs/utils.d.ts.map +1 -0
  66. package/dist/cjs/utils.js +58 -0
  67. package/dist/cjs/vitest.config.d.ts +3 -0
  68. package/dist/cjs/vitest.config.d.ts.map +1 -0
  69. package/dist/cjs/vitest.config.js +24 -0
  70. package/dist/esm/Cell.d.ts +35 -0
  71. package/dist/esm/Cell.d.ts.map +1 -0
  72. package/dist/esm/Cell.js +24 -0
  73. package/dist/esm/CellOverlay.d.ts +21 -0
  74. package/dist/esm/CellOverlay.d.ts.map +1 -0
  75. package/dist/esm/CellOverlay.js +120 -0
  76. package/dist/esm/Context.d.ts +8 -0
  77. package/dist/esm/Context.d.ts.map +1 -0
  78. package/dist/esm/Context.js +9 -0
  79. package/dist/esm/FillHandle.d.ts +8 -0
  80. package/dist/esm/FillHandle.d.ts.map +1 -0
  81. package/dist/{FillHandle.js → esm/FillHandle.js} +5 -11
  82. package/dist/esm/Grid.d.ts +558 -0
  83. package/dist/esm/Grid.d.ts.map +1 -0
  84. package/dist/esm/Grid.js +2451 -0
  85. package/dist/esm/GridLine.d.ts +5 -0
  86. package/dist/esm/GridLine.d.ts.map +1 -0
  87. package/dist/esm/GridLine.js +7 -0
  88. package/dist/esm/Image.d.ts +11 -0
  89. package/dist/esm/Image.d.ts.map +1 -0
  90. package/dist/esm/Image.js +53 -0
  91. package/dist/esm/MemoizedGrid.d.ts +49 -0
  92. package/dist/esm/MemoizedGrid.d.ts.map +1 -0
  93. package/dist/esm/MemoizedGrid.js +98 -0
  94. package/dist/esm/Selection.d.ts +5 -0
  95. package/dist/esm/Selection.d.ts.map +1 -0
  96. package/dist/esm/Selection.js +7 -0
  97. package/dist/esm/helpers.d.ts +281 -0
  98. package/dist/esm/helpers.d.ts.map +1 -0
  99. package/dist/esm/helpers.js +1260 -0
  100. package/dist/esm/hooks/useCopyPaste.d.ts +53 -0
  101. package/dist/esm/hooks/useCopyPaste.d.ts.map +1 -0
  102. package/dist/{hooks → esm/hooks}/useCopyPaste.js +40 -46
  103. package/dist/esm/hooks/useEditable.d.ts +253 -0
  104. package/dist/esm/hooks/useEditable.d.ts.map +1 -0
  105. package/dist/esm/hooks/useEditable.js +482 -0
  106. package/dist/esm/hooks/useFilter.d.ts +69 -0
  107. package/dist/esm/hooks/useFilter.d.ts.map +1 -0
  108. package/dist/{hooks → esm/hooks}/useFilter.js +22 -42
  109. package/dist/esm/hooks/useImage.d.ts +13 -0
  110. package/dist/esm/hooks/useImage.d.ts.map +1 -0
  111. package/dist/esm/hooks/useImage.js +76 -0
  112. package/dist/esm/hooks/usePagination.d.ts +69 -0
  113. package/dist/esm/hooks/usePagination.d.ts.map +1 -0
  114. package/dist/esm/hooks/usePagination.js +47 -0
  115. package/dist/esm/hooks/useSizer.d.ts +114 -0
  116. package/dist/esm/hooks/useSizer.d.ts.map +1 -0
  117. package/dist/esm/hooks/useSizer.js +176 -0
  118. package/dist/esm/hooks/useTooltip.d.ts +43 -0
  119. package/dist/esm/hooks/useTooltip.d.ts.map +1 -0
  120. package/dist/esm/hooks/useTooltip.js +80 -0
  121. package/dist/esm/hooks/useUndo.d.ts +36 -0
  122. package/dist/esm/hooks/useUndo.d.ts.map +1 -0
  123. package/dist/{hooks → esm/hooks}/useUndo.js +16 -25
  124. package/dist/esm/index.d.ts +19 -0
  125. package/dist/esm/index.d.ts.map +1 -0
  126. package/dist/esm/index.js +17 -0
  127. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
  128. package/dist/esm/types.d.ts +70 -0
  129. package/dist/esm/types.d.ts.map +1 -0
  130. package/dist/esm/types.js +68 -0
  131. package/dist/esm/utils.d.ts +9 -0
  132. package/dist/esm/utils.d.ts.map +1 -0
  133. package/dist/esm/utils.js +104 -0
  134. package/dist/esm/vitest.config.d.ts +3 -0
  135. package/dist/esm/vitest.config.d.ts.map +1 -0
  136. package/dist/esm/vitest.config.js +22 -0
  137. package/package.json +28 -29
  138. package/dist/Cell.d.ts +0 -23
  139. package/dist/Cell.js +0 -55
  140. package/dist/Cell.js.map +0 -1
  141. package/dist/CellOverlay.js +0 -116
  142. package/dist/CellOverlay.js.map +0 -1
  143. package/dist/FillHandle.js.map +0 -1
  144. package/dist/Grid.d.ts +0 -385
  145. package/dist/Grid.js +0 -1684
  146. package/dist/Grid.js.map +0 -1
  147. package/dist/GridLine.js +0 -13
  148. package/dist/GridLine.js.map +0 -1
  149. package/dist/Image.d.ts +0 -8
  150. package/dist/Image.js +0 -50
  151. package/dist/Image.js.map +0 -1
  152. package/dist/Selection.d.ts +0 -4
  153. package/dist/Selection.js +0 -9
  154. package/dist/Selection.js.map +0 -1
  155. package/dist/helpers.js +0 -1033
  156. package/dist/helpers.js.map +0 -1
  157. package/dist/hooks/useCopyPaste.js.map +0 -1
  158. package/dist/hooks/useEditable.js +0 -477
  159. package/dist/hooks/useEditable.js.map +0 -1
  160. package/dist/hooks/useFilter.js.map +0 -1
  161. package/dist/hooks/useImage.js +0 -42
  162. package/dist/hooks/useImage.js.map +0 -1
  163. package/dist/hooks/usePagination.js +0 -73
  164. package/dist/hooks/usePagination.js.map +0 -1
  165. package/dist/hooks/useSelection.d.ts +0 -175
  166. package/dist/hooks/useSelection.js +0 -982
  167. package/dist/hooks/useSelection.js.map +0 -1
  168. package/dist/hooks/useSizer.js +0 -150
  169. package/dist/hooks/useSizer.js.map +0 -1
  170. package/dist/hooks/useTooltip.js +0 -106
  171. package/dist/hooks/useTooltip.js.map +0 -1
  172. package/dist/hooks/useTouch.d.ts +0 -21
  173. package/dist/hooks/useTouch.js +0 -73
  174. package/dist/hooks/useTouch.js.map +0 -1
  175. package/dist/hooks/useUndo.js.map +0 -1
  176. package/dist/index.d.ts +0 -25
  177. package/dist/index.js +0 -61
  178. package/dist/index.js.map +0 -1
  179. package/dist/types.js.map +0 -1
  180. package/dist/utils.d.ts +0 -8
  181. package/dist/utils.js +0 -153
  182. package/dist/utils.js.map +0 -1
  183. package/src/Cell.tsx +0 -100
  184. package/src/CellOverlay.tsx +0 -191
  185. package/src/FillHandle.tsx +0 -37
  186. package/src/Grid.tsx +0 -2677
  187. package/src/GridLine.tsx +0 -23
  188. package/src/Image.tsx +0 -43
  189. package/src/Selection.tsx +0 -9
  190. package/src/helpers.ts +0 -1455
  191. package/src/hooks/useCopyPaste.ts +0 -265
  192. package/src/hooks/useEditable.tsx +0 -945
  193. package/src/hooks/useFilter.tsx +0 -233
  194. package/src/hooks/useImage.ts +0 -57
  195. package/src/hooks/usePagination.tsx +0 -153
  196. package/src/hooks/useSelection.ts +0 -1440
  197. package/src/hooks/useSizer.ts +0 -312
  198. package/src/hooks/useTooltip.tsx +0 -172
  199. package/src/hooks/useTouch.ts +0 -116
  200. package/src/hooks/useUndo.ts +0 -134
  201. package/src/index.tsx +0 -46
  202. package/src/tests/Grid.spec.tsx +0 -47
  203. package/src/tests/helpers.test.ts +0 -292
  204. package/src/tests/usePagination.test.ts +0 -28
  205. package/src/tests/useSelection.test.ts +0 -27
  206. package/src/tests/useUndo.test.ts +0 -73
  207. package/src/types.ts +0 -69
  208. package/src/utils.tsx +0 -287
@@ -0,0 +1,5 @@
1
+ import type { ShapeConfig } from "konva/lib/Shape";
2
+ import React from "react";
3
+ declare const GridLine: React.FC<ShapeConfig>;
4
+ export default GridLine;
5
+ //# sourceMappingURL=GridLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridLine.d.ts","sourceRoot":"","sources":["../../GridLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAiBnC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Line } from "react-konva";
3
+ const GridLine = (props) => {
4
+ const { points, stroke, strokeWidth, offsetY, offsetX } = props;
5
+ return (React.createElement(Line, { points: points, stroke: stroke, strokeWidth: strokeWidth, offsetY: offsetY, offsetX: offsetX, shadowForStrokeEnabled: false, strokeScaleEnabled: false, hitStrokeWidth: 0, listening: false, perfectDrawEnabled: false, lineCap: "square" }));
6
+ };
7
+ export default GridLine;
@@ -0,0 +1,11 @@
1
+ import type { ShapeConfig } from "konva/lib/Shape";
2
+ import React from "react";
3
+ export interface ImageProps extends ShapeConfig {
4
+ url: string;
5
+ spacing?: number;
6
+ horizontalAlignment?: "left" | "right" | "center";
7
+ verticalAlignment?: "top" | "middle" | "bottom";
8
+ enableCache?: boolean;
9
+ }
10
+ export declare const Image: React.MemoExoticComponent<(props: ImageProps) => React.JSX.Element | null>;
11
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAA2C,MAAM,OAAO,CAAC;AAMhE,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClD,iBAAiB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,KAAK,oCAAgB,UAAU,8BA4D1C,CAAC"}
@@ -0,0 +1,53 @@
1
+ import React, { memo, useMemo, useEffect, useRef } from "react";
2
+ import { Image as BaseImage } from "react-konva";
3
+ import useImage from "./hooks/useImage";
4
+ export const Image = memo((props) => {
5
+ const { url, spacing = 1, horizontalAlignment, verticalAlignment, width: containerWidth = 0, height: containerHeight = 0, enableCache = false, ...rest } = props;
6
+ let { width = 0, height = 0, x = 0, y = 0 } = props;
7
+ const imageRef = useRef(null);
8
+ const { image, width: imageWidth, height: imageHeight, status, } = useImage({
9
+ url,
10
+ });
11
+ const aspectRatio = useMemo(() => {
12
+ return Math.min((width - spacing) / imageWidth, (height - spacing) / imageHeight);
13
+ }, [imageWidth, imageHeight, width, height, spacing]);
14
+ x = x + spacing;
15
+ y = y + spacing;
16
+ width = Math.min(imageWidth, aspectRatio * imageWidth);
17
+ height = Math.min(imageHeight, aspectRatio * imageHeight);
18
+ useEffect(() => {
19
+ if (enableCache && imageRef.current) {
20
+ imageRef.current.cache();
21
+ }
22
+ // `image` must be a dependency: when `url` swaps between already-loaded images (an AOP chip's
23
+ // ic-flow → ic-session on completion), the shared image cache answers synchronously — `status`
24
+ // stays "loaded" and the dimensions are unchanged, so without it the Konva node keeps blitting
25
+ // the PREVIOUS icon's cached bitmap (scene graph updated, canvas stale) until a full remount.
26
+ }, [enableCache, status, width, height, image]);
27
+ if (status !== "loaded") {
28
+ return null;
29
+ }
30
+ x = x + getHorizontalOffset(horizontalAlignment, containerWidth, width);
31
+ y = y + getVerticalOffset(verticalAlignment, containerHeight, height);
32
+ return (React.createElement(BaseImage, { ref: imageRef, ...rest, x: x, y: y, height: height, width: width, image: image }));
33
+ });
34
+ const getHorizontalOffset = (horizontalAlignment, containerWidth, imageWidth) => {
35
+ switch (horizontalAlignment) {
36
+ case "center":
37
+ return (containerWidth - imageWidth) / 2;
38
+ case "right":
39
+ return containerWidth - imageWidth;
40
+ default:
41
+ return 0;
42
+ }
43
+ };
44
+ const getVerticalOffset = (verticalAlignment, containerHeight, imageHeight) => {
45
+ switch (verticalAlignment) {
46
+ case "middle":
47
+ return (containerHeight - imageHeight) / 2;
48
+ case "bottom":
49
+ return containerHeight - imageHeight - 1; // Cater for border;
50
+ default:
51
+ return 0;
52
+ }
53
+ };
@@ -0,0 +1,49 @@
1
+ import type Konva from "konva";
2
+ import type { ReactNode } from "react";
3
+ import React from "react";
4
+ import type { GridProps } from "./Grid";
5
+ type RefAttribute = {
6
+ ref: React.Ref<Konva.Stage>;
7
+ };
8
+ type MemoizedGridProps = {
9
+ cells: ReactNode[];
10
+ gridLines: ReactNode[];
11
+ gridLinesFrozenRow: ReactNode[];
12
+ gridLinesFrozenColumn: ReactNode[];
13
+ gridLinesFrozenIntersection: ReactNode[];
14
+ cellOverlays: ReactNode[];
15
+ cellBackgrounds: ReactNode[];
16
+ frozenRowCellOverlays: ReactNode[];
17
+ frozenColumnCellOverlays: ReactNode[];
18
+ frozenRowCellBackgrounds: ReactNode[];
19
+ frozenColumnCellBackgrounds: ReactNode[];
20
+ frozenIntersectionCellOverlays: ReactNode[];
21
+ frozenIntersectionCellBackgrounds: ReactNode[];
22
+ frozenRowCells: ReactNode[];
23
+ frozenRowHeaderCells: ReactNode[];
24
+ frozenColumnCells: ReactNode[];
25
+ frozenColumnHeaderCells: ReactNode[];
26
+ frozenIntersectionCells: ReactNode[];
27
+ frozenIntersectionRowHeaderCells: ReactNode[];
28
+ frozenIntersectionColumnHeaderCells: ReactNode[];
29
+ frozenRowShadowComponent: React.JSX.Element | null;
30
+ frozenColumnShadowComponent: React.JSX.Element | null;
31
+ frozenColumnWidth: number;
32
+ frozenRowHeight: number;
33
+ width: number;
34
+ height: number;
35
+ frozenSpacing: number;
36
+ scrollTop: number;
37
+ scrollLeft: number;
38
+ headerRowHeight: number;
39
+ headerColumnWidth: number;
40
+ stageProps?: GridProps["stageProps"];
41
+ listening?: boolean;
42
+ showHeaders?: boolean;
43
+ wrapper?: GridProps["wrapper"];
44
+ rowHeaderStageRef?: React.RefObject<Konva.Stage | null>;
45
+ columnHeaderStageRef?: React.RefObject<Konva.Stage | null>;
46
+ };
47
+ export declare const MemoizedGrid: React.FunctionComponent<MemoizedGridProps & RefAttribute>;
48
+ export {};
49
+ //# sourceMappingURL=MemoizedGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoizedGrid.d.ts","sourceRoot":"","sources":["../../MemoizedGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAmC,M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AAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACxD,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAC5D,CAAC;AAyBF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAChD,iBAAiB,GAAG,YAAY,CA2HjC,CAAC"}
@@ -0,0 +1,98 @@
1
+ import React, { forwardRef, memo, useRef } from "react";
2
+ import { Group, Layer, Stage } from "react-konva";
3
+ import { canUseDOM, getDevicePixelRatio, useIsomorphicLayoutEffect, } from "./helpers";
4
+ const useResizeListener = (layerRef) => {
5
+ useIsomorphicLayoutEffect(() => {
6
+ if (canUseDOM) {
7
+ const handler = () => {
8
+ if (layerRef.current) {
9
+ layerRef.current.getCanvas().pixelRatio = getDevicePixelRatio();
10
+ }
11
+ };
12
+ const visibilityHandler = () => {
13
+ if (document.visibilityState === "visible") {
14
+ layerRef.current?.batchDraw();
15
+ }
16
+ };
17
+ window.addEventListener("resize", handler);
18
+ window.addEventListener("visibilitychange", visibilityHandler);
19
+ return () => {
20
+ window.removeEventListener("resize", handler);
21
+ window.removeEventListener("visibilitychange", visibilityHandler);
22
+ };
23
+ }
24
+ }, []);
25
+ };
26
+ export const MemoizedGrid = memo(forwardRef((props, forwardedRef) => {
27
+ const { cells, gridLines, cellOverlays, cellBackgrounds, frozenRowCells, frozenRowHeaderCells, gridLinesFrozenRow, frozenRowShadowComponent, frozenRowCellOverlays, frozenRowCellBackgrounds, frozenColumnCellBackgrounds, gridLinesFrozenColumn, frozenColumnCells, frozenColumnHeaderCells, frozenColumnShadowComponent, frozenColumnCellOverlays, gridLinesFrozenIntersection, frozenIntersectionCells, frozenIntersectionCellOverlays, frozenIntersectionCellBackgrounds, frozenIntersectionRowHeaderCells, frozenIntersectionColumnHeaderCells, frozenColumnWidth, frozenRowHeight, width, height, frozenSpacing, scrollTop, scrollLeft, headerRowHeight, headerColumnWidth, showHeaders, listening, columnHeaderStageRef, rowHeaderStageRef, } = props;
28
+ return (React.createElement(React.Fragment, null,
29
+ React.createElement(Stage, { width: width, height: height, ref: forwardedRef, listening: listening, className: "rnc-cell-stage print:mt-[var(--rnc-print-top-margin)] print:ml-[var(--rnc-print-left-margin)]" },
30
+ React.createElement(CellLayer, { cells: cells, gridLines: gridLines, cellOverlays: cellOverlays, cellBackgrounds: cellBackgrounds, frozenRowCells: frozenRowCells, gridLinesFrozenRow: gridLinesFrozenRow, frozenRowShadowComponent: frozenRowShadowComponent, frozenRowCellOverlays: frozenRowCellOverlays, frozenRowCellBackgrounds: frozenRowCellBackgrounds, frozenColumnCellBackgrounds: frozenColumnCellBackgrounds, gridLinesFrozenColumn: gridLinesFrozenColumn, frozenColumnCells: frozenColumnCells, frozenColumnShadowComponent: frozenColumnShadowComponent, frozenColumnCellOverlays: frozenColumnCellOverlays, gridLinesFrozenIntersection: gridLinesFrozenIntersection, frozenIntersectionCells: frozenIntersectionCells, frozenIntersectionCellOverlays: frozenIntersectionCellOverlays, frozenIntersectionCellBackgrounds: frozenIntersectionCellBackgrounds, frozenColumnWidth: frozenColumnWidth, frozenRowHeight: frozenRowHeight, frozenSpacing: frozenSpacing, scrollTop: scrollTop, scrollLeft: scrollLeft, width: width, height: height })),
31
+ showHeaders ? (React.createElement(Stage, { width: width, height: headerRowHeight, listening: false, ref: columnHeaderStageRef, className: "rnc-header-stage absolute top-0 left-0 print:hidden" },
32
+ React.createElement(ColumnHeader, { frozenColumnWidth: frozenColumnWidth, frozenRowHeight: frozenRowHeight, frozenSpacing: frozenSpacing, frozenHeaderCells: frozenColumnHeaderCells, frozenIntersectionHeaderCells: frozenIntersectionColumnHeaderCells, scrollLeft: scrollLeft }))) : null,
33
+ showHeaders ? (React.createElement(Stage, { width: headerColumnWidth, height: height, listening: false, ref: rowHeaderStageRef, className: "rnc-header-stage absolute top-0 left-0 print:hidden" },
34
+ React.createElement(RowHeader, { frozenColumnWidth: frozenColumnWidth, frozenRowHeight: frozenRowHeight, frozenSpacing: frozenSpacing, frozenHeaderCells: frozenRowHeaderCells, frozenIntersectionHeaderCells: frozenIntersectionRowHeaderCells, scrollTop: scrollTop }))) : null));
35
+ }));
36
+ /**
37
+ * Canvas layer to draw row headers
38
+ */
39
+ const ColumnHeader = memo(({ frozenColumnWidth, frozenRowHeight, scrollLeft, frozenSpacing, frozenHeaderCells, frozenIntersectionHeaderCells, }) => {
40
+ // Pixel ratio in sync
41
+ const layerRef = useRef(null);
42
+ useResizeListener(layerRef);
43
+ return (React.createElement(Layer, { draggable: false, listening: false, imageSmoothingEnabled: false, ref: layerRef },
44
+ React.createElement(Group, { offsetY: 0, offsetX: scrollLeft }, frozenHeaderCells),
45
+ React.createElement(Group, { clipX: 0, clipY: 0, clipWidth: frozenColumnWidth + frozenSpacing, clipHeight: frozenRowHeight + frozenSpacing }, frozenIntersectionHeaderCells)));
46
+ });
47
+ ColumnHeader.displayName = "ColumnHeader";
48
+ /**
49
+ * Canvas layer to draw column headers
50
+ */
51
+ const RowHeader = memo(({ frozenColumnWidth, frozenRowHeight, scrollTop, frozenSpacing, frozenHeaderCells, frozenIntersectionHeaderCells, }) => {
52
+ // Pixel ratio in sync
53
+ const layerRef = useRef(null);
54
+ useResizeListener(layerRef);
55
+ return (React.createElement(Layer, { draggable: false, listening: false, imageSmoothingEnabled: false, ref: layerRef },
56
+ React.createElement(Group, { offsetY: scrollTop, offsetX: 0 }, frozenHeaderCells),
57
+ React.createElement(Group, { clipX: 0, clipY: 0, clipWidth: frozenColumnWidth + frozenSpacing, clipHeight: frozenRowHeight + frozenSpacing }, frozenIntersectionHeaderCells)));
58
+ });
59
+ RowHeader.displayName = "RowHeader";
60
+ /**
61
+ * Canvas layer to draw cells
62
+ */
63
+ const CellLayer = memo((props) => {
64
+ const { cells, gridLines, cellOverlays, cellBackgrounds, frozenRowCells, gridLinesFrozenRow, frozenRowShadowComponent, frozenRowCellOverlays, frozenRowCellBackgrounds, gridLinesFrozenColumn, frozenColumnCells, frozenColumnShadowComponent, frozenColumnCellOverlays, frozenColumnCellBackgrounds, gridLinesFrozenIntersection, frozenIntersectionCells, frozenIntersectionCellOverlays, frozenIntersectionCellBackgrounds, frozenColumnWidth, frozenRowHeight, width, height, frozenSpacing, scrollTop, scrollLeft, } = props;
65
+ // Pixel ratio in sync
66
+ const layerRef = useRef(null);
67
+ useResizeListener(layerRef);
68
+ return (React.createElement(Layer, { draggable: false, ref: layerRef },
69
+ React.createElement(Group, { clipX: frozenColumnWidth, clipY: frozenRowHeight, clipWidth: width - frozenColumnWidth, clipHeight: height - frozenRowHeight },
70
+ React.createElement(Group, { offsetY: scrollTop, offsetX: scrollLeft },
71
+ gridLines,
72
+ cellBackgrounds,
73
+ cellOverlays,
74
+ cells)),
75
+ React.createElement(Group, { clipX: frozenColumnWidth, clipY: 0, clipWidth: width - frozenColumnWidth, clipHeight: frozenRowHeight + frozenSpacing },
76
+ React.createElement(Group, { offsetY: 0, offsetX: scrollLeft },
77
+ gridLinesFrozenRow,
78
+ frozenRowCellBackgrounds,
79
+ frozenRowCellOverlays,
80
+ frozenRowCells,
81
+ frozenRowShadowComponent)),
82
+ React.createElement(Group, { clipX: 0, clipY: frozenRowHeight, clipWidth: frozenColumnWidth + frozenSpacing, clipHeight: height - frozenRowHeight },
83
+ React.createElement(Group, { offsetY: scrollTop, offsetX: 0 },
84
+ gridLinesFrozenColumn,
85
+ frozenColumnCellBackgrounds,
86
+ frozenColumnCellOverlays,
87
+ frozenColumnCells,
88
+ frozenColumnShadowComponent)),
89
+ React.createElement(Group, { clipX: 0, clipY: 0, clipWidth: frozenColumnWidth + frozenSpacing, clipHeight: frozenRowHeight + frozenSpacing },
90
+ gridLinesFrozenIntersection,
91
+ frozenIntersectionCellBackgrounds,
92
+ frozenIntersectionCellOverlays,
93
+ frozenIntersectionCells,
94
+ frozenRowShadowComponent,
95
+ frozenColumnShadowComponent)));
96
+ });
97
+ CellLayer.displayName = "CellLayer";
98
+ MemoizedGrid.displayName = "MemoizedGrid";
@@ -0,0 +1,5 @@
1
+ import type React from "react";
2
+ import type { SelectionProps } from "./Grid";
3
+ declare const Selection: React.FC<SelectionProps>;
4
+ export default Selection;
5
+ //# sourceMappingURL=Selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Selection.d.ts","sourceRoot":"","sources":["../../Selection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7C,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAEtC,CAAC;AAIH,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { memo } from "react";
2
+ import { createHTMLBox } from "./utils";
3
+ const Selection = memo((props) => {
4
+ return createHTMLBox({ strokeWidth: 1, ...props });
5
+ });
6
+ Selection.displayName = "Selection";
7
+ export default Selection;
@@ -0,0 +1,281 @@
1
+ import { useLayoutEffect } from "react";
2
+ import type { FrameCallbackType } from "scheduler";
3
+ import type { CellInterface, CellMetaData, GridRange, InstanceInterface, ItemSizer, SelectionArea } from "./Grid";
4
+ import { Direction, RowRange } from "./types";
5
+ export declare enum Align {
6
+ start = "start",
7
+ end = "end",
8
+ center = "center",
9
+ auto = "auto",
10
+ smart = "smart"
11
+ }
12
+ export declare enum ItemType {
13
+ row = "row",
14
+ column = "column"
15
+ }
16
+ export interface IItemMetaData {
17
+ itemType: ItemType;
18
+ offset: number;
19
+ index: number;
20
+ rowCount: number;
21
+ columnCount: number;
22
+ rowHeight: ItemSizer;
23
+ columnWidth: ItemSizer;
24
+ instanceProps: InstanceInterface;
25
+ scale: number;
26
+ }
27
+ export declare const getRowStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }: Omit<IItemMetaData, "index" | "itemType">) => number;
28
+ interface IRowStopIndex extends Omit<IItemMetaData, "itemType" | "index" | "offset" | "columnCount"> {
29
+ startIndex: number;
30
+ containerHeight: number;
31
+ scrollTop: number;
32
+ visibleRowRanges?: RowRange[];
33
+ }
34
+ export declare const getRowStopIndexForStartIndex: ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale, visibleRowRanges, }: IRowStopIndex) => number;
35
+ export declare const getColumnStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }: Omit<IItemMetaData, "index" | "itemType">) => number;
36
+ interface IColumnStopIndex extends Omit<IItemMetaData, "itemType" | "index" | "offset" | "rowCount"> {
37
+ startIndex: number;
38
+ containerWidth: number;
39
+ scrollLeft: number;
40
+ }
41
+ export declare const getColumnStopIndexForStartIndex: ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale, }: IColumnStopIndex) => number;
42
+ export declare const getBoundedCells: (area: GridRange | null | undefined) => Set<string>;
43
+ export declare const itemKey: ({ rowIndex, columnIndex }: CellInterface) => string;
44
+ export declare const getRowOffset: ({ index, rowHeight, columnWidth, instanceProps, scale, readonly, visibleRowRanges, }: Omit<IGetItemMetadata, "itemType">) => number;
45
+ export declare const getColumnOffset: ({ index, rowHeight, columnWidth, instanceProps, scale, readonly, }: Omit<IGetItemMetadata, "itemType">) => number;
46
+ export declare const getRowHeight: (index: number, instanceProps: InstanceInterface) => number;
47
+ export declare const getColumnWidth: (index: number, instanceProps: InstanceInterface) => number;
48
+ type IGetItemMetadata = Pick<IItemMetaData, "itemType" | "index" | "rowHeight" | "columnWidth" | "instanceProps" | "scale"> & {
49
+ readonly?: boolean;
50
+ visibleRowRanges?: RowRange[];
51
+ };
52
+ export declare const getItemMetadata: ({ itemType, index, rowHeight, columnWidth, instanceProps, scale, readonly, visibleRowRanges, }: IGetItemMetadata) => CellMetaData;
53
+ export declare const getEstimatedTotalHeight: (rowCount: number, instanceProps: InstanceInterface) => number;
54
+ export declare const getEstimatedTotalWidth: (columnCount: number, instanceProps: InstanceInterface) => number;
55
+ export declare const cellIdentifier: (rowIndex: number, columnIndex: number) => string;
56
+ /**
57
+ * @desc Throttle fn
58
+ * @param func function
59
+ * @param limit Delay in milliseconds
60
+ */
61
+ export declare function throttle<T extends Function>(func: T, limit: number): T;
62
+ export declare function debounce<T extends Function>(cb: T, wait?: number): T;
63
+ export declare function rafThrottle(callback: Function): (e: any) => void;
64
+ export declare const scheduleIdlePriorityCallback: (callback: FrameCallbackType) => import("scheduler").CallbackNode;
65
+ export declare function ricThrottle(callback: Function): (e: any) => void;
66
+ export interface AlignmentProps extends Omit<IItemMetaData, "offset"> {
67
+ containerHeight: number;
68
+ containerWidth: number;
69
+ align?: Align;
70
+ scrollOffset: number;
71
+ scrollbarSize: number;
72
+ frozenOffset: number;
73
+ estimatedTotalHeight: number;
74
+ estimatedTotalWidth: number;
75
+ }
76
+ export declare const getOffsetForIndexAndAlignment: ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align, scrollOffset, instanceProps, scrollbarSize, frozenOffset, scale, estimatedTotalHeight, estimatedTotalWidth, }: AlignmentProps) => number;
77
+ export declare const getOffsetForColumnAndAlignment: (props: Omit<AlignmentProps, "itemType">) => number;
78
+ export declare const getOffsetForRowAndAlignment: (props: Omit<AlignmentProps, "itemType">) => number;
79
+ export type TimeoutID = {
80
+ id: number;
81
+ };
82
+ export declare function cancelTimeout(timeoutID: TimeoutID): void;
83
+ /**
84
+ * Create a throttler based on RAF
85
+ * @param callback
86
+ * @param delay
87
+ */
88
+ export declare function requestTimeout(callback: Function, delay: number): TimeoutID;
89
+ export declare const selectionFromActiveCell: (activeCell: CellInterface | null) => SelectionArea[];
90
+ /**
91
+ * Check if a selection are spans multiple cells
92
+ * @param sel
93
+ */
94
+ export declare const selectionSpansCells: (sel: GridRange | undefined) => boolean;
95
+ /**
96
+ * When user tries to drag a selection
97
+ * @param initialSelection
98
+ * @param from
99
+ * @param to
100
+ */
101
+ export declare const newSelectionFromDrag: (initialSelection: SelectionArea, from: CellInterface, to: CellInterface, topBound: number | undefined, leftBound: number | undefined, rowCount: number, columnCount: number) => SelectionArea;
102
+ /**
103
+ * Clamp cell coordinates to be inside activeCell and selection
104
+ * @param coords
105
+ * @param activeCell
106
+ * @param selection
107
+ */
108
+ export declare const clampCellCoords: (coords: CellInterface, activeCell: CellInterface | undefined, selection: SelectionArea | undefined) => CellInterface;
109
+ /**
110
+ * Converts a number to alphabet
111
+ * @param i
112
+ */
113
+ export declare const numberToAlphabet: (i: number) => string;
114
+ /**
115
+ * Convert selections to html and csv data
116
+ * @param rows
117
+ */
118
+ export declare const prepareClipboardData: (rows: (string | undefined)[][]) => [string, string];
119
+ /**
120
+ * Cycles active cell within selecton bounds
121
+ * @param activeCellBounds
122
+ * @param selectionBounds
123
+ * @param direction
124
+ */
125
+ export declare const findNextCellWithinBounds: (activeCellBounds: GridRange, selectionBounds: GridRange, direction?: Direction) => CellInterface | null;
126
+ /**
127
+ * Check if 2 areas overlap
128
+ * @param area1
129
+ * @param area2
130
+ */
131
+ export declare const areaIntersects: (area1: GridRange, area2: GridRange | undefined) => boolean;
132
+ /**
133
+ * Check if area is inside another area
134
+ * @param needle
135
+ * @param haystack
136
+ */
137
+ export declare const areaInsideArea: (needle: GridRange, haystack: GridRange) => boolean;
138
+ /**
139
+ * Check if two areas are equal
140
+ * @param area1
141
+ * @param area2
142
+ */
143
+ export declare const isAreasEqual: (area1: GridRange | undefined, area2: GridRange | undefined) => boolean;
144
+ /**
145
+ * Get maximum bound of an area, caters to merged cells
146
+ * @param area
147
+ * @param boundGetter
148
+ */
149
+ export declare const extendAreaToMergedCells: (_area: GridRange, mergedCells: GridRange[]) => GridRange;
150
+ /**
151
+ * Convert 2 cells to bounds
152
+ * @param start
153
+ * @param end
154
+ * @returns
155
+ *
156
+ * 2 loops O(n)
157
+ */
158
+ export declare const cellRangeToBounds: (start: CellInterface, end: CellInterface, spanMerges: boolean | undefined, getCellBounds: (cell: CellInterface) => GridRange, selectionLeftbound?: number, selectionTopBound?: number) => {
159
+ startRowIndex: number;
160
+ startColumnIndex: number;
161
+ endColumnIndex: number;
162
+ endRowIndex: number;
163
+ };
164
+ /**
165
+ * Create a range out of a cell
166
+ * @param param0
167
+ * @returns
168
+ */
169
+ export declare const cellToArea: ({ rowIndex, columnIndex, }: CellInterface) => GridRange;
170
+ /**
171
+ * Check if its being rendered in Browser or SSR
172
+ */
173
+ export declare const canUseDOM: boolean;
174
+ /**
175
+ * Make a font-family value safe for CSS font shorthand (canvas
176
+ * `ctx.font`). Family names that aren't a single safe identifier
177
+ * (leading digit, spaces with odd characters, slashes, …) must be
178
+ * quoted or the shorthand is invalid; generic families (sans-serif,
179
+ * serif, monospace, …) must stay unquoted to keep their generic
180
+ * meaning. Accepts a single family or a comma-separated stack.
181
+ */
182
+ export declare const toCssFontFamily: (family: string) => string;
183
+ /**
184
+ * Simple Canvas element to measure text size
185
+ *
186
+ * Usage
187
+ *
188
+ * ```
189
+ * const textSizer = new AutoSizer()
190
+ * textSizer.measureText('Hello world').width
191
+ * ```
192
+ */
193
+ interface AutoSizerProps {
194
+ fontFamily?: string;
195
+ fontSize?: number;
196
+ fontWeight?: string;
197
+ fontStyle?: string;
198
+ lineHeight?: number;
199
+ scale?: number;
200
+ }
201
+ type IOptions = {
202
+ [key: string]: any;
203
+ };
204
+ export declare const AutoSizerCanvas: (defaults?: AutoSizerProps) => {
205
+ context: CanvasRenderingContext2D | null;
206
+ measureText: (text: string, shouldWrap?: boolean, boundedWidth?: number) => {
207
+ width: number;
208
+ height: number;
209
+ };
210
+ setFont: (options?: IOptions) => void;
211
+ reset: () => void;
212
+ };
213
+ export declare const autoSizerCanvas: {
214
+ context: CanvasRenderingContext2D | null;
215
+ measureText: (text: string, shouldWrap?: boolean, boundedWidth?: number) => {
216
+ width: number;
217
+ height: number;
218
+ };
219
+ setFont: (options?: IOptions) => void;
220
+ reset: () => void;
221
+ };
222
+ export declare const isNull: (value: any) => value is undefined | null | "";
223
+ export declare const isEqualCells: (a: CellInterface | null | undefined, b: CellInterface | null | undefined) => boolean;
224
+ /**
225
+ * Simple utility function to check if cell is within bounds
226
+ * @param cell
227
+ * @param bounds
228
+ */
229
+ export declare const isCellWithinBounds: (cell: CellInterface, bounds?: GridRange) => boolean;
230
+ /**
231
+ * Find next row Index
232
+ * @param rowIndex
233
+ * @param direction
234
+ */
235
+ export type HiddenType = (i: number) => boolean;
236
+ export declare const clampIndex: (index: number, isHidden: HiddenType | undefined, direction: Direction) => number;
237
+ type ValueGetter = (sheetId: number, rowIndex: number, columnIndex: number) => string | number | undefined | null;
238
+ /**
239
+ * Find a cell with content if the current cell is out of the current dataregion
240
+ * [
241
+ * 1, 2, 3,
242
+ * x, x, x
243
+ * 7, 8, 9
244
+ * ]
245
+ * activeCel = 2
246
+ * direction = Down
247
+ * New Cell = 8
248
+ *
249
+ * @param activeCell
250
+ * @param getValue
251
+ * @param isHidden
252
+ * @param direction
253
+ * @param limit
254
+ */
255
+ export declare const findNextContentfulCell: (sheetId: number, activeCell: CellInterface, getValue: ValueGetter, isHidden: HiddenType | undefined, direction: Direction, limit: number) => CellInterface;
256
+ /**
257
+ * Find the next cell
258
+ * @param activeCell
259
+ * @param getValue
260
+ * @param isHidden
261
+ * @param direction
262
+ * @param limit
263
+ */
264
+ export declare const findLastContentfulCell: (sheetId: number, activeCell: CellInterface, getValue: ValueGetter, isHidden: HiddenType | undefined, direction: Direction, limit: number) => CellInterface;
265
+ /**
266
+ * Ex
267
+ */
268
+ export declare const findNextCellInDataRegion: (sheetId: number, activeCell: CellInterface, getValue: ValueGetter, isHidden: HiddenType | undefined, direction: Direction, limit: number) => number;
269
+ /**
270
+ * Converts a value to string
271
+ * @param value
272
+ */
273
+ export declare const castToString: (value: any) => string | undefined;
274
+ export declare const isArrowKey: (key: string) => boolean;
275
+ export declare const getScrollIncrement: (delta: number, minDim?: number) => number;
276
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
277
+ export declare const useCallbackRef: <T extends (...args: any[]) => any>(callback: T | undefined) => T;
278
+ export declare const getDevicePixelRatio: () => number;
279
+ export declare const getPreviousCellInDirection: (cell: CellInterface, direction?: Direction | undefined) => CellInterface | undefined;
280
+ export {};
281
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,eAAe,EAAmB,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,aAAa,EACd,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,SAAS,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExD,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE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