impact-nova 2.1.0-alpha.5 → 2.1.0-alpha.7
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/dist/components/data/ag-grid-react/index.js +120 -119
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
- package/dist/components/data/ag-grid-react/theme.js +5 -4
- package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +14 -1
- package/dist/components/data/data-table/data-table-column-apply.js +97 -13
- package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
- package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
- package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
- package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
- package/dist/components/data/data-table/data-table-column-list.d.ts +1 -1
- package/dist/components/data/data-table/data-table-column-list.js +73 -283
- package/dist/components/data/data-table/data-table-sheet.js +18 -18
- package/dist/components/data/data-table/data-table.js +86 -77
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
- package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
- package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
- package/dist/components/forms/select/index.js +4 -3
- package/dist/components/forms/select/select.js +163 -158
- package/dist/components/forms/select/select.types.d.ts +3 -2
- package/dist/components/forms/select/utils/select.d.ts +2 -1
- package/dist/components/forms/select/utils/select.js +47 -37
- package/dist/impact-nova-components.css +26 -17
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +297 -296
- package/dist/lib/primitives/create-component.d.ts +1 -1
- package/dist/lib/primitives/create-component.js +4 -4
- package/dist/lib/primitives/field.js +17 -18
- package/dist/lib/virtualized/virtualized-list-parts.d.ts +1 -2
- package/dist/lib/virtualized/virtualized-list-parts.js +23 -23
- package/dist/lib/virtualized/virtualized.types.d.ts +10 -0
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/migration.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +6 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import d, { useState as b, useEffect as
|
|
2
|
+
import d, { useState as b, useEffect as u, useCallback as T } from "react";
|
|
3
3
|
import { createPortal as g } from "react-dom";
|
|
4
4
|
import { Cross as C } from "impact-nova-icons";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
6
6
|
import { Button as x } from "../../primitives/button/button.js";
|
|
7
7
|
import { useDataTable as w, useDataTableSheetPortal as D } from "./data-table-context.js";
|
|
8
8
|
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as v } from "./data-table-constants.js";
|
|
@@ -13,16 +13,18 @@ const I = ({
|
|
|
13
13
|
open: e,
|
|
14
14
|
onOpenChange: o
|
|
15
15
|
}) => {
|
|
16
|
-
const { registerScopedSheetDepth: a } = w(), [s, i] = b(r), l = e !== void 0 ? e : s,
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const { registerScopedSheetDepth: a } = w(), [s, i] = b(r), l = e !== void 0 ? e : s, h = d.useRef(o);
|
|
17
|
+
u(() => {
|
|
18
|
+
h.current = o;
|
|
19
19
|
});
|
|
20
|
-
const y = T((
|
|
21
|
-
e === void 0 && i(
|
|
20
|
+
const y = T((p) => {
|
|
21
|
+
e === void 0 && i(p), h.current?.(p);
|
|
22
22
|
}, [e]);
|
|
23
|
-
return
|
|
23
|
+
return u(() => {
|
|
24
24
|
if (l)
|
|
25
|
-
return a(1), () =>
|
|
25
|
+
return a(1), () => {
|
|
26
|
+
a(-1);
|
|
27
|
+
};
|
|
26
28
|
}, [l, a]), /* @__PURE__ */ t(N.Provider, { value: y, children: /* @__PURE__ */ t(k.Provider, { value: l, children: n }) });
|
|
27
29
|
}, M = ({
|
|
28
30
|
children: n,
|
|
@@ -49,7 +51,7 @@ const I = ({
|
|
|
49
51
|
return /* @__PURE__ */ c(
|
|
50
52
|
"div",
|
|
51
53
|
{
|
|
52
|
-
className:
|
|
54
|
+
className: f(
|
|
53
55
|
"flex shrink-0 flex-row justify-between items-center px-4 py-3 mb-2 bg-brand-tint",
|
|
54
56
|
e
|
|
55
57
|
),
|
|
@@ -78,14 +80,12 @@ const I = ({
|
|
|
78
80
|
children: n,
|
|
79
81
|
className: r
|
|
80
82
|
}) => {
|
|
81
|
-
const { open: e } = S(), { sheetTarget: o } = D(), [a, s] = b(
|
|
82
|
-
if (
|
|
83
|
-
e && s(!0);
|
|
84
|
-
}, [e]), !a) return null;
|
|
83
|
+
const { open: e } = S(), { sheetTarget: o } = D(), [a, s] = b(!1);
|
|
84
|
+
if (e && !a && s(!0), !a) return null;
|
|
85
85
|
const i = /* @__PURE__ */ c(
|
|
86
86
|
"div",
|
|
87
87
|
{
|
|
88
|
-
className:
|
|
88
|
+
className: f(
|
|
89
89
|
"-my-px flex h-[calc(100%_+_2px)]",
|
|
90
90
|
e && "animate-in slide-in-from-right-[100%] duration-200 ease-in-out fade-in fill-mode-forwards motion-reduce:animate-none motion-reduce:transition-none"
|
|
91
91
|
),
|
|
@@ -99,7 +99,7 @@ const I = ({
|
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
101
101
|
"data-component": "data-table-sheet-panel",
|
|
102
|
-
className:
|
|
102
|
+
className: f(
|
|
103
103
|
"relative flex h-full w-[355px] flex-col overflow-y-auto bg-canvas-elevated border-t border-l border-stroke-hairline pointer-events-auto shadow-elevation-floating",
|
|
104
104
|
r
|
|
105
105
|
),
|
|
@@ -109,7 +109,7 @@ const I = ({
|
|
|
109
109
|
/* @__PURE__ */ t("div", { className: "w-[16px] bg-canvas-elevated border-l border-stroke-hairline shrink-0" })
|
|
110
110
|
]
|
|
111
111
|
}
|
|
112
|
-
),
|
|
112
|
+
), m = /* @__PURE__ */ t(
|
|
113
113
|
"div",
|
|
114
114
|
{
|
|
115
115
|
className: "pointer-events-none absolute inset-0 z-[35] flex justify-end overflow-x-hidden overflow-y-visible",
|
|
@@ -117,7 +117,7 @@ const I = ({
|
|
|
117
117
|
children: i
|
|
118
118
|
}
|
|
119
119
|
);
|
|
120
|
-
return o ? g(
|
|
120
|
+
return o ? g(m, o) : /* @__PURE__ */ t(
|
|
121
121
|
"div",
|
|
122
122
|
{
|
|
123
123
|
className: "pointer-events-none fixed inset-0 z-[35] flex justify-end overflow-x-hidden overflow-y-visible",
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { AgGridWrapper as
|
|
1
|
+
import { jsx as n, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useMemo as m, useCallback as D, useEffect as y, memo as v } from "react";
|
|
3
|
+
import { AgGridWrapper as E } from "../ag-grid-react/index.js";
|
|
4
4
|
import { cn as H } from "../../../lib/utils.js";
|
|
5
|
-
import { DataTableContext as
|
|
6
|
-
import { createDataTableSheetPortalStore as
|
|
7
|
-
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as
|
|
8
|
-
|
|
5
|
+
import { DataTableContext as O, DataTableSheetPortalStoreContext as F, useDataTable as N, useDataTableSheetPortal as A } from "./data-table-context.js";
|
|
6
|
+
import { createDataTableSheetPortalStore as I } from "./data-table-sheet-portal-store.js";
|
|
7
|
+
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as z } from "./data-table-constants.js";
|
|
8
|
+
import { extractRuntimeColumnDefs as B, mergeInitialGridRuntimeState as M } from "./data-table-column-def-pin.js";
|
|
9
|
+
const P = {
|
|
9
10
|
default: 46,
|
|
10
11
|
compact: 30,
|
|
11
12
|
comfort: 52
|
|
12
|
-
},
|
|
13
|
+
}, Q = ({
|
|
13
14
|
children: a,
|
|
14
15
|
className: t
|
|
15
16
|
}) => {
|
|
16
|
-
const [r, e] =
|
|
17
|
-
|
|
18
|
-
}, []),
|
|
19
|
-
e(
|
|
20
|
-
}, []),
|
|
17
|
+
const [r, e] = g(null), [o, d] = g("medium"), [i, S] = g("full"), [s, u] = g("default"), l = m(() => I(), []), f = D((c) => {
|
|
18
|
+
l.registerScopedSheetDepth(c);
|
|
19
|
+
}, [l]), p = D((c) => {
|
|
20
|
+
e(c);
|
|
21
|
+
}, []), x = {
|
|
21
22
|
small: "12px",
|
|
22
23
|
medium: "14px",
|
|
23
24
|
large: "16px"
|
|
24
|
-
}[o], b = `${
|
|
25
|
+
}[o], b = `${P[s]}px`, T = m(
|
|
25
26
|
() => ({
|
|
26
27
|
gridApi: r,
|
|
27
|
-
registerApi:
|
|
28
|
-
registerScopedSheetDepth:
|
|
28
|
+
registerApi: p,
|
|
29
|
+
registerScopedSheetDepth: f,
|
|
29
30
|
fontSize: o,
|
|
30
|
-
setFontSize:
|
|
31
|
-
numericFormat:
|
|
32
|
-
setNumericFormat:
|
|
33
|
-
rowHeight:
|
|
34
|
-
setRowHeight:
|
|
31
|
+
setFontSize: d,
|
|
32
|
+
numericFormat: i,
|
|
33
|
+
setNumericFormat: S,
|
|
34
|
+
rowHeight: s,
|
|
35
|
+
setRowHeight: u
|
|
35
36
|
}),
|
|
36
37
|
[
|
|
37
38
|
r,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
p,
|
|
40
|
+
f,
|
|
40
41
|
o,
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
i,
|
|
43
|
+
s
|
|
43
44
|
]
|
|
44
45
|
);
|
|
45
|
-
return /* @__PURE__ */ n(
|
|
46
|
-
|
|
46
|
+
return /* @__PURE__ */ n(O.Provider, { value: T, children: /* @__PURE__ */ n(
|
|
47
|
+
F.Provider,
|
|
47
48
|
{
|
|
48
|
-
value:
|
|
49
|
+
value: l,
|
|
49
50
|
children: /* @__PURE__ */ n(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
@@ -55,7 +56,7 @@ const A = {
|
|
|
55
56
|
t
|
|
56
57
|
),
|
|
57
58
|
style: {
|
|
58
|
-
"--ag-font-size":
|
|
59
|
+
"--ag-font-size": x,
|
|
59
60
|
"--ag-row-height": b
|
|
60
61
|
},
|
|
61
62
|
children: a
|
|
@@ -63,14 +64,14 @@ const A = {
|
|
|
63
64
|
)
|
|
64
65
|
}
|
|
65
66
|
) });
|
|
66
|
-
},
|
|
67
|
+
}, w = {
|
|
67
68
|
full: "full_no",
|
|
68
69
|
k: "thou",
|
|
69
70
|
m: "mil",
|
|
70
71
|
b: "bil",
|
|
71
72
|
full_precision: "full_precision"
|
|
72
|
-
},
|
|
73
|
-
const { setSheetTarget: t } =
|
|
73
|
+
}, j = v(function() {
|
|
74
|
+
const { setSheetTarget: t } = A();
|
|
74
75
|
return /* @__PURE__ */ n(
|
|
75
76
|
"div",
|
|
76
77
|
{
|
|
@@ -78,96 +79,104 @@ const A = {
|
|
|
78
79
|
className: "absolute inset-0 pointer-events-none z-[39] flex overflow-x-hidden overflow-y-visible"
|
|
79
80
|
}
|
|
80
81
|
);
|
|
81
|
-
}),
|
|
82
|
+
}), k = v(function({
|
|
82
83
|
className: t,
|
|
83
84
|
children: r
|
|
84
85
|
}) {
|
|
85
|
-
const { scopedSheetOpen: e } =
|
|
86
|
-
return /* @__PURE__ */
|
|
86
|
+
const { scopedSheetOpen: e } = A();
|
|
87
|
+
return /* @__PURE__ */ R(
|
|
87
88
|
"div",
|
|
88
89
|
{
|
|
89
90
|
className: H(
|
|
90
91
|
"relative flex-1 min-h-0 w-full bg-canvas-elevated rounded-b-[inherit] grid-rounded-bottom",
|
|
91
92
|
t
|
|
92
93
|
),
|
|
93
|
-
style: e ? { minHeight:
|
|
94
|
+
style: e ? { minHeight: z } : void 0,
|
|
94
95
|
children: [
|
|
95
96
|
r,
|
|
96
|
-
/* @__PURE__ */ n(
|
|
97
|
+
/* @__PURE__ */ n(j, {})
|
|
97
98
|
]
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
|
-
}),
|
|
101
|
+
}), L = v(function({
|
|
101
102
|
resolvedRowHeight: t,
|
|
102
103
|
mergedContext: r,
|
|
103
104
|
onGridReady: e,
|
|
104
105
|
columnDefs: o,
|
|
105
|
-
maintainColumnOrder:
|
|
106
|
-
...
|
|
106
|
+
maintainColumnOrder: d = !0,
|
|
107
|
+
...i
|
|
107
108
|
}) {
|
|
108
109
|
return /* @__PURE__ */ n(
|
|
109
|
-
|
|
110
|
+
E,
|
|
110
111
|
{
|
|
111
|
-
...
|
|
112
|
+
...i,
|
|
112
113
|
columnDefs: o,
|
|
113
114
|
rowHeight: t,
|
|
114
115
|
onGridReady: e,
|
|
115
116
|
context: r,
|
|
116
|
-
maintainColumnOrder:
|
|
117
|
+
maintainColumnOrder: d
|
|
117
118
|
}
|
|
118
119
|
);
|
|
119
120
|
});
|
|
120
|
-
function
|
|
121
|
+
function U(a) {
|
|
121
122
|
const {
|
|
122
123
|
registerApi: t,
|
|
123
124
|
rowHeight: r,
|
|
124
125
|
gridApi: e,
|
|
125
126
|
numericFormat: o
|
|
126
|
-
} =
|
|
127
|
-
className:
|
|
128
|
-
onGridReady:
|
|
129
|
-
rowHeight:
|
|
130
|
-
context:
|
|
131
|
-
columnDefs:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
127
|
+
} = N(), {
|
|
128
|
+
className: d,
|
|
129
|
+
onGridReady: i,
|
|
130
|
+
rowHeight: S,
|
|
131
|
+
context: s,
|
|
132
|
+
columnDefs: u,
|
|
133
|
+
initialState: l,
|
|
134
|
+
maintainColumnOrder: f = !0,
|
|
135
|
+
...p
|
|
136
|
+
} = a, x = P[r], b = S ?? x, { runtimeColumnDefs: T, extractedRuntimeDefaults: c } = m(
|
|
137
|
+
() => B(u ?? void 0),
|
|
138
|
+
[u]
|
|
139
|
+
), _ = m(
|
|
140
|
+
() => M(l, c),
|
|
141
|
+
[l, c]
|
|
142
|
+
), C = m(
|
|
135
143
|
() => ({
|
|
136
|
-
...
|
|
137
|
-
formatType:
|
|
144
|
+
...s,
|
|
145
|
+
formatType: w[o]
|
|
138
146
|
}),
|
|
139
|
-
[
|
|
147
|
+
[s, o]
|
|
140
148
|
);
|
|
141
|
-
|
|
149
|
+
y(() => {
|
|
142
150
|
e?.resetRowHeights();
|
|
143
|
-
}, [r, e]),
|
|
151
|
+
}, [r, e]), y(() => {
|
|
144
152
|
if (e) {
|
|
145
|
-
const
|
|
153
|
+
const h = e.getGridOption("context") || {};
|
|
146
154
|
e.setGridOption("context", {
|
|
147
|
-
...
|
|
148
|
-
formatType:
|
|
155
|
+
...h,
|
|
156
|
+
formatType: w[o]
|
|
149
157
|
}), e.refreshCells({ force: !0 });
|
|
150
158
|
}
|
|
151
159
|
}, [o, e]);
|
|
152
|
-
const
|
|
153
|
-
(
|
|
154
|
-
t(
|
|
160
|
+
const G = D(
|
|
161
|
+
(h) => {
|
|
162
|
+
t(h.api), i?.(h);
|
|
155
163
|
},
|
|
156
|
-
[t,
|
|
164
|
+
[t, i]
|
|
157
165
|
);
|
|
158
|
-
return /* @__PURE__ */ n(
|
|
159
|
-
|
|
166
|
+
return /* @__PURE__ */ n(k, { className: d, children: /* @__PURE__ */ n(
|
|
167
|
+
L,
|
|
160
168
|
{
|
|
161
|
-
...
|
|
162
|
-
columnDefs:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
...p,
|
|
170
|
+
columnDefs: T,
|
|
171
|
+
initialState: _,
|
|
172
|
+
maintainColumnOrder: f,
|
|
173
|
+
resolvedRowHeight: b,
|
|
174
|
+
mergedContext: C,
|
|
175
|
+
onGridReady: G
|
|
167
176
|
}
|
|
168
177
|
) });
|
|
169
178
|
}
|
|
170
|
-
const
|
|
179
|
+
const Z = ({
|
|
171
180
|
children: a,
|
|
172
181
|
className: t
|
|
173
182
|
}) => /* @__PURE__ */ n(
|
|
@@ -182,7 +191,7 @@ const $ = ({
|
|
|
182
191
|
}
|
|
183
192
|
);
|
|
184
193
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
Q as DataTable,
|
|
195
|
+
U as DataTableContent,
|
|
196
|
+
Z as DataTableToolbar
|
|
188
197
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GridApi } from 'ag-grid-community';
|
|
2
|
+
import { NestedListItem } from '../nested-list/nested-list.types';
|
|
3
|
+
export interface UseDataTableColumnListSyncOptions {
|
|
4
|
+
gridApi: GridApi | null;
|
|
5
|
+
frozenColumnsLabel: string;
|
|
6
|
+
scrollableColumnsLabel: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useDataTableColumnListSync({ gridApi, frozenColumnsLabel, scrollableColumnsLabel, }: UseDataTableColumnListSyncOptions): {
|
|
9
|
+
items: NestedListItem[];
|
|
10
|
+
isReady: boolean;
|
|
11
|
+
externalSyncKey: boolean;
|
|
12
|
+
listWrapperRef: import('react').RefObject<HTMLDivElement | null>;
|
|
13
|
+
handleChange: (currentItems: NestedListItem[], enableApplyDiscard: boolean) => void;
|
|
14
|
+
handleSubmit: (finalItems: NestedListItem[]) => void;
|
|
15
|
+
handlePinChange: (itemId: string, newPinned: "left" | "right" | null) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { useState as O, useRef as h, useCallback as a, useEffect as x } from "react";
|
|
2
|
+
import { mergePartialOrderedColumnState as N } from "./data-table-column-state.js";
|
|
3
|
+
import { afterSynchronousColumnApply as R, normalizeColumnPinned as q, GRID_AUTO_UNPIN_WAIT_MS as J, alignColumnTreePinMetadata as L, EXTERNAL_SYNC_DEBOUNCE_MS as Q, readGridColumnPinned as Z } from "./data-table-column-apply.js";
|
|
4
|
+
import { buildColumnTreeFromGrid as $ } from "./build-column-tree-from-grid.js";
|
|
5
|
+
import { computeColumnListSyncFingerprints as z, resolveColumnListSyncMode as A } from "./data-table-column-list-sync.js";
|
|
6
|
+
import { subscribeGridApiEvent as j } from "../ag-grid-react/grid-api-event-subscription.js";
|
|
7
|
+
function se({
|
|
8
|
+
gridApi: r,
|
|
9
|
+
frozenColumnsLabel: D,
|
|
10
|
+
scrollableColumnsLabel: U
|
|
11
|
+
}) {
|
|
12
|
+
const [K, b] = O([]), [V, W] = O(!1), [_, B] = O(!1), i = h(!1), E = h(null), S = h(0), y = h(""), G = h(""), C = a(() => !r || i.current ? null : $(r, {
|
|
13
|
+
frozenColumns: D,
|
|
14
|
+
scrollableColumns: U
|
|
15
|
+
}), [r, D, U]), I = a(
|
|
16
|
+
(t, e) => {
|
|
17
|
+
const o = y.current, l = z(t);
|
|
18
|
+
y.current = l.structural, G.current = l.indicators, b(t), W(!0), e === "structural" && o !== "" && B((n) => !n);
|
|
19
|
+
},
|
|
20
|
+
[]
|
|
21
|
+
), m = a(
|
|
22
|
+
() => {
|
|
23
|
+
const t = C();
|
|
24
|
+
t && I(t, "structural");
|
|
25
|
+
},
|
|
26
|
+
[I, C]
|
|
27
|
+
), k = a(
|
|
28
|
+
() => {
|
|
29
|
+
const t = C();
|
|
30
|
+
if (!t) return;
|
|
31
|
+
const e = A(
|
|
32
|
+
t,
|
|
33
|
+
y.current,
|
|
34
|
+
G.current
|
|
35
|
+
);
|
|
36
|
+
if (e !== "skip") {
|
|
37
|
+
if (e === "structural") {
|
|
38
|
+
const o = E.current?.querySelector(
|
|
39
|
+
'[data-component="nested-list"] .overflow-y-auto'
|
|
40
|
+
);
|
|
41
|
+
o && (S.current = o.scrollTop);
|
|
42
|
+
}
|
|
43
|
+
I(t, e);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[I, C]
|
|
47
|
+
);
|
|
48
|
+
x(() => {
|
|
49
|
+
if (!r) return;
|
|
50
|
+
queueMicrotask(() => m());
|
|
51
|
+
const t = [
|
|
52
|
+
"columnVisible",
|
|
53
|
+
"columnPinned",
|
|
54
|
+
"columnMoved",
|
|
55
|
+
"gridReady",
|
|
56
|
+
"columnGroupOpened",
|
|
57
|
+
"columnRowGroupChanged",
|
|
58
|
+
"columnPivotModeChanged",
|
|
59
|
+
"columnEverythingChanged",
|
|
60
|
+
"dragStopped",
|
|
61
|
+
"columnValueChanged",
|
|
62
|
+
"displayedColumnsChanged",
|
|
63
|
+
"sortChanged",
|
|
64
|
+
"filterChanged",
|
|
65
|
+
"newColumnsLoaded"
|
|
66
|
+
];
|
|
67
|
+
let e = null;
|
|
68
|
+
const o = () => {
|
|
69
|
+
i.current || (e && clearTimeout(e), e = setTimeout(() => {
|
|
70
|
+
e = null, !(i.current || r.isDestroyed()) && k();
|
|
71
|
+
}, Q));
|
|
72
|
+
}, l = t.map(
|
|
73
|
+
(u) => j(r, u, () => {
|
|
74
|
+
o();
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
return () => {
|
|
78
|
+
e && clearTimeout(e), l.forEach((u) => u());
|
|
79
|
+
};
|
|
80
|
+
}, [r, m, k]), x(() => {
|
|
81
|
+
if (S.current === 0) return;
|
|
82
|
+
const t = requestAnimationFrame(() => {
|
|
83
|
+
const e = E.current?.querySelector(
|
|
84
|
+
'[data-component="nested-list"] .overflow-y-auto'
|
|
85
|
+
);
|
|
86
|
+
e && (e.scrollTop = S.current, S.current = 0);
|
|
87
|
+
});
|
|
88
|
+
return () => cancelAnimationFrame(t);
|
|
89
|
+
}, [_]);
|
|
90
|
+
const w = a(
|
|
91
|
+
(t) => {
|
|
92
|
+
const e = [], o = (l, u) => {
|
|
93
|
+
l.forEach((n) => {
|
|
94
|
+
if (n.id === "root-frozen") {
|
|
95
|
+
n.children && o(n.children, "left");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (n.id === "root-scrollable") {
|
|
99
|
+
n.children && o(n.children, null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (n.category === "group" || n.children && n.children.length > 0)
|
|
103
|
+
n.children && o(n.children, u);
|
|
104
|
+
else {
|
|
105
|
+
let c;
|
|
106
|
+
if (u === null)
|
|
107
|
+
c = null;
|
|
108
|
+
else {
|
|
109
|
+
const d = n.data?.pinned;
|
|
110
|
+
c = d === "left" || d === "right" ? d : u;
|
|
111
|
+
}
|
|
112
|
+
e.push({
|
|
113
|
+
colId: n.id,
|
|
114
|
+
pinned: c,
|
|
115
|
+
hide: !n.checked
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
return o(t, null), e;
|
|
121
|
+
},
|
|
122
|
+
[]
|
|
123
|
+
), g = a(
|
|
124
|
+
(t) => {
|
|
125
|
+
if (!r) return;
|
|
126
|
+
i.current = !0;
|
|
127
|
+
const e = w(t);
|
|
128
|
+
if (e.length === 0) {
|
|
129
|
+
R(() => {
|
|
130
|
+
i.current = !1;
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const o = r.getColumnState(), l = N(o, e), u = new Set(
|
|
135
|
+
o.filter((s) => q(s.pinned)).map((s) => s.colId)
|
|
136
|
+
), n = l.filter(
|
|
137
|
+
(s) => q(s.pinned) && !u.has(s.colId)
|
|
138
|
+
), p = new Set(n.map((s) => s.colId));
|
|
139
|
+
r.applyColumnState({ state: l, applyOrder: !0 });
|
|
140
|
+
const c = () => {
|
|
141
|
+
i.current = !1, m();
|
|
142
|
+
};
|
|
143
|
+
if (p.size === 0) {
|
|
144
|
+
R(c);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
let T = !1, d = null, P = null;
|
|
148
|
+
P = j(r, "columnPinned", () => {
|
|
149
|
+
if (T || r.isDestroyed()) return;
|
|
150
|
+
const s = r.getColumnState();
|
|
151
|
+
if (n.filter((v) => {
|
|
152
|
+
const f = s.find((F) => F.colId === v.colId);
|
|
153
|
+
return f && !f.pinned;
|
|
154
|
+
}).length > 0) {
|
|
155
|
+
T = !0, d && clearTimeout(d), P?.();
|
|
156
|
+
const v = l.filter(
|
|
157
|
+
(f) => f.pinned && !p.has(f.colId)
|
|
158
|
+
);
|
|
159
|
+
if (v.length > 0) {
|
|
160
|
+
const f = v[0], F = l.map(
|
|
161
|
+
(M) => M.colId === f.colId ? { ...M, pinned: null } : M
|
|
162
|
+
);
|
|
163
|
+
r.applyColumnState({ state: F, applyOrder: !0 });
|
|
164
|
+
}
|
|
165
|
+
R(c);
|
|
166
|
+
}
|
|
167
|
+
}), d = setTimeout(() => {
|
|
168
|
+
P?.(), T || c();
|
|
169
|
+
}, J);
|
|
170
|
+
},
|
|
171
|
+
[r, w, m]
|
|
172
|
+
), X = a(
|
|
173
|
+
(t) => {
|
|
174
|
+
g(L(t));
|
|
175
|
+
},
|
|
176
|
+
[g]
|
|
177
|
+
), Y = a(
|
|
178
|
+
(t, e) => {
|
|
179
|
+
const o = L(t);
|
|
180
|
+
e || g(o), b(o);
|
|
181
|
+
const l = z(o);
|
|
182
|
+
y.current = l.structural, G.current = l.indicators;
|
|
183
|
+
},
|
|
184
|
+
[g]
|
|
185
|
+
), H = a(
|
|
186
|
+
(t, e) => {
|
|
187
|
+
if (b((u) => {
|
|
188
|
+
const n = (p) => p.map((c) => c.id === t ? {
|
|
189
|
+
...c,
|
|
190
|
+
data: {
|
|
191
|
+
...c.data,
|
|
192
|
+
pinned: e
|
|
193
|
+
}
|
|
194
|
+
} : c.children ? {
|
|
195
|
+
...c,
|
|
196
|
+
children: n(c.children)
|
|
197
|
+
} : c);
|
|
198
|
+
return n(u);
|
|
199
|
+
}), !r) return;
|
|
200
|
+
i.current = !0;
|
|
201
|
+
const o = r.getColumnState(), l = N(o, [
|
|
202
|
+
{ colId: t, pinned: e }
|
|
203
|
+
]);
|
|
204
|
+
r.applyColumnState({ state: l, applyOrder: !0 }), R(() => {
|
|
205
|
+
i.current = !1, Z(r, t) !== e && m();
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
[r, m]
|
|
209
|
+
);
|
|
210
|
+
return {
|
|
211
|
+
items: K,
|
|
212
|
+
isReady: V,
|
|
213
|
+
externalSyncKey: _,
|
|
214
|
+
listWrapperRef: E,
|
|
215
|
+
handleChange: Y,
|
|
216
|
+
handleSubmit: X,
|
|
217
|
+
handlePinChange: H
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
se as useDataTableColumnListSync
|
|
222
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Option, PropsValue } from '../select.types';
|
|
2
|
+
export interface UseSelectValueStateParams<OptionType> {
|
|
3
|
+
value: PropsValue<OptionType> | undefined;
|
|
4
|
+
defaultValue: PropsValue<OptionType> | undefined;
|
|
5
|
+
isMulti: boolean;
|
|
6
|
+
onChange?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface UseSelectValueStateResult<OptionType> {
|
|
9
|
+
usesMenuSession: boolean;
|
|
10
|
+
currentValue: PropsValue<OptionType>;
|
|
11
|
+
setCurrentValue: (next: PropsValue<OptionType>) => void;
|
|
12
|
+
beginMenuSession: () => void;
|
|
13
|
+
endMenuSession: () => PropsValue<OptionType> | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Controlled selects without `onChange` keep edits in a menu session so
|
|
17
|
+
* `onMenuClose` can batch-commit without stale `value` props.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSelectValueState<OptionType extends Option = Option>({ value, defaultValue, isMulti, onChange, }: UseSelectValueStateParams<OptionType>): UseSelectValueStateResult<OptionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as i, useRef as v, useCallback as r } from "react";
|
|
2
|
+
import { cloneSelectValue as M } from "../utils/select.js";
|
|
3
|
+
function h({
|
|
4
|
+
value: c,
|
|
5
|
+
defaultValue: V,
|
|
6
|
+
isMulti: s,
|
|
7
|
+
onChange: f
|
|
8
|
+
}) {
|
|
9
|
+
const u = c !== void 0, e = u && f === void 0, [S, d] = i(
|
|
10
|
+
V ?? (s ? [] : null)
|
|
11
|
+
), [a, l] = i(null), o = v(null), t = u ? c : S, m = e && a !== null ? a : t, p = r(
|
|
12
|
+
(n) => {
|
|
13
|
+
if (!u) {
|
|
14
|
+
d(n);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
e && (o.current = n, l(n));
|
|
18
|
+
},
|
|
19
|
+
[u, e]
|
|
20
|
+
), C = r(() => {
|
|
21
|
+
if (!e)
|
|
22
|
+
return;
|
|
23
|
+
const n = M(t, s);
|
|
24
|
+
o.current = n, l(n);
|
|
25
|
+
}, [e, t, s]), b = r(() => {
|
|
26
|
+
if (!e)
|
|
27
|
+
return;
|
|
28
|
+
const n = o.current ?? t;
|
|
29
|
+
return o.current = null, l(null), n;
|
|
30
|
+
}, [e, t]);
|
|
31
|
+
return {
|
|
32
|
+
usesMenuSession: e,
|
|
33
|
+
currentValue: m,
|
|
34
|
+
setCurrentValue: p,
|
|
35
|
+
beginMenuSession: C,
|
|
36
|
+
endMenuSession: b
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
h as useSelectValueState
|
|
41
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Select as n } from "./select.js";
|
|
2
|
-
import { cx as r, getIndeterminateState as i, getLeafOptions as
|
|
2
|
+
import { cloneSelectValue as c, cx as r, getIndeterminateState as i, getLeafOptions as l, getSelectedCount as S, getSequence as a, isInvertedSelection as d, isOptionArray as g, isSelected as p } from "./utils/select.js";
|
|
3
3
|
export {
|
|
4
4
|
n as Select,
|
|
5
|
+
c as cloneSelectValue,
|
|
5
6
|
r as cx,
|
|
6
7
|
i as getIndeterminateState,
|
|
7
|
-
|
|
8
|
+
l as getLeafOptions,
|
|
8
9
|
S as getSelectedCount,
|
|
9
10
|
a as getSequence,
|
|
10
11
|
d as isInvertedSelection,
|
|
11
12
|
g as isOptionArray,
|
|
12
|
-
|
|
13
|
+
p as isSelected
|
|
13
14
|
};
|