@rowsncolumns/spreadsheet 10.6.4 → 10.6.5

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 (29) hide show
  1. package/dist/cjs/components/cell/alignment.d.ts +25 -0
  2. package/dist/cjs/components/cell/alignment.d.ts.map +1 -1
  3. package/dist/cjs/components/cell/alignment.js +39 -1
  4. package/dist/cjs/components/cell/cell-background.d.ts +16 -0
  5. package/dist/cjs/components/cell/cell-background.d.ts.map +1 -1
  6. package/dist/cjs/components/cell/cell-background.js +141 -54
  7. package/dist/cjs/components/cell/cell-text-runs.d.ts +12 -5
  8. package/dist/cjs/components/cell/cell-text-runs.d.ts.map +1 -1
  9. package/dist/cjs/components/cell/cell-text-runs.js +18 -20
  10. package/dist/cjs/components/cell/index.d.ts.map +1 -1
  11. package/dist/cjs/components/cell/index.js +20 -14
  12. package/dist/cjs/helpers.d.ts +5 -0
  13. package/dist/cjs/helpers.d.ts.map +1 -1
  14. package/dist/cjs/helpers.js +8 -4
  15. package/dist/esm/components/cell/alignment.d.ts +25 -0
  16. package/dist/esm/components/cell/alignment.d.ts.map +1 -1
  17. package/dist/esm/components/cell/alignment.js +33 -0
  18. package/dist/esm/components/cell/cell-background.d.ts +16 -0
  19. package/dist/esm/components/cell/cell-background.d.ts.map +1 -1
  20. package/dist/esm/components/cell/cell-background.js +106 -36
  21. package/dist/esm/components/cell/cell-text-runs.d.ts +12 -5
  22. package/dist/esm/components/cell/cell-text-runs.d.ts.map +1 -1
  23. package/dist/esm/components/cell/cell-text-runs.js +17 -22
  24. package/dist/esm/components/cell/index.d.ts.map +1 -1
  25. package/dist/esm/components/cell/index.js +17 -11
  26. package/dist/esm/helpers.d.ts +5 -0
  27. package/dist/esm/helpers.d.ts.map +1 -1
  28. package/dist/esm/helpers.js +8 -4
  29. package/package.json +2 -2
@@ -14,7 +14,7 @@ import { CellError, ERROR_TAG_WIDTH } from "../cell-error";
14
14
  import { CellExpand } from "../cell-expand";
15
15
  import { CellFilter } from "../cell-filter";
16
16
  import { CellGroup } from "../cell-group";
17
- import { alignmentImpliesWrap, computeShrinkToFitFontSize, fillCellText, getKonvaRotationDegrees, getRotatedTextLayout, getUnderlineStrokes, getVerticalSpreadLineHeight, layoutDistributedLines, resolveCanvasTextAlign, resolveCanvasVerticalAlign, resolveReadingOrderAlignment, stackTextVertically, verticalAlignmentImpliesWrap, } from "./alignment";
17
+ import { alignmentImpliesWrap, computeShrinkToFitFontSize, fillCellText, getKonvaRotationDegrees, getRotatedTextLayout, getScriptTextOffsetY, getUnderlineStrokes, getVerticalSpreadLineHeight, layoutDistributedLines, resolveCanvasTextAlign, resolveCanvasVerticalAlign, resolveReadingOrderAlignment, stackTextVertically, verticalAlignmentImpliesWrap, } from "./alignment";
18
18
  import { CellTextRuns } from "./cell-text-runs";
19
19
  import { getLeftSpacing, getRightSpacing } from "./helpers";
20
20
  import { getLineMetrics } from "./line-height";
