@box-kite/react 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/box-kite-rules.md +43 -0
- package/.claude/skills/box-kite/SKILL.md +431 -0
- package/BOX_AI_CONTEXT.md +1833 -0
- package/BOX_KITE_AI_CONTEXT.md +1833 -0
- package/LICENSE +21 -0
- package/README.md +710 -7
- package/a11y.cjs +1 -0
- package/a11y.d.ts +15 -0
- package/a11y.mjs +3 -0
- package/behavior.cjs +1 -0
- package/behavior.mjs +295 -0
- package/box.cjs +1 -0
- package/box.d.ts +46 -0
- package/box.mjs +23 -0
- package/client.cjs +1 -0
- package/client.mjs +163 -0
- package/components/baseSvg.cjs +1 -0
- package/components/baseSvg.d.ts +5 -0
- package/components/baseSvg.mjs +21 -0
- package/components/button.cjs +1 -0
- package/components/button.d.ts +16 -0
- package/components/button.mjs +19 -0
- package/components/chart.cjs +1 -0
- package/components/chart.d.ts +82 -0
- package/components/chart.mjs +261 -0
- package/components/checkbox.cjs +1 -0
- package/components/checkbox.d.ts +28 -0
- package/components/checkbox.mjs +38 -0
- package/components/dataGrid/components/dataGridBody.d.ts +7 -0
- package/components/dataGrid/components/dataGridBottomBar.d.ts +6 -0
- package/components/dataGrid/components/dataGridCell.d.ts +15 -0
- package/components/dataGrid/components/dataGridCellRowDetail.d.ts +6 -0
- package/components/dataGrid/components/dataGridCellRowSelection.d.ts +6 -0
- package/components/dataGrid/components/dataGridCellText.d.ts +6 -0
- package/components/dataGrid/components/dataGridColumnFilter.d.ts +9 -0
- package/components/dataGrid/components/dataGridColumnGroups.d.ts +7 -0
- package/components/dataGrid/components/dataGridContent.d.ts +6 -0
- package/components/dataGrid/components/dataGridDetailRow.d.ts +8 -0
- package/components/dataGrid/components/dataGridEmptyColumns.d.ts +6 -0
- package/components/dataGrid/components/dataGridFilterCell.d.ts +11 -0
- package/components/dataGrid/components/dataGridFilterRow.d.ts +6 -0
- package/components/dataGrid/components/dataGridGlobalFilter.d.ts +6 -0
- package/components/dataGrid/components/dataGridGroupRow.d.ts +8 -0
- package/components/dataGrid/components/dataGridHeader.d.ts +6 -0
- package/components/dataGrid/components/dataGridHeaderCell.d.ts +9 -0
- package/components/dataGrid/components/dataGridHeaderCellContextMenu.d.ts +11 -0
- package/components/dataGrid/components/dataGridHeaderCellResizer.d.ts +14 -0
- package/components/dataGrid/components/dataGridLoader.d.ts +11 -0
- package/components/dataGrid/components/dataGridPagination.d.ts +6 -0
- package/components/dataGrid/components/dataGridRow.d.ts +8 -0
- package/components/dataGrid/components/dataGridTopBar.d.ts +6 -0
- package/components/dataGrid/components/dataGridTopBarContextMenu.d.ts +6 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +213 -0
- package/components/dataGrid/gridNavigationContext.d.ts +24 -0
- package/components/dataGrid/models/cellModel.d.ts +18 -0
- package/components/dataGrid/models/columnModel.d.ts +150 -0
- package/components/dataGrid/models/columnVisibilityModel.d.ts +24 -0
- package/components/dataGrid/models/detailRowModel.d.ts +22 -0
- package/components/dataGrid/models/filterModel.d.ts +22 -0
- package/components/dataGrid/models/gridModel.d.ts +206 -0
- package/components/dataGrid/models/groupRowCellModel.d.ts +26 -0
- package/components/dataGrid/models/groupRowModel.d.ts +48 -0
- package/components/dataGrid/models/headerCellModel.d.ts +83 -0
- package/components/dataGrid/models/paginationModel.d.ts +32 -0
- package/components/dataGrid/models/rowModel.d.ts +34 -0
- package/components/dataGrid/models/viewportModel.d.ts +44 -0
- package/components/dataGrid/useGrid.d.ts +8 -0
- package/components/dataGrid/useGridNavigation.d.ts +21 -0
- package/components/dataGrid.cjs +1 -0
- package/components/dataGrid.d.ts +2 -0
- package/components/dataGrid.mjs +3178 -0
- package/components/dropdown/dropdownContext.d.ts +44 -0
- package/components/dropdown/dropdownItems.d.ts +22 -0
- package/components/dropdown/dropdownRowRenderer.d.ts +8 -0
- package/components/dropdown/dropdownSearch.d.ts +21 -0
- package/components/dropdown/utils.d.ts +1 -0
- package/components/dropdown.cjs +1 -0
- package/components/dropdown.d.ts +47 -0
- package/components/dropdown.mjs +479 -0
- package/components/flex.cjs +1 -0
- package/components/flex.d.ts +6 -0
- package/components/flex.mjs +16 -0
- package/components/form.cjs +1 -0
- package/components/form.d.ts +10 -0
- package/components/form.mjs +58 -0
- package/components/grid.cjs +1 -0
- package/components/grid.d.ts +6 -0
- package/components/grid.mjs +16 -0
- package/components/icon.cjs +1 -0
- package/components/icon.d.ts +36 -0
- package/components/icon.mjs +41 -0
- package/components/overlay.cjs +1 -0
- package/components/overlay.d.ts +43 -0
- package/components/overlay.mjs +82 -0
- package/components/presence.cjs +1 -0
- package/components/presence.d.ts +30 -0
- package/components/presence.mjs +11 -0
- package/components/radioButton.cjs +1 -0
- package/components/radioButton.d.ts +24 -0
- package/components/radioButton.mjs +32 -0
- package/components/radioGroup.cjs +1 -0
- package/components/radioGroup.d.ts +38 -0
- package/components/radioGroup.mjs +79 -0
- package/components/select.cjs +1 -0
- package/components/select.d.ts +42 -0
- package/components/select.mjs +36 -0
- package/components/semantics.cjs +1 -0
- package/components/semantics.d.ts +34 -0
- package/components/semantics.mjs +17 -0
- package/components/svg.cjs +1 -0
- package/components/svg.d.ts +63 -0
- package/components/svg.mjs +141 -0
- package/components/switch.cjs +1 -0
- package/components/switch.d.ts +20 -0
- package/components/switch.mjs +25 -0
- package/components/textarea.cjs +1 -0
- package/components/textarea.d.ts +27 -0
- package/components/textarea.mjs +33 -0
- package/components/textbox.cjs +1 -0
- package/components/textbox.d.ts +26 -0
- package/components/textbox.mjs +33 -0
- package/components/tooltip.cjs +1 -0
- package/components/tooltip.d.ts +63 -0
- package/components/tooltip.mjs +108 -0
- package/components/visuallyHidden.cjs +1 -0
- package/components/visuallyHidden.d.ts +6 -0
- package/components/visuallyHidden.mjs +23 -0
- package/effects.cjs +1 -0
- package/effects.mjs +6 -0
- package/forms.cjs +1 -0
- package/forms.mjs +21 -0
- package/icons/dotsIcon.d.ts +2 -0
- package/icons/expandIcon.d.ts +2 -0
- package/icons/groupingIcon.d.ts +2 -0
- package/icons/pinIcon.d.ts +2 -0
- package/icons/searchIcon.d.ts +2 -0
- package/icons/sortIcon.d.ts +2 -0
- package/motion.cjs +1 -0
- package/motion.mjs +66 -0
- package/package.json +203 -7
- package/platform.cjs +1 -0
- package/platform.mjs +32 -0
- package/react/a11y/callbacks.d.ts +12 -0
- package/react/a11y/useControllableState.d.ts +25 -0
- package/react/a11y/useDismiss.d.ts +25 -0
- package/react/a11y/useFocusReturn.d.ts +18 -0
- package/react/a11y/useIdentifier.d.ts +17 -0
- package/react/a11y/useRovingFocus.d.ts +84 -0
- package/react/animation/usePresence.d.ts +32 -0
- package/react/boxClassNames.d.ts +25 -0
- package/react/boxProps.d.ts +49 -0
- package/react/boxTagProps.d.ts +7 -0
- package/react/clientRuntime.d.ts +11 -0
- package/react/effects.d.ts +10 -0
- package/react/forms/labelledControl.d.ts +17 -0
- package/react/forms/placeholderProp.d.ts +13 -0
- package/react/hooks/usePortalContainer.d.ts +1 -0
- package/react/hooks/useVirtualization.d.ts +43 -0
- package/react/hooks/useVisibility.d.ts +9 -0
- package/react/reactTypes.d.ts +10 -0
- package/react/resolveStyles.d.ts +18 -0
- package/react/styleElements.d.ts +3 -0
- package/react/svg/attributesInProps.d.ts +4 -0
- package/react/svg/svgNaming.d.ts +15 -0
- package/react/theme/theme.d.ts +26 -0
- package/react/theme/themeContext.d.ts +7 -0
- package/react/useStyles.d.ts +22 -0
- package/react-shared.cjs +1 -0
- package/react-shared.mjs +105 -0
- package/rolldown-runtime.cjs +1 -0
- package/rsc.cjs +1 -0
- package/rsc.d.ts +27 -0
- package/rsc.mjs +18 -0
- package/ssg.cjs +1 -0
- package/ssg.d.ts +24 -0
- package/ssg.mjs +25 -0
- package/utils/animation/animationUtils.d.ts +29 -0
- package/utils/array/arrayUtils.d.ts +15 -0
- package/utils/box/boxUtils.d.ts +5 -0
- package/utils/chart/chartUtils.d.ts +98 -0
- package/utils/dom/domUtils.d.ts +26 -0
- package/utils/environment/environmentUtils.d.ts +18 -0
- package/utils/fn/fnUtils.d.ts +4 -0
- package/utils/form/formUtils.d.ts +8 -0
- package/utils/memo.d.ts +10 -0
- package/utils/object/objectUtils.d.ts +13 -0
- package/utils/string/fuzzySearch.d.ts +27 -0
- package/utils/string/stringUtils.d.ts +4 -0
|
@@ -0,0 +1,3178 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as e, o as t } from "../platform.mjs";
|
|
3
|
+
import { n } from "../effects.mjs";
|
|
4
|
+
import r from "../box.mjs";
|
|
5
|
+
import { i, n as a, r as o, t as s } from "../behavior.mjs";
|
|
6
|
+
import { Path as c, Svg as l } from "./svg.mjs";
|
|
7
|
+
import u from "./baseSvg.mjs";
|
|
8
|
+
import d from "./button.mjs";
|
|
9
|
+
import f from "./flex.mjs";
|
|
10
|
+
import p from "./checkbox.mjs";
|
|
11
|
+
import m from "./textbox.mjs";
|
|
12
|
+
import h from "./grid.mjs";
|
|
13
|
+
import g from "./overlay.mjs";
|
|
14
|
+
import _ from "./presence.mjs";
|
|
15
|
+
import v from "./dropdown.mjs";
|
|
16
|
+
import y from "./visuallyHidden.mjs";
|
|
17
|
+
import { Span as b } from "./semantics.mjs";
|
|
18
|
+
import x, { Fragment as S, createContext as C, useCallback as w, useContext as T, useEffect as E, useLayoutEffect as D, useMemo as O, useRef as k, useState as A } from "react";
|
|
19
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
20
|
+
import { useSyncExternalStore as ee } from "use-sync-external-store/shim";
|
|
21
|
+
//#region src/components/dataGrid/components/dataGridPagination.tsx
|
|
22
|
+
function P(e) {
|
|
23
|
+
let { grid: t } = e, { pagination: n } = t, i = n.state, a = w(() => n.firstPage(), [n]), o = w(() => n.prevPage(), [n]), s = w(() => n.nextPage(), [n]), c = w(() => n.lastPage(), [n]);
|
|
24
|
+
if (!i) return null;
|
|
25
|
+
let { canGoPrev: l, canGoNext: u, totalPages: d } = n;
|
|
26
|
+
return /* @__PURE__ */ N(f, {
|
|
27
|
+
component: `${t.componentName}.bottomBar.pagination`,
|
|
28
|
+
gap: .5,
|
|
29
|
+
ai: "center",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ M(te, {
|
|
32
|
+
grid: t,
|
|
33
|
+
pageSize: i.pageSize
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ M(F, {
|
|
36
|
+
componentName: t.componentName,
|
|
37
|
+
onClick: a,
|
|
38
|
+
disabled: !l,
|
|
39
|
+
children: /* @__PURE__ */ M(re, {})
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ M(F, {
|
|
42
|
+
componentName: t.componentName,
|
|
43
|
+
onClick: o,
|
|
44
|
+
disabled: !l,
|
|
45
|
+
children: /* @__PURE__ */ M(L, {})
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ N(f, {
|
|
48
|
+
ai: "center",
|
|
49
|
+
gap: 1.5,
|
|
50
|
+
px: 2,
|
|
51
|
+
userSelect: "none",
|
|
52
|
+
children: [/* @__PURE__ */ M(ne, {
|
|
53
|
+
grid: t,
|
|
54
|
+
page: i.page,
|
|
55
|
+
totalPages: d
|
|
56
|
+
}), /* @__PURE__ */ N(r, {
|
|
57
|
+
component: `${t.componentName}.bottomBar.pagination.info`,
|
|
58
|
+
fontSize: 12,
|
|
59
|
+
opacity: .7,
|
|
60
|
+
children: ["of ", d]
|
|
61
|
+
})]
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ M(F, {
|
|
64
|
+
componentName: t.componentName,
|
|
65
|
+
onClick: s,
|
|
66
|
+
disabled: !u,
|
|
67
|
+
children: /* @__PURE__ */ M(R, {})
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ M(F, {
|
|
70
|
+
componentName: t.componentName,
|
|
71
|
+
onClick: c,
|
|
72
|
+
disabled: !u,
|
|
73
|
+
children: /* @__PURE__ */ M(ie, {})
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
P.displayName = "DataGridPagination";
|
|
79
|
+
function te({ grid: e, pageSize: t }) {
|
|
80
|
+
let n = e.pagination.pageSizeOptions;
|
|
81
|
+
return !n || n.length === 0 ? null : /* @__PURE__ */ M(f, {
|
|
82
|
+
ai: "center",
|
|
83
|
+
gap: 1,
|
|
84
|
+
me: 1,
|
|
85
|
+
children: /* @__PURE__ */ M(r, {
|
|
86
|
+
component: `${e.componentName}.bottomBar.pagination.pageSize`,
|
|
87
|
+
tag: "select",
|
|
88
|
+
fontSize: 12,
|
|
89
|
+
borderRadius: 4,
|
|
90
|
+
cursor: "pointer",
|
|
91
|
+
props: {
|
|
92
|
+
value: t,
|
|
93
|
+
onChange: (t) => e.pagination.changePageSize(Number(t.target.value))
|
|
94
|
+
},
|
|
95
|
+
children: n.map((e) => /* @__PURE__ */ N("option", {
|
|
96
|
+
value: e,
|
|
97
|
+
children: [e, " / page"]
|
|
98
|
+
}, e))
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function ne({ grid: e, page: t, totalPages: n }) {
|
|
103
|
+
let [r, i] = A(String(t)), [a, o] = A(t);
|
|
104
|
+
t !== a && (o(t), i(String(t)));
|
|
105
|
+
let s = w(() => {
|
|
106
|
+
e.pagination.jumpToPage(r), i(String(e.pagination.page));
|
|
107
|
+
}, [e, r]), c = w((e) => {
|
|
108
|
+
e.key === "Enter" ? s() : e.key === "Escape" && i(String(t));
|
|
109
|
+
}, [s, t]);
|
|
110
|
+
return /* @__PURE__ */ M(m, {
|
|
111
|
+
type: "number",
|
|
112
|
+
variant: "compact",
|
|
113
|
+
value: r,
|
|
114
|
+
onChange: (e) => i(e.target.value),
|
|
115
|
+
textAlign: "center",
|
|
116
|
+
fontSize: 12,
|
|
117
|
+
props: {
|
|
118
|
+
onKeyDown: c,
|
|
119
|
+
onBlur: s,
|
|
120
|
+
min: 1,
|
|
121
|
+
max: n
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function F(e) {
|
|
126
|
+
let { componentName: t, onClick: n, disabled: r, children: i } = e;
|
|
127
|
+
return /* @__PURE__ */ M(d, {
|
|
128
|
+
component: `${t}.bottomBar.pagination.button`,
|
|
129
|
+
clean: !0,
|
|
130
|
+
onClick: n,
|
|
131
|
+
cursor: r ? "default" : "pointer",
|
|
132
|
+
p: 1,
|
|
133
|
+
borderRadius: 4,
|
|
134
|
+
opacity: r ? .3 : .7,
|
|
135
|
+
hover: r ? void 0 : {
|
|
136
|
+
opacity: 1,
|
|
137
|
+
bgColor: "gray-100"
|
|
138
|
+
},
|
|
139
|
+
theme: { dark: { hover: r ? void 0 : { bgColor: "gray-700" } } },
|
|
140
|
+
transitionDuration: 150,
|
|
141
|
+
children: i
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function I(e) {
|
|
145
|
+
return /* @__PURE__ */ M(l, {
|
|
146
|
+
viewBox: "0 0 24 24",
|
|
147
|
+
width: "14",
|
|
148
|
+
height: "14",
|
|
149
|
+
fill: "none",
|
|
150
|
+
stroke: "currentColor",
|
|
151
|
+
strokeWidth: 2,
|
|
152
|
+
strokeLinecap: "round",
|
|
153
|
+
strokeLinejoin: "round",
|
|
154
|
+
children: /* @__PURE__ */ M(c, { d: e.d })
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function L() {
|
|
158
|
+
return /* @__PURE__ */ M(I, { d: "M15 18l-6-6 6-6" });
|
|
159
|
+
}
|
|
160
|
+
function R() {
|
|
161
|
+
return /* @__PURE__ */ M(I, { d: "M9 18l6-6-6-6" });
|
|
162
|
+
}
|
|
163
|
+
function re() {
|
|
164
|
+
return /* @__PURE__ */ M(I, { d: "M18 18l-6-6 6-6M11 18l-6-6 6-6" });
|
|
165
|
+
}
|
|
166
|
+
function ie() {
|
|
167
|
+
return /* @__PURE__ */ M(I, { d: "M6 18l6-6-6-6M13 18l6-6-6-6" });
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/components/dataGrid/components/dataGridBottomBar.tsx
|
|
171
|
+
function ae(e) {
|
|
172
|
+
let { grid: t } = e, { pagination: n, filter: i } = t;
|
|
173
|
+
if (n.state) {
|
|
174
|
+
let { totalItems: e, startItem: i, endItem: a } = n;
|
|
175
|
+
return /* @__PURE__ */ N(f, {
|
|
176
|
+
component: `${t.componentName}.bottomBar`,
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ N(r, {
|
|
179
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
180
|
+
children: ["Rows: ", e > 0 ? `${i}–${a} of ${e}` : "0"]
|
|
181
|
+
}),
|
|
182
|
+
t.props.def.rowSelection && /* @__PURE__ */ N(r, {
|
|
183
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
184
|
+
children: ["Selected: ", t.selectedRows.size]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ M(P, { grid: t })
|
|
187
|
+
]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
let { filtered: a, total: o } = i.filterStats;
|
|
191
|
+
return /* @__PURE__ */ N(f, {
|
|
192
|
+
component: `${t.componentName}.bottomBar`,
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ N(r, {
|
|
195
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
196
|
+
children: ["Rows: ", a === o ? o : `${a} / ${o}`]
|
|
197
|
+
}),
|
|
198
|
+
t.props.def.rowSelection && /* @__PURE__ */ N(r, {
|
|
199
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
200
|
+
children: ["Selected: ", t.selectedRows.size]
|
|
201
|
+
}),
|
|
202
|
+
i.hasActiveFilters && /* @__PURE__ */ M(r, {
|
|
203
|
+
component: `${t.componentName}.bottomBar.clearFilters`,
|
|
204
|
+
color: "blue-600",
|
|
205
|
+
cursor: "pointer",
|
|
206
|
+
hover: { textDecoration: "underline" },
|
|
207
|
+
props: { onClick: i.clearAllFilters },
|
|
208
|
+
children: "Clear filters"
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/components/dataGrid/gridNavigationContext.ts
|
|
215
|
+
var oe = C(null);
|
|
216
|
+
function z() {
|
|
217
|
+
return T(oe);
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/components/dataGrid/useGridNavigation.ts
|
|
221
|
+
var se = "[role=\"gridcell\"],[role=\"columnheader\"]", ce = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])", le = 2, ue = [];
|
|
222
|
+
function de(e) {
|
|
223
|
+
let { grid: t, scrollerRef: r, scrollTop: i, onScrollTo: a } = e, o = t.headerRows.value, c = t.filter.hasFilterableColumns, l = o.length + +!!c, u = t.viewport.isEmpty ? ue : t.flatRows.value, d = t.columns.value.visibleLeafs.length, f = l + u.length, p = w((e) => {
|
|
224
|
+
if (e < o.length) return o[e]?.length ?? 0;
|
|
225
|
+
if (e < l) return d;
|
|
226
|
+
let t = u[e - l];
|
|
227
|
+
return t ? t.cellCount : 0;
|
|
228
|
+
}, [
|
|
229
|
+
u,
|
|
230
|
+
d,
|
|
231
|
+
l,
|
|
232
|
+
o
|
|
233
|
+
]), m = w((e, t) => e < o.length ? (o[e]?.[t]?.headerCell.columnIndex ?? t + 1) - 1 : e < l ? t : u[e - l]?.columnOf(t) ?? t, [
|
|
234
|
+
u,
|
|
235
|
+
l,
|
|
236
|
+
o
|
|
237
|
+
]), h = k(!1), g = w((e, n) => {
|
|
238
|
+
let { viewport: o } = t, s = e - l, c = r.current;
|
|
239
|
+
if (o.showAll || !c) return;
|
|
240
|
+
if (s < 0) {
|
|
241
|
+
n >= l && (c.scrollTop = 0, a(0));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
let { startIndex: u, take: d } = o.window(i);
|
|
245
|
+
if (s >= u + le && s < u + d - le) return;
|
|
246
|
+
let f = o.rowTop(s);
|
|
247
|
+
c.scrollTop = f, a(f);
|
|
248
|
+
}, [
|
|
249
|
+
t,
|
|
250
|
+
l,
|
|
251
|
+
a,
|
|
252
|
+
i,
|
|
253
|
+
r
|
|
254
|
+
]), _ = k(0), v = s({
|
|
255
|
+
count: f,
|
|
256
|
+
columns: p,
|
|
257
|
+
columnIndexOf: m,
|
|
258
|
+
pageSize: t.viewport.pageRows,
|
|
259
|
+
onActiveCellChange: (e, t) => {
|
|
260
|
+
let n = _.current;
|
|
261
|
+
_.current = e.row, t.reason === "keyboard" && (g(e.row, n), h.current = !0);
|
|
262
|
+
}
|
|
263
|
+
}), y = v.activeItem;
|
|
264
|
+
n(() => {
|
|
265
|
+
h.current && (h.current = !1, y()?.focus());
|
|
266
|
+
});
|
|
267
|
+
let b = v.onKeyDown, x = w((e) => {
|
|
268
|
+
let t = e.target, n = t.closest?.(se);
|
|
269
|
+
if (n) {
|
|
270
|
+
if (t !== n) {
|
|
271
|
+
e.key === "Escape" && !n.querySelector("[aria-expanded=\"true\"]") && (e.preventDefault(), n.focus());
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (e.key === "Enter" || e.key === " " || e.key === "F2") {
|
|
275
|
+
let t = o[v.activeIndex]?.[v.activeColumn];
|
|
276
|
+
if (e.key !== "F2" && t?.headerCell.isSortable) {
|
|
277
|
+
e.preventDefault(), t.sortColumn();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
let r = n.querySelector(ce);
|
|
281
|
+
if (r) {
|
|
282
|
+
e.preventDefault(), r.focus();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
b(e);
|
|
287
|
+
}
|
|
288
|
+
}, [
|
|
289
|
+
o,
|
|
290
|
+
v.activeColumn,
|
|
291
|
+
v.activeIndex,
|
|
292
|
+
b
|
|
293
|
+
]);
|
|
294
|
+
return {
|
|
295
|
+
rowCount: f,
|
|
296
|
+
columnCount: d,
|
|
297
|
+
headerRowCount: l,
|
|
298
|
+
cellProps: v.cellProps,
|
|
299
|
+
onKeyDown: x
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/utils/array/arrayUtils.ts
|
|
304
|
+
var fe;
|
|
305
|
+
(function(e) {
|
|
306
|
+
function t(e, t, n = 0) {
|
|
307
|
+
return e.slice(n, n + t);
|
|
308
|
+
}
|
|
309
|
+
e.take = t;
|
|
310
|
+
function n(e, t, n = 0) {
|
|
311
|
+
return e.reduce((e, n, r) => e + t(n, r), n);
|
|
312
|
+
}
|
|
313
|
+
e.sumBy = n;
|
|
314
|
+
function r(e, t, n) {
|
|
315
|
+
return [...e].sort((e, r) => {
|
|
316
|
+
let i = t(e), a = t(r);
|
|
317
|
+
return i < a ? n === "DESC" ? 1 : -1 : i > a ? n === "DESC" ? -1 : 1 : 0;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
e.sortBy = r;
|
|
321
|
+
function i(e, t) {
|
|
322
|
+
return Math.max(...e.map(t));
|
|
323
|
+
}
|
|
324
|
+
e.maxBy = i;
|
|
325
|
+
function a(e, t) {
|
|
326
|
+
let n = e.find(t);
|
|
327
|
+
if (n === void 0) throw Error("No items satisfy the provided condition.");
|
|
328
|
+
return n;
|
|
329
|
+
}
|
|
330
|
+
e.findOrThrow = a;
|
|
331
|
+
function o(e, t) {
|
|
332
|
+
return e.reduce((e, n) => {
|
|
333
|
+
let r = t(n);
|
|
334
|
+
if (!r) return e;
|
|
335
|
+
let [i, a] = r;
|
|
336
|
+
return e[i] = a, e;
|
|
337
|
+
}, {});
|
|
338
|
+
}
|
|
339
|
+
e.toRecord = o;
|
|
340
|
+
function s(e, t) {
|
|
341
|
+
let n = e.reduce((e, n, r) => {
|
|
342
|
+
let i = t(n, r);
|
|
343
|
+
return e.has(i) === !1 && e.set(i, []), e.get(i)?.push(n), e;
|
|
344
|
+
}, /* @__PURE__ */ new Map());
|
|
345
|
+
return Array.from(n, ([e, t]) => ({
|
|
346
|
+
key: e,
|
|
347
|
+
values: t
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
e.groupBy = s;
|
|
351
|
+
})(fe ||= {});
|
|
352
|
+
var B = fe, V = class e {
|
|
353
|
+
grid;
|
|
354
|
+
parentRow;
|
|
355
|
+
constructor(e, t) {
|
|
356
|
+
this.grid = e, this.parentRow = t;
|
|
357
|
+
}
|
|
358
|
+
kind = "detail";
|
|
359
|
+
get key() {
|
|
360
|
+
return `detail-${this.parentRow.key}`;
|
|
361
|
+
}
|
|
362
|
+
get isAutoHeight() {
|
|
363
|
+
return this.height === "auto";
|
|
364
|
+
}
|
|
365
|
+
static AUTO_HEIGHT_ESTIMATE = 200;
|
|
366
|
+
get height() {
|
|
367
|
+
let e = this.grid.props.def.rowDetail;
|
|
368
|
+
return !e || e.height === void 0 || e.height === "auto" ? "auto" : typeof e.height == "function" ? e.height(this.parentRow.data) : e.height;
|
|
369
|
+
}
|
|
370
|
+
get heightForOffset() {
|
|
371
|
+
let t = this.height;
|
|
372
|
+
return t === "auto" ? e.AUTO_HEIGHT_ESTIMATE : t;
|
|
373
|
+
}
|
|
374
|
+
count = 0;
|
|
375
|
+
cellCount = 1;
|
|
376
|
+
columnOf() {
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
get flatRows() {
|
|
380
|
+
return [this];
|
|
381
|
+
}
|
|
382
|
+
get allRows() {
|
|
383
|
+
return [];
|
|
384
|
+
}
|
|
385
|
+
}, H = Symbol("memo.unset"), pe = class {
|
|
386
|
+
action;
|
|
387
|
+
deps;
|
|
388
|
+
cache = H;
|
|
389
|
+
dependents = /* @__PURE__ */ new Set();
|
|
390
|
+
wired = !1;
|
|
391
|
+
constructor(e, t) {
|
|
392
|
+
this.action = e, this.deps = t;
|
|
393
|
+
}
|
|
394
|
+
wire() {
|
|
395
|
+
if (!this.wired) {
|
|
396
|
+
this.wired = !0;
|
|
397
|
+
for (let e of this.deps()) e.dependents.add(this);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
get value() {
|
|
401
|
+
return this.wire(), this.cache === H && (this.cache = this.action()), this.cache;
|
|
402
|
+
}
|
|
403
|
+
clear() {
|
|
404
|
+
if (this.wire(), this.cache !== H) {
|
|
405
|
+
this.cache = H;
|
|
406
|
+
for (let e of this.dependents) e.clear();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
function U(e, t = () => []) {
|
|
411
|
+
return new pe(e, t);
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/utils/string/fuzzySearch.ts
|
|
415
|
+
function me(e, t) {
|
|
416
|
+
if (!e) return {
|
|
417
|
+
score: 1,
|
|
418
|
+
matches: []
|
|
419
|
+
};
|
|
420
|
+
if (!t) return null;
|
|
421
|
+
let n = e.toLowerCase(), r = t.toLowerCase(), i = 0, a = 0, o = [], s = -1, c = 0, l = 0;
|
|
422
|
+
for (; i < n.length && a < r.length;) n[i] === r[a] ? (s === -1 && (s = a), i++, l++, c += l, (a === 0 || /\s|_|-/.test(t[a - 1])) && (c += 5), e[i - 1] === t[a] && (c += 1)) : (s !== -1 && (o.push([s, a]), s = -1), l = 0), a++;
|
|
423
|
+
return s !== -1 && o.push([s, a]), i < n.length ? null : (c /= t.length, {
|
|
424
|
+
score: c,
|
|
425
|
+
matches: o
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function he(e, t) {
|
|
429
|
+
return me(e, t) !== null;
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/icons/expandIcon.tsx
|
|
433
|
+
function W(e) {
|
|
434
|
+
return /* @__PURE__ */ M(l, {
|
|
435
|
+
viewBox: "4 2 16 18",
|
|
436
|
+
width: "1rem",
|
|
437
|
+
fill: "currentColor",
|
|
438
|
+
...e,
|
|
439
|
+
children: /* @__PURE__ */ M(c, {
|
|
440
|
+
fillRule: "evenodd",
|
|
441
|
+
d: "M12.707 14.707a1 1 0 0 1-1.414 0l-5-5a1 1 0 0 1 1.414-1.414L12 12.586l4.293-4.293a1 1 0 1 1 1.414 1.414l-5 5Z",
|
|
442
|
+
props: { clipRule: "evenodd" }
|
|
443
|
+
})
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/components/dataGrid/components/dataGridCellRowDetail.tsx
|
|
448
|
+
function ge(e) {
|
|
449
|
+
let { cell: t } = e, n = t.isExpanded, r = w((e) => {
|
|
450
|
+
e.stopPropagation(), t.toggleDetail();
|
|
451
|
+
}, [t]);
|
|
452
|
+
return /* @__PURE__ */ M(d, {
|
|
453
|
+
component: `${t.grid.componentName}.body.cell.rowDetail`,
|
|
454
|
+
variant: { isExpanded: n },
|
|
455
|
+
clean: !0,
|
|
456
|
+
type: "button",
|
|
457
|
+
onClick: r,
|
|
458
|
+
cursor: "pointer",
|
|
459
|
+
display: "flex",
|
|
460
|
+
ai: "center",
|
|
461
|
+
jc: "center",
|
|
462
|
+
width: "fit",
|
|
463
|
+
height: "fit",
|
|
464
|
+
props: {
|
|
465
|
+
"aria-label": `${n ? "Collapse" : "Expand"} details for row ${t.row.rowIndex + 1}`,
|
|
466
|
+
"aria-expanded": n
|
|
467
|
+
},
|
|
468
|
+
children: /* @__PURE__ */ M(W, {
|
|
469
|
+
fill: "currentColor",
|
|
470
|
+
width: "14px",
|
|
471
|
+
height: "14px",
|
|
472
|
+
rotate: n ? 0 : -90
|
|
473
|
+
})
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
ge.displayName = "DataGridCellRowDetail";
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/components/dataGrid/components/dataGridCellRowSelection.tsx
|
|
479
|
+
function _e(e) {
|
|
480
|
+
let { cell: t } = e, n = w(() => {
|
|
481
|
+
t.toggleSelection();
|
|
482
|
+
}, [t]);
|
|
483
|
+
return /* @__PURE__ */ M(p, {
|
|
484
|
+
variant: "datagrid",
|
|
485
|
+
checked: t.selected,
|
|
486
|
+
onChange: n,
|
|
487
|
+
props: { "aria-label": `Select row ${t.row.rowIndex + 1}` }
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
_e.displayName = "DataGridCellRowSelection";
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/components/dataGrid/contracts/dataGridContract.ts
|
|
493
|
+
function G(e) {
|
|
494
|
+
if (e) return e === "LEFT" ? "START" : e === "RIGHT" ? "END" : e;
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/components/dataGrid/models/headerCellModel.ts
|
|
498
|
+
var ve = 1e3, ye = class {
|
|
499
|
+
column;
|
|
500
|
+
constructor(e) {
|
|
501
|
+
this.column = e;
|
|
502
|
+
}
|
|
503
|
+
get grid() {
|
|
504
|
+
return this.column.grid;
|
|
505
|
+
}
|
|
506
|
+
get label() {
|
|
507
|
+
let e = this.column;
|
|
508
|
+
if (e.isRowNumber || e.isRowSelection) return null;
|
|
509
|
+
if (e.isGrouping) {
|
|
510
|
+
if (this.grid.groupColumns.size === 1) {
|
|
511
|
+
let e = this.grid.groupColumns.values().next().value, t = B.findOrThrow(this.grid.columns.value.leafs, (t) => t.key === e);
|
|
512
|
+
return t.header ?? t.key;
|
|
513
|
+
}
|
|
514
|
+
return "Group";
|
|
515
|
+
}
|
|
516
|
+
return e.header ?? e.key;
|
|
517
|
+
}
|
|
518
|
+
get hiddenLabel() {
|
|
519
|
+
if (this.column.isRowNumber) return "Row number";
|
|
520
|
+
if (this.column.isRowDetail) return "Row details";
|
|
521
|
+
}
|
|
522
|
+
get isSortable() {
|
|
523
|
+
let e = this.column;
|
|
524
|
+
return e.isLeaf && !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.sortable;
|
|
525
|
+
}
|
|
526
|
+
get isSorted() {
|
|
527
|
+
return this.column.key === this.grid.sortColumn;
|
|
528
|
+
}
|
|
529
|
+
get sortDirection() {
|
|
530
|
+
return this.grid.sortDirection;
|
|
531
|
+
}
|
|
532
|
+
get showResizer() {
|
|
533
|
+
let e = this.column;
|
|
534
|
+
return !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.resizable;
|
|
535
|
+
}
|
|
536
|
+
get showContextMenu() {
|
|
537
|
+
let e = this.column;
|
|
538
|
+
return !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.showContextMenu;
|
|
539
|
+
}
|
|
540
|
+
get gridColumn() {
|
|
541
|
+
return this.column.isLeaf ? 1 : this.column.leafs.length;
|
|
542
|
+
}
|
|
543
|
+
get columnIndex() {
|
|
544
|
+
let e = this.column.leafs[0] ?? this.column;
|
|
545
|
+
return this.grid.columns.value.visibleLeafs.indexOf(e) + 1;
|
|
546
|
+
}
|
|
547
|
+
get columnSpan() {
|
|
548
|
+
let e = this.column.leafs.length;
|
|
549
|
+
return e > 1 ? e : void 0;
|
|
550
|
+
}
|
|
551
|
+
get rowSpan() {
|
|
552
|
+
let e = this.column.gridRows;
|
|
553
|
+
return e > 1 ? e : void 0;
|
|
554
|
+
}
|
|
555
|
+
get ariaSort() {
|
|
556
|
+
if (this.isSortable) return !this.isSorted || !this.sortDirection ? "none" : this.sortDirection === "ASC" ? "ascending" : "descending";
|
|
557
|
+
}
|
|
558
|
+
get resizerLabel() {
|
|
559
|
+
return `Resize ${this.label ?? this.column.key}`;
|
|
560
|
+
}
|
|
561
|
+
get width() {
|
|
562
|
+
return this.column.inlineWidth ?? this.column.baseWidth;
|
|
563
|
+
}
|
|
564
|
+
get minWidth() {
|
|
565
|
+
return Math.max(1, this.column.leafs.length) * this.grid.MIN_COLUMN_WIDTH_PX;
|
|
566
|
+
}
|
|
567
|
+
get maxWidth() {
|
|
568
|
+
return Math.max(this.grid.containerWidth || ve, this.width, this.minWidth);
|
|
569
|
+
}
|
|
570
|
+
get paddingStart() {
|
|
571
|
+
if (!this.column.isRowSelection) return this.column.isEndAligned ? 10 : 3;
|
|
572
|
+
}
|
|
573
|
+
get paddingEnd() {
|
|
574
|
+
if (!this.column.isRowSelection) return this.column.align === "center" ? 3 : void 0;
|
|
575
|
+
}
|
|
576
|
+
get variant() {
|
|
577
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.column.pinFlags.value;
|
|
578
|
+
return {
|
|
579
|
+
isPinned: e,
|
|
580
|
+
isFirstStartPinned: t,
|
|
581
|
+
isLastStartPinned: n,
|
|
582
|
+
isFirstEndPinned: r,
|
|
583
|
+
isLastEndPinned: i,
|
|
584
|
+
isSortable: this.isSortable,
|
|
585
|
+
isRowNumber: this.column.isRowNumber,
|
|
586
|
+
isFirstLeaf: this.column.isFirstLeaf,
|
|
587
|
+
isLastLeaf: this.column.isLastLeaf
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
get contextMenuButtonVariant() {
|
|
591
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.column.pinFlags.value;
|
|
592
|
+
return {
|
|
593
|
+
isPinned: e,
|
|
594
|
+
isFirstStartPinned: t,
|
|
595
|
+
isLastStartPinned: n,
|
|
596
|
+
isFirstEndPinned: r,
|
|
597
|
+
isLastEndPinned: i,
|
|
598
|
+
isSortable: this.isSortable,
|
|
599
|
+
isRowNumber: this.column.isRowNumber
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
get sections() {
|
|
603
|
+
return this.column.contextMenuSections;
|
|
604
|
+
}
|
|
605
|
+
get canSortAsc() {
|
|
606
|
+
let { key: e } = this.column;
|
|
607
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && (this.grid.sortColumn !== e || this.grid.sortDirection === "DESC");
|
|
608
|
+
}
|
|
609
|
+
get canSortDesc() {
|
|
610
|
+
let { key: e } = this.column;
|
|
611
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && (this.grid.sortColumn !== e || this.grid.sortDirection === "ASC");
|
|
612
|
+
}
|
|
613
|
+
get canClearSort() {
|
|
614
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && this.grid.sortColumn === this.column.key;
|
|
615
|
+
}
|
|
616
|
+
get canPinStart() {
|
|
617
|
+
return this.sections.pin && this.column.pin !== "START";
|
|
618
|
+
}
|
|
619
|
+
get canPinEnd() {
|
|
620
|
+
return this.sections.pin && this.column.pin !== "END";
|
|
621
|
+
}
|
|
622
|
+
get canUnpin() {
|
|
623
|
+
return this.sections.pin && !!this.column.pin;
|
|
624
|
+
}
|
|
625
|
+
get canGroupBy() {
|
|
626
|
+
return this.sections.group && this.column.isLeaf && !this.column.isGrouping;
|
|
627
|
+
}
|
|
628
|
+
get canUnGroupAll() {
|
|
629
|
+
return this.sections.group && this.column.isLeaf && this.column.isGrouping;
|
|
630
|
+
}
|
|
631
|
+
get hasSortSection() {
|
|
632
|
+
return this.canSortAsc || this.canSortDesc || this.canClearSort;
|
|
633
|
+
}
|
|
634
|
+
get hasPinSection() {
|
|
635
|
+
return this.canPinStart || this.canPinEnd || this.canUnpin;
|
|
636
|
+
}
|
|
637
|
+
get hasGroupSection() {
|
|
638
|
+
return this.canGroupBy || this.canUnGroupAll;
|
|
639
|
+
}
|
|
640
|
+
}, K = class e {
|
|
641
|
+
def;
|
|
642
|
+
grid;
|
|
643
|
+
parent;
|
|
644
|
+
constructor(t, n, r) {
|
|
645
|
+
if (this.def = t, this.grid = n, this.parent = r, this.columns = t.columns?.map((r) => new e(t.pin ? {
|
|
646
|
+
...r,
|
|
647
|
+
pin: t.pin
|
|
648
|
+
} : r, n, this)) ?? [], this.isLeaf) {
|
|
649
|
+
let e = this.grid.columnWidths.get(this.key);
|
|
650
|
+
this._inlineWidth = e ?? this.def.width ?? this.grid.DEFAULT_COLUMN_WIDTH_PX, this._pin = G(t.pin);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
columns = [];
|
|
654
|
+
get kind() {
|
|
655
|
+
switch (this.key) {
|
|
656
|
+
case q: return "rowNumber";
|
|
657
|
+
case J: return "rowSelection";
|
|
658
|
+
case X: return "rowDetail";
|
|
659
|
+
case Y: return "grouping";
|
|
660
|
+
default: return "data";
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
get isRowNumber() {
|
|
664
|
+
return this.kind === "rowNumber";
|
|
665
|
+
}
|
|
666
|
+
get isRowSelection() {
|
|
667
|
+
return this.kind === "rowSelection";
|
|
668
|
+
}
|
|
669
|
+
get isRowDetail() {
|
|
670
|
+
return this.kind === "rowDetail";
|
|
671
|
+
}
|
|
672
|
+
get isGrouping() {
|
|
673
|
+
return this.kind === "grouping";
|
|
674
|
+
}
|
|
675
|
+
get isData() {
|
|
676
|
+
return this.kind === "data";
|
|
677
|
+
}
|
|
678
|
+
pinFlags = U(() => {
|
|
679
|
+
let e = this.pin === "START", t = this.pin === "END";
|
|
680
|
+
return {
|
|
681
|
+
isStartPinned: e,
|
|
682
|
+
isEndPinned: t,
|
|
683
|
+
isPinned: e || t,
|
|
684
|
+
isFirstStartPinned: e && this.startOffset === 0,
|
|
685
|
+
isLastStartPinned: e && this.isEdge,
|
|
686
|
+
isFirstEndPinned: t && this.isEdge,
|
|
687
|
+
isLastEndPinned: t && this.endOffset === 0
|
|
688
|
+
};
|
|
689
|
+
}, () => [this.grid.columns]);
|
|
690
|
+
cellVariant = U(() => {
|
|
691
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.pinFlags.value;
|
|
692
|
+
return {
|
|
693
|
+
isPinned: e,
|
|
694
|
+
isFirstStartPinned: t,
|
|
695
|
+
isLastStartPinned: n,
|
|
696
|
+
isFirstEndPinned: r,
|
|
697
|
+
isLastEndPinned: i,
|
|
698
|
+
isRowSelection: this.isRowSelection,
|
|
699
|
+
isRowNumber: this.isRowNumber,
|
|
700
|
+
isFirstLeaf: this.isFirstLeaf,
|
|
701
|
+
isLastLeaf: this.isLastLeaf,
|
|
702
|
+
isRowDetail: this.isRowDetail
|
|
703
|
+
};
|
|
704
|
+
}, () => [this.pinFlags]);
|
|
705
|
+
cellStyleVars = U(() => {
|
|
706
|
+
let { isStartPinned: e, isEndPinned: t } = this.pinFlags.value;
|
|
707
|
+
return {
|
|
708
|
+
width: `var(${this.widthVarName})`,
|
|
709
|
+
height: `var(${this.grid.rowHeightVarName})`,
|
|
710
|
+
insetInlineStart: e ? `var(${this.inlineStartVarName})` : void 0,
|
|
711
|
+
insetInlineEnd: t ? `var(${this.inlineEndVarName})` : void 0
|
|
712
|
+
};
|
|
713
|
+
}, () => [this.pinFlags]);
|
|
714
|
+
_headerCell = U(() => new ye(this));
|
|
715
|
+
get headerCell() {
|
|
716
|
+
return this._headerCell.value;
|
|
717
|
+
}
|
|
718
|
+
get visibleColumns() {
|
|
719
|
+
return this.columns.filter((e) => e.isVisible);
|
|
720
|
+
}
|
|
721
|
+
get isFirstLeaf() {
|
|
722
|
+
let { leafs: e } = this;
|
|
723
|
+
return e.length > 0 && e.at(0) === this;
|
|
724
|
+
}
|
|
725
|
+
get isLastLeaf() {
|
|
726
|
+
let { leafs: e } = this;
|
|
727
|
+
return e.length > 0 && e.at(-1) === this;
|
|
728
|
+
}
|
|
729
|
+
get key() {
|
|
730
|
+
return this.def.key;
|
|
731
|
+
}
|
|
732
|
+
get header() {
|
|
733
|
+
return this.def.header;
|
|
734
|
+
}
|
|
735
|
+
get align() {
|
|
736
|
+
return this.def.align;
|
|
737
|
+
}
|
|
738
|
+
get isEndAligned() {
|
|
739
|
+
return this.align === "end" || this.align === "right";
|
|
740
|
+
}
|
|
741
|
+
get hasAlign() {
|
|
742
|
+
return "align" in this.def;
|
|
743
|
+
}
|
|
744
|
+
get isLeaf() {
|
|
745
|
+
return this.columns.length === 0;
|
|
746
|
+
}
|
|
747
|
+
get Cell() {
|
|
748
|
+
return this.def.Cell;
|
|
749
|
+
}
|
|
750
|
+
get filterable() {
|
|
751
|
+
return this.def.filterable;
|
|
752
|
+
}
|
|
753
|
+
get filterConfig() {
|
|
754
|
+
let { filterable: e } = this.def;
|
|
755
|
+
if (e) return typeof e == "object" ? e : { type: "text" };
|
|
756
|
+
}
|
|
757
|
+
get currentFilter() {
|
|
758
|
+
return this.grid.columnFilters[this.key];
|
|
759
|
+
}
|
|
760
|
+
get filterOptions() {
|
|
761
|
+
let e = this.filterConfig;
|
|
762
|
+
return e?.type === "multiselect" && e.options ? e.options : this.grid.getColumnUniqueValues(this.key).map((e) => ({
|
|
763
|
+
label: e === null ? "(empty)" : String(e),
|
|
764
|
+
value: e
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
767
|
+
setTextFilter(e) {
|
|
768
|
+
this.grid.setColumnFilter(this.key, e.trim() ? {
|
|
769
|
+
type: "text",
|
|
770
|
+
value: e
|
|
771
|
+
} : void 0);
|
|
772
|
+
}
|
|
773
|
+
setNumberFilter(e, t, n) {
|
|
774
|
+
let r = typeof t == "number" ? t : parseFloat(t);
|
|
775
|
+
if (isNaN(r) || t === "") {
|
|
776
|
+
this.grid.setColumnFilter(this.key, void 0);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
let i = {
|
|
780
|
+
type: "number",
|
|
781
|
+
operator: e,
|
|
782
|
+
value: r
|
|
783
|
+
};
|
|
784
|
+
if (e === "between" && n !== void 0 && n !== "") {
|
|
785
|
+
let e = typeof n == "number" ? n : parseFloat(String(n));
|
|
786
|
+
isNaN(e) || (i.valueTo = e);
|
|
787
|
+
}
|
|
788
|
+
this.grid.setColumnFilter(this.key, i);
|
|
789
|
+
}
|
|
790
|
+
setMultiselectFilter(e) {
|
|
791
|
+
this.grid.setColumnFilter(this.key, e.length === 0 ? void 0 : {
|
|
792
|
+
type: "multiselect",
|
|
793
|
+
values: e
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
clearFilter() {
|
|
797
|
+
this.grid.setColumnFilter(this.key, void 0);
|
|
798
|
+
}
|
|
799
|
+
get sortable() {
|
|
800
|
+
return this.def.sortable === void 0 ? this.grid.props.def.sortable !== !1 : this.def.sortable;
|
|
801
|
+
}
|
|
802
|
+
get resizable() {
|
|
803
|
+
return this.def.resizable === void 0 ? this.grid.props.def.resizable !== !1 : this.def.resizable;
|
|
804
|
+
}
|
|
805
|
+
get contextMenu() {
|
|
806
|
+
return this.def.contextMenu === void 0 ? this.grid.props.def.contextMenu ?? !0 : this.def.contextMenu;
|
|
807
|
+
}
|
|
808
|
+
get showContextMenu() {
|
|
809
|
+
let e = this.contextMenu;
|
|
810
|
+
return typeof e == "boolean" ? e : e.sort !== !1 || e.pin !== !1 || e.group !== !1;
|
|
811
|
+
}
|
|
812
|
+
get contextMenuSections() {
|
|
813
|
+
let e = this.contextMenu;
|
|
814
|
+
return typeof e == "boolean" ? {
|
|
815
|
+
sort: e,
|
|
816
|
+
pin: e,
|
|
817
|
+
group: e
|
|
818
|
+
} : {
|
|
819
|
+
sort: e.sort !== !1,
|
|
820
|
+
pin: e.pin !== !1,
|
|
821
|
+
group: e.group !== !1
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
get isFlexible() {
|
|
825
|
+
return this.def.flexible !== !1;
|
|
826
|
+
}
|
|
827
|
+
get baseWidth() {
|
|
828
|
+
return this._inlineWidth ?? this.grid.DEFAULT_COLUMN_WIDTH_PX;
|
|
829
|
+
}
|
|
830
|
+
_pin;
|
|
831
|
+
get pin() {
|
|
832
|
+
if (this.isLeaf) return this._pin;
|
|
833
|
+
let e = [...new Set(this.columns.flatMap((e) => e.pin))];
|
|
834
|
+
if (e.length === 1) return e[0];
|
|
835
|
+
}
|
|
836
|
+
get uniqueKey() {
|
|
837
|
+
return `${this.key}${this.pin ?? ""}`;
|
|
838
|
+
}
|
|
839
|
+
getPinnedColumn(t) {
|
|
840
|
+
if (this.hasPin(t)) {
|
|
841
|
+
if (this.isLeaf) return this;
|
|
842
|
+
let n = new e({
|
|
843
|
+
...this.def,
|
|
844
|
+
pin: t
|
|
845
|
+
}, this.grid, this.parent);
|
|
846
|
+
return n.columns = this.columns.filter((e) => e.hasPin(t)).map((e) => {
|
|
847
|
+
let r = e.getPinnedColumn(t);
|
|
848
|
+
return r.parent = n, r;
|
|
849
|
+
}).filter((e) => !!e), n;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
hasPin(e) {
|
|
853
|
+
return this.isLeaf ? this._pin === e : this.columns.some((t) => t.hasPin(e));
|
|
854
|
+
}
|
|
855
|
+
get death() {
|
|
856
|
+
return this.parent ? this.parent.death + 1 : 0;
|
|
857
|
+
}
|
|
858
|
+
get flatColumns() {
|
|
859
|
+
let e = [this];
|
|
860
|
+
return e.push(...this.columns.flatMap((e) => e.flatColumns)), e;
|
|
861
|
+
}
|
|
862
|
+
_inlineWidth;
|
|
863
|
+
get inlineWidth() {
|
|
864
|
+
if (this.isLeaf) return this.grid.getFlexWidth(this.key) ?? this._inlineWidth;
|
|
865
|
+
let e = this.visibleColumns.map((e) => e.inlineWidth).filter((e) => typeof e == "number");
|
|
866
|
+
if (e.length !== 0) return B.sumBy(e, (e) => e);
|
|
867
|
+
}
|
|
868
|
+
get startOffset() {
|
|
869
|
+
let e = 0;
|
|
870
|
+
if (this.parent) {
|
|
871
|
+
let { visibleColumns: t, startOffset: n } = this.parent, r = t.findIndex((e) => e === this);
|
|
872
|
+
e += B.sumBy(t, (e, t) => t < r ? e.inlineWidth ?? 0 : 0), e += n;
|
|
873
|
+
} else {
|
|
874
|
+
let t = this.grid.columns.value.start.filter((e) => e.isVisible), n = t.findIndex((e) => e === this);
|
|
875
|
+
e += B.sumBy(t, (e, t) => t < n ? e.inlineWidth ?? 0 : 0);
|
|
876
|
+
}
|
|
877
|
+
return e;
|
|
878
|
+
}
|
|
879
|
+
get endOffset() {
|
|
880
|
+
let e = 0;
|
|
881
|
+
if (this.parent) {
|
|
882
|
+
let { visibleColumns: t } = this.parent, n = t.reverse(), r = n.findIndex((e) => e === this);
|
|
883
|
+
e += B.sumBy(n, (e, t) => t < r ? e.inlineWidth ?? 0 : 0), e += this.parent.endOffset;
|
|
884
|
+
} else {
|
|
885
|
+
let t = this.grid.columns.value.end.filter((e) => e.isVisible).reverse(), n = t.findIndex((e) => e === this);
|
|
886
|
+
e += B.sumBy(t, (e, t) => t < n ? e.inlineWidth ?? 0 : 0);
|
|
887
|
+
}
|
|
888
|
+
return e;
|
|
889
|
+
}
|
|
890
|
+
get isEdge() {
|
|
891
|
+
if (!this.pin) return !1;
|
|
892
|
+
if (this.parent) {
|
|
893
|
+
let { visibleColumns: e } = this.parent;
|
|
894
|
+
return (this.pin === "START" ? e.at(-1) : e.at(0)) === this && this.parent.isEdge;
|
|
895
|
+
}
|
|
896
|
+
return (this.pin === "START" ? this.grid.columns.value.start.filter((e) => e.isVisible).at(-1) : this.grid.columns.value.end.filter((e) => e.isVisible).at(0)) === this;
|
|
897
|
+
}
|
|
898
|
+
get isVisible() {
|
|
899
|
+
return this.isLeaf ? !this.grid.hiddenColumns.has(this.key) : this.leafs.some((e) => e.isVisible);
|
|
900
|
+
}
|
|
901
|
+
get leafs() {
|
|
902
|
+
return this.isLeaf ? [this] : this.visibleColumns.flatMap((e) => e.leafs);
|
|
903
|
+
}
|
|
904
|
+
get groupColumnWidthVarName() {
|
|
905
|
+
return `--${this.uniqueKey}-group-width`;
|
|
906
|
+
}
|
|
907
|
+
get widthVarName() {
|
|
908
|
+
return `--${this.uniqueKey}-width`;
|
|
909
|
+
}
|
|
910
|
+
get inlineStartVarName() {
|
|
911
|
+
return `--${this.uniqueKey}-inline-start`;
|
|
912
|
+
}
|
|
913
|
+
get inlineEndVarName() {
|
|
914
|
+
return `--${this.uniqueKey}-inline-end`;
|
|
915
|
+
}
|
|
916
|
+
get gridRows() {
|
|
917
|
+
return this.isLeaf ? this.grid.columns.value.maxDeath - this.death : 1;
|
|
918
|
+
}
|
|
919
|
+
_resizeStartX = 0;
|
|
920
|
+
_resizeSizes = {};
|
|
921
|
+
_resizeTotalWidth = 0;
|
|
922
|
+
beginResize = (e) => {
|
|
923
|
+
let { MIN_COLUMN_WIDTH_PX: t } = this.grid;
|
|
924
|
+
this._resizeStartX = e, this._resizeSizes = B.toRecord(this.leafs, (e) => [e.key, e.inlineWidth ?? e.baseWidth]), this._resizeTotalWidth = B.sumBy(this.leafs, (e) => this._resizeSizes[e.key]) - this.leafs.length * t;
|
|
925
|
+
};
|
|
926
|
+
get resizeSign() {
|
|
927
|
+
return this.pin === "END" === this.grid.isRtl ? 1 : -1;
|
|
928
|
+
}
|
|
929
|
+
applyResize = (e) => {
|
|
930
|
+
let { MIN_COLUMN_WIDTH_PX: t } = this.grid, n = (e - this._resizeStartX) * this.resizeSign;
|
|
931
|
+
this.leafs.forEach((e) => {
|
|
932
|
+
let r = this._resizeSizes[e.key], i = this._resizeTotalWidth > 0 ? (r - t) / this._resizeTotalWidth * n : n / this.leafs.length, a = Math.round(r + i);
|
|
933
|
+
e.setWidth(a < t ? t : a);
|
|
934
|
+
}), this.grid.flexWidths.clear();
|
|
935
|
+
};
|
|
936
|
+
resizeTo = (e) => {
|
|
937
|
+
this.applyResize(e), this.grid.notify();
|
|
938
|
+
};
|
|
939
|
+
endResize = () => {
|
|
940
|
+
this.grid.notify();
|
|
941
|
+
};
|
|
942
|
+
moveResizer = (e) => {
|
|
943
|
+
this.beginResize(0), this.applyResize(e);
|
|
944
|
+
};
|
|
945
|
+
resizeWidthTo = (e) => {
|
|
946
|
+
let t = this.inlineWidth ?? this.baseWidth;
|
|
947
|
+
this.moveResizer((e - t) * this.resizeSign);
|
|
948
|
+
};
|
|
949
|
+
pinColumn = (e) => {
|
|
950
|
+
this.isLeaf ? this._pin = G(e) : this.columns.forEach((t) => t.pinColumn(e)), this.grid.pinColumn(this.uniqueKey, e);
|
|
951
|
+
};
|
|
952
|
+
toggleGrouping = () => {
|
|
953
|
+
this.grid.toggleGrouping(this.key);
|
|
954
|
+
};
|
|
955
|
+
sortColumn = (...e) => {
|
|
956
|
+
this.grid.setSortColumn(this.key, ...e);
|
|
957
|
+
};
|
|
958
|
+
setWidth = (e) => {
|
|
959
|
+
if (!this.isLeaf) throw Error("Cannot set width for a parent column.");
|
|
960
|
+
this._inlineWidth !== e && (this._inlineWidth = e, this.grid.setWidth(this.key, e));
|
|
961
|
+
};
|
|
962
|
+
toggleVisibility = () => {
|
|
963
|
+
this.grid.toggleColumnVisibility(this.key);
|
|
964
|
+
};
|
|
965
|
+
}, be = class {
|
|
966
|
+
grid;
|
|
967
|
+
constructor(e) {
|
|
968
|
+
this.grid = e;
|
|
969
|
+
}
|
|
970
|
+
get entries() {
|
|
971
|
+
return this.grid.columns.value.leafs.filter((e) => e.isData).map((e) => ({
|
|
972
|
+
id: String(e.key),
|
|
973
|
+
label: String(e.header ?? e.key),
|
|
974
|
+
column: e,
|
|
975
|
+
visible: e.isVisible
|
|
976
|
+
}));
|
|
977
|
+
}
|
|
978
|
+
get selectedIds() {
|
|
979
|
+
return this.entries.filter((e) => e.visible).map((e) => e.id);
|
|
980
|
+
}
|
|
981
|
+
get total() {
|
|
982
|
+
return this.entries.length;
|
|
983
|
+
}
|
|
984
|
+
get hiddenCount() {
|
|
985
|
+
return this.entries.reduce((e, t) => t.visible ? e : e + 1, 0);
|
|
986
|
+
}
|
|
987
|
+
get hasHidden() {
|
|
988
|
+
return this.hiddenCount > 0;
|
|
989
|
+
}
|
|
990
|
+
setVisibility = (e) => {
|
|
991
|
+
let t = new Set(e);
|
|
992
|
+
this.entries.forEach((e) => {
|
|
993
|
+
let n = t.has(e.id);
|
|
994
|
+
e.visible !== n && e.column.toggleVisibility();
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
}, xe = class {
|
|
998
|
+
grid;
|
|
999
|
+
constructor(e) {
|
|
1000
|
+
this.grid = e;
|
|
1001
|
+
}
|
|
1002
|
+
get globalFilterValue() {
|
|
1003
|
+
return this.grid.globalFilterValue;
|
|
1004
|
+
}
|
|
1005
|
+
get columnFilters() {
|
|
1006
|
+
return this.grid.columnFilters;
|
|
1007
|
+
}
|
|
1008
|
+
get hasActiveFilters() {
|
|
1009
|
+
return this.grid.hasActiveFilters;
|
|
1010
|
+
}
|
|
1011
|
+
get filterStats() {
|
|
1012
|
+
return this.grid.filterStats;
|
|
1013
|
+
}
|
|
1014
|
+
get hasFilterableColumns() {
|
|
1015
|
+
return this.grid.columns.value.visibleLeafs.some((e) => !!e.filterable);
|
|
1016
|
+
}
|
|
1017
|
+
setGlobalFilter = (e) => this.grid.setGlobalFilter(e);
|
|
1018
|
+
clearAllFilters = () => this.grid.clearAllFilters();
|
|
1019
|
+
}, Se = class {
|
|
1020
|
+
grid;
|
|
1021
|
+
constructor(e) {
|
|
1022
|
+
this.grid = e;
|
|
1023
|
+
}
|
|
1024
|
+
get isPaginated() {
|
|
1025
|
+
return this.grid.isPaginated;
|
|
1026
|
+
}
|
|
1027
|
+
get state() {
|
|
1028
|
+
return this.grid.paginationState;
|
|
1029
|
+
}
|
|
1030
|
+
get pageSizeOptions() {
|
|
1031
|
+
return this.grid.pageSizeOptions;
|
|
1032
|
+
}
|
|
1033
|
+
get page() {
|
|
1034
|
+
return this.grid.page;
|
|
1035
|
+
}
|
|
1036
|
+
get pageSize() {
|
|
1037
|
+
return this.grid.pageSize;
|
|
1038
|
+
}
|
|
1039
|
+
get totalPages() {
|
|
1040
|
+
return this.state?.totalPages ?? 1;
|
|
1041
|
+
}
|
|
1042
|
+
get totalItems() {
|
|
1043
|
+
return this.state?.totalItems ?? 0;
|
|
1044
|
+
}
|
|
1045
|
+
get canGoPrev() {
|
|
1046
|
+
return this.page > 1;
|
|
1047
|
+
}
|
|
1048
|
+
get canGoNext() {
|
|
1049
|
+
return this.page < this.totalPages;
|
|
1050
|
+
}
|
|
1051
|
+
get startItem() {
|
|
1052
|
+
return (this.page - 1) * this.pageSize + 1;
|
|
1053
|
+
}
|
|
1054
|
+
get endItem() {
|
|
1055
|
+
return Math.min(this.startItem + this.pageSize - 1, this.totalItems);
|
|
1056
|
+
}
|
|
1057
|
+
changePage = (e) => this.grid.changePage(e);
|
|
1058
|
+
changePageSize = (e) => this.grid.changePageSize(e);
|
|
1059
|
+
firstPage = () => {
|
|
1060
|
+
this.canGoPrev && this.grid.changePage(1);
|
|
1061
|
+
};
|
|
1062
|
+
prevPage = () => {
|
|
1063
|
+
this.canGoPrev && this.grid.changePage(this.page - 1);
|
|
1064
|
+
};
|
|
1065
|
+
nextPage = () => {
|
|
1066
|
+
this.canGoNext && this.grid.changePage(this.page + 1);
|
|
1067
|
+
};
|
|
1068
|
+
lastPage = () => {
|
|
1069
|
+
this.canGoNext && this.grid.changePage(this.totalPages);
|
|
1070
|
+
};
|
|
1071
|
+
jumpToPage = (e) => {
|
|
1072
|
+
let t = parseInt(e, 10);
|
|
1073
|
+
isNaN(t) || this.grid.changePage(Math.max(1, Math.min(t, this.totalPages)));
|
|
1074
|
+
};
|
|
1075
|
+
}, Ce = class {
|
|
1076
|
+
grid;
|
|
1077
|
+
row;
|
|
1078
|
+
column;
|
|
1079
|
+
constructor(e, t, n) {
|
|
1080
|
+
this.grid = e, this.row = t, this.column = n;
|
|
1081
|
+
}
|
|
1082
|
+
get value() {
|
|
1083
|
+
return this.column.isRowNumber ? this.row.rowIndex + 1 : this.row.data[this.column.key];
|
|
1084
|
+
}
|
|
1085
|
+
get isExpanded() {
|
|
1086
|
+
return this.row.expanded;
|
|
1087
|
+
}
|
|
1088
|
+
get selected() {
|
|
1089
|
+
return this.row.selected;
|
|
1090
|
+
}
|
|
1091
|
+
get isFirst() {
|
|
1092
|
+
return this.row.cells[0] === this;
|
|
1093
|
+
}
|
|
1094
|
+
get isLast() {
|
|
1095
|
+
let e = this.row.cells;
|
|
1096
|
+
return e[e.length - 1] === this;
|
|
1097
|
+
}
|
|
1098
|
+
toggleDetail = () => {
|
|
1099
|
+
this.grid.toggleDetailRow(this.row.key);
|
|
1100
|
+
};
|
|
1101
|
+
toggleSelection = () => {
|
|
1102
|
+
this.grid.toggleRowSelection(this.row.key);
|
|
1103
|
+
};
|
|
1104
|
+
}, we = class {
|
|
1105
|
+
grid;
|
|
1106
|
+
data;
|
|
1107
|
+
rowIndex;
|
|
1108
|
+
constructor(e, t, n) {
|
|
1109
|
+
this.grid = e, this.data = t, this.rowIndex = n;
|
|
1110
|
+
}
|
|
1111
|
+
_key;
|
|
1112
|
+
get key() {
|
|
1113
|
+
return this._key ??= this.grid.getRowKey(this.data);
|
|
1114
|
+
}
|
|
1115
|
+
parentRow;
|
|
1116
|
+
count = 1;
|
|
1117
|
+
kind = "row";
|
|
1118
|
+
get expandOnRowClick() {
|
|
1119
|
+
return this.grid.props.def.rowDetail?.expandOnRowClick ?? !1;
|
|
1120
|
+
}
|
|
1121
|
+
toggleDetail = () => {
|
|
1122
|
+
this.grid.toggleDetailRow(this.key);
|
|
1123
|
+
};
|
|
1124
|
+
_cells = U(() => this.grid.columns.value.visibleLeafs.map((e) => new Ce(this.grid, this, e)));
|
|
1125
|
+
get cells() {
|
|
1126
|
+
return this._cells.value;
|
|
1127
|
+
}
|
|
1128
|
+
get cellCount() {
|
|
1129
|
+
return this.cells.length;
|
|
1130
|
+
}
|
|
1131
|
+
columnOf(e) {
|
|
1132
|
+
return e;
|
|
1133
|
+
}
|
|
1134
|
+
get selected() {
|
|
1135
|
+
return this.grid.selectedRows.has(this.key);
|
|
1136
|
+
}
|
|
1137
|
+
get expanded() {
|
|
1138
|
+
return this.grid.expandedDetailRows.has(this.key);
|
|
1139
|
+
}
|
|
1140
|
+
get flatRows() {
|
|
1141
|
+
return this.grid.props.def.rowDetail && this.expanded ? [this, new V(this.grid, this)] : [this];
|
|
1142
|
+
}
|
|
1143
|
+
get allRows() {
|
|
1144
|
+
return this;
|
|
1145
|
+
}
|
|
1146
|
+
}, Te = class e {
|
|
1147
|
+
grid;
|
|
1148
|
+
static DEFAULT_VISIBLE_ROWS_COUNT = 10;
|
|
1149
|
+
static ROWS_TO_PRELOAD = 20;
|
|
1150
|
+
constructor(e) {
|
|
1151
|
+
this.grid = e;
|
|
1152
|
+
}
|
|
1153
|
+
get showAll() {
|
|
1154
|
+
return this.grid.props.def.visibleRowsCount === "all";
|
|
1155
|
+
}
|
|
1156
|
+
get hasDetailRows() {
|
|
1157
|
+
return !!this.grid.props.def.rowDetail;
|
|
1158
|
+
}
|
|
1159
|
+
get isEmpty() {
|
|
1160
|
+
return this.grid.props.data.length === 0;
|
|
1161
|
+
}
|
|
1162
|
+
get visibleRowsCount() {
|
|
1163
|
+
if (this.showAll) return this.grid.flatRows.value.length;
|
|
1164
|
+
let t = this.grid.props.def.visibleRowsCount;
|
|
1165
|
+
return typeof t == "number" ? t : e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
1166
|
+
}
|
|
1167
|
+
get pageRows() {
|
|
1168
|
+
let t = this.grid.props.def.visibleRowsCount;
|
|
1169
|
+
return typeof t == "number" ? t : e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
1170
|
+
}
|
|
1171
|
+
get viewHeight() {
|
|
1172
|
+
if (this.showAll) return;
|
|
1173
|
+
let { rowHeight: e } = this.grid;
|
|
1174
|
+
return e * this.visibleRowsCount + e / 5;
|
|
1175
|
+
}
|
|
1176
|
+
get totalHeight() {
|
|
1177
|
+
return this.hasDetailRows ? this.grid.rowOffsets.value.totalHeight : this.grid.flatRows.value.length * this.grid.rowHeight;
|
|
1178
|
+
}
|
|
1179
|
+
get emptyHeight() {
|
|
1180
|
+
return this.viewHeight ?? this.grid.rowHeight * e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
1181
|
+
}
|
|
1182
|
+
rowTop(e) {
|
|
1183
|
+
return this.hasDetailRows ? this.grid.rowOffsets.value.offsets[e] ?? 0 : e * this.grid.rowHeight;
|
|
1184
|
+
}
|
|
1185
|
+
findStartIndex(e, t) {
|
|
1186
|
+
let n = 0, r = e.length - 1;
|
|
1187
|
+
for (; n < r;) {
|
|
1188
|
+
let i = n + r + 1 >>> 1;
|
|
1189
|
+
e[i] <= t ? n = i : r = i - 1;
|
|
1190
|
+
}
|
|
1191
|
+
return n;
|
|
1192
|
+
}
|
|
1193
|
+
window(t) {
|
|
1194
|
+
let n = this.grid.flatRows.value.length;
|
|
1195
|
+
if (this.showAll) return {
|
|
1196
|
+
startIndex: 0,
|
|
1197
|
+
take: n,
|
|
1198
|
+
translateY: 0,
|
|
1199
|
+
totalHeight: this.totalHeight,
|
|
1200
|
+
viewHeight: void 0
|
|
1201
|
+
};
|
|
1202
|
+
let { rowHeight: r } = this.grid, i = e.ROWS_TO_PRELOAD, { offsets: a } = this.grid.rowOffsets.value, o = this.hasDetailRows ? Math.max(0, this.findStartIndex(a, t) - i) : Math.max(0, Math.floor(t / r) - i), s = this.hasDetailRows ? a[o] ?? 0 : o * r;
|
|
1203
|
+
return {
|
|
1204
|
+
startIndex: o,
|
|
1205
|
+
take: this.visibleRowsCount + i * 2,
|
|
1206
|
+
translateY: s,
|
|
1207
|
+
totalHeight: this.totalHeight,
|
|
1208
|
+
viewHeight: this.viewHeight
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
}, q = "row-number-cell", J = "row-selection-cell", Y = "grouping-cell", X = "row-detail-cell", Ee = class {
|
|
1212
|
+
props;
|
|
1213
|
+
constructor(e, t) {
|
|
1214
|
+
this.props = e, t && this.listeners.add(t);
|
|
1215
|
+
}
|
|
1216
|
+
_version = 0;
|
|
1217
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1218
|
+
subscribe = (e) => (this.listeners.add(e), () => this.listeners.delete(e));
|
|
1219
|
+
getSnapshot = () => this._version;
|
|
1220
|
+
notify = () => {
|
|
1221
|
+
this._version++, this.listeners.forEach((e) => e());
|
|
1222
|
+
};
|
|
1223
|
+
setProps(e) {
|
|
1224
|
+
let t = this.props;
|
|
1225
|
+
t !== e && (this.props = e, t.def !== e.def && this.sourceColumns.clear(), (t.data !== e.data || t.def !== e.def || t.globalFilterValue !== e.globalFilterValue || t.columnFilters !== e.columnFilters || t.filters !== e.filters || t.expandedRowKeys !== e.expandedRowKeys || t.page !== e.page || t.pageSize !== e.pageSize) && this.rows.clear());
|
|
1226
|
+
}
|
|
1227
|
+
get componentName() {
|
|
1228
|
+
return this.props.component || "datagrid";
|
|
1229
|
+
}
|
|
1230
|
+
_identifier = "datagrid";
|
|
1231
|
+
get identifier() {
|
|
1232
|
+
return this._identifier;
|
|
1233
|
+
}
|
|
1234
|
+
setIdentifier(e) {
|
|
1235
|
+
this._identifier = e;
|
|
1236
|
+
}
|
|
1237
|
+
get titleId() {
|
|
1238
|
+
return `${this._identifier}-title`;
|
|
1239
|
+
}
|
|
1240
|
+
get resizerStyle() {
|
|
1241
|
+
return this.props.def.resizerStyle ?? "visible";
|
|
1242
|
+
}
|
|
1243
|
+
get resizeMode() {
|
|
1244
|
+
return this.props.def.resizeMode ?? "smooth";
|
|
1245
|
+
}
|
|
1246
|
+
sourceColumns = U(() => {
|
|
1247
|
+
let { def: e } = this.props, t = [];
|
|
1248
|
+
if (this.groupColumns.size > 0 && t.push(new K({ key: Y }, this)), t.push(...e.columns.map((e) => new K(e, this))), e.rowSelection) {
|
|
1249
|
+
let n = typeof e.rowSelection == "object" && e.rowSelection.pinned ? "START" : void 0;
|
|
1250
|
+
t.unshift(new K({
|
|
1251
|
+
key: J,
|
|
1252
|
+
pin: n,
|
|
1253
|
+
width: 50,
|
|
1254
|
+
align: "center",
|
|
1255
|
+
Cell: _e
|
|
1256
|
+
}, this));
|
|
1257
|
+
}
|
|
1258
|
+
if (e.showRowNumber) {
|
|
1259
|
+
let n, r = 70;
|
|
1260
|
+
typeof e.showRowNumber == "object" && (e.showRowNumber.pinned && (n = "START"), r = e.showRowNumber.width ?? 70), t.unshift(new K({
|
|
1261
|
+
key: q,
|
|
1262
|
+
pin: n,
|
|
1263
|
+
width: r,
|
|
1264
|
+
align: "end"
|
|
1265
|
+
}, this));
|
|
1266
|
+
}
|
|
1267
|
+
if (e.rowDetail) {
|
|
1268
|
+
let n = e.rowDetail.pinned ? "START" : void 0, r = e.rowDetail.expandColumnWidth ?? 50, i = e.rowDetail.expandColumnHeader ?? "";
|
|
1269
|
+
t.unshift(new K({
|
|
1270
|
+
key: X,
|
|
1271
|
+
header: i,
|
|
1272
|
+
pin: n,
|
|
1273
|
+
width: r,
|
|
1274
|
+
align: "center",
|
|
1275
|
+
Cell: ge
|
|
1276
|
+
}, this));
|
|
1277
|
+
}
|
|
1278
|
+
return t;
|
|
1279
|
+
});
|
|
1280
|
+
columns = U(() => {
|
|
1281
|
+
let e = this.sourceColumns.value.map((e) => e.getPinnedColumn("START")).filter((e) => !!e), t = this.sourceColumns.value.map((e) => e.getPinnedColumn()).filter((e) => !!e), n = this.sourceColumns.value.map((e) => e.getPinnedColumn("END")).filter((e) => !!e), r = [
|
|
1282
|
+
...e,
|
|
1283
|
+
...t,
|
|
1284
|
+
...n
|
|
1285
|
+
].flatMap((e) => e.flatColumns), i = r.filter((e) => e.isLeaf), a = r.filter((e) => e.isLeaf && e.isVisible);
|
|
1286
|
+
return {
|
|
1287
|
+
start: e,
|
|
1288
|
+
middle: t,
|
|
1289
|
+
end: n,
|
|
1290
|
+
flat: r,
|
|
1291
|
+
leafs: i,
|
|
1292
|
+
visibleLeafs: a,
|
|
1293
|
+
userVisibleLeafs: a.filter((e) => ![
|
|
1294
|
+
q,
|
|
1295
|
+
J,
|
|
1296
|
+
Y,
|
|
1297
|
+
X
|
|
1298
|
+
].includes(e.key)),
|
|
1299
|
+
maxDeath: B.maxBy(r, (e) => e.death) + 1
|
|
1300
|
+
};
|
|
1301
|
+
}, () => [this.sourceColumns]);
|
|
1302
|
+
headerRows = U(() => B.sortBy(B.groupBy(this.columns.value.flat, (e) => e.death), (e) => e.key).map((e) => {
|
|
1303
|
+
let t = B.toRecord(B.groupBy(e.values, (e) => e.pin ?? "NO_PIN"), (e) => [e.key, e.values]);
|
|
1304
|
+
return [
|
|
1305
|
+
...t.START?.filter((e) => e.isVisible) ?? [],
|
|
1306
|
+
...t.NO_PIN?.filter((e) => e.isVisible) ?? [],
|
|
1307
|
+
...t.END?.filter((e) => e.isVisible) ?? []
|
|
1308
|
+
];
|
|
1309
|
+
}), () => [this.columns]);
|
|
1310
|
+
gridTemplateColumns = U(() => {
|
|
1311
|
+
let { visibleLeafs: e } = this.columns.value, t = B.sumBy(e, (e) => +(e.pin === "END")), n = e.length - t;
|
|
1312
|
+
return `${n > 0 ? `repeat(${n}, max-content)` : ""} ${t > 0 ? `repeat(${t}, max-content)` : ""}`.trim();
|
|
1313
|
+
}, () => [this.columns]);
|
|
1314
|
+
_globalFilterValue = "";
|
|
1315
|
+
get globalFilterValue() {
|
|
1316
|
+
return this.props.globalFilterValue ?? this._globalFilterValue;
|
|
1317
|
+
}
|
|
1318
|
+
_columnFilters = {};
|
|
1319
|
+
get columnFilters() {
|
|
1320
|
+
return this.props.columnFilters ?? this._columnFilters;
|
|
1321
|
+
}
|
|
1322
|
+
applyGlobalFilter(e) {
|
|
1323
|
+
let t = this.globalFilterValue.trim();
|
|
1324
|
+
if (!t) return e;
|
|
1325
|
+
let { globalFilterKeys: n } = this.props.def, r = n ?? this.columns.value.leafs.filter((e) => e.key !== "row-number-cell" && e.key !== "row-selection-cell" && e.key !== "grouping-cell" && e.key !== "row-detail-cell").map((e) => e.key);
|
|
1326
|
+
return e.filter((e) => r.some((n) => {
|
|
1327
|
+
let r = e[n];
|
|
1328
|
+
return r != null && he(t, String(r));
|
|
1329
|
+
}));
|
|
1330
|
+
}
|
|
1331
|
+
applyColumnFilters(e) {
|
|
1332
|
+
let t = this.columnFilters, n = Object.keys(t);
|
|
1333
|
+
return n.length === 0 ? e : e.filter((e) => n.every((n) => {
|
|
1334
|
+
let r = t[n];
|
|
1335
|
+
if (!r) return !0;
|
|
1336
|
+
let i = e[n];
|
|
1337
|
+
return this.matchesFilter(i, r);
|
|
1338
|
+
}));
|
|
1339
|
+
}
|
|
1340
|
+
matchesFilter(e, t) {
|
|
1341
|
+
switch (t.type) {
|
|
1342
|
+
case "text": return !t.value.trim() || e != null && he(t.value, String(e));
|
|
1343
|
+
case "number": {
|
|
1344
|
+
if (e == null) return !1;
|
|
1345
|
+
let n = typeof e == "number" ? e : parseFloat(String(e));
|
|
1346
|
+
if (isNaN(n)) return !1;
|
|
1347
|
+
switch (t.operator) {
|
|
1348
|
+
case "eq": return n === t.value;
|
|
1349
|
+
case "ne": return n !== t.value;
|
|
1350
|
+
case "gt": return n > t.value;
|
|
1351
|
+
case "gte": return n >= t.value;
|
|
1352
|
+
case "lt": return n < t.value;
|
|
1353
|
+
case "lte": return n <= t.value;
|
|
1354
|
+
case "between": return t.valueTo === void 0 ? n >= t.value : n >= t.value && n <= t.valueTo;
|
|
1355
|
+
default: return !0;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
case "multiselect": return t.values.length === 0 || t.values.includes(e);
|
|
1359
|
+
default: return !0;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
applyExternalFilters(e) {
|
|
1363
|
+
let t = this.props.filters;
|
|
1364
|
+
return !t || t.length === 0 ? e : e.filter((e) => t.every((t) => t(e)));
|
|
1365
|
+
}
|
|
1366
|
+
get filteredData() {
|
|
1367
|
+
if (this.isPaginated) return this.props.data;
|
|
1368
|
+
let e = this.props.data;
|
|
1369
|
+
return e = this.applyExternalFilters(e), this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
|
|
1370
|
+
}
|
|
1371
|
+
fireServerStateChange(e) {
|
|
1372
|
+
this.props.onServerStateChange?.({
|
|
1373
|
+
page: e?.page ?? this.page,
|
|
1374
|
+
pageSize: e?.pageSize ?? this.pageSize,
|
|
1375
|
+
sortColumn: "sortColumn" in (e ?? {}) ? e.sortColumn : this._sortColumn,
|
|
1376
|
+
sortDirection: "sortDirection" in (e ?? {}) ? e.sortDirection : this._sortDirection,
|
|
1377
|
+
columnFilters: e?.columnFilters ?? this.columnFilters,
|
|
1378
|
+
globalFilterValue: e?.globalFilterValue ?? this.globalFilterValue
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
setGlobalFilter = (e) => {
|
|
1382
|
+
this.props.onGlobalFilterChange ? this.props.onGlobalFilterChange(e) : this._globalFilterValue = e;
|
|
1383
|
+
let t = this.isPaginated && this.page !== 1 ? 1 : this.page;
|
|
1384
|
+
t !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({
|
|
1385
|
+
globalFilterValue: e,
|
|
1386
|
+
page: t
|
|
1387
|
+
}), this.rows.clear(), this.notify();
|
|
1388
|
+
};
|
|
1389
|
+
setColumnFilter = (e, t) => {
|
|
1390
|
+
let n = { ...this.columnFilters };
|
|
1391
|
+
t === void 0 ? delete n[e] : n[e] = t, this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange(n) : this._columnFilters = n;
|
|
1392
|
+
let r = this.isPaginated && this.page !== 1 ? 1 : this.page;
|
|
1393
|
+
r !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({
|
|
1394
|
+
columnFilters: n,
|
|
1395
|
+
page: r
|
|
1396
|
+
}), this.rows.clear(), this.notify();
|
|
1397
|
+
};
|
|
1398
|
+
clearColumnFilters = () => {
|
|
1399
|
+
this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange({}) : this._columnFilters = {}, this.fireServerStateChange({ columnFilters: {} }), this.rows.clear(), this.notify();
|
|
1400
|
+
};
|
|
1401
|
+
clearAllFilters = () => {
|
|
1402
|
+
this.setGlobalFilter(""), this.clearColumnFilters();
|
|
1403
|
+
};
|
|
1404
|
+
getColumnUniqueValues = (e) => {
|
|
1405
|
+
let t = /* @__PURE__ */ new Set();
|
|
1406
|
+
return this.props.data.forEach((n) => {
|
|
1407
|
+
let r = n[e];
|
|
1408
|
+
r !== void 0 && t.add(r);
|
|
1409
|
+
}), Array.from(t).sort((e, t) => e === null ? 1 : t === null ? -1 : typeof e == "string" && typeof t == "string" ? e.localeCompare(t) : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)));
|
|
1410
|
+
};
|
|
1411
|
+
get hasActiveFilters() {
|
|
1412
|
+
return this.globalFilterValue.trim() !== "" || Object.keys(this.columnFilters).length > 0;
|
|
1413
|
+
}
|
|
1414
|
+
get filterStats() {
|
|
1415
|
+
if (this.isPaginated) {
|
|
1416
|
+
let e = this.props.def.pagination.totalCount;
|
|
1417
|
+
return {
|
|
1418
|
+
filtered: e,
|
|
1419
|
+
total: e
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
return {
|
|
1423
|
+
filtered: this.filteredData.length,
|
|
1424
|
+
total: this.props.data.length
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
rows = U(() => {
|
|
1428
|
+
let e = this.filteredData;
|
|
1429
|
+
if (this._sortColumn && !this.isPaginated && (e = B.sortBy(e, (e) => e[this._sortColumn], this._sortDirection)), this.groupColumns.size > 0) {
|
|
1430
|
+
let t = (e, n, r) => {
|
|
1431
|
+
let i = n.values().next().value;
|
|
1432
|
+
n.delete(i);
|
|
1433
|
+
let a = B.findOrThrow(this.columns.value.leafs, (e) => e.key === i);
|
|
1434
|
+
return this._sortColumn === "grouping-cell" && (e = B.sortBy(e, (e) => e[i], this._sortDirection)), B.groupBy(e, (e) => e[i]).map((e) => {
|
|
1435
|
+
let i;
|
|
1436
|
+
i = n.size > 0 ? t(e.values, new Set(n), r + 1) : e.values.map((e, t) => new we(this, e, r + 1 + t));
|
|
1437
|
+
let o = new Oe(this, a, i, r, e.key);
|
|
1438
|
+
return r += 1, o.expanded && (r += i.length), o;
|
|
1439
|
+
});
|
|
1440
|
+
};
|
|
1441
|
+
return t(e, new Set(this.groupColumns), 0);
|
|
1442
|
+
}
|
|
1443
|
+
return e.map((e, t) => new we(this, e, t));
|
|
1444
|
+
}, () => [this.columns]);
|
|
1445
|
+
flatRows = U(() => this.rows.value.flatMap((e) => e.flatRows), () => [this.rows]);
|
|
1446
|
+
get rowHeight() {
|
|
1447
|
+
return this.props.def.rowHeight ?? this.DEFAULT_ROW_HEIGHT_PX;
|
|
1448
|
+
}
|
|
1449
|
+
sizes = U(() => {
|
|
1450
|
+
let e = this.columns.value.flat.reduce((e, t) => {
|
|
1451
|
+
let { inlineWidth: n } = t;
|
|
1452
|
+
return typeof n == "number" && (e[t.widthVarName] = `${t.inlineWidth}px`), t.pin === "START" && (e[t.inlineStartVarName] = `${t.startOffset}px`), t.pin === "END" && (e[t.inlineEndVarName] = `${t.endOffset}px`), e;
|
|
1453
|
+
}, {});
|
|
1454
|
+
e[this.rowHeightVarName] = `${this.rowHeight}px`, e[this.inlineStartEdgeVarName] = `${this.inlineStartEdge}px`, this._containerWidth > 0 && (e[this.viewportWidthVarName] = `${this._containerWidth}px`);
|
|
1455
|
+
let { visibleLeafs: t } = this.columns.value, n = t.find((e) => e.key === Y);
|
|
1456
|
+
if (n) {
|
|
1457
|
+
let r = B.sumBy(t, (e) => e.pin === n.pin && e.key !== "row-number-cell" && e.key !== "row-selection-cell" && e.key !== "row-detail-cell" ? e.inlineWidth ?? 0 : 0);
|
|
1458
|
+
e[n.groupColumnWidthVarName] = `${r}px`;
|
|
1459
|
+
}
|
|
1460
|
+
return this.groupColumns.forEach((n) => {
|
|
1461
|
+
let r = B.findOrThrow(this.columns.value.leafs, (e) => e.key === n);
|
|
1462
|
+
e[r.groupColumnWidthVarName] = `${B.sumBy(t, (e) => e.pin === r.pin ? e.inlineWidth ?? 0 : 0)}px`;
|
|
1463
|
+
}), e;
|
|
1464
|
+
}, () => [this.columns, this.flexWidths]);
|
|
1465
|
+
_containerWidth = 0;
|
|
1466
|
+
get containerWidth() {
|
|
1467
|
+
return this._containerWidth;
|
|
1468
|
+
}
|
|
1469
|
+
_sizingElement = null;
|
|
1470
|
+
get sizingElement() {
|
|
1471
|
+
return this._sizingElement;
|
|
1472
|
+
}
|
|
1473
|
+
setSizingElement = (e) => {
|
|
1474
|
+
this._sizingElement = e;
|
|
1475
|
+
};
|
|
1476
|
+
get isRtl() {
|
|
1477
|
+
return t(this._sizingElement);
|
|
1478
|
+
}
|
|
1479
|
+
setContainerWidth = (e) => {
|
|
1480
|
+
this._containerWidth !== e && (this._containerWidth = e, this.flexWidths.clear(), this.notify());
|
|
1481
|
+
};
|
|
1482
|
+
flexWidths = U(() => {
|
|
1483
|
+
let e = this._containerWidth;
|
|
1484
|
+
if (e <= 0) return {};
|
|
1485
|
+
let t = this.columns.value.visibleLeafs, n = (e) => !e.isFlexible || this.columnWidths.has(e.key), r = B.sumBy(t.filter(n), (e) => e.baseWidth), i = t.filter((e) => !n(e)), a = B.sumBy(i, (e) => e.baseWidth), o = e - r;
|
|
1486
|
+
if (o <= a) return B.toRecord(i, (e) => [e.key, e.baseWidth]);
|
|
1487
|
+
let s = {}, c = 0;
|
|
1488
|
+
return i.forEach((e, t) => {
|
|
1489
|
+
if (t === i.length - 1) s[e.key] = o - c;
|
|
1490
|
+
else {
|
|
1491
|
+
let t = Math.floor(e.baseWidth / a * o);
|
|
1492
|
+
s[e.key] = t, c += t;
|
|
1493
|
+
}
|
|
1494
|
+
}), s;
|
|
1495
|
+
}, () => [this.columns]);
|
|
1496
|
+
getFlexWidth(e) {
|
|
1497
|
+
return this.flexWidths.value[e];
|
|
1498
|
+
}
|
|
1499
|
+
DEFAULT_ROW_HEIGHT_PX = 48;
|
|
1500
|
+
MIN_COLUMN_WIDTH_PX = 48;
|
|
1501
|
+
DEFAULT_COLUMN_WIDTH_PX = 200;
|
|
1502
|
+
expandedGroupRow = /* @__PURE__ */ new Set();
|
|
1503
|
+
_expandedDetailRows = /* @__PURE__ */ new Set();
|
|
1504
|
+
get expandedDetailRows() {
|
|
1505
|
+
return this.props.expandedRowKeys ? new Set(this.props.expandedRowKeys) : this._expandedDetailRows;
|
|
1506
|
+
}
|
|
1507
|
+
toggleDetailRow = (e) => {
|
|
1508
|
+
let t = new Set(this.expandedDetailRows);
|
|
1509
|
+
t.has(e) ? t.delete(e) : t.add(e), this.props.onExpandedRowKeysChange ? this.props.onExpandedRowKeysChange(Array.from(t)) : this._expandedDetailRows = t, this.rows.clear(), this.notify();
|
|
1510
|
+
};
|
|
1511
|
+
_page = 1;
|
|
1512
|
+
_pageSize;
|
|
1513
|
+
get page() {
|
|
1514
|
+
return this.props.page ?? this._page;
|
|
1515
|
+
}
|
|
1516
|
+
get pageSize() {
|
|
1517
|
+
if (this.props.pageSize !== void 0) return this.props.pageSize;
|
|
1518
|
+
if (this._pageSize !== void 0) return this._pageSize;
|
|
1519
|
+
let e = this.props.def.pagination;
|
|
1520
|
+
if (e?.pageSize) return e.pageSize;
|
|
1521
|
+
let t = this.props.def.visibleRowsCount;
|
|
1522
|
+
return typeof t == "number" ? t : 10;
|
|
1523
|
+
}
|
|
1524
|
+
get pageSizeOptions() {
|
|
1525
|
+
return this.props.def.pagination?.pageSizeOptions;
|
|
1526
|
+
}
|
|
1527
|
+
get isPaginated() {
|
|
1528
|
+
return !!this.props.def.pagination;
|
|
1529
|
+
}
|
|
1530
|
+
get paginationState() {
|
|
1531
|
+
let e = this.props.def.pagination;
|
|
1532
|
+
if (!e) return;
|
|
1533
|
+
let t = e.totalCount, n = this.pageSize;
|
|
1534
|
+
return {
|
|
1535
|
+
page: this.page,
|
|
1536
|
+
pageSize: n,
|
|
1537
|
+
totalItems: t,
|
|
1538
|
+
totalPages: Math.max(1, Math.ceil(t / n))
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
changePage = (e) => {
|
|
1542
|
+
let t = this.paginationState;
|
|
1543
|
+
if (!t) return;
|
|
1544
|
+
let n = Math.max(1, Math.min(e, t.totalPages));
|
|
1545
|
+
n !== this.page && (this.props.onPageChange ? this.props.onPageChange(n, t.pageSize) : this._page = n, this.fireServerStateChange({ page: n }), this.rows.clear(), this.notify());
|
|
1546
|
+
};
|
|
1547
|
+
changePageSize = (e) => {
|
|
1548
|
+
e !== this.pageSize && (this.props.onPageSizeChange ? this.props.onPageSizeChange(e) : this._pageSize = e, this.props.onPageChange ? this.props.onPageChange(1, e) : this._page = 1, this.fireServerStateChange({
|
|
1549
|
+
page: 1,
|
|
1550
|
+
pageSize: e
|
|
1551
|
+
}), this.rows.clear(), this.notify());
|
|
1552
|
+
};
|
|
1553
|
+
rowOffsets = U(() => {
|
|
1554
|
+
let e = [], t = 0;
|
|
1555
|
+
for (let n of this.flatRows.value) e.push(t), t += n instanceof V ? n.heightForOffset : this.rowHeight;
|
|
1556
|
+
return {
|
|
1557
|
+
offsets: e,
|
|
1558
|
+
totalHeight: t
|
|
1559
|
+
};
|
|
1560
|
+
}, () => [this.flatRows]);
|
|
1561
|
+
viewport = new Te(this);
|
|
1562
|
+
columnVisibility = new be(this);
|
|
1563
|
+
filter = new xe(this);
|
|
1564
|
+
pagination = new Se(this);
|
|
1565
|
+
get hasVisibleColumns() {
|
|
1566
|
+
return this.columns.value.userVisibleLeafs.length > 0;
|
|
1567
|
+
}
|
|
1568
|
+
get isEmpty() {
|
|
1569
|
+
return this.props.data.length === 0;
|
|
1570
|
+
}
|
|
1571
|
+
get allRowsSelected() {
|
|
1572
|
+
return this.selectedRows.size === this.props.data.length;
|
|
1573
|
+
}
|
|
1574
|
+
get someRowsSelected() {
|
|
1575
|
+
return this.selectedRows.size > 0;
|
|
1576
|
+
}
|
|
1577
|
+
_selectionAnnounced = !1;
|
|
1578
|
+
get selectionAnnouncement() {
|
|
1579
|
+
if (!this._selectionAnnounced) return "";
|
|
1580
|
+
let e = this.selectedRows.size;
|
|
1581
|
+
return e === 0 ? "No rows selected" : `${e} of ${this.props.data.length} rows selected`;
|
|
1582
|
+
}
|
|
1583
|
+
get groupedColumns() {
|
|
1584
|
+
return Array.from(this.groupColumns, (e) => B.findOrThrow(this.columns.value.leafs, (t) => t.key === e));
|
|
1585
|
+
}
|
|
1586
|
+
selectedRows = /* @__PURE__ */ new Set();
|
|
1587
|
+
get inlineStartEdge() {
|
|
1588
|
+
return B.sumBy(this.columns.value.start, (e) => e.inlineWidth ?? 0);
|
|
1589
|
+
}
|
|
1590
|
+
get inlineEndEdge() {
|
|
1591
|
+
return B.sumBy(this.columns.value.end, (e) => e.inlineWidth ?? 0);
|
|
1592
|
+
}
|
|
1593
|
+
inlineStartEdgeVarName = "--inline-start-edge";
|
|
1594
|
+
rowHeightVarName = "--row-height";
|
|
1595
|
+
viewportWidthVarName = "--viewport-width";
|
|
1596
|
+
_idMap = /* @__PURE__ */ new WeakMap();
|
|
1597
|
+
_autoId = 0;
|
|
1598
|
+
_idFactory = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? () => crypto.randomUUID() : () => `auto-row-${this._autoId++}`;
|
|
1599
|
+
getRowKey(e) {
|
|
1600
|
+
let { rowKey: t } = this.props.def;
|
|
1601
|
+
return t ? typeof t == "function" ? t(e) : e[t] : (this._idMap.has(e) || this._idMap.set(e, this._idFactory()), this._idMap.get(e));
|
|
1602
|
+
}
|
|
1603
|
+
setSortColumn = (e, ...t) => {
|
|
1604
|
+
if (t.length > 0) [this._sortDirection] = t, this._sortColumn = this._sortDirection ? e : void 0;
|
|
1605
|
+
else {
|
|
1606
|
+
let { _sortColumn: t, _sortDirection: n } = this;
|
|
1607
|
+
this._sortColumn = t === e && n === "DESC" ? void 0 : e, this._sortDirection = t === e && n === "ASC" ? "DESC" : "ASC";
|
|
1608
|
+
}
|
|
1609
|
+
this.props.onSortChange?.(this._sortColumn, this._sortDirection);
|
|
1610
|
+
let n = this.isPaginated && this.page !== 1 ? 1 : this.page;
|
|
1611
|
+
n !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({
|
|
1612
|
+
sortColumn: this._sortColumn,
|
|
1613
|
+
sortDirection: this._sortDirection,
|
|
1614
|
+
page: n
|
|
1615
|
+
}), this.rows.clear(), this.notify();
|
|
1616
|
+
};
|
|
1617
|
+
pinColumn = (e, t) => {
|
|
1618
|
+
let n = G(t), r = B.findOrThrow(this.columns.value.flat, (t) => t.uniqueKey === e);
|
|
1619
|
+
r.pin !== n && r.pinColumn(n), this.columns.clear(), this.notify();
|
|
1620
|
+
};
|
|
1621
|
+
toggleGrouping = (e) => {
|
|
1622
|
+
this.groupColumns = new Set(this.groupColumns), this.hiddenColumns = new Set(this.hiddenColumns), this.groupColumns.has(e) ? (this.groupColumns.delete(e), this.hiddenColumns.delete(e)) : (this.groupColumns.add(e), this.hiddenColumns.add(e)), this.sourceColumns.clear(), this.notify();
|
|
1623
|
+
};
|
|
1624
|
+
unGroupAll = () => {
|
|
1625
|
+
let e = new Set(this.groupColumns);
|
|
1626
|
+
this.groupColumns = /* @__PURE__ */ new Set(), this.hiddenColumns = new Set(Array.from(this.hiddenColumns).filter((t) => !e.has(t))), this.sourceColumns.clear(), this.notify();
|
|
1627
|
+
};
|
|
1628
|
+
toggleGroupRow = (e) => {
|
|
1629
|
+
this.expandedGroupRow = new Set(this.expandedGroupRow), this.expandedGroupRow.has(e) ? this.expandedGroupRow.delete(e) : this.expandedGroupRow.add(e), this.rows.clear(), this.notify();
|
|
1630
|
+
};
|
|
1631
|
+
toggleRowSelection = (e) => {
|
|
1632
|
+
this.toggleRowsSelection([e]);
|
|
1633
|
+
};
|
|
1634
|
+
toggleRowsSelection = (e) => {
|
|
1635
|
+
this.selectedRows = new Set(this.selectedRows), this._selectionAnnounced = !0;
|
|
1636
|
+
let t = e.every((e) => this.selectedRows.has(e));
|
|
1637
|
+
t ? e.forEach((e) => this.selectedRows.delete(e)) : e.forEach((e) => this.selectedRows.add(e)), this.flatRows.clear(), this.notify(), this.props.onSelectionChange?.({
|
|
1638
|
+
action: t ? "deselect" : "select",
|
|
1639
|
+
affectedRowKeys: e,
|
|
1640
|
+
selectedRowKeys: Array.from(this.selectedRows),
|
|
1641
|
+
isAllSelected: this.selectedRows.size === this.props.data.length
|
|
1642
|
+
});
|
|
1643
|
+
};
|
|
1644
|
+
toggleSelectAllRows = () => {
|
|
1645
|
+
this.toggleRowsSelection(this.props.data.map((e) => this.getRowKey(e)));
|
|
1646
|
+
};
|
|
1647
|
+
toggleColumnVisibility = (e) => {
|
|
1648
|
+
this.hiddenColumns = new Set(this.hiddenColumns), this.hiddenColumns.has(e) ? this.hiddenColumns.delete(e) : this.hiddenColumns.add(e), this.columns.clear(), this.notify();
|
|
1649
|
+
};
|
|
1650
|
+
setWidth = (e, t) => {
|
|
1651
|
+
this.columnWidths.set(e, t);
|
|
1652
|
+
};
|
|
1653
|
+
groupColumns = /* @__PURE__ */ new Set();
|
|
1654
|
+
hiddenColumns = /* @__PURE__ */ new Set();
|
|
1655
|
+
columnWidths = /* @__PURE__ */ new Map();
|
|
1656
|
+
_sortColumn;
|
|
1657
|
+
get sortColumn() {
|
|
1658
|
+
return this._sortColumn;
|
|
1659
|
+
}
|
|
1660
|
+
_sortDirection = "ASC";
|
|
1661
|
+
get sortDirection() {
|
|
1662
|
+
return this._sortDirection;
|
|
1663
|
+
}
|
|
1664
|
+
}, De = class {
|
|
1665
|
+
grid;
|
|
1666
|
+
row;
|
|
1667
|
+
column;
|
|
1668
|
+
constructor(e, t, n) {
|
|
1669
|
+
this.grid = e, this.row = t, this.column = n;
|
|
1670
|
+
}
|
|
1671
|
+
get value() {
|
|
1672
|
+
return this.column.isRowNumber ? this.row.rowIndex + 1 : this.column.isGrouping ? `${this.row.groupValue} (${this.row.count})` : null;
|
|
1673
|
+
}
|
|
1674
|
+
get isExpanded() {
|
|
1675
|
+
return !1;
|
|
1676
|
+
}
|
|
1677
|
+
get isFirst() {
|
|
1678
|
+
return !1;
|
|
1679
|
+
}
|
|
1680
|
+
get isLast() {
|
|
1681
|
+
return !1;
|
|
1682
|
+
}
|
|
1683
|
+
get cellKind() {
|
|
1684
|
+
if (this.column.isGrouping) return "grouping";
|
|
1685
|
+
if (this.column.isRowSelection) return "selection";
|
|
1686
|
+
let { groupingColumn: e } = this.row;
|
|
1687
|
+
return this.column.pin !== e.pin || this.column.isRowNumber || this.column.isRowDetail ? "spacer" : "hidden";
|
|
1688
|
+
}
|
|
1689
|
+
get depthPadding() {
|
|
1690
|
+
return 4 * this.row.depth;
|
|
1691
|
+
}
|
|
1692
|
+
get gridColumnSpan() {
|
|
1693
|
+
return this.row.groupingColumnGridColumn;
|
|
1694
|
+
}
|
|
1695
|
+
get widthVar() {
|
|
1696
|
+
return `var(${this.column.groupColumnWidthVarName})`;
|
|
1697
|
+
}
|
|
1698
|
+
get isEndPinned() {
|
|
1699
|
+
return this.column.pin === "END";
|
|
1700
|
+
}
|
|
1701
|
+
get hasGroupingBorder() {
|
|
1702
|
+
return this.row.groupingColumn.pin === "START";
|
|
1703
|
+
}
|
|
1704
|
+
}, Oe = class {
|
|
1705
|
+
grid;
|
|
1706
|
+
groupColumn;
|
|
1707
|
+
rows;
|
|
1708
|
+
rowIndex;
|
|
1709
|
+
groupValue;
|
|
1710
|
+
constructor(e, t, n, r, i) {
|
|
1711
|
+
this.grid = e, this.groupColumn = t, this.rows = n, this.rowIndex = r, this.groupValue = i, n.forEach((e) => e.parentRow = this);
|
|
1712
|
+
}
|
|
1713
|
+
get key() {
|
|
1714
|
+
return `${this.parentRow?.key ?? ""}${this.groupColumn.key}${this.groupValue}`;
|
|
1715
|
+
}
|
|
1716
|
+
parentRow;
|
|
1717
|
+
_cells = U(() => this.grid.columns.value.visibleLeafs.map((e) => new De(this.grid, this, e)));
|
|
1718
|
+
get cells() {
|
|
1719
|
+
return this._cells.value;
|
|
1720
|
+
}
|
|
1721
|
+
_renderedCells = U(() => {
|
|
1722
|
+
let e = [];
|
|
1723
|
+
return this.cells.forEach((t, n) => {
|
|
1724
|
+
t.cellKind !== "hidden" && e.push({
|
|
1725
|
+
cell: t,
|
|
1726
|
+
columnIndex: n
|
|
1727
|
+
});
|
|
1728
|
+
}), e;
|
|
1729
|
+
});
|
|
1730
|
+
get renderedCells() {
|
|
1731
|
+
return this._renderedCells.value;
|
|
1732
|
+
}
|
|
1733
|
+
get cellCount() {
|
|
1734
|
+
return this.renderedCells.length;
|
|
1735
|
+
}
|
|
1736
|
+
columnOf(e) {
|
|
1737
|
+
return this.renderedCells[e]?.columnIndex ?? e;
|
|
1738
|
+
}
|
|
1739
|
+
get selected() {
|
|
1740
|
+
return this.allRows.every((e) => e.selected);
|
|
1741
|
+
}
|
|
1742
|
+
get indeterminate() {
|
|
1743
|
+
return !this.selected && this.allRows.some((e) => e.selected);
|
|
1744
|
+
}
|
|
1745
|
+
get expanded() {
|
|
1746
|
+
return this.grid.expandedGroupRow.has(this.key);
|
|
1747
|
+
}
|
|
1748
|
+
get depth() {
|
|
1749
|
+
return this.parentRow ? this.parentRow.depth + 1 : 0;
|
|
1750
|
+
}
|
|
1751
|
+
get count() {
|
|
1752
|
+
return B.sumBy(this.rows, (e) => e.count, 0);
|
|
1753
|
+
}
|
|
1754
|
+
get flatRows() {
|
|
1755
|
+
return this.expanded ? [this, ...this.rows.flatMap((e) => e.flatRows)] : [this];
|
|
1756
|
+
}
|
|
1757
|
+
get allRows() {
|
|
1758
|
+
return this.rows.flatMap((e) => e.allRows);
|
|
1759
|
+
}
|
|
1760
|
+
get groupingColumn() {
|
|
1761
|
+
return B.findOrThrow(this.grid.columns.value.leafs, (e) => e.key === Y);
|
|
1762
|
+
}
|
|
1763
|
+
get groupingColumnGridColumn() {
|
|
1764
|
+
let { visibleLeafs: e } = this.grid.columns.value, { groupingColumn: t } = this;
|
|
1765
|
+
return B.sumBy(e, (e) => +(e.pin === t.pin && e.key !== "row-selection-cell" && e.key !== "row-number-cell" && e.key !== "row-detail-cell"));
|
|
1766
|
+
}
|
|
1767
|
+
kind = "group";
|
|
1768
|
+
toggleRow() {
|
|
1769
|
+
this.grid.toggleGroupRow(this.key);
|
|
1770
|
+
}
|
|
1771
|
+
toggleSelectAll = () => {
|
|
1772
|
+
this.grid.toggleRowsSelection(this.allRows.map((e) => e.key));
|
|
1773
|
+
};
|
|
1774
|
+
};
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region src/components/dataGrid/components/dataGridDetailRow.tsx
|
|
1777
|
+
function ke(e) {
|
|
1778
|
+
let { row: t, index: n } = e, { grid: i, parentRow: a } = t, o = i.props.def.rowDetail, s = z(), c = (s?.headerRowCount ?? 0) + n, { ref: l, tabIndex: u, onFocus: d } = s?.cellProps(c, 0) ?? {}, p = t.isAutoHeight;
|
|
1779
|
+
return /* @__PURE__ */ M(f, {
|
|
1780
|
+
component: `${i.componentName}.body.detailRow`,
|
|
1781
|
+
props: {
|
|
1782
|
+
role: "row",
|
|
1783
|
+
"aria-rowindex": c + 1
|
|
1784
|
+
},
|
|
1785
|
+
style: {
|
|
1786
|
+
gridColumn: "1 / -1",
|
|
1787
|
+
height: p ? "auto" : `${t.height}px`
|
|
1788
|
+
},
|
|
1789
|
+
children: /* @__PURE__ */ M(r, {
|
|
1790
|
+
ref: l,
|
|
1791
|
+
component: `${i.componentName}.body.detailRow.content`,
|
|
1792
|
+
position: "sticky",
|
|
1793
|
+
insetStart: 0,
|
|
1794
|
+
overflowX: "auto",
|
|
1795
|
+
overflowY: "hidden",
|
|
1796
|
+
props: {
|
|
1797
|
+
role: "gridcell",
|
|
1798
|
+
"aria-colindex": 1,
|
|
1799
|
+
"aria-colspan": s?.columnCount,
|
|
1800
|
+
tabIndex: u,
|
|
1801
|
+
onFocus: d
|
|
1802
|
+
},
|
|
1803
|
+
style: { width: `var(${i.viewportWidthVarName})` },
|
|
1804
|
+
children: o.content(a.data)
|
|
1805
|
+
})
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
ke.displayName = "DataGridDetailRow";
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/components/dataGrid/components/dataGridCell.tsx
|
|
1811
|
+
function Z(e) {
|
|
1812
|
+
let { children: t, cell: n, row: r, columnIndex: i, ariaColIndex: a, ariaColSpan: o, style: s, ...c } = e, { column: l } = n, { ref: u, tabIndex: d, onFocus: p } = z()?.cellProps(r, i) ?? {};
|
|
1813
|
+
l.hasAlign && (c.jc = l.align);
|
|
1814
|
+
let m = n.isExpanded ? {
|
|
1815
|
+
...l.cellVariant.value,
|
|
1816
|
+
isExpanded: !0,
|
|
1817
|
+
isExpandedFirstLeaf: n.isFirst,
|
|
1818
|
+
isExpandedLastLeaf: n.isLast
|
|
1819
|
+
} : l.cellVariant.value;
|
|
1820
|
+
return /* @__PURE__ */ M(f, {
|
|
1821
|
+
ref: u,
|
|
1822
|
+
component: `${l.grid.componentName}.body.cell`,
|
|
1823
|
+
props: {
|
|
1824
|
+
role: "gridcell",
|
|
1825
|
+
"aria-colindex": a ?? i + 1,
|
|
1826
|
+
"aria-colspan": o,
|
|
1827
|
+
tabIndex: d,
|
|
1828
|
+
onFocus: p
|
|
1829
|
+
},
|
|
1830
|
+
variant: m,
|
|
1831
|
+
style: {
|
|
1832
|
+
...l.cellStyleVars.value,
|
|
1833
|
+
...s
|
|
1834
|
+
},
|
|
1835
|
+
...c,
|
|
1836
|
+
children: t
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
Z.displayName = "DataGridCell";
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region src/components/dataGrid/components/dataGridGroupRow.tsx
|
|
1842
|
+
function Ae(e) {
|
|
1843
|
+
let { row: t, index: n } = e, { selected: i, indeterminate: a, expanded: o } = t, s = (z()?.headerRowCount ?? 0) + n, c = w(() => t.toggleSelectAll(), [t]);
|
|
1844
|
+
return /* @__PURE__ */ M(f, {
|
|
1845
|
+
component: `${t.grid.componentName}.body.groupRow`,
|
|
1846
|
+
className: "grid-row",
|
|
1847
|
+
selected: t.grid.props.def.rowSelection ? i : void 0,
|
|
1848
|
+
display: "contents",
|
|
1849
|
+
props: {
|
|
1850
|
+
role: "row",
|
|
1851
|
+
"aria-rowindex": s + 1,
|
|
1852
|
+
"aria-expanded": o
|
|
1853
|
+
},
|
|
1854
|
+
children: t.renderedCells.map(({ cell: e, columnIndex: n }, l) => {
|
|
1855
|
+
switch (e.cellKind) {
|
|
1856
|
+
case "grouping": return /* @__PURE__ */ M(Z, {
|
|
1857
|
+
cell: e,
|
|
1858
|
+
row: s,
|
|
1859
|
+
columnIndex: l,
|
|
1860
|
+
ariaColIndex: n + 1,
|
|
1861
|
+
ariaColSpan: e.gridColumnSpan,
|
|
1862
|
+
style: {
|
|
1863
|
+
width: e.widthVar,
|
|
1864
|
+
insetInlineEnd: e.isEndPinned ? "0" : void 0
|
|
1865
|
+
},
|
|
1866
|
+
be: e.hasGroupingBorder ? 1 : void 0,
|
|
1867
|
+
gridColumn: e.gridColumnSpan,
|
|
1868
|
+
ps: e.depthPadding,
|
|
1869
|
+
overflow: "auto",
|
|
1870
|
+
children: /* @__PURE__ */ M(r, {
|
|
1871
|
+
textWrap: "nowrap",
|
|
1872
|
+
px: 3,
|
|
1873
|
+
children: /* @__PURE__ */ N(d, {
|
|
1874
|
+
component: `${t.grid.componentName}.body.groupRow.expandButton`,
|
|
1875
|
+
clean: !0,
|
|
1876
|
+
onClick: () => t.toggleRow(),
|
|
1877
|
+
cursor: "pointer",
|
|
1878
|
+
display: "flex",
|
|
1879
|
+
gap: 1,
|
|
1880
|
+
ai: "center",
|
|
1881
|
+
props: { "aria-expanded": o },
|
|
1882
|
+
children: [/* @__PURE__ */ M(W, {
|
|
1883
|
+
fill: "currentColor",
|
|
1884
|
+
width: "14px",
|
|
1885
|
+
height: "14px",
|
|
1886
|
+
rotate: o ? 0 : -90
|
|
1887
|
+
}), e.value]
|
|
1888
|
+
})
|
|
1889
|
+
})
|
|
1890
|
+
}, e.column.key);
|
|
1891
|
+
case "selection": return /* @__PURE__ */ M(Z, {
|
|
1892
|
+
cell: e,
|
|
1893
|
+
row: s,
|
|
1894
|
+
columnIndex: l,
|
|
1895
|
+
ariaColIndex: n + 1,
|
|
1896
|
+
children: /* @__PURE__ */ M(p, {
|
|
1897
|
+
variant: "datagrid",
|
|
1898
|
+
m: 1,
|
|
1899
|
+
checked: i,
|
|
1900
|
+
indeterminate: a,
|
|
1901
|
+
onChange: c,
|
|
1902
|
+
props: { "aria-label": `Select all rows in ${t.groupValue}` }
|
|
1903
|
+
})
|
|
1904
|
+
}, e.column.key);
|
|
1905
|
+
case "spacer": return /* @__PURE__ */ M(Z, {
|
|
1906
|
+
cell: e,
|
|
1907
|
+
row: s,
|
|
1908
|
+
columnIndex: l,
|
|
1909
|
+
ariaColIndex: n + 1,
|
|
1910
|
+
px: e.column.isRowNumber ? 3 : void 0,
|
|
1911
|
+
children: e.value
|
|
1912
|
+
}, e.column.key);
|
|
1913
|
+
default: return null;
|
|
1914
|
+
}
|
|
1915
|
+
})
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
Ae.displayName = "DataGridGroupRow";
|
|
1919
|
+
//#endregion
|
|
1920
|
+
//#region src/components/dataGrid/components/dataGridCellText.tsx
|
|
1921
|
+
function je(e) {
|
|
1922
|
+
let { cell: t } = e;
|
|
1923
|
+
return /* @__PURE__ */ M(f, {
|
|
1924
|
+
component: `${t.grid.componentName}.body.cell.text`,
|
|
1925
|
+
height: "fit",
|
|
1926
|
+
width: "fit",
|
|
1927
|
+
overflow: "auto",
|
|
1928
|
+
ai: "center",
|
|
1929
|
+
jc: t.column.align,
|
|
1930
|
+
children: /* @__PURE__ */ M(r, {
|
|
1931
|
+
px: 3,
|
|
1932
|
+
textOverflow: "ellipsis",
|
|
1933
|
+
overflow: "hidden",
|
|
1934
|
+
textWrap: "nowrap",
|
|
1935
|
+
children: t.value
|
|
1936
|
+
})
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
je.displayName = "DataGridCellText";
|
|
1940
|
+
//#endregion
|
|
1941
|
+
//#region src/components/dataGrid/components/dataGridRow.tsx
|
|
1942
|
+
function Me(e) {
|
|
1943
|
+
let { row: t, index: n } = e, { selected: r, expandOnRowClick: i } = t, a = (z()?.headerRowCount ?? 0) + n, o = w(() => {
|
|
1944
|
+
t.toggleDetail();
|
|
1945
|
+
}, [t]);
|
|
1946
|
+
return /* @__PURE__ */ M(f, {
|
|
1947
|
+
component: `${t.grid.componentName}.body.row`,
|
|
1948
|
+
className: "grid-row",
|
|
1949
|
+
selected: t.grid.props.def.rowSelection ? r : void 0,
|
|
1950
|
+
display: "contents",
|
|
1951
|
+
props: {
|
|
1952
|
+
role: "row",
|
|
1953
|
+
"aria-rowindex": a + 1,
|
|
1954
|
+
onClick: i ? o : void 0
|
|
1955
|
+
},
|
|
1956
|
+
cursor: i ? "pointer" : void 0,
|
|
1957
|
+
children: t.cells.map((e, t) => /* @__PURE__ */ M(Z, {
|
|
1958
|
+
cell: e,
|
|
1959
|
+
row: a,
|
|
1960
|
+
columnIndex: t,
|
|
1961
|
+
children: e.column.Cell ? /* @__PURE__ */ M(e.column.Cell, { cell: e }) : /* @__PURE__ */ M(je, { cell: e })
|
|
1962
|
+
}, e.column.key))
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
Me.displayName = "DataGridRow";
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region src/components/dataGrid/components/dataGridBody.tsx
|
|
1968
|
+
function Ne(e, t) {
|
|
1969
|
+
return e instanceof V ? /* @__PURE__ */ M(ke, {
|
|
1970
|
+
row: e,
|
|
1971
|
+
index: t
|
|
1972
|
+
}, e.key) : e instanceof Oe ? /* @__PURE__ */ M(Ae, {
|
|
1973
|
+
row: e,
|
|
1974
|
+
index: t
|
|
1975
|
+
}, e.key) : /* @__PURE__ */ M(Me, {
|
|
1976
|
+
row: e,
|
|
1977
|
+
index: t
|
|
1978
|
+
}, e.key);
|
|
1979
|
+
}
|
|
1980
|
+
function Pe(e) {
|
|
1981
|
+
let { grid: t, scrollTop: n } = e, { viewport: i } = t, { startIndex: a, take: o, translateY: s, totalHeight: c, viewHeight: l } = i.window(n), u = i.showAll, d = i.isEmpty, p = t.flatRows.value, m = O(() => d ? null : B.take(p, o, a).map((e, t) => Ne(e, a + t)), [
|
|
1982
|
+
p,
|
|
1983
|
+
d,
|
|
1984
|
+
o,
|
|
1985
|
+
a
|
|
1986
|
+
]);
|
|
1987
|
+
if (d) {
|
|
1988
|
+
let { noDataComponent: e } = t.props.def, n = t.props.loading ? "loading..." : "empty";
|
|
1989
|
+
return /* @__PURE__ */ M(f, {
|
|
1990
|
+
component: `${t.componentName}.body.empty`,
|
|
1991
|
+
jc: "center",
|
|
1992
|
+
ai: "center",
|
|
1993
|
+
width: "fit",
|
|
1994
|
+
position: "sticky",
|
|
1995
|
+
insetStart: 0,
|
|
1996
|
+
props: { role: "row" },
|
|
1997
|
+
style: { height: i.emptyHeight },
|
|
1998
|
+
children: /* @__PURE__ */ M(r, {
|
|
1999
|
+
display: "contents",
|
|
2000
|
+
props: { role: "gridcell" },
|
|
2001
|
+
children: e ?? n
|
|
2002
|
+
})
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
return u ? /* @__PURE__ */ M(h, {
|
|
2006
|
+
component: `${t.componentName}.body`,
|
|
2007
|
+
width: "max-content",
|
|
2008
|
+
minWidth: "fit",
|
|
2009
|
+
transition: "none",
|
|
2010
|
+
props: { role: "rowgroup" },
|
|
2011
|
+
style: { gridTemplateColumns: t.gridTemplateColumns.value },
|
|
2012
|
+
children: m
|
|
2013
|
+
}) : /* @__PURE__ */ M(r, {
|
|
2014
|
+
props: { role: "presentation" },
|
|
2015
|
+
style: { height: l },
|
|
2016
|
+
children: /* @__PURE__ */ M(r, {
|
|
2017
|
+
props: { role: "presentation" },
|
|
2018
|
+
style: { height: `${c}px` },
|
|
2019
|
+
children: /* @__PURE__ */ M(h, {
|
|
2020
|
+
component: `${t.componentName}.body`,
|
|
2021
|
+
width: "max-content",
|
|
2022
|
+
minWidth: "fit",
|
|
2023
|
+
transition: "none",
|
|
2024
|
+
props: { role: "rowgroup" },
|
|
2025
|
+
style: {
|
|
2026
|
+
transform: `translate3d(0, ${s}px, 0)`,
|
|
2027
|
+
willChange: "transform",
|
|
2028
|
+
gridTemplateColumns: t.gridTemplateColumns.value
|
|
2029
|
+
},
|
|
2030
|
+
children: m
|
|
2031
|
+
})
|
|
2032
|
+
})
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
Pe.displayName = "DataGridBody";
|
|
2036
|
+
//#endregion
|
|
2037
|
+
//#region src/components/dataGrid/components/dataGridEmptyColumns.tsx
|
|
2038
|
+
function Fe(e) {
|
|
2039
|
+
let { grid: t } = e;
|
|
2040
|
+
return /* @__PURE__ */ M(f, {
|
|
2041
|
+
component: `${t.componentName}.emptyColumns`,
|
|
2042
|
+
d: "column",
|
|
2043
|
+
ai: "center",
|
|
2044
|
+
jc: "center",
|
|
2045
|
+
gap: 4,
|
|
2046
|
+
py: 16,
|
|
2047
|
+
px: 6,
|
|
2048
|
+
bgColor: "gray-50",
|
|
2049
|
+
borderRadius: 4,
|
|
2050
|
+
theme: { dark: { bgColor: "gray-900" } },
|
|
2051
|
+
children: /* @__PURE__ */ N(f, {
|
|
2052
|
+
d: "column",
|
|
2053
|
+
ai: "center",
|
|
2054
|
+
gap: 3,
|
|
2055
|
+
children: [/* @__PURE__ */ M(r, {
|
|
2056
|
+
width: 16,
|
|
2057
|
+
height: 16,
|
|
2058
|
+
borderRadius: 999,
|
|
2059
|
+
bgColor: "gray-200",
|
|
2060
|
+
theme: { dark: { bgColor: "gray-700" } },
|
|
2061
|
+
display: "flex",
|
|
2062
|
+
ai: "center",
|
|
2063
|
+
jc: "center",
|
|
2064
|
+
children: /* @__PURE__ */ M(l, {
|
|
2065
|
+
viewBox: "0 0 24 24",
|
|
2066
|
+
width: "40",
|
|
2067
|
+
fill: "currentColor",
|
|
2068
|
+
color: "gray-400",
|
|
2069
|
+
theme: { dark: { color: "gray-500" } },
|
|
2070
|
+
children: /* @__PURE__ */ M(c, {
|
|
2071
|
+
fillRule: "evenodd",
|
|
2072
|
+
props: { clipRule: "evenodd" },
|
|
2073
|
+
d: "M3 6a3 3 0 013-3h12a3 3 0 013 3v12a3 3 0 01-3 3H6a3 3 0 01-3-3V6zm3-1a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1V6a1 1 0 00-1-1H6zm2 3a1 1 0 011-1h6a1 1 0 110 2H9a1 1 0 01-1-1zm0 4a1 1 0 011-1h6a1 1 0 110 2H9a1 1 0 01-1-1zm0 4a1 1 0 011-1h4a1 1 0 110 2H9a1 1 0 01-1-1z"
|
|
2074
|
+
})
|
|
2075
|
+
})
|
|
2076
|
+
}), /* @__PURE__ */ N(f, {
|
|
2077
|
+
d: "column",
|
|
2078
|
+
ai: "center",
|
|
2079
|
+
gap: 1,
|
|
2080
|
+
children: [/* @__PURE__ */ M(r, {
|
|
2081
|
+
fontSize: 18,
|
|
2082
|
+
fontWeight: 600,
|
|
2083
|
+
color: "gray-900",
|
|
2084
|
+
theme: { dark: { color: "gray-50" } },
|
|
2085
|
+
children: "No Columns Selected"
|
|
2086
|
+
}), /* @__PURE__ */ M(r, {
|
|
2087
|
+
fontSize: 14,
|
|
2088
|
+
color: "gray-500",
|
|
2089
|
+
textAlign: "center",
|
|
2090
|
+
theme: { dark: { color: "gray-400" } },
|
|
2091
|
+
children: "Select at least one column from the columns menu to display data"
|
|
2092
|
+
})]
|
|
2093
|
+
})]
|
|
2094
|
+
})
|
|
2095
|
+
});
|
|
2096
|
+
}
|
|
2097
|
+
//#endregion
|
|
2098
|
+
//#region src/components/dataGrid/components/dataGridColumnFilter.tsx
|
|
2099
|
+
function Ie(e) {
|
|
2100
|
+
let { columnName: t, onClear: n } = e;
|
|
2101
|
+
return /* @__PURE__ */ M(d, {
|
|
2102
|
+
clean: !0,
|
|
2103
|
+
type: "button",
|
|
2104
|
+
position: "absolute",
|
|
2105
|
+
insetEnd: 2,
|
|
2106
|
+
top: "1/2",
|
|
2107
|
+
translateY: "-1/2",
|
|
2108
|
+
cursor: "pointer",
|
|
2109
|
+
display: "flex",
|
|
2110
|
+
ai: "center",
|
|
2111
|
+
onClick: n,
|
|
2112
|
+
props: { "aria-label": `Clear the ${t} filter` },
|
|
2113
|
+
children: /* @__PURE__ */ M(r, {
|
|
2114
|
+
fontSize: 10,
|
|
2115
|
+
color: "gray-400",
|
|
2116
|
+
hover: { color: "gray-600" },
|
|
2117
|
+
children: "✕"
|
|
2118
|
+
})
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
function Le({ column: e }) {
|
|
2122
|
+
let { currentFilter: t } = e, { componentName: n } = e.grid, r = e.header ?? e.key, i = t?.type === "text" ? t.value : "", [a, o] = A(i), s = k(null);
|
|
2123
|
+
E(() => () => {
|
|
2124
|
+
s.current && clearTimeout(s.current);
|
|
2125
|
+
}, []);
|
|
2126
|
+
let c = w((t) => {
|
|
2127
|
+
let n = t.target.value;
|
|
2128
|
+
o(n), s.current && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
2129
|
+
e.setTextFilter(n), s.current = null;
|
|
2130
|
+
}, 300);
|
|
2131
|
+
}, [e]), l = w(() => {
|
|
2132
|
+
o(""), e.clearFilter();
|
|
2133
|
+
}, [e]);
|
|
2134
|
+
return /* @__PURE__ */ N(f, {
|
|
2135
|
+
component: `${n}.filter.cell.input`,
|
|
2136
|
+
children: [/* @__PURE__ */ M(m, {
|
|
2137
|
+
width: "fit",
|
|
2138
|
+
variant: "compact",
|
|
2139
|
+
placeholder: e.filterConfig?.placeholder ?? "Filter...",
|
|
2140
|
+
value: a,
|
|
2141
|
+
onChange: c,
|
|
2142
|
+
b: 0,
|
|
2143
|
+
bgColor: "transparent",
|
|
2144
|
+
focus: { outline: 0 },
|
|
2145
|
+
props: { "aria-label": `Filter ${r}` }
|
|
2146
|
+
}), a && /* @__PURE__ */ M(Ie, {
|
|
2147
|
+
columnName: r,
|
|
2148
|
+
onClear: l
|
|
2149
|
+
})]
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function Re({ column: e }) {
|
|
2153
|
+
let { currentFilter: t } = e, { componentName: n } = e.grid, r = e.header ?? e.key, i = t?.type === "number" ? t.value : "", a = t?.type === "number" ? t.operator : "eq", o = t?.type === "number" ? t.valueTo : "", [s, c] = A(i), [l, u] = A(a), [d, p] = A(o ?? ""), h = k(null), g = k(null);
|
|
2154
|
+
E(() => () => {
|
|
2155
|
+
h.current && clearTimeout(h.current), g.current && clearTimeout(g.current);
|
|
2156
|
+
}, []);
|
|
2157
|
+
let _ = e.filterConfig, y = w((t) => {
|
|
2158
|
+
let n = t.target.value;
|
|
2159
|
+
c(n), h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
2160
|
+
e.setNumberFilter(l, n, d), h.current = null;
|
|
2161
|
+
}, 300);
|
|
2162
|
+
}, [
|
|
2163
|
+
e,
|
|
2164
|
+
l,
|
|
2165
|
+
d
|
|
2166
|
+
]), b = w((t) => {
|
|
2167
|
+
u(t), e.setNumberFilter(t, s, d);
|
|
2168
|
+
}, [
|
|
2169
|
+
e,
|
|
2170
|
+
s,
|
|
2171
|
+
d
|
|
2172
|
+
]), x = w((t) => {
|
|
2173
|
+
let n = t.target.value;
|
|
2174
|
+
p(n), g.current && clearTimeout(g.current), g.current = setTimeout(() => {
|
|
2175
|
+
e.setNumberFilter(l, s, n), g.current = null;
|
|
2176
|
+
}, 300);
|
|
2177
|
+
}, [
|
|
2178
|
+
e,
|
|
2179
|
+
l,
|
|
2180
|
+
s
|
|
2181
|
+
]), S = w(() => {
|
|
2182
|
+
c(""), p(""), u("eq"), e.clearFilter();
|
|
2183
|
+
}, [e]);
|
|
2184
|
+
return /* @__PURE__ */ N(f, {
|
|
2185
|
+
component: `${n}.filter.cell.input`,
|
|
2186
|
+
ai: l === "between" ? "start" : "center",
|
|
2187
|
+
gap: 1,
|
|
2188
|
+
children: [/* @__PURE__ */ N(v, {
|
|
2189
|
+
value: l,
|
|
2190
|
+
variant: "compact",
|
|
2191
|
+
onChange: (e) => e && b(e),
|
|
2192
|
+
minWidth: 6,
|
|
2193
|
+
hideIcon: !0,
|
|
2194
|
+
b: 0,
|
|
2195
|
+
bgColor: "transparent",
|
|
2196
|
+
focus: { outline: 0 },
|
|
2197
|
+
props: { "aria-label": `Comparison for ${r}` },
|
|
2198
|
+
children: [
|
|
2199
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2200
|
+
value: "eq",
|
|
2201
|
+
children: "="
|
|
2202
|
+
}),
|
|
2203
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2204
|
+
value: "ne",
|
|
2205
|
+
children: "≠"
|
|
2206
|
+
}),
|
|
2207
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2208
|
+
value: "gt",
|
|
2209
|
+
children: ">"
|
|
2210
|
+
}),
|
|
2211
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2212
|
+
value: "gte",
|
|
2213
|
+
children: "≥"
|
|
2214
|
+
}),
|
|
2215
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2216
|
+
value: "lt",
|
|
2217
|
+
children: "<"
|
|
2218
|
+
}),
|
|
2219
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2220
|
+
value: "lte",
|
|
2221
|
+
children: "≤"
|
|
2222
|
+
}),
|
|
2223
|
+
/* @__PURE__ */ M(v.Item, {
|
|
2224
|
+
value: "between",
|
|
2225
|
+
children: "↔"
|
|
2226
|
+
})
|
|
2227
|
+
]
|
|
2228
|
+
}), l === "between" ? /* @__PURE__ */ N(f, {
|
|
2229
|
+
d: "column",
|
|
2230
|
+
gap: 1,
|
|
2231
|
+
flex1: !0,
|
|
2232
|
+
children: [/* @__PURE__ */ N(f, {
|
|
2233
|
+
ai: "center",
|
|
2234
|
+
position: "relative",
|
|
2235
|
+
flex1: !0,
|
|
2236
|
+
children: [/* @__PURE__ */ M(m, {
|
|
2237
|
+
type: "number",
|
|
2238
|
+
variant: "compact",
|
|
2239
|
+
placeholder: _?.placeholder ?? "From",
|
|
2240
|
+
value: s,
|
|
2241
|
+
onChange: y,
|
|
2242
|
+
width: "fit",
|
|
2243
|
+
step: _?.step,
|
|
2244
|
+
b: 0,
|
|
2245
|
+
bgColor: "transparent",
|
|
2246
|
+
focus: { outline: 0 },
|
|
2247
|
+
props: { "aria-label": `Filter ${r} from` }
|
|
2248
|
+
}), (s !== "" || d !== "") && /* @__PURE__ */ M(Ie, {
|
|
2249
|
+
columnName: r,
|
|
2250
|
+
onClear: S
|
|
2251
|
+
})]
|
|
2252
|
+
}), /* @__PURE__ */ M(f, {
|
|
2253
|
+
ai: "center",
|
|
2254
|
+
flex1: !0,
|
|
2255
|
+
children: /* @__PURE__ */ M(m, {
|
|
2256
|
+
type: "number",
|
|
2257
|
+
variant: "compact",
|
|
2258
|
+
placeholder: "To",
|
|
2259
|
+
value: d,
|
|
2260
|
+
onChange: x,
|
|
2261
|
+
width: "fit",
|
|
2262
|
+
step: _?.step,
|
|
2263
|
+
b: 0,
|
|
2264
|
+
bgColor: "transparent",
|
|
2265
|
+
focus: { outline: 0 },
|
|
2266
|
+
props: { "aria-label": `Filter ${r} to` }
|
|
2267
|
+
})
|
|
2268
|
+
})]
|
|
2269
|
+
}) : /* @__PURE__ */ N(f, {
|
|
2270
|
+
ai: "center",
|
|
2271
|
+
position: "relative",
|
|
2272
|
+
flex1: !0,
|
|
2273
|
+
children: [/* @__PURE__ */ M(m, {
|
|
2274
|
+
type: "number",
|
|
2275
|
+
variant: "compact",
|
|
2276
|
+
placeholder: _?.placeholder ?? "Value",
|
|
2277
|
+
value: s,
|
|
2278
|
+
onChange: y,
|
|
2279
|
+
width: "fit",
|
|
2280
|
+
step: _?.step,
|
|
2281
|
+
b: 0,
|
|
2282
|
+
bgColor: "transparent",
|
|
2283
|
+
focus: { outline: 0 },
|
|
2284
|
+
props: { "aria-label": `Filter ${r}` }
|
|
2285
|
+
}), s !== "" && /* @__PURE__ */ M(Ie, {
|
|
2286
|
+
columnName: r,
|
|
2287
|
+
onClear: S
|
|
2288
|
+
})]
|
|
2289
|
+
})]
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
function ze({ column: e }) {
|
|
2293
|
+
let { currentFilter: t } = e, { componentName: n } = e.grid, i = e.header ?? e.key, a = t?.type === "multiselect" ? t.values : [], o = e.filterOptions, s = w((t, n) => {
|
|
2294
|
+
e.setMultiselectFilter(n);
|
|
2295
|
+
}, [e]);
|
|
2296
|
+
return /* @__PURE__ */ M(f, {
|
|
2297
|
+
component: `${n}.filter.cell.input`,
|
|
2298
|
+
children: /* @__PURE__ */ N(v, {
|
|
2299
|
+
multiple: !0,
|
|
2300
|
+
showCheckbox: !0,
|
|
2301
|
+
isSearchable: !0,
|
|
2302
|
+
searchPlaceholder: "Search...",
|
|
2303
|
+
value: a,
|
|
2304
|
+
width: "fit",
|
|
2305
|
+
minWidth: 0,
|
|
2306
|
+
bgColor: "transparent",
|
|
2307
|
+
onChange: s,
|
|
2308
|
+
variant: "compact",
|
|
2309
|
+
b: 0,
|
|
2310
|
+
focus: { outline: 0 },
|
|
2311
|
+
props: { "aria-label": `Filter ${i}` },
|
|
2312
|
+
children: [
|
|
2313
|
+
/* @__PURE__ */ M(v.Display, { children: (t) => t.length === 0 ? /* @__PURE__ */ M(r, {
|
|
2314
|
+
tag: "span",
|
|
2315
|
+
color: "gray-400",
|
|
2316
|
+
children: e.filterConfig?.placeholder ?? "Select..."
|
|
2317
|
+
}) : t.length === 1 ? o.find((e) => e.value === t[0])?.label ?? String(t[0]) : `${t.length} selected` }),
|
|
2318
|
+
/* @__PURE__ */ M(v.Unselect, { children: "Clear" }),
|
|
2319
|
+
/* @__PURE__ */ M(v.SelectAll, { children: "Select All" }),
|
|
2320
|
+
o.map((e) => /* @__PURE__ */ M(v.Item, {
|
|
2321
|
+
value: e.value,
|
|
2322
|
+
ai: "center",
|
|
2323
|
+
gap: 2,
|
|
2324
|
+
children: e.label
|
|
2325
|
+
}, String(e.value)))
|
|
2326
|
+
]
|
|
2327
|
+
})
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
function Be(e) {
|
|
2331
|
+
let { column: t } = e, n = t.filterConfig;
|
|
2332
|
+
if (!n) return null;
|
|
2333
|
+
switch (n.type) {
|
|
2334
|
+
case "number": return /* @__PURE__ */ M(Re, { column: t });
|
|
2335
|
+
case "multiselect": return /* @__PURE__ */ M(ze, { column: t });
|
|
2336
|
+
default: return /* @__PURE__ */ M(Le, { column: t });
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
Be.displayName = "DataGridColumnFilter";
|
|
2340
|
+
//#endregion
|
|
2341
|
+
//#region src/components/dataGrid/components/dataGridFilterCell.tsx
|
|
2342
|
+
function Ve(e) {
|
|
2343
|
+
let { column: t, grid: n, row: r, columnIndex: i } = e, { widthVarName: a, inlineStartVarName: o, inlineEndVarName: s, filterable: c } = t, { isStartPinned: l, isEndPinned: u, isPinned: d, isFirstStartPinned: p, isLastStartPinned: m, isFirstEndPinned: h, isLastEndPinned: g } = t.pinFlags.value, { ref: _, tabIndex: v, onFocus: y } = z()?.cellProps(r, i) ?? {}, b = t.isGrouping || t.isRowNumber || t.isRowSelection;
|
|
2344
|
+
return /* @__PURE__ */ M(f, {
|
|
2345
|
+
ref: _,
|
|
2346
|
+
component: `${n.componentName}.filter.cell`,
|
|
2347
|
+
props: {
|
|
2348
|
+
role: "gridcell",
|
|
2349
|
+
"aria-colindex": i + 1,
|
|
2350
|
+
tabIndex: v,
|
|
2351
|
+
onFocus: y
|
|
2352
|
+
},
|
|
2353
|
+
variant: {
|
|
2354
|
+
isPinned: d,
|
|
2355
|
+
isFirstStartPinned: p,
|
|
2356
|
+
isLastStartPinned: m,
|
|
2357
|
+
isFirstEndPinned: h,
|
|
2358
|
+
isLastEndPinned: g
|
|
2359
|
+
},
|
|
2360
|
+
px: 2,
|
|
2361
|
+
style: {
|
|
2362
|
+
width: `var(${a})`,
|
|
2363
|
+
insetInlineStart: l ? `var(${o})` : void 0,
|
|
2364
|
+
insetInlineEnd: u ? `var(${s})` : void 0
|
|
2365
|
+
},
|
|
2366
|
+
children: !b && c && /* @__PURE__ */ M(Be, { column: t })
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
Ve.displayName = "DataGridFilterCell";
|
|
2370
|
+
//#endregion
|
|
2371
|
+
//#region src/components/dataGrid/components/dataGridFilterRow.tsx
|
|
2372
|
+
function He(e) {
|
|
2373
|
+
let { grid: t } = e;
|
|
2374
|
+
if (!t.filter.hasFilterableColumns) return null;
|
|
2375
|
+
let n = t.headerRows.value.length;
|
|
2376
|
+
return /* @__PURE__ */ M(r, {
|
|
2377
|
+
display: "contents",
|
|
2378
|
+
props: {
|
|
2379
|
+
role: "row",
|
|
2380
|
+
"aria-rowindex": n + 1
|
|
2381
|
+
},
|
|
2382
|
+
children: t.columns.value.visibleLeafs.map((e, r) => /* @__PURE__ */ M(Ve, {
|
|
2383
|
+
column: e,
|
|
2384
|
+
grid: t,
|
|
2385
|
+
row: n,
|
|
2386
|
+
columnIndex: r
|
|
2387
|
+
}, e.uniqueKey))
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
He.displayName = "DataGridFilterRow";
|
|
2391
|
+
//#endregion
|
|
2392
|
+
//#region src/icons/sortIcon.tsx
|
|
2393
|
+
function Ue(e) {
|
|
2394
|
+
return /* @__PURE__ */ M(l, {
|
|
2395
|
+
viewBox: "0 0 24 24",
|
|
2396
|
+
width: "1.5rem",
|
|
2397
|
+
...e,
|
|
2398
|
+
children: /* @__PURE__ */ M(c, { d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" })
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
//#endregion
|
|
2402
|
+
//#region src/icons/dotsIcon.tsx
|
|
2403
|
+
function We(e) {
|
|
2404
|
+
return /* @__PURE__ */ M(l, {
|
|
2405
|
+
viewBox: "0 0 16 16",
|
|
2406
|
+
width: "18",
|
|
2407
|
+
...e,
|
|
2408
|
+
children: /* @__PURE__ */ M(c, {
|
|
2409
|
+
strokeWidth: 4,
|
|
2410
|
+
d: "M7.936 12.128a.936.936 0 1 1 0 1.872.936.936 0 0 1 0-1.872ZM7.936 7.052a.936.936 0 1 1 0 1.873.936.936 0 0 1 0-1.873ZM7.936 1.977a.936.936 0 1 1 0 1.872.936.936 0 0 1 0-1.872Z"
|
|
2411
|
+
})
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2414
|
+
//#endregion
|
|
2415
|
+
//#region src/icons/groupingIcon.tsx
|
|
2416
|
+
function Ge(e) {
|
|
2417
|
+
return /* @__PURE__ */ M(l, {
|
|
2418
|
+
viewBox: "0 0 24 24",
|
|
2419
|
+
width: "1.5rem",
|
|
2420
|
+
...e,
|
|
2421
|
+
children: /* @__PURE__ */ M(c, { d: "M3 5h8v2H3V5zm0 6h8v2H3v-2zm0 6h8v2H3v-2zm12-12h6v6h-6V5zm1 1v4h4V6h-4zm-1 7h6v6h-6v-6zm1 1v4h4v-4h-4z" })
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
//#endregion
|
|
2425
|
+
//#region src/icons/pinIcon.tsx
|
|
2426
|
+
function Ke(e) {
|
|
2427
|
+
return /* @__PURE__ */ M(l, {
|
|
2428
|
+
viewBox: "0 0 1024 1024",
|
|
2429
|
+
width: "1.5rem",
|
|
2430
|
+
...e,
|
|
2431
|
+
children: /* @__PURE__ */ M(c, { d: "M31.997 1023.957a31.699 31.699 0 0 1-22.611-9.386C3.328 1008.556 0 1000.493 0 991.96s3.328-16.596 9.386-22.611L328.25 650.484l-152.52-152.52a95.907 95.907 0 0 1-25.087-92.152 95.31 95.31 0 0 1 44.327-58.62l.896-.512a353.464 353.464 0 0 1 176.156-47.398c20.137 0 40.36 1.749 60.283 5.205L597.71 44.54A95.224 95.224 0 0 1 678.685.085c25.64 0 49.745 9.983 67.877 28.073l249.195 249.195a95.224 95.224 0 0 1 25.897 88.74 95.139 95.139 0 0 1-42.152 60.154L719.513 591.695a352.227 352.227 0 0 1-42.663 237.292A95.395 95.395 0 0 1 594 876.514a95.523 95.523 0 0 1-67.963-28.2L373.43 695.706 54.61 1014.614a31.912 31.912 0 0 1-22.612 9.343zm340.025-660.68c-50.64 0-100.685 13.566-144.798 39.207a31.57 31.57 0 0 0-14.676 19.497 31.699 31.699 0 0 0 8.362 30.675L571.344 803.09c6.059 6.059 14.122 9.386 22.697 9.386a31.699 31.699 0 0 0 27.56-15.785 287.421 287.421 0 0 0 31.06-212.676 31.997 31.997 0 0 1 13.907-34.471l278.59-177.266a31.57 31.57 0 0 0 14.037-20.051 31.699 31.699 0 0 0-8.618-29.566l-249.28-249.28a31.912 31.912 0 0 0-49.618 5.418l-177.308 278.59a31.827 31.827 0 0 1-34.472 13.908 293.778 293.778 0 0 0-67.877-8.02z" })
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region src/components/dataGrid/components/dataGridHeaderCellContextMenu.tsx
|
|
2436
|
+
function qe(e) {
|
|
2437
|
+
let t = e.side === "start" ? "Left" : "Right", n = e.side === "start" ? "Right" : "Left";
|
|
2438
|
+
return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N(b, {
|
|
2439
|
+
rtl: { display: "none" },
|
|
2440
|
+
children: ["Pin ", t]
|
|
2441
|
+
}), /* @__PURE__ */ N(b, {
|
|
2442
|
+
ltr: { display: "none" },
|
|
2443
|
+
children: ["Pin ", n]
|
|
2444
|
+
})] });
|
|
2445
|
+
}
|
|
2446
|
+
function Je(t) {
|
|
2447
|
+
let { column: c } = t, { grid: l, isEndAligned: u, header: p, key: m } = c, h = c.headerCell, v = p ?? m, y = a("datagrid-column-menu"), [x, C] = A(!1), T = k(null), E = k(null), D = k(!1), [j, ee] = A({
|
|
2448
|
+
top: 0,
|
|
2449
|
+
left: 0
|
|
2450
|
+
}), P = O(() => e() && j.left > window.innerWidth / 2, [j.left]), te = u ? 2 : void 0, ne = u ? void 0 : c.pin === "END" ? 2.5 : 4, F = O(() => {
|
|
2451
|
+
let e = (e) => /* @__PURE__ */ M(b, {
|
|
2452
|
+
component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`,
|
|
2453
|
+
children: e
|
|
2454
|
+
}), t = (t) => e(/* @__PURE__ */ M(Ue, {
|
|
2455
|
+
width: "100%",
|
|
2456
|
+
fill: "currentColor",
|
|
2457
|
+
rotate: t
|
|
2458
|
+
})), n = (t, n) => e(/* @__PURE__ */ M(Ke, {
|
|
2459
|
+
width: "100%",
|
|
2460
|
+
fill: "currentColor",
|
|
2461
|
+
rotate: t,
|
|
2462
|
+
rtl: { rotate: n }
|
|
2463
|
+
})), i = e(/* @__PURE__ */ M(Ge, {
|
|
2464
|
+
width: "100%",
|
|
2465
|
+
fill: "currentColor"
|
|
2466
|
+
})), a = /* @__PURE__ */ M(r, { width: 4 });
|
|
2467
|
+
return [
|
|
2468
|
+
[
|
|
2469
|
+
h.canSortAsc && {
|
|
2470
|
+
key: "sort-asc",
|
|
2471
|
+
icon: t(),
|
|
2472
|
+
label: "Sort Ascending",
|
|
2473
|
+
text: "Sort Ascending",
|
|
2474
|
+
run: () => c.sortColumn("ASC")
|
|
2475
|
+
},
|
|
2476
|
+
h.canSortDesc && {
|
|
2477
|
+
key: "sort-desc",
|
|
2478
|
+
icon: t(180),
|
|
2479
|
+
label: "Sort Descending",
|
|
2480
|
+
text: "Sort Descending",
|
|
2481
|
+
run: () => c.sortColumn("DESC")
|
|
2482
|
+
},
|
|
2483
|
+
h.canClearSort && {
|
|
2484
|
+
key: "sort-clear",
|
|
2485
|
+
icon: a,
|
|
2486
|
+
label: "Clear Sort",
|
|
2487
|
+
text: "Clear Sort",
|
|
2488
|
+
run: () => c.sortColumn(void 0)
|
|
2489
|
+
}
|
|
2490
|
+
],
|
|
2491
|
+
[
|
|
2492
|
+
h.canPinStart && {
|
|
2493
|
+
key: "pin-start",
|
|
2494
|
+
icon: n(0, -90),
|
|
2495
|
+
label: /* @__PURE__ */ M(qe, { side: "start" }),
|
|
2496
|
+
text: "Pin Left",
|
|
2497
|
+
run: () => c.pinColumn("START")
|
|
2498
|
+
},
|
|
2499
|
+
h.canPinEnd && {
|
|
2500
|
+
key: "pin-end",
|
|
2501
|
+
icon: n(-90, 0),
|
|
2502
|
+
label: /* @__PURE__ */ M(qe, { side: "end" }),
|
|
2503
|
+
text: "Pin Right",
|
|
2504
|
+
run: () => c.pinColumn("END")
|
|
2505
|
+
},
|
|
2506
|
+
h.canUnpin && {
|
|
2507
|
+
key: "unpin",
|
|
2508
|
+
icon: a,
|
|
2509
|
+
label: "Unpin",
|
|
2510
|
+
text: "Unpin",
|
|
2511
|
+
run: () => c.pinColumn()
|
|
2512
|
+
}
|
|
2513
|
+
],
|
|
2514
|
+
[h.canGroupBy && {
|
|
2515
|
+
key: "group",
|
|
2516
|
+
icon: i,
|
|
2517
|
+
label: /* @__PURE__ */ N(r, {
|
|
2518
|
+
textWrap: "nowrap",
|
|
2519
|
+
children: ["Group by ", v]
|
|
2520
|
+
}),
|
|
2521
|
+
text: `Group by ${v}`,
|
|
2522
|
+
run: c.toggleGrouping
|
|
2523
|
+
}, h.canUnGroupAll && {
|
|
2524
|
+
key: "ungroup",
|
|
2525
|
+
icon: i,
|
|
2526
|
+
label: /* @__PURE__ */ M(r, {
|
|
2527
|
+
textWrap: "nowrap",
|
|
2528
|
+
children: "Un-Group All"
|
|
2529
|
+
}),
|
|
2530
|
+
text: "Un-Group All",
|
|
2531
|
+
run: l.unGroupAll
|
|
2532
|
+
}]
|
|
2533
|
+
].map((e) => e.filter((e) => e !== !1)).filter((e) => e.length > 0).flatMap((e, t) => e.map((e, n) => ({
|
|
2534
|
+
...e,
|
|
2535
|
+
startsSection: t > 0 && n === 0
|
|
2536
|
+
})));
|
|
2537
|
+
}, [
|
|
2538
|
+
c,
|
|
2539
|
+
v,
|
|
2540
|
+
l,
|
|
2541
|
+
h
|
|
2542
|
+
]), I = w((e = !0) => {
|
|
2543
|
+
D.current = !1, C(!1), e && T.current?.focus();
|
|
2544
|
+
}, []), L = s({
|
|
2545
|
+
count: F.length,
|
|
2546
|
+
textOf: (e) => F[e]?.text ?? "",
|
|
2547
|
+
onSelect: (e) => {
|
|
2548
|
+
F[e]?.run(), I();
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
i({
|
|
2552
|
+
enabled: x,
|
|
2553
|
+
inside: [T, E],
|
|
2554
|
+
onDismiss: () => I()
|
|
2555
|
+
}), o({
|
|
2556
|
+
enabled: x,
|
|
2557
|
+
returnTo: T
|
|
2558
|
+
});
|
|
2559
|
+
let R = L.setActiveIndex, re = L.activeItem, ie = w(() => {
|
|
2560
|
+
R(0, { reason: "programmatic" }), D.current = !0, C(!0);
|
|
2561
|
+
}, [R]);
|
|
2562
|
+
return n(() => {
|
|
2563
|
+
if (!D.current) return;
|
|
2564
|
+
let e = re();
|
|
2565
|
+
e && (D.current = !1, e.focus());
|
|
2566
|
+
}), /* @__PURE__ */ M(f, {
|
|
2567
|
+
position: "absolute",
|
|
2568
|
+
insetStart: te,
|
|
2569
|
+
insetEnd: ne,
|
|
2570
|
+
top: "1/2",
|
|
2571
|
+
translateY: -3,
|
|
2572
|
+
ai: "center",
|
|
2573
|
+
children: /* @__PURE__ */ N(d, {
|
|
2574
|
+
ref: T,
|
|
2575
|
+
component: `${l.componentName}.header.cell.contextMenu`,
|
|
2576
|
+
onClick: () => x ? I(!1) : ie(),
|
|
2577
|
+
variant: h.contextMenuButtonVariant,
|
|
2578
|
+
type: "button",
|
|
2579
|
+
props: {
|
|
2580
|
+
"aria-label": `Column options for ${v}`,
|
|
2581
|
+
"aria-haspopup": "menu",
|
|
2582
|
+
"aria-expanded": x,
|
|
2583
|
+
"aria-controls": x ? y : void 0
|
|
2584
|
+
},
|
|
2585
|
+
children: [/* @__PURE__ */ M(b, {
|
|
2586
|
+
component: `${l.componentName}.header.cell.contextMenu.icon`,
|
|
2587
|
+
children: /* @__PURE__ */ M(We, { fill: "currentColor" })
|
|
2588
|
+
}), /* @__PURE__ */ M(_, {
|
|
2589
|
+
present: x,
|
|
2590
|
+
children: (e) => /* @__PURE__ */ M(g, {
|
|
2591
|
+
component: `${l.componentName}.header.cell.contextMenu.tooltip`,
|
|
2592
|
+
variant: { closed: !e.present },
|
|
2593
|
+
onPositionChange: ee,
|
|
2594
|
+
ref: E,
|
|
2595
|
+
contentRef: e.ref,
|
|
2596
|
+
adjustTranslateX: P ? "-100%" : "-21px",
|
|
2597
|
+
adjustTranslateY: "16px",
|
|
2598
|
+
id: y,
|
|
2599
|
+
props: {
|
|
2600
|
+
role: "menu",
|
|
2601
|
+
"aria-label": `Column options for ${v}`,
|
|
2602
|
+
onKeyDown: L.onKeyDown,
|
|
2603
|
+
...e.props
|
|
2604
|
+
},
|
|
2605
|
+
children: F.map((e, t) => {
|
|
2606
|
+
let { ref: n, tabIndex: i, onFocus: a } = L.itemProps(t);
|
|
2607
|
+
return /* @__PURE__ */ N(S, { children: [e.startsSection && /* @__PURE__ */ M(r, {
|
|
2608
|
+
bb: 1,
|
|
2609
|
+
my: 2,
|
|
2610
|
+
borderColor: "gray-300",
|
|
2611
|
+
component: `${l.componentName}.header.cell.contextMenu.tooltip.item.separator`
|
|
2612
|
+
}), /* @__PURE__ */ N(d, {
|
|
2613
|
+
component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
|
|
2614
|
+
ref: n,
|
|
2615
|
+
type: "button",
|
|
2616
|
+
onClick: (t) => {
|
|
2617
|
+
t.stopPropagation(), e.run(), I();
|
|
2618
|
+
},
|
|
2619
|
+
props: {
|
|
2620
|
+
role: "menuitem",
|
|
2621
|
+
tabIndex: i,
|
|
2622
|
+
onFocus: a
|
|
2623
|
+
},
|
|
2624
|
+
children: [e.icon, e.label]
|
|
2625
|
+
})] }, e.key);
|
|
2626
|
+
})
|
|
2627
|
+
})
|
|
2628
|
+
})]
|
|
2629
|
+
})
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
Je.displayName = "DataGridHeaderCellContextMenu";
|
|
2633
|
+
//#endregion
|
|
2634
|
+
//#region src/components/dataGrid/components/dataGridHeaderCellResizer.tsx
|
|
2635
|
+
var Q = (e) => "touches" in e ? e.touches[0]?.pageX ?? 0 : e.pageX, Ye = 16, Xe = 150;
|
|
2636
|
+
function $(e) {
|
|
2637
|
+
let t = e.sizingElement;
|
|
2638
|
+
t && Object.entries(e.sizes.value).forEach(([e, n]) => t.style.setProperty(e, n));
|
|
2639
|
+
}
|
|
2640
|
+
function Ze(e) {
|
|
2641
|
+
let { column: t, controls: n } = e, i = t.grid.resizerStyle, a = t.headerCell, o = w((e) => {
|
|
2642
|
+
let { grid: n } = t;
|
|
2643
|
+
e.type === "mousedown" && e.preventDefault(), t.beginResize(Q(e.nativeEvent));
|
|
2644
|
+
let r = new AbortController(), { signal: i } = r, a = 0, o = Q(e.nativeEvent), s = () => {
|
|
2645
|
+
t.applyResize(o), $(n);
|
|
2646
|
+
}, c = n.resizeMode === "instant" ? (e) => {
|
|
2647
|
+
o = Q(e), s();
|
|
2648
|
+
} : (e) => {
|
|
2649
|
+
o = Q(e), a ||= requestAnimationFrame(() => {
|
|
2650
|
+
a = 0, s();
|
|
2651
|
+
});
|
|
2652
|
+
}, l = () => {
|
|
2653
|
+
r.abort(), a && cancelAnimationFrame(a), s(), t.endResize();
|
|
2654
|
+
};
|
|
2655
|
+
window.addEventListener("mousemove", c, { signal: i }), window.addEventListener("touchmove", c, { signal: i }), window.addEventListener("mouseup", l, { signal: i }), window.addEventListener("touchend", l, { signal: i });
|
|
2656
|
+
}, [t]), s = k(void 0), c = k(0), l = w(() => {
|
|
2657
|
+
let { grid: e } = t;
|
|
2658
|
+
if (e.resizeMode === "instant") {
|
|
2659
|
+
$(e);
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
c.current ||= requestAnimationFrame(() => {
|
|
2663
|
+
c.current = 0, $(e);
|
|
2664
|
+
});
|
|
2665
|
+
}, [t]), u = w(() => {
|
|
2666
|
+
s.current !== void 0 && (clearTimeout(s.current), s.current = void 0, c.current &&= (cancelAnimationFrame(c.current), 0), t.endResize());
|
|
2667
|
+
}, [t]);
|
|
2668
|
+
E(() => () => {
|
|
2669
|
+
clearTimeout(s.current), c.current && cancelAnimationFrame(c.current);
|
|
2670
|
+
}, []);
|
|
2671
|
+
let d = w((e) => {
|
|
2672
|
+
switch (e.key) {
|
|
2673
|
+
case "ArrowRight":
|
|
2674
|
+
t.moveResizer(Ye);
|
|
2675
|
+
break;
|
|
2676
|
+
case "ArrowLeft":
|
|
2677
|
+
t.moveResizer(-16);
|
|
2678
|
+
break;
|
|
2679
|
+
case "Home":
|
|
2680
|
+
t.resizeWidthTo(a.minWidth);
|
|
2681
|
+
break;
|
|
2682
|
+
case "End":
|
|
2683
|
+
t.resizeWidthTo(a.maxWidth);
|
|
2684
|
+
break;
|
|
2685
|
+
default: return;
|
|
2686
|
+
}
|
|
2687
|
+
e.preventDefault(), l(), clearTimeout(s.current), s.current = setTimeout(u, Xe);
|
|
2688
|
+
}, [
|
|
2689
|
+
t,
|
|
2690
|
+
u,
|
|
2691
|
+
a,
|
|
2692
|
+
l
|
|
2693
|
+
]);
|
|
2694
|
+
return /* @__PURE__ */ M(f, {
|
|
2695
|
+
height: "fit",
|
|
2696
|
+
ai: "center",
|
|
2697
|
+
position: "absolute",
|
|
2698
|
+
insetEnd: t.pin === "END" ? void 0 : 0,
|
|
2699
|
+
insetStart: t.pin === "END" ? 0 : void 0,
|
|
2700
|
+
py: 3,
|
|
2701
|
+
children: /* @__PURE__ */ M(r, {
|
|
2702
|
+
cursor: "col-resize",
|
|
2703
|
+
px: .75,
|
|
2704
|
+
mt: -6,
|
|
2705
|
+
className: "resizer",
|
|
2706
|
+
height: "fit",
|
|
2707
|
+
props: {
|
|
2708
|
+
onMouseDown: o,
|
|
2709
|
+
onTouchStart: o
|
|
2710
|
+
},
|
|
2711
|
+
children: /* @__PURE__ */ M(r, {
|
|
2712
|
+
component: `${t.grid.componentName}.header.cell.resizer`,
|
|
2713
|
+
opacity: i === "visible" ? void 0 : 0,
|
|
2714
|
+
group: i === "hover" ? { "header-cell/hover": { opacity: 1 } } : void 0,
|
|
2715
|
+
props: {
|
|
2716
|
+
role: "separator",
|
|
2717
|
+
"aria-label": a.resizerLabel,
|
|
2718
|
+
"aria-controls": n,
|
|
2719
|
+
"aria-orientation": "vertical",
|
|
2720
|
+
"aria-valuenow": a.width,
|
|
2721
|
+
"aria-valuemin": a.minWidth,
|
|
2722
|
+
"aria-valuemax": a.maxWidth,
|
|
2723
|
+
"aria-valuetext": `${a.width} pixels`,
|
|
2724
|
+
tabIndex: 0,
|
|
2725
|
+
onKeyDown: d,
|
|
2726
|
+
onKeyUp: u
|
|
2727
|
+
}
|
|
2728
|
+
})
|
|
2729
|
+
})
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
Ze.displayName = "DataGridHeaderCellResizer";
|
|
2733
|
+
//#endregion
|
|
2734
|
+
//#region src/components/dataGrid/components/dataGridHeaderCell.tsx
|
|
2735
|
+
function Qe(e) {
|
|
2736
|
+
let { column: t, row: n, columnIndex: i } = e, { grid: o } = t, { isStartPinned: s, isEndPinned: c } = t.pinFlags.value, l = t.headerCell, { isSortable: u, showResizer: d, showContextMenu: m, paddingStart: h, paddingEnd: g } = l, { ref: _, tabIndex: v, onFocus: b } = z()?.cellProps(n, i) ?? {}, x = a("datagrid-columnheader"), S = w(() => {
|
|
2737
|
+
o.toggleSelectAllRows();
|
|
2738
|
+
}, [o]), C = t.isRowSelection ? /* @__PURE__ */ M(p, {
|
|
2739
|
+
variant: "datagrid",
|
|
2740
|
+
m: 1,
|
|
2741
|
+
indeterminate: o.someRowsSelected && !o.allRowsSelected,
|
|
2742
|
+
checked: o.allRowsSelected,
|
|
2743
|
+
onChange: S,
|
|
2744
|
+
props: { "aria-label": "Select all rows" }
|
|
2745
|
+
}) : l.hiddenLabel ? /* @__PURE__ */ M(y, {
|
|
2746
|
+
tag: "span",
|
|
2747
|
+
children: l.hiddenLabel
|
|
2748
|
+
}) : l.label;
|
|
2749
|
+
return /* @__PURE__ */ M(f, {
|
|
2750
|
+
ref: _,
|
|
2751
|
+
id: x,
|
|
2752
|
+
props: {
|
|
2753
|
+
role: "columnheader",
|
|
2754
|
+
"aria-colindex": l.columnIndex,
|
|
2755
|
+
"aria-colspan": l.columnSpan,
|
|
2756
|
+
"aria-rowspan": l.rowSpan,
|
|
2757
|
+
"aria-sort": l.ariaSort,
|
|
2758
|
+
tabIndex: v,
|
|
2759
|
+
onFocus: b
|
|
2760
|
+
},
|
|
2761
|
+
className: "header-cell",
|
|
2762
|
+
component: `${o.componentName}.header.cell`,
|
|
2763
|
+
variant: l.variant,
|
|
2764
|
+
gridRow: t.gridRows,
|
|
2765
|
+
gridColumn: l.gridColumn,
|
|
2766
|
+
style: {
|
|
2767
|
+
width: `var(${t.widthVarName})`,
|
|
2768
|
+
insetInlineStart: s ? `var(${t.inlineStartVarName})` : void 0,
|
|
2769
|
+
insetInlineEnd: c ? `var(${t.inlineEndVarName})` : void 0
|
|
2770
|
+
},
|
|
2771
|
+
children: /* @__PURE__ */ N(j, { children: [
|
|
2772
|
+
/* @__PURE__ */ M(f, {
|
|
2773
|
+
width: "fit",
|
|
2774
|
+
height: "fit",
|
|
2775
|
+
jc: t.align,
|
|
2776
|
+
props: { onClick: u ? () => t.sortColumn() : void 0 },
|
|
2777
|
+
children: /* @__PURE__ */ N(f, {
|
|
2778
|
+
overflow: "hidden",
|
|
2779
|
+
position: t.isLeaf ? void 0 : "sticky",
|
|
2780
|
+
ai: "center",
|
|
2781
|
+
transition: "none",
|
|
2782
|
+
ps: h,
|
|
2783
|
+
pe: g,
|
|
2784
|
+
style: { insetInlineStart: t.pin ? void 0 : `var(${o.inlineStartEdgeVarName})` },
|
|
2785
|
+
children: [
|
|
2786
|
+
/* @__PURE__ */ M(r, {
|
|
2787
|
+
overflow: "hidden",
|
|
2788
|
+
textOverflow: "ellipsis",
|
|
2789
|
+
textWrap: "nowrap",
|
|
2790
|
+
children: C
|
|
2791
|
+
}),
|
|
2792
|
+
l.isSorted && /* @__PURE__ */ M(r, {
|
|
2793
|
+
ps: (t.inlineWidth ?? 0) < 58 ? 0 : 2,
|
|
2794
|
+
children: /* @__PURE__ */ M(Ue, {
|
|
2795
|
+
width: "16px",
|
|
2796
|
+
rotate: l.sortDirection === "ASC" ? 0 : 180,
|
|
2797
|
+
fill: "currentColor"
|
|
2798
|
+
})
|
|
2799
|
+
}),
|
|
2800
|
+
m && /* @__PURE__ */ M(r, { minWidth: t.isEndAligned ? 4 : 10 })
|
|
2801
|
+
]
|
|
2802
|
+
})
|
|
2803
|
+
}),
|
|
2804
|
+
d && /* @__PURE__ */ M(Ze, {
|
|
2805
|
+
column: t,
|
|
2806
|
+
controls: x
|
|
2807
|
+
}),
|
|
2808
|
+
m && /* @__PURE__ */ M(Je, { column: t })
|
|
2809
|
+
] })
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
Qe.displayName = "DataGridHeaderCell";
|
|
2813
|
+
//#endregion
|
|
2814
|
+
//#region src/components/dataGrid/components/dataGridHeader.tsx
|
|
2815
|
+
function $e(e) {
|
|
2816
|
+
let { grid: t } = e;
|
|
2817
|
+
return /* @__PURE__ */ N(h, {
|
|
2818
|
+
component: `${t.componentName}.header`,
|
|
2819
|
+
props: { role: "rowgroup" },
|
|
2820
|
+
style: { gridTemplateColumns: t.gridTemplateColumns.value },
|
|
2821
|
+
children: [t.headerRows.value.map((e, t) => /* @__PURE__ */ M(r, {
|
|
2822
|
+
display: "contents",
|
|
2823
|
+
props: {
|
|
2824
|
+
role: "row",
|
|
2825
|
+
"aria-rowindex": t + 1
|
|
2826
|
+
},
|
|
2827
|
+
children: e.map((e, n) => /* @__PURE__ */ M(Qe, {
|
|
2828
|
+
column: e,
|
|
2829
|
+
row: t,
|
|
2830
|
+
columnIndex: n
|
|
2831
|
+
}, e.uniqueKey))
|
|
2832
|
+
}, t)), /* @__PURE__ */ M(He, { grid: t })]
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
$e.displayName = "DataGridHeader";
|
|
2836
|
+
//#endregion
|
|
2837
|
+
//#region src/components/dataGrid/components/dataGridLoader.tsx
|
|
2838
|
+
function et(e) {
|
|
2839
|
+
let { grid: t } = e;
|
|
2840
|
+
return /* @__PURE__ */ M(r, {
|
|
2841
|
+
component: `${t.componentName}.loader`,
|
|
2842
|
+
props: { "aria-hidden": !0 },
|
|
2843
|
+
children: /* @__PURE__ */ M(r, {
|
|
2844
|
+
component: `${t.componentName}.loader.track`,
|
|
2845
|
+
style: { height: 3 },
|
|
2846
|
+
children: /* @__PURE__ */ M(r, {
|
|
2847
|
+
component: `${t.componentName}.loader.track.bar`,
|
|
2848
|
+
width: "2/5"
|
|
2849
|
+
})
|
|
2850
|
+
})
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
et.displayName = "DataGridLoader";
|
|
2854
|
+
//#endregion
|
|
2855
|
+
//#region src/components/dataGrid/components/dataGridContent.tsx
|
|
2856
|
+
function tt(e) {
|
|
2857
|
+
let { grid: t } = e, n = k(null), [i, a] = A(0), o = k(null), s = w((e) => {
|
|
2858
|
+
o.current !== null && cancelAnimationFrame(o.current), o.current = requestAnimationFrame(() => {
|
|
2859
|
+
a(e.target.scrollTop), o.current = null;
|
|
2860
|
+
});
|
|
2861
|
+
}, []), c = de({
|
|
2862
|
+
grid: t,
|
|
2863
|
+
scrollerRef: n,
|
|
2864
|
+
scrollTop: i,
|
|
2865
|
+
onScrollTo: a
|
|
2866
|
+
});
|
|
2867
|
+
return t.hasVisibleColumns ? /* @__PURE__ */ M(oe.Provider, {
|
|
2868
|
+
value: c,
|
|
2869
|
+
children: /* @__PURE__ */ N(r, {
|
|
2870
|
+
ref: n,
|
|
2871
|
+
component: `${t.componentName}.content`,
|
|
2872
|
+
overflowX: "scroll",
|
|
2873
|
+
style: { willChange: "scroll-position" },
|
|
2874
|
+
props: {
|
|
2875
|
+
role: "grid",
|
|
2876
|
+
"aria-rowcount": c.rowCount,
|
|
2877
|
+
"aria-colcount": c.columnCount,
|
|
2878
|
+
"aria-multiselectable": t.props.def.rowSelection ? !0 : void 0,
|
|
2879
|
+
"aria-labelledby": t.props.def.title ? t.titleId : void 0,
|
|
2880
|
+
"aria-busy": t.props.loading ? !0 : void 0,
|
|
2881
|
+
onScroll: s,
|
|
2882
|
+
onKeyDown: c.onKeyDown
|
|
2883
|
+
},
|
|
2884
|
+
children: [
|
|
2885
|
+
/* @__PURE__ */ M($e, { grid: t }),
|
|
2886
|
+
t.props.loading && /* @__PURE__ */ M(et, { grid: t }),
|
|
2887
|
+
/* @__PURE__ */ M(Pe, {
|
|
2888
|
+
grid: t,
|
|
2889
|
+
scrollTop: i
|
|
2890
|
+
})
|
|
2891
|
+
]
|
|
2892
|
+
})
|
|
2893
|
+
}) : /* @__PURE__ */ M(Fe, { grid: t });
|
|
2894
|
+
}
|
|
2895
|
+
tt.displayName = "DataGridContent";
|
|
2896
|
+
//#endregion
|
|
2897
|
+
//#region src/components/dataGrid/components/dataGridColumnGroups.tsx
|
|
2898
|
+
function nt(e) {
|
|
2899
|
+
let { grid: t } = e;
|
|
2900
|
+
return t.groupColumns.size === 0 ? null : /* @__PURE__ */ N(f, {
|
|
2901
|
+
component: `${t.componentName}.topBar.columnGroups`,
|
|
2902
|
+
children: [/* @__PURE__ */ M(b, {
|
|
2903
|
+
component: `${t.componentName}.topBar.columnGroups.icon`,
|
|
2904
|
+
children: /* @__PURE__ */ M(Ge, {
|
|
2905
|
+
width: "100%",
|
|
2906
|
+
fill: "currentColor"
|
|
2907
|
+
})
|
|
2908
|
+
}), t.groupedColumns.map((e) => /* @__PURE__ */ N(x.Fragment, { children: [/* @__PURE__ */ M(W, {
|
|
2909
|
+
fill: "currentColor",
|
|
2910
|
+
width: "14px",
|
|
2911
|
+
height: "14px",
|
|
2912
|
+
rotate: -90
|
|
2913
|
+
}), /* @__PURE__ */ N(f, {
|
|
2914
|
+
component: `${t.componentName}.topBar.columnGroups.item`,
|
|
2915
|
+
children: [e.header ?? e.key, /* @__PURE__ */ M(d, {
|
|
2916
|
+
component: `${t.componentName}.topBar.columnGroups.item.icon`,
|
|
2917
|
+
onClick: () => t.toggleGrouping(e.key),
|
|
2918
|
+
props: { "aria-label": `Stop grouping by ${e.header ?? e.key}` },
|
|
2919
|
+
children: /* @__PURE__ */ M(r, {
|
|
2920
|
+
fontSize: 10,
|
|
2921
|
+
color: "gray-400",
|
|
2922
|
+
hover: { color: "gray-600" },
|
|
2923
|
+
children: "✕"
|
|
2924
|
+
})
|
|
2925
|
+
})]
|
|
2926
|
+
})] }, e.key))]
|
|
2927
|
+
});
|
|
2928
|
+
}
|
|
2929
|
+
nt.displayName = "DataGridColumnGroups";
|
|
2930
|
+
//#endregion
|
|
2931
|
+
//#region src/icons/searchIcon.tsx
|
|
2932
|
+
function rt(e) {
|
|
2933
|
+
return /* @__PURE__ */ M(l, {
|
|
2934
|
+
viewBox: "0 0 488.4 488.4",
|
|
2935
|
+
width: "1.5rem",
|
|
2936
|
+
...e,
|
|
2937
|
+
children: /* @__PURE__ */ M(c, { d: "M0 203.25c0 112.1 91.2 203.2 203.2 203.2 51.6 0 98.8-19.4 134.7-51.2l129.5 129.5c2.4 2.4 5.5 3.6 8.7 3.6s6.3-1.2 8.7-3.6c4.8-4.8 4.8-12.5 0-17.3l-129.6-129.5c31.8-35.9 51.2-83 51.2-134.7C406.4 91.15 315.2.05 203.2.05S0 91.15 0 203.25zm381.9 0c0 98.5-80.2 178.7-178.7 178.7s-178.7-80.2-178.7-178.7 80.2-178.7 178.7-178.7 178.7 80.1 178.7 178.7z" })
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
//#endregion
|
|
2941
|
+
//#region src/components/dataGrid/components/dataGridGlobalFilter.tsx
|
|
2942
|
+
function it(e) {
|
|
2943
|
+
let { grid: t } = e, [n, i] = A(t.globalFilterValue), a = k(null);
|
|
2944
|
+
E(() => () => {
|
|
2945
|
+
a.current && clearTimeout(a.current);
|
|
2946
|
+
}, []);
|
|
2947
|
+
let o = w((e) => {
|
|
2948
|
+
let n = e.target.value;
|
|
2949
|
+
i(n), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
2950
|
+
t.filter.setGlobalFilter(n), a.current = null;
|
|
2951
|
+
}, 300);
|
|
2952
|
+
}, [t]), s = w(() => {
|
|
2953
|
+
i(""), t.filter.setGlobalFilter("");
|
|
2954
|
+
}, [t]), { filtered: c, total: l } = t.filter.filterStats, u = t.filter.hasActiveFilters && c !== l;
|
|
2955
|
+
return /* @__PURE__ */ N(f, {
|
|
2956
|
+
component: `${t.componentName}.topBar.globalFilter`,
|
|
2957
|
+
children: [u && /* @__PURE__ */ N(r, {
|
|
2958
|
+
component: `${t.componentName}.topBar.globalFilter.stats`,
|
|
2959
|
+
children: [
|
|
2960
|
+
c,
|
|
2961
|
+
"/",
|
|
2962
|
+
l
|
|
2963
|
+
]
|
|
2964
|
+
}), /* @__PURE__ */ N(f, {
|
|
2965
|
+
position: "relative",
|
|
2966
|
+
ai: "center",
|
|
2967
|
+
children: [
|
|
2968
|
+
/* @__PURE__ */ M(f, {
|
|
2969
|
+
position: "absolute",
|
|
2970
|
+
insetStart: 3,
|
|
2971
|
+
pointerEvents: "none",
|
|
2972
|
+
color: "gray-400",
|
|
2973
|
+
theme: { dark: { color: "gray-500" } },
|
|
2974
|
+
children: /* @__PURE__ */ M(rt, {
|
|
2975
|
+
fill: "currentColor",
|
|
2976
|
+
width: "14px"
|
|
2977
|
+
})
|
|
2978
|
+
}),
|
|
2979
|
+
/* @__PURE__ */ M(m, {
|
|
2980
|
+
placeholder: "Search...",
|
|
2981
|
+
variant: "compact",
|
|
2982
|
+
value: n,
|
|
2983
|
+
onChange: o,
|
|
2984
|
+
ps: 8,
|
|
2985
|
+
pe: n ? 8 : 3
|
|
2986
|
+
}),
|
|
2987
|
+
n && /* @__PURE__ */ M(r, {
|
|
2988
|
+
position: "absolute",
|
|
2989
|
+
insetEnd: 2,
|
|
2990
|
+
cursor: "pointer",
|
|
2991
|
+
p: 1,
|
|
2992
|
+
color: "gray-400",
|
|
2993
|
+
hover: { color: "gray-600" },
|
|
2994
|
+
theme: { dark: {
|
|
2995
|
+
color: "gray-500",
|
|
2996
|
+
hover: { color: "gray-300" }
|
|
2997
|
+
} },
|
|
2998
|
+
props: { onClick: s },
|
|
2999
|
+
children: /* @__PURE__ */ M(r, {
|
|
3000
|
+
fontSize: 12,
|
|
3001
|
+
fontWeight: 600,
|
|
3002
|
+
children: "✕"
|
|
3003
|
+
})
|
|
3004
|
+
})
|
|
3005
|
+
]
|
|
3006
|
+
})]
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
//#endregion
|
|
3010
|
+
//#region src/components/dataGrid/components/dataGridTopBarContextMenu.tsx
|
|
3011
|
+
function at(e) {
|
|
3012
|
+
let { grid: t } = e, { columnVisibility: n } = t, { entries: i, selectedIds: a, total: o, hasHidden: s } = n;
|
|
3013
|
+
return /* @__PURE__ */ N(v, {
|
|
3014
|
+
component: `${t.componentName}.topBar.columnVisibility`,
|
|
3015
|
+
multiple: !0,
|
|
3016
|
+
showCheckbox: !0,
|
|
3017
|
+
hideIcon: !0,
|
|
3018
|
+
variant: "compact",
|
|
3019
|
+
value: a,
|
|
3020
|
+
onChange: (e, t) => {
|
|
3021
|
+
n.setVisibility(t);
|
|
3022
|
+
},
|
|
3023
|
+
isSearchable: i.length > 6,
|
|
3024
|
+
searchPlaceholder: "Search columns...",
|
|
3025
|
+
display: "inline-flex",
|
|
3026
|
+
props: { "aria-label": "Columns" },
|
|
3027
|
+
children: [
|
|
3028
|
+
/* @__PURE__ */ M(v.Display, { children: (e) => {
|
|
3029
|
+
let n = e.length === 0;
|
|
3030
|
+
return /* @__PURE__ */ N(f, {
|
|
3031
|
+
ai: "center",
|
|
3032
|
+
gap: 2,
|
|
3033
|
+
children: [/* @__PURE__ */ N(u, {
|
|
3034
|
+
viewBox: "0 0 20 20",
|
|
3035
|
+
width: "18",
|
|
3036
|
+
height: "18",
|
|
3037
|
+
children: [
|
|
3038
|
+
/* @__PURE__ */ M("rect", {
|
|
3039
|
+
x: "2",
|
|
3040
|
+
y: "3",
|
|
3041
|
+
width: "4",
|
|
3042
|
+
height: "14",
|
|
3043
|
+
rx: "1",
|
|
3044
|
+
fill: "currentColor",
|
|
3045
|
+
opacity: .9
|
|
3046
|
+
}),
|
|
3047
|
+
/* @__PURE__ */ M("rect", {
|
|
3048
|
+
x: "8",
|
|
3049
|
+
y: "3",
|
|
3050
|
+
width: "4",
|
|
3051
|
+
height: "14",
|
|
3052
|
+
rx: "1",
|
|
3053
|
+
fill: "currentColor",
|
|
3054
|
+
opacity: .6
|
|
3055
|
+
}),
|
|
3056
|
+
/* @__PURE__ */ M("rect", {
|
|
3057
|
+
x: "14",
|
|
3058
|
+
y: "3",
|
|
3059
|
+
width: "4",
|
|
3060
|
+
height: "14",
|
|
3061
|
+
rx: "1",
|
|
3062
|
+
fill: "currentColor",
|
|
3063
|
+
opacity: .3
|
|
3064
|
+
})
|
|
3065
|
+
]
|
|
3066
|
+
}), s && /* @__PURE__ */ N(r, {
|
|
3067
|
+
component: `${t.componentName}.topBar.columnVisibility.badge`,
|
|
3068
|
+
tag: "span",
|
|
3069
|
+
fontSize: 11,
|
|
3070
|
+
lineHeight: 16,
|
|
3071
|
+
fontWeight: 500,
|
|
3072
|
+
px: 2,
|
|
3073
|
+
py: .5,
|
|
3074
|
+
borderRadius: 1,
|
|
3075
|
+
bgColor: n ? "red-100" : "amber-100",
|
|
3076
|
+
color: n ? "red-700" : "amber-700",
|
|
3077
|
+
theme: { dark: {
|
|
3078
|
+
bgColor: n ? "red-900" : "amber-900",
|
|
3079
|
+
color: n ? "red-300" : "amber-300"
|
|
3080
|
+
} },
|
|
3081
|
+
children: [
|
|
3082
|
+
e.length,
|
|
3083
|
+
"/",
|
|
3084
|
+
o
|
|
3085
|
+
]
|
|
3086
|
+
})]
|
|
3087
|
+
});
|
|
3088
|
+
} }),
|
|
3089
|
+
/* @__PURE__ */ M(v.SelectAll, { children: "Show All" }),
|
|
3090
|
+
/* @__PURE__ */ M(v.Unselect, { children: "Hide All" }),
|
|
3091
|
+
i.map((e) => /* @__PURE__ */ M(v.Item, {
|
|
3092
|
+
value: e.id,
|
|
3093
|
+
textWrap: "nowrap",
|
|
3094
|
+
children: e.label
|
|
3095
|
+
}, e.id))
|
|
3096
|
+
]
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
at.displayName = "DataGridTopBarContextMenu";
|
|
3100
|
+
//#endregion
|
|
3101
|
+
//#region src/components/dataGrid/components/dataGridTopBar.tsx
|
|
3102
|
+
function ot(e) {
|
|
3103
|
+
let { grid: t } = e, { title: n, topBarContent: i, globalFilter: a } = t.props.def;
|
|
3104
|
+
return /* @__PURE__ */ N(f, {
|
|
3105
|
+
component: `${t.componentName}.topBar`,
|
|
3106
|
+
position: "relative",
|
|
3107
|
+
d: "column",
|
|
3108
|
+
gap: 3,
|
|
3109
|
+
children: [/* @__PURE__ */ N(f, {
|
|
3110
|
+
ai: "center",
|
|
3111
|
+
jc: "space-between",
|
|
3112
|
+
gap: 4,
|
|
3113
|
+
flexWrap: "wrap",
|
|
3114
|
+
width: "fit",
|
|
3115
|
+
children: [/* @__PURE__ */ N(f, {
|
|
3116
|
+
ai: "center",
|
|
3117
|
+
gap: 3,
|
|
3118
|
+
flexWrap: "wrap",
|
|
3119
|
+
minWidth: 0,
|
|
3120
|
+
children: [
|
|
3121
|
+
/* @__PURE__ */ M(at, { grid: t }),
|
|
3122
|
+
n && /* @__PURE__ */ M(r, {
|
|
3123
|
+
id: t.titleId,
|
|
3124
|
+
fontWeight: 600,
|
|
3125
|
+
fontSize: 16,
|
|
3126
|
+
color: "gray-800",
|
|
3127
|
+
theme: { dark: { color: "gray-100" } },
|
|
3128
|
+
children: n
|
|
3129
|
+
}),
|
|
3130
|
+
/* @__PURE__ */ M(nt, { grid: t })
|
|
3131
|
+
]
|
|
3132
|
+
}), a && /* @__PURE__ */ M(it, { grid: t })]
|
|
3133
|
+
}), i && /* @__PURE__ */ M(r, {
|
|
3134
|
+
width: "fit",
|
|
3135
|
+
children: i
|
|
3136
|
+
})]
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3139
|
+
ot.displayName = "DataGridTopBar";
|
|
3140
|
+
//#endregion
|
|
3141
|
+
//#region src/components/dataGrid/useGrid.ts
|
|
3142
|
+
function st(e) {
|
|
3143
|
+
let [t] = A(() => new Ee(e)), n = a("datagrid");
|
|
3144
|
+
return t.setProps(e), t.setIdentifier(n), ee(t.subscribe, t.getSnapshot, t.getSnapshot), t;
|
|
3145
|
+
}
|
|
3146
|
+
//#endregion
|
|
3147
|
+
//#region src/components/dataGrid.tsx
|
|
3148
|
+
function ct(e) {
|
|
3149
|
+
let t = st(e), n = k(null);
|
|
3150
|
+
return D(() => {
|
|
3151
|
+
let e = n.current;
|
|
3152
|
+
if (!e) return;
|
|
3153
|
+
t.setSizingElement(e);
|
|
3154
|
+
let r = new ResizeObserver((e) => {
|
|
3155
|
+
let n = e[0]?.contentRect.width ?? 0;
|
|
3156
|
+
t.setContainerWidth(n);
|
|
3157
|
+
});
|
|
3158
|
+
return r.observe(e), () => {
|
|
3159
|
+
r.disconnect(), t.setSizingElement(null);
|
|
3160
|
+
};
|
|
3161
|
+
}, [t]), /* @__PURE__ */ N(r, {
|
|
3162
|
+
ref: n,
|
|
3163
|
+
component: t.componentName,
|
|
3164
|
+
style: t.sizes.value,
|
|
3165
|
+
children: [
|
|
3166
|
+
t.props.def.topBar && /* @__PURE__ */ M(ot, { grid: t }),
|
|
3167
|
+
/* @__PURE__ */ M(tt, { grid: t }),
|
|
3168
|
+
t.props.def.bottomBar && /* @__PURE__ */ M(ae, { grid: t }),
|
|
3169
|
+
/* @__PURE__ */ M(y, {
|
|
3170
|
+
props: { role: "status" },
|
|
3171
|
+
children: t.selectionAnnouncement
|
|
3172
|
+
})
|
|
3173
|
+
]
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
ct.displayName = "DataGrid";
|
|
3177
|
+
//#endregion
|
|
3178
|
+
export { ct as default };
|