caplink-saas-ui-shared-component-library 1.76.0 → 1.77.0

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 (37) hide show
  1. package/dist/features/spreadsheet/core/clipboard/clipboard-manager.d.ts +38 -0
  2. package/dist/features/spreadsheet/core/clipboard/index.d.ts +52 -0
  3. package/dist/features/spreadsheet/core/clipboard/operations/copy-range.d.ts +6 -0
  4. package/dist/features/spreadsheet/core/clipboard/operations/copy-single-cell.d.ts +6 -0
  5. package/dist/features/spreadsheet/core/clipboard/operations/paste-orchestrator.d.ts +10 -0
  6. package/dist/features/spreadsheet/core/clipboard/operations/paste-single-value.d.ts +6 -0
  7. package/dist/features/spreadsheet/core/clipboard/operations/paste-with-cyclic-repeat.d.ts +9 -0
  8. package/dist/features/spreadsheet/core/clipboard/operations/paste-with-overlay.d.ts +6 -0
  9. package/dist/features/spreadsheet/core/clipboard/services/clipboard-data-extractor.d.ts +30 -0
  10. package/dist/features/spreadsheet/core/clipboard/services/paste-strategy-selector.d.ts +9 -0
  11. package/dist/features/spreadsheet/core/clipboard/types/index.d.ts +94 -0
  12. package/dist/features/spreadsheet/core/formatters/date-formatter.d.ts +57 -0
  13. package/dist/features/spreadsheet/core/formatters/index.d.ts +6 -0
  14. package/dist/features/spreadsheet/core/index.d.ts +26 -0
  15. package/dist/features/spreadsheet/core/normalize-value-cache.d.ts +34 -0
  16. package/dist/features/spreadsheet/core/normalize-value.d.ts +24 -0
  17. package/dist/features/spreadsheet/core/normalizers/boolean-normalizer.d.ts +17 -0
  18. package/dist/features/spreadsheet/core/normalizers/date-normalizer.d.ts +18 -0
  19. package/dist/features/spreadsheet/core/normalizers/index.d.ts +8 -0
  20. package/dist/features/spreadsheet/core/normalizers/numeric-formatter.d.ts +18 -0
  21. package/dist/features/spreadsheet/core/normalizers/numeric-normalizer.d.ts +43 -0
  22. package/dist/features/spreadsheet/core/normalizers/string-normalizer.d.ts +15 -0
  23. package/dist/features/spreadsheet/core/validators/index.d.ts +5 -0
  24. package/dist/features/spreadsheet/core/validators/mask-validator.d.ts +19 -0
  25. package/dist/features/spreadsheet/model/context.d.ts +1 -1
  26. package/dist/features/spreadsheet/model/spreadsheet.d.ts +3 -3
  27. package/dist/features/spreadsheet/ui/spreadsheet.d.ts +8 -1
  28. package/dist/index.es.js +16243 -15923
  29. package/dist/index.es.js.map +1 -1
  30. package/dist/index.umd.js +74 -74
  31. package/dist/index.umd.js.map +1 -1
  32. package/dist/package.json +1 -1
  33. package/dist/shared/lib/get-clipboard-text.d.ts +15 -0
  34. package/dist/shared/lib/index.d.ts +1 -0
  35. package/dist/svg/empty-page-icon/empty-page-icon.d.ts +1 -1
  36. package/package.json +1 -1
  37. package/dist/features/spreadsheet/lib/normalize-value.d.ts +0 -5