@@ -72,11 +72,9 @@ export const Cell = memo((props) => {
72
72
  const fontSize = baselineOffset
73
73
  ? baseFontSize * BASELINE_OFFSET_FONT_SCALE
74
74
  : baseFontSize;
75
- const effectiveVerticalAlignment = baselineOffset === "superscript"
76
- ? "top"
77
- : baselineOffset === "subscript"
78
- ? "bottom"
79
- : verticalAlignment;
75
+ // Superscript / subscript keep the cell's alignment and move the
76
+ // baseline instead (`scriptOffsetY` below), as Excel does.
77
+ const effectiveVerticalAlignment = verticalAlignment;
80
78
  const textStyle = `${bold ? "bold" : "normal"} ${italic ? "italic" : "normal"}`;
81
79
  const showText = !isNil(structuredValue) ? false : !isNil(value);
82
80
  // Overflow line
@@ -301,11 +299,19 @@ export const Cell = memo((props) => {
301
299
  // own styling instead of being flattened; plain no-run cells with
302
300
  // a cell-level baselineOffset keep the single-style approximation
303
301
  // below (scaled font + top/bottom alignment).
302
+ // Shrink-to-fit and rotated cells keep their runs: the run painter takes
303
+ // the shrink factor and the rotated layout (stacked text stays plain).
304
304
  const useRichTextRunPath = !showChip &&
305
- !shrinkEnabled &&
306
305
  !isStackedVertical &&
307
- !hasNumericRotation &&
308
306
  hasRenderableRuns(textFormatRuns ?? undefined);
307
+ const shrinkFactor = fontSize > 0 ? effectiveFontSize / fontSize : 1;
308
+ const scriptOffsetY = getScriptTextOffsetY({
309
+ baselineOffset,
310
+ verticalAlign: effectiveVerticalAlignment,
311
+ baseFontSize: baseFontSize * shrinkFactor,
312
+ scriptFontSize: effectiveFontSize,
313
+ lineHeight: textLineHeight,
314
+ });
309
315
  // Double / accounting underlines on a single unrotated line (the default
310
316
  // Text path); wrapped, rotated or rich-text cells keep Konva's single line.
311
317
  const paintStyledUnderline = hasStyledUnderline &&
@@ -549,14 +555,14 @@ export const Cell = memo((props) => {
549
555
  // lines, and `textFormatRuns` indices reference the raw
550
556
  // string. `normalizeDisplayText` is bypassed because the
551
557
  // renderer handles multi-line layout itself.
552
- React.createElement(CellTextRuns, { x: textLeftPadding, y: textNode.y, width: finalTextWidth, height: textNode.height, padding: padding, value: displayValue ?? "", runs: textFormatRuns ?? [], baseColor: color ?? defaultColor, baseFontFamily: fontFamily,
558
+ React.createElement(CellTextRuns, { x: rotatedLayout?.x ?? textLeftPadding, y: rotatedLayout?.y ?? textNode.y, width: rotatedLayout?.width ?? finalTextWidth, height: rotatedLayout ? approxTextHeight : textNode.height, rotation: rotatedLayout ? rotationDegrees : undefined, fontScale: scale * shrinkFactor, padding: padding, value: displayValue ?? "", runs: textFormatRuns ?? [], baseColor: color ?? defaultColor, baseFontFamily: fontFamily,
553
559
  // UN-scaled size on purpose: when the cell carries a
554
560
  // baselineOffset the segment resolver applies the
555
561
  // sup/sub font scale itself (exactly once). Shrink-to-
556
562
  // fit never reaches this path, so `baseFontSize` equals
557
563
  // `effectiveFontSize` for every other cell.
558
- baseFontSize: baseFontSize, baseBold: !!bold, baseItalic: !!italic, baseUnderline: !!underline, baseStrikethrough: !!strikethrough, baseBaselineOffset: baselineOffset ?? undefined, horizontalAlign: canvasTextAlign, verticalAlign: effectiveVerticalAlignment, lineHeight: lineHeight, lineHeightMode: lineHeightMode, scale: scale, wrap: shouldWrap, theme: theme })) : paintDistributed ? (React.createElement(Shape, { x: textLeftPadding, y: textNode.y, width: finalTextWidth, height: textNode.height, sceneFunc: distributedSceneFunc, listening: false, perfectDrawEnabled: false })) : paintNumberFormatLayout ? (React.createElement(Shape, { x: textLeftPadding, y: textNode.y, width: finalTextWidth, height: textNode.height, sceneFunc: numberFormatSceneFunc, listening: false, perfectDrawEnabled: false })) : (React.createElement(React.Fragment, null,
559
- React.createElement(Text, { x: rotatedLayout?.x ?? textLeftPadding, y: rotatedLayout?.y ?? textNode.y, offsetX: rotatedLayout?.offsetX, offsetY: rotatedLayout?.offsetY, height: rotatedLayout ? approxTextHeight : textNode.height, width: rotatedLayout?.width ?? finalTextWidth, text: displayValue, fill: color ?? defaultColor, verticalAlign: rotatedLayout ? "top" : effectiveVerticalAlignment, align: rotatedLayout ? "left" : canvasTextAlign, fontFamily: fontFamily, fontStyle: textStyle, fontSize: effectiveFontSize, textDecoration: paintStyledUnderline ? textDecorationFor(false) : textDecoration, padding: padding, wrap: textWrapStrategy, lineHeight: textLineHeight, rotation: rotationDegrees, direction: textDirection, hitStrokeWidth: 0, perfectDrawEnabled: false }),
564
+ baseFontSize: baseFontSize * shrinkFactor, baseBold: !!bold, baseItalic: !!italic, baseUnderline: !!underline, baseStrikethrough: !!strikethrough, baseBaselineOffset: baselineOffset ?? undefined, horizontalAlign: rotatedLayout ? "left" : canvasTextAlign, verticalAlign: rotatedLayout ? "top" : effectiveVerticalAlignment, lineHeight: lineHeight, lineHeightMode: lineHeightMode, scale: scale, wrap: shouldWrap && !rotatedLayout, theme: theme })) : paintDistributed ? (React.createElement(Shape, { x: textLeftPadding, y: textNode.y, width: finalTextWidth, height: textNode.height, sceneFunc: distributedSceneFunc, listening: false, perfectDrawEnabled: false })) : paintNumberFormatLayout ? (React.createElement(Shape, { x: textLeftPadding, y: textNode.y, width: finalTextWidth, height: textNode.height, sceneFunc: numberFormatSceneFunc, listening: false, perfectDrawEnabled: false })) : (React.createElement(React.Fragment, null,
565
+ React.createElement(Text, { x: rotatedLayout?.x ?? textLeftPadding, y: rotatedLayout?.y ?? textNode.y, offsetX: rotatedLayout?.offsetX, offsetY: (rotatedLayout?.offsetY ?? 0) + scriptOffsetY, height: rotatedLayout ? approxTextHeight : textNode.height, width: rotatedLayout?.width ?? finalTextWidth, text: displayValue, fill: color ?? defaultColor, verticalAlign: rotatedLayout ? "top" : effectiveVerticalAlignment, align: rotatedLayout ? "left" : canvasTextAlign, fontFamily: fontFamily, fontStyle: textStyle, fontSize: effectiveFontSize, textDecoration: paintStyledUnderline ? textDecorationFor(false) : textDecoration, padding: padding, wrap: textWrapStrategy, lineHeight: textLineHeight, rotation: rotationDegrees, direction: textDirection, hitStrokeWidth: 0, perfectDrawEnabled: false }),
560
566
  paintStyledUnderline ? (React.createElement(Shape, { sceneFunc: underlineSceneFunc, listening: false, perfectDrawEnabled: false })) : null)))) : imageUrl ? (React.createElement(Image, { x: x, y: y, spacing: 1, width: width, height: height, url: imageUrl, perfectDrawEnabled: false, horizontalAlignment: canvasTextAlign === "justify" ? "left" : canvasTextAlign, verticalAlignment: verticalAlignment })) : null,
561
567
  showFilter ? (React.createElement(CellFilter, { scale: scale, isActive: isFilterActive, onClick: readonly ? undefined : onFilterClick, rowIndex: props.rowIndex, columnIndex: props.columnIndex, x: x, y: y, height: height, width: width, filterIconColor: filterIconColor, verticalAlignment: verticalAlignment, backgroundColor: defaultBackgroundColor, sortOrder: sortOrder })) : showArrow && !readonly ? (React.createElement(CellArrow, { scale: scale, onClick: onArrowClick ?? onRequestEdit, rowIndex: rowIndex, columnIndex: columnIndex, x: arrowOutside ? x + (ARROW_DOWN_WIDTH + 4) * scale : x, y: y, height: height, width: width, verticalAlignment: verticalAlignment })) : null,
562
568
  expandable ? (React.createElement(CellGroup, { scale: scale, onClick: (cell) => {
@@ -3,6 +3,11 @@ import type { CellTooltipVariants } from "@rowsncolumns/ui";
3
3
  import type { AXIS, Border, CellData, Color, ConditionType, ConditionValue, FilterSpec, FilterView, HorizontalAlign, Sheet, SheetCoordinate, SheetRange, SortOrder, StructuredValue, StyleReference, TableTheme, TableView, VerticalAlign } from "./types";
4
4
  export declare const isFirefox: boolean;
5
5
  export declare const isMac: boolean;
6
+ /**
7
+ * Converts a font size in points to CSS pixels: 96 px per inch over 72 pt
8
+ * per inch, unrounded, so 11 pt is 14.67 px as Excel paints it at 100 %
9
+ * (a rounded `1.3 × pt` made 11 pt 14 px and 24 pt 31 px).
10
+ */
6
11
  export declare const pointToPixel: (pt: number) => number;
7
12
  export declare const pixelToPoint: (px: number) => number;
8
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAS5D,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EAEN,QAAQ,EACR,KAAK,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,EACf,KAAK,EACL,eAAe,EACf,UAAU,EACV,SAAS,EAET,eAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,SAAS,SAEb,CAAC;AAGV,eAAO,MAAM,KAAK,SAAkB,CAAC;AAGrC,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,WAA+B,CAAC;AAGvE,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,WAA+B,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,GAAG,SAAS,EACxB,YAAY,OAAO,KAClB,MAAM,GAAG,SAKX,CAAC;AAsBF;;;GAGG;AACH,eAAO,MAAM,6BAA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,aAAa,GAAG,SAAS,GAAG,IAAI,EAC5C,aAAa,aAAa,GAAG,SAAS,GAAG,IAAI,+BAM9C,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC"}
@@ -8,10 +8,14 @@ export const isFirefox = canUseDOM
8
8
  : false;
9
9
  // Check if platform is macOS, where Ctrl+click is the context menu gesture
10
10
  export const isMac = isMacPlatform();
11
- /* Converts point to pixel */
12
- export const pointToPixel = (pt) => Math.round((13 / 10) * pt);
13
- /* Convert pixel to point */
14
- export const pixelToPoint = (px) => Math.round((px / 13) * 10);
11
+ /**
12
+ * Converts a font size in points to CSS pixels: 96 px per inch over 72 pt
13
+ * per inch, unrounded, so 11 pt is 14.67 px as Excel paints it at 100 %
14
+ * (a rounded `1.3 × pt` made 11 pt 14 px and 24 pt 31 px).
15
+ */
16
+ export const pointToPixel = (pt) => (pt * 96) / 72;
17
+ /* Convert pixel to (whole) points */
18
+ export const pixelToPoint = (px) => Math.round((px * 72) / 96);
15
19
  /**
16
20
  * Normalize text for display by replacing newlines with spaces.
17
21
  * Excel displays newlines as spaces unless wrapText is enabled in the cell style.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/spreadsheet",
3
- "version": "10.6.4",
3
+ "version": "10.6.5",
4
4
  "author": "Vinay M",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "./dist/cjs/index.js",
@@ -48,7 +48,7 @@
48
48
  "@rowsncolumns/grid": ">=13.3.1",
49
49
  "@rowsncolumns/icons": ">=7.2.33",
50
50
  "@rowsncolumns/ui": ">=16.1.1",
51
- "@rowsncolumns/utils": ">=9.6.1",
51
+ "@rowsncolumns/utils": ">=9.6.2",
52
52
  "@rowsncolumns/version-comparison": ">=9.0.1",
53
53
  "@tanstack/react-virtual": "3.13.9",
54
54
  "jotai": "^2.12.4",