react-excel-lite 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -16,6 +16,7 @@ A lightweight, Excel-like editable grid component for React.
16
16
  - Grouped column headers with custom styling
17
17
  - Row headers with custom styling
18
18
  - Keyboard shortcuts (Delete/Backspace to clear)
19
+ - **Styling-agnostic**: Works with Tailwind CSS, CSS Modules, plain CSS, or any styling solution
19
20
  - Zero external dependencies
20
21
 
21
22
  ## Installation
@@ -100,9 +101,18 @@ function App() {
100
101
  }
101
102
  ```
102
103
 
103
- ## Custom Styling
104
+ ## Styling
105
+
106
+ The component comes with sensible default styles built-in. You can customize styles using the `styles` prop with CSS class strings from any styling solution.
107
+
108
+ ### Default Styles
104
109
 
105
- Use the `styles` prop to customize selection, fill handle, and header styles:
110
+ Out of the box, the grid has:
111
+ - Light gray borders and headers
112
+ - Blue selection highlight
113
+ - Blue fill handle
114
+
115
+ ### Custom Styling with Tailwind CSS
106
116
 
107
117
  ```tsx
108
118
  import type { GridStyles } from "react-excel-lite";
@@ -120,6 +130,66 @@ const styles: GridStyles = {
120
130
  <ExcelGrid data={data} onChange={setData} styles={styles} />;
121
131
  ```
122
132
 
133
+ ### Custom Styling with CSS Modules
134
+
135
+ ```tsx
136
+ import styles from "./grid.module.css";
137
+ import type { GridStyles } from "react-excel-lite";
138
+
139
+ const gridStyles: GridStyles = {
140
+ selected: styles.selectedCell,
141
+ fillTarget: styles.fillTargetCell,
142
+ fillHandle: styles.fillHandle,
143
+ };
144
+
145
+ <ExcelGrid data={data} onChange={setData} styles={gridStyles} />;
146
+ ```
147
+
148
+ ### Custom Styling with Plain CSS
149
+
150
+ ```tsx
151
+ const styles: GridStyles = {
152
+ selected: "my-selected-cell",
153
+ fillTarget: "my-fill-target",
154
+ fillHandle: "my-fill-handle",
155
+ };
156
+
157
+ <ExcelGrid data={data} onChange={setData} styles={styles} />;
158
+ ```
159
+
160
+ ```css
161
+ /* styles.css */
162
+ .my-selected-cell {
163
+ background-color: #f3e8ff;
164
+ outline: 2px solid #a855f7;
165
+ outline-offset: -2px;
166
+ }
167
+
168
+ .my-fill-target {
169
+ background-color: #faf5ff;
170
+ }
171
+
172
+ .my-fill-handle {
173
+ background-color: #a855f7;
174
+ }
175
+ ```
176
+
177
+ ### GridStyles Interface
178
+
179
+ ```ts
180
+ interface GridStyles {
181
+ cell?: string; // CSS class for data cells
182
+ selected?: string; // CSS class for selected cells (overrides default)
183
+ fillTarget?: string; // CSS class for fill target cells (overrides default)
184
+ fillHandle?: string; // CSS class for fill handle (overrides default)
185
+ colGroup?: string; // CSS class for column group headers
186
+ colHeader?: string; // CSS class for individual column headers
187
+ rowHeader?: string; // CSS class for row headers
188
+ }
189
+ ```
190
+
191
+ ### Styling Individual Headers
192
+
123
193
  Style individual column headers and groups:
124
194
 
125
195
  ```tsx
@@ -242,7 +312,3 @@ interface ExcelGridProps {
242
312
  styles?: GridStyles;
243
313
  }
244
314
  ```
245
-
246
- ## Styling
247
-
248
- The component uses Tailwind CSS classes. Make sure Tailwind CSS is configured in your project, or override styles using the `styles` prop.
@@ -1 +1 @@
1
- {"version":3,"file":"excel-grid.d.ts","sourceRoot":"","sources":["../../src/components/excel-grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,UAAU,CAAC;AAO1D,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAmB,EACnB,MAAM,GACP,EAAE,cAAc,2CAwPhB"}
1
+ {"version":3,"file":"excel-grid.d.ts","sourceRoot":"","sources":["../../src/components/excel-grid.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,UAAU,CAAC;AAgD1D,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAmB,EACnB,MAAM,GACP,EAAE,cAAc,2CA+OhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"grid-cell.d.ts","sourceRoot":"","sources":["../../src/components/grid-cell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,MAAM,GACP,EAAE,aAAa,2CAmDf"}
1
+ {"version":3,"file":"grid-cell.d.ts","sourceRoot":"","sources":["../../src/components/grid-cell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA8C9C,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,MAAM,GACP,EAAE,aAAa,2CA+Df"}
@@ -1,468 +1,524 @@
1
- import { jsxs as j, jsx as E } from "react/jsx-runtime";
2
- import { useState as L, useCallback as x, useEffect as $, useRef as _, useMemo as q } from "react";
3
- function R(...n) {
4
- return n.filter(Boolean).join(" ");
1
+ import { jsxs as G, jsx as v } from "react/jsx-runtime";
2
+ import { useState as K, useCallback as x, useEffect as W, useRef as $, useMemo as q } from "react";
3
+ function I(...o) {
4
+ return o.filter(Boolean).join(" ");
5
5
  }
6
- function on(n) {
7
- return `${n.row}-${n.col}`;
6
+ function fo(o) {
7
+ return `${o.row}-${o.col}`;
8
8
  }
9
- function tn(n) {
10
- const [o, e] = n.split("-").map(Number);
11
- return { row: o, col: e };
9
+ function wo(o) {
10
+ const [n, l] = o.split("-").map(Number);
11
+ return { row: n, col: l };
12
12
  }
13
- function en(n, o) {
14
- if (!n || !o) return n ? [n] : [];
15
- const e = Math.min(n.row, o.row), s = Math.max(n.row, o.row), i = Math.min(n.col, o.col), b = Math.max(n.col, o.col), c = [];
16
- for (let f = e; f <= s; f++)
17
- for (let a = i; a <= b; a++)
18
- c.push({ row: f, col: a });
19
- return c;
13
+ function ho(o, n) {
14
+ if (!o || !n) return o ? [o] : [];
15
+ const l = Math.min(o.row, n.row), s = Math.max(o.row, n.row), u = Math.min(o.col, n.col), b = Math.max(o.col, n.col), i = [];
16
+ for (let h = l; h <= s; h++)
17
+ for (let f = u; f <= b; f++)
18
+ i.push({ row: h, col: f });
19
+ return i;
20
20
  }
21
- function J(n, o) {
22
- if (!o.start) return !1;
23
- const e = o.end || o.start, s = Math.min(o.start.row, e.row), i = Math.max(o.start.row, e.row), b = Math.min(o.start.col, e.col), c = Math.max(o.start.col, e.col);
24
- return n.row >= s && n.row <= i && n.col >= b && n.col <= c;
21
+ function O(o, n) {
22
+ if (!n.start) return !1;
23
+ const l = n.end || n.start, s = Math.min(n.start.row, l.row), u = Math.max(n.start.row, l.row), b = Math.min(n.start.col, l.col), i = Math.max(n.start.col, l.col);
24
+ return o.row >= s && o.row <= u && o.col >= b && o.col <= i;
25
25
  }
26
- function O(n) {
27
- return n.split(/\r?\n/).filter((o) => o.trim()).map((o) => o.split(" ").map((e) => e.trim()));
26
+ function X(o) {
27
+ return o.split(/\r?\n/).filter((n) => n.trim()).map((n) => n.split(" ").map((l) => l.trim()));
28
28
  }
29
- function Q(n) {
30
- return n.map((o) => o.join(" ")).join(`
29
+ function _(o) {
30
+ return o.map((n) => n.join(" ")).join(`
31
31
  `);
32
32
  }
33
- function B(n) {
34
- return !n.start || !n.end ? n : {
33
+ function L(o) {
34
+ return !o.start || !o.end ? o : {
35
35
  start: {
36
- row: Math.min(n.start.row, n.end.row),
37
- col: Math.min(n.start.col, n.end.col)
36
+ row: Math.min(o.start.row, o.end.row),
37
+ col: Math.min(o.start.col, o.end.col)
38
38
  },
39
39
  end: {
40
- row: Math.max(n.start.row, n.end.row),
41
- col: Math.max(n.start.col, n.end.col)
40
+ row: Math.max(o.start.row, o.end.row),
41
+ col: Math.max(o.start.col, o.end.col)
42
42
  }
43
43
  };
44
44
  }
45
- function ln(n, o) {
46
- if (n.row === o.row && n.col === o.col)
45
+ function po(o, n) {
46
+ if (o.row === n.row && o.col === n.col)
47
47
  return [];
48
- const e = Math.min(n.row, o.row), s = Math.max(n.row, o.row), i = Math.min(n.col, o.col), b = Math.max(n.col, o.col), c = [];
49
- for (let f = e; f <= s; f++)
50
- for (let a = i; a <= b; a++)
51
- f === n.row && a === n.col || c.push({ row: f, col: a });
52
- return c;
48
+ const l = Math.min(o.row, n.row), s = Math.max(o.row, n.row), u = Math.min(o.col, n.col), b = Math.max(o.col, n.col), i = [];
49
+ for (let h = l; h <= s; h++)
50
+ for (let f = u; f <= b; f++)
51
+ h === o.row && f === o.col || i.push({ row: h, col: f });
52
+ return i;
53
53
  }
54
- function W() {
55
- const [n, o] = L({
54
+ function J() {
55
+ const [o, n] = K({
56
56
  start: null,
57
57
  end: null
58
- }), [e, s] = L(!1), i = x((u) => {
59
- o({ start: u, end: u }), s(!0);
58
+ }), [l, s] = K(!1), u = x((a) => {
59
+ n({ start: a, end: a }), s(!0);
60
60
  }, []), b = x(
61
- (u) => {
62
- e && o((l) => ({ ...l, end: u }));
61
+ (a) => {
62
+ l && n((e) => ({ ...e, end: a }));
63
63
  },
64
- [e]
65
- ), c = x(() => {
64
+ [l]
65
+ ), i = x(() => {
66
66
  s(!1);
67
- }, []), f = x(() => {
68
- o({ start: null, end: null }), s(!1);
69
- }, []), a = x(
70
- (u) => J(u, n),
71
- [n]
67
+ }, []), h = x(() => {
68
+ n({ start: null, end: null }), s(!1);
69
+ }, []), f = x(
70
+ (a) => O(a, o),
71
+ [o]
72
72
  );
73
- return $(() => {
74
- const u = () => {
75
- e && s(!1);
73
+ return W(() => {
74
+ const a = () => {
75
+ l && s(!1);
76
76
  };
77
- return window.addEventListener("mouseup", u), () => window.removeEventListener("mouseup", u);
78
- }, [e]), {
79
- selection: n,
80
- isSelecting: e,
81
- isCellSelected: a,
82
- handleCellMouseDown: i,
77
+ return window.addEventListener("mouseup", a), () => window.removeEventListener("mouseup", a);
78
+ }, [l]), {
79
+ selection: o,
80
+ isSelecting: l,
81
+ isCellSelected: f,
82
+ handleCellMouseDown: u,
83
83
  handleCellMouseEnter: b,
84
- handleMouseUp: c,
85
- clearSelection: f,
86
- setSelection: o
84
+ handleMouseUp: i,
85
+ clearSelection: h,
86
+ setSelection: n
87
87
  };
88
88
  }
89
- function X({
90
- selection: n,
91
- getValue: o,
92
- setValues: e,
89
+ function Q({
90
+ selection: o,
91
+ getValue: n,
92
+ setValues: l,
93
93
  rowCount: s,
94
- colCount: i
94
+ colCount: u
95
95
  }) {
96
96
  const b = x(() => {
97
- const l = B(n);
98
- if (!l.start || !l.end) return [];
99
- const y = [];
100
- for (let C = l.start.row; C <= l.end.row; C++) {
101
- const h = [];
102
- for (let D = l.start.col; D <= l.end.col; D++)
103
- h.push(o({ row: C, col: D }));
104
- y.push(h);
97
+ const e = L(o);
98
+ if (!e.start || !e.end) return [];
99
+ const C = [];
100
+ for (let M = e.start.row; M <= e.end.row; M++) {
101
+ const S = [];
102
+ for (let g = e.start.col; g <= e.end.col; g++)
103
+ S.push(n({ row: M, col: g }));
104
+ C.push(S);
105
105
  }
106
- return y;
107
- }, [n, o]), c = x(async () => {
108
- const l = b();
109
- if (l.length === 0) return;
110
- const y = Q(l);
106
+ return C;
107
+ }, [o, n]), i = x(async () => {
108
+ const e = b();
109
+ if (e.length === 0) return;
110
+ const C = _(e);
111
111
  try {
112
- await navigator.clipboard.writeText(y);
113
- } catch (C) {
114
- console.error("Clipboard copy failed:", C);
112
+ await navigator.clipboard.writeText(C);
113
+ } catch (M) {
114
+ console.error("Clipboard copy failed:", M);
115
115
  }
116
- }, [b]), f = x(async () => {
117
- if (n.start)
116
+ }, [b]), h = x(async () => {
117
+ if (o.start)
118
118
  try {
119
- const l = await navigator.clipboard.readText(), y = O(l);
120
- if (y.length === 0) return;
121
- const C = n.start.row, h = n.start.col, D = [];
122
- y.forEach((d, M) => {
123
- const w = C + M;
124
- w >= s || d.forEach((m, v) => {
125
- const F = h + v;
126
- F >= i || D.push({ coord: { row: w, col: F }, value: m });
119
+ const e = await navigator.clipboard.readText(), C = X(e);
120
+ if (C.length === 0) return;
121
+ const M = o.start.row, S = o.start.col, g = [];
122
+ C.forEach((w, p) => {
123
+ const d = M + p;
124
+ d >= s || w.forEach((c, N) => {
125
+ const D = S + N;
126
+ D >= u || g.push({ coord: { row: d, col: D }, value: c });
127
127
  });
128
- }), D.length > 0 && e(D);
129
- } catch (l) {
130
- console.error("Clipboard paste failed:", l);
128
+ }), g.length > 0 && l(g);
129
+ } catch (e) {
130
+ console.error("Clipboard paste failed:", e);
131
131
  }
132
- }, [n.start, e, s, i]), a = x(() => {
133
- const l = B(n);
134
- if (!l.start || !l.end) return;
135
- const y = [];
136
- for (let C = l.start.row; C <= l.end.row; C++)
137
- for (let h = l.start.col; h <= l.end.col; h++)
138
- y.push({ coord: { row: C, col: h }, value: "" });
139
- y.length > 0 && e(y);
140
- }, [n, e]), u = x(
141
- (l) => {
142
- (l.ctrlKey || l.metaKey) && l.key === "c" && (l.preventDefault(), c()), (l.ctrlKey || l.metaKey) && l.key === "v" && (l.preventDefault(), f()), (l.key === "Backspace" || l.key === "Delete") && (l.preventDefault(), a());
132
+ }, [o.start, l, s, u]), f = x(() => {
133
+ const e = L(o);
134
+ if (!e.start || !e.end) return;
135
+ const C = [];
136
+ for (let M = e.start.row; M <= e.end.row; M++)
137
+ for (let S = e.start.col; S <= e.end.col; S++)
138
+ C.push({ coord: { row: M, col: S }, value: "" });
139
+ C.length > 0 && l(C);
140
+ }, [o, l]), a = x(
141
+ (e) => {
142
+ (e.ctrlKey || e.metaKey) && e.key === "c" && (e.preventDefault(), i()), (e.ctrlKey || e.metaKey) && e.key === "v" && (e.preventDefault(), h()), (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), f());
143
143
  },
144
- [c, f, a]
144
+ [i, h, f]
145
145
  );
146
146
  return {
147
- handleCopy: c,
148
- handlePaste: f,
149
- handleKeyDown: u
147
+ handleCopy: i,
148
+ handlePaste: h,
149
+ handleKeyDown: a
150
150
  };
151
151
  }
152
- function Y(n) {
153
- if (n.trim() === "") return null;
154
- const o = Number(n);
155
- return isNaN(o) ? null : o;
152
+ function Y(o) {
153
+ if (o.trim() === "") return null;
154
+ const n = Number(o);
155
+ return isNaN(n) ? null : n;
156
156
  }
157
- function P(n) {
158
- if (n.length === 0) return null;
159
- const o = n.map(Y);
160
- if (o.some((i) => i === null)) return null;
161
- const e = o;
162
- if (e.length === 1)
163
- return { numbers: e, diff: 0 };
164
- const s = e[1] - e[0];
165
- for (let i = 2; i < e.length; i++)
166
- if (e[i] - e[i - 1] !== s)
167
- return { numbers: e, diff: 0 };
168
- return { numbers: e, diff: s };
157
+ function H(o) {
158
+ if (o.length === 0) return null;
159
+ const n = o.map(Y);
160
+ if (n.some((u) => u === null)) return null;
161
+ const l = n;
162
+ if (l.length === 1)
163
+ return { numbers: l, diff: 0 };
164
+ const s = l[1] - l[0];
165
+ for (let u = 2; u < l.length; u++)
166
+ if (l[u] - l[u - 1] !== s)
167
+ return { numbers: l, diff: 0 };
168
+ return { numbers: l, diff: s };
169
169
  }
170
170
  function Z({
171
- selection: n,
172
- getValue: o,
173
- setValues: e
171
+ selection: o,
172
+ getValue: n,
173
+ setValues: l
174
174
  }) {
175
- const [s, i] = L(null), [b, c] = L([]), [f, a] = L(!1), [u, l] = L(null), y = x((d) => {
176
- i(d), a(!0), c([]), l(null);
177
- }, []), C = x(
178
- (d) => {
179
- if (!f || !n.start) return;
180
- const M = B(n);
181
- if (!M.start || !M.end) return;
182
- l(d);
183
- const w = {
184
- row: Math.min(M.start.row, d.row),
185
- col: Math.min(M.start.col, d.col)
186
- }, m = {
187
- row: Math.max(M.end.row, d.row),
188
- col: Math.max(M.end.col, d.col)
189
- }, v = [];
190
- for (let F = w.row; F <= m.row; F++)
191
- for (let r = w.col; r <= m.col; r++)
192
- F >= M.start.row && F <= M.end.row && r >= M.start.col && r <= M.end.col || v.push({ row: F, col: r });
193
- c(v);
175
+ const [s, u] = K(null), [b, i] = K([]), [h, f] = K(!1), [a, e] = K(null), C = x((w) => {
176
+ u(w), f(!0), i([]), e(null);
177
+ }, []), M = x(
178
+ (w) => {
179
+ if (!h || !o.start) return;
180
+ const p = L(o);
181
+ if (!p.start || !p.end) return;
182
+ e(w);
183
+ const d = {
184
+ row: Math.min(p.start.row, w.row),
185
+ col: Math.min(p.start.col, w.col)
186
+ }, c = {
187
+ row: Math.max(p.end.row, w.row),
188
+ col: Math.max(p.end.col, w.col)
189
+ }, N = [];
190
+ for (let D = d.row; D <= c.row; D++)
191
+ for (let r = d.col; r <= c.col; r++)
192
+ D >= p.start.row && D <= p.end.row && r >= p.start.col && r <= p.end.col || N.push({ row: D, col: r });
193
+ i(N);
194
194
  },
195
- [f, n]
196
- ), h = x(() => {
197
- if (!n.start || b.length === 0 || !u) {
198
- i(null), c([]), a(!1), l(null);
195
+ [h, o]
196
+ ), S = x(() => {
197
+ if (!o.start || b.length === 0 || !a) {
198
+ u(null), i([]), f(!1), e(null);
199
199
  return;
200
200
  }
201
- const d = B(n);
202
- if (!d.start || !d.end) {
203
- i(null), c([]), a(!1), l(null);
201
+ const w = L(o);
202
+ if (!w.start || !w.end) {
203
+ u(null), i([]), f(!1), e(null);
204
204
  return;
205
205
  }
206
- const M = [], w = d.start, m = d.end, v = m.row - w.row + 1, F = m.col - w.col + 1;
206
+ const p = [], d = w.start, c = w.end, N = c.row - d.row + 1, D = c.col - d.col + 1;
207
207
  b.forEach((r) => {
208
- let T, k;
209
- if (r.row < w.row) {
210
- const S = w.row - r.row;
211
- T = m.row - (S - 1) % v;
212
- } else if (r.row > m.row) {
213
- const S = r.row - m.row;
214
- T = w.row + (S - 1) % v;
208
+ let R, k;
209
+ if (r.row < d.row) {
210
+ const F = d.row - r.row;
211
+ R = c.row - (F - 1) % N;
212
+ } else if (r.row > c.row) {
213
+ const F = r.row - c.row;
214
+ R = d.row + (F - 1) % N;
215
215
  } else
216
- T = r.row;
217
- if (r.col < w.col) {
218
- const S = w.col - r.col;
219
- k = m.col - (S - 1) % F;
220
- } else if (r.col > m.col) {
221
- const S = r.col - m.col;
222
- k = w.col + (S - 1) % F;
216
+ R = r.row;
217
+ if (r.col < d.col) {
218
+ const F = d.col - r.col;
219
+ k = c.col - (F - 1) % D;
220
+ } else if (r.col > c.col) {
221
+ const F = r.col - c.col;
222
+ k = d.col + (F - 1) % D;
223
223
  } else
224
224
  k = r.col;
225
- let z = o({ row: T, col: k });
226
- if (r.row !== T && r.col >= w.col && r.col <= m.col) {
227
- const S = [];
228
- for (let t = w.row; t <= m.row; t++)
229
- S.push(o({ row: t, col: r.col }));
230
- const g = P(S);
231
- if (g && g.diff !== 0) {
232
- if (r.row > m.row) {
233
- const t = r.row - m.row;
234
- z = String(g.numbers[g.numbers.length - 1] + g.diff * t);
235
- } else if (r.row < w.row) {
236
- const t = w.row - r.row;
237
- z = String(g.numbers[0] - g.diff * t);
225
+ let T = n({ row: R, col: k });
226
+ if (r.row !== R && r.col >= d.col && r.col <= c.col) {
227
+ const F = [];
228
+ for (let t = d.row; t <= c.row; t++)
229
+ F.push(n({ row: t, col: r.col }));
230
+ const y = H(F);
231
+ if (y && y.diff !== 0) {
232
+ if (r.row > c.row) {
233
+ const t = r.row - c.row;
234
+ T = String(y.numbers[y.numbers.length - 1] + y.diff * t);
235
+ } else if (r.row < d.row) {
236
+ const t = d.row - r.row;
237
+ T = String(y.numbers[0] - y.diff * t);
238
238
  }
239
239
  }
240
240
  }
241
- if (r.col !== k && r.row >= w.row && r.row <= m.row) {
242
- const S = [];
243
- for (let t = w.col; t <= m.col; t++)
244
- S.push(o({ row: r.row, col: t }));
245
- const g = P(S);
246
- if (g && g.diff !== 0) {
247
- if (r.col > m.col) {
248
- const t = r.col - m.col;
249
- z = String(g.numbers[g.numbers.length - 1] + g.diff * t);
250
- } else if (r.col < w.col) {
251
- const t = w.col - r.col;
252
- z = String(g.numbers[0] - g.diff * t);
241
+ if (r.col !== k && r.row >= d.row && r.row <= c.row) {
242
+ const F = [];
243
+ for (let t = d.col; t <= c.col; t++)
244
+ F.push(n({ row: r.row, col: t }));
245
+ const y = H(F);
246
+ if (y && y.diff !== 0) {
247
+ if (r.col > c.col) {
248
+ const t = r.col - c.col;
249
+ T = String(y.numbers[y.numbers.length - 1] + y.diff * t);
250
+ } else if (r.col < d.col) {
251
+ const t = d.col - r.col;
252
+ T = String(y.numbers[0] - y.diff * t);
253
253
  }
254
254
  }
255
255
  }
256
- M.push({ coord: r, value: z });
257
- }), M.length > 0 && e(M), i(null), c([]), a(!1), l(null);
258
- }, [n, b, u, o, e]), D = x(
259
- (d) => b.some(
260
- (M) => M.row === d.row && M.col === d.col
256
+ p.push({ coord: r, value: T });
257
+ }), p.length > 0 && l(p), u(null), i([]), f(!1), e(null);
258
+ }, [o, b, a, n, l]), g = x(
259
+ (w) => b.some(
260
+ (p) => p.row === w.row && p.col === w.col
261
261
  ),
262
262
  [b]
263
263
  );
264
- return $(() => {
265
- const d = () => {
266
- f && h();
264
+ return W(() => {
265
+ const w = () => {
266
+ h && S();
267
267
  };
268
- return window.addEventListener("mouseup", d), () => window.removeEventListener("mouseup", d);
269
- }, [f, h]), {
268
+ return window.addEventListener("mouseup", w), () => window.removeEventListener("mouseup", w);
269
+ }, [h, S]), {
270
270
  fillSource: s,
271
271
  fillTargets: b,
272
- isDraggingFill: f,
273
- isFillTarget: D,
274
- handleFillHandleMouseDown: y,
275
- handleCellMouseEnterForFill: C,
276
- handleFillMouseUp: h
272
+ isDraggingFill: h,
273
+ isFillTarget: g,
274
+ handleFillHandleMouseDown: C,
275
+ handleCellMouseEnterForFill: M,
276
+ handleFillMouseUp: S
277
277
  };
278
278
  }
279
- function V({
280
- coord: n,
281
- value: o,
282
- isSelected: e,
279
+ const V = {
280
+ position: "relative",
281
+ border: "1px solid #d1d5db",
282
+ padding: 0
283
+ }, oo = {
284
+ width: "100%",
285
+ height: "100%",
286
+ paddingLeft: "4px",
287
+ paddingRight: "4px",
288
+ paddingTop: "4px",
289
+ paddingBottom: "4px",
290
+ textAlign: "right",
291
+ fontSize: "12px",
292
+ backgroundColor: "transparent",
293
+ outline: "none",
294
+ cursor: "cell"
295
+ }, no = {
296
+ position: "absolute",
297
+ bottom: "-2px",
298
+ right: "-2px",
299
+ width: "8px",
300
+ height: "8px",
301
+ cursor: "crosshair",
302
+ zIndex: 20,
303
+ backgroundColor: "#3b82f6"
304
+ }, to = {
305
+ backgroundColor: "#dbeafe",
306
+ outline: "2px solid #3b82f6",
307
+ outlineOffset: "-2px"
308
+ }, lo = {
309
+ backgroundColor: "#eff6ff"
310
+ };
311
+ function eo({
312
+ coord: o,
313
+ value: n,
314
+ isSelected: l,
283
315
  isFillTarget: s,
284
- showFillHandle: i,
316
+ showFillHandle: u,
285
317
  onMouseDown: b,
286
- onMouseEnter: c,
287
- onChange: f,
288
- onFillHandleMouseDown: a,
289
- styles: u
318
+ onMouseEnter: i,
319
+ onChange: h,
320
+ onFillHandleMouseDown: f,
321
+ styles: a
290
322
  }) {
291
- const l = (h) => {
292
- f(n, h.target.value);
293
- }, y = (h) => {
294
- h.target.classList.contains("fill-handle") || b(n);
295
- }, C = (h) => {
296
- h.stopPropagation(), h.preventDefault(), a(n);
323
+ const e = (c) => {
324
+ h(o, c.target.value);
325
+ }, C = (c) => {
326
+ c.target.classList.contains("fill-handle") || b(o);
327
+ }, M = (c) => {
328
+ c.stopPropagation(), c.preventDefault(), f(o);
329
+ }, S = !!a?.selected, g = !!a?.fillTarget, w = !!a?.fillHandle, p = {
330
+ ...V,
331
+ ...l && !S ? to : {},
332
+ ...s && !g ? lo : {}
333
+ }, d = {
334
+ ...no,
335
+ ...w ? { backgroundColor: void 0 } : {}
297
336
  };
298
- return /* @__PURE__ */ j(
337
+ return /* @__PURE__ */ G(
299
338
  "td",
300
339
  {
301
- className: R(
302
- "relative border border-gray-300 p-0",
303
- u?.cell,
304
- e && (u?.selected ?? "bg-blue-100 ring-2 ring-inset ring-blue-500"),
305
- s && (u?.fillTarget ?? "bg-blue-50")
340
+ className: I(
341
+ a?.cell,
342
+ l && a?.selected,
343
+ s && a?.fillTarget
306
344
  ),
307
- onMouseDown: y,
308
- onMouseEnter: () => c(n),
345
+ style: p,
346
+ onMouseDown: C,
347
+ onMouseEnter: () => i(o),
309
348
  children: [
310
- /* @__PURE__ */ E(
349
+ /* @__PURE__ */ v(
311
350
  "input",
312
351
  {
313
352
  type: "text",
314
- value: o,
315
- onChange: l,
316
- className: R(
317
- "w-full h-full px-1 py-1 text-right text-xs bg-transparent outline-none cursor-cell",
318
- e && "bg-transparent"
319
- )
353
+ value: n,
354
+ onChange: e,
355
+ style: oo
320
356
  }
321
357
  ),
322
- i && /* @__PURE__ */ E(
358
+ u && /* @__PURE__ */ v(
323
359
  "div",
324
360
  {
325
- className: R(
326
- "fill-handle absolute -bottom-0.5 -right-0.5 w-2 h-2 cursor-crosshair z-20",
327
- u?.fillHandle ?? "bg-blue-500"
328
- ),
329
- onMouseDown: C
361
+ className: I("fill-handle", a?.fillHandle),
362
+ style: d,
363
+ onMouseDown: M
330
364
  }
331
365
  )
332
366
  ]
333
367
  }
334
368
  );
335
369
  }
336
- function rn({
337
- data: n,
338
- onChange: o,
339
- rowHeaders: e,
370
+ const ro = {
371
+ outline: "none",
372
+ overflowX: "auto"
373
+ }, so = {
374
+ borderCollapse: "collapse",
375
+ fontSize: "12px",
376
+ userSelect: "none"
377
+ }, U = {
378
+ position: "sticky",
379
+ left: 0,
380
+ zIndex: 10,
381
+ backgroundColor: "#f3f4f6",
382
+ border: "1px solid #d1d5db",
383
+ padding: "6px 8px",
384
+ textAlign: "center",
385
+ fontWeight: 500
386
+ }, co = {
387
+ backgroundColor: "#dbeafe",
388
+ border: "1px solid #d1d5db",
389
+ padding: "6px 4px",
390
+ textAlign: "center",
391
+ fontWeight: 500,
392
+ color: "#1d4ed8"
393
+ }, io = {
394
+ backgroundColor: "#f9fafb",
395
+ border: "1px solid #d1d5db",
396
+ padding: "4px",
397
+ textAlign: "center",
398
+ fontWeight: 500,
399
+ fontSize: "11px"
400
+ };
401
+ function mo({
402
+ data: o,
403
+ onChange: n,
404
+ rowHeaders: l,
340
405
  colHeaders: s,
341
- className: i,
406
+ className: u,
342
407
  rowHeaderTitle: b = "",
343
- styles: c
408
+ styles: i
344
409
  }) {
345
- const f = _(null), a = n.length, u = q(() => s ? s.reduce(
346
- (t, p) => t + p.headers.length,
410
+ const h = $(null), f = o.length, a = q(() => s ? s.reduce(
411
+ (t, m) => t + m.headers.length,
347
412
  0
348
- ) : n[0]?.length ?? 0, [s, n]), l = q(() => s ? s.flatMap((t) => t.headers) : [], [s]), y = x(
349
- (t) => t.row < 0 || t.row >= a || t.col < 0 || t.col >= u ? "" : n[t.row]?.[t.col] ?? "",
350
- [n, a, u]
351
- ), C = x(
352
- (t, p) => {
353
- const N = n.map(
354
- (K, G) => G === t.row ? K.map(
355
- (I, U) => U === t.col ? p : I
356
- ) : K
413
+ ) : o[0]?.length ?? 0, [s, o]), e = q(() => s ? s.flatMap((t) => t.headers) : [], [s]), C = x(
414
+ (t) => t.row < 0 || t.row >= f || t.col < 0 || t.col >= a ? "" : o[t.row]?.[t.col] ?? "",
415
+ [o, f, a]
416
+ ), M = x(
417
+ (t, m) => {
418
+ const E = o.map(
419
+ (B, z) => z === t.row ? B.map(
420
+ (j, A) => A === t.col ? m : j
421
+ ) : B
357
422
  );
358
- o(N);
423
+ n(E);
359
424
  },
360
- [n, o]
361
- ), h = x(
425
+ [o, n]
426
+ ), S = x(
362
427
  (t) => {
363
428
  if (t.length === 0) return;
364
- const p = n.map((N) => [...N]);
365
- t.forEach(({ coord: N, value: K }) => {
366
- N.row >= 0 && N.row < a && N.col >= 0 && N.col < u && (p[N.row][N.col] = K);
367
- }), o(p);
429
+ const m = o.map((E) => [...E]);
430
+ t.forEach(({ coord: E, value: B }) => {
431
+ E.row >= 0 && E.row < f && E.col >= 0 && E.col < a && (m[E.row][E.col] = B);
432
+ }), n(m);
368
433
  },
369
- [n, o, a, u]
434
+ [o, n, f, a]
370
435
  ), {
371
- selection: D,
372
- isSelecting: d,
373
- isCellSelected: M,
374
- handleCellMouseDown: w,
375
- handleCellMouseEnter: m
376
- } = W(), { handleKeyDown: v } = X({
377
- selection: D,
378
- getValue: y,
379
- setValues: h,
380
- rowCount: a,
381
- colCount: u
436
+ selection: g,
437
+ isSelecting: w,
438
+ isCellSelected: p,
439
+ handleCellMouseDown: d,
440
+ handleCellMouseEnter: c
441
+ } = J(), { handleKeyDown: N } = Q({
442
+ selection: g,
443
+ getValue: C,
444
+ setValues: S,
445
+ rowCount: f,
446
+ colCount: a
382
447
  }), {
383
- isDraggingFill: F,
448
+ isDraggingFill: D,
384
449
  isFillTarget: r,
385
- handleFillHandleMouseDown: T,
450
+ handleFillHandleMouseDown: R,
386
451
  handleCellMouseEnterForFill: k
387
452
  } = Z({
388
- selection: D,
389
- getValue: y,
390
- setValues: h
391
- }), z = x(
453
+ selection: g,
454
+ getValue: C,
455
+ setValues: S
456
+ }), T = x(
392
457
  (t) => {
393
- F ? k(t) : d && m(t);
458
+ D ? k(t) : w && c(t);
394
459
  },
395
460
  [
396
- F,
397
- d,
461
+ D,
462
+ w,
398
463
  k,
399
- m
464
+ c
400
465
  ]
401
- ), S = x(
402
- (t, p) => {
403
- C(t, p);
466
+ ), F = x(
467
+ (t, m) => {
468
+ M(t, m);
404
469
  },
405
- [C]
406
- ), g = x(
470
+ [M]
471
+ ), y = x(
407
472
  (t) => {
408
- if (!D.start) return !1;
409
- const p = B(D);
410
- return !p.start || !p.end ? !1 : t.row === p.end.row && t.col === p.end.col;
473
+ if (!g.start) return !1;
474
+ const m = L(g);
475
+ return !m.start || !m.end ? !1 : t.row === m.end.row && t.col === m.end.col;
411
476
  },
412
- [D]
477
+ [g]
413
478
  );
414
- return /* @__PURE__ */ E(
479
+ return /* @__PURE__ */ v(
415
480
  "div",
416
481
  {
417
- ref: f,
418
- className: R("outline-none overflow-x-auto", i),
482
+ ref: h,
483
+ className: u,
484
+ style: ro,
419
485
  tabIndex: 0,
420
- onKeyDown: v,
421
- children: /* @__PURE__ */ j("table", { className: "border-collapse text-xs select-none", children: [
422
- /* @__PURE__ */ j("thead", { children: [
423
- s && /* @__PURE__ */ j("tr", { children: [
424
- e && /* @__PURE__ */ E(
486
+ onKeyDown: N,
487
+ children: /* @__PURE__ */ G("table", { style: so, children: [
488
+ /* @__PURE__ */ G("thead", { children: [
489
+ s && /* @__PURE__ */ G("tr", { children: [
490
+ l && /* @__PURE__ */ v(
425
491
  "th",
426
492
  {
427
- className: R(
428
- "sticky left-0 z-10 bg-gray-100 border border-gray-300 px-2 py-1.5 text-center font-medium",
429
- c?.rowHeader
430
- ),
493
+ className: i?.rowHeader,
494
+ style: U,
431
495
  children: b
432
496
  }
433
497
  ),
434
- s.map((t, p) => /* @__PURE__ */ E(
498
+ s.map((t, m) => /* @__PURE__ */ v(
435
499
  "th",
436
500
  {
437
501
  colSpan: t.headers.length,
438
- className: R(
439
- "bg-blue-100 border border-gray-300 px-1 py-1.5 text-center font-medium text-blue-700",
440
- c?.colGroup,
441
- t.className
442
- ),
502
+ className: I(i?.colGroup, t.className),
503
+ style: co,
443
504
  children: t.label
444
505
  },
445
- p
506
+ m
446
507
  ))
447
508
  ] }),
448
- s && /* @__PURE__ */ j("tr", { children: [
449
- e && /* @__PURE__ */ E(
509
+ s && /* @__PURE__ */ G("tr", { children: [
510
+ l && /* @__PURE__ */ v(
450
511
  "th",
451
512
  {
452
- className: R(
453
- "sticky left-0 z-10 bg-gray-100 border border-gray-300 px-2 py-1",
454
- c?.rowHeader
455
- )
513
+ className: i?.rowHeader,
514
+ style: U
456
515
  }
457
516
  ),
458
- l.map((t) => /* @__PURE__ */ E(
517
+ e.map((t) => /* @__PURE__ */ v(
459
518
  "th",
460
519
  {
461
- className: R(
462
- "bg-gray-50 border border-gray-300 px-1 py-1 text-center font-medium text-[11px]",
463
- c?.colHeader,
464
- t.className
465
- ),
520
+ className: I(i?.colHeader, t.className),
521
+ style: io,
466
522
  title: t.description,
467
523
  children: t.label
468
524
  },
@@ -470,66 +526,66 @@ function rn({
470
526
  ))
471
527
  ] })
472
528
  ] }),
473
- /* @__PURE__ */ E("tbody", { children: n.map((t, p) => /* @__PURE__ */ j("tr", { children: [
474
- e && e[p] && /* @__PURE__ */ E(
529
+ /* @__PURE__ */ v("tbody", { children: o.map((t, m) => /* @__PURE__ */ G("tr", { children: [
530
+ l && l[m] && /* @__PURE__ */ v(
475
531
  "td",
476
532
  {
477
- className: R(
478
- "sticky left-0 z-10 bg-gray-100 border border-gray-300 px-1 py-1.5 text-center font-medium",
479
- c?.rowHeader,
480
- e[p].className
533
+ className: I(
534
+ i?.rowHeader,
535
+ l[m].className
481
536
  ),
482
- title: e[p].description,
483
- children: e[p].label
537
+ style: U,
538
+ title: l[m].description,
539
+ children: l[m].label
484
540
  }
485
541
  ),
486
- t.map((N, K) => {
487
- const G = { row: p, col: K }, I = M(G), U = r(G), A = g(G);
488
- return /* @__PURE__ */ E(
489
- V,
542
+ t.map((E, B) => {
543
+ const z = { row: m, col: B }, j = p(z), A = r(z), P = y(z);
544
+ return /* @__PURE__ */ v(
545
+ eo,
490
546
  {
491
- coord: G,
492
- value: y(G),
493
- isSelected: I,
494
- isFillTarget: U,
495
- showFillHandle: A && !F,
496
- onMouseDown: w,
497
- onMouseEnter: z,
498
- onChange: S,
499
- onFillHandleMouseDown: T,
500
- styles: c
547
+ coord: z,
548
+ value: C(z),
549
+ isSelected: j,
550
+ isFillTarget: A,
551
+ showFillHandle: P && !D,
552
+ onMouseDown: d,
553
+ onMouseEnter: T,
554
+ onChange: F,
555
+ onFillHandleMouseDown: R,
556
+ styles: i
501
557
  },
502
- K
558
+ B
503
559
  );
504
560
  })
505
- ] }, p)) })
561
+ ] }, m)) })
506
562
  ] })
507
563
  }
508
564
  );
509
565
  }
510
- function sn(n) {
511
- const o = typeof n == "string" ? parseFloat(n.replace(/,/g, "")) : n;
512
- return isNaN(o) ? "0" : new Intl.NumberFormat("ko-KR").format(o);
566
+ function bo(o) {
567
+ const n = typeof o == "string" ? parseFloat(o.replace(/,/g, "")) : o;
568
+ return isNaN(n) ? "0" : new Intl.NumberFormat("ko-KR").format(n);
513
569
  }
514
- function cn(n) {
515
- const o = parseInt(n.replace(/,/g, ""), 10);
516
- return isNaN(o) ? 0 : o;
570
+ function xo(o) {
571
+ const n = parseInt(o.replace(/,/g, ""), 10);
572
+ return isNaN(n) ? 0 : n;
517
573
  }
518
574
  export {
519
- rn as ExcelGrid,
520
- V as GridCell,
521
- R as cn,
522
- on as coordToKey,
523
- sn as formatCurrency,
524
- en as getCellsInRange,
525
- ln as getFillTargetCells,
526
- J as isCellInRange,
527
- tn as keyToCoord,
528
- B as normalizeRange,
529
- cn as parseCurrency,
530
- O as parseTSV,
531
- Q as toTSV,
532
- X as useGridClipboard,
575
+ mo as ExcelGrid,
576
+ eo as GridCell,
577
+ I as cn,
578
+ fo as coordToKey,
579
+ bo as formatCurrency,
580
+ ho as getCellsInRange,
581
+ po as getFillTargetCells,
582
+ O as isCellInRange,
583
+ wo as keyToCoord,
584
+ L as normalizeRange,
585
+ xo as parseCurrency,
586
+ X as parseTSV,
587
+ _ as toTSV,
588
+ Q as useGridClipboard,
533
589
  Z as useGridDragFill,
534
- W as useGridSelection
590
+ J as useGridSelection
535
591
  };
@@ -1,2 +1,2 @@
1
- (function(m,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],g):(m=typeof globalThis<"u"?globalThis:m||self,g(m.ReactExcelLite={},m.ReactJsxRuntime,m.React))})(this,(function(m,g,s){"use strict";function T(...l){return l.filter(Boolean).join(" ")}function _(l){return`${l.row}-${l.col}`}function Q(l){const[n,o]=l.split("-").map(Number);return{row:n,col:o}}function W(l,n){if(!l||!n)return l?[l]:[];const o=Math.min(l.row,n.row),c=Math.max(l.row,n.row),a=Math.min(l.col,n.col),y=Math.max(l.col,n.col),i=[];for(let w=o;w<=c;w++)for(let u=a;u<=y;u++)i.push({row:w,col:u});return i}function B(l,n){if(!n.start)return!1;const o=n.end||n.start,c=Math.min(n.start.row,o.row),a=Math.max(n.start.row,o.row),y=Math.min(n.start.col,o.col),i=Math.max(n.start.col,o.col);return l.row>=c&&l.row<=a&&l.col>=y&&l.col<=i}function U(l){return l.split(/\r?\n/).filter(n=>n.trim()).map(n=>n.split(" ").map(o=>o.trim()))}function P(l){return l.map(n=>n.join(" ")).join(`
2
- `)}function I(l){return!l.start||!l.end?l:{start:{row:Math.min(l.start.row,l.end.row),col:Math.min(l.start.col,l.end.col)},end:{row:Math.max(l.start.row,l.end.row),col:Math.max(l.start.col,l.end.col)}}}function X(l,n){if(l.row===n.row&&l.col===n.col)return[];const o=Math.min(l.row,n.row),c=Math.max(l.row,n.row),a=Math.min(l.col,n.col),y=Math.max(l.col,n.col),i=[];for(let w=o;w<=c;w++)for(let u=a;u<=y;u++)w===l.row&&u===l.col||i.push({row:w,col:u});return i}function $(){const[l,n]=s.useState({start:null,end:null}),[o,c]=s.useState(!1),a=s.useCallback(f=>{n({start:f,end:f}),c(!0)},[]),y=s.useCallback(f=>{o&&n(t=>({...t,end:f}))},[o]),i=s.useCallback(()=>{c(!1)},[]),w=s.useCallback(()=>{n({start:null,end:null}),c(!1)},[]),u=s.useCallback(f=>B(f,l),[l]);return s.useEffect(()=>{const f=()=>{o&&c(!1)};return window.addEventListener("mouseup",f),()=>window.removeEventListener("mouseup",f)},[o]),{selection:l,isSelecting:o,isCellSelected:u,handleCellMouseDown:a,handleCellMouseEnter:y,handleMouseUp:i,clearSelection:w,setSelection:n}}function A({selection:l,getValue:n,setValues:o,rowCount:c,colCount:a}){const y=s.useCallback(()=>{const t=I(l);if(!t.start||!t.end)return[];const S=[];for(let k=t.start.row;k<=t.end.row;k++){const b=[];for(let D=t.start.col;D<=t.end.col;D++)b.push(n({row:k,col:D}));S.push(b)}return S},[l,n]),i=s.useCallback(async()=>{const t=y();if(t.length===0)return;const S=P(t);try{await navigator.clipboard.writeText(S)}catch(k){console.error("Clipboard copy failed:",k)}},[y]),w=s.useCallback(async()=>{if(l.start)try{const t=await navigator.clipboard.readText(),S=U(t);if(S.length===0)return;const k=l.start.row,b=l.start.col,D=[];S.forEach((p,M)=>{const d=k+M;d>=c||p.forEach((h,v)=>{const F=b+v;F>=a||D.push({coord:{row:d,col:F},value:h})})}),D.length>0&&o(D)}catch(t){console.error("Clipboard paste failed:",t)}},[l.start,o,c,a]),u=s.useCallback(()=>{const t=I(l);if(!t.start||!t.end)return;const S=[];for(let k=t.start.row;k<=t.end.row;k++)for(let b=t.start.col;b<=t.end.col;b++)S.push({coord:{row:k,col:b},value:""});S.length>0&&o(S)},[l,o]),f=s.useCallback(t=>{(t.ctrlKey||t.metaKey)&&t.key==="c"&&(t.preventDefault(),i()),(t.ctrlKey||t.metaKey)&&t.key==="v"&&(t.preventDefault(),w()),(t.key==="Backspace"||t.key==="Delete")&&(t.preventDefault(),u())},[i,w,u]);return{handleCopy:i,handlePaste:w,handleKeyDown:f}}function Y(l){if(l.trim()==="")return null;const n=Number(l);return isNaN(n)?null:n}function J(l){if(l.length===0)return null;const n=l.map(Y);if(n.some(a=>a===null))return null;const o=n;if(o.length===1)return{numbers:o,diff:0};const c=o[1]-o[0];for(let a=2;a<o.length;a++)if(o[a]-o[a-1]!==c)return{numbers:o,diff:0};return{numbers:o,diff:c}}function O({selection:l,getValue:n,setValues:o}){const[c,a]=s.useState(null),[y,i]=s.useState([]),[w,u]=s.useState(!1),[f,t]=s.useState(null),S=s.useCallback(p=>{a(p),u(!0),i([]),t(null)},[]),k=s.useCallback(p=>{if(!w||!l.start)return;const M=I(l);if(!M.start||!M.end)return;t(p);const d={row:Math.min(M.start.row,p.row),col:Math.min(M.start.col,p.col)},h={row:Math.max(M.end.row,p.row),col:Math.max(M.end.col,p.col)},v=[];for(let F=d.row;F<=h.row;F++)for(let r=d.col;r<=h.col;r++)F>=M.start.row&&F<=M.end.row&&r>=M.start.col&&r<=M.end.col||v.push({row:F,col:r});i(v)},[w,l]),b=s.useCallback(()=>{if(!l.start||y.length===0||!f){a(null),i([]),u(!1),t(null);return}const p=I(l);if(!p.start||!p.end){a(null),i([]),u(!1),t(null);return}const M=[],d=p.start,h=p.end,v=h.row-d.row+1,F=h.col-d.col+1;y.forEach(r=>{let G,z;if(r.row<d.row){const E=d.row-r.row;G=h.row-(E-1)%v}else if(r.row>h.row){const E=r.row-h.row;G=d.row+(E-1)%v}else G=r.row;if(r.col<d.col){const E=d.col-r.col;z=h.col-(E-1)%F}else if(r.col>h.col){const E=r.col-h.col;z=d.col+(E-1)%F}else z=r.col;let K=n({row:G,col:z});if(r.row!==G&&r.col>=d.col&&r.col<=h.col){const E=[];for(let e=d.row;e<=h.row;e++)E.push(n({row:e,col:r.col}));const x=J(E);if(x&&x.diff!==0){if(r.row>h.row){const e=r.row-h.row;K=String(x.numbers[x.numbers.length-1]+x.diff*e)}else if(r.row<d.row){const e=d.row-r.row;K=String(x.numbers[0]-x.diff*e)}}}if(r.col!==z&&r.row>=d.row&&r.row<=h.row){const E=[];for(let e=d.col;e<=h.col;e++)E.push(n({row:r.row,col:e}));const x=J(E);if(x&&x.diff!==0){if(r.col>h.col){const e=r.col-h.col;K=String(x.numbers[x.numbers.length-1]+x.diff*e)}else if(r.col<d.col){const e=d.col-r.col;K=String(x.numbers[0]-x.diff*e)}}}M.push({coord:r,value:K})}),M.length>0&&o(M),a(null),i([]),u(!1),t(null)},[l,y,f,n,o]),D=s.useCallback(p=>y.some(M=>M.row===p.row&&M.col===p.col),[y]);return s.useEffect(()=>{const p=()=>{w&&b()};return window.addEventListener("mouseup",p),()=>window.removeEventListener("mouseup",p)},[w,b]),{fillSource:c,fillTargets:y,isDraggingFill:w,isFillTarget:D,handleFillHandleMouseDown:S,handleCellMouseEnterForFill:k,handleFillMouseUp:b}}function V({coord:l,value:n,isSelected:o,isFillTarget:c,showFillHandle:a,onMouseDown:y,onMouseEnter:i,onChange:w,onFillHandleMouseDown:u,styles:f}){const t=b=>{w(l,b.target.value)},S=b=>{b.target.classList.contains("fill-handle")||y(l)},k=b=>{b.stopPropagation(),b.preventDefault(),u(l)};return g.jsxs("td",{className:T("relative border border-gray-300 p-0",f?.cell,o&&(f?.selected??"bg-blue-100 ring-2 ring-inset ring-blue-500"),c&&(f?.fillTarget??"bg-blue-50")),onMouseDown:S,onMouseEnter:()=>i(l),children:[g.jsx("input",{type:"text",value:n,onChange:t,className:T("w-full h-full px-1 py-1 text-right text-xs bg-transparent outline-none cursor-cell",o&&"bg-transparent")}),a&&g.jsx("div",{className:T("fill-handle absolute -bottom-0.5 -right-0.5 w-2 h-2 cursor-crosshair z-20",f?.fillHandle??"bg-blue-500"),onMouseDown:k})]})}function Z({data:l,onChange:n,rowHeaders:o,colHeaders:c,className:a,rowHeaderTitle:y="",styles:i}){const w=s.useRef(null),u=l.length,f=s.useMemo(()=>c?c.reduce((e,C)=>e+C.headers.length,0):l[0]?.length??0,[c,l]),t=s.useMemo(()=>c?c.flatMap(e=>e.headers):[],[c]),S=s.useCallback(e=>e.row<0||e.row>=u||e.col<0||e.col>=f?"":l[e.row]?.[e.col]??"",[l,u,f]),k=s.useCallback((e,C)=>{const N=l.map((R,j)=>j===e.row?R.map((L,q)=>q===e.col?C:L):R);n(N)},[l,n]),b=s.useCallback(e=>{if(e.length===0)return;const C=l.map(N=>[...N]);e.forEach(({coord:N,value:R})=>{N.row>=0&&N.row<u&&N.col>=0&&N.col<f&&(C[N.row][N.col]=R)}),n(C)},[l,n,u,f]),{selection:D,isSelecting:p,isCellSelected:M,handleCellMouseDown:d,handleCellMouseEnter:h}=$(),{handleKeyDown:v}=A({selection:D,getValue:S,setValues:b,rowCount:u,colCount:f}),{isDraggingFill:F,isFillTarget:r,handleFillHandleMouseDown:G,handleCellMouseEnterForFill:z}=O({selection:D,getValue:S,setValues:b}),K=s.useCallback(e=>{F?z(e):p&&h(e)},[F,p,z,h]),E=s.useCallback((e,C)=>{k(e,C)},[k]),x=s.useCallback(e=>{if(!D.start)return!1;const C=I(D);return!C.start||!C.end?!1:e.row===C.end.row&&e.col===C.end.col},[D]);return g.jsx("div",{ref:w,className:T("outline-none overflow-x-auto",a),tabIndex:0,onKeyDown:v,children:g.jsxs("table",{className:"border-collapse text-xs select-none",children:[g.jsxs("thead",{children:[c&&g.jsxs("tr",{children:[o&&g.jsx("th",{className:T("sticky left-0 z-10 bg-gray-100 border border-gray-300 px-2 py-1.5 text-center font-medium",i?.rowHeader),children:y}),c.map((e,C)=>g.jsx("th",{colSpan:e.headers.length,className:T("bg-blue-100 border border-gray-300 px-1 py-1.5 text-center font-medium text-blue-700",i?.colGroup,e.className),children:e.label},C))]}),c&&g.jsxs("tr",{children:[o&&g.jsx("th",{className:T("sticky left-0 z-10 bg-gray-100 border border-gray-300 px-2 py-1",i?.rowHeader)}),t.map(e=>g.jsx("th",{className:T("bg-gray-50 border border-gray-300 px-1 py-1 text-center font-medium text-[11px]",i?.colHeader,e.className),title:e.description,children:e.label},e.key))]})]}),g.jsx("tbody",{children:l.map((e,C)=>g.jsxs("tr",{children:[o&&o[C]&&g.jsx("td",{className:T("sticky left-0 z-10 bg-gray-100 border border-gray-300 px-1 py-1.5 text-center font-medium",i?.rowHeader,o[C].className),title:o[C].description,children:o[C].label}),e.map((N,R)=>{const j={row:C,col:R},L=M(j),q=r(j),nl=x(j);return g.jsx(V,{coord:j,value:S(j),isSelected:L,isFillTarget:q,showFillHandle:nl&&!F,onMouseDown:d,onMouseEnter:K,onChange:E,onFillHandleMouseDown:G,styles:i},R)})]},C))})]})})}function H(l){const n=typeof l=="string"?parseFloat(l.replace(/,/g,"")):l;return isNaN(n)?"0":new Intl.NumberFormat("ko-KR").format(n)}function ll(l){const n=parseInt(l.replace(/,/g,""),10);return isNaN(n)?0:n}m.ExcelGrid=Z,m.GridCell=V,m.cn=T,m.coordToKey=_,m.formatCurrency=H,m.getCellsInRange=W,m.getFillTargetCells=X,m.isCellInRange=B,m.keyToCoord=Q,m.normalizeRange=I,m.parseCurrency=ll,m.parseTSV=U,m.toTSV=P,m.useGridClipboard=A,m.useGridDragFill=O,m.useGridSelection=$,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(m,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],g):(m=typeof globalThis<"u"?globalThis:m||self,g(m.ReactExcelLite={},m.ReactJsxRuntime,m.React))})(this,(function(m,g,r){"use strict";function K(...l){return l.filter(Boolean).join(" ")}function V(l){return`${l.row}-${l.col}`}function X(l){const[o,e]=l.split("-").map(Number);return{row:o,col:e}}function _(l,o){if(!l||!o)return l?[l]:[];const e=Math.min(l.row,o.row),c=Math.max(l.row,o.row),f=Math.min(l.col,o.col),S=Math.max(l.col,o.col),a=[];for(let p=e;p<=c;p++)for(let d=f;d<=S;d++)a.push({row:p,col:d});return a}function A(l,o){if(!o.start)return!1;const e=o.end||o.start,c=Math.min(o.start.row,e.row),f=Math.max(o.start.row,e.row),S=Math.min(o.start.col,e.col),a=Math.max(o.start.col,e.col);return l.row>=c&&l.row<=f&&l.col>=S&&l.col<=a}function U(l){return l.split(/\r?\n/).filter(o=>o.trim()).map(o=>o.split(" ").map(e=>e.trim()))}function H(l){return l.map(o=>o.join(" ")).join(`
2
+ `)}function j(l){return!l.start||!l.end?l:{start:{row:Math.min(l.start.row,l.end.row),col:Math.min(l.start.col,l.end.col)},end:{row:Math.max(l.start.row,l.end.row),col:Math.max(l.start.col,l.end.col)}}}function Q(l,o){if(l.row===o.row&&l.col===o.col)return[];const e=Math.min(l.row,o.row),c=Math.max(l.row,o.row),f=Math.min(l.col,o.col),S=Math.max(l.col,o.col),a=[];for(let p=e;p<=c;p++)for(let d=f;d<=S;d++)p===l.row&&d===l.col||a.push({row:p,col:d});return a}function P(){const[l,o]=r.useState({start:null,end:null}),[e,c]=r.useState(!1),f=r.useCallback(u=>{o({start:u,end:u}),c(!0)},[]),S=r.useCallback(u=>{e&&o(t=>({...t,end:u}))},[e]),a=r.useCallback(()=>{c(!1)},[]),p=r.useCallback(()=>{o({start:null,end:null}),c(!1)},[]),d=r.useCallback(u=>A(u,l),[l]);return r.useEffect(()=>{const u=()=>{e&&c(!1)};return window.addEventListener("mouseup",u),()=>window.removeEventListener("mouseup",u)},[e]),{selection:l,isSelecting:e,isCellSelected:d,handleCellMouseDown:f,handleCellMouseEnter:S,handleMouseUp:a,clearSelection:p,setSelection:o}}function W({selection:l,getValue:o,setValues:e,rowCount:c,colCount:f}){const S=r.useCallback(()=>{const t=j(l);if(!t.start||!t.end)return[];const y=[];for(let M=t.start.row;M<=t.end.row;M++){const x=[];for(let k=t.start.col;k<=t.end.col;k++)x.push(o({row:M,col:k}));y.push(x)}return y},[l,o]),a=r.useCallback(async()=>{const t=S();if(t.length===0)return;const y=H(t);try{await navigator.clipboard.writeText(y)}catch(M){console.error("Clipboard copy failed:",M)}},[S]),p=r.useCallback(async()=>{if(l.start)try{const t=await navigator.clipboard.readText(),y=U(t);if(y.length===0)return;const M=l.start.row,x=l.start.col,k=[];y.forEach((h,b)=>{const w=M+b;w>=c||h.forEach((i,v)=>{const F=x+v;F>=f||k.push({coord:{row:w,col:F},value:i})})}),k.length>0&&e(k)}catch(t){console.error("Clipboard paste failed:",t)}},[l.start,e,c,f]),d=r.useCallback(()=>{const t=j(l);if(!t.start||!t.end)return;const y=[];for(let M=t.start.row;M<=t.end.row;M++)for(let x=t.start.col;x<=t.end.col;x++)y.push({coord:{row:M,col:x},value:""});y.length>0&&e(y)},[l,e]),u=r.useCallback(t=>{(t.ctrlKey||t.metaKey)&&t.key==="c"&&(t.preventDefault(),a()),(t.ctrlKey||t.metaKey)&&t.key==="v"&&(t.preventDefault(),p()),(t.key==="Backspace"||t.key==="Delete")&&(t.preventDefault(),d())},[a,p,d]);return{handleCopy:a,handlePaste:p,handleKeyDown:u}}function Y(l){if(l.trim()==="")return null;const o=Number(l);return isNaN(o)?null:o}function O(l){if(l.length===0)return null;const o=l.map(Y);if(o.some(f=>f===null))return null;const e=o;if(e.length===1)return{numbers:e,diff:0};const c=e[1]-e[0];for(let f=2;f<e.length;f++)if(e[f]-e[f-1]!==c)return{numbers:e,diff:0};return{numbers:e,diff:c}}function $({selection:l,getValue:o,setValues:e}){const[c,f]=r.useState(null),[S,a]=r.useState([]),[p,d]=r.useState(!1),[u,t]=r.useState(null),y=r.useCallback(h=>{f(h),d(!0),a([]),t(null)},[]),M=r.useCallback(h=>{if(!p||!l.start)return;const b=j(l);if(!b.start||!b.end)return;t(h);const w={row:Math.min(b.start.row,h.row),col:Math.min(b.start.col,h.col)},i={row:Math.max(b.end.row,h.row),col:Math.max(b.end.col,h.col)},v=[];for(let F=w.row;F<=i.row;F++)for(let s=w.col;s<=i.col;s++)F>=b.start.row&&F<=b.end.row&&s>=b.start.col&&s<=b.end.col||v.push({row:F,col:s});a(v)},[p,l]),x=r.useCallback(()=>{if(!l.start||S.length===0||!u){f(null),a([]),d(!1),t(null);return}const h=j(l);if(!h.start||!h.end){f(null),a([]),d(!1),t(null);return}const b=[],w=h.start,i=h.end,v=i.row-w.row+1,F=i.col-w.col+1;S.forEach(s=>{let N,G;if(s.row<w.row){const E=w.row-s.row;N=i.row-(E-1)%v}else if(s.row>i.row){const E=s.row-i.row;N=w.row+(E-1)%v}else N=s.row;if(s.col<w.col){const E=w.col-s.col;G=i.col-(E-1)%F}else if(s.col>i.col){const E=s.col-i.col;G=w.col+(E-1)%F}else G=s.col;let B=o({row:N,col:G});if(s.row!==N&&s.col>=w.col&&s.col<=i.col){const E=[];for(let n=w.row;n<=i.row;n++)E.push(o({row:n,col:s.col}));const D=O(E);if(D&&D.diff!==0){if(s.row>i.row){const n=s.row-i.row;B=String(D.numbers[D.numbers.length-1]+D.diff*n)}else if(s.row<w.row){const n=w.row-s.row;B=String(D.numbers[0]-D.diff*n)}}}if(s.col!==G&&s.row>=w.row&&s.row<=i.row){const E=[];for(let n=w.col;n<=i.col;n++)E.push(o({row:s.row,col:n}));const D=O(E);if(D&&D.diff!==0){if(s.col>i.col){const n=s.col-i.col;B=String(D.numbers[D.numbers.length-1]+D.diff*n)}else if(s.col<w.col){const n=w.col-s.col;B=String(D.numbers[0]-D.diff*n)}}}b.push({coord:s,value:B})}),b.length>0&&e(b),f(null),a([]),d(!1),t(null)},[l,S,u,o,e]),k=r.useCallback(h=>S.some(b=>b.row===h.row&&b.col===h.col),[S]);return r.useEffect(()=>{const h=()=>{p&&x()};return window.addEventListener("mouseup",h),()=>window.removeEventListener("mouseup",h)},[p,x]),{fillSource:c,fillTargets:S,isDraggingFill:p,isFillTarget:k,handleFillHandleMouseDown:y,handleCellMouseEnterForFill:M,handleFillMouseUp:x}}const Z={position:"relative",border:"1px solid #d1d5db",padding:0},ll={width:"100%",height:"100%",paddingLeft:"4px",paddingRight:"4px",paddingTop:"4px",paddingBottom:"4px",textAlign:"right",fontSize:"12px",backgroundColor:"transparent",outline:"none",cursor:"cell"},ol={position:"absolute",bottom:"-2px",right:"-2px",width:"8px",height:"8px",cursor:"crosshair",zIndex:20,backgroundColor:"#3b82f6"},nl={backgroundColor:"#dbeafe",outline:"2px solid #3b82f6",outlineOffset:"-2px"},el={backgroundColor:"#eff6ff"};function J({coord:l,value:o,isSelected:e,isFillTarget:c,showFillHandle:f,onMouseDown:S,onMouseEnter:a,onChange:p,onFillHandleMouseDown:d,styles:u}){const t=i=>{p(l,i.target.value)},y=i=>{i.target.classList.contains("fill-handle")||S(l)},M=i=>{i.stopPropagation(),i.preventDefault(),d(l)},x=!!u?.selected,k=!!u?.fillTarget,h=!!u?.fillHandle,b={...Z,...e&&!x?nl:{},...c&&!k?el:{}},w={...ol,...h?{backgroundColor:void 0}:{}};return g.jsxs("td",{className:K(u?.cell,e&&u?.selected,c&&u?.fillTarget),style:b,onMouseDown:y,onMouseEnter:()=>a(l),children:[g.jsx("input",{type:"text",value:o,onChange:t,style:ll}),f&&g.jsx("div",{className:K("fill-handle",u?.fillHandle),style:w,onMouseDown:M})]})}const tl={outline:"none",overflowX:"auto"},sl={borderCollapse:"collapse",fontSize:"12px",userSelect:"none"},I={position:"sticky",left:0,zIndex:10,backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",padding:"6px 8px",textAlign:"center",fontWeight:500},rl={backgroundColor:"#dbeafe",border:"1px solid #d1d5db",padding:"6px 4px",textAlign:"center",fontWeight:500,color:"#1d4ed8"},cl={backgroundColor:"#f9fafb",border:"1px solid #d1d5db",padding:"4px",textAlign:"center",fontWeight:500,fontSize:"11px"};function il({data:l,onChange:o,rowHeaders:e,colHeaders:c,className:f,rowHeaderTitle:S="",styles:a}){const p=r.useRef(null),d=l.length,u=r.useMemo(()=>c?c.reduce((n,C)=>n+C.headers.length,0):l[0]?.length??0,[c,l]),t=r.useMemo(()=>c?c.flatMap(n=>n.headers):[],[c]),y=r.useCallback(n=>n.row<0||n.row>=d||n.col<0||n.col>=u?"":l[n.row]?.[n.col]??"",[l,d,u]),M=r.useCallback((n,C)=>{const T=l.map((z,R)=>R===n.row?z.map((L,q)=>q===n.col?C:L):z);o(T)},[l,o]),x=r.useCallback(n=>{if(n.length===0)return;const C=l.map(T=>[...T]);n.forEach(({coord:T,value:z})=>{T.row>=0&&T.row<d&&T.col>=0&&T.col<u&&(C[T.row][T.col]=z)}),o(C)},[l,o,d,u]),{selection:k,isSelecting:h,isCellSelected:b,handleCellMouseDown:w,handleCellMouseEnter:i}=P(),{handleKeyDown:v}=W({selection:k,getValue:y,setValues:x,rowCount:d,colCount:u}),{isDraggingFill:F,isFillTarget:s,handleFillHandleMouseDown:N,handleCellMouseEnterForFill:G}=$({selection:k,getValue:y,setValues:x}),B=r.useCallback(n=>{F?G(n):h&&i(n)},[F,h,G,i]),E=r.useCallback((n,C)=>{M(n,C)},[M]),D=r.useCallback(n=>{if(!k.start)return!1;const C=j(k);return!C.start||!C.end?!1:n.row===C.end.row&&n.col===C.end.col},[k]);return g.jsx("div",{ref:p,className:f,style:tl,tabIndex:0,onKeyDown:v,children:g.jsxs("table",{style:sl,children:[g.jsxs("thead",{children:[c&&g.jsxs("tr",{children:[e&&g.jsx("th",{className:a?.rowHeader,style:I,children:S}),c.map((n,C)=>g.jsx("th",{colSpan:n.headers.length,className:K(a?.colGroup,n.className),style:rl,children:n.label},C))]}),c&&g.jsxs("tr",{children:[e&&g.jsx("th",{className:a?.rowHeader,style:I}),t.map(n=>g.jsx("th",{className:K(a?.colHeader,n.className),style:cl,title:n.description,children:n.label},n.key))]})]}),g.jsx("tbody",{children:l.map((n,C)=>g.jsxs("tr",{children:[e&&e[C]&&g.jsx("td",{className:K(a?.rowHeader,e[C].className),style:I,title:e[C].description,children:e[C].label}),n.map((T,z)=>{const R={row:C,col:z},L=b(R),q=s(R),fl=D(R);return g.jsx(J,{coord:R,value:y(R),isSelected:L,isFillTarget:q,showFillHandle:fl&&!F,onMouseDown:w,onMouseEnter:B,onChange:E,onFillHandleMouseDown:N,styles:a},z)})]},C))})]})})}function al(l){const o=typeof l=="string"?parseFloat(l.replace(/,/g,"")):l;return isNaN(o)?"0":new Intl.NumberFormat("ko-KR").format(o)}function ul(l){const o=parseInt(l.replace(/,/g,""),10);return isNaN(o)?0:o}m.ExcelGrid=il,m.GridCell=J,m.cn=K,m.coordToKey=V,m.formatCurrency=al,m.getCellsInRange=_,m.getFillTargetCells=Q,m.isCellInRange=A,m.keyToCoord=X,m.normalizeRange=j,m.parseCurrency=ul,m.parseTSV=U,m.toTSV=H,m.useGridClipboard=W,m.useGridDragFill=$,m.useGridSelection=P,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
package/dist/types.d.ts CHANGED
@@ -43,21 +43,22 @@ export interface RowHeaderGroup {
43
43
  }
44
44
  /**
45
45
  * Grid styles configuration
46
+ * All values are CSS class strings (e.g., Tailwind classes, CSS modules, or plain CSS classes)
46
47
  */
47
48
  export interface GridStyles {
48
- /** Data cell style */
49
+ /** CSS class for data cells */
49
50
  cell?: string;
50
- /** Selected cell style */
51
+ /** CSS class for selected cells (overrides default blue selection style) */
51
52
  selected?: string;
52
- /** Fill target cell style (when dragging fill handle) */
53
+ /** CSS class for fill target cells when dragging fill handle (overrides default light blue) */
53
54
  fillTarget?: string;
54
- /** Fill handle style (bottom-right corner handle) */
55
+ /** CSS class for fill handle at bottom-right corner (overrides default blue square) */
55
56
  fillHandle?: string;
56
- /** Column group header style */
57
+ /** CSS class for column group headers */
57
58
  colGroup?: string;
58
- /** Column header style */
59
+ /** CSS class for individual column headers */
59
60
  colHeader?: string;
60
- /** Row header style */
61
+ /** CSS class for row headers */
61
62
  rowHeader?: string;
62
63
  }
63
64
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,CAAC;IACrC,mDAAmD;IACnD,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,sCAAsC;IACtC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,qBAAqB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,kBAAkB;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CAAC,CAAC;CAC9E"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,CAAC;IACrC,mDAAmD;IACnD,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,sCAAsC;IACtC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,qBAAqB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,kBAAkB;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CAAC,CAAC;CAC9E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-excel-lite",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A lightweight, Excel-like editable grid component for React with cell selection, copy/paste, auto-fill with arithmetic sequence detection, and customizable styling.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,8 +23,7 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=18.0.0",
26
- "react-dom": ">=18.0.0",
27
- "tailwindcss": ">=3.0.0"
26
+ "react-dom": ">=18.0.0"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@vitejs/plugin-react": "^5.1.1",