@@ -0,0 +1,38 @@
1
+ import { ClipboardEventType, CopyOperationResult, PasteOperationResult } from './types';
2
+ import type * as Matrix from '../../model/matrix';
3
+ import type * as Spreadsheet from '../../model/spreadsheet';
4
+ /**
5
+ * Executes a paste operation
6
+ * @param event - The clipboard event from browser/React
7
+ * @param params - Parameters for the paste operation
8
+ * @returns Result with updated matrix and history entries
9
+ */
10
+ export declare function paste(event: ClipboardEventType, params: {
11
+ targetPoint: Matrix.Point;
12
+ currentMatrix: Matrix.Matrix<unknown>;
13
+ columns: Spreadsheet.Column[];
14
+ selectedRanges: Matrix.PointRange[];
15
+ isStaticRows: boolean;
16
+ maxColumns: number;
17
+ enableCyclicRepeat?: boolean;
18
+ }): PasteOperationResult;
19
+ /**
20
+ * Copies a single cell to clipboard
21
+ * @param point - The cell position to copy
22
+ * @param currentMatrix - Current matrix state
23
+ * @returns Result with clipboard text and success status
24
+ */
25
+ export declare function copySingleCellToClipboard(point: Matrix.Point, currentMatrix: Matrix.Matrix<unknown>): CopyOperationResult;
26
+ /**
27
+ * Copies multiple ranges to clipboard
28
+ * @param ranges - The ranges to copy
29
+ * @param currentMatrix - Current matrix state
30
+ * @returns Result with clipboard text and success status
31
+ */
32
+ export declare function copyRangesToClipboard(ranges: Matrix.PointRange[], currentMatrix: Matrix.Matrix<unknown>): CopyOperationResult;
33
+ /**
34
+ * Writes text to system clipboard
35
+ * @param text - The text to write
36
+ * @returns Promise that resolves when write is complete
37
+ */
38
+ export declare function writeToClipboard(text: string): Promise<void>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Clipboard Module - Core functionality for copy/paste operations
3
+ *
4
+ * This module provides a clean, well-structured API for handling clipboard
5
+ * operations in the spreadsheet. It follows Domain-Driven Design principles
6
+ * with clear separation of concerns.
7
+ *
8
+ * Architecture:
9
+ * - types/: TypeScript interfaces and types
10
+ * - services/: Business logic services (data extraction, strategy selection)
11
+ * - operations/: Specific paste/copy implementations
12
+ *
13
+ * Usage Example:
14
+ * ```ts
15
+ * import {
16
+ * paste,
17
+ * copySingleCellToClipboard,
18
+ * copyRangesToClipboard,
19
+ * writeToClipboard,
20
+ * } from '@/features/spreadsheet/core/clipboard';
21
+ *
22
+ * // Paste operation
23
+ * const result = paste(event, {
24
+ * targetPoint: { row: 0, column: 0 },
25
+ * currentMatrix: matrix,
26
+ * columns: columns,
27
+ * selectedRanges: ranges,
28
+ * isStaticRows: false,
29
+ * maxColumns: 10,
30
+ * enableCyclicRepeat: false, // Optional: Excel behavior
31
+ * });
32
+ *
33
+ * // Copy operations
34
+ * const copyResult = copyRangesToClipboard(ranges, matrix);
35
+ * await writeToClipboard(copyResult.clipboardText);
36
+ *
37
+ * // Single cell copy
38
+ * const singleResult = copySingleCellToClipboard(point, matrix);
39
+ * await writeToClipboard(singleResult.clipboardText);
40
+ * ```
41
+ */
42
+ export { paste, copySingleCellToClipboard, copyRangesToClipboard, writeToClipboard, } from './clipboard-manager';
43
+ export type { ClipboardEventType, PasteOperationConfig, PasteOperationResult, CopyOperationConfig, CopyOperationResult, HistoryEntry, ParsedClipboardData, PasteValidationResult, } from './types';
44
+ export { PasteStrategy } from './types';
45
+ export { extractAndParseClipboardData, formatMatrixForClipboard, isSingleCell, getClipboardDataDimensions, } from './services/clipboard-data-extractor';
46
+ export { selectPasteStrategy } from './services/paste-strategy-selector';
47
+ export { executePasteOperation } from './operations/paste-orchestrator';
48
+ export { pasteSingleValueToSelection } from './operations/paste-single-value';
49
+ export { pasteWithCyclicRepeat } from './operations/paste-with-cyclic-repeat';
50
+ export { pasteWithOverlay } from './operations/paste-with-overlay';
51
+ export { copySingleCell } from './operations/copy-single-cell';
52
+ export { copyRange } from './operations/copy-range';
@@ -0,0 +1,6 @@
1
+ import { CopyOperationConfig, CopyOperationResult } from '../types';
2
+ /**
3
+ * Handles copying multiple cell ranges to clipboard
4
+ * Formats data as tab-separated values (TSV) compatible with Excel/Sheets
5
+ */
6
+ export declare function copyRange(config: CopyOperationConfig): CopyOperationResult;
@@ -0,0 +1,6 @@
1
+ import { CopyOperationResult } from '../types';
2
+ import type * as Matrix from '../../../model/matrix';
3
+ /**
4
+ * Handles copying a single cell value to clipboard
5
+ */
6
+ export declare function copySingleCell(point: Matrix.Point, currentMatrix: Matrix.Matrix<unknown>): CopyOperationResult;
@@ -0,0 +1,10 @@
1
+ import { ClipboardEventType, PasteOperationConfig, PasteOperationResult } from '../types';
2
+ /**
3
+ * Orchestrates the entire paste operation
4
+ * Determines strategy and delegates to appropriate handler
5
+ *
6
+ * @param event - The clipboard event
7
+ * @param config - Configuration for the paste operation
8
+ * @returns Result containing updated matrix and history entries
9
+ */
10
+ export declare function executePasteOperation(event: ClipboardEventType, config: Omit<PasteOperationConfig, 'parsedData'>): PasteOperationResult;
@@ -0,0 +1,6 @@
1
+ import { PasteOperationConfig, PasteOperationResult } from '../types';
2
+ /**
3
+ * Handles pasting a single value to multiple selected cells
4
+ * This is used when user pastes one cell value into a larger selection
5
+ */
6
+ export declare function pasteSingleValueToSelection(config: PasteOperationConfig): PasteOperationResult;
@@ -0,0 +1,9 @@
1
+ import { PasteOperationConfig, PasteOperationResult } from '../types';
2
+ /**
3
+ * Handles pasting data with cyclic repetition to fill a larger selection
4
+ * Example: Pasting [A, B] into 5 cells results in [A, B, A, B, A]
5
+ *
6
+ * @param config - Paste operation configuration
7
+ * @param enableCyclicRepeat - If false, only paste data once (Excel behavior)
8
+ */
9
+ export declare function pasteWithCyclicRepeat(config: PasteOperationConfig, enableCyclicRepeat?: boolean): PasteOperationResult;
@@ -0,0 +1,6 @@
1
+ import { PasteOperationConfig, PasteOperationResult } from '../types';
2
+ /**
3
+ * Handles pasting data by overlaying it on the matrix
4
+ * This may expand the matrix if needed (unless staticRows is true)
5
+ */
6
+ export declare function pasteWithOverlay(config: PasteOperationConfig): PasteOperationResult;
@@ -0,0 +1,30 @@
1
+ import { ClipboardEventType, ParsedClipboardData } from '../types';
2
+ import * as Matrix from '../../../model/matrix';
3
+ /**
4
+ * Extracts text from clipboard event and parses it into matrix format
5
+ * @param event - The clipboard event (from browser or React)
6
+ * @returns Parsed data as a matrix of unknown values
7
+ */
8
+ export declare function extractAndParseClipboardData(event: ClipboardEventType): ParsedClipboardData;
9
+ /**
10
+ * Formats matrix data into clipboard-compatible string
11
+ * Columns are separated by tabs (\t), rows by newlines (\n)
12
+ * @param data - Matrix data to format
13
+ * @returns Formatted string ready for clipboard
14
+ */
15
+ export declare function formatMatrixForClipboard(data: Matrix.Matrix<unknown>): string;
16
+ /**
17
+ * Checks if parsed data represents a single cell
18
+ * @param data - Parsed clipboard data
19
+ * @returns True if data is a single cell (1x1 matrix)
20
+ */
21
+ export declare function isSingleCell(data: ParsedClipboardData): boolean;
22
+ /**
23
+ * Gets the dimensions of parsed clipboard data
24
+ * @param data - Parsed clipboard data
25
+ * @returns Object with rows and columns count
26
+ */
27
+ export declare function getClipboardDataDimensions(data: ParsedClipboardData): {
28
+ rows: number;
29
+ columns: number;
30
+ };
@@ -0,0 +1,9 @@
1
+ import { ParsedClipboardData, PasteStrategy } from '../types';
2
+ import type * as Matrix from '../../../model/matrix';
3
+ /**
4
+ * Selects the appropriate paste strategy
5
+ * @param parsedData - The clipboard data to paste
6
+ * @param selectedRanges - Currently selected cell ranges
7
+ * @returns The strategy to use for pasting
8
+ */
9
+ export declare function selectPasteStrategy(parsedData: ParsedClipboardData, selectedRanges: Matrix.PointRange[]): PasteStrategy;
@@ -0,0 +1,94 @@
1
+ import { ClipboardEvent } from 'react';
2
+ import type * as Matrix from '../../../model/matrix';
3
+ import type * as Spreadsheet from '../../../model/spreadsheet';
4
+ /**
5
+ * Represents the result of parsing clipboard data into a matrix format
6
+ */
7
+ export type ParsedClipboardData = Matrix.Matrix<unknown>;
8
+ /**
9
+ * Unified type for clipboard events from both browser and React
10
+ */
11
+ export type ClipboardEventType = ClipboardEvent | globalThis.ClipboardEvent;
12
+ /**
13
+ * Configuration for paste operations
14
+ */
15
+ export interface PasteOperationConfig {
16
+ /** The target point where paste operation starts */
17
+ targetPoint: Matrix.Point;
18
+ /** The data to be pasted (already parsed into matrix format) */
19
+ parsedData: ParsedClipboardData;
20
+ /** Current matrix state */
21
+ currentMatrix: Matrix.Matrix<unknown>;
22
+ /** Column definitions with metadata */
23
+ columns: Spreadsheet.Column[];
24
+ /** Currently selected ranges */
25
+ selectedRanges: Matrix.PointRange[];
26
+ /** Whether the spreadsheet has static rows (no expansion allowed) */
27
+ isStaticRows: boolean;
28
+ /** Maximum number of columns allowed */
29
+ maxColumns: number;
30
+ /** Enable cyclic repetition when pasting (default: true) */
31
+ enableCyclicRepeat?: boolean;
32
+ }
33
+ /**
34
+ * Result of a paste operation
35
+ */
36
+ export interface PasteOperationResult {
37
+ /** The updated matrix after paste */
38
+ updatedMatrix: Matrix.Matrix<unknown>;
39
+ /** History entries to track changes for undo */
40
+ historyEntries: HistoryEntry[];
41
+ }
42
+ /**
43
+ * Represents a single change in the spreadsheet for undo/redo
44
+ */
45
+ export interface HistoryEntry {
46
+ /** The cell position that changed */
47
+ point: Matrix.Point;
48
+ /** The value before the change */
49
+ oldValue: unknown;
50
+ /** The value after the change */
51
+ newValue: unknown;
52
+ /** Unique identifier to group related changes (e.g., all cells from one paste) */
53
+ pastedId: string;
54
+ }
55
+ /**
56
+ * Determines which paste strategy to use
57
+ */
58
+ export declare enum PasteStrategy {
59
+ /** Single value pasted to multiple selected cells */
60
+ SINGLE_VALUE_TO_SELECTION = "SINGLE_VALUE_TO_SELECTION",
61
+ /** Data repeated cyclically to fill larger selection */
62
+ CYCLIC_REPEAT = "CYCLIC_REPEAT",
63
+ /** Data overlaid on matrix (may expand) */
64
+ OVERLAY = "OVERLAY"
65
+ }
66
+ /**
67
+ * Configuration for copy operations
68
+ */
69
+ export interface CopyOperationConfig {
70
+ /** The ranges to copy from */
71
+ sourceRanges: Matrix.PointRange[];
72
+ /** Current matrix state */
73
+ currentMatrix: Matrix.Matrix<unknown>;
74
+ }
75
+ /**
76
+ * Result of a copy operation
77
+ */
78
+ export interface CopyOperationResult {
79
+ /** The formatted string ready for clipboard */
80
+ clipboardText: string;
81
+ /** Whether the operation was successful */
82
+ success: boolean;
83
+ }
84
+ /**
85
+ * Validation result for paste operations
86
+ */
87
+ export interface PasteValidationResult {
88
+ /** Whether the paste operation is valid */
89
+ isValid: boolean;
90
+ /** Reason for validation failure (if any) */
91
+ reason?: string;
92
+ /** Which cells would be affected */
93
+ affectedCells?: Matrix.Point[];
94
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Date formatter module
3
+ * Converts various date formats to ISO date strings (YYYY-MM-DD)
4
+ * Handles DD/MM/YYYY, MM/DD/YYYY, ISO formats, and Excel serial numbers
5
+ *
6
+ * Supported formats:
7
+ * - DD/MM/YYYY or MM/DD/YYYY (based on locale)
8
+ * - DD.MM.YYYY (German, Russian, Polish, etc.)
9
+ * - DD/MM/YY or DD.MM.YY (two-digit years)
10
+ * - Excel serial numbers (both 1900 and 1904 date systems)
11
+ * - ISO format (YYYY-MM-DD)
12
+ *
13
+ * Excel Date Systems:
14
+ * - 1900 system (default, Windows): Serial 1 = 1900-01-01
15
+ * - 1904 system (Mac): Serial 0 = 1904-01-01
16
+ */
17
+ /**
18
+ * Excel date system type
19
+ * - '1900': Windows default (Serial 1 = 1900-01-01)
20
+ * - '1904': Mac OS (Serial 0 = 1904-01-01)
21
+ * - 'auto': Auto-detect based on serial value (default)
22
+ */
23
+ export type ExcelDateSystem = '1900' | '1904' | 'auto';
24
+ /**
25
+ * Options for formatDate function
26
+ */
27
+ export interface FormatDateOptions {
28
+ /**
29
+ * Excel date system to use for serial number conversion
30
+ * @default 'auto'
31
+ */
32
+ dateSystem?: ExcelDateSystem;
33
+ }
34
+ /**
35
+ * Formats a date value into ISO format (YYYY-MM-DD)
36
+ * Supports multiple input formats:
37
+ * - DD/MM/YYYY or MM/DD/YYYY (based on locale)
38
+ * - DD.MM.YYYY (German, Russian, Polish, etc.)
39
+ * - DD/MM/YY or DD.MM.YY (two-digit years)
40
+ * - Excel serial numbers (both 1900 and 1904 systems)
41
+ * - ISO format (YYYY-MM-DD)
42
+ *
43
+ * @param value - Date value as string
44
+ * @param options - Optional configuration
45
+ * @param options.dateSystem - Excel date system: '1900' (Windows), '1904' (Mac), or 'auto' (default)
46
+ * @returns ISO date string (YYYY-MM-DD) or null if invalid
47
+ *
48
+ * @example
49
+ * formatDate('15/03/2024') // '2024-03-15'
50
+ * formatDate('15.03.2024') // '2024-03-15' (German format)
51
+ * formatDate('15/03/24') // '2024-03-15' (two-digit year)
52
+ * formatDate('45365') // '2024-03-15' (Excel serial 1900)
53
+ * formatDate('0', { dateSystem: '1904' }) // '1904-01-01' (Excel serial 1904)
54
+ * formatDate('2024-03-15') // '2024-03-15'
55
+ * formatDate('99/99/9999') // null
56
+ */
57
+ export declare function formatDate(value: string, options?: FormatDateOptions): string | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Formatters module
3
+ * Exports all value formatters
4
+ */
5
+ export { formatDate } from './date-formatter';
6
+ export type { ExcelDateSystem, FormatDateOptions } from './date-formatter';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Core Module - Business logic and domain services
3
+ *
4
+ * This module contains the core business logic of the spreadsheet,
5
+ * separated from the presentation layer (UI components) and infrastructure
6
+ * (state management).
7
+ *
8
+ * Follows Clean Architecture principles:
9
+ * - Independent of frameworks
10
+ * - Testable
11
+ * - Independent of UI
12
+ * - Independent of Database/State management
13
+ *
14
+ * Structure:
15
+ * - clipboard/: Copy/paste operations
16
+ * - formatters/: Data formatting (dates, etc)
17
+ * - normalizers/: Value normalization by type
18
+ * - validators/: Input validation
19
+ * - normalize-value.ts: Main normalization orchestrator
20
+ */
21
+ export * from './clipboard';
22
+ export * from './formatters';
23
+ export * from './normalizers';
24
+ export * from './validators';
25
+ export { normalizeValue } from './normalize-value';
26
+ export { normalizationCache } from './normalize-value-cache';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Cache for normalized values to avoid redundant processing
3
+ * Used during paste operations where the same value is normalized multiple times
4
+ */
5
+ declare class NormalizationCache {
6
+ private cache;
7
+ private readonly maxSize;
8
+ private readonly ttl;
9
+ /**
10
+ * Generates a cache key from value and column type
11
+ */
12
+ private generateKey;
13
+ /**
14
+ * Gets a cached normalized value if available and not expired
15
+ */
16
+ get(value: unknown, columnType: string, settings?: unknown): unknown | undefined;
17
+ /**
18
+ * Stores a normalized value in cache
19
+ */
20
+ set(value: unknown, columnType: string, normalizedValue: unknown, settings?: unknown): void;
21
+ /**
22
+ * Clears the entire cache
23
+ */
24
+ clear(): void;
25
+ /**
26
+ * Gets cache statistics for monitoring
27
+ */
28
+ getStats(): {
29
+ size: number;
30
+ maxSize: number;
31
+ };
32
+ }
33
+ export declare const normalizationCache: NormalizationCache;
34
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Value normalization orchestrator
3
+ * Coordinates normalization based on column data type
4
+ */
5
+ import type * as Spreadsheet from '../model/spreadsheet';
6
+ /**
7
+ * Main normalization function
8
+ * Normalizes values based on column data type with optional caching
9
+ *
10
+ * @param params - Normalization parameters
11
+ * @param params.value - Value to normalize
12
+ * @param params.column - Column configuration with data type
13
+ * @param params.useCache - Whether to use normalization cache (default: true)
14
+ * @returns Normalized value appropriate for the column type
15
+ *
16
+ * @example
17
+ * normalizeValue({ value: '1.250,50', column: { dataEditorType: 'Numeric', ... } })
18
+ * normalizeValue({ value: '15/03/2024', column: { dataEditorType: 'Date', ... } })
19
+ */
20
+ export declare function normalizeValue(params: {
21
+ value: unknown;
22
+ column: Spreadsheet.Column;
23
+ useCache?: boolean;
24
+ }): unknown;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Boolean normalization module
3
+ * Converts various boolean representations to string 'true' or 'false'
4
+ */
5
+ /**
6
+ * Normalizes a value to boolean string representation
7
+ * Accepts: true, false, 'true', 'false'
8
+ * @param value - Value to normalize
9
+ * @returns 'true' or 'false'
10
+ *
11
+ * @example
12
+ * normalizeBoolean('true') // 'true'
13
+ * normalizeBoolean('false') // 'false'
14
+ * normalizeBoolean('yes') // 'false'
15
+ * normalizeBoolean(true) // 'true'
16
+ */
17
+ export declare function normalizeBoolean(value: unknown): 'true' | 'false';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Date normalization module
3
+ * Converts date strings to ISO format using the date formatter
4
+ */
5
+ /**
6
+ * Normalizes a date value to ISO format (YYYY-MM-DD)
7
+ * Returns empty string if date is invalid
8
+ * Logs a warning for invalid non-empty dates
9
+ *
10
+ * @param value - Date value as string
11
+ * @returns ISO date string or empty string
12
+ *
13
+ * @example
14
+ * normalizeDate('15/03/2024') // '2024-03-15'
15
+ * normalizeDate('99/99/9999') // '' (with console warning)
16
+ * normalizeDate('') // ''
17
+ */
18
+ export declare function normalizeDate(value: string): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Normalizers module
3
+ * Exports all value normalizers for different data types
4
+ */
5
+ export { normalizeString } from './string-normalizer';
6
+ export { normalizeBoolean } from './boolean-normalizer';
7
+ export { normalizeDate } from './date-normalizer';
8
+ export { normalizeNumeric, parseNumericString, clampNumber } from './numeric-normalizer';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Numeric formatting module
3
+ * Handles complex numeric string parsing with multiple separators
4
+ */
5
+ /**
6
+ * Formats a numeric string by handling various separator combinations
7
+ * Handles European (1.250,50), US (1,250.50), and malformed formats
8
+ *
9
+ * @param value - Raw numeric string with potential separators
10
+ * @returns Formatted string with dot as decimal separator
11
+ *
12
+ * @example
13
+ * formatNumericString('1,25') // '1.25'
14
+ * formatNumericString('1.250,50') // '1250.50'
15
+ * formatNumericString('1,250.50') // '1250.50'
16
+ * formatNumericString('1,,,,25') // '125'
17
+ */
18
+ export declare function formatNumericString(value: string): string;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Numeric normalization module
3
+ * Handles number parsing, separator removal, and range validation
4
+ */
5
+ /**
6
+ * Parses a numeric string by removing thousand separators and normalizing decimal point
7
+ * Handles both European (1.000,50) and US (1,000.50) formats
8
+ *
9
+ * @param value - Numeric string to parse
10
+ * @returns Parsed number or NaN if invalid
11
+ *
12
+ * @example
13
+ * parseNumericString('1.234,56') // 1234.56 (European)
14
+ * parseNumericString('1,234.56') // 1234.56 (US)
15
+ * parseNumericString('1.234.567') // 1234567 (thousands only)
16
+ */
17
+ export declare function parseNumericString(value: string): number;
18
+ /**
19
+ * Clamps a number within a specified range
20
+ * @param value - Number to clamp
21
+ * @param min - Minimum value (optional)
22
+ * @param max - Maximum value (optional)
23
+ * @returns Clamped number
24
+ *
25
+ * @example
26
+ * clampNumber(150, 0, 100) // 100
27
+ * clampNumber(-50, 0, 100) // 0
28
+ * clampNumber(50, 0, 100) // 50
29
+ */
30
+ export declare function clampNumber(value: number, min?: number, max?: number): number;
31
+ /**
32
+ * Normalizes a numeric value by parsing and applying range constraints
33
+ * @param value - Value to normalize
34
+ * @param min - Minimum allowed value
35
+ * @param max - Maximum allowed value
36
+ * @returns Normalized number or empty string if invalid
37
+ *
38
+ * @example
39
+ * normalizeNumeric('1.234,56', 0, 10000) // 1234.56
40
+ * normalizeNumeric('150', 0, 100) // 100
41
+ * normalizeNumeric('abc', 0, 100) // ''
42
+ */
43
+ export declare function normalizeNumeric(value: string, min?: number, max?: number): number | '';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * String normalization module
3
+ * Handles string value normalization including truncation and mask validation
4
+ */
5
+ /**
6
+ * Normalizes a string value by truncating it to the maximum allowed length
7
+ * @param value - The string to normalize
8
+ * @param maxLength - Maximum allowed length (defaults to COLUMN_STRING_LIMIT)
9
+ * @returns Normalized string
10
+ *
11
+ * @example
12
+ * normalizeString('Hello World', 1200) // 'Hello World'
13
+ * normalizeString('A'.repeat(1500), 1200) // Returns first 1200 characters
14
+ */
15
+ export declare function normalizeString(value: string, maxLength?: number): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Validators module
3
+ * Exports all value validators
4
+ */
5
+ export { validateMask } from './mask-validator';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Mask validation module
3
+ * Validates string values against digit-based mask patterns
4
+ */
5
+ /**
6
+ * Validates if a value matches a digit-based mask pattern
7
+ * Mask format: '0' represents a digit placeholder, '|' separates alternative masks
8
+ *
9
+ * @param value - Value to validate
10
+ * @param maskData - Mask pattern(s) separated by '|' for alternatives
11
+ * @returns True if value matches any of the masks
12
+ *
13
+ * @example
14
+ * validateMask('12345', '00000') // true (5 digits)
15
+ * validateMask('123', '00000|000') // true (matches second mask)
16
+ * validateMask('12-345', '00000') // true (non-digits ignored)
17
+ * validateMask('12', '00000') // false (not enough digits)
18
+ */
19
+ export declare function validateMask(value: unknown, maskData: string): boolean;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import * as Spreadsheet from './spreadsheet';
3
3
  export declare const SpreadsheetContext: import('react').Context<Spreadsheet.Context | null>;
4
- export declare function SpreadsheetContextProvider({ children, startingColumns, matrix: startingMatrix, staticRows, onMatrixChange, onExportData, onImportData, onOpenFullScreen, fullScreen, conditionalFormatting, }: Spreadsheet.ContextProvider): import("react/jsx-runtime").JSX.Element;
4
+ export declare function SpreadsheetContextProvider({ children, startingColumns, matrix: startingMatrix, staticRows, onMatrixChange, onExportData, onImportData, onOpenFullScreen, fullScreen, conditionalFormatting, enableCyclicPasteRepeat, }: Spreadsheet.ContextProvider): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
- import { ClipboardEvent, CSSProperties, Dispatch, MouseEvent, PropsWithChildren, SetStateAction } from 'react';
2
- import { SpreadsheetProps } from '../ui/spreadsheet';
1
+ import { CSSProperties, ClipboardEvent, Dispatch, MouseEvent, PropsWithChildren, SetStateAction } from 'react';
3
2
  import { ConditionalFormattingRule } from '../lib/conditional-formatting';
3
+ import { SpreadsheetProps } from '../ui/spreadsheet';
4
4
  import { ColumnCounterEnum, CommonFiltersEnum, DateFiltersEnum, NumericFiltersEnum, TextFiltersEnum } from '../lib/spreadsheet-filters';
5
5
  import type * as Matrix from './matrix';
6
6
  export declare const COLUMN_STRING_LIMIT = 1200;
@@ -193,7 +193,7 @@ export type Context = {
193
193
  onDeleteSelectedCells: () => void;
194
194
  onSelectRow: (row: number, event?: MouseEvent) => void;
195
195
  onSelectColumn: (column: number, event?: MouseEvent) => void;
196
- onChangeTemporaryValue: (point: Matrix.Point, value: unknown) => void;
196
+ onChangeTemporaryValue: (point: Matrix.Point, value: unknown, filteredMatrix: RowFiltered[]) => void;
197
197
  onSelectCell: (point: Matrix.Point) => void;
198
198
  isCellSelected: (point: Matrix.Point) => boolean;
199
199
  isCopied: boolean;
@@ -1,5 +1,5 @@
1
- import { InitialColumn } from '../lib/setup-columns';
2
1
  import { ConditionalFormattingRule } from '../lib/conditional-formatting';
2
+ import { InitialColumn } from '../lib/setup-columns';
3
3
  import type * as Matrix from '../model/matrix';
4
4
  export type SpreadsheetProps = {
5
5
  matrix: Matrix.Matrix<unknown>;
@@ -14,5 +14,12 @@ export type SpreadsheetProps = {
14
14
  onOpenFullScreen?: () => void;
15
15
  fullScreen?: boolean;
16
16
  conditionalFormatting?: ConditionalFormattingRule[];
17
+ /**
18
+ * Enable cyclic repetition when pasting data into a larger selection.
19
+ * When true: Pasting [A, B] into 5 cells results in [A, B, A, B, A]
20
+ * When false: Pasting [A, B] into 5 cells results in [A, B, _, _, _] (Excel behavior)
21
+ * @default true
22
+ */
23
+ enableCyclicPasteRepeat?: boolean;
17
24
  };
18
25
  export declare function Spreadsheet(props: SpreadsheetProps): import("react/jsx-runtime").JSX.Element;