intable 0.0.1 → 0.0.3

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.
@@ -16,44 +16,6 @@ const CellSelectionPlugin = {
16
16
  return store.props.data.slice(y1, y2 + 1);
17
17
  } }),
18
18
  rewriteProps: {
19
- Th: ({ Th }, { store }) => (o) => {
20
- const clazz = createMemo(() => {
21
- const { start, end } = store.selected;
22
- return inrange(o.x, ...[start[0], end[0]].sort((a, b) => a - b)) ? "col-range-highlight" : "";
23
- });
24
- const mo = combineProps(o, { get class() {
25
- return clazz();
26
- } });
27
- return createComponent(Th, mergeProps(mo, { get children() {
28
- return [memo(() => mo.children), memo(() => memo(() => !!clazz())() && _tmpl$())];
29
- } }));
30
- },
31
- Td: ({ Td }, { store }) => (o) => {
32
- const clazz = createMemo(() => {
33
- let clazz$1 = "";
34
- const { xs, ys } = store.cellSelectionRect();
35
- const inx = inrange(o.x, xs[0], xs[1]);
36
- const iny = inrange(o.y, ys[0], ys[1]);
37
- if (inx && iny) {
38
- clazz$1 += "range-selected ";
39
- if (o.x == xs[0]) clazz$1 += "range-selected-l ";
40
- if (o.x == xs[1]) clazz$1 += "range-selected-r ";
41
- if (o.y == ys[0]) clazz$1 += "range-selected-t ";
42
- if (o.y == ys[1]) clazz$1 += "range-selected-b ";
43
- }
44
- if (o.x == 0 && iny) clazz$1 += "row-range-highlight ";
45
- return clazz$1;
46
- });
47
- const mo = combineProps(o, {
48
- get class() {
49
- return clazz();
50
- },
51
- tabindex: -1
52
- });
53
- return createComponent(Td, mergeProps(mo, { get children() {
54
- return [memo(() => mo.children), memo(() => memo(() => !!clazz())() && _tmpl$())];
55
- } }));
56
- },
57
19
  Table: ({ Table }, { store }) => (o) => {
58
20
  const { props } = useContext(Ctx);
59
21
  store.cellSelectionRect ??= createMemo(() => {
@@ -65,53 +27,56 @@ const CellSelectionPlugin = {
65
27
  ys
66
28
  };
67
29
  });
68
- usePointerDrag(() => store.table, { start(e, move, end) {
69
- batch(() => {
70
- const findCell = (e$1) => e$1.composedPath().find((e$2) => e$2.tagName == "TH" || e$2.tagName == "TD");
71
- const getXY = (cell$1) => [cell$1.getAttribute("x"), cell$1.getAttribute("y")];
72
- const cell = findCell(e);
73
- if (!cell) return;
74
- if (e.buttons != 1 && cell.classList.contains("range-selected")) return;
75
- if (cell.tagName == "TH") {
76
- const [x, y] = getXY(cell);
77
- if (x == null) return;
78
- store.selected.start = [+x, 0];
79
- store.selected.end = [+x, Infinity];
80
- move((e$1) => {
81
- const cell$1 = findCell(e$1);
82
- if (!cell$1) return;
83
- const [x$1, y$1] = getXY(cell$1);
84
- if (x$1 == null) return;
85
- store.selected.end = [+x$1, Infinity];
86
- });
87
- }
88
- if (cell.classList.contains("index")) {
89
- const [x, y] = getXY(cell);
90
- if (x == null || y == null) return;
91
- store.selected.start = [0, +y];
92
- store.selected.end = [Infinity, +y];
93
- move((e$1) => {
94
- const cell$1 = findCell(e$1);
95
- if (!cell$1) return;
96
- const [x$1, y$1] = getXY(cell$1);
97
- if (x$1 == null || y$1 == null) return;
98
- store.selected.end = [Infinity, +y$1];
99
- });
100
- } else if (cell.tagName == "TD") {
101
- const [x, y] = getXY(cell);
102
- if (x == null || y == null) return;
103
- store.selected.start = [+x, +y];
104
- store.selected.end = [...store.selected.start];
105
- move((e$1) => {
106
- const cell$1 = findCell(e$1);
107
- if (!cell$1) return;
108
- const [x$1, y$1] = getXY(cell$1);
109
- if (x$1 == null || y$1 == null) return;
110
- store.selected.end = [+x$1, +y$1];
111
- });
112
- }
113
- });
114
- } });
30
+ usePointerDrag(() => store.table, {
31
+ preventDefault: false,
32
+ start(e, move, end) {
33
+ batch(() => {
34
+ const findCell = (e$1) => e$1.composedPath().find((e$2) => e$2.tagName == "TH" || e$2.tagName == "TD");
35
+ const getXY = (cell$1) => [cell$1.getAttribute("x"), cell$1.getAttribute("y")];
36
+ const cell = findCell(e);
37
+ if (!cell) return;
38
+ if (e.buttons != 1 && cell.classList.contains("range-selected")) return;
39
+ if (cell.tagName == "TH") {
40
+ const [x, y] = getXY(cell);
41
+ if (x == null) return;
42
+ store.selected.start = [+x, 0];
43
+ store.selected.end = [+x, Infinity];
44
+ move((e$1) => {
45
+ const cell$1 = findCell(e$1);
46
+ if (!cell$1) return;
47
+ const [x$1, y$1] = getXY(cell$1);
48
+ if (x$1 == null) return;
49
+ store.selected.end = [+x$1, Infinity];
50
+ });
51
+ }
52
+ if (cell.classList.contains("index")) {
53
+ const [x, y] = getXY(cell);
54
+ if (x == null || y == null) return;
55
+ store.selected.start = [0, +y];
56
+ store.selected.end = [Infinity, +y];
57
+ move((e$1) => {
58
+ const cell$1 = findCell(e$1);
59
+ if (!cell$1) return;
60
+ const [x$1, y$1] = getXY(cell$1);
61
+ if (x$1 == null || y$1 == null) return;
62
+ store.selected.end = [Infinity, +y$1];
63
+ });
64
+ } else if (cell.tagName == "TD") {
65
+ const [x, y] = getXY(cell);
66
+ if (x == null || y == null) return;
67
+ store.selected.start = [+x, +y];
68
+ store.selected.end = [...store.selected.start];
69
+ move((e$1) => {
70
+ const cell$1 = findCell(e$1);
71
+ if (!cell$1) return;
72
+ const [x$1, y$1] = getXY(cell$1);
73
+ if (x$1 == null || y$1 == null) return;
74
+ store.selected.end = [+x$1, +y$1];
75
+ });
76
+ }
77
+ });
78
+ }
79
+ });
115
80
  useTinykeys(() => store.table, {
116
81
  "ArrowLeft": () => {
117
82
  const { start, end } = store.selected;
@@ -143,7 +108,46 @@ const CellSelectionPlugin = {
143
108
  cell?.scrollIntoViewIfNeeded(false);
144
109
  cell?.focus();
145
110
  };
111
+ o = combineProps({ class: "select-none" }, o);
146
112
  return createComponent(Table, o);
113
+ },
114
+ Th: ({ Th }, { store }) => (o) => {
115
+ const clazz = createMemo(() => {
116
+ const { start, end } = store.selected;
117
+ return inrange(o.x, ...[start[0], end[0]].sort((a, b) => a - b)) ? "col-range-highlight" : "";
118
+ });
119
+ const mo = combineProps(o, { get class() {
120
+ return clazz();
121
+ } });
122
+ return createComponent(Th, mergeProps(mo, { get children() {
123
+ return [memo(() => mo.children), memo(() => memo(() => !!clazz())() && _tmpl$())];
124
+ } }));
125
+ },
126
+ Td: ({ Td }, { store }) => (o) => {
127
+ const clazz = createMemo(() => {
128
+ let clazz$1 = "";
129
+ const { xs, ys } = store.cellSelectionRect();
130
+ const inx = inrange(o.x, xs[0], xs[1]);
131
+ const iny = inrange(o.y, ys[0], ys[1]);
132
+ if (inx && iny) {
133
+ clazz$1 += "range-selected ";
134
+ if (o.x == xs[0]) clazz$1 += "range-selected-l ";
135
+ if (o.x == xs[1]) clazz$1 += "range-selected-r ";
136
+ if (o.y == ys[0]) clazz$1 += "range-selected-t ";
137
+ if (o.y == ys[1]) clazz$1 += "range-selected-b ";
138
+ }
139
+ if (o.x == 0 && iny) clazz$1 += "row-range-highlight ";
140
+ return clazz$1;
141
+ });
142
+ const mo = combineProps(o, {
143
+ get class() {
144
+ return clazz();
145
+ },
146
+ tabindex: -1
147
+ });
148
+ return createComponent(Td, mergeProps(mo, { get children() {
149
+ return [memo(() => mo.children), memo(() => memo(() => !!clazz())() && _tmpl$())];
150
+ } }));
147
151
  }
148
152
  }
149
153
  };
@@ -1,8 +1,8 @@
1
1
  import { useTinykeys } from "../hooks/index.js";
2
2
  import { createComponent } from "solid-js/web";
3
3
  import { unwrap } from "solid-js/store";
4
- import { isEqual, keyBy } from "es-toolkit";
5
4
  import { combineProps } from "@solid-primitives/props";
5
+ import { isEqual, keyBy } from "es-toolkit";
6
6
  import { createLazyMemo } from "@solid-primitives/memo";
7
7
  import { v4 } from "uuid";
8
8
  import { diffArrays } from "diff";
@@ -0,0 +1,14 @@
1
+ import { type Plugin } from "../index";
2
+ declare module '../index' {
3
+ interface TableProps {
4
+ colDrag: boolean;
5
+ rowDrag: boolean;
6
+ }
7
+ interface TableColumn {
8
+ }
9
+ interface TableStore {
10
+ }
11
+ interface Commands {
12
+ }
13
+ }
14
+ export declare const DragPlugin: Plugin;
@@ -0,0 +1,63 @@
1
+ import { useSort } from "../hooks/useSort.js";
2
+ import { delay } from "es-toolkit";
3
+ import { isMatch } from "es-toolkit/compat";
4
+ const DragPlugin = {
5
+ rewriteProps: {
6
+ colDrag: ({ colDrag = false }) => colDrag,
7
+ rowDrag: ({ rowDrag = false }) => rowDrag
8
+ },
9
+ onMount(store) {
10
+ const colDrag = useSort(() => store.scroll_el, {
11
+ get enable() {
12
+ return store.props?.colDrag;
13
+ },
14
+ guideLine: { class: "col__guide-line" },
15
+ draggable: (el) => ((x, y) => el.tagName == "TH" && isMatch(store.selected, { start: [x, 0] }) && !store.props?.columns[x][store.internal] && store.thead.contains(el) && delay(300).then(() => true))(+el.getAttribute("x"), +el.getAttribute("y")),
16
+ dragover: (el) => el.tagName == "THEAD",
17
+ children: (el) => [...colDrag.drag.parentElement.children].filter((e) => !store.props?.columns[e.getAttribute("x")][store.internal]),
18
+ dragend: onColDragend
19
+ });
20
+ const rowDrag = useSort(() => store.scroll_el, {
21
+ get enable() {
22
+ return store.props?.rowDrag;
23
+ },
24
+ guideLine: { class: "row__guide-line" },
25
+ draggable: (el) => ((x, y) => el.tagName == "TD" && isMatch(store.selected, { start: [0, y] }) && x == 0 && !store.props?.data[y][store.internal] && store.tbody.contains(el) && delay(300).then(() => true))(+el.getAttribute("x"), +el.getAttribute("y")),
26
+ dragover: (el) => el.tagName == "TBODY",
27
+ children: (el) => [...rowDrag.over.children].filter((e) => !store.props.data[e.getAttribute("y")][store.internal]),
28
+ dragend: onRowDragend
29
+ });
30
+ async function onColDragend() {
31
+ if (colDrag.drag == colDrag.rel) return;
32
+ const [cols, rawCols] = [store.props.columns, [...store.rawProps.columns || []]];
33
+ const col1 = ((col) => col[store.raw] ?? col)(cols[colDrag.drag.getAttribute("x")]);
34
+ const col2 = ((col) => col[store.raw] ?? col)(cols[colDrag.rel.getAttribute("x")]);
35
+ const i1 = rawCols.indexOf(col1);
36
+ const i2 = rawCols.indexOf(col2);
37
+ if (i1 < 0 || i2 < 0) return;
38
+ rawCols[i1].fixed = rawCols[i2].fixed;
39
+ rawCols.splice(i2 - (i1 > i2 ? 0 : 1) + (colDrag.type == "before" ? 0 : 1), 0, rawCols.splice(i1, 1)[0]);
40
+ store.props.onColumnsChange?.(rawCols);
41
+ await Promise.resolve();
42
+ const i = store.props.columns.findIndex((e) => e == col1 || e[store.raw] == col1);
43
+ if (i < 0) return;
44
+ store.selected.start[0] = store.selected.end[0] = i;
45
+ }
46
+ async function onRowDragend() {
47
+ if (rowDrag.drag == rowDrag.rel) return;
48
+ const [data, rawData] = [store.props.data, [...store.rawProps.data || []]];
49
+ const data1 = ((row) => row[store.raw] ?? row)(data[rowDrag.drag.getAttribute("y")]);
50
+ const data2 = ((row) => row[store.raw] ?? row)(data[rowDrag.rel.getAttribute("y")]);
51
+ const i1 = rawData.indexOf(data1);
52
+ const i2 = rawData.indexOf(data2);
53
+ if (i1 < 0 || i2 < 0) return;
54
+ rawData.splice(i2 - (i1 > i2 ? 0 : 1) + (rowDrag.type == "before" ? 0 : 1), 0, rawData.splice(i1, 1)[0]);
55
+ store.props.onDataChange?.(rawData);
56
+ await Promise.resolve();
57
+ const i = store.props.data.findIndex((e) => e == data1 || e[store.raw] == data1);
58
+ if (i < 0) return;
59
+ store.selected.start[1] = store.selected.end[1] = i;
60
+ }
61
+ }
62
+ };
63
+ export { DragPlugin };
@@ -8,7 +8,6 @@ declare module '../index' {
8
8
  editor?: string | Editor;
9
9
  editorProps?: any;
10
10
  editorPopup?: boolean;
11
- editOnInput?: boolean;
12
11
  }
13
12
  interface TableStore {
14
13
  editors: {
@@ -4,8 +4,8 @@ import { Ctx } from "../index.js";
4
4
  import { createComponent, delegateEvents, effect, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
5
5
  import { createComputed, createEffect, createMemo, createRoot, createSignal, on, onCleanup, useContext } from "solid-js";
6
6
  import { createMutable } from "solid-js/store";
7
- import { delay } from "es-toolkit";
8
7
  import { combineProps } from "@solid-primitives/props";
8
+ import { delay } from "es-toolkit";
9
9
  import { createAsyncMemo } from "@solid-primitives/memo";
10
10
  var _tmpl$ = /* @__PURE__ */ template(`<input style=position:absolute;margin-top:1em;width:0;height:0;pointer-events:none;opacity:0>`), _tmpl$2 = /* @__PURE__ */ template(`<div class=in-cell-edit-wrapper>`), _tmpl$3 = /* @__PURE__ */ template(`<input>`), _tmpl$4 = /* @__PURE__ */ template(`<select>`), _tmpl$5 = /* @__PURE__ */ template(`<option>`), _tmpl$6 = /* @__PURE__ */ template(`<label class="h-full flex items-center">`);
11
11
  const EditablePlugin = {
@@ -17,7 +17,7 @@ const EditablePlugin = {
17
17
  const [editing, setEditing] = createSignal(false);
18
18
  let eventKey = "";
19
19
  const selected = createMemo(() => (([x, y]) => o.x == x && o.y == y)(store.selected.start || []));
20
- const preEdit = createMemo(() => selected() && editable() && !editing() && o.col.editOnInput);
20
+ const preEdit = createMemo(() => selected() && editable() && !editing());
21
21
  const editorState = createAsyncMemo(async () => {
22
22
  if (editing()) {
23
23
  let canceled = false;
@@ -1,4 +1,4 @@
1
- import { useHistory } from '@/hooks';
1
+ import { useHistory } from '../hooks';
2
2
  import { type Plugin } from '..';
3
3
  declare module '../index' {
4
4
  interface TableProps {
@@ -3,8 +3,8 @@ import { useMemoAsync } from "../hooks/index.js";
3
3
  import { Menu } from "../components/Menu.js";
4
4
  import { createComponent, memo, mergeProps } from "solid-js/web";
5
5
  import { batch, createMemo, createSignal, mapArray } from "solid-js";
6
- import { range, remove } from "es-toolkit";
7
6
  import { combineProps } from "@solid-primitives/props";
7
+ import { range, remove } from "es-toolkit";
8
8
  import { createEventListener } from "@solid-primitives/event-listener";
9
9
  import { autoPlacement, computePosition } from "@floating-ui/dom";
10
10
  const MenuPlugin = {
@@ -1,13 +1,13 @@
1
- import { type Plugin } from "@/index";
1
+ import { type Plugin } from "../index";
2
2
  declare module '../index' {
3
3
  interface TableProps {
4
4
  resizable?: {
5
- col: Partial<{
5
+ col?: Partial<{
6
6
  enable: boolean;
7
7
  min: number;
8
8
  max: number;
9
9
  }>;
10
- row: Partial<{
10
+ row?: Partial<{
11
11
  enable: boolean;
12
12
  min: number;
13
13
  max: number;
@@ -1,103 +1,116 @@
1
+ import { unFn } from "../utils.js";
1
2
  import { usePointerDrag } from "../hooks/index.js";
2
3
  import { Ctx } from "../index.js";
3
- import { useSplit } from "../components/Split.js";
4
- import { createComponent, template, use } from "solid-js/web";
5
- import { createMemo, onMount, useContext } from "solid-js";
6
- import { clamp } from "es-toolkit";
4
+ import { className, createComponent, effect, memo, mergeProps, template, use } from "solid-js/web";
5
+ import { batch, untrack, useContext } from "solid-js";
6
+ import { reconcile } from "solid-js/store";
7
7
  import { combineProps } from "@solid-primitives/props";
8
+ import { clamp } from "es-toolkit";
9
+ import { createEventListener } from "@solid-primitives/event-listener";
8
10
  import { defaultsDeep } from "es-toolkit/compat";
9
- var _tmpl$ = /* @__PURE__ */ template(`<div class="in-cell__resize-handle flex justify-center after:w-1 cursor-w-resize">`), _tmpl$2 = /* @__PURE__ */ template(`<div class="in-cell__resize-handle flex flex-row items-center after:h-1 cursor-s-resize">`);
10
- const ResizePlugin = { rewriteProps: {
11
- resizable: ({ resizable }) => defaultsDeep(resizable, {
12
- col: {
13
- enable: true,
14
- min: 45,
15
- max: 800
16
- },
17
- row: {
18
- enable: false,
19
- min: 20,
20
- max: 400
21
- }
22
- }),
23
- columns: ({ columns }, { store }) => columns.map((e) => defaultsDeep(e, { resizable: store.props?.resizable?.col.enable })),
24
- Thead: ({ Thead }, { store }) => (o) => {
25
- let theadEl;
26
- const { props } = useContext(Ctx);
27
- const ths = createMemo(() => store.ths.filter((e) => e != null));
28
- onMount(() => {
29
- useSplit({
30
- container: theadEl,
31
- cells: ths,
32
- size: 10,
33
- trailing: true,
34
- dir: "x",
35
- handle: (i) => createComponent(Handle, { i })
36
- });
11
+ var _tmpl$ = /* @__PURE__ */ template(`<div>`);
12
+ var COL = Symbol("col_size");
13
+ var ROW = Symbol("row_size");
14
+ var ColHandle = (o) => {
15
+ const { props, store } = useContext(Ctx);
16
+ let el;
17
+ usePointerDrag(() => el, { start(e, move, end) {
18
+ e.stopPropagation();
19
+ const i = o.x;
20
+ const { min, max } = props.resizable.col;
21
+ const th = el.parentElement;
22
+ const sw = th.offsetWidth;
23
+ move((e$1, { ox }) => store[COL][o.x] = clamp(sw + ox, min, max));
24
+ end(() => {
25
+ const col = props.columns[i];
26
+ const cols = [...store.rawProps.columns || []];
27
+ const index = cols.indexOf(col[store.raw] ?? col);
28
+ if (index > -1) {
29
+ cols[index] = {
30
+ ...cols[index],
31
+ width: th.offsetWidth
32
+ };
33
+ props.onColumnsChange?.(cols);
34
+ }
35
+ col.onWidthChange?.(th.offsetWidth);
37
36
  });
38
- const Handle = (_props) => {
39
- let el;
40
- usePointerDrag(() => el, { start(e, move, end) {
41
- const { min, max } = props.resizable.col;
42
- const th = ths()[_props.i];
43
- const sw = th.offsetWidth;
44
- move((e$1, o$1) => th.style.width = `${clamp(sw + o$1.ox, min, max)}px`);
45
- end(() => {
46
- const col = props.columns[_props.i];
47
- const cols = [...store.rawProps.columns || []];
48
- const index = cols?.findIndex((e$1) => e$1.id == col.id);
49
- if (index > -1) {
50
- cols[index] = {
51
- ...cols[index],
52
- width: th.offsetWidth
53
- };
54
- props.onColumnsChange?.(cols);
55
- }
56
- col.onWidthChange?.(th.offsetWidth);
57
- });
58
- } });
59
- return (() => {
60
- var _el$ = _tmpl$();
61
- var _ref$ = el;
62
- typeof _ref$ === "function" ? use(_ref$, _el$) : el = _el$;
63
- return _el$;
64
- })();
65
- };
66
- o = combineProps({ ref: (e) => theadEl = e }, o);
67
- return createComponent(Thead, o);
68
- },
69
- Tbody: ({ Tbody }, { store }) => (o) => {
70
- let el;
71
- const { props } = useContext(Ctx);
72
- const tds = createMemo(() => store.trs.filter((e) => e != null).map((e) => e.firstElementChild));
73
- onMount(() => {
74
- useSplit({
75
- container: el,
76
- cells: tds,
77
- size: 8,
78
- trailing: true,
79
- dir: "y",
80
- handle: (i) => createComponent(Handle, { i })
81
- });
37
+ } });
38
+ return (() => {
39
+ var _el$ = _tmpl$();
40
+ var _ref$ = el;
41
+ typeof _ref$ === "function" ? use(_ref$, _el$) : el = _el$;
42
+ effect(() => className(_el$, `in-cell__resize-handle absolute top-0 right-0 flex justify-center w-10px! ${o.x == props.columns.length - 1 ? "justify-end!" : "w-10px! translate-x-1/2"} after:w-1 cursor-w-resize z-1`));
43
+ return _el$;
44
+ })();
45
+ };
46
+ var RowHandle = (o) => {
47
+ const { props, store } = useContext(Ctx);
48
+ let el;
49
+ usePointerDrag(() => el, { start(e, move, end) {
50
+ e.stopPropagation();
51
+ const i = o.y;
52
+ const { min, max } = props.resizable.row;
53
+ const sh = el.parentElement.offsetHeight;
54
+ move((e$1, { oy }) => store[ROW][o.y] = clamp(sh + oy, min, max));
55
+ end(() => {
56
+ const row = props.data[i];
57
+ if ([...store.rawProps.data || []].indexOf(row[store.raw] ?? row) > -1) {}
82
58
  });
83
- const Handle = (_props2) => {
84
- let el$1;
85
- usePointerDrag(() => el$1, { start(e, move, end) {
86
- const { min, max } = props.resizable.row;
87
- const tr = tds()[_props2.i];
88
- const sw = tr.offsetHeight;
89
- move((e$1, o$1) => tr.style.height = `${clamp(sw + o$1.oy, min, max)}px`);
90
- end(() => {});
91
- } });
92
- return (() => {
93
- var _el$2 = _tmpl$2();
94
- var _ref$2 = el$1;
95
- typeof _ref$2 === "function" ? use(_ref$2, _el$2) : el$1 = _el$2;
96
- return _el$2;
97
- })();
98
- };
99
- o = combineProps({ ref: (e) => el = e }, o);
100
- return createComponent(Tbody, o);
59
+ } });
60
+ createEventListener(() => el, "dblclick", () => o.data[COL] = void 0);
61
+ return (() => {
62
+ var _el$2 = _tmpl$();
63
+ var _ref$2 = el;
64
+ typeof _ref$2 === "function" ? use(_ref$2, _el$2) : el = _el$2;
65
+ effect(() => className(_el$2, `in-cell__resize-handle absolute bottom-0 left-0 flex flex-col justify-center h-1! ${o.y == props.data.length - 1 ? "justify-end!" : ""} after:h-1 cursor-s-resize z-1`));
66
+ return _el$2;
67
+ })();
68
+ };
69
+ const ResizePlugin = {
70
+ store: () => ({
71
+ [COL]: [],
72
+ [ROW]: []
73
+ }),
74
+ rewriteProps: {
75
+ resizable: ({ resizable }) => defaultsDeep(resizable, {
76
+ col: {
77
+ enable: true,
78
+ min: 45,
79
+ max: 800
80
+ },
81
+ row: {
82
+ enable: false,
83
+ min: 20,
84
+ max: 400
85
+ }
86
+ }),
87
+ columns: ({ columns }, { store }) => (columns = columns.map((e, i) => ({
88
+ ...e,
89
+ [store.raw]: e[store.raw] ?? e
90
+ })), columns = columns.map((e) => e.resizable === void 0 ? {
91
+ ...e,
92
+ resizable: store.props?.resizable?.col.enable,
93
+ [store.raw]: e[store.raw] ?? e
94
+ } : e), columns = columns.map((e, i) => store[COL][i] ? {
95
+ ...e,
96
+ width: store[COL][i],
97
+ [store.raw]: e[store.raw] ?? e
98
+ } : e), untrack(() => batch(() => reconcile(columns, { key: store.raw })(store.__resize__cols ??= [])))),
99
+ Th: ({ Th }, { store }) => (o) => {
100
+ o = combineProps({ class: "relative" }, o);
101
+ return createComponent(Th, mergeProps(o, { get children() {
102
+ return [memo(() => o.children), memo(() => memo(() => !!o.col.resizable)() && createComponent(ColHandle, o))];
103
+ } }));
104
+ },
105
+ Td: ({ Td }, { store }) => !store.props?.resizable?.row.enable ? Td : (o) => {
106
+ o = combineProps({ class: "relative" }, o);
107
+ return createComponent(Td, mergeProps(o, { get children() {
108
+ return [memo(() => o.children), memo(() => memo(() => !!(o.x == 0 && store.props?.resizable?.row.enable))() && createComponent(RowHandle, o))];
109
+ } }));
110
+ },
111
+ cellStyle: ({ cellStyle }, { store }) => (o) => {
112
+ return `${unFn(cellStyle, o)};` + (store[ROW][o.y] ? `height: ${store[ROW][o.y]}px` : "");
113
+ }
101
114
  }
102
- } };
115
+ };
103
116
  export { ResizePlugin };
@@ -27,6 +27,6 @@ declare function useSelector(opt: Partial<{
27
27
  isSelected: (data: any) => boolean;
28
28
  select: (data: any, bool?: boolean) => void;
29
29
  clear: () => any;
30
- set: (rows?: never[]) => any;
30
+ set: (rows?: any[]) => any;
31
31
  };
32
32
  export {};
@@ -1,4 +1,4 @@
1
- import { useVirtualizer } from '@/hooks/useVirtualizer';
1
+ import { useVirtualizer } from '../hooks/useVirtualizer';
2
2
  import { type Plugin } from '..';
3
3
  declare module '../index' {
4
4
  interface TableProps {