@box-kite/react 0.0.1 → 2.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 +65 -0
- package/.claude/skills/box-kite/SKILL.md +138 -0
- package/.claude/skills/box-kite/references/components.md +235 -0
- package/.claude/skills/box-kite/references/extending.md +42 -0
- package/.claude/skills/box-kite/references/patterns.md +27 -0
- package/.claude/skills/box-kite/references/styling.md +222 -0
- package/.cursor/rules/box-kite.mdc +73 -0
- package/AGENTS.md +102 -0
- package/BOX_AI_CONTEXT.md +2804 -0
- package/BOX_KITE_AI_CONTEXT.md +2804 -0
- package/LICENSE +21 -0
- package/README.md +744 -7
- package/a11y.cjs +1 -0
- package/a11y.d.ts +15 -0
- package/a11y.mjs +4 -0
- package/anchor.cjs +1 -0
- package/anchor.d.ts +14 -0
- package/anchor.mjs +3 -0
- package/behavior.cjs +1 -0
- package/behavior.mjs +277 -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 +164 -0
- package/components/accordion.cjs +1 -0
- package/components/accordion.d.ts +114 -0
- package/components/accordion.mjs +251 -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 +19 -0
- package/components/button.mjs +19 -0
- package/components/chart.cjs +1 -0
- package/components/chart.d.ts +83 -0
- package/components/chart.mjs +236 -0
- package/components/checkbox.cjs +1 -0
- package/components/checkbox.d.ts +36 -0
- package/components/checkbox.mjs +38 -0
- package/components/combobox/comboboxChips.d.ts +21 -0
- package/components/combobox/comboboxListbox.d.ts +47 -0
- package/components/combobox.cjs +1 -0
- package/components/combobox.d.ts +121 -0
- package/components/combobox.mjs +563 -0
- package/components/dataGrid/components/dataGridAggregateValue.d.ts +10 -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 +16 -0
- package/components/dataGrid/components/dataGridCellEditor.d.ts +15 -0
- package/components/dataGrid/components/dataGridCellPlaceholder.d.ts +14 -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/dataGridCellTree.d.ts +16 -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/dataGridDataSourceError.d.ts +12 -0
- package/components/dataGrid/components/dataGridDetailRow.d.ts +8 -0
- package/components/dataGrid/components/dataGridEmptyColumns.d.ts +6 -0
- package/components/dataGrid/components/dataGridExport.d.ts +10 -0
- package/components/dataGrid/components/dataGridFilterCell.d.ts +11 -0
- package/components/dataGrid/components/dataGridFilterRow.d.ts +6 -0
- package/components/dataGrid/components/dataGridFooter.d.ts +11 -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 +671 -0
- package/components/dataGrid/export/gridExport.d.ts +10 -0
- package/components/dataGrid/gridNavigationContext.d.ts +32 -0
- package/components/dataGrid/models/aggregateCellModel.d.ts +34 -0
- package/components/dataGrid/models/aggregationModel.d.ts +32 -0
- package/components/dataGrid/models/cellKeys.d.ts +11 -0
- package/components/dataGrid/models/cellModel.d.ts +44 -0
- package/components/dataGrid/models/columnModel.d.ts +160 -0
- package/components/dataGrid/models/columnVisibilityModel.d.ts +24 -0
- package/components/dataGrid/models/dataSourceModel.d.ts +177 -0
- package/components/dataGrid/models/detailRowModel.d.ts +22 -0
- package/components/dataGrid/models/editModel.d.ts +77 -0
- package/components/dataGrid/models/exportModel.d.ts +51 -0
- package/components/dataGrid/models/filterModel.d.ts +22 -0
- package/components/dataGrid/models/gridModel.d.ts +293 -0
- package/components/dataGrid/models/groupRowCellModel.d.ts +34 -0
- package/components/dataGrid/models/groupRowModel.d.ts +68 -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 +46 -0
- package/components/dataGrid/models/sourceGroupRowModel.d.ts +45 -0
- package/components/dataGrid/models/sourceLevel.d.ts +71 -0
- package/components/dataGrid/models/sourceRowModel.d.ts +29 -0
- package/components/dataGrid/models/sourceTreeRowModel.d.ts +23 -0
- package/components/dataGrid/models/treeModel.d.ts +94 -0
- package/components/dataGrid/models/treeRow.d.ts +22 -0
- package/components/dataGrid/models/treeRowModel.d.ts +50 -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 +4 -0
- package/components/dataGrid.mjs +4907 -0
- package/components/dialog.cjs +1 -0
- package/components/dialog.d.ts +151 -0
- package/components/dialog.mjs +223 -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 +77 -0
- package/components/dropdown.mjs +491 -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 +37 -0
- package/components/icon.mjs +41 -0
- package/components/menu.cjs +1 -0
- package/components/menu.d.ts +234 -0
- package/components/menu.mjs +422 -0
- package/components/overlay.cjs +1 -0
- package/components/overlay.d.ts +47 -0
- package/components/overlay.mjs +52 -0
- package/components/popover.cjs +1 -0
- package/components/popover.d.ts +100 -0
- package/components/popover.mjs +69 -0
- package/components/presence.cjs +1 -0
- package/components/presence.d.ts +36 -0
- package/components/presence.mjs +11 -0
- package/components/progress.cjs +1 -0
- package/components/progress.d.ts +47 -0
- package/components/progress.mjs +28 -0
- package/components/radioButton.cjs +1 -0
- package/components/radioButton.d.ts +32 -0
- package/components/radioButton.mjs +32 -0
- package/components/radioGroup.cjs +1 -0
- package/components/radioGroup.d.ts +51 -0
- package/components/radioGroup.mjs +83 -0
- package/components/select.cjs +1 -0
- package/components/select.d.ts +51 -0
- package/components/select.mjs +36 -0
- package/components/semantics.cjs +1 -0
- package/components/semantics.d.ts +39 -0
- package/components/semantics.mjs +17 -0
- package/components/slider.cjs +1 -0
- package/components/slider.d.ts +98 -0
- package/components/slider.mjs +250 -0
- package/components/svg.cjs +1 -0
- package/components/svg.d.ts +65 -0
- package/components/svg.mjs +141 -0
- package/components/switch.cjs +1 -0
- package/components/switch.d.ts +29 -0
- package/components/switch.mjs +25 -0
- package/components/tabs.cjs +1 -0
- package/components/tabs.d.ts +87 -0
- package/components/tabs.mjs +324 -0
- package/components/textarea.cjs +1 -0
- package/components/textarea.d.ts +41 -0
- package/components/textarea.mjs +33 -0
- package/components/textbox.cjs +1 -0
- package/components/textbox.d.ts +38 -0
- package/components/textbox.mjs +33 -0
- package/components/toaster.cjs +1 -0
- package/components/toaster.d.ts +106 -0
- package/components/toaster.mjs +295 -0
- package/components/tooltip.cjs +1 -0
- package/components/tooltip.d.ts +98 -0
- package/components/tooltip.mjs +110 -0
- package/components/visuallyHidden.cjs +1 -0
- package/components/visuallyHidden.d.ts +6 -0
- package/components/visuallyHidden.mjs +23 -0
- package/docs/a11y.md +199 -0
- package/docs/anchor.md +139 -0
- package/docs/components.md +48 -0
- package/docs/index.md +11 -0
- package/docs/props.md +1777 -0
- package/effects.cjs +1 -0
- package/effects.mjs +6 -0
- package/forms.cjs +1 -0
- package/forms.mjs +21 -0
- package/gridExport.cjs +2 -0
- package/gridExport.mjs +244 -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/identity.cjs +1 -0
- package/identity.mjs +12 -0
- package/keyboard.cjs +1 -0
- package/keyboard.mjs +30 -0
- package/layer.cjs +1 -0
- package/layer.mjs +127 -0
- package/motion.cjs +1 -0
- package/motion.mjs +66 -0
- package/package.json +327 -7
- package/placement.cjs +1 -0
- package/placement.mjs +180 -0
- package/platform.cjs +1 -0
- package/platform.mjs +45 -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/useRovingFocus.d.ts +84 -0
- package/react/anchor/useAnchorPosition.d.ts +79 -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/dialog/useScrollLock.d.ts +12 -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 +6 -0
- package/react/hooks/useVirtualization.d.ts +32 -0
- package/react/hooks/useVisibility.d.ts +9 -0
- package/react/identity/useIdentifier.d.ts +17 -0
- package/react/popover/usePopoverLayer.d.ts +87 -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 +122 -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/accordion/accordionUtils.d.ts +48 -0
- package/utils/anchor/anchorUtils.d.ts +79 -0
- package/utils/animation/animationUtils.d.ts +29 -0
- package/utils/array/arrayUtils.d.ts +15 -0
- package/utils/array/lazyList.d.ts +10 -0
- package/utils/box/boxUtils.d.ts +5 -0
- package/utils/chart/chartPalette.d.ts +15 -0
- package/utils/chart/chartUtils.d.ts +92 -0
- package/utils/combobox/comboboxUtils.d.ts +89 -0
- package/utils/dom/domUtils.d.ts +32 -0
- package/utils/environment/environmentUtils.d.ts +28 -0
- package/utils/export/csvUtils.d.ts +23 -0
- package/utils/export/downloadUtils.d.ts +12 -0
- package/utils/export/xlsxUtils.d.ts +56 -0
- package/utils/export/zipUtils.d.ts +26 -0
- package/utils/fn/fnUtils.d.ts +4 -0
- package/utils/form/formUtils.d.ts +8 -0
- package/utils/keyboard/typeaheadUtils.d.ts +31 -0
- package/utils/memo.d.ts +10 -0
- package/utils/menu/menuUtils.d.ts +25 -0
- package/utils/object/objectUtils.d.ts +13 -0
- package/utils/slider/sliderUtils.d.ts +67 -0
- package/utils/string/fuzzySearch.d.ts +27 -0
- package/utils/string/stringUtils.d.ts +4 -0
- package/utils/tabs/tabsUtils.d.ts +75 -0
- package/utils/toast/toastStore.d.ts +73 -0
- package/utils/virtual/virtualUtils.d.ts +47 -0
|
@@ -0,0 +1,4907 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { o as e, u as t } from "../platform.mjs";
|
|
3
|
+
import { n } from "../effects.mjs";
|
|
4
|
+
import r from "../box.mjs";
|
|
5
|
+
import { n as i, r as a, t as o } from "../behavior.mjs";
|
|
6
|
+
import { t as s } from "../identity.mjs";
|
|
7
|
+
import { Path as c, Svg as l } from "./svg.mjs";
|
|
8
|
+
import u from "./baseSvg.mjs";
|
|
9
|
+
import d from "./button.mjs";
|
|
10
|
+
import f from "./flex.mjs";
|
|
11
|
+
import p from "./checkbox.mjs";
|
|
12
|
+
import m from "./overlay.mjs";
|
|
13
|
+
import h from "./presence.mjs";
|
|
14
|
+
import g from "./textbox.mjs";
|
|
15
|
+
import _ from "./grid.mjs";
|
|
16
|
+
import v from "./dropdown.mjs";
|
|
17
|
+
import y from "./visuallyHidden.mjs";
|
|
18
|
+
import { Span as b } from "./semantics.mjs";
|
|
19
|
+
import x, { Fragment as S, createContext as C, forwardRef as w, useCallback as T, useContext as E, useEffect as D, useImperativeHandle as ee, useLayoutEffect as O, useMemo as te, useRef as k, useState as A } from "react";
|
|
20
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
21
|
+
import { useSyncExternalStore as P } from "use-sync-external-store/shim";
|
|
22
|
+
//#region src/components/dataGrid/components/dataGridPagination.tsx
|
|
23
|
+
function F(e) {
|
|
24
|
+
let { grid: t } = e, { pagination: n } = t, i = n.state, a = T(() => n.firstPage(), [n]), o = T(() => n.prevPage(), [n]), s = T(() => n.nextPage(), [n]), c = T(() => n.lastPage(), [n]);
|
|
25
|
+
if (!i) return null;
|
|
26
|
+
let { canGoPrev: l, canGoNext: u, totalPages: d } = n;
|
|
27
|
+
return /* @__PURE__ */ N(f, {
|
|
28
|
+
component: `${t.componentName}.bottomBar.pagination`,
|
|
29
|
+
gap: .5,
|
|
30
|
+
ai: "center",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ M(ne, {
|
|
33
|
+
grid: t,
|
|
34
|
+
pageSize: i.pageSize
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ M(I, {
|
|
37
|
+
componentName: t.componentName,
|
|
38
|
+
label: "First page",
|
|
39
|
+
onClick: a,
|
|
40
|
+
disabled: !l,
|
|
41
|
+
children: /* @__PURE__ */ M(oe, {})
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ M(I, {
|
|
44
|
+
componentName: t.componentName,
|
|
45
|
+
label: "Previous page",
|
|
46
|
+
onClick: o,
|
|
47
|
+
disabled: !l,
|
|
48
|
+
children: /* @__PURE__ */ M(ie, {})
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ N(f, {
|
|
51
|
+
ai: "center",
|
|
52
|
+
gap: 1.5,
|
|
53
|
+
px: 2,
|
|
54
|
+
userSelect: "none",
|
|
55
|
+
children: [/* @__PURE__ */ M(re, {
|
|
56
|
+
grid: t,
|
|
57
|
+
page: i.page,
|
|
58
|
+
totalPages: d
|
|
59
|
+
}), /* @__PURE__ */ N(r, {
|
|
60
|
+
component: `${t.componentName}.bottomBar.pagination.info`,
|
|
61
|
+
fontSize: 12,
|
|
62
|
+
opacity: .7,
|
|
63
|
+
children: ["of ", d]
|
|
64
|
+
})]
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ M(I, {
|
|
67
|
+
componentName: t.componentName,
|
|
68
|
+
label: "Next page",
|
|
69
|
+
onClick: s,
|
|
70
|
+
disabled: !u,
|
|
71
|
+
children: /* @__PURE__ */ M(ae, {})
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ M(I, {
|
|
74
|
+
componentName: t.componentName,
|
|
75
|
+
label: "Last page",
|
|
76
|
+
onClick: c,
|
|
77
|
+
disabled: !u,
|
|
78
|
+
children: /* @__PURE__ */ M(se, {})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
F.displayName = "DataGridPagination";
|
|
84
|
+
function ne({ grid: e, pageSize: t }) {
|
|
85
|
+
let n = e.pagination.pageSizeOptions;
|
|
86
|
+
return !n || n.length === 0 ? null : /* @__PURE__ */ M(f, {
|
|
87
|
+
ai: "center",
|
|
88
|
+
gap: 1,
|
|
89
|
+
me: 1,
|
|
90
|
+
children: /* @__PURE__ */ M(r, {
|
|
91
|
+
component: `${e.componentName}.bottomBar.pagination.pageSize`,
|
|
92
|
+
tag: "select",
|
|
93
|
+
fontSize: 12,
|
|
94
|
+
borderRadius: 4,
|
|
95
|
+
cursor: "pointer",
|
|
96
|
+
props: {
|
|
97
|
+
"aria-label": "Rows per page",
|
|
98
|
+
value: t,
|
|
99
|
+
onChange: (t) => e.pagination.changePageSize(Number(t.target.value))
|
|
100
|
+
},
|
|
101
|
+
children: n.map((e) => /* @__PURE__ */ N("option", {
|
|
102
|
+
value: e,
|
|
103
|
+
children: [e, " / page"]
|
|
104
|
+
}, e))
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function re({ grid: e, page: t, totalPages: n }) {
|
|
109
|
+
let [r, i] = A(String(t)), [a, o] = A(t);
|
|
110
|
+
t !== a && (o(t), i(String(t)));
|
|
111
|
+
let s = T(() => {
|
|
112
|
+
e.pagination.jumpToPage(r), i(String(e.pagination.page));
|
|
113
|
+
}, [e, r]), c = T((e) => {
|
|
114
|
+
e.key === "Enter" ? s() : e.key === "Escape" && i(String(t));
|
|
115
|
+
}, [s, t]);
|
|
116
|
+
return /* @__PURE__ */ M(g, {
|
|
117
|
+
type: "number",
|
|
118
|
+
variant: "compact",
|
|
119
|
+
value: r,
|
|
120
|
+
onChange: (e) => i(e.target.value),
|
|
121
|
+
textAlign: "center",
|
|
122
|
+
fontSize: 12,
|
|
123
|
+
props: {
|
|
124
|
+
"aria-label": "Page number",
|
|
125
|
+
onKeyDown: c,
|
|
126
|
+
onBlur: s,
|
|
127
|
+
min: 1,
|
|
128
|
+
max: n
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function I(e) {
|
|
133
|
+
let { componentName: t, label: n, onClick: r, disabled: i, children: a } = e;
|
|
134
|
+
return /* @__PURE__ */ M(d, {
|
|
135
|
+
component: `${t}.bottomBar.pagination.button`,
|
|
136
|
+
props: {
|
|
137
|
+
"aria-label": n,
|
|
138
|
+
"aria-disabled": i || void 0
|
|
139
|
+
},
|
|
140
|
+
onClick: r,
|
|
141
|
+
cursor: i ? "default" : "pointer",
|
|
142
|
+
p: 1,
|
|
143
|
+
borderRadius: 4,
|
|
144
|
+
opacity: i ? .3 : .7,
|
|
145
|
+
hover: i ? void 0 : {
|
|
146
|
+
opacity: 1,
|
|
147
|
+
bgColor: "gray-100"
|
|
148
|
+
},
|
|
149
|
+
theme: { dark: { hover: i ? void 0 : { bgColor: "gray-700" } } },
|
|
150
|
+
transitionDuration: 150,
|
|
151
|
+
children: a
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function L(e) {
|
|
155
|
+
return /* @__PURE__ */ M(l, {
|
|
156
|
+
viewBox: "0 0 24 24",
|
|
157
|
+
width: "14",
|
|
158
|
+
height: "14",
|
|
159
|
+
fill: "none",
|
|
160
|
+
stroke: "currentColor",
|
|
161
|
+
strokeWidth: 2,
|
|
162
|
+
strokeLinecap: "round",
|
|
163
|
+
strokeLinejoin: "round",
|
|
164
|
+
children: /* @__PURE__ */ M(c, { d: e.d })
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function ie() {
|
|
168
|
+
return /* @__PURE__ */ M(L, { d: "M15 18l-6-6 6-6" });
|
|
169
|
+
}
|
|
170
|
+
function ae() {
|
|
171
|
+
return /* @__PURE__ */ M(L, { d: "M9 18l6-6-6-6" });
|
|
172
|
+
}
|
|
173
|
+
function oe() {
|
|
174
|
+
return /* @__PURE__ */ M(L, { d: "M18 18l-6-6 6-6M11 18l-6-6 6-6" });
|
|
175
|
+
}
|
|
176
|
+
function se() {
|
|
177
|
+
return /* @__PURE__ */ M(L, { d: "M6 18l6-6-6-6M13 18l6-6-6-6" });
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/components/dataGrid/components/dataGridBottomBar.tsx
|
|
181
|
+
function ce(e) {
|
|
182
|
+
let { grid: t } = e, { pagination: n, filter: i } = t;
|
|
183
|
+
if (n.state) {
|
|
184
|
+
let { totalItems: e, startItem: i, endItem: a } = n;
|
|
185
|
+
return /* @__PURE__ */ N(f, {
|
|
186
|
+
component: `${t.componentName}.bottomBar`,
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ N(r, {
|
|
189
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
190
|
+
children: ["Rows: ", e > 0 ? `${i}–${a} of ${e}` : "0"]
|
|
191
|
+
}),
|
|
192
|
+
t.props.def.rowSelection && /* @__PURE__ */ N(r, {
|
|
193
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
194
|
+
children: ["Selected: ", t.selectedRows.size]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ M(F, { grid: t })
|
|
197
|
+
]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
let { filtered: a, total: o } = i.filterStats;
|
|
201
|
+
return /* @__PURE__ */ N(f, {
|
|
202
|
+
component: `${t.componentName}.bottomBar`,
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ N(r, {
|
|
205
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
206
|
+
children: ["Rows: ", a === o ? o : `${a} / ${o}`]
|
|
207
|
+
}),
|
|
208
|
+
t.props.def.rowSelection && /* @__PURE__ */ N(r, {
|
|
209
|
+
component: `${t.componentName}.bottomBar.info`,
|
|
210
|
+
children: ["Selected: ", t.selectedRows.size]
|
|
211
|
+
}),
|
|
212
|
+
i.hasActiveFilters && /* @__PURE__ */ M(r, {
|
|
213
|
+
component: `${t.componentName}.bottomBar.clearFilters`,
|
|
214
|
+
color: "blue-600",
|
|
215
|
+
cursor: "pointer",
|
|
216
|
+
hover: { textDecoration: "underline" },
|
|
217
|
+
props: { onClick: i.clearAllFilters },
|
|
218
|
+
children: "Clear filters"
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/components/dataGrid/gridNavigationContext.ts
|
|
225
|
+
var le = C(null);
|
|
226
|
+
function R() {
|
|
227
|
+
return E(le);
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/components/dataGrid/models/editModel.ts
|
|
231
|
+
var ue = "Invalid value";
|
|
232
|
+
function de(e, t) {
|
|
233
|
+
return JSON.stringify([e, t]);
|
|
234
|
+
}
|
|
235
|
+
var fe = 1e3;
|
|
236
|
+
function pe(e) {
|
|
237
|
+
return typeof e == "number" ? "number" : typeof e == "boolean" ? "checkbox" : "text";
|
|
238
|
+
}
|
|
239
|
+
function me(e, t) {
|
|
240
|
+
if (e === "text") return t;
|
|
241
|
+
if (e !== "number" || t.trim() === "") return;
|
|
242
|
+
let n = Number(t);
|
|
243
|
+
return Number.isFinite(n) ? n : void 0;
|
|
244
|
+
}
|
|
245
|
+
function he(e) {
|
|
246
|
+
return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
247
|
+
}
|
|
248
|
+
var ge = class {
|
|
249
|
+
grid;
|
|
250
|
+
constructor(e) {
|
|
251
|
+
this.grid = e;
|
|
252
|
+
}
|
|
253
|
+
values = /* @__PURE__ */ new Map();
|
|
254
|
+
_edits = [];
|
|
255
|
+
_active;
|
|
256
|
+
_token = 0;
|
|
257
|
+
get enabled() {
|
|
258
|
+
let { def: e } = this.grid.props;
|
|
259
|
+
return e.editable === !0 || e.columns.some((e) => e.editable !== void 0 && e.editable !== !1);
|
|
260
|
+
}
|
|
261
|
+
isEditable(e, t) {
|
|
262
|
+
if (e.placeholder || !t.isData) return !1;
|
|
263
|
+
let n = t.editable;
|
|
264
|
+
return typeof n == "function" ? !!n(e.data) : n;
|
|
265
|
+
}
|
|
266
|
+
editorFor(e, t) {
|
|
267
|
+
let { editor: n } = e.def;
|
|
268
|
+
return typeof n == "object" ? n : n ? { type: n } : { type: pe(t) };
|
|
269
|
+
}
|
|
270
|
+
isEditing(e, t) {
|
|
271
|
+
return this._active?.rowKey === e && this._active.columnKey === t;
|
|
272
|
+
}
|
|
273
|
+
get draft() {
|
|
274
|
+
return this._active?.draft;
|
|
275
|
+
}
|
|
276
|
+
get error() {
|
|
277
|
+
return this._active?.error;
|
|
278
|
+
}
|
|
279
|
+
get pending() {
|
|
280
|
+
return !!this._active?.pending;
|
|
281
|
+
}
|
|
282
|
+
begin(e, t, n, r) {
|
|
283
|
+
let i = r === void 0 ? void 0 : me(this.editorFor(t, n).type, r);
|
|
284
|
+
this._active = {
|
|
285
|
+
row: e,
|
|
286
|
+
rowKey: e.key,
|
|
287
|
+
columnKey: t.key,
|
|
288
|
+
draft: i ?? n,
|
|
289
|
+
token: ++this._token,
|
|
290
|
+
pending: !1
|
|
291
|
+
}, this.grid.notify();
|
|
292
|
+
}
|
|
293
|
+
beginAt(e, t, n) {
|
|
294
|
+
let r = this.grid.flatRows.value[e], i = this.grid.columns.value.visibleLeafs[t];
|
|
295
|
+
if (!i || !r || r.kind !== "row" || !this.isEditable(r, i)) return !1;
|
|
296
|
+
let a = r.data[i.key];
|
|
297
|
+
return this.begin(r, i, this.valueOf(r.key, i.key, a), n), !0;
|
|
298
|
+
}
|
|
299
|
+
setDraft(e) {
|
|
300
|
+
this._active && (this._active = {
|
|
301
|
+
...this._active,
|
|
302
|
+
draft: e,
|
|
303
|
+
error: void 0
|
|
304
|
+
}, this.grid.notify());
|
|
305
|
+
}
|
|
306
|
+
cancel() {
|
|
307
|
+
this._active && (this._token++, this._active = void 0, this.grid.notify());
|
|
308
|
+
}
|
|
309
|
+
commit() {
|
|
310
|
+
let e = this._active;
|
|
311
|
+
if (!e || e.pending) return;
|
|
312
|
+
let { row: t, rowKey: n, columnKey: r, draft: i } = e, a = this.valueOf(n, r, t.data[r]);
|
|
313
|
+
if (Object.is(i, a)) {
|
|
314
|
+
this.cancel();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
let o = {
|
|
318
|
+
rowKey: n,
|
|
319
|
+
columnKey: r,
|
|
320
|
+
row: t.data,
|
|
321
|
+
value: i,
|
|
322
|
+
oldValue: a
|
|
323
|
+
}, s = this.grid.props.def.onCellEdit?.(o);
|
|
324
|
+
if (s instanceof Promise) {
|
|
325
|
+
this._active = {
|
|
326
|
+
...e,
|
|
327
|
+
pending: !0
|
|
328
|
+
}, this.grid.notify(), s.then((t) => this.settle(e.token, o, t), (t) => this.settle(e.token, o, t instanceof Error ? t.message : ue));
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.settle(e.token, o, s);
|
|
332
|
+
}
|
|
333
|
+
settle(e, t, n) {
|
|
334
|
+
if (!(!this._active || this._active.token !== e)) {
|
|
335
|
+
if (typeof n == "string" || n === !1) {
|
|
336
|
+
this._active = {
|
|
337
|
+
...this._active,
|
|
338
|
+
pending: !1,
|
|
339
|
+
error: typeof n == "string" ? n : ue
|
|
340
|
+
}, this.grid.notify();
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
this.values.set(de(t.rowKey, t.columnKey), t.value), this._edits = [...this._edits, t], this._active = void 0, this.grid.notify(), this.grid.props.onCellEditsChange?.(this._edits, { reason: "edit" });
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
valueOf(e, t, n) {
|
|
347
|
+
if (this.values.size === 0) return n;
|
|
348
|
+
let r = de(e, t);
|
|
349
|
+
return this.values.has(r) ? this.values.get(r) : n;
|
|
350
|
+
}
|
|
351
|
+
get edits() {
|
|
352
|
+
return this._edits;
|
|
353
|
+
}
|
|
354
|
+
clearEdits = () => {
|
|
355
|
+
(this.values.size !== 0 || this._edits.length !== 0) && (this.values.clear(), this._edits = [], this.grid.notify(), this.grid.props.onCellEditsChange?.(this._edits, { reason: "clear" }));
|
|
356
|
+
};
|
|
357
|
+
nextEditable(e, t, n = !1) {
|
|
358
|
+
let r = this.grid.flatRows.value, i = this.grid.columns.value.visibleLeafs, a = n ? -1 : 1, o = e * i.length + t + a, s = Math.min(r.length * i.length - 1, o + fe);
|
|
359
|
+
for (let e = o; e >= Math.max(0, o - fe) && e <= s; e += a) {
|
|
360
|
+
let t = Math.floor(e / i.length), n = e % i.length, a = r[t], o = i[n];
|
|
361
|
+
if (!(!o || a?.kind !== "row" || !this.isEditable(a, o))) return {
|
|
362
|
+
row: t,
|
|
363
|
+
column: n
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, z = Symbol("memo.unset"), _e = class {
|
|
368
|
+
action;
|
|
369
|
+
deps;
|
|
370
|
+
cache = z;
|
|
371
|
+
dependents = /* @__PURE__ */ new Set();
|
|
372
|
+
wired = !1;
|
|
373
|
+
constructor(e, t) {
|
|
374
|
+
this.action = e, this.deps = t;
|
|
375
|
+
}
|
|
376
|
+
wire() {
|
|
377
|
+
if (!this.wired) {
|
|
378
|
+
this.wired = !0;
|
|
379
|
+
for (let e of this.deps()) e.dependents.add(this);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
get value() {
|
|
383
|
+
return this.wire(), this.cache === z && (this.cache = this.action()), this.cache;
|
|
384
|
+
}
|
|
385
|
+
clear() {
|
|
386
|
+
if (this.wire(), this.cache !== z) {
|
|
387
|
+
this.cache = z;
|
|
388
|
+
for (let e of this.dependents) e.clear();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
function B(e, t = () => []) {
|
|
393
|
+
return new _e(e, t);
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/components/dataGrid/models/cellModel.ts
|
|
397
|
+
var ve = class {
|
|
398
|
+
grid;
|
|
399
|
+
row;
|
|
400
|
+
column;
|
|
401
|
+
constructor(e, t, n) {
|
|
402
|
+
this.grid = e, this.row = t, this.column = n;
|
|
403
|
+
}
|
|
404
|
+
get value() {
|
|
405
|
+
if (this.column.isRowNumber) return this.row.rowIndex + 1;
|
|
406
|
+
let e = this.row.data[this.column.key];
|
|
407
|
+
return this.grid.edits.valueOf(this.row.key, this.column.key, e);
|
|
408
|
+
}
|
|
409
|
+
get isExpanded() {
|
|
410
|
+
return this.row.expanded;
|
|
411
|
+
}
|
|
412
|
+
get selected() {
|
|
413
|
+
return this.row.selected;
|
|
414
|
+
}
|
|
415
|
+
get isFirst() {
|
|
416
|
+
return this.row.cells[0] === this;
|
|
417
|
+
}
|
|
418
|
+
get isLast() {
|
|
419
|
+
let e = this.row.cells;
|
|
420
|
+
return e[e.length - 1] === this;
|
|
421
|
+
}
|
|
422
|
+
toggleDetail = () => {
|
|
423
|
+
this.grid.toggleDetailRow(this.row.key);
|
|
424
|
+
};
|
|
425
|
+
get indeterminate() {
|
|
426
|
+
return this.row.indeterminate;
|
|
427
|
+
}
|
|
428
|
+
toggleSelection = () => {
|
|
429
|
+
this.row.toggleSelection();
|
|
430
|
+
};
|
|
431
|
+
get editable() {
|
|
432
|
+
return this.grid.edits.isEditable(this.row, this.column);
|
|
433
|
+
}
|
|
434
|
+
get editing() {
|
|
435
|
+
return this.grid.edits.isEditing(this.row.key, this.column.key);
|
|
436
|
+
}
|
|
437
|
+
get editor() {
|
|
438
|
+
return this.grid.edits.editorFor(this.column, this.value);
|
|
439
|
+
}
|
|
440
|
+
get draft() {
|
|
441
|
+
return this.grid.edits.draft;
|
|
442
|
+
}
|
|
443
|
+
get error() {
|
|
444
|
+
return this.grid.edits.error;
|
|
445
|
+
}
|
|
446
|
+
get pending() {
|
|
447
|
+
return this.grid.edits.pending;
|
|
448
|
+
}
|
|
449
|
+
beginEdit = (e) => {
|
|
450
|
+
this.editable && this.grid.edits.begin(this.row, this.column, this.value, e);
|
|
451
|
+
};
|
|
452
|
+
setDraft = (e) => {
|
|
453
|
+
this.grid.edits.setDraft(e);
|
|
454
|
+
};
|
|
455
|
+
commitEdit = () => {
|
|
456
|
+
this.grid.edits.commit();
|
|
457
|
+
};
|
|
458
|
+
cancelEdit = () => {
|
|
459
|
+
this.grid.edits.cancel();
|
|
460
|
+
};
|
|
461
|
+
}, V = class e {
|
|
462
|
+
grid;
|
|
463
|
+
parentRow;
|
|
464
|
+
constructor(e, t) {
|
|
465
|
+
this.grid = e, this.parentRow = t;
|
|
466
|
+
}
|
|
467
|
+
kind = "detail";
|
|
468
|
+
get key() {
|
|
469
|
+
return `detail-${this.parentRow.key}`;
|
|
470
|
+
}
|
|
471
|
+
get isAutoHeight() {
|
|
472
|
+
return this.height === "auto";
|
|
473
|
+
}
|
|
474
|
+
static AUTO_HEIGHT_ESTIMATE = 200;
|
|
475
|
+
get height() {
|
|
476
|
+
let e = this.grid.props.def.rowDetail;
|
|
477
|
+
return !e || e.height === void 0 || e.height === "auto" ? "auto" : typeof e.height == "function" ? e.height(this.parentRow.data) : e.height;
|
|
478
|
+
}
|
|
479
|
+
get heightForOffset() {
|
|
480
|
+
let t = this.height;
|
|
481
|
+
return t === "auto" ? e.AUTO_HEIGHT_ESTIMATE : t;
|
|
482
|
+
}
|
|
483
|
+
count = 0;
|
|
484
|
+
cellCount = 1;
|
|
485
|
+
columnOf() {
|
|
486
|
+
return 0;
|
|
487
|
+
}
|
|
488
|
+
get flatRows() {
|
|
489
|
+
return [this];
|
|
490
|
+
}
|
|
491
|
+
get allRows() {
|
|
492
|
+
return [];
|
|
493
|
+
}
|
|
494
|
+
}, H = class {
|
|
495
|
+
grid;
|
|
496
|
+
rowIndex;
|
|
497
|
+
constructor(e, t, n) {
|
|
498
|
+
this.grid = e, this.rowIndex = n, this._data = t;
|
|
499
|
+
}
|
|
500
|
+
_data;
|
|
501
|
+
get data() {
|
|
502
|
+
return this._data;
|
|
503
|
+
}
|
|
504
|
+
_key;
|
|
505
|
+
get key() {
|
|
506
|
+
return this._key ??= this.grid.getRowKey(this.data);
|
|
507
|
+
}
|
|
508
|
+
parentRow;
|
|
509
|
+
count = 1;
|
|
510
|
+
kind = "row";
|
|
511
|
+
get placeholder() {
|
|
512
|
+
return !1;
|
|
513
|
+
}
|
|
514
|
+
get expandOnRowClick() {
|
|
515
|
+
return this.grid.props.def.rowDetail?.expandOnRowClick ?? !1;
|
|
516
|
+
}
|
|
517
|
+
toggleDetail = () => {
|
|
518
|
+
this.grid.toggleDetailRow(this.key);
|
|
519
|
+
};
|
|
520
|
+
_cells = B(() => this.grid.columns.value.visibleLeafs.map((e) => new ve(this.grid, this, e)));
|
|
521
|
+
get cells() {
|
|
522
|
+
return this._cells.value;
|
|
523
|
+
}
|
|
524
|
+
get cellCount() {
|
|
525
|
+
return this.cells.length;
|
|
526
|
+
}
|
|
527
|
+
columnOf(e) {
|
|
528
|
+
return e;
|
|
529
|
+
}
|
|
530
|
+
get selected() {
|
|
531
|
+
return this.grid.selectedRows.has(this.key);
|
|
532
|
+
}
|
|
533
|
+
get indeterminate() {
|
|
534
|
+
return !1;
|
|
535
|
+
}
|
|
536
|
+
toggleSelection = () => {
|
|
537
|
+
this.grid.toggleRowSelection(this.key);
|
|
538
|
+
};
|
|
539
|
+
get expanded() {
|
|
540
|
+
return this.grid.expandedDetailRows.has(this.key);
|
|
541
|
+
}
|
|
542
|
+
get flatRows() {
|
|
543
|
+
return this.grid.props.def.rowDetail && this.expanded ? [this, new V(this.grid, this)] : [this];
|
|
544
|
+
}
|
|
545
|
+
get allRows() {
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/components/dataGrid/models/treeRow.ts
|
|
551
|
+
function U(e) {
|
|
552
|
+
return !!e && e.isTreeRow === !0;
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/components/dataGrid/useGridNavigation.ts
|
|
556
|
+
var ye = "[role=\"gridcell\"],[role=\"columnheader\"]", be = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]", xe = 2, Se = [];
|
|
557
|
+
function Ce(e) {
|
|
558
|
+
let { grid: t, scrollerRef: r, scrollTop: i, onScrollTo: a } = e, s = t.headerRows.value, c = t.filter.hasFilterableColumns, l = s.length + +!!c, u = t.viewport.isEmpty ? Se : t.flatRows.value, d = t.columns.value.visibleLeafs.length, f = t.aggregation.hasFooter && !t.viewport.isEmpty ? 1 : 0, p = l + u.length + f, m = T((e) => {
|
|
559
|
+
if (e < s.length) return s[e]?.length ?? 0;
|
|
560
|
+
if (e < l || e >= l + u.length) return d;
|
|
561
|
+
let t = u[e - l];
|
|
562
|
+
return t ? t.cellCount : 0;
|
|
563
|
+
}, [
|
|
564
|
+
u,
|
|
565
|
+
d,
|
|
566
|
+
l,
|
|
567
|
+
s
|
|
568
|
+
]), h = T((e, t) => e < s.length ? (s[e]?.[t]?.headerCell.columnIndex ?? t + 1) - 1 : e < l ? t : u[e - l]?.columnOf(t) ?? t, [
|
|
569
|
+
u,
|
|
570
|
+
l,
|
|
571
|
+
s
|
|
572
|
+
]), g = k(!1), _ = T((e, n) => {
|
|
573
|
+
let { viewport: o } = t, s = e - l, c = r.current;
|
|
574
|
+
if (o.showAll || !c || s >= u.length) return;
|
|
575
|
+
if (s < 0) {
|
|
576
|
+
n >= l && (c.scrollTop = 0, a(0));
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
let { startIndex: d, take: f } = o.window(i);
|
|
580
|
+
if (s >= d + xe && s < d + f - xe) return;
|
|
581
|
+
let p = o.rowTop(s);
|
|
582
|
+
c.scrollTop = p, a(p);
|
|
583
|
+
}, [
|
|
584
|
+
u.length,
|
|
585
|
+
t,
|
|
586
|
+
l,
|
|
587
|
+
a,
|
|
588
|
+
i,
|
|
589
|
+
r
|
|
590
|
+
]), v = k(0), y = o({
|
|
591
|
+
count: p,
|
|
592
|
+
columns: m,
|
|
593
|
+
columnIndexOf: h,
|
|
594
|
+
pageSize: t.viewport.pageRows,
|
|
595
|
+
onActiveCellChange: (e, t) => {
|
|
596
|
+
let n = v.current;
|
|
597
|
+
v.current = e.row, t.reason === "keyboard" && (_(e.row, n), g.current = !0);
|
|
598
|
+
}
|
|
599
|
+
}), b = y.activeItem;
|
|
600
|
+
n(() => {
|
|
601
|
+
g.current && (g.current = !1, b()?.focus());
|
|
602
|
+
});
|
|
603
|
+
let x = T((e, n, r) => {
|
|
604
|
+
if (!t.tree.enabled || e.key !== "ArrowRight" && e.key !== "ArrowLeft") return !1;
|
|
605
|
+
let i = u[n - l];
|
|
606
|
+
if (!U(i) || t.columns.value.visibleLeafs[r]?.key !== t.tree.columnKey) return !1;
|
|
607
|
+
if (e.key === (t.isRtl ? "ArrowLeft" : "ArrowRight")) return !i.hasChildren || i.treeExpanded ? !1 : (i.toggleTree(), !0);
|
|
608
|
+
if (i.hasChildren && i.treeExpanded) return i.toggleTree(), !0;
|
|
609
|
+
for (let e = n - 1; e >= l; e--) {
|
|
610
|
+
let t = u[e - l];
|
|
611
|
+
if (!(!U(t) || t.level >= i.level)) return y.setActiveCell(e, r, { reason: "keyboard" }), !0;
|
|
612
|
+
}
|
|
613
|
+
return !1;
|
|
614
|
+
}, [
|
|
615
|
+
u,
|
|
616
|
+
t,
|
|
617
|
+
l,
|
|
618
|
+
y
|
|
619
|
+
]), S = T((e) => {
|
|
620
|
+
let { activeIndex: t, activeColumn: n } = y, r = e ? -1 : 1, i = n + r;
|
|
621
|
+
if (i >= 0 && i < m(t)) return y.setActiveCell(t, i, { reason: "keyboard" }), !0;
|
|
622
|
+
let a = t + r;
|
|
623
|
+
return a < 0 || a >= p ? !1 : (y.setActiveCell(a, e ? Math.max(0, m(a) - 1) : 0, { reason: "keyboard" }), !0);
|
|
624
|
+
}, [
|
|
625
|
+
m,
|
|
626
|
+
y,
|
|
627
|
+
p
|
|
628
|
+
]), C = T((e, n) => {
|
|
629
|
+
if (!t.props.def.rowSelection) return !1;
|
|
630
|
+
if (e < l) return e >= s.length || !t.columns.value.visibleLeafs[n]?.isRowSelection ? !1 : (t.toggleSelectAllRows(), !0);
|
|
631
|
+
let r = t.flatRows.value[e - l];
|
|
632
|
+
return r instanceof H && (r.toggleSelection(), !0);
|
|
633
|
+
}, [
|
|
634
|
+
t,
|
|
635
|
+
l,
|
|
636
|
+
s.length
|
|
637
|
+
]), w = T((e, t, n) => {
|
|
638
|
+
let r = Array.from(e.querySelectorAll(be));
|
|
639
|
+
if (r.length < 2) return !1;
|
|
640
|
+
let i = r.indexOf(t);
|
|
641
|
+
return i !== -1 && (r[(i + (n ? -1 : 1) + r.length) % r.length].focus(), !0);
|
|
642
|
+
}, []), E = y.onKeyDown, D = T((e) => {
|
|
643
|
+
let n = e.target, r = n.closest?.(ye);
|
|
644
|
+
if (r) {
|
|
645
|
+
if (n !== r) {
|
|
646
|
+
if (e.key === "Escape" && !r.querySelector("[aria-expanded=\"true\"]")) {
|
|
647
|
+
e.preventDefault(), r.focus();
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
e.key === "Tab" && w(r, n, e.shiftKey) && e.preventDefault();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (e.key === "Tab" && t.props.def.tabNavigation === "cells") {
|
|
654
|
+
S(e.shiftKey) && e.preventDefault();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (e.key === " " && C(y.activeIndex, y.activeColumn)) {
|
|
658
|
+
e.preventDefault();
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if (e.key === "Enter" || e.key === " " || e.key === "F2") {
|
|
662
|
+
let n = s[y.activeIndex]?.[y.activeColumn];
|
|
663
|
+
if (e.key !== "F2" && n?.headerCell.isSortable) {
|
|
664
|
+
e.preventDefault(), n.sortColumn();
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (t.edits.beginAt(y.activeIndex - l, y.activeColumn)) {
|
|
668
|
+
e.preventDefault();
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
let i = r.querySelector(be);
|
|
672
|
+
if (i) {
|
|
673
|
+
e.preventDefault(), i.focus();
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (t.edits.enabled && he(e) && t.edits.beginAt(y.activeIndex - l, y.activeColumn, e.key)) {
|
|
678
|
+
e.preventDefault();
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (x(e, y.activeIndex, y.activeColumn)) {
|
|
682
|
+
e.preventDefault();
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
E(e);
|
|
686
|
+
}
|
|
687
|
+
}, [
|
|
688
|
+
t,
|
|
689
|
+
l,
|
|
690
|
+
s,
|
|
691
|
+
y.activeColumn,
|
|
692
|
+
y.activeIndex,
|
|
693
|
+
E,
|
|
694
|
+
S,
|
|
695
|
+
w,
|
|
696
|
+
C,
|
|
697
|
+
x
|
|
698
|
+
]);
|
|
699
|
+
return {
|
|
700
|
+
rowCount: p,
|
|
701
|
+
columnCount: d,
|
|
702
|
+
headerRowCount: l,
|
|
703
|
+
cellProps: y.cellProps,
|
|
704
|
+
setActiveCell: y.setActiveCell,
|
|
705
|
+
onKeyDown: D
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/utils/array/arrayUtils.ts
|
|
710
|
+
var we;
|
|
711
|
+
(function(e) {
|
|
712
|
+
function t(e, t, n = 0) {
|
|
713
|
+
return e.slice(n, n + t);
|
|
714
|
+
}
|
|
715
|
+
e.take = t;
|
|
716
|
+
function n(e, t, n = 0) {
|
|
717
|
+
return e.reduce((e, n, r) => e + t(n, r), n);
|
|
718
|
+
}
|
|
719
|
+
e.sumBy = n;
|
|
720
|
+
function r(e, t, n) {
|
|
721
|
+
return [...e].sort((e, r) => {
|
|
722
|
+
let i = t(e), a = t(r);
|
|
723
|
+
return i < a ? n === "DESC" ? 1 : -1 : i > a ? n === "DESC" ? -1 : 1 : 0;
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
e.sortBy = r;
|
|
727
|
+
function i(e, t) {
|
|
728
|
+
return Math.max(...e.map(t));
|
|
729
|
+
}
|
|
730
|
+
e.maxBy = i;
|
|
731
|
+
function a(e, t) {
|
|
732
|
+
let n = e.find(t);
|
|
733
|
+
if (n === void 0) throw Error("No items satisfy the provided condition.");
|
|
734
|
+
return n;
|
|
735
|
+
}
|
|
736
|
+
e.findOrThrow = a;
|
|
737
|
+
function o(e, t) {
|
|
738
|
+
return e.reduce((e, n) => {
|
|
739
|
+
let r = t(n);
|
|
740
|
+
if (!r) return e;
|
|
741
|
+
let [i, a] = r;
|
|
742
|
+
return e[i] = a, e;
|
|
743
|
+
}, {});
|
|
744
|
+
}
|
|
745
|
+
e.toRecord = o;
|
|
746
|
+
function s(e, t) {
|
|
747
|
+
let n = e.reduce((e, n, r) => {
|
|
748
|
+
let i = t(n, r);
|
|
749
|
+
return e.has(i) === !1 && e.set(i, []), e.get(i)?.push(n), e;
|
|
750
|
+
}, /* @__PURE__ */ new Map());
|
|
751
|
+
return Array.from(n, ([e, t]) => ({
|
|
752
|
+
key: e,
|
|
753
|
+
values: t
|
|
754
|
+
}));
|
|
755
|
+
}
|
|
756
|
+
e.groupBy = s;
|
|
757
|
+
})(we ||= {});
|
|
758
|
+
var W = we, Te = "row-number-cell", Ee = "row-selection-cell", G = "grouping-cell", De = "row-detail-cell";
|
|
759
|
+
//#endregion
|
|
760
|
+
//#region src/components/dataGrid/models/aggregationModel.ts
|
|
761
|
+
function K(e) {
|
|
762
|
+
return e.filter((e) => typeof e == "number" && !Number.isNaN(e));
|
|
763
|
+
}
|
|
764
|
+
var Oe = (e) => e.reduce((e, t) => e + t, 0), ke = (e, t) => e.reduce((e, n) => (t ? n < e : n > e) ? n : e), Ae = {
|
|
765
|
+
sum: (e) => {
|
|
766
|
+
let t = K(e);
|
|
767
|
+
return t.length ? Oe(t) : null;
|
|
768
|
+
},
|
|
769
|
+
avg: (e) => {
|
|
770
|
+
let t = K(e);
|
|
771
|
+
return t.length ? Math.round(Oe(t) / t.length * 100) / 100 : null;
|
|
772
|
+
},
|
|
773
|
+
min: (e) => {
|
|
774
|
+
let t = K(e);
|
|
775
|
+
return t.length ? ke(t, !0) : null;
|
|
776
|
+
},
|
|
777
|
+
max: (e) => {
|
|
778
|
+
let t = K(e);
|
|
779
|
+
return t.length ? ke(t, !1) : null;
|
|
780
|
+
},
|
|
781
|
+
count: (e, t) => t.length
|
|
782
|
+
};
|
|
783
|
+
function je(e, t, n) {
|
|
784
|
+
return typeof e == "function" ? e(t, n) : Ae[e]?.(t, n) ?? null;
|
|
785
|
+
}
|
|
786
|
+
var Me = class {
|
|
787
|
+
grid;
|
|
788
|
+
constructor(e) {
|
|
789
|
+
this.grid = e;
|
|
790
|
+
}
|
|
791
|
+
get columns() {
|
|
792
|
+
return this.grid.columns.value.visibleLeafs.filter((e) => !!e.aggregate);
|
|
793
|
+
}
|
|
794
|
+
get hasAggregates() {
|
|
795
|
+
return this.columns.length > 0;
|
|
796
|
+
}
|
|
797
|
+
get hasFooter() {
|
|
798
|
+
return !!this.grid.props.def.footer && this.hasAggregates;
|
|
799
|
+
}
|
|
800
|
+
get footerLabel() {
|
|
801
|
+
let { footer: e } = this.grid.props.def;
|
|
802
|
+
return typeof e == "object" ? e.label : "Total";
|
|
803
|
+
}
|
|
804
|
+
get footerLabelColumn() {
|
|
805
|
+
return this.grid.columns.value.visibleLeafs.find((e) => (e.isData || e.isGrouping) && !e.aggregate);
|
|
806
|
+
}
|
|
807
|
+
footerCells = B(() => this.grid.columns.value.visibleLeafs.map((e) => new Ne(this.grid, e, this.grid.filteredData, "footer")), () => [this.grid.rows]);
|
|
808
|
+
}, Ne = class {
|
|
809
|
+
grid;
|
|
810
|
+
column;
|
|
811
|
+
rows;
|
|
812
|
+
scope;
|
|
813
|
+
given;
|
|
814
|
+
constructor(e, t, n, r, i) {
|
|
815
|
+
this.grid = e, this.column = t, this.rows = n, this.scope = r, this.given = i;
|
|
816
|
+
}
|
|
817
|
+
_values = B(() => this.rows.map((e) => e[this.column.key]));
|
|
818
|
+
get values() {
|
|
819
|
+
return this._values.value;
|
|
820
|
+
}
|
|
821
|
+
_value = B(() => {
|
|
822
|
+
let e = this.column.aggregate;
|
|
823
|
+
return e ? je(e, this.values, this.rows) : null;
|
|
824
|
+
});
|
|
825
|
+
get value() {
|
|
826
|
+
let e = this.given?.();
|
|
827
|
+
return e === void 0 ? this._value.value : e;
|
|
828
|
+
}
|
|
829
|
+
get isExpanded() {
|
|
830
|
+
return !1;
|
|
831
|
+
}
|
|
832
|
+
get isFirst() {
|
|
833
|
+
return !1;
|
|
834
|
+
}
|
|
835
|
+
get isLast() {
|
|
836
|
+
return !1;
|
|
837
|
+
}
|
|
838
|
+
}, Pe = class {
|
|
839
|
+
grid;
|
|
840
|
+
row;
|
|
841
|
+
column;
|
|
842
|
+
constructor(e, t, n) {
|
|
843
|
+
this.grid = e, this.row = t, this.column = n;
|
|
844
|
+
}
|
|
845
|
+
get value() {
|
|
846
|
+
return this.column.isRowNumber ? this.row.rowIndex + 1 : this.column.isGrouping ? this.row.label : null;
|
|
847
|
+
}
|
|
848
|
+
get isExpanded() {
|
|
849
|
+
return !1;
|
|
850
|
+
}
|
|
851
|
+
get isFirst() {
|
|
852
|
+
return !1;
|
|
853
|
+
}
|
|
854
|
+
get isLast() {
|
|
855
|
+
return !1;
|
|
856
|
+
}
|
|
857
|
+
get cellKind() {
|
|
858
|
+
return this.column.isGrouping ? "grouping" : this.column.isRowSelection ? this.row.selectable ? "selection" : "spacer" : this.row.spans(this.column) ? "hidden" : this.column.aggregate ? "aggregate" : "spacer";
|
|
859
|
+
}
|
|
860
|
+
_aggregate = B(() => this.column.aggregate ? new Ne(this.grid, this.column, this.row.allRows.map((e) => e.data), "group", () => this.row.aggregateValue(this.column)) : null);
|
|
861
|
+
get aggregate() {
|
|
862
|
+
return this._aggregate.value;
|
|
863
|
+
}
|
|
864
|
+
get depthPadding() {
|
|
865
|
+
return 4 * this.row.depth;
|
|
866
|
+
}
|
|
867
|
+
get gridColumnSpan() {
|
|
868
|
+
return this.row.groupingColumnGridColumn;
|
|
869
|
+
}
|
|
870
|
+
get widthVar() {
|
|
871
|
+
return `var(${this.column.groupColumnWidthVarName})`;
|
|
872
|
+
}
|
|
873
|
+
get isEndPinned() {
|
|
874
|
+
return this.column.pin === "END";
|
|
875
|
+
}
|
|
876
|
+
get hasGroupingBorder() {
|
|
877
|
+
return this.row.groupingColumn.pin === "START";
|
|
878
|
+
}
|
|
879
|
+
}, Fe = class {
|
|
880
|
+
grid;
|
|
881
|
+
groupColumn;
|
|
882
|
+
rows;
|
|
883
|
+
rowIndex;
|
|
884
|
+
constructor(e, t, n, r, i) {
|
|
885
|
+
this.grid = e, this.groupColumn = t, this.rows = n, this.rowIndex = r, this._groupValue = i, n.forEach((e) => e.parentRow = this);
|
|
886
|
+
}
|
|
887
|
+
_groupValue;
|
|
888
|
+
get groupValue() {
|
|
889
|
+
return this._groupValue;
|
|
890
|
+
}
|
|
891
|
+
get label() {
|
|
892
|
+
return `${this.groupValue} (${this.count})`;
|
|
893
|
+
}
|
|
894
|
+
get placeholder() {
|
|
895
|
+
return !1;
|
|
896
|
+
}
|
|
897
|
+
get selectable() {
|
|
898
|
+
return !0;
|
|
899
|
+
}
|
|
900
|
+
aggregateValue(e) {}
|
|
901
|
+
get key() {
|
|
902
|
+
return `${this.parentRow?.key ?? ""}${this.groupColumn.key}${this.groupValue}`;
|
|
903
|
+
}
|
|
904
|
+
parentRow;
|
|
905
|
+
_cells = B(() => this.grid.columns.value.visibleLeafs.map((e) => new Pe(this.grid, this, e)));
|
|
906
|
+
get cells() {
|
|
907
|
+
return this._cells.value;
|
|
908
|
+
}
|
|
909
|
+
_renderedCells = B(() => {
|
|
910
|
+
let e = [];
|
|
911
|
+
return this.cells.forEach((t, n) => {
|
|
912
|
+
t.cellKind !== "hidden" && e.push({
|
|
913
|
+
cell: t,
|
|
914
|
+
columnIndex: n
|
|
915
|
+
});
|
|
916
|
+
}), e;
|
|
917
|
+
});
|
|
918
|
+
get renderedCells() {
|
|
919
|
+
return this._renderedCells.value;
|
|
920
|
+
}
|
|
921
|
+
get cellCount() {
|
|
922
|
+
return this.renderedCells.length;
|
|
923
|
+
}
|
|
924
|
+
columnOf(e) {
|
|
925
|
+
return this.renderedCells[e]?.columnIndex ?? e;
|
|
926
|
+
}
|
|
927
|
+
get selected() {
|
|
928
|
+
return this.allRows.every((e) => e.selected);
|
|
929
|
+
}
|
|
930
|
+
get indeterminate() {
|
|
931
|
+
return !this.selected && this.allRows.some((e) => e.selected);
|
|
932
|
+
}
|
|
933
|
+
get expanded() {
|
|
934
|
+
return this.grid.isGroupExpanded(this.key, this.depth);
|
|
935
|
+
}
|
|
936
|
+
get depth() {
|
|
937
|
+
return this.parentRow ? this.parentRow.depth + 1 : 0;
|
|
938
|
+
}
|
|
939
|
+
get count() {
|
|
940
|
+
return W.sumBy(this.rows, (e) => e.count, 0);
|
|
941
|
+
}
|
|
942
|
+
get flatRows() {
|
|
943
|
+
return this.expanded ? [this, ...this.rows.flatMap((e) => e.flatRows)] : [this];
|
|
944
|
+
}
|
|
945
|
+
get allRows() {
|
|
946
|
+
return this.rows.flatMap((e) => e.allRows);
|
|
947
|
+
}
|
|
948
|
+
get groupingColumn() {
|
|
949
|
+
return W.findOrThrow(this.grid.columns.value.leafs, (e) => e.key === G);
|
|
950
|
+
}
|
|
951
|
+
get groupingColumnGridColumn() {
|
|
952
|
+
return this.grid.groupingSpan.value.length;
|
|
953
|
+
}
|
|
954
|
+
spans(e) {
|
|
955
|
+
return !e.isGrouping && this.grid.groupingSpan.value.includes(e);
|
|
956
|
+
}
|
|
957
|
+
kind = "group";
|
|
958
|
+
toggleRow() {
|
|
959
|
+
this.grid.toggleGroupRow(this.key, this.expanded);
|
|
960
|
+
}
|
|
961
|
+
toggleSelectAll = () => {
|
|
962
|
+
this.grid.toggleRowsSelection(this.allRows.map((e) => e.key));
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/components/dataGrid/components/dataGridDetailRow.tsx
|
|
967
|
+
function Ie(e) {
|
|
968
|
+
let { row: t, index: i } = e, { grid: a, parentRow: o } = t, s = a.props.def.rowDetail, c = R(), l = (c?.headerRowCount ?? 0) + i, { ref: u, tabIndex: d, onFocus: p } = c?.cellProps(l, 0) ?? {}, m = t.isAutoHeight, h = k(null);
|
|
969
|
+
return n(() => {
|
|
970
|
+
a.takeDetailReveal(o.key) && h.current?.scrollIntoView?.({ block: "nearest" });
|
|
971
|
+
}), /* @__PURE__ */ M(f, {
|
|
972
|
+
ref: h,
|
|
973
|
+
component: `${a.componentName}.body.detailRow`,
|
|
974
|
+
props: {
|
|
975
|
+
role: "row",
|
|
976
|
+
"aria-rowindex": l + 1
|
|
977
|
+
},
|
|
978
|
+
style: {
|
|
979
|
+
gridColumn: "1 / -1",
|
|
980
|
+
height: m ? "auto" : `${t.height}px`
|
|
981
|
+
},
|
|
982
|
+
children: /* @__PURE__ */ M(r, {
|
|
983
|
+
ref: u,
|
|
984
|
+
component: `${a.componentName}.body.detailRow.content`,
|
|
985
|
+
position: "sticky",
|
|
986
|
+
insetStart: 0,
|
|
987
|
+
overflowX: "auto",
|
|
988
|
+
overflowY: "hidden",
|
|
989
|
+
props: {
|
|
990
|
+
role: "gridcell",
|
|
991
|
+
"aria-colindex": 1,
|
|
992
|
+
"aria-colspan": c?.columnCount,
|
|
993
|
+
tabIndex: d,
|
|
994
|
+
onFocus: p
|
|
995
|
+
},
|
|
996
|
+
style: { width: `var(${a.viewportWidthVarName})` },
|
|
997
|
+
children: s.content(o.data)
|
|
998
|
+
})
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
Ie.displayName = "DataGridDetailRow";
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region src/components/dataGrid/components/dataGridAggregateValue.tsx
|
|
1004
|
+
function Le(e) {
|
|
1005
|
+
let { cell: t } = e, { column: n } = t;
|
|
1006
|
+
if (n.AggregateCell) return /* @__PURE__ */ M(n.AggregateCell, { cell: t });
|
|
1007
|
+
let i = t.scope === "footer" ? "footer.cell" : "body.groupRow.aggregate";
|
|
1008
|
+
return /* @__PURE__ */ M(r, {
|
|
1009
|
+
component: `${n.grid.componentName}.${i}`,
|
|
1010
|
+
px: 3,
|
|
1011
|
+
textOverflow: "ellipsis",
|
|
1012
|
+
overflow: "hidden",
|
|
1013
|
+
textWrap: "nowrap",
|
|
1014
|
+
children: t.value
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
Le.displayName = "DataGridAggregateValue";
|
|
1018
|
+
//#endregion
|
|
1019
|
+
//#region src/components/dataGrid/components/dataGridCell.tsx
|
|
1020
|
+
var Re = "button,a[href],input,select,textarea";
|
|
1021
|
+
function q(t) {
|
|
1022
|
+
let { children: n, cell: r, row: i, columnIndex: a, ariaColIndex: o, ariaColSpan: s, style: c, ...l } = t, { column: u } = r, { ref: d, tabIndex: p, onFocus: m } = R()?.cellProps(i, a) ?? {};
|
|
1023
|
+
u.hasAlign && (l.jc = u.align);
|
|
1024
|
+
let h = r.isExpanded ? {
|
|
1025
|
+
...u.cellVariant.value,
|
|
1026
|
+
isExpanded: !0,
|
|
1027
|
+
isExpandedFirstLeaf: r.isFirst,
|
|
1028
|
+
isExpandedLastLeaf: r.isLast
|
|
1029
|
+
} : u.cellVariant.value;
|
|
1030
|
+
r instanceof ve && r.editing && (h = {
|
|
1031
|
+
...h,
|
|
1032
|
+
isEditing: !0,
|
|
1033
|
+
isInvalid: !!r.error
|
|
1034
|
+
});
|
|
1035
|
+
let g = r instanceof ve ? (t) => {
|
|
1036
|
+
t.target.closest(Re) || (e(t.currentTarget), r.beginEdit());
|
|
1037
|
+
} : void 0;
|
|
1038
|
+
return /* @__PURE__ */ M(f, {
|
|
1039
|
+
ref: d,
|
|
1040
|
+
component: `${u.grid.componentName}.body.cell`,
|
|
1041
|
+
props: {
|
|
1042
|
+
role: "gridcell",
|
|
1043
|
+
"aria-colindex": o ?? a + 1,
|
|
1044
|
+
"aria-colspan": s,
|
|
1045
|
+
tabIndex: p,
|
|
1046
|
+
onFocus: m,
|
|
1047
|
+
onDoubleClick: g
|
|
1048
|
+
},
|
|
1049
|
+
variant: h,
|
|
1050
|
+
style: {
|
|
1051
|
+
...u.cellStyleVars.value,
|
|
1052
|
+
...c
|
|
1053
|
+
},
|
|
1054
|
+
...l,
|
|
1055
|
+
children: n
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
q.displayName = "DataGridCell";
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/components/dataGrid/components/dataGridFooter.tsx
|
|
1061
|
+
function ze(e) {
|
|
1062
|
+
let { grid: t } = e, { aggregation: n } = t, i = R();
|
|
1063
|
+
if (!n.hasFooter) return null;
|
|
1064
|
+
let a = (i?.rowCount ?? 1) - 1, { footerLabelColumn: o, footerLabel: s } = n;
|
|
1065
|
+
return /* @__PURE__ */ M(_, {
|
|
1066
|
+
component: `${t.componentName}.footer`,
|
|
1067
|
+
props: { role: "rowgroup" },
|
|
1068
|
+
style: { gridTemplateColumns: t.gridTemplateColumns.value },
|
|
1069
|
+
children: /* @__PURE__ */ M(r, {
|
|
1070
|
+
display: "contents",
|
|
1071
|
+
props: {
|
|
1072
|
+
role: "row",
|
|
1073
|
+
"aria-rowindex": a + 1
|
|
1074
|
+
},
|
|
1075
|
+
children: n.footerCells.value.map((e, n) => /* @__PURE__ */ M(q, {
|
|
1076
|
+
cell: e,
|
|
1077
|
+
row: a,
|
|
1078
|
+
columnIndex: n,
|
|
1079
|
+
children: e.column.aggregate ? /* @__PURE__ */ M(Le, { cell: e }) : e.column === o ? /* @__PURE__ */ M(r, {
|
|
1080
|
+
component: `${t.componentName}.footer.label`,
|
|
1081
|
+
px: 3,
|
|
1082
|
+
textWrap: "nowrap",
|
|
1083
|
+
children: s
|
|
1084
|
+
}) : null
|
|
1085
|
+
}, e.column.key))
|
|
1086
|
+
})
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
ze.displayName = "DataGridFooter";
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region src/icons/expandIcon.tsx
|
|
1092
|
+
function J(e) {
|
|
1093
|
+
return /* @__PURE__ */ M(l, {
|
|
1094
|
+
viewBox: "4 2 16 18",
|
|
1095
|
+
width: "1rem",
|
|
1096
|
+
fill: "currentColor",
|
|
1097
|
+
...e,
|
|
1098
|
+
children: /* @__PURE__ */ M(c, {
|
|
1099
|
+
fillRule: "evenodd",
|
|
1100
|
+
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",
|
|
1101
|
+
props: { clipRule: "evenodd" }
|
|
1102
|
+
})
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
//#endregion
|
|
1106
|
+
//#region src/components/dataGrid/components/dataGridCellPlaceholder.tsx
|
|
1107
|
+
var Be = [
|
|
1108
|
+
"3/5",
|
|
1109
|
+
"2/5",
|
|
1110
|
+
"4/5",
|
|
1111
|
+
"1/2",
|
|
1112
|
+
"7/12"
|
|
1113
|
+
];
|
|
1114
|
+
function Y(e) {
|
|
1115
|
+
let { cell: t, columnIndex: n } = e, i = Be[(t.row.rowIndex + n) % Be.length];
|
|
1116
|
+
return /* @__PURE__ */ M(f, {
|
|
1117
|
+
component: `${t.grid.componentName}.body.cell.placeholder`,
|
|
1118
|
+
ai: "center",
|
|
1119
|
+
px: 3,
|
|
1120
|
+
props: { "aria-hidden": !0 },
|
|
1121
|
+
children: /* @__PURE__ */ M(r, {
|
|
1122
|
+
component: `${t.grid.componentName}.body.cell.placeholder.bar`,
|
|
1123
|
+
width: i
|
|
1124
|
+
})
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
Y.displayName = "DataGridCellPlaceholder";
|
|
1128
|
+
//#endregion
|
|
1129
|
+
//#region src/components/dataGrid/components/dataGridGroupRow.tsx
|
|
1130
|
+
function Ve(e) {
|
|
1131
|
+
let { row: t, index: n } = e, { selected: i, indeterminate: a, expanded: o, placeholder: s } = t, c = (R()?.headerRowCount ?? 0) + n, l = T(() => t.toggleSelectAll(), [t]);
|
|
1132
|
+
return /* @__PURE__ */ M(f, {
|
|
1133
|
+
component: `${t.grid.componentName}.body.groupRow`,
|
|
1134
|
+
className: "grid-row",
|
|
1135
|
+
selected: t.grid.props.def.rowSelection ? i : void 0,
|
|
1136
|
+
display: "contents",
|
|
1137
|
+
props: {
|
|
1138
|
+
role: "row",
|
|
1139
|
+
"aria-rowindex": c + 1,
|
|
1140
|
+
"data-group-row": "",
|
|
1141
|
+
"aria-busy": s || void 0
|
|
1142
|
+
},
|
|
1143
|
+
children: t.renderedCells.map(({ cell: e, columnIndex: n }, u) => {
|
|
1144
|
+
switch (e.cellKind) {
|
|
1145
|
+
case "grouping": return /* @__PURE__ */ M(q, {
|
|
1146
|
+
cell: e,
|
|
1147
|
+
row: c,
|
|
1148
|
+
columnIndex: u,
|
|
1149
|
+
ariaColIndex: n + 1,
|
|
1150
|
+
ariaColSpan: e.gridColumnSpan,
|
|
1151
|
+
style: {
|
|
1152
|
+
width: e.widthVar,
|
|
1153
|
+
insetInlineEnd: e.isEndPinned ? "0" : void 0
|
|
1154
|
+
},
|
|
1155
|
+
be: e.hasGroupingBorder ? 1 : void 0,
|
|
1156
|
+
gridColumn: e.gridColumnSpan,
|
|
1157
|
+
ps: e.depthPadding,
|
|
1158
|
+
overflow: "auto",
|
|
1159
|
+
children: s ? /* @__PURE__ */ M(Y, {
|
|
1160
|
+
cell: e,
|
|
1161
|
+
columnIndex: u
|
|
1162
|
+
}) : /* @__PURE__ */ M(r, {
|
|
1163
|
+
textWrap: "nowrap",
|
|
1164
|
+
px: 3,
|
|
1165
|
+
children: /* @__PURE__ */ N(d, {
|
|
1166
|
+
component: `${t.grid.componentName}.body.groupRow.expandButton`,
|
|
1167
|
+
onClick: () => t.toggleRow(),
|
|
1168
|
+
cursor: "pointer",
|
|
1169
|
+
display: "flex",
|
|
1170
|
+
gap: 1,
|
|
1171
|
+
ai: "center",
|
|
1172
|
+
props: {
|
|
1173
|
+
tabIndex: -1,
|
|
1174
|
+
"aria-expanded": o
|
|
1175
|
+
},
|
|
1176
|
+
children: [/* @__PURE__ */ M(J, {
|
|
1177
|
+
fill: "currentColor",
|
|
1178
|
+
width: "14px",
|
|
1179
|
+
height: "14px",
|
|
1180
|
+
rotate: o ? 0 : -90
|
|
1181
|
+
}), e.value]
|
|
1182
|
+
})
|
|
1183
|
+
})
|
|
1184
|
+
}, e.column.key);
|
|
1185
|
+
case "selection": return /* @__PURE__ */ M(q, {
|
|
1186
|
+
cell: e,
|
|
1187
|
+
row: c,
|
|
1188
|
+
columnIndex: u,
|
|
1189
|
+
ariaColIndex: n + 1,
|
|
1190
|
+
children: /* @__PURE__ */ M(p, {
|
|
1191
|
+
variant: "datagrid",
|
|
1192
|
+
m: 1,
|
|
1193
|
+
checked: i,
|
|
1194
|
+
indeterminate: a,
|
|
1195
|
+
onChange: l,
|
|
1196
|
+
props: {
|
|
1197
|
+
tabIndex: -1,
|
|
1198
|
+
"aria-label": `Select all rows in ${t.groupValue}`
|
|
1199
|
+
}
|
|
1200
|
+
})
|
|
1201
|
+
}, e.column.key);
|
|
1202
|
+
case "aggregate": return /* @__PURE__ */ M(q, {
|
|
1203
|
+
cell: e,
|
|
1204
|
+
row: c,
|
|
1205
|
+
columnIndex: u,
|
|
1206
|
+
ariaColIndex: n + 1,
|
|
1207
|
+
children: e.aggregate && /* @__PURE__ */ M(Le, { cell: e.aggregate })
|
|
1208
|
+
}, e.column.key);
|
|
1209
|
+
case "spacer": return /* @__PURE__ */ M(q, {
|
|
1210
|
+
cell: e,
|
|
1211
|
+
row: c,
|
|
1212
|
+
columnIndex: u,
|
|
1213
|
+
ariaColIndex: n + 1,
|
|
1214
|
+
px: e.column.isRowNumber ? 3 : void 0,
|
|
1215
|
+
children: e.value
|
|
1216
|
+
}, e.column.key);
|
|
1217
|
+
default: return null;
|
|
1218
|
+
}
|
|
1219
|
+
})
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
Ve.displayName = "DataGridGroupRow";
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region src/components/dataGrid/components/dataGridCellEditor.tsx
|
|
1225
|
+
var He = "input,select,textarea,button";
|
|
1226
|
+
function Ue(e) {
|
|
1227
|
+
let { options: t } = e.editor;
|
|
1228
|
+
return typeof t == "function" ? t(e.row.data) : t ?? [];
|
|
1229
|
+
}
|
|
1230
|
+
function We(e) {
|
|
1231
|
+
let { cell: t, row: r, columnIndex: i } = e, { grid: a } = t, o = R(), c = k(null), l = s("datagrid-cell-error"), { error: u, pending: d } = t;
|
|
1232
|
+
n(() => {
|
|
1233
|
+
let e = c.current?.querySelector(He);
|
|
1234
|
+
e?.focus(), e instanceof HTMLInputElement && e.type !== "checkbox" && e.select();
|
|
1235
|
+
}, []);
|
|
1236
|
+
let p = T(() => {
|
|
1237
|
+
c.current?.closest("[role=\"gridcell\"]")?.focus();
|
|
1238
|
+
}, []), h = T((e) => {
|
|
1239
|
+
if (!o) return;
|
|
1240
|
+
let t = a.edits.nextEditable(r - o.headerRowCount, i, e.shiftKey);
|
|
1241
|
+
t && (e.preventDefault(), o.setActiveCell(t.row + o.headerRowCount, t.column, { reason: "programmatic" }), a.edits.beginAt(t.row, t.column));
|
|
1242
|
+
}, [
|
|
1243
|
+
i,
|
|
1244
|
+
a,
|
|
1245
|
+
o,
|
|
1246
|
+
r
|
|
1247
|
+
]), g = T((e) => {
|
|
1248
|
+
if (e.key === "Escape") {
|
|
1249
|
+
if (c.current?.querySelector("[aria-expanded=\"true\"]")) return;
|
|
1250
|
+
e.preventDefault(), e.stopPropagation(), t.cancelEdit(), p();
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
if (e.key === "Enter") {
|
|
1254
|
+
e.preventDefault(), e.stopPropagation(), t.commitEdit(), t.editing || p();
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
if (e.key === "Tab") {
|
|
1258
|
+
if (e.stopPropagation(), t.commitEdit(), t.editing) {
|
|
1259
|
+
e.preventDefault();
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
h(e);
|
|
1263
|
+
}
|
|
1264
|
+
}, [
|
|
1265
|
+
t,
|
|
1266
|
+
p,
|
|
1267
|
+
h
|
|
1268
|
+
]), _ = T(() => {
|
|
1269
|
+
!t.editing || t.pending || t.commitEdit();
|
|
1270
|
+
}, [t]);
|
|
1271
|
+
return /* @__PURE__ */ N(f, {
|
|
1272
|
+
ref: c,
|
|
1273
|
+
component: `${a.componentName}.body.cell.editor`,
|
|
1274
|
+
variant: { isPending: d },
|
|
1275
|
+
props: { onKeyDown: g },
|
|
1276
|
+
width: "fit",
|
|
1277
|
+
height: "fit",
|
|
1278
|
+
ai: "center",
|
|
1279
|
+
children: [/* @__PURE__ */ M(Ge, {
|
|
1280
|
+
cell: t,
|
|
1281
|
+
errorId: u ? l : void 0,
|
|
1282
|
+
onBlur: _,
|
|
1283
|
+
onCommitted: p
|
|
1284
|
+
}), u && /* @__PURE__ */ M(m, {
|
|
1285
|
+
anchor: c,
|
|
1286
|
+
side: "bottom",
|
|
1287
|
+
align: "start",
|
|
1288
|
+
offset: 1,
|
|
1289
|
+
matchWidth: !1,
|
|
1290
|
+
component: `${a.componentName}.body.cell.error`,
|
|
1291
|
+
id: l,
|
|
1292
|
+
props: { role: "alert" },
|
|
1293
|
+
children: u
|
|
1294
|
+
})]
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function Ge(e) {
|
|
1298
|
+
let { cell: t, errorId: n, onBlur: r, onCommitted: i } = e, { EditCell: a } = t.column.def, { type: o, placeholder: s, step: c, min: l, max: u } = t.editor, d = {
|
|
1299
|
+
"aria-label": `Edit ${t.column.header ?? t.column.key}`,
|
|
1300
|
+
"aria-invalid": n ? !0 : void 0,
|
|
1301
|
+
"aria-describedby": n
|
|
1302
|
+
};
|
|
1303
|
+
if (a) return /* @__PURE__ */ M(a, { cell: t });
|
|
1304
|
+
if (o === "checkbox") return /* @__PURE__ */ M(p, {
|
|
1305
|
+
checked: !!t.draft,
|
|
1306
|
+
onChange: (e) => {
|
|
1307
|
+
t.setDraft(e.target.checked), t.commitEdit(), i();
|
|
1308
|
+
},
|
|
1309
|
+
props: {
|
|
1310
|
+
...d,
|
|
1311
|
+
onBlur: r
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
if (o === "select") return /* @__PURE__ */ M(v, {
|
|
1315
|
+
value: t.draft,
|
|
1316
|
+
defaultOpen: !0,
|
|
1317
|
+
width: "fit",
|
|
1318
|
+
variant: "compact",
|
|
1319
|
+
b: 0,
|
|
1320
|
+
bgColor: "transparent",
|
|
1321
|
+
focus: { outline: 0 },
|
|
1322
|
+
onValueChange: (e) => {
|
|
1323
|
+
t.setDraft(e ?? null), t.commitEdit(), i();
|
|
1324
|
+
},
|
|
1325
|
+
props: d,
|
|
1326
|
+
children: Ue(t).map((e) => /* @__PURE__ */ M(v.Item, {
|
|
1327
|
+
value: e.value,
|
|
1328
|
+
children: e.label ?? String(e.value)
|
|
1329
|
+
}, String(e.value)))
|
|
1330
|
+
});
|
|
1331
|
+
let f = o === "number";
|
|
1332
|
+
return /* @__PURE__ */ M(g, {
|
|
1333
|
+
type: f ? "number" : "text",
|
|
1334
|
+
value: t.draft === null || t.draft === void 0 ? "" : String(t.draft),
|
|
1335
|
+
placeholder: s,
|
|
1336
|
+
step: c,
|
|
1337
|
+
width: "fit",
|
|
1338
|
+
variant: "compact",
|
|
1339
|
+
b: 0,
|
|
1340
|
+
bgColor: "transparent",
|
|
1341
|
+
focus: { outline: 0 },
|
|
1342
|
+
onChange: (e) => {
|
|
1343
|
+
let n = e.target.value;
|
|
1344
|
+
t.setDraft(f ? n === "" ? null : Number(n) : n);
|
|
1345
|
+
},
|
|
1346
|
+
props: {
|
|
1347
|
+
...d,
|
|
1348
|
+
min: l,
|
|
1349
|
+
max: u,
|
|
1350
|
+
onBlur: r
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
We.displayName = "DataGridCellEditor";
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region src/components/dataGrid/components/dataGridCellText.tsx
|
|
1357
|
+
function Ke(e) {
|
|
1358
|
+
let { cell: t } = e;
|
|
1359
|
+
return /* @__PURE__ */ M(f, {
|
|
1360
|
+
component: `${t.grid.componentName}.body.cell.text`,
|
|
1361
|
+
height: "fit",
|
|
1362
|
+
width: "fit",
|
|
1363
|
+
overflow: "auto",
|
|
1364
|
+
ai: "center",
|
|
1365
|
+
jc: t.column.align,
|
|
1366
|
+
children: /* @__PURE__ */ M(r, {
|
|
1367
|
+
px: 3,
|
|
1368
|
+
textOverflow: "ellipsis",
|
|
1369
|
+
overflow: "hidden",
|
|
1370
|
+
textWrap: "nowrap",
|
|
1371
|
+
children: t.value
|
|
1372
|
+
})
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
Ke.displayName = "DataGridCellText";
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region src/components/dataGrid/components/dataGridCellTree.tsx
|
|
1378
|
+
function qe(e) {
|
|
1379
|
+
let { cell: t, row: n, children: i } = e, { hasChildren: a, treeExpanded: o, level: s } = n, c = n.grid.componentName, l = T((e) => {
|
|
1380
|
+
e.stopPropagation(), n.toggleTree();
|
|
1381
|
+
}, [n]), u = t.value == null || t.value === "" ? `row ${n.rowIndex + 1}` : String(t.value);
|
|
1382
|
+
return /* @__PURE__ */ N(f, {
|
|
1383
|
+
component: `${c}.body.cell.tree`,
|
|
1384
|
+
ai: "center",
|
|
1385
|
+
ps: s * n.grid.tree.indent,
|
|
1386
|
+
children: [a ? /* @__PURE__ */ M(d, {
|
|
1387
|
+
component: `${c}.body.cell.tree.toggle`,
|
|
1388
|
+
variant: { isExpanded: o },
|
|
1389
|
+
type: "button",
|
|
1390
|
+
onClick: l,
|
|
1391
|
+
cursor: "pointer",
|
|
1392
|
+
display: "flex",
|
|
1393
|
+
ai: "center",
|
|
1394
|
+
jc: "center",
|
|
1395
|
+
props: {
|
|
1396
|
+
tabIndex: -1,
|
|
1397
|
+
"aria-label": `${o ? "Collapse" : "Expand"} ${u}`
|
|
1398
|
+
},
|
|
1399
|
+
children: /* @__PURE__ */ M(J, {
|
|
1400
|
+
fill: "currentColor",
|
|
1401
|
+
width: "14px",
|
|
1402
|
+
height: "14px",
|
|
1403
|
+
rotate: o ? 0 : -90
|
|
1404
|
+
})
|
|
1405
|
+
}) : /* @__PURE__ */ M(r, { component: `${c}.body.cell.tree.spacer` }), /* @__PURE__ */ M(r, {
|
|
1406
|
+
textOverflow: "ellipsis",
|
|
1407
|
+
overflow: "hidden",
|
|
1408
|
+
textWrap: "nowrap",
|
|
1409
|
+
minWidth: 0,
|
|
1410
|
+
children: i
|
|
1411
|
+
})]
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
qe.displayName = "DataGridCellTree";
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/components/dataGrid/components/dataGridRow.tsx
|
|
1417
|
+
function Je(e) {
|
|
1418
|
+
let { row: t, index: n } = e, { selected: r, expandOnRowClick: i } = t, a = (R()?.headerRowCount ?? 0) + n, o = U(t) ? t : void 0, s = o && t.grid.tree.columnKey, c = T(() => {
|
|
1419
|
+
t.toggleDetail();
|
|
1420
|
+
}, [t]), l = (e, n) => {
|
|
1421
|
+
if (e.editing) return /* @__PURE__ */ M(We, {
|
|
1422
|
+
cell: e,
|
|
1423
|
+
row: a,
|
|
1424
|
+
columnIndex: n
|
|
1425
|
+
});
|
|
1426
|
+
let r = t.placeholder && !e.column.isRowNumber ? /* @__PURE__ */ M(Y, {
|
|
1427
|
+
cell: e,
|
|
1428
|
+
columnIndex: n
|
|
1429
|
+
}) : e.column.Cell ? /* @__PURE__ */ M(e.column.Cell, { cell: e }) : /* @__PURE__ */ M(Ke, { cell: e });
|
|
1430
|
+
return !o || e.column.key !== s ? r : /* @__PURE__ */ M(qe, {
|
|
1431
|
+
cell: e,
|
|
1432
|
+
row: o,
|
|
1433
|
+
children: r
|
|
1434
|
+
});
|
|
1435
|
+
};
|
|
1436
|
+
return /* @__PURE__ */ M(f, {
|
|
1437
|
+
component: `${t.grid.componentName}.body.row`,
|
|
1438
|
+
className: "grid-row",
|
|
1439
|
+
selected: t.grid.props.def.rowSelection ? r : void 0,
|
|
1440
|
+
display: "contents",
|
|
1441
|
+
props: {
|
|
1442
|
+
role: "row",
|
|
1443
|
+
"aria-rowindex": a + 1,
|
|
1444
|
+
"aria-busy": t.placeholder || void 0,
|
|
1445
|
+
"aria-level": o ? o.level + 1 : void 0,
|
|
1446
|
+
"aria-posinset": o ? o.position + 1 : void 0,
|
|
1447
|
+
"aria-setsize": o ? o.siblings : void 0,
|
|
1448
|
+
"aria-expanded": o?.hasChildren ? o.treeExpanded : void 0,
|
|
1449
|
+
onClick: i ? c : void 0
|
|
1450
|
+
},
|
|
1451
|
+
cursor: i ? "pointer" : void 0,
|
|
1452
|
+
children: t.cells.map((e, t) => /* @__PURE__ */ M(q, {
|
|
1453
|
+
cell: e,
|
|
1454
|
+
row: a,
|
|
1455
|
+
columnIndex: t,
|
|
1456
|
+
children: l(e, t)
|
|
1457
|
+
}, e.column.key))
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
Je.displayName = "DataGridRow";
|
|
1461
|
+
//#endregion
|
|
1462
|
+
//#region src/components/dataGrid/components/dataGridBody.tsx
|
|
1463
|
+
function Ye(e, t) {
|
|
1464
|
+
return e instanceof V ? /* @__PURE__ */ M(Ie, {
|
|
1465
|
+
row: e,
|
|
1466
|
+
index: t
|
|
1467
|
+
}, e.key) : e instanceof Fe ? /* @__PURE__ */ M(Ve, {
|
|
1468
|
+
row: e,
|
|
1469
|
+
index: t
|
|
1470
|
+
}, e.key) : /* @__PURE__ */ M(Je, {
|
|
1471
|
+
row: e,
|
|
1472
|
+
index: t
|
|
1473
|
+
}, e.key);
|
|
1474
|
+
}
|
|
1475
|
+
function Xe(e) {
|
|
1476
|
+
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 = te(() => d ? null : W.take(p, o, a).map((e, t) => Ye(e, a + t)), [
|
|
1477
|
+
p,
|
|
1478
|
+
d,
|
|
1479
|
+
o,
|
|
1480
|
+
a
|
|
1481
|
+
]);
|
|
1482
|
+
if (d) {
|
|
1483
|
+
let { noDataComponent: e } = t.props.def, n = t.props.loading ? "loading..." : "empty";
|
|
1484
|
+
return /* @__PURE__ */ M(f, {
|
|
1485
|
+
component: `${t.componentName}.body.empty`,
|
|
1486
|
+
jc: "center",
|
|
1487
|
+
ai: "center",
|
|
1488
|
+
width: "fit",
|
|
1489
|
+
position: "sticky",
|
|
1490
|
+
insetStart: 0,
|
|
1491
|
+
props: { role: "row" },
|
|
1492
|
+
style: { height: i.emptyHeight },
|
|
1493
|
+
children: /* @__PURE__ */ M(r, {
|
|
1494
|
+
display: "contents",
|
|
1495
|
+
props: { role: "gridcell" },
|
|
1496
|
+
children: e ?? n
|
|
1497
|
+
})
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
return u ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(_, {
|
|
1501
|
+
component: `${t.componentName}.body`,
|
|
1502
|
+
width: "max-content",
|
|
1503
|
+
minWidth: "fit",
|
|
1504
|
+
transition: "none",
|
|
1505
|
+
props: { role: "rowgroup" },
|
|
1506
|
+
style: { gridTemplateColumns: t.gridTemplateColumns.value },
|
|
1507
|
+
children: m
|
|
1508
|
+
}), /* @__PURE__ */ M(ze, { grid: t })] }) : /* @__PURE__ */ N(r, {
|
|
1509
|
+
props: { role: "presentation" },
|
|
1510
|
+
style: { height: l },
|
|
1511
|
+
children: [/* @__PURE__ */ M(r, {
|
|
1512
|
+
props: { role: "presentation" },
|
|
1513
|
+
style: { height: `${c}px` },
|
|
1514
|
+
children: /* @__PURE__ */ M(_, {
|
|
1515
|
+
component: `${t.componentName}.body`,
|
|
1516
|
+
width: "max-content",
|
|
1517
|
+
minWidth: "fit",
|
|
1518
|
+
transition: "none",
|
|
1519
|
+
props: { role: "rowgroup" },
|
|
1520
|
+
style: {
|
|
1521
|
+
transform: `translate3d(0, ${s}px, 0)`,
|
|
1522
|
+
willChange: "transform",
|
|
1523
|
+
gridTemplateColumns: t.gridTemplateColumns.value
|
|
1524
|
+
},
|
|
1525
|
+
children: m
|
|
1526
|
+
})
|
|
1527
|
+
}), /* @__PURE__ */ M(ze, { grid: t })]
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
Xe.displayName = "DataGridBody";
|
|
1531
|
+
//#endregion
|
|
1532
|
+
//#region src/components/dataGrid/components/dataGridEmptyColumns.tsx
|
|
1533
|
+
function Ze(e) {
|
|
1534
|
+
let { grid: t } = e;
|
|
1535
|
+
return /* @__PURE__ */ M(f, {
|
|
1536
|
+
component: `${t.componentName}.emptyColumns`,
|
|
1537
|
+
d: "column",
|
|
1538
|
+
ai: "center",
|
|
1539
|
+
jc: "center",
|
|
1540
|
+
gap: 4,
|
|
1541
|
+
py: 16,
|
|
1542
|
+
px: 6,
|
|
1543
|
+
bgColor: "gray-50",
|
|
1544
|
+
borderRadius: 4,
|
|
1545
|
+
theme: { dark: { bgColor: "gray-900" } },
|
|
1546
|
+
children: /* @__PURE__ */ N(f, {
|
|
1547
|
+
d: "column",
|
|
1548
|
+
ai: "center",
|
|
1549
|
+
gap: 3,
|
|
1550
|
+
children: [/* @__PURE__ */ M(r, {
|
|
1551
|
+
width: 16,
|
|
1552
|
+
height: 16,
|
|
1553
|
+
borderRadius: 999,
|
|
1554
|
+
bgColor: "gray-200",
|
|
1555
|
+
theme: { dark: { bgColor: "gray-700" } },
|
|
1556
|
+
display: "flex",
|
|
1557
|
+
ai: "center",
|
|
1558
|
+
jc: "center",
|
|
1559
|
+
children: /* @__PURE__ */ M(l, {
|
|
1560
|
+
viewBox: "0 0 24 24",
|
|
1561
|
+
width: "40",
|
|
1562
|
+
fill: "currentColor",
|
|
1563
|
+
color: "gray-400",
|
|
1564
|
+
theme: { dark: { color: "gray-500" } },
|
|
1565
|
+
children: /* @__PURE__ */ M(c, {
|
|
1566
|
+
fillRule: "evenodd",
|
|
1567
|
+
props: { clipRule: "evenodd" },
|
|
1568
|
+
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"
|
|
1569
|
+
})
|
|
1570
|
+
})
|
|
1571
|
+
}), /* @__PURE__ */ N(f, {
|
|
1572
|
+
d: "column",
|
|
1573
|
+
ai: "center",
|
|
1574
|
+
gap: 1,
|
|
1575
|
+
children: [/* @__PURE__ */ M(r, {
|
|
1576
|
+
fontSize: 18,
|
|
1577
|
+
fontWeight: 600,
|
|
1578
|
+
color: "gray-900",
|
|
1579
|
+
theme: { dark: { color: "gray-50" } },
|
|
1580
|
+
children: "No Columns Selected"
|
|
1581
|
+
}), /* @__PURE__ */ M(r, {
|
|
1582
|
+
fontSize: 14,
|
|
1583
|
+
color: "gray-500",
|
|
1584
|
+
textAlign: "center",
|
|
1585
|
+
theme: { dark: { color: "gray-400" } },
|
|
1586
|
+
children: "Select at least one column from the columns menu to display data"
|
|
1587
|
+
})]
|
|
1588
|
+
})]
|
|
1589
|
+
})
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
//#endregion
|
|
1593
|
+
//#region src/components/dataGrid/components/dataGridColumnFilter.tsx
|
|
1594
|
+
function Qe(e) {
|
|
1595
|
+
let { columnName: t, onClear: n } = e;
|
|
1596
|
+
return /* @__PURE__ */ M(d, {
|
|
1597
|
+
clean: !0,
|
|
1598
|
+
type: "button",
|
|
1599
|
+
position: "absolute",
|
|
1600
|
+
insetEnd: 2,
|
|
1601
|
+
top: "1/2",
|
|
1602
|
+
translateY: "-1/2",
|
|
1603
|
+
cursor: "pointer",
|
|
1604
|
+
display: "flex",
|
|
1605
|
+
ai: "center",
|
|
1606
|
+
onClick: n,
|
|
1607
|
+
props: {
|
|
1608
|
+
tabIndex: -1,
|
|
1609
|
+
"aria-label": `Clear the ${t} filter`
|
|
1610
|
+
},
|
|
1611
|
+
children: /* @__PURE__ */ M(r, {
|
|
1612
|
+
fontSize: 10,
|
|
1613
|
+
color: "gray-400",
|
|
1614
|
+
hover: { color: "gray-600" },
|
|
1615
|
+
children: "✕"
|
|
1616
|
+
})
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
function $e({ column: e }) {
|
|
1620
|
+
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);
|
|
1621
|
+
D(() => () => {
|
|
1622
|
+
s.current && clearTimeout(s.current);
|
|
1623
|
+
}, []);
|
|
1624
|
+
let c = T((t) => {
|
|
1625
|
+
let n = t.target.value;
|
|
1626
|
+
o(n), s.current && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
1627
|
+
e.setTextFilter(n), s.current = null;
|
|
1628
|
+
}, 300);
|
|
1629
|
+
}, [e]), l = T(() => {
|
|
1630
|
+
o(""), e.clearFilter();
|
|
1631
|
+
}, [e]);
|
|
1632
|
+
return /* @__PURE__ */ N(f, {
|
|
1633
|
+
component: `${n}.filter.cell.input`,
|
|
1634
|
+
children: [/* @__PURE__ */ M(g, {
|
|
1635
|
+
width: "fit",
|
|
1636
|
+
variant: "compact",
|
|
1637
|
+
placeholder: e.filterConfig?.placeholder ?? "Filter...",
|
|
1638
|
+
value: a,
|
|
1639
|
+
onChange: c,
|
|
1640
|
+
b: 0,
|
|
1641
|
+
bgColor: "transparent",
|
|
1642
|
+
focus: { outline: 0 },
|
|
1643
|
+
props: {
|
|
1644
|
+
tabIndex: -1,
|
|
1645
|
+
"aria-label": `Filter ${r}`
|
|
1646
|
+
}
|
|
1647
|
+
}), a && /* @__PURE__ */ M(Qe, {
|
|
1648
|
+
columnName: r,
|
|
1649
|
+
onClear: l
|
|
1650
|
+
})]
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function et({ column: e }) {
|
|
1654
|
+
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 ?? ""), m = k(null), h = k(null);
|
|
1655
|
+
D(() => () => {
|
|
1656
|
+
m.current && clearTimeout(m.current), h.current && clearTimeout(h.current);
|
|
1657
|
+
}, []);
|
|
1658
|
+
let _ = e.filterConfig, y = T((t) => {
|
|
1659
|
+
let n = t.target.value;
|
|
1660
|
+
c(n), m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
1661
|
+
e.setNumberFilter(l, n, d), m.current = null;
|
|
1662
|
+
}, 300);
|
|
1663
|
+
}, [
|
|
1664
|
+
e,
|
|
1665
|
+
l,
|
|
1666
|
+
d
|
|
1667
|
+
]), b = T((t) => {
|
|
1668
|
+
u(t), e.setNumberFilter(t, s, d);
|
|
1669
|
+
}, [
|
|
1670
|
+
e,
|
|
1671
|
+
s,
|
|
1672
|
+
d
|
|
1673
|
+
]), x = T((t) => {
|
|
1674
|
+
let n = t.target.value;
|
|
1675
|
+
p(n), h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
1676
|
+
e.setNumberFilter(l, s, n), h.current = null;
|
|
1677
|
+
}, 300);
|
|
1678
|
+
}, [
|
|
1679
|
+
e,
|
|
1680
|
+
l,
|
|
1681
|
+
s
|
|
1682
|
+
]), S = T(() => {
|
|
1683
|
+
c(""), p(""), u("eq"), e.clearFilter();
|
|
1684
|
+
}, [e]);
|
|
1685
|
+
return /* @__PURE__ */ N(f, {
|
|
1686
|
+
component: `${n}.filter.cell.input`,
|
|
1687
|
+
ai: l === "between" ? "start" : "center",
|
|
1688
|
+
gap: 1,
|
|
1689
|
+
children: [/* @__PURE__ */ N(v, {
|
|
1690
|
+
value: l,
|
|
1691
|
+
variant: "compact",
|
|
1692
|
+
onChange: (e) => e && b(e),
|
|
1693
|
+
minWidth: 6,
|
|
1694
|
+
hideIcon: !0,
|
|
1695
|
+
b: 0,
|
|
1696
|
+
bgColor: "transparent",
|
|
1697
|
+
focus: { outline: 0 },
|
|
1698
|
+
props: {
|
|
1699
|
+
tabIndex: -1,
|
|
1700
|
+
"aria-label": `Comparison for ${r}`
|
|
1701
|
+
},
|
|
1702
|
+
children: [
|
|
1703
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1704
|
+
value: "eq",
|
|
1705
|
+
children: "="
|
|
1706
|
+
}),
|
|
1707
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1708
|
+
value: "ne",
|
|
1709
|
+
children: "≠"
|
|
1710
|
+
}),
|
|
1711
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1712
|
+
value: "gt",
|
|
1713
|
+
children: ">"
|
|
1714
|
+
}),
|
|
1715
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1716
|
+
value: "gte",
|
|
1717
|
+
children: "≥"
|
|
1718
|
+
}),
|
|
1719
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1720
|
+
value: "lt",
|
|
1721
|
+
children: "<"
|
|
1722
|
+
}),
|
|
1723
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1724
|
+
value: "lte",
|
|
1725
|
+
children: "≤"
|
|
1726
|
+
}),
|
|
1727
|
+
/* @__PURE__ */ M(v.Item, {
|
|
1728
|
+
value: "between",
|
|
1729
|
+
children: "↔"
|
|
1730
|
+
})
|
|
1731
|
+
]
|
|
1732
|
+
}), l === "between" ? /* @__PURE__ */ N(f, {
|
|
1733
|
+
d: "column",
|
|
1734
|
+
gap: 1,
|
|
1735
|
+
flex1: !0,
|
|
1736
|
+
children: [/* @__PURE__ */ N(f, {
|
|
1737
|
+
ai: "center",
|
|
1738
|
+
position: "relative",
|
|
1739
|
+
flex1: !0,
|
|
1740
|
+
children: [/* @__PURE__ */ M(g, {
|
|
1741
|
+
type: "number",
|
|
1742
|
+
variant: "compact",
|
|
1743
|
+
placeholder: _?.placeholder ?? "From",
|
|
1744
|
+
value: s,
|
|
1745
|
+
onChange: y,
|
|
1746
|
+
width: "fit",
|
|
1747
|
+
step: _?.step,
|
|
1748
|
+
b: 0,
|
|
1749
|
+
bgColor: "transparent",
|
|
1750
|
+
focus: { outline: 0 },
|
|
1751
|
+
props: {
|
|
1752
|
+
tabIndex: -1,
|
|
1753
|
+
"aria-label": `Filter ${r} from`
|
|
1754
|
+
}
|
|
1755
|
+
}), (s !== "" || d !== "") && /* @__PURE__ */ M(Qe, {
|
|
1756
|
+
columnName: r,
|
|
1757
|
+
onClear: S
|
|
1758
|
+
})]
|
|
1759
|
+
}), /* @__PURE__ */ M(f, {
|
|
1760
|
+
ai: "center",
|
|
1761
|
+
flex1: !0,
|
|
1762
|
+
children: /* @__PURE__ */ M(g, {
|
|
1763
|
+
type: "number",
|
|
1764
|
+
variant: "compact",
|
|
1765
|
+
placeholder: "To",
|
|
1766
|
+
value: d,
|
|
1767
|
+
onChange: x,
|
|
1768
|
+
width: "fit",
|
|
1769
|
+
step: _?.step,
|
|
1770
|
+
b: 0,
|
|
1771
|
+
bgColor: "transparent",
|
|
1772
|
+
focus: { outline: 0 },
|
|
1773
|
+
props: {
|
|
1774
|
+
tabIndex: -1,
|
|
1775
|
+
"aria-label": `Filter ${r} to`
|
|
1776
|
+
}
|
|
1777
|
+
})
|
|
1778
|
+
})]
|
|
1779
|
+
}) : /* @__PURE__ */ N(f, {
|
|
1780
|
+
ai: "center",
|
|
1781
|
+
position: "relative",
|
|
1782
|
+
flex1: !0,
|
|
1783
|
+
children: [/* @__PURE__ */ M(g, {
|
|
1784
|
+
type: "number",
|
|
1785
|
+
variant: "compact",
|
|
1786
|
+
placeholder: _?.placeholder ?? "Value",
|
|
1787
|
+
value: s,
|
|
1788
|
+
onChange: y,
|
|
1789
|
+
width: "fit",
|
|
1790
|
+
step: _?.step,
|
|
1791
|
+
b: 0,
|
|
1792
|
+
bgColor: "transparent",
|
|
1793
|
+
focus: { outline: 0 },
|
|
1794
|
+
props: {
|
|
1795
|
+
tabIndex: -1,
|
|
1796
|
+
"aria-label": `Filter ${r}`
|
|
1797
|
+
}
|
|
1798
|
+
}), s !== "" && /* @__PURE__ */ M(Qe, {
|
|
1799
|
+
columnName: r,
|
|
1800
|
+
onClear: S
|
|
1801
|
+
})]
|
|
1802
|
+
})]
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
function tt({ column: e }) {
|
|
1806
|
+
let { currentFilter: t } = e, { componentName: n } = e.grid, i = e.header ?? e.key, a = t?.type === "multiselect" ? t.values : [], o = e.filterOptions, s = T((t, n) => {
|
|
1807
|
+
e.setMultiselectFilter(n);
|
|
1808
|
+
}, [e]);
|
|
1809
|
+
return /* @__PURE__ */ M(f, {
|
|
1810
|
+
component: `${n}.filter.cell.input`,
|
|
1811
|
+
children: /* @__PURE__ */ N(v, {
|
|
1812
|
+
multiple: !0,
|
|
1813
|
+
showCheckbox: !0,
|
|
1814
|
+
isSearchable: !0,
|
|
1815
|
+
searchPlaceholder: "Search...",
|
|
1816
|
+
value: a,
|
|
1817
|
+
width: "fit",
|
|
1818
|
+
minWidth: 0,
|
|
1819
|
+
bgColor: "transparent",
|
|
1820
|
+
onChange: s,
|
|
1821
|
+
variant: "compact",
|
|
1822
|
+
b: 0,
|
|
1823
|
+
focus: { outline: 0 },
|
|
1824
|
+
props: {
|
|
1825
|
+
tabIndex: -1,
|
|
1826
|
+
"aria-label": `Filter ${i}`
|
|
1827
|
+
},
|
|
1828
|
+
children: [
|
|
1829
|
+
/* @__PURE__ */ M(v.Display, { children: (t) => t.length === 0 ? /* @__PURE__ */ M(r, {
|
|
1830
|
+
tag: "span",
|
|
1831
|
+
color: "gray-400",
|
|
1832
|
+
children: e.filterConfig?.placeholder ?? "Select..."
|
|
1833
|
+
}) : t.length === 1 ? o.find((e) => e.value === t[0])?.label ?? String(t[0]) : `${t.length} selected` }),
|
|
1834
|
+
/* @__PURE__ */ M(v.Unselect, { children: "Clear" }),
|
|
1835
|
+
/* @__PURE__ */ M(v.SelectAll, { children: "Select All" }),
|
|
1836
|
+
o.map((e) => /* @__PURE__ */ M(v.Item, {
|
|
1837
|
+
value: e.value,
|
|
1838
|
+
ai: "center",
|
|
1839
|
+
gap: 2,
|
|
1840
|
+
children: e.label
|
|
1841
|
+
}, String(e.value)))
|
|
1842
|
+
]
|
|
1843
|
+
})
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
function nt(e) {
|
|
1847
|
+
let { column: t } = e, n = t.filterConfig;
|
|
1848
|
+
if (!n) return null;
|
|
1849
|
+
switch (n.type) {
|
|
1850
|
+
case "number": return /* @__PURE__ */ M(et, { column: t });
|
|
1851
|
+
case "multiselect": return /* @__PURE__ */ M(tt, { column: t });
|
|
1852
|
+
default: return /* @__PURE__ */ M($e, { column: t });
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
nt.displayName = "DataGridColumnFilter";
|
|
1856
|
+
//#endregion
|
|
1857
|
+
//#region src/components/dataGrid/components/dataGridFilterCell.tsx
|
|
1858
|
+
function rt(e) {
|
|
1859
|
+
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 } = R()?.cellProps(r, i) ?? {}, b = t.isGrouping || t.isRowNumber || t.isRowSelection;
|
|
1860
|
+
return /* @__PURE__ */ M(f, {
|
|
1861
|
+
ref: _,
|
|
1862
|
+
component: `${n.componentName}.filter.cell`,
|
|
1863
|
+
props: {
|
|
1864
|
+
role: "gridcell",
|
|
1865
|
+
"aria-colindex": i + 1,
|
|
1866
|
+
tabIndex: v,
|
|
1867
|
+
onFocus: y
|
|
1868
|
+
},
|
|
1869
|
+
variant: {
|
|
1870
|
+
isPinned: d,
|
|
1871
|
+
isFirstStartPinned: p,
|
|
1872
|
+
isLastStartPinned: m,
|
|
1873
|
+
isFirstEndPinned: h,
|
|
1874
|
+
isLastEndPinned: g
|
|
1875
|
+
},
|
|
1876
|
+
px: 2,
|
|
1877
|
+
style: {
|
|
1878
|
+
width: `var(${a})`,
|
|
1879
|
+
insetInlineStart: l ? `var(${o})` : void 0,
|
|
1880
|
+
insetInlineEnd: u ? `var(${s})` : void 0
|
|
1881
|
+
},
|
|
1882
|
+
children: !b && c && /* @__PURE__ */ M(nt, { column: t })
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
rt.displayName = "DataGridFilterCell";
|
|
1886
|
+
//#endregion
|
|
1887
|
+
//#region src/components/dataGrid/components/dataGridFilterRow.tsx
|
|
1888
|
+
function it(e) {
|
|
1889
|
+
let { grid: t } = e;
|
|
1890
|
+
if (!t.filter.hasFilterableColumns) return null;
|
|
1891
|
+
let n = t.headerRows.value.length;
|
|
1892
|
+
return /* @__PURE__ */ M(r, {
|
|
1893
|
+
display: "contents",
|
|
1894
|
+
props: {
|
|
1895
|
+
role: "row",
|
|
1896
|
+
"aria-rowindex": n + 1
|
|
1897
|
+
},
|
|
1898
|
+
children: t.columns.value.visibleLeafs.map((e, r) => /* @__PURE__ */ M(rt, {
|
|
1899
|
+
column: e,
|
|
1900
|
+
grid: t,
|
|
1901
|
+
row: n,
|
|
1902
|
+
columnIndex: r
|
|
1903
|
+
}, e.uniqueKey))
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
it.displayName = "DataGridFilterRow";
|
|
1907
|
+
//#endregion
|
|
1908
|
+
//#region src/icons/sortIcon.tsx
|
|
1909
|
+
function at(e) {
|
|
1910
|
+
return /* @__PURE__ */ M(l, {
|
|
1911
|
+
viewBox: "0 0 24 24",
|
|
1912
|
+
width: "1.5rem",
|
|
1913
|
+
...e,
|
|
1914
|
+
children: /* @__PURE__ */ M(c, { d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" })
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
//#endregion
|
|
1918
|
+
//#region src/icons/dotsIcon.tsx
|
|
1919
|
+
function ot(e) {
|
|
1920
|
+
return /* @__PURE__ */ M(l, {
|
|
1921
|
+
viewBox: "0 0 16 16",
|
|
1922
|
+
width: "18",
|
|
1923
|
+
...e,
|
|
1924
|
+
children: /* @__PURE__ */ M(c, {
|
|
1925
|
+
strokeWidth: 4,
|
|
1926
|
+
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"
|
|
1927
|
+
})
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
//#endregion
|
|
1931
|
+
//#region src/icons/groupingIcon.tsx
|
|
1932
|
+
function st(e) {
|
|
1933
|
+
return /* @__PURE__ */ M(l, {
|
|
1934
|
+
viewBox: "0 0 24 24",
|
|
1935
|
+
width: "1.5rem",
|
|
1936
|
+
...e,
|
|
1937
|
+
children: /* @__PURE__ */ M(c, { d: "M3 5h8v2H3V5zm0 6h8v2H3v-2zm0 6h8v2H3v-2zm12-12h6v6h-6V5zm1 1v4h4V6h-4zm-1 7h6v6h-6v-6zm1 1v4h4v-4h-4z" })
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
//#endregion
|
|
1941
|
+
//#region src/icons/pinIcon.tsx
|
|
1942
|
+
function ct(e) {
|
|
1943
|
+
return /* @__PURE__ */ M(l, {
|
|
1944
|
+
viewBox: "0 0 1024 1024",
|
|
1945
|
+
width: "1.5rem",
|
|
1946
|
+
...e,
|
|
1947
|
+
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" })
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
//#endregion
|
|
1951
|
+
//#region src/components/dataGrid/components/dataGridHeaderCellContextMenu.tsx
|
|
1952
|
+
function lt(e) {
|
|
1953
|
+
let t = e.side === "start" ? "Left" : "Right", n = e.side === "start" ? "Right" : "Left";
|
|
1954
|
+
return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N(b, {
|
|
1955
|
+
rtl: { display: "none" },
|
|
1956
|
+
children: ["Pin ", t]
|
|
1957
|
+
}), /* @__PURE__ */ N(b, {
|
|
1958
|
+
ltr: { display: "none" },
|
|
1959
|
+
children: ["Pin ", n]
|
|
1960
|
+
})] });
|
|
1961
|
+
}
|
|
1962
|
+
function ut(e) {
|
|
1963
|
+
let { column: t } = e, { grid: c, isEndAligned: l, header: u, key: p } = t, g = t.headerCell, _ = u ?? p, v = s("datagrid-column-menu"), [y, x] = A(!1), C = k(null), w = k(null), E = k(!1), D = l ? 2 : void 0, ee = l ? void 0 : t.pin === "END" ? 2.5 : 4, O = te(() => {
|
|
1964
|
+
let e = (e) => /* @__PURE__ */ M(b, {
|
|
1965
|
+
component: `${c.componentName}.header.cell.contextMenu.tooltip.item.icon`,
|
|
1966
|
+
children: e
|
|
1967
|
+
}), n = (t) => e(/* @__PURE__ */ M(at, {
|
|
1968
|
+
width: "100%",
|
|
1969
|
+
fill: "currentColor",
|
|
1970
|
+
rotate: t
|
|
1971
|
+
})), i = (t, n) => e(/* @__PURE__ */ M(ct, {
|
|
1972
|
+
width: "100%",
|
|
1973
|
+
fill: "currentColor",
|
|
1974
|
+
rotate: t,
|
|
1975
|
+
rtl: { rotate: n }
|
|
1976
|
+
})), a = e(/* @__PURE__ */ M(st, {
|
|
1977
|
+
width: "100%",
|
|
1978
|
+
fill: "currentColor"
|
|
1979
|
+
})), o = /* @__PURE__ */ M(r, { width: 4 });
|
|
1980
|
+
return [
|
|
1981
|
+
[
|
|
1982
|
+
g.canSortAsc && {
|
|
1983
|
+
key: "sort-asc",
|
|
1984
|
+
icon: n(),
|
|
1985
|
+
label: "Sort Ascending",
|
|
1986
|
+
text: "Sort Ascending",
|
|
1987
|
+
run: () => t.sortColumn("ASC")
|
|
1988
|
+
},
|
|
1989
|
+
g.canSortDesc && {
|
|
1990
|
+
key: "sort-desc",
|
|
1991
|
+
icon: n(180),
|
|
1992
|
+
label: "Sort Descending",
|
|
1993
|
+
text: "Sort Descending",
|
|
1994
|
+
run: () => t.sortColumn("DESC")
|
|
1995
|
+
},
|
|
1996
|
+
g.canClearSort && {
|
|
1997
|
+
key: "sort-clear",
|
|
1998
|
+
icon: o,
|
|
1999
|
+
label: "Clear Sort",
|
|
2000
|
+
text: "Clear Sort",
|
|
2001
|
+
run: () => t.sortColumn(void 0)
|
|
2002
|
+
}
|
|
2003
|
+
],
|
|
2004
|
+
[
|
|
2005
|
+
g.canPinStart && {
|
|
2006
|
+
key: "pin-start",
|
|
2007
|
+
icon: i(0, -90),
|
|
2008
|
+
label: /* @__PURE__ */ M(lt, { side: "start" }),
|
|
2009
|
+
text: "Pin Left",
|
|
2010
|
+
run: () => t.pinColumn("START")
|
|
2011
|
+
},
|
|
2012
|
+
g.canPinEnd && {
|
|
2013
|
+
key: "pin-end",
|
|
2014
|
+
icon: i(-90, 0),
|
|
2015
|
+
label: /* @__PURE__ */ M(lt, { side: "end" }),
|
|
2016
|
+
text: "Pin Right",
|
|
2017
|
+
run: () => t.pinColumn("END")
|
|
2018
|
+
},
|
|
2019
|
+
g.canUnpin && {
|
|
2020
|
+
key: "unpin",
|
|
2021
|
+
icon: o,
|
|
2022
|
+
label: "Unpin",
|
|
2023
|
+
text: "Unpin",
|
|
2024
|
+
run: () => t.pinColumn()
|
|
2025
|
+
}
|
|
2026
|
+
],
|
|
2027
|
+
[g.canGroupBy && {
|
|
2028
|
+
key: "group",
|
|
2029
|
+
icon: a,
|
|
2030
|
+
label: /* @__PURE__ */ N(r, {
|
|
2031
|
+
textWrap: "nowrap",
|
|
2032
|
+
children: ["Group by ", _]
|
|
2033
|
+
}),
|
|
2034
|
+
text: `Group by ${_}`,
|
|
2035
|
+
run: t.toggleGrouping
|
|
2036
|
+
}, g.canUnGroupAll && {
|
|
2037
|
+
key: "ungroup",
|
|
2038
|
+
icon: a,
|
|
2039
|
+
label: /* @__PURE__ */ M(r, {
|
|
2040
|
+
textWrap: "nowrap",
|
|
2041
|
+
children: "Un-Group All"
|
|
2042
|
+
}),
|
|
2043
|
+
text: "Un-Group All",
|
|
2044
|
+
run: c.unGroupAll
|
|
2045
|
+
}]
|
|
2046
|
+
].map((e) => e.filter((e) => e !== !1)).filter((e) => e.length > 0).flatMap((e, t) => e.map((e, n) => ({
|
|
2047
|
+
...e,
|
|
2048
|
+
startsSection: t > 0 && n === 0
|
|
2049
|
+
})));
|
|
2050
|
+
}, [
|
|
2051
|
+
t,
|
|
2052
|
+
_,
|
|
2053
|
+
c,
|
|
2054
|
+
g
|
|
2055
|
+
]), j = T((e = !0) => {
|
|
2056
|
+
E.current = !1, x(!1), e && C.current?.focus();
|
|
2057
|
+
}, []), P = o({
|
|
2058
|
+
count: O.length,
|
|
2059
|
+
textOf: (e) => O[e]?.text ?? "",
|
|
2060
|
+
onSelect: (e) => {
|
|
2061
|
+
O[e]?.run(), j();
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
a({
|
|
2065
|
+
enabled: y,
|
|
2066
|
+
inside: [C, w],
|
|
2067
|
+
onDismiss: () => j()
|
|
2068
|
+
}), i({
|
|
2069
|
+
enabled: y,
|
|
2070
|
+
returnTo: C
|
|
2071
|
+
});
|
|
2072
|
+
let F = P.setActiveIndex, ne = P.activeItem, re = T(() => {
|
|
2073
|
+
F(0, { reason: "programmatic" }), E.current = !0, x(!0);
|
|
2074
|
+
}, [F]);
|
|
2075
|
+
return n(() => {
|
|
2076
|
+
if (!E.current) return;
|
|
2077
|
+
let e = ne();
|
|
2078
|
+
e && (E.current = !1, e.focus());
|
|
2079
|
+
}), /* @__PURE__ */ N(f, {
|
|
2080
|
+
position: "absolute",
|
|
2081
|
+
insetStart: D,
|
|
2082
|
+
insetEnd: ee,
|
|
2083
|
+
top: "1/2",
|
|
2084
|
+
translateY: -3,
|
|
2085
|
+
ai: "center",
|
|
2086
|
+
children: [/* @__PURE__ */ M(d, {
|
|
2087
|
+
ref: C,
|
|
2088
|
+
component: `${c.componentName}.header.cell.contextMenu`,
|
|
2089
|
+
onClick: () => y ? j(!1) : re(),
|
|
2090
|
+
variant: g.contextMenuButtonVariant,
|
|
2091
|
+
type: "button",
|
|
2092
|
+
props: {
|
|
2093
|
+
tabIndex: -1,
|
|
2094
|
+
"aria-label": `Column options for ${_}`,
|
|
2095
|
+
"aria-haspopup": "menu",
|
|
2096
|
+
"aria-expanded": y,
|
|
2097
|
+
"aria-controls": y ? v : void 0
|
|
2098
|
+
},
|
|
2099
|
+
children: /* @__PURE__ */ M(b, {
|
|
2100
|
+
component: `${c.componentName}.header.cell.contextMenu.icon`,
|
|
2101
|
+
children: /* @__PURE__ */ M(ot, { fill: "currentColor" })
|
|
2102
|
+
})
|
|
2103
|
+
}), /* @__PURE__ */ M(h, {
|
|
2104
|
+
present: y,
|
|
2105
|
+
children: (e) => /* @__PURE__ */ M(m, {
|
|
2106
|
+
component: `${c.componentName}.header.cell.contextMenu.tooltip`,
|
|
2107
|
+
variant: { closed: !e.present },
|
|
2108
|
+
ref: w,
|
|
2109
|
+
contentRef: e.ref,
|
|
2110
|
+
anchor: C,
|
|
2111
|
+
side: "bottom",
|
|
2112
|
+
align: "end",
|
|
2113
|
+
matchWidth: !1,
|
|
2114
|
+
id: v,
|
|
2115
|
+
props: {
|
|
2116
|
+
role: "menu",
|
|
2117
|
+
"aria-label": `Column options for ${_}`,
|
|
2118
|
+
onKeyDown: P.onKeyDown,
|
|
2119
|
+
...e.props
|
|
2120
|
+
},
|
|
2121
|
+
children: O.map((e, t) => {
|
|
2122
|
+
let { ref: n, tabIndex: i, onFocus: a } = P.itemProps(t);
|
|
2123
|
+
return /* @__PURE__ */ N(S, { children: [e.startsSection && /* @__PURE__ */ M(r, {
|
|
2124
|
+
bb: 1,
|
|
2125
|
+
my: 2,
|
|
2126
|
+
borderColor: "gray-300",
|
|
2127
|
+
component: `${c.componentName}.header.cell.contextMenu.tooltip.item.separator`
|
|
2128
|
+
}), /* @__PURE__ */ N(d, {
|
|
2129
|
+
component: `${c.componentName}.header.cell.contextMenu.tooltip.item`,
|
|
2130
|
+
ref: n,
|
|
2131
|
+
type: "button",
|
|
2132
|
+
onClick: (t) => {
|
|
2133
|
+
t.stopPropagation(), e.run(), j();
|
|
2134
|
+
},
|
|
2135
|
+
props: {
|
|
2136
|
+
role: "menuitem",
|
|
2137
|
+
tabIndex: i,
|
|
2138
|
+
onFocus: a
|
|
2139
|
+
},
|
|
2140
|
+
children: [e.icon, e.label]
|
|
2141
|
+
})] }, e.key);
|
|
2142
|
+
})
|
|
2143
|
+
})
|
|
2144
|
+
})]
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
ut.displayName = "DataGridHeaderCellContextMenu";
|
|
2148
|
+
//#endregion
|
|
2149
|
+
//#region src/components/dataGrid/components/dataGridHeaderCellResizer.tsx
|
|
2150
|
+
var X = (e) => "touches" in e ? e.touches[0]?.pageX ?? 0 : e.pageX, dt = 16, ft = 150;
|
|
2151
|
+
function pt(e) {
|
|
2152
|
+
let t = e.sizingElement;
|
|
2153
|
+
t && Object.entries(e.sizes.value).forEach(([e, n]) => t.style.setProperty(e, n));
|
|
2154
|
+
}
|
|
2155
|
+
function mt(e) {
|
|
2156
|
+
let { column: t, controls: n } = e, i = t.grid.resizerStyle, a = t.headerCell, o = T((e) => {
|
|
2157
|
+
let { grid: n } = t;
|
|
2158
|
+
e.type === "mousedown" && e.preventDefault(), t.beginResize(X(e.nativeEvent));
|
|
2159
|
+
let r = new AbortController(), { signal: i } = r, a = 0, o = X(e.nativeEvent), s = () => {
|
|
2160
|
+
t.applyResize(o), pt(n);
|
|
2161
|
+
}, c = n.resizeMode === "instant" ? (e) => {
|
|
2162
|
+
o = X(e), s();
|
|
2163
|
+
} : (e) => {
|
|
2164
|
+
o = X(e), a ||= requestAnimationFrame(() => {
|
|
2165
|
+
a = 0, s();
|
|
2166
|
+
});
|
|
2167
|
+
}, l = () => {
|
|
2168
|
+
r.abort(), a && cancelAnimationFrame(a), s(), t.endResize();
|
|
2169
|
+
};
|
|
2170
|
+
window.addEventListener("mousemove", c, { signal: i }), window.addEventListener("touchmove", c, { signal: i }), window.addEventListener("mouseup", l, { signal: i }), window.addEventListener("touchend", l, { signal: i });
|
|
2171
|
+
}, [t]), s = k(void 0), c = k(0), l = T(() => {
|
|
2172
|
+
let { grid: e } = t;
|
|
2173
|
+
if (e.resizeMode === "instant") {
|
|
2174
|
+
pt(e);
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
c.current ||= requestAnimationFrame(() => {
|
|
2178
|
+
c.current = 0, pt(e);
|
|
2179
|
+
});
|
|
2180
|
+
}, [t]), u = T(() => {
|
|
2181
|
+
s.current !== void 0 && (clearTimeout(s.current), s.current = void 0, c.current &&= (cancelAnimationFrame(c.current), 0), t.endResize());
|
|
2182
|
+
}, [t]);
|
|
2183
|
+
D(() => () => {
|
|
2184
|
+
clearTimeout(s.current), c.current && cancelAnimationFrame(c.current);
|
|
2185
|
+
}, []);
|
|
2186
|
+
let d = T((e) => {
|
|
2187
|
+
switch (e.key) {
|
|
2188
|
+
case "ArrowRight":
|
|
2189
|
+
t.moveResizer(dt);
|
|
2190
|
+
break;
|
|
2191
|
+
case "ArrowLeft":
|
|
2192
|
+
t.moveResizer(-16);
|
|
2193
|
+
break;
|
|
2194
|
+
case "Home":
|
|
2195
|
+
t.resizeWidthTo(a.minWidth);
|
|
2196
|
+
break;
|
|
2197
|
+
case "End":
|
|
2198
|
+
t.resizeWidthTo(a.maxWidth);
|
|
2199
|
+
break;
|
|
2200
|
+
default: return;
|
|
2201
|
+
}
|
|
2202
|
+
e.preventDefault(), l(), clearTimeout(s.current), s.current = setTimeout(u, ft);
|
|
2203
|
+
}, [
|
|
2204
|
+
t,
|
|
2205
|
+
u,
|
|
2206
|
+
a,
|
|
2207
|
+
l
|
|
2208
|
+
]);
|
|
2209
|
+
return /* @__PURE__ */ M(f, {
|
|
2210
|
+
height: "fit",
|
|
2211
|
+
ai: "center",
|
|
2212
|
+
position: "absolute",
|
|
2213
|
+
insetEnd: t.pin === "END" ? void 0 : 0,
|
|
2214
|
+
insetStart: t.pin === "END" ? 0 : void 0,
|
|
2215
|
+
py: 3,
|
|
2216
|
+
children: /* @__PURE__ */ M(r, {
|
|
2217
|
+
cursor: "col-resize",
|
|
2218
|
+
px: .75,
|
|
2219
|
+
mt: -6,
|
|
2220
|
+
className: "resizer",
|
|
2221
|
+
height: "fit",
|
|
2222
|
+
props: {
|
|
2223
|
+
onMouseDown: o,
|
|
2224
|
+
onTouchStart: o
|
|
2225
|
+
},
|
|
2226
|
+
children: /* @__PURE__ */ M(r, {
|
|
2227
|
+
component: `${t.grid.componentName}.header.cell.resizer`,
|
|
2228
|
+
opacity: i === "visible" ? void 0 : 0,
|
|
2229
|
+
group: i === "hover" ? { "header-cell/hover": { opacity: 1 } } : void 0,
|
|
2230
|
+
props: {
|
|
2231
|
+
role: "separator",
|
|
2232
|
+
"aria-label": a.resizerLabel,
|
|
2233
|
+
"aria-controls": n,
|
|
2234
|
+
"aria-orientation": "vertical",
|
|
2235
|
+
"aria-valuenow": a.width,
|
|
2236
|
+
"aria-valuemin": a.minWidth,
|
|
2237
|
+
"aria-valuemax": a.maxWidth,
|
|
2238
|
+
"aria-valuetext": `${a.width} pixels`,
|
|
2239
|
+
tabIndex: -1,
|
|
2240
|
+
onKeyDown: d,
|
|
2241
|
+
onKeyUp: u
|
|
2242
|
+
}
|
|
2243
|
+
})
|
|
2244
|
+
})
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
mt.displayName = "DataGridHeaderCellResizer";
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/components/dataGrid/components/dataGridHeaderCell.tsx
|
|
2250
|
+
function ht(e) {
|
|
2251
|
+
let { column: t, row: n, columnIndex: i } = e, { grid: a } = t, { isStartPinned: o, isEndPinned: c } = t.pinFlags.value, l = t.headerCell, { isSortable: u, showResizer: d, showContextMenu: m, paddingStart: h, paddingEnd: g } = l, { ref: _, tabIndex: v, onFocus: b } = R()?.cellProps(n, i) ?? {}, x = s("datagrid-columnheader"), S = T(() => {
|
|
2252
|
+
a.toggleSelectAllRows();
|
|
2253
|
+
}, [a]), C = t.isRowSelection ? /* @__PURE__ */ M(p, {
|
|
2254
|
+
variant: "datagrid",
|
|
2255
|
+
m: 1,
|
|
2256
|
+
indeterminate: a.someRowsSelected && !a.allRowsSelected,
|
|
2257
|
+
checked: a.allRowsSelected,
|
|
2258
|
+
onChange: S,
|
|
2259
|
+
props: {
|
|
2260
|
+
tabIndex: -1,
|
|
2261
|
+
"aria-label": "Select all rows"
|
|
2262
|
+
}
|
|
2263
|
+
}) : l.hiddenLabel ? /* @__PURE__ */ M(y, {
|
|
2264
|
+
tag: "span",
|
|
2265
|
+
children: l.hiddenLabel
|
|
2266
|
+
}) : l.label;
|
|
2267
|
+
return /* @__PURE__ */ M(f, {
|
|
2268
|
+
ref: _,
|
|
2269
|
+
id: x,
|
|
2270
|
+
props: {
|
|
2271
|
+
role: "columnheader",
|
|
2272
|
+
"aria-colindex": l.columnIndex,
|
|
2273
|
+
"aria-colspan": l.columnSpan,
|
|
2274
|
+
"aria-rowspan": l.rowSpan,
|
|
2275
|
+
"aria-sort": l.ariaSort,
|
|
2276
|
+
tabIndex: v,
|
|
2277
|
+
onFocus: b
|
|
2278
|
+
},
|
|
2279
|
+
className: "header-cell",
|
|
2280
|
+
component: `${a.componentName}.header.cell`,
|
|
2281
|
+
variant: l.variant,
|
|
2282
|
+
gridRow: t.gridRows,
|
|
2283
|
+
gridColumn: l.gridColumn,
|
|
2284
|
+
style: {
|
|
2285
|
+
width: `var(${t.widthVarName})`,
|
|
2286
|
+
insetInlineStart: o ? `var(${t.inlineStartVarName})` : void 0,
|
|
2287
|
+
insetInlineEnd: c ? `var(${t.inlineEndVarName})` : void 0
|
|
2288
|
+
},
|
|
2289
|
+
children: /* @__PURE__ */ N(j, { children: [
|
|
2290
|
+
/* @__PURE__ */ M(f, {
|
|
2291
|
+
width: "fit",
|
|
2292
|
+
height: "fit",
|
|
2293
|
+
jc: t.align,
|
|
2294
|
+
props: { onClick: u ? () => t.sortColumn() : void 0 },
|
|
2295
|
+
children: /* @__PURE__ */ N(f, {
|
|
2296
|
+
overflow: "hidden",
|
|
2297
|
+
position: t.isLeaf ? void 0 : "sticky",
|
|
2298
|
+
ai: "center",
|
|
2299
|
+
transition: "none",
|
|
2300
|
+
ps: h,
|
|
2301
|
+
pe: g,
|
|
2302
|
+
style: { insetInlineStart: t.pin ? void 0 : `var(${a.inlineStartEdgeVarName})` },
|
|
2303
|
+
children: [
|
|
2304
|
+
/* @__PURE__ */ M(r, {
|
|
2305
|
+
overflow: "hidden",
|
|
2306
|
+
textOverflow: "ellipsis",
|
|
2307
|
+
textWrap: "nowrap",
|
|
2308
|
+
children: C
|
|
2309
|
+
}),
|
|
2310
|
+
l.isSorted && /* @__PURE__ */ M(r, {
|
|
2311
|
+
ps: (t.inlineWidth ?? 0) < 58 ? 0 : 2,
|
|
2312
|
+
children: /* @__PURE__ */ M(at, {
|
|
2313
|
+
width: "16px",
|
|
2314
|
+
rotate: l.sortDirection === "ASC" ? 0 : 180,
|
|
2315
|
+
fill: "currentColor"
|
|
2316
|
+
})
|
|
2317
|
+
}),
|
|
2318
|
+
m && /* @__PURE__ */ M(r, { minWidth: t.isEndAligned ? 4 : 10 })
|
|
2319
|
+
]
|
|
2320
|
+
})
|
|
2321
|
+
}),
|
|
2322
|
+
d && /* @__PURE__ */ M(mt, {
|
|
2323
|
+
column: t,
|
|
2324
|
+
controls: x
|
|
2325
|
+
}),
|
|
2326
|
+
m && /* @__PURE__ */ M(ut, { column: t })
|
|
2327
|
+
] })
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
ht.displayName = "DataGridHeaderCell";
|
|
2331
|
+
//#endregion
|
|
2332
|
+
//#region src/components/dataGrid/components/dataGridHeader.tsx
|
|
2333
|
+
function gt(e) {
|
|
2334
|
+
let { grid: t } = e;
|
|
2335
|
+
return /* @__PURE__ */ N(_, {
|
|
2336
|
+
component: `${t.componentName}.header`,
|
|
2337
|
+
props: { role: "rowgroup" },
|
|
2338
|
+
style: { gridTemplateColumns: t.gridTemplateColumns.value },
|
|
2339
|
+
children: [t.headerRows.value.map((e, t) => /* @__PURE__ */ M(r, {
|
|
2340
|
+
display: "contents",
|
|
2341
|
+
props: {
|
|
2342
|
+
role: "row",
|
|
2343
|
+
"aria-rowindex": t + 1
|
|
2344
|
+
},
|
|
2345
|
+
children: e.map((e, n) => /* @__PURE__ */ M(ht, {
|
|
2346
|
+
column: e,
|
|
2347
|
+
row: t,
|
|
2348
|
+
columnIndex: n
|
|
2349
|
+
}, e.uniqueKey))
|
|
2350
|
+
}, t)), /* @__PURE__ */ M(it, { grid: t })]
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
gt.displayName = "DataGridHeader";
|
|
2354
|
+
//#endregion
|
|
2355
|
+
//#region src/components/dataGrid/components/dataGridLoader.tsx
|
|
2356
|
+
function _t(e) {
|
|
2357
|
+
let { grid: t } = e;
|
|
2358
|
+
return /* @__PURE__ */ M(r, {
|
|
2359
|
+
component: `${t.componentName}.loader`,
|
|
2360
|
+
props: { "aria-hidden": !0 },
|
|
2361
|
+
children: /* @__PURE__ */ M(r, {
|
|
2362
|
+
component: `${t.componentName}.loader.track`,
|
|
2363
|
+
style: { height: 3 },
|
|
2364
|
+
children: /* @__PURE__ */ M(r, {
|
|
2365
|
+
component: `${t.componentName}.loader.track.bar`,
|
|
2366
|
+
width: "2/5"
|
|
2367
|
+
})
|
|
2368
|
+
})
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
_t.displayName = "DataGridLoader";
|
|
2372
|
+
//#endregion
|
|
2373
|
+
//#region src/components/dataGrid/components/dataGridContent.tsx
|
|
2374
|
+
function vt(e) {
|
|
2375
|
+
let { grid: t } = e, i = k(null), [a, o] = A(0), s = k(null), c = T((e) => {
|
|
2376
|
+
s.current !== null && cancelAnimationFrame(s.current), s.current = requestAnimationFrame(() => {
|
|
2377
|
+
o(e.target.scrollTop), s.current = null;
|
|
2378
|
+
});
|
|
2379
|
+
}, []), l = Ce({
|
|
2380
|
+
grid: t,
|
|
2381
|
+
scrollerRef: i,
|
|
2382
|
+
scrollTop: a,
|
|
2383
|
+
onScrollTo: o
|
|
2384
|
+
}), { source: u } = t, { queryVersion: d } = u;
|
|
2385
|
+
return n(() => {
|
|
2386
|
+
u.enabled && i.current && (i.current.scrollTop = 0);
|
|
2387
|
+
}, [u, d]), D(() => {
|
|
2388
|
+
if (!u.enabled) return;
|
|
2389
|
+
let { startIndex: e, take: n } = t.viewport.window(i.current?.scrollTop ?? 0);
|
|
2390
|
+
u.request(e, e + n);
|
|
2391
|
+
}, [
|
|
2392
|
+
t,
|
|
2393
|
+
u,
|
|
2394
|
+
d,
|
|
2395
|
+
a,
|
|
2396
|
+
t.totalRowCount,
|
|
2397
|
+
t.page,
|
|
2398
|
+
t.pageSize,
|
|
2399
|
+
t.expansionVersion
|
|
2400
|
+
]), n(() => {
|
|
2401
|
+
let e = i.current;
|
|
2402
|
+
if (!e) return;
|
|
2403
|
+
let n = new ResizeObserver(() => t.setContainerWidth(e.clientWidth));
|
|
2404
|
+
return n.observe(e), () => n.disconnect();
|
|
2405
|
+
}, [t]), t.hasVisibleColumns ? /* @__PURE__ */ M(le.Provider, {
|
|
2406
|
+
value: l,
|
|
2407
|
+
children: /* @__PURE__ */ N(r, {
|
|
2408
|
+
ref: i,
|
|
2409
|
+
component: `${t.componentName}.content`,
|
|
2410
|
+
overflowX: "auto",
|
|
2411
|
+
scrollbarGutter: t.viewport.showAll ? void 0 : "stable",
|
|
2412
|
+
style: { willChange: "scroll-position" },
|
|
2413
|
+
props: {
|
|
2414
|
+
role: t.tree.enabled ? "treegrid" : "grid",
|
|
2415
|
+
"aria-rowcount": l.rowCount,
|
|
2416
|
+
"aria-colcount": l.columnCount,
|
|
2417
|
+
"aria-multiselectable": t.props.def.rowSelection ? !0 : void 0,
|
|
2418
|
+
"aria-labelledby": t.props.def.title ? t.titleId : void 0,
|
|
2419
|
+
"aria-busy": t.props.loading || u.isLoading ? !0 : void 0,
|
|
2420
|
+
onScroll: c,
|
|
2421
|
+
onKeyDown: l.onKeyDown
|
|
2422
|
+
},
|
|
2423
|
+
children: [
|
|
2424
|
+
/* @__PURE__ */ M(gt, { grid: t }),
|
|
2425
|
+
(t.props.loading || u.isLoading) && /* @__PURE__ */ M(_t, { grid: t }),
|
|
2426
|
+
/* @__PURE__ */ M(Xe, {
|
|
2427
|
+
grid: t,
|
|
2428
|
+
scrollTop: a
|
|
2429
|
+
})
|
|
2430
|
+
]
|
|
2431
|
+
})
|
|
2432
|
+
}) : /* @__PURE__ */ M(Ze, { grid: t });
|
|
2433
|
+
}
|
|
2434
|
+
vt.displayName = "DataGridContent";
|
|
2435
|
+
//#endregion
|
|
2436
|
+
//#region src/components/dataGrid/components/dataGridDataSourceError.tsx
|
|
2437
|
+
function yt(e) {
|
|
2438
|
+
let { grid: t } = e, { error: n } = t.source;
|
|
2439
|
+
if (n === void 0) return null;
|
|
2440
|
+
let i = n instanceof Error && n.message ? n.message : "Could not load rows.";
|
|
2441
|
+
return /* @__PURE__ */ N(f, {
|
|
2442
|
+
component: `${t.componentName}.error`,
|
|
2443
|
+
props: { role: "alert" },
|
|
2444
|
+
children: [/* @__PURE__ */ M(r, {
|
|
2445
|
+
component: `${t.componentName}.error.message`,
|
|
2446
|
+
children: i
|
|
2447
|
+
}), /* @__PURE__ */ M(d, {
|
|
2448
|
+
component: `${t.componentName}.error.retry`,
|
|
2449
|
+
type: "button",
|
|
2450
|
+
onClick: t.source.retry,
|
|
2451
|
+
children: "Retry"
|
|
2452
|
+
})]
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
yt.displayName = "DataGridDataSourceError";
|
|
2456
|
+
//#endregion
|
|
2457
|
+
//#region src/components/dataGrid/components/dataGridColumnGroups.tsx
|
|
2458
|
+
function bt(e) {
|
|
2459
|
+
let { grid: t } = e;
|
|
2460
|
+
return t.groupColumns.size === 0 ? null : /* @__PURE__ */ N(f, {
|
|
2461
|
+
component: `${t.componentName}.topBar.columnGroups`,
|
|
2462
|
+
children: [/* @__PURE__ */ M(b, {
|
|
2463
|
+
component: `${t.componentName}.topBar.columnGroups.icon`,
|
|
2464
|
+
children: /* @__PURE__ */ M(st, {
|
|
2465
|
+
width: "100%",
|
|
2466
|
+
fill: "currentColor"
|
|
2467
|
+
})
|
|
2468
|
+
}), t.groupedColumns.map((e) => /* @__PURE__ */ N(x.Fragment, { children: [/* @__PURE__ */ M(J, {
|
|
2469
|
+
fill: "currentColor",
|
|
2470
|
+
width: "14px",
|
|
2471
|
+
height: "14px",
|
|
2472
|
+
rotate: -90
|
|
2473
|
+
}), /* @__PURE__ */ N(f, {
|
|
2474
|
+
component: `${t.componentName}.topBar.columnGroups.item`,
|
|
2475
|
+
children: [e.header ?? e.key, /* @__PURE__ */ M(d, {
|
|
2476
|
+
component: `${t.componentName}.topBar.columnGroups.item.icon`,
|
|
2477
|
+
onClick: () => t.toggleGrouping(e.key),
|
|
2478
|
+
props: { "aria-label": `Stop grouping by ${e.header ?? e.key}` },
|
|
2479
|
+
children: /* @__PURE__ */ M(r, {
|
|
2480
|
+
fontSize: 10,
|
|
2481
|
+
color: "gray-400",
|
|
2482
|
+
hover: { color: "gray-600" },
|
|
2483
|
+
children: "✕"
|
|
2484
|
+
})
|
|
2485
|
+
})]
|
|
2486
|
+
})] }, e.key))]
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
bt.displayName = "DataGridColumnGroups";
|
|
2490
|
+
//#endregion
|
|
2491
|
+
//#region src/components/dataGrid/components/dataGridExport.tsx
|
|
2492
|
+
function xt(e) {
|
|
2493
|
+
let { grid: t } = e, n = t.exportConfig, r = T(() => void t.exportCsv(n).catch(() => void 0), [t, n]), i = T(() => void t.exportXlsx(n).catch(() => void 0), [t, n]);
|
|
2494
|
+
return n ? /* @__PURE__ */ N(f, {
|
|
2495
|
+
component: `${t.componentName}.topBar.export`,
|
|
2496
|
+
ai: "center",
|
|
2497
|
+
gap: 2,
|
|
2498
|
+
children: [n.csv !== !1 && /* @__PURE__ */ M(St, {
|
|
2499
|
+
componentName: t.componentName,
|
|
2500
|
+
onClick: r,
|
|
2501
|
+
label: "Export CSV",
|
|
2502
|
+
children: "CSV"
|
|
2503
|
+
}), n.xlsx !== !1 && /* @__PURE__ */ M(St, {
|
|
2504
|
+
componentName: t.componentName,
|
|
2505
|
+
onClick: i,
|
|
2506
|
+
label: "Export Excel",
|
|
2507
|
+
children: "Excel"
|
|
2508
|
+
})]
|
|
2509
|
+
}) : null;
|
|
2510
|
+
}
|
|
2511
|
+
xt.displayName = "DataGridExport";
|
|
2512
|
+
function St(e) {
|
|
2513
|
+
let { componentName: t, onClick: n, label: r, children: i } = e;
|
|
2514
|
+
return /* @__PURE__ */ N(d, {
|
|
2515
|
+
component: `${t}.topBar.export.button`,
|
|
2516
|
+
onClick: n,
|
|
2517
|
+
props: { "aria-label": r },
|
|
2518
|
+
children: [/* @__PURE__ */ N(l, {
|
|
2519
|
+
viewBox: "0 0 20 20",
|
|
2520
|
+
width: 16,
|
|
2521
|
+
height: 16,
|
|
2522
|
+
fill: "none",
|
|
2523
|
+
stroke: "currentColor",
|
|
2524
|
+
strokeWidth: 1.6,
|
|
2525
|
+
children: [/* @__PURE__ */ M(c, {
|
|
2526
|
+
d: "M10 3v9m0 0 3.5-3.5M10 12 6.5 8.5",
|
|
2527
|
+
strokeLinecap: "round",
|
|
2528
|
+
strokeLinejoin: "round"
|
|
2529
|
+
}), /* @__PURE__ */ M(c, {
|
|
2530
|
+
d: "M3.5 13.5v2a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-2",
|
|
2531
|
+
strokeLinecap: "round"
|
|
2532
|
+
})]
|
|
2533
|
+
}), i]
|
|
2534
|
+
});
|
|
2535
|
+
}
|
|
2536
|
+
//#endregion
|
|
2537
|
+
//#region src/icons/searchIcon.tsx
|
|
2538
|
+
function Ct(e) {
|
|
2539
|
+
return /* @__PURE__ */ M(l, {
|
|
2540
|
+
viewBox: "0 0 488.4 488.4",
|
|
2541
|
+
width: "1.5rem",
|
|
2542
|
+
...e,
|
|
2543
|
+
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" })
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2546
|
+
//#endregion
|
|
2547
|
+
//#region src/components/dataGrid/components/dataGridGlobalFilter.tsx
|
|
2548
|
+
function wt(e) {
|
|
2549
|
+
let { grid: t } = e, [n, i] = A(t.globalFilterValue), a = k(null);
|
|
2550
|
+
D(() => () => {
|
|
2551
|
+
a.current && clearTimeout(a.current);
|
|
2552
|
+
}, []);
|
|
2553
|
+
let o = T((e) => {
|
|
2554
|
+
let n = e.target.value;
|
|
2555
|
+
i(n), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
2556
|
+
t.filter.setGlobalFilter(n), a.current = null;
|
|
2557
|
+
}, 300);
|
|
2558
|
+
}, [t]), s = T(() => {
|
|
2559
|
+
i(""), t.filter.setGlobalFilter("");
|
|
2560
|
+
}, [t]), { filtered: c, total: l } = t.filter.filterStats, u = t.filter.hasActiveFilters && c !== l;
|
|
2561
|
+
return /* @__PURE__ */ N(f, {
|
|
2562
|
+
component: `${t.componentName}.topBar.globalFilter`,
|
|
2563
|
+
children: [u && /* @__PURE__ */ N(r, {
|
|
2564
|
+
component: `${t.componentName}.topBar.globalFilter.stats`,
|
|
2565
|
+
children: [
|
|
2566
|
+
c,
|
|
2567
|
+
"/",
|
|
2568
|
+
l
|
|
2569
|
+
]
|
|
2570
|
+
}), /* @__PURE__ */ N(f, {
|
|
2571
|
+
position: "relative",
|
|
2572
|
+
ai: "center",
|
|
2573
|
+
children: [
|
|
2574
|
+
/* @__PURE__ */ M(f, {
|
|
2575
|
+
position: "absolute",
|
|
2576
|
+
insetStart: 3,
|
|
2577
|
+
pointerEvents: "none",
|
|
2578
|
+
color: "gray-400",
|
|
2579
|
+
theme: { dark: { color: "gray-500" } },
|
|
2580
|
+
children: /* @__PURE__ */ M(Ct, {
|
|
2581
|
+
fill: "currentColor",
|
|
2582
|
+
width: "14px"
|
|
2583
|
+
})
|
|
2584
|
+
}),
|
|
2585
|
+
/* @__PURE__ */ M(g, {
|
|
2586
|
+
placeholder: "Search...",
|
|
2587
|
+
variant: "compact",
|
|
2588
|
+
value: n,
|
|
2589
|
+
onChange: o,
|
|
2590
|
+
ps: 8,
|
|
2591
|
+
pe: n ? 8 : 3
|
|
2592
|
+
}),
|
|
2593
|
+
n && /* @__PURE__ */ M(r, {
|
|
2594
|
+
position: "absolute",
|
|
2595
|
+
insetEnd: 2,
|
|
2596
|
+
cursor: "pointer",
|
|
2597
|
+
p: 1,
|
|
2598
|
+
color: "gray-400",
|
|
2599
|
+
hover: { color: "gray-600" },
|
|
2600
|
+
theme: { dark: {
|
|
2601
|
+
color: "gray-500",
|
|
2602
|
+
hover: { color: "gray-300" }
|
|
2603
|
+
} },
|
|
2604
|
+
props: { onClick: s },
|
|
2605
|
+
children: /* @__PURE__ */ M(r, {
|
|
2606
|
+
fontSize: 12,
|
|
2607
|
+
fontWeight: 600,
|
|
2608
|
+
children: "✕"
|
|
2609
|
+
})
|
|
2610
|
+
})
|
|
2611
|
+
]
|
|
2612
|
+
})]
|
|
2613
|
+
});
|
|
2614
|
+
}
|
|
2615
|
+
//#endregion
|
|
2616
|
+
//#region src/components/dataGrid/components/dataGridTopBarContextMenu.tsx
|
|
2617
|
+
function Tt(e) {
|
|
2618
|
+
let { grid: t } = e, { columnVisibility: n } = t, { entries: i, selectedIds: a, total: o, hasHidden: s } = n;
|
|
2619
|
+
return /* @__PURE__ */ N(v, {
|
|
2620
|
+
component: `${t.componentName}.topBar.columnVisibility`,
|
|
2621
|
+
multiple: !0,
|
|
2622
|
+
showCheckbox: !0,
|
|
2623
|
+
hideIcon: !0,
|
|
2624
|
+
variant: "compact",
|
|
2625
|
+
value: a,
|
|
2626
|
+
onChange: (e, t) => {
|
|
2627
|
+
n.setVisibility(t);
|
|
2628
|
+
},
|
|
2629
|
+
isSearchable: i.length > 6,
|
|
2630
|
+
searchPlaceholder: "Search columns...",
|
|
2631
|
+
display: "inline-flex",
|
|
2632
|
+
props: { "aria-label": "Columns" },
|
|
2633
|
+
children: [
|
|
2634
|
+
/* @__PURE__ */ M(v.Display, { children: (e) => {
|
|
2635
|
+
let n = e.length === 0;
|
|
2636
|
+
return /* @__PURE__ */ N(f, {
|
|
2637
|
+
ai: "center",
|
|
2638
|
+
gap: 2,
|
|
2639
|
+
children: [/* @__PURE__ */ N(u, {
|
|
2640
|
+
viewBox: "0 0 20 20",
|
|
2641
|
+
width: "18",
|
|
2642
|
+
height: "18",
|
|
2643
|
+
children: [
|
|
2644
|
+
/* @__PURE__ */ M("rect", {
|
|
2645
|
+
x: "2",
|
|
2646
|
+
y: "3",
|
|
2647
|
+
width: "4",
|
|
2648
|
+
height: "14",
|
|
2649
|
+
rx: "1",
|
|
2650
|
+
fill: "currentColor",
|
|
2651
|
+
opacity: .9
|
|
2652
|
+
}),
|
|
2653
|
+
/* @__PURE__ */ M("rect", {
|
|
2654
|
+
x: "8",
|
|
2655
|
+
y: "3",
|
|
2656
|
+
width: "4",
|
|
2657
|
+
height: "14",
|
|
2658
|
+
rx: "1",
|
|
2659
|
+
fill: "currentColor",
|
|
2660
|
+
opacity: .6
|
|
2661
|
+
}),
|
|
2662
|
+
/* @__PURE__ */ M("rect", {
|
|
2663
|
+
x: "14",
|
|
2664
|
+
y: "3",
|
|
2665
|
+
width: "4",
|
|
2666
|
+
height: "14",
|
|
2667
|
+
rx: "1",
|
|
2668
|
+
fill: "currentColor",
|
|
2669
|
+
opacity: .3
|
|
2670
|
+
})
|
|
2671
|
+
]
|
|
2672
|
+
}), s && /* @__PURE__ */ N(r, {
|
|
2673
|
+
component: `${t.componentName}.topBar.columnVisibility.badge`,
|
|
2674
|
+
tag: "span",
|
|
2675
|
+
fontSize: 11,
|
|
2676
|
+
lineHeight: 16,
|
|
2677
|
+
fontWeight: 500,
|
|
2678
|
+
px: 2,
|
|
2679
|
+
py: .5,
|
|
2680
|
+
borderRadius: 1,
|
|
2681
|
+
bgColor: n ? "red-100" : "amber-100",
|
|
2682
|
+
color: n ? "red-700" : "amber-700",
|
|
2683
|
+
theme: { dark: {
|
|
2684
|
+
bgColor: n ? "red-900" : "amber-900",
|
|
2685
|
+
color: n ? "red-300" : "amber-300"
|
|
2686
|
+
} },
|
|
2687
|
+
children: [
|
|
2688
|
+
e.length,
|
|
2689
|
+
"/",
|
|
2690
|
+
o
|
|
2691
|
+
]
|
|
2692
|
+
})]
|
|
2693
|
+
});
|
|
2694
|
+
} }),
|
|
2695
|
+
/* @__PURE__ */ M(v.SelectAll, { children: "Show All" }),
|
|
2696
|
+
/* @__PURE__ */ M(v.Unselect, { children: "Hide All" }),
|
|
2697
|
+
i.map((e) => /* @__PURE__ */ M(v.Item, {
|
|
2698
|
+
value: e.id,
|
|
2699
|
+
textWrap: "nowrap",
|
|
2700
|
+
children: e.label
|
|
2701
|
+
}, e.id))
|
|
2702
|
+
]
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
Tt.displayName = "DataGridTopBarContextMenu";
|
|
2706
|
+
//#endregion
|
|
2707
|
+
//#region src/components/dataGrid/components/dataGridTopBar.tsx
|
|
2708
|
+
function Et(e) {
|
|
2709
|
+
let { grid: t } = e, { title: n, topBarContent: i, globalFilter: a } = t.props.def;
|
|
2710
|
+
return /* @__PURE__ */ N(f, {
|
|
2711
|
+
component: `${t.componentName}.topBar`,
|
|
2712
|
+
position: "relative",
|
|
2713
|
+
d: "column",
|
|
2714
|
+
gap: 3,
|
|
2715
|
+
children: [/* @__PURE__ */ N(f, {
|
|
2716
|
+
ai: "center",
|
|
2717
|
+
jc: "space-between",
|
|
2718
|
+
gap: 4,
|
|
2719
|
+
flexWrap: "wrap",
|
|
2720
|
+
width: "fit",
|
|
2721
|
+
children: [/* @__PURE__ */ N(f, {
|
|
2722
|
+
ai: "center",
|
|
2723
|
+
gap: 3,
|
|
2724
|
+
flexWrap: "wrap",
|
|
2725
|
+
minWidth: 0,
|
|
2726
|
+
children: [
|
|
2727
|
+
/* @__PURE__ */ M(Tt, { grid: t }),
|
|
2728
|
+
n && /* @__PURE__ */ M(r, {
|
|
2729
|
+
id: t.titleId,
|
|
2730
|
+
fontWeight: 600,
|
|
2731
|
+
fontSize: 16,
|
|
2732
|
+
color: "gray-800",
|
|
2733
|
+
theme: { dark: { color: "gray-100" } },
|
|
2734
|
+
children: n
|
|
2735
|
+
}),
|
|
2736
|
+
/* @__PURE__ */ M(bt, { grid: t })
|
|
2737
|
+
]
|
|
2738
|
+
}), /* @__PURE__ */ N(f, {
|
|
2739
|
+
ai: "center",
|
|
2740
|
+
gap: 3,
|
|
2741
|
+
flexWrap: "wrap",
|
|
2742
|
+
children: [a && /* @__PURE__ */ M(wt, { grid: t }), /* @__PURE__ */ M(xt, { grid: t })]
|
|
2743
|
+
})]
|
|
2744
|
+
}), i && /* @__PURE__ */ M(r, {
|
|
2745
|
+
width: "fit",
|
|
2746
|
+
children: i
|
|
2747
|
+
})]
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
Et.displayName = "DataGridTopBar";
|
|
2751
|
+
//#endregion
|
|
2752
|
+
//#region src/utils/string/fuzzySearch.ts
|
|
2753
|
+
function Dt(e, t) {
|
|
2754
|
+
if (!e) return {
|
|
2755
|
+
score: 1,
|
|
2756
|
+
matches: []
|
|
2757
|
+
};
|
|
2758
|
+
if (!t) return null;
|
|
2759
|
+
let n = e.toLowerCase(), r = t.toLowerCase(), i = 0, a = 0, o = [], s = -1, c = 0, l = 0;
|
|
2760
|
+
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++;
|
|
2761
|
+
return s !== -1 && o.push([s, a]), i < n.length ? null : (c /= t.length, {
|
|
2762
|
+
score: c,
|
|
2763
|
+
matches: o
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
function Ot(e, t) {
|
|
2767
|
+
return Dt(e, t) !== null;
|
|
2768
|
+
}
|
|
2769
|
+
//#endregion
|
|
2770
|
+
//#region src/components/dataGrid/components/dataGridCellRowDetail.tsx
|
|
2771
|
+
function kt(e) {
|
|
2772
|
+
let { cell: t } = e, n = t.isExpanded, r = T((e) => {
|
|
2773
|
+
e.stopPropagation(), t.toggleDetail();
|
|
2774
|
+
}, [t]);
|
|
2775
|
+
return /* @__PURE__ */ M(d, {
|
|
2776
|
+
component: `${t.grid.componentName}.body.cell.rowDetail`,
|
|
2777
|
+
variant: { isExpanded: n },
|
|
2778
|
+
type: "button",
|
|
2779
|
+
onClick: r,
|
|
2780
|
+
cursor: "pointer",
|
|
2781
|
+
display: "flex",
|
|
2782
|
+
ai: "center",
|
|
2783
|
+
jc: "center",
|
|
2784
|
+
width: "fit",
|
|
2785
|
+
height: "fit",
|
|
2786
|
+
props: {
|
|
2787
|
+
tabIndex: -1,
|
|
2788
|
+
"aria-label": `${n ? "Collapse" : "Expand"} details for row ${t.row.rowIndex + 1}`,
|
|
2789
|
+
"aria-expanded": n
|
|
2790
|
+
},
|
|
2791
|
+
children: /* @__PURE__ */ M(J, {
|
|
2792
|
+
fill: "currentColor",
|
|
2793
|
+
width: "14px",
|
|
2794
|
+
height: "14px",
|
|
2795
|
+
rotate: n ? 0 : -90
|
|
2796
|
+
})
|
|
2797
|
+
});
|
|
2798
|
+
}
|
|
2799
|
+
kt.displayName = "DataGridCellRowDetail";
|
|
2800
|
+
//#endregion
|
|
2801
|
+
//#region src/components/dataGrid/components/dataGridCellRowSelection.tsx
|
|
2802
|
+
function At(e) {
|
|
2803
|
+
let { cell: t } = e, n = T(() => {
|
|
2804
|
+
t.toggleSelection();
|
|
2805
|
+
}, [t]);
|
|
2806
|
+
return /* @__PURE__ */ M(p, {
|
|
2807
|
+
variant: "datagrid",
|
|
2808
|
+
checked: t.selected,
|
|
2809
|
+
indeterminate: t.indeterminate,
|
|
2810
|
+
onChange: n,
|
|
2811
|
+
props: {
|
|
2812
|
+
tabIndex: -1,
|
|
2813
|
+
"aria-label": `Select row ${t.row.rowIndex + 1}`
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
At.displayName = "DataGridCellRowSelection";
|
|
2818
|
+
//#endregion
|
|
2819
|
+
//#region src/components/dataGrid/contracts/dataGridContract.ts
|
|
2820
|
+
function jt(e) {
|
|
2821
|
+
if (e) return e === "LEFT" ? "START" : e === "RIGHT" ? "END" : e;
|
|
2822
|
+
}
|
|
2823
|
+
//#endregion
|
|
2824
|
+
//#region src/components/dataGrid/models/headerCellModel.ts
|
|
2825
|
+
var Mt = 1e3, Nt = class {
|
|
2826
|
+
column;
|
|
2827
|
+
constructor(e) {
|
|
2828
|
+
this.column = e;
|
|
2829
|
+
}
|
|
2830
|
+
get grid() {
|
|
2831
|
+
return this.column.grid;
|
|
2832
|
+
}
|
|
2833
|
+
get label() {
|
|
2834
|
+
let e = this.column;
|
|
2835
|
+
if (e.isRowNumber || e.isRowSelection) return null;
|
|
2836
|
+
if (e.isGrouping) {
|
|
2837
|
+
if (this.grid.groupColumns.size === 1) {
|
|
2838
|
+
let e = this.grid.groupColumns.values().next().value, t = W.findOrThrow(this.grid.columns.value.leafs, (t) => t.key === e);
|
|
2839
|
+
return t.header ?? t.key;
|
|
2840
|
+
}
|
|
2841
|
+
return "Group";
|
|
2842
|
+
}
|
|
2843
|
+
return e.header ?? e.key;
|
|
2844
|
+
}
|
|
2845
|
+
get hiddenLabel() {
|
|
2846
|
+
if (this.column.isRowNumber) return "Row number";
|
|
2847
|
+
if (this.column.isRowDetail) return "Row details";
|
|
2848
|
+
}
|
|
2849
|
+
get isSortable() {
|
|
2850
|
+
let e = this.column;
|
|
2851
|
+
return e.isLeaf && !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.sortable;
|
|
2852
|
+
}
|
|
2853
|
+
get isSorted() {
|
|
2854
|
+
return this.column.key === this.grid.sortColumn;
|
|
2855
|
+
}
|
|
2856
|
+
get sortDirection() {
|
|
2857
|
+
return this.grid.sortDirection;
|
|
2858
|
+
}
|
|
2859
|
+
get showResizer() {
|
|
2860
|
+
let e = this.column;
|
|
2861
|
+
return !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.resizable;
|
|
2862
|
+
}
|
|
2863
|
+
get showContextMenu() {
|
|
2864
|
+
let e = this.column;
|
|
2865
|
+
return !e.isRowNumber && !e.isRowSelection && !e.isRowDetail && e.showContextMenu;
|
|
2866
|
+
}
|
|
2867
|
+
get gridColumn() {
|
|
2868
|
+
return this.column.isLeaf ? 1 : this.column.leafs.length;
|
|
2869
|
+
}
|
|
2870
|
+
get columnIndex() {
|
|
2871
|
+
let e = this.column.leafs[0] ?? this.column;
|
|
2872
|
+
return this.grid.columns.value.visibleLeafs.indexOf(e) + 1;
|
|
2873
|
+
}
|
|
2874
|
+
get columnSpan() {
|
|
2875
|
+
let e = this.column.leafs.length;
|
|
2876
|
+
return e > 1 ? e : void 0;
|
|
2877
|
+
}
|
|
2878
|
+
get rowSpan() {
|
|
2879
|
+
let e = this.column.gridRows;
|
|
2880
|
+
return e > 1 ? e : void 0;
|
|
2881
|
+
}
|
|
2882
|
+
get ariaSort() {
|
|
2883
|
+
if (this.isSortable) return !this.isSorted || !this.sortDirection ? "none" : this.sortDirection === "ASC" ? "ascending" : "descending";
|
|
2884
|
+
}
|
|
2885
|
+
get resizerLabel() {
|
|
2886
|
+
return `Resize ${this.label ?? this.column.key}`;
|
|
2887
|
+
}
|
|
2888
|
+
get width() {
|
|
2889
|
+
return this.column.inlineWidth ?? this.column.baseWidth;
|
|
2890
|
+
}
|
|
2891
|
+
get minWidth() {
|
|
2892
|
+
return Math.max(1, this.column.leafs.length) * this.grid.MIN_COLUMN_WIDTH_PX;
|
|
2893
|
+
}
|
|
2894
|
+
get maxWidth() {
|
|
2895
|
+
return Math.max(this.grid.containerWidth || Mt, this.width, this.minWidth);
|
|
2896
|
+
}
|
|
2897
|
+
get paddingStart() {
|
|
2898
|
+
if (!this.column.isRowSelection) return this.column.isEndAligned ? 10 : 3;
|
|
2899
|
+
}
|
|
2900
|
+
get paddingEnd() {
|
|
2901
|
+
if (!this.column.isRowSelection) return this.column.align === "center" ? 3 : void 0;
|
|
2902
|
+
}
|
|
2903
|
+
get variant() {
|
|
2904
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.column.pinFlags.value;
|
|
2905
|
+
return {
|
|
2906
|
+
isPinned: e,
|
|
2907
|
+
isFirstStartPinned: t,
|
|
2908
|
+
isLastStartPinned: n,
|
|
2909
|
+
isFirstEndPinned: r,
|
|
2910
|
+
isLastEndPinned: i,
|
|
2911
|
+
isSortable: this.isSortable,
|
|
2912
|
+
isRowNumber: this.column.isRowNumber,
|
|
2913
|
+
isFirstLeaf: this.column.isFirstLeaf,
|
|
2914
|
+
isLastLeaf: this.column.isLastLeaf
|
|
2915
|
+
};
|
|
2916
|
+
}
|
|
2917
|
+
get contextMenuButtonVariant() {
|
|
2918
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.column.pinFlags.value;
|
|
2919
|
+
return {
|
|
2920
|
+
isPinned: e,
|
|
2921
|
+
isFirstStartPinned: t,
|
|
2922
|
+
isLastStartPinned: n,
|
|
2923
|
+
isFirstEndPinned: r,
|
|
2924
|
+
isLastEndPinned: i,
|
|
2925
|
+
isSortable: this.isSortable,
|
|
2926
|
+
isRowNumber: this.column.isRowNumber
|
|
2927
|
+
};
|
|
2928
|
+
}
|
|
2929
|
+
get sections() {
|
|
2930
|
+
return this.column.contextMenuSections;
|
|
2931
|
+
}
|
|
2932
|
+
get canSortAsc() {
|
|
2933
|
+
let { key: e } = this.column;
|
|
2934
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && (this.grid.sortColumn !== e || this.grid.sortDirection === "DESC");
|
|
2935
|
+
}
|
|
2936
|
+
get canSortDesc() {
|
|
2937
|
+
let { key: e } = this.column;
|
|
2938
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && (this.grid.sortColumn !== e || this.grid.sortDirection === "ASC");
|
|
2939
|
+
}
|
|
2940
|
+
get canClearSort() {
|
|
2941
|
+
return this.sections.sort && this.column.isLeaf && this.column.sortable && this.grid.sortColumn === this.column.key;
|
|
2942
|
+
}
|
|
2943
|
+
get canPinStart() {
|
|
2944
|
+
return this.sections.pin && this.column.pin !== "START";
|
|
2945
|
+
}
|
|
2946
|
+
get canPinEnd() {
|
|
2947
|
+
return this.sections.pin && this.column.pin !== "END";
|
|
2948
|
+
}
|
|
2949
|
+
get canUnpin() {
|
|
2950
|
+
return this.sections.pin && !!this.column.pin;
|
|
2951
|
+
}
|
|
2952
|
+
get canGroupBy() {
|
|
2953
|
+
return this.sections.group && this.column.isLeaf && !this.column.isGrouping;
|
|
2954
|
+
}
|
|
2955
|
+
get canUnGroupAll() {
|
|
2956
|
+
return this.sections.group && this.column.isLeaf && this.column.isGrouping;
|
|
2957
|
+
}
|
|
2958
|
+
get hasSortSection() {
|
|
2959
|
+
return this.canSortAsc || this.canSortDesc || this.canClearSort;
|
|
2960
|
+
}
|
|
2961
|
+
get hasPinSection() {
|
|
2962
|
+
return this.canPinStart || this.canPinEnd || this.canUnpin;
|
|
2963
|
+
}
|
|
2964
|
+
get hasGroupSection() {
|
|
2965
|
+
return this.canGroupBy || this.canUnGroupAll;
|
|
2966
|
+
}
|
|
2967
|
+
}, Z = class e {
|
|
2968
|
+
def;
|
|
2969
|
+
grid;
|
|
2970
|
+
parent;
|
|
2971
|
+
constructor(t, n, r) {
|
|
2972
|
+
if (this.def = t, this.grid = n, this.parent = r, this.columns = t.columns?.map((r) => new e(t.pin ? {
|
|
2973
|
+
...r,
|
|
2974
|
+
pin: t.pin
|
|
2975
|
+
} : r, n, this)) ?? [], this.isLeaf) {
|
|
2976
|
+
let e = this.grid.columnWidths.get(this.key);
|
|
2977
|
+
this._inlineWidth = e ?? this.def.width ?? this.grid.DEFAULT_COLUMN_WIDTH_PX, this._pin = jt(t.pin);
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
columns = [];
|
|
2981
|
+
get kind() {
|
|
2982
|
+
switch (this.key) {
|
|
2983
|
+
case Te: return "rowNumber";
|
|
2984
|
+
case Ee: return "rowSelection";
|
|
2985
|
+
case De: return "rowDetail";
|
|
2986
|
+
case G: return "grouping";
|
|
2987
|
+
default: return "data";
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
get isRowNumber() {
|
|
2991
|
+
return this.kind === "rowNumber";
|
|
2992
|
+
}
|
|
2993
|
+
get isRowSelection() {
|
|
2994
|
+
return this.kind === "rowSelection";
|
|
2995
|
+
}
|
|
2996
|
+
get isRowDetail() {
|
|
2997
|
+
return this.kind === "rowDetail";
|
|
2998
|
+
}
|
|
2999
|
+
get isGrouping() {
|
|
3000
|
+
return this.kind === "grouping";
|
|
3001
|
+
}
|
|
3002
|
+
get isData() {
|
|
3003
|
+
return this.kind === "data";
|
|
3004
|
+
}
|
|
3005
|
+
pinFlags = B(() => {
|
|
3006
|
+
let e = this.pin === "START", t = this.pin === "END";
|
|
3007
|
+
return {
|
|
3008
|
+
isStartPinned: e,
|
|
3009
|
+
isEndPinned: t,
|
|
3010
|
+
isPinned: e || t,
|
|
3011
|
+
isFirstStartPinned: e && this.startOffset === 0,
|
|
3012
|
+
isLastStartPinned: e && this.isEdge,
|
|
3013
|
+
isFirstEndPinned: t && this.isEdge,
|
|
3014
|
+
isLastEndPinned: t && this.endOffset === 0
|
|
3015
|
+
};
|
|
3016
|
+
}, () => [this.grid.columns]);
|
|
3017
|
+
cellVariant = B(() => {
|
|
3018
|
+
let { isPinned: e, isFirstStartPinned: t, isLastStartPinned: n, isFirstEndPinned: r, isLastEndPinned: i } = this.pinFlags.value;
|
|
3019
|
+
return {
|
|
3020
|
+
isPinned: e,
|
|
3021
|
+
isFirstStartPinned: t,
|
|
3022
|
+
isLastStartPinned: n,
|
|
3023
|
+
isFirstEndPinned: r,
|
|
3024
|
+
isLastEndPinned: i,
|
|
3025
|
+
isRowSelection: this.isRowSelection,
|
|
3026
|
+
isRowNumber: this.isRowNumber,
|
|
3027
|
+
isFirstLeaf: this.isFirstLeaf,
|
|
3028
|
+
isLastLeaf: this.isLastLeaf,
|
|
3029
|
+
isRowDetail: this.isRowDetail
|
|
3030
|
+
};
|
|
3031
|
+
}, () => [this.pinFlags]);
|
|
3032
|
+
cellStyleVars = B(() => {
|
|
3033
|
+
let { isStartPinned: e, isEndPinned: t } = this.pinFlags.value;
|
|
3034
|
+
return {
|
|
3035
|
+
width: `var(${this.widthVarName})`,
|
|
3036
|
+
height: `var(${this.grid.rowHeightVarName})`,
|
|
3037
|
+
insetInlineStart: e ? `var(${this.inlineStartVarName})` : void 0,
|
|
3038
|
+
insetInlineEnd: t ? `var(${this.inlineEndVarName})` : void 0
|
|
3039
|
+
};
|
|
3040
|
+
}, () => [this.pinFlags]);
|
|
3041
|
+
_headerCell = B(() => new Nt(this));
|
|
3042
|
+
get headerCell() {
|
|
3043
|
+
return this._headerCell.value;
|
|
3044
|
+
}
|
|
3045
|
+
get visibleColumns() {
|
|
3046
|
+
return this.columns.filter((e) => e.isVisible);
|
|
3047
|
+
}
|
|
3048
|
+
get isFirstLeaf() {
|
|
3049
|
+
let { leafs: e } = this;
|
|
3050
|
+
return e.length > 0 && e.at(0) === this;
|
|
3051
|
+
}
|
|
3052
|
+
get isLastLeaf() {
|
|
3053
|
+
let { leafs: e } = this;
|
|
3054
|
+
return e.length > 0 && e.at(-1) === this;
|
|
3055
|
+
}
|
|
3056
|
+
get key() {
|
|
3057
|
+
return this.def.key;
|
|
3058
|
+
}
|
|
3059
|
+
get header() {
|
|
3060
|
+
return this.def.header;
|
|
3061
|
+
}
|
|
3062
|
+
get align() {
|
|
3063
|
+
return this.def.align;
|
|
3064
|
+
}
|
|
3065
|
+
get isEndAligned() {
|
|
3066
|
+
return this.align === "end" || this.align === "right";
|
|
3067
|
+
}
|
|
3068
|
+
get hasAlign() {
|
|
3069
|
+
return "align" in this.def;
|
|
3070
|
+
}
|
|
3071
|
+
get isLeaf() {
|
|
3072
|
+
return this.columns.length === 0;
|
|
3073
|
+
}
|
|
3074
|
+
get Cell() {
|
|
3075
|
+
return this.def.Cell;
|
|
3076
|
+
}
|
|
3077
|
+
get aggregate() {
|
|
3078
|
+
return this.def.aggregate;
|
|
3079
|
+
}
|
|
3080
|
+
get AggregateCell() {
|
|
3081
|
+
return this.def.AggregateCell;
|
|
3082
|
+
}
|
|
3083
|
+
get filterable() {
|
|
3084
|
+
return this.def.filterable;
|
|
3085
|
+
}
|
|
3086
|
+
get filterConfig() {
|
|
3087
|
+
let { filterable: e } = this.def;
|
|
3088
|
+
if (e) return typeof e == "object" ? e : { type: "text" };
|
|
3089
|
+
}
|
|
3090
|
+
get currentFilter() {
|
|
3091
|
+
return this.grid.columnFilters[this.key];
|
|
3092
|
+
}
|
|
3093
|
+
get filterOptions() {
|
|
3094
|
+
let e = this.filterConfig;
|
|
3095
|
+
return e?.type === "multiselect" && e.options ? e.options : this.grid.getColumnUniqueValues(this.key).map((e) => ({
|
|
3096
|
+
label: e === null ? "(empty)" : String(e),
|
|
3097
|
+
value: e
|
|
3098
|
+
}));
|
|
3099
|
+
}
|
|
3100
|
+
setTextFilter(e) {
|
|
3101
|
+
this.grid.setColumnFilter(this.key, e.trim() ? {
|
|
3102
|
+
type: "text",
|
|
3103
|
+
value: e
|
|
3104
|
+
} : void 0);
|
|
3105
|
+
}
|
|
3106
|
+
setNumberFilter(e, t, n) {
|
|
3107
|
+
let r = typeof t == "number" ? t : parseFloat(t);
|
|
3108
|
+
if (isNaN(r) || t === "") {
|
|
3109
|
+
this.grid.setColumnFilter(this.key, void 0);
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
let i = {
|
|
3113
|
+
type: "number",
|
|
3114
|
+
operator: e,
|
|
3115
|
+
value: r
|
|
3116
|
+
};
|
|
3117
|
+
if (e === "between" && n !== void 0 && n !== "") {
|
|
3118
|
+
let e = typeof n == "number" ? n : parseFloat(String(n));
|
|
3119
|
+
isNaN(e) || (i.valueTo = e);
|
|
3120
|
+
}
|
|
3121
|
+
this.grid.setColumnFilter(this.key, i);
|
|
3122
|
+
}
|
|
3123
|
+
setMultiselectFilter(e) {
|
|
3124
|
+
this.grid.setColumnFilter(this.key, e.length === 0 ? void 0 : {
|
|
3125
|
+
type: "multiselect",
|
|
3126
|
+
values: e
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
clearFilter() {
|
|
3130
|
+
this.grid.setColumnFilter(this.key, void 0);
|
|
3131
|
+
}
|
|
3132
|
+
get editable() {
|
|
3133
|
+
return this.def.editable === void 0 ? this.grid.props.def.editable ?? !1 : this.def.editable;
|
|
3134
|
+
}
|
|
3135
|
+
get sortable() {
|
|
3136
|
+
return this.def.sortable === void 0 ? this.grid.props.def.sortable !== !1 : this.def.sortable;
|
|
3137
|
+
}
|
|
3138
|
+
get resizable() {
|
|
3139
|
+
return this.def.resizable === void 0 ? this.grid.props.def.resizable !== !1 : this.def.resizable;
|
|
3140
|
+
}
|
|
3141
|
+
get contextMenu() {
|
|
3142
|
+
return this.def.contextMenu === void 0 ? this.grid.props.def.contextMenu ?? !0 : this.def.contextMenu;
|
|
3143
|
+
}
|
|
3144
|
+
get showContextMenu() {
|
|
3145
|
+
let e = this.contextMenu;
|
|
3146
|
+
return typeof e == "boolean" ? e : e.sort !== !1 || e.pin !== !1 || e.group !== !1;
|
|
3147
|
+
}
|
|
3148
|
+
get contextMenuSections() {
|
|
3149
|
+
let e = this.contextMenu, t = (!this.grid.source.enabled || this.grid.source.canGroup) && !this.grid.tree.enabled;
|
|
3150
|
+
return typeof e == "boolean" ? {
|
|
3151
|
+
sort: e,
|
|
3152
|
+
pin: e,
|
|
3153
|
+
group: e && t
|
|
3154
|
+
} : {
|
|
3155
|
+
sort: e.sort !== !1,
|
|
3156
|
+
pin: e.pin !== !1,
|
|
3157
|
+
group: t && e.group !== !1
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
get isFlexible() {
|
|
3161
|
+
return this.def.flexible !== !1;
|
|
3162
|
+
}
|
|
3163
|
+
get baseWidth() {
|
|
3164
|
+
return this._inlineWidth ?? this.grid.DEFAULT_COLUMN_WIDTH_PX;
|
|
3165
|
+
}
|
|
3166
|
+
_pin;
|
|
3167
|
+
get pin() {
|
|
3168
|
+
if (this.isLeaf) return this._pin;
|
|
3169
|
+
let e = [...new Set(this.columns.flatMap((e) => e.pin))];
|
|
3170
|
+
if (e.length === 1) return e[0];
|
|
3171
|
+
}
|
|
3172
|
+
get uniqueKey() {
|
|
3173
|
+
return `${this.key}${this.pin ?? ""}`;
|
|
3174
|
+
}
|
|
3175
|
+
getPinnedColumn(t) {
|
|
3176
|
+
if (this.hasPin(t)) {
|
|
3177
|
+
if (this.isLeaf) return this;
|
|
3178
|
+
let n = new e({
|
|
3179
|
+
...this.def,
|
|
3180
|
+
pin: t
|
|
3181
|
+
}, this.grid, this.parent);
|
|
3182
|
+
return n.columns = this.columns.filter((e) => e.hasPin(t)).map((e) => {
|
|
3183
|
+
let r = e.getPinnedColumn(t);
|
|
3184
|
+
return r.parent = n, r;
|
|
3185
|
+
}).filter((e) => !!e), n;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
hasPin(e) {
|
|
3189
|
+
return this.isLeaf ? this._pin === e : this.columns.some((t) => t.hasPin(e));
|
|
3190
|
+
}
|
|
3191
|
+
get death() {
|
|
3192
|
+
return this.parent ? this.parent.death + 1 : 0;
|
|
3193
|
+
}
|
|
3194
|
+
get flatColumns() {
|
|
3195
|
+
let e = [this];
|
|
3196
|
+
return e.push(...this.columns.flatMap((e) => e.flatColumns)), e;
|
|
3197
|
+
}
|
|
3198
|
+
_inlineWidth;
|
|
3199
|
+
get inlineWidth() {
|
|
3200
|
+
if (this.isLeaf) return this.grid.getFlexWidth(this.key) ?? this._inlineWidth;
|
|
3201
|
+
let e = this.visibleColumns.map((e) => e.inlineWidth).filter((e) => typeof e == "number");
|
|
3202
|
+
if (e.length !== 0) return W.sumBy(e, (e) => e);
|
|
3203
|
+
}
|
|
3204
|
+
get startOffset() {
|
|
3205
|
+
let e = 0;
|
|
3206
|
+
if (this.parent) {
|
|
3207
|
+
let { visibleColumns: t, startOffset: n } = this.parent, r = t.findIndex((e) => e === this);
|
|
3208
|
+
e += W.sumBy(t, (e, t) => t < r ? e.inlineWidth ?? 0 : 0), e += n;
|
|
3209
|
+
} else {
|
|
3210
|
+
let t = this.grid.columns.value.start.filter((e) => e.isVisible), n = t.findIndex((e) => e === this);
|
|
3211
|
+
e += W.sumBy(t, (e, t) => t < n ? e.inlineWidth ?? 0 : 0);
|
|
3212
|
+
}
|
|
3213
|
+
return e;
|
|
3214
|
+
}
|
|
3215
|
+
get endOffset() {
|
|
3216
|
+
let e = 0;
|
|
3217
|
+
if (this.parent) {
|
|
3218
|
+
let { visibleColumns: t } = this.parent, n = t.reverse(), r = n.findIndex((e) => e === this);
|
|
3219
|
+
e += W.sumBy(n, (e, t) => t < r ? e.inlineWidth ?? 0 : 0), e += this.parent.endOffset;
|
|
3220
|
+
} else {
|
|
3221
|
+
let t = this.grid.columns.value.end.filter((e) => e.isVisible).reverse(), n = t.findIndex((e) => e === this);
|
|
3222
|
+
e += W.sumBy(t, (e, t) => t < n ? e.inlineWidth ?? 0 : 0);
|
|
3223
|
+
}
|
|
3224
|
+
return e;
|
|
3225
|
+
}
|
|
3226
|
+
get isEdge() {
|
|
3227
|
+
if (!this.pin) return !1;
|
|
3228
|
+
if (this.parent) {
|
|
3229
|
+
let { visibleColumns: e } = this.parent;
|
|
3230
|
+
return (this.pin === "START" ? e.at(-1) : e.at(0)) === this && this.parent.isEdge;
|
|
3231
|
+
}
|
|
3232
|
+
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;
|
|
3233
|
+
}
|
|
3234
|
+
get isVisible() {
|
|
3235
|
+
return this.isLeaf ? !this.grid.hiddenColumns.has(this.key) : this.leafs.some((e) => e.isVisible);
|
|
3236
|
+
}
|
|
3237
|
+
get leafs() {
|
|
3238
|
+
return this.isLeaf ? [this] : this.visibleColumns.flatMap((e) => e.leafs);
|
|
3239
|
+
}
|
|
3240
|
+
get groupColumnWidthVarName() {
|
|
3241
|
+
return `--${this.uniqueKey}-group-width`;
|
|
3242
|
+
}
|
|
3243
|
+
get widthVarName() {
|
|
3244
|
+
return `--${this.uniqueKey}-width`;
|
|
3245
|
+
}
|
|
3246
|
+
get inlineStartVarName() {
|
|
3247
|
+
return `--${this.uniqueKey}-inline-start`;
|
|
3248
|
+
}
|
|
3249
|
+
get inlineEndVarName() {
|
|
3250
|
+
return `--${this.uniqueKey}-inline-end`;
|
|
3251
|
+
}
|
|
3252
|
+
get gridRows() {
|
|
3253
|
+
return this.isLeaf ? this.grid.columns.value.maxDeath - this.death : 1;
|
|
3254
|
+
}
|
|
3255
|
+
_resizeStartX = 0;
|
|
3256
|
+
_resizeSizes = {};
|
|
3257
|
+
_resizeTotalWidth = 0;
|
|
3258
|
+
beginResize = (e) => {
|
|
3259
|
+
let { MIN_COLUMN_WIDTH_PX: t } = this.grid;
|
|
3260
|
+
this._resizeStartX = e, this._resizeSizes = W.toRecord(this.leafs, (e) => [e.key, e.inlineWidth ?? e.baseWidth]), this._resizeTotalWidth = W.sumBy(this.leafs, (e) => this._resizeSizes[e.key]) - this.leafs.length * t;
|
|
3261
|
+
};
|
|
3262
|
+
get resizeSign() {
|
|
3263
|
+
return this.pin === "END" === this.grid.isRtl ? 1 : -1;
|
|
3264
|
+
}
|
|
3265
|
+
applyResize = (e) => {
|
|
3266
|
+
let { MIN_COLUMN_WIDTH_PX: t } = this.grid, n = (e - this._resizeStartX) * this.resizeSign;
|
|
3267
|
+
this.leafs.forEach((e) => {
|
|
3268
|
+
let r = this._resizeSizes[e.key], i = this._resizeTotalWidth > 0 ? (r - t) / this._resizeTotalWidth * n : n / this.leafs.length, a = Math.round(r + i);
|
|
3269
|
+
e.setWidth(a < t ? t : a);
|
|
3270
|
+
}), this.grid.flexWidths.clear();
|
|
3271
|
+
};
|
|
3272
|
+
resizeTo = (e) => {
|
|
3273
|
+
this.applyResize(e), this.grid.notify();
|
|
3274
|
+
};
|
|
3275
|
+
endResize = () => {
|
|
3276
|
+
this.grid.notify();
|
|
3277
|
+
};
|
|
3278
|
+
moveResizer = (e) => {
|
|
3279
|
+
this.beginResize(0), this.applyResize(e);
|
|
3280
|
+
};
|
|
3281
|
+
resizeWidthTo = (e) => {
|
|
3282
|
+
let t = this.inlineWidth ?? this.baseWidth;
|
|
3283
|
+
this.moveResizer((e - t) * this.resizeSign);
|
|
3284
|
+
};
|
|
3285
|
+
pinColumn = (e) => {
|
|
3286
|
+
this.isLeaf ? this._pin = jt(e) : this.columns.forEach((t) => t.pinColumn(e)), this.grid.pinColumn(this.uniqueKey, e);
|
|
3287
|
+
};
|
|
3288
|
+
toggleGrouping = () => {
|
|
3289
|
+
this.grid.toggleGrouping(this.key);
|
|
3290
|
+
};
|
|
3291
|
+
sortColumn = (...e) => {
|
|
3292
|
+
this.grid.setSortColumn(this.key, ...e);
|
|
3293
|
+
};
|
|
3294
|
+
setWidth = (e) => {
|
|
3295
|
+
if (!this.isLeaf) throw Error("Cannot set width for a parent column.");
|
|
3296
|
+
this._inlineWidth !== e && (this._inlineWidth = e, this.grid.setWidth(this.key, e));
|
|
3297
|
+
};
|
|
3298
|
+
toggleVisibility = () => {
|
|
3299
|
+
this.grid.toggleColumnVisibility(this.key);
|
|
3300
|
+
};
|
|
3301
|
+
}, Pt = class {
|
|
3302
|
+
grid;
|
|
3303
|
+
constructor(e) {
|
|
3304
|
+
this.grid = e;
|
|
3305
|
+
}
|
|
3306
|
+
get entries() {
|
|
3307
|
+
return this.grid.columns.value.leafs.filter((e) => e.isData).map((e) => ({
|
|
3308
|
+
id: String(e.key),
|
|
3309
|
+
label: String(e.header ?? e.key),
|
|
3310
|
+
column: e,
|
|
3311
|
+
visible: e.isVisible
|
|
3312
|
+
}));
|
|
3313
|
+
}
|
|
3314
|
+
get selectedIds() {
|
|
3315
|
+
return this.entries.filter((e) => e.visible).map((e) => e.id);
|
|
3316
|
+
}
|
|
3317
|
+
get total() {
|
|
3318
|
+
return this.entries.length;
|
|
3319
|
+
}
|
|
3320
|
+
get hiddenCount() {
|
|
3321
|
+
return this.entries.reduce((e, t) => t.visible ? e : e + 1, 0);
|
|
3322
|
+
}
|
|
3323
|
+
get hasHidden() {
|
|
3324
|
+
return this.hiddenCount > 0;
|
|
3325
|
+
}
|
|
3326
|
+
setVisibility = (e) => {
|
|
3327
|
+
let t = new Set(e);
|
|
3328
|
+
this.entries.forEach((e) => {
|
|
3329
|
+
let n = t.has(e.id);
|
|
3330
|
+
e.visible !== n && e.column.toggleVisibility();
|
|
3331
|
+
});
|
|
3332
|
+
};
|
|
3333
|
+
};
|
|
3334
|
+
//#endregion
|
|
3335
|
+
//#region src/utils/array/lazyList.ts
|
|
3336
|
+
function Ft(e, t) {
|
|
3337
|
+
return new Proxy([], {
|
|
3338
|
+
get(n, r, i) {
|
|
3339
|
+
if (r === "length") return e;
|
|
3340
|
+
let a = Q(r, e);
|
|
3341
|
+
return a === void 0 ? Reflect.get(n, r, i) : t(a);
|
|
3342
|
+
},
|
|
3343
|
+
has(t, n) {
|
|
3344
|
+
return Q(n, e) !== void 0 || Reflect.has(t, n);
|
|
3345
|
+
},
|
|
3346
|
+
getOwnPropertyDescriptor(n, r) {
|
|
3347
|
+
return Q(r, e) === void 0 ? Reflect.getOwnPropertyDescriptor(n, r) : {
|
|
3348
|
+
value: t(Q(r, e)),
|
|
3349
|
+
writable: !0,
|
|
3350
|
+
enumerable: !0,
|
|
3351
|
+
configurable: !0
|
|
3352
|
+
};
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
function Q(e, t) {
|
|
3357
|
+
if (typeof e != "string") return;
|
|
3358
|
+
let n = Number(e);
|
|
3359
|
+
return Number.isInteger(n) && n >= 0 && n < t ? n : void 0;
|
|
3360
|
+
}
|
|
3361
|
+
//#endregion
|
|
3362
|
+
//#region src/components/dataGrid/models/sourceLevel.ts
|
|
3363
|
+
var $ = class e {
|
|
3364
|
+
source;
|
|
3365
|
+
path;
|
|
3366
|
+
parent;
|
|
3367
|
+
parentRowIndex;
|
|
3368
|
+
constructor(e, t, n, r = 0, i) {
|
|
3369
|
+
this.source = e, this.path = t, this.parent = n, this.parentRowIndex = r, this._totalCount = i;
|
|
3370
|
+
}
|
|
3371
|
+
blocks = /* @__PURE__ */ new Map();
|
|
3372
|
+
_totalCount;
|
|
3373
|
+
alive = !0;
|
|
3374
|
+
_reachedEnd = !1;
|
|
3375
|
+
static keyOf(e) {
|
|
3376
|
+
return JSON.stringify(e);
|
|
3377
|
+
}
|
|
3378
|
+
get key() {
|
|
3379
|
+
return e.keyOf(this.path);
|
|
3380
|
+
}
|
|
3381
|
+
get groupKeys() {
|
|
3382
|
+
return this.source.isTree ? [] : this.path;
|
|
3383
|
+
}
|
|
3384
|
+
get treeKeys() {
|
|
3385
|
+
return this.source.isTree ? this.path : [];
|
|
3386
|
+
}
|
|
3387
|
+
get placeholderKey() {
|
|
3388
|
+
return this.depth === 0 ? "rb-placeholder" : `rb-placeholder-${this.key}`;
|
|
3389
|
+
}
|
|
3390
|
+
get depth() {
|
|
3391
|
+
return this.path.length;
|
|
3392
|
+
}
|
|
3393
|
+
get isGroupLevel() {
|
|
3394
|
+
return this.depth < this.source.groupBy.length;
|
|
3395
|
+
}
|
|
3396
|
+
get rowCount() {
|
|
3397
|
+
if (this._totalCount !== void 0) return this._totalCount;
|
|
3398
|
+
let e = 0;
|
|
3399
|
+
return this.blocks.forEach((t, n) => {
|
|
3400
|
+
t.status === "loaded" && (e = Math.max(e, n * this.source.blockSize + t.rows.length));
|
|
3401
|
+
}), this._reachedEnd ? e : e + this.source.blockSize;
|
|
3402
|
+
}
|
|
3403
|
+
get totalCount() {
|
|
3404
|
+
return this._totalCount;
|
|
3405
|
+
}
|
|
3406
|
+
rowAt(e) {
|
|
3407
|
+
let t = this.blocks.get(Math.floor(e / this.source.blockSize));
|
|
3408
|
+
if (!(!t || t.status !== "loaded")) return t.rows[e % this.source.blockSize];
|
|
3409
|
+
}
|
|
3410
|
+
groupCountAt(e) {
|
|
3411
|
+
let t = this.blocks.get(Math.floor(e / this.source.blockSize));
|
|
3412
|
+
return t?.status === "loaded" ? t.counts?.[e % this.source.blockSize] : void 0;
|
|
3413
|
+
}
|
|
3414
|
+
statusAt(e) {
|
|
3415
|
+
return this.blocks.get(Math.floor(e / this.source.blockSize))?.status ?? "missing";
|
|
3416
|
+
}
|
|
3417
|
+
get isLoading() {
|
|
3418
|
+
for (let e of this.blocks.values()) if (e.status === "loading") return !0;
|
|
3419
|
+
return !1;
|
|
3420
|
+
}
|
|
3421
|
+
failedBlocks() {
|
|
3422
|
+
let e = [];
|
|
3423
|
+
return this.blocks.forEach((t, n) => t.status === "error" && e.push(n)), e;
|
|
3424
|
+
}
|
|
3425
|
+
errorAt(e) {
|
|
3426
|
+
return this.blocks.get(e)?.error;
|
|
3427
|
+
}
|
|
3428
|
+
has(e) {
|
|
3429
|
+
return this.blocks.has(e);
|
|
3430
|
+
}
|
|
3431
|
+
loadedBlocks() {
|
|
3432
|
+
let e = [];
|
|
3433
|
+
return this.blocks.forEach((t, n) => t.status === "loaded" && e.push({
|
|
3434
|
+
index: n,
|
|
3435
|
+
rows: t.rows
|
|
3436
|
+
})), e.sort((e, t) => e.index - t.index);
|
|
3437
|
+
}
|
|
3438
|
+
drop(e) {
|
|
3439
|
+
this.blocks.get(e)?.controller?.abort(), this.blocks.delete(e);
|
|
3440
|
+
}
|
|
3441
|
+
dispose() {
|
|
3442
|
+
this.alive = !1, this.blocks.forEach((e) => e.controller?.abort()), this.blocks.clear();
|
|
3443
|
+
}
|
|
3444
|
+
retry() {
|
|
3445
|
+
let e = this.failedBlocks();
|
|
3446
|
+
e.forEach((e) => this.blocks.delete(e)), e.forEach((e) => this.load(e));
|
|
3447
|
+
}
|
|
3448
|
+
load(e) {
|
|
3449
|
+
let t = this.source.config;
|
|
3450
|
+
if (!t) return;
|
|
3451
|
+
let { grid: n } = this.source, r = this.source.blockSize, i = new AbortController(), a = this.source.queryVersion;
|
|
3452
|
+
this.blocks.set(e, {
|
|
3453
|
+
status: "loading",
|
|
3454
|
+
rows: [],
|
|
3455
|
+
controller: i
|
|
3456
|
+
});
|
|
3457
|
+
let o = {
|
|
3458
|
+
startRow: e * r,
|
|
3459
|
+
endRow: (e + 1) * r,
|
|
3460
|
+
page: e + 1,
|
|
3461
|
+
pageSize: r,
|
|
3462
|
+
sort: n.sortColumn !== void 0 && n.sortDirection !== void 0 ? {
|
|
3463
|
+
columnKey: n.sortColumn,
|
|
3464
|
+
direction: n.sortDirection
|
|
3465
|
+
} : void 0,
|
|
3466
|
+
globalFilter: n.globalFilterValue,
|
|
3467
|
+
columnFilters: n.columnFilters,
|
|
3468
|
+
groupBy: this.source.groupBy,
|
|
3469
|
+
groupKeys: this.groupKeys,
|
|
3470
|
+
treeKeys: this.treeKeys,
|
|
3471
|
+
signal: i.signal
|
|
3472
|
+
};
|
|
3473
|
+
t.getRows(o).then((t) => {
|
|
3474
|
+
!this.alive || a !== this.source.queryVersion || i.signal.aborted || (this.blocks.set(e, {
|
|
3475
|
+
status: "loaded",
|
|
3476
|
+
rows: t.rows ?? [],
|
|
3477
|
+
counts: t.groupCounts
|
|
3478
|
+
}), t.totalCount !== void 0 && (this._totalCount = t.totalCount), (t.rows?.length ?? 0) < r && (this._reachedEnd = !0), this.source.changed());
|
|
3479
|
+
}, (t) => {
|
|
3480
|
+
!this.alive || a !== this.source.queryVersion || i.signal.aborted || (this.blocks.set(e, {
|
|
3481
|
+
status: "error",
|
|
3482
|
+
rows: [],
|
|
3483
|
+
error: t
|
|
3484
|
+
}), this.source.changed());
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
}, It = class extends Fe {
|
|
3488
|
+
level;
|
|
3489
|
+
constructor(e, t, n, r) {
|
|
3490
|
+
super(e, n, [], r, ""), this.level = t;
|
|
3491
|
+
}
|
|
3492
|
+
get row() {
|
|
3493
|
+
return this.level.rowAt(this.rowIndex);
|
|
3494
|
+
}
|
|
3495
|
+
get data() {
|
|
3496
|
+
return this.row;
|
|
3497
|
+
}
|
|
3498
|
+
get placeholder() {
|
|
3499
|
+
return this.row === void 0;
|
|
3500
|
+
}
|
|
3501
|
+
get groupValue() {
|
|
3502
|
+
let e = this.row;
|
|
3503
|
+
return e == null ? "" : e[this.groupColumn.key];
|
|
3504
|
+
}
|
|
3505
|
+
get groupKeys() {
|
|
3506
|
+
return [...this.level.groupKeys, this.groupValue];
|
|
3507
|
+
}
|
|
3508
|
+
get key() {
|
|
3509
|
+
return this.placeholder ? `${this.level.placeholderKey}-group-${this.rowIndex}` : Lt(this.groupKeys);
|
|
3510
|
+
}
|
|
3511
|
+
get depth() {
|
|
3512
|
+
return this.level.depth;
|
|
3513
|
+
}
|
|
3514
|
+
get count() {
|
|
3515
|
+
return this.level.groupCountAt(this.rowIndex) ?? 0;
|
|
3516
|
+
}
|
|
3517
|
+
get label() {
|
|
3518
|
+
if (this.placeholder) return "";
|
|
3519
|
+
let e = this.level.groupCountAt(this.rowIndex);
|
|
3520
|
+
return e === void 0 ? `${this.groupValue}` : `${this.groupValue} (${e})`;
|
|
3521
|
+
}
|
|
3522
|
+
aggregateValue(e) {
|
|
3523
|
+
let t = this.row?.[e.key];
|
|
3524
|
+
return typeof t == "number" || typeof t == "string" ? t : void 0;
|
|
3525
|
+
}
|
|
3526
|
+
get selectable() {
|
|
3527
|
+
return !1;
|
|
3528
|
+
}
|
|
3529
|
+
get selected() {
|
|
3530
|
+
return !1;
|
|
3531
|
+
}
|
|
3532
|
+
get indeterminate() {
|
|
3533
|
+
return !1;
|
|
3534
|
+
}
|
|
3535
|
+
get expanded() {
|
|
3536
|
+
return !this.placeholder && this.grid.expandedGroupRow.has(this.key);
|
|
3537
|
+
}
|
|
3538
|
+
get allRows() {
|
|
3539
|
+
return [];
|
|
3540
|
+
}
|
|
3541
|
+
toggleRow() {
|
|
3542
|
+
this.placeholder || this.grid.toggleGroupRow(this.key);
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
function Lt(e) {
|
|
3546
|
+
return `rb-group:${$.keyOf(e)}`;
|
|
3547
|
+
}
|
|
3548
|
+
//#endregion
|
|
3549
|
+
//#region src/components/dataGrid/models/sourceRowModel.ts
|
|
3550
|
+
var Rt = {}, zt = class extends H {
|
|
3551
|
+
sourceLevel;
|
|
3552
|
+
constructor(e, t, n) {
|
|
3553
|
+
super(e, Rt, n), this.sourceLevel = t;
|
|
3554
|
+
}
|
|
3555
|
+
get row() {
|
|
3556
|
+
return this.sourceLevel.rowAt(this.rowIndex);
|
|
3557
|
+
}
|
|
3558
|
+
get data() {
|
|
3559
|
+
return this.row ?? Rt;
|
|
3560
|
+
}
|
|
3561
|
+
get placeholder() {
|
|
3562
|
+
return this.row === void 0;
|
|
3563
|
+
}
|
|
3564
|
+
get key() {
|
|
3565
|
+
let e = this.row;
|
|
3566
|
+
return e === void 0 ? `${this.sourceLevel.placeholderKey}-${this.rowIndex}` : this.grid.getRowKey(e);
|
|
3567
|
+
}
|
|
3568
|
+
get expandOnRowClick() {
|
|
3569
|
+
return !this.placeholder && super.expandOnRowClick;
|
|
3570
|
+
}
|
|
3571
|
+
get expanded() {
|
|
3572
|
+
return !this.placeholder && super.expanded;
|
|
3573
|
+
}
|
|
3574
|
+
get selected() {
|
|
3575
|
+
return !this.placeholder && super.selected;
|
|
3576
|
+
}
|
|
3577
|
+
}, Bt = class extends zt {
|
|
3578
|
+
isTreeRow = !0;
|
|
3579
|
+
get level() {
|
|
3580
|
+
return this.sourceLevel.depth;
|
|
3581
|
+
}
|
|
3582
|
+
get position() {
|
|
3583
|
+
return this.rowIndex;
|
|
3584
|
+
}
|
|
3585
|
+
get siblings() {
|
|
3586
|
+
return this.sourceLevel.totalCount ?? -1;
|
|
3587
|
+
}
|
|
3588
|
+
get hasChildren() {
|
|
3589
|
+
return !this.placeholder && this.grid.tree.rowHasChildren(this.data);
|
|
3590
|
+
}
|
|
3591
|
+
get treeExpanded() {
|
|
3592
|
+
return this.hasChildren && this.grid.tree.isExpanded(this.key, this.level);
|
|
3593
|
+
}
|
|
3594
|
+
toggleTree = () => {
|
|
3595
|
+
this.hasChildren && this.grid.tree.toggle(this.key, this.level);
|
|
3596
|
+
};
|
|
3597
|
+
}, Vt = 100, Ht = 40, Ut = class {
|
|
3598
|
+
grid;
|
|
3599
|
+
constructor(e) {
|
|
3600
|
+
this.grid = e;
|
|
3601
|
+
}
|
|
3602
|
+
root = new $(this, []);
|
|
3603
|
+
levels = /* @__PURE__ */ new Map([[this.root.key, this.root]]);
|
|
3604
|
+
recent = [];
|
|
3605
|
+
_query = 0;
|
|
3606
|
+
get config() {
|
|
3607
|
+
return this.grid.props.def.dataSource;
|
|
3608
|
+
}
|
|
3609
|
+
get enabled() {
|
|
3610
|
+
return !!this.config;
|
|
3611
|
+
}
|
|
3612
|
+
get canGroup() {
|
|
3613
|
+
return !!this.config?.grouping && !this.isTree;
|
|
3614
|
+
}
|
|
3615
|
+
get isTree() {
|
|
3616
|
+
return this.enabled && !!this.grid.props.def.treeData;
|
|
3617
|
+
}
|
|
3618
|
+
get groupBy() {
|
|
3619
|
+
return this.canGroup ? [...this.grid.groupColumns] : [];
|
|
3620
|
+
}
|
|
3621
|
+
get blockSize() {
|
|
3622
|
+
let e = this.config?.blockSize;
|
|
3623
|
+
return e && e > 0 ? Math.floor(e) : this.grid.isPaginated ? this.grid.pageSize : Vt;
|
|
3624
|
+
}
|
|
3625
|
+
get maxBlocks() {
|
|
3626
|
+
let e = this.config?.maxBlocks;
|
|
3627
|
+
return e && e > 0 ? Math.floor(e) : Ht;
|
|
3628
|
+
}
|
|
3629
|
+
get queryVersion() {
|
|
3630
|
+
return this._query;
|
|
3631
|
+
}
|
|
3632
|
+
get totalCount() {
|
|
3633
|
+
return this.root.totalCount;
|
|
3634
|
+
}
|
|
3635
|
+
get isLoading() {
|
|
3636
|
+
for (let e of this.levels.values()) if (e.isLoading) return !0;
|
|
3637
|
+
return !1;
|
|
3638
|
+
}
|
|
3639
|
+
get error() {
|
|
3640
|
+
for (let e of this.levels.values()) {
|
|
3641
|
+
let t = e.failedBlocks();
|
|
3642
|
+
if (t.length > 0) return e.errorAt(t[0]);
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
_segments;
|
|
3646
|
+
_byLevel;
|
|
3647
|
+
segments() {
|
|
3648
|
+
if (this._segments) return this._segments;
|
|
3649
|
+
let e = [], t = /* @__PURE__ */ new Set(), n = 0, r = (t, r, i) => {
|
|
3650
|
+
i <= 0 || (e.push({
|
|
3651
|
+
start: n,
|
|
3652
|
+
levelStart: r,
|
|
3653
|
+
length: i,
|
|
3654
|
+
level: t
|
|
3655
|
+
}), n += i);
|
|
3656
|
+
}, i = (e) => {
|
|
3657
|
+
t.add(e.key);
|
|
3658
|
+
let n = 0;
|
|
3659
|
+
for (let { rowIndex: t, child: a } of this.expansionsOf(e)) t < n || t >= e.rowCount || (r(e, n, t - n + 1), n = t + 1, i(a));
|
|
3660
|
+
r(e, n, e.rowCount - n);
|
|
3661
|
+
};
|
|
3662
|
+
return i(this.root), this.levels.forEach((e, n) => {
|
|
3663
|
+
t.has(n) || (e.dispose(), this.levels.delete(n));
|
|
3664
|
+
}), this._segments = e, e;
|
|
3665
|
+
}
|
|
3666
|
+
byLevel() {
|
|
3667
|
+
if (this._byLevel) return this._byLevel;
|
|
3668
|
+
let e = /* @__PURE__ */ new Map();
|
|
3669
|
+
return this.segments().forEach((t) => {
|
|
3670
|
+
let n = t.level.key, r = e.get(n);
|
|
3671
|
+
r ? r.push(t) : e.set(n, [t]);
|
|
3672
|
+
}), this._byLevel = e;
|
|
3673
|
+
}
|
|
3674
|
+
expansionsOf(e) {
|
|
3675
|
+
if (this.isTree) return this.treeExpansionsOf(e);
|
|
3676
|
+
let t = this.grid.expandedGroupRow;
|
|
3677
|
+
if (!e.isGroupLevel || t.size === 0) return [];
|
|
3678
|
+
let n = this.blockSize, r = this.groupBy[e.depth], i = [];
|
|
3679
|
+
return e.loadedBlocks().forEach(({ index: a, rows: o }) => {
|
|
3680
|
+
o.forEach((o, s) => {
|
|
3681
|
+
let c = [...e.path, o[r]];
|
|
3682
|
+
if (!t.has(Lt(c))) return;
|
|
3683
|
+
let l = a * n + s;
|
|
3684
|
+
i.push({
|
|
3685
|
+
rowIndex: l,
|
|
3686
|
+
child: this.levelFor(c, e, l)
|
|
3687
|
+
});
|
|
3688
|
+
});
|
|
3689
|
+
}), i.sort((e, t) => e.rowIndex - t.rowIndex);
|
|
3690
|
+
}
|
|
3691
|
+
treeExpansionsOf(e) {
|
|
3692
|
+
let { tree: t } = this.grid;
|
|
3693
|
+
if (!t.mayExpand) return [];
|
|
3694
|
+
let n = this.blockSize, r = [];
|
|
3695
|
+
return e.loadedBlocks().forEach(({ index: i, rows: a }) => {
|
|
3696
|
+
a.forEach((a, o) => {
|
|
3697
|
+
if (!t.rowHasChildren(a)) return;
|
|
3698
|
+
let s = this.grid.getRowKey(a);
|
|
3699
|
+
if (!t.isExpanded(s, e.depth)) return;
|
|
3700
|
+
let c = i * n + o;
|
|
3701
|
+
r.push({
|
|
3702
|
+
rowIndex: c,
|
|
3703
|
+
child: this.levelFor([...e.path, s], e, c)
|
|
3704
|
+
});
|
|
3705
|
+
});
|
|
3706
|
+
}), r.sort((e, t) => e.rowIndex - t.rowIndex);
|
|
3707
|
+
}
|
|
3708
|
+
openTreeKeys() {
|
|
3709
|
+
if (!this.isTree) return [];
|
|
3710
|
+
this.segments();
|
|
3711
|
+
let e = [];
|
|
3712
|
+
return this.levels.forEach((t) => t.depth > 0 && e.push(t.path[t.depth - 1])), e;
|
|
3713
|
+
}
|
|
3714
|
+
levelFor(e, t, n) {
|
|
3715
|
+
let r = $.keyOf(e), i = this.levels.get(r);
|
|
3716
|
+
return i ? i.parentRowIndex = n : this.levels.set(r, i = new $(this, e, t, n)), i;
|
|
3717
|
+
}
|
|
3718
|
+
segmentAt(e) {
|
|
3719
|
+
let t = this.segments(), n = 0, r = t.length - 1;
|
|
3720
|
+
for (; n < r;) {
|
|
3721
|
+
let i = n + r + 1 >>> 1;
|
|
3722
|
+
t[i].start <= e ? n = i : r = i - 1;
|
|
3723
|
+
}
|
|
3724
|
+
let i = t[n];
|
|
3725
|
+
return i && e >= i.start && e < i.start + i.length ? i : void 0;
|
|
3726
|
+
}
|
|
3727
|
+
get rowCount() {
|
|
3728
|
+
if (!this.enabled) return 0;
|
|
3729
|
+
let e = this.segments(), t = e[e.length - 1];
|
|
3730
|
+
return t ? t.start + t.length : 0;
|
|
3731
|
+
}
|
|
3732
|
+
models = /* @__PURE__ */ new Map();
|
|
3733
|
+
listLength = -1;
|
|
3734
|
+
rowList() {
|
|
3735
|
+
let { start: e } = this.visibleRange();
|
|
3736
|
+
return this.listLength = this.visibleLength(), Ft(this.listLength, (t) => this.rowModelAt(e + t));
|
|
3737
|
+
}
|
|
3738
|
+
flatRowList(e) {
|
|
3739
|
+
let t = this.detailPositions();
|
|
3740
|
+
return t.length === 0 ? e : Ft(e.length + t.length, (n) => {
|
|
3741
|
+
let r = Gt(t, n);
|
|
3742
|
+
return t[r] === n ? new V(this.grid, e[n - r - 1]) : e[n - r];
|
|
3743
|
+
});
|
|
3744
|
+
}
|
|
3745
|
+
rowOffsets(e) {
|
|
3746
|
+
let { rowHeight: t } = this.grid, n = this.detailPositions(), r = [0];
|
|
3747
|
+
return n.forEach((t, n) => r.push(r[n] + e[t].heightForOffset)), {
|
|
3748
|
+
offsets: Ft(e.length, (e) => {
|
|
3749
|
+
let i = Gt(n, e);
|
|
3750
|
+
return (e - i) * t + r[i];
|
|
3751
|
+
}),
|
|
3752
|
+
totalHeight: (e.length - n.length) * t + r[n.length]
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3755
|
+
detailPositions() {
|
|
3756
|
+
let e = this.grid.expandedDetailRows;
|
|
3757
|
+
if (!this.grid.props.def.rowDetail || e.size === 0) return [];
|
|
3758
|
+
let { start: t, end: n } = this.visibleRange(), r = [];
|
|
3759
|
+
return this.eachLoadedLeafRow((i, a) => {
|
|
3760
|
+
i >= t && i < n && e.has(this.grid.getRowKey(a)) && r.push(i);
|
|
3761
|
+
}), r.sort((e, t) => e - t), r.map((e, n) => e - t + n + 1);
|
|
3762
|
+
}
|
|
3763
|
+
loadedRows() {
|
|
3764
|
+
let { start: e, end: t } = this.visibleRange(), n = [];
|
|
3765
|
+
return this.eachLoadedLeafRow((r, i) => {
|
|
3766
|
+
r >= e && r < t && n.push({
|
|
3767
|
+
display: r,
|
|
3768
|
+
row: i
|
|
3769
|
+
});
|
|
3770
|
+
}), n.sort((e, t) => e.display - t.display).map((e) => e.row);
|
|
3771
|
+
}
|
|
3772
|
+
eachLoadedLeafRow(e) {
|
|
3773
|
+
let t = this.blockSize;
|
|
3774
|
+
this.byLevel().forEach((n, r) => {
|
|
3775
|
+
let i = this.levels.get(r);
|
|
3776
|
+
!i || i.isGroupLevel || i.loadedBlocks().forEach(({ index: r, rows: i }) => {
|
|
3777
|
+
i.forEach((i, a) => {
|
|
3778
|
+
let o = Wt(n, r * t + a);
|
|
3779
|
+
o !== void 0 && e(o, i);
|
|
3780
|
+
});
|
|
3781
|
+
});
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
rowModelAt(e) {
|
|
3785
|
+
let t = this.segmentAt(e);
|
|
3786
|
+
if (!t) return new zt(this.grid, this.root, e);
|
|
3787
|
+
let { level: n } = t, r = t.levelStart + (e - t.start), i = this.models.get(n.key);
|
|
3788
|
+
i || this.models.set(n.key, i = /* @__PURE__ */ new Map());
|
|
3789
|
+
let a = i.get(r);
|
|
3790
|
+
return a || (a = n.isGroupLevel ? new It(this.grid, n, this.groupColumnAt(n.depth), r) : this.isTree ? new Bt(this.grid, n, r) : new zt(this.grid, n, r), i.set(r, a)), a;
|
|
3791
|
+
}
|
|
3792
|
+
groupColumnAt(e) {
|
|
3793
|
+
return W.findOrThrow(this.grid.columns.value.leafs, (t) => t.key === this.groupBy[e]);
|
|
3794
|
+
}
|
|
3795
|
+
visibleLength() {
|
|
3796
|
+
let { start: e, end: t } = this.visibleRange();
|
|
3797
|
+
return Math.max(0, t - e);
|
|
3798
|
+
}
|
|
3799
|
+
visibleRange() {
|
|
3800
|
+
if (!this.grid.isPaginated) return {
|
|
3801
|
+
start: 0,
|
|
3802
|
+
end: this.rowCount
|
|
3803
|
+
};
|
|
3804
|
+
let { pageSize: e } = this.grid, t = (this.grid.page - 1) * e;
|
|
3805
|
+
return {
|
|
3806
|
+
start: t,
|
|
3807
|
+
end: Math.min(t + e, Math.max(this.rowCount, t))
|
|
3808
|
+
};
|
|
3809
|
+
}
|
|
3810
|
+
rowAt(e) {
|
|
3811
|
+
let t = this.segmentAt(e);
|
|
3812
|
+
return t?.level.rowAt(t.levelStart + (e - t.start));
|
|
3813
|
+
}
|
|
3814
|
+
statusAt(e) {
|
|
3815
|
+
let t = this.segmentAt(e);
|
|
3816
|
+
return t ? t.level.statusAt(t.levelStart + (e - t.start)) : "missing";
|
|
3817
|
+
}
|
|
3818
|
+
request(e, t) {
|
|
3819
|
+
if (!this.enabled) return;
|
|
3820
|
+
let n = this.grid.isPaginated ? this.visibleRange() : {
|
|
3821
|
+
start: e,
|
|
3822
|
+
end: t
|
|
3823
|
+
}, r = {
|
|
3824
|
+
start: n.start,
|
|
3825
|
+
end: Math.max(n.end, n.start + 1)
|
|
3826
|
+
}, i = this.blockSize, a = !1;
|
|
3827
|
+
for (let e of this.segments()) {
|
|
3828
|
+
let t = Math.max(r.start, e.start), n = Math.min(r.end, e.start + e.length);
|
|
3829
|
+
if (n <= t) continue;
|
|
3830
|
+
let o = Math.floor((e.levelStart + (t - e.start)) / i), s = Math.floor((e.levelStart + (n - 1 - e.start)) / i);
|
|
3831
|
+
for (let t = o; t <= s; t++) this.touch(e.level, t), !e.level.has(t) && (e.level.load(t), a = !0);
|
|
3832
|
+
}
|
|
3833
|
+
this.evict(), a && this.changed();
|
|
3834
|
+
}
|
|
3835
|
+
expansionChanged() {
|
|
3836
|
+
this._segments = void 0, this._byLevel = void 0;
|
|
3837
|
+
}
|
|
3838
|
+
retry = () => {
|
|
3839
|
+
let e = !1;
|
|
3840
|
+
this.levels.forEach((t) => {
|
|
3841
|
+
t.failedBlocks().length !== 0 && (t.retry(), e = !0);
|
|
3842
|
+
}), e && this.changed();
|
|
3843
|
+
};
|
|
3844
|
+
invalidate() {
|
|
3845
|
+
if (!this.enabled) return;
|
|
3846
|
+
this._query++;
|
|
3847
|
+
let e = this.root.totalCount;
|
|
3848
|
+
this.levels.forEach((e) => e.dispose()), this.root = new $(this, [], void 0, 0, e), this.levels = /* @__PURE__ */ new Map([[this.root.key, this.root]]), this.recent = [], this.models.clear(), this.changed();
|
|
3849
|
+
}
|
|
3850
|
+
touch(e, t) {
|
|
3851
|
+
this.bump(e.key, t);
|
|
3852
|
+
for (let t = e.parent, n = e.parentRowIndex; t; n = t.parentRowIndex, t = t.parent) this.bump(t.key, Math.floor(n / this.blockSize));
|
|
3853
|
+
}
|
|
3854
|
+
bump(e, t) {
|
|
3855
|
+
let n = this.recent.findIndex((n) => n.level === e && n.index === t);
|
|
3856
|
+
n !== -1 && this.recent.splice(n, 1), this.recent.push({
|
|
3857
|
+
level: e,
|
|
3858
|
+
index: t
|
|
3859
|
+
});
|
|
3860
|
+
}
|
|
3861
|
+
evict() {
|
|
3862
|
+
for (; this.recent.length > this.maxBlocks;) {
|
|
3863
|
+
let e = this.recent.shift();
|
|
3864
|
+
this.levels.get(e.level)?.drop(e.index);
|
|
3865
|
+
}
|
|
3866
|
+
let e = this.blockSize;
|
|
3867
|
+
this.models.forEach((t, n) => {
|
|
3868
|
+
let r = this.levels.get(n);
|
|
3869
|
+
if (!r) return this.models.delete(n);
|
|
3870
|
+
t.forEach((n, i) => {
|
|
3871
|
+
r.has(Math.floor(i / e)) || t.delete(i);
|
|
3872
|
+
});
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
changed() {
|
|
3876
|
+
this._segments = void 0, this._byLevel = void 0, this.listLength !== this.visibleLength() && this.grid.rows.clear(), this.grid.flatRows.clear(), this.grid.notify();
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
function Wt(e, t) {
|
|
3880
|
+
for (let n of e) if (t >= n.levelStart && t < n.levelStart + n.length) return n.start + (t - n.levelStart);
|
|
3881
|
+
}
|
|
3882
|
+
function Gt(e, t) {
|
|
3883
|
+
let n = 0, r = e.length;
|
|
3884
|
+
for (; n < r;) {
|
|
3885
|
+
let i = n + r >>> 1;
|
|
3886
|
+
e[i] < t ? n = i + 1 : r = i;
|
|
3887
|
+
}
|
|
3888
|
+
return n;
|
|
3889
|
+
}
|
|
3890
|
+
//#endregion
|
|
3891
|
+
//#region src/components/dataGrid/models/exportModel.ts
|
|
3892
|
+
var Kt = 7, qt = class {
|
|
3893
|
+
grid;
|
|
3894
|
+
constructor(e) {
|
|
3895
|
+
this.grid = e;
|
|
3896
|
+
}
|
|
3897
|
+
columns(e) {
|
|
3898
|
+
let t = this.grid.columns.value.leafs.filter((e) => e.isData && (e.isVisible || this.grid.groupColumns.has(e.key)));
|
|
3899
|
+
return e ? e.map((e) => t.find((t) => t.key === e)).filter((e) => !!e) : t;
|
|
3900
|
+
}
|
|
3901
|
+
header(e) {
|
|
3902
|
+
return e.header ?? String(e.key);
|
|
3903
|
+
}
|
|
3904
|
+
width(e) {
|
|
3905
|
+
let t = e.inlineWidth ?? this.grid.DEFAULT_COLUMN_WIDTH_PX;
|
|
3906
|
+
return Math.min(80, Math.max(6, Math.round(t / Kt * 10) / 10));
|
|
3907
|
+
}
|
|
3908
|
+
value(e, t) {
|
|
3909
|
+
let { exportValue: n } = e.def, r = n ? n(t) : t[e.key];
|
|
3910
|
+
return this.grid.edits.edits.length ? this.grid.edits.valueOf(this.grid.getRowKey(t), e.key, r) : r;
|
|
3911
|
+
}
|
|
3912
|
+
aggregateOf(e, t) {
|
|
3913
|
+
let n = e.aggregate;
|
|
3914
|
+
return n ? je(n, t.map((t) => this.value(e, t)), t) : null;
|
|
3915
|
+
}
|
|
3916
|
+
table(e = {}) {
|
|
3917
|
+
let t = this.columns(e.columns), n = e.groups ?? !0, r = [], i = (e, a, o) => {
|
|
3918
|
+
for (let s of e) if (s.kind === "group") {
|
|
3919
|
+
let e = !s.expanded, c = s.allRows.map((e) => e.data);
|
|
3920
|
+
n && r.push({
|
|
3921
|
+
kind: "group",
|
|
3922
|
+
level: a,
|
|
3923
|
+
hidden: o,
|
|
3924
|
+
collapsed: e,
|
|
3925
|
+
values: t.map((e) => e.key === s.groupColumn.key ? s.groupValue : this.aggregateOf(e, c))
|
|
3926
|
+
}), i(s.rows, n ? a + 1 : a, o || n && e);
|
|
3927
|
+
} else {
|
|
3928
|
+
if (s.placeholder) continue;
|
|
3929
|
+
let e = U(s) ? s.level : a;
|
|
3930
|
+
r.push({
|
|
3931
|
+
kind: "data",
|
|
3932
|
+
level: e,
|
|
3933
|
+
hidden: o,
|
|
3934
|
+
collapsed: !1,
|
|
3935
|
+
values: t.map((e) => this.value(e, s.data))
|
|
3936
|
+
});
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
return this.grid.tree.isEager ? this.walkTree(r, t) : i(this.grid.rows.value, 0, !1), (e.footer ?? this.grid.aggregation.hasFooter) && r.push(this.footerRow(t)), {
|
|
3940
|
+
columns: t.map((e) => ({
|
|
3941
|
+
key: e.key,
|
|
3942
|
+
header: this.header(e),
|
|
3943
|
+
width: this.width(e),
|
|
3944
|
+
format: e.def.exportFormat
|
|
3945
|
+
})),
|
|
3946
|
+
rows: r
|
|
3947
|
+
};
|
|
3948
|
+
}
|
|
3949
|
+
walkTree(e, t) {
|
|
3950
|
+
let { tree: n } = this.grid, r = (i, a, o) => {
|
|
3951
|
+
i.forEach((i) => {
|
|
3952
|
+
let s = i.children.length > 0 && !n.isExpanded(this.grid.getRowKey(i.data), a);
|
|
3953
|
+
e.push({
|
|
3954
|
+
kind: "data",
|
|
3955
|
+
level: a,
|
|
3956
|
+
hidden: o,
|
|
3957
|
+
collapsed: s,
|
|
3958
|
+
values: t.map((e) => this.value(e, i.data))
|
|
3959
|
+
}), r(i.children, a + 1, o || s);
|
|
3960
|
+
});
|
|
3961
|
+
};
|
|
3962
|
+
r(n.nodes.value, 0, !1);
|
|
3963
|
+
}
|
|
3964
|
+
footerRow(e) {
|
|
3965
|
+
let t = this.grid.filteredData, n = this.grid.aggregation.footerLabel, r = e.find((e) => !e.aggregate);
|
|
3966
|
+
return {
|
|
3967
|
+
kind: "footer",
|
|
3968
|
+
level: 0,
|
|
3969
|
+
hidden: !1,
|
|
3970
|
+
collapsed: !1,
|
|
3971
|
+
values: e.map((e) => e.aggregate ? this.aggregateOf(e, t) : e === r && (typeof n == "string" || typeof n == "number") ? n : null)
|
|
3972
|
+
};
|
|
3973
|
+
}
|
|
3974
|
+
fileName(e = {}) {
|
|
3975
|
+
let { title: t } = this.grid.props.def, n = typeof t == "string" && t.trim() ? t.trim() : "export";
|
|
3976
|
+
return e.fileName?.trim() || n;
|
|
3977
|
+
}
|
|
3978
|
+
}, Jt = class {
|
|
3979
|
+
grid;
|
|
3980
|
+
constructor(e) {
|
|
3981
|
+
this.grid = e;
|
|
3982
|
+
}
|
|
3983
|
+
get globalFilterValue() {
|
|
3984
|
+
return this.grid.globalFilterValue;
|
|
3985
|
+
}
|
|
3986
|
+
get columnFilters() {
|
|
3987
|
+
return this.grid.columnFilters;
|
|
3988
|
+
}
|
|
3989
|
+
get hasActiveFilters() {
|
|
3990
|
+
return this.grid.hasActiveFilters;
|
|
3991
|
+
}
|
|
3992
|
+
get filterStats() {
|
|
3993
|
+
return this.grid.filterStats;
|
|
3994
|
+
}
|
|
3995
|
+
get hasFilterableColumns() {
|
|
3996
|
+
return this.grid.columns.value.visibleLeafs.some((e) => !!e.filterable);
|
|
3997
|
+
}
|
|
3998
|
+
setGlobalFilter = (e) => this.grid.setGlobalFilter(e);
|
|
3999
|
+
clearAllFilters = () => this.grid.clearAllFilters();
|
|
4000
|
+
}, Yt = class {
|
|
4001
|
+
grid;
|
|
4002
|
+
constructor(e) {
|
|
4003
|
+
this.grid = e;
|
|
4004
|
+
}
|
|
4005
|
+
get isPaginated() {
|
|
4006
|
+
return this.grid.isPaginated;
|
|
4007
|
+
}
|
|
4008
|
+
get state() {
|
|
4009
|
+
return this.grid.paginationState;
|
|
4010
|
+
}
|
|
4011
|
+
get pageSizeOptions() {
|
|
4012
|
+
return this.grid.pageSizeOptions;
|
|
4013
|
+
}
|
|
4014
|
+
get page() {
|
|
4015
|
+
return this.grid.page;
|
|
4016
|
+
}
|
|
4017
|
+
get pageSize() {
|
|
4018
|
+
return this.grid.pageSize;
|
|
4019
|
+
}
|
|
4020
|
+
get totalPages() {
|
|
4021
|
+
return this.state?.totalPages ?? 1;
|
|
4022
|
+
}
|
|
4023
|
+
get totalItems() {
|
|
4024
|
+
return this.state?.totalItems ?? 0;
|
|
4025
|
+
}
|
|
4026
|
+
get canGoPrev() {
|
|
4027
|
+
return this.page > 1;
|
|
4028
|
+
}
|
|
4029
|
+
get canGoNext() {
|
|
4030
|
+
return this.page < this.totalPages;
|
|
4031
|
+
}
|
|
4032
|
+
get startItem() {
|
|
4033
|
+
return (this.page - 1) * this.pageSize + 1;
|
|
4034
|
+
}
|
|
4035
|
+
get endItem() {
|
|
4036
|
+
return Math.min(this.startItem + this.pageSize - 1, this.totalItems);
|
|
4037
|
+
}
|
|
4038
|
+
changePage = (e) => this.grid.changePage(e);
|
|
4039
|
+
changePageSize = (e) => this.grid.changePageSize(e);
|
|
4040
|
+
firstPage = () => {
|
|
4041
|
+
this.canGoPrev && this.grid.changePage(1);
|
|
4042
|
+
};
|
|
4043
|
+
prevPage = () => {
|
|
4044
|
+
this.canGoPrev && this.grid.changePage(this.page - 1);
|
|
4045
|
+
};
|
|
4046
|
+
nextPage = () => {
|
|
4047
|
+
this.canGoNext && this.grid.changePage(this.page + 1);
|
|
4048
|
+
};
|
|
4049
|
+
lastPage = () => {
|
|
4050
|
+
this.canGoNext && this.grid.changePage(this.totalPages);
|
|
4051
|
+
};
|
|
4052
|
+
jumpToPage = (e) => {
|
|
4053
|
+
let t = parseInt(e, 10);
|
|
4054
|
+
isNaN(t) || this.grid.changePage(Math.max(1, Math.min(t, this.totalPages)));
|
|
4055
|
+
};
|
|
4056
|
+
}, Xt = class extends H {
|
|
4057
|
+
node;
|
|
4058
|
+
level;
|
|
4059
|
+
position;
|
|
4060
|
+
siblings;
|
|
4061
|
+
treeParent;
|
|
4062
|
+
isTreeRow = !0;
|
|
4063
|
+
constructor(e, t, n, r, i, a, o) {
|
|
4064
|
+
super(e, t.data, n), this.node = t, this.level = r, this.position = i, this.siblings = a, this.treeParent = o;
|
|
4065
|
+
}
|
|
4066
|
+
children = [];
|
|
4067
|
+
get hasChildren() {
|
|
4068
|
+
return this.node.children.length > 0;
|
|
4069
|
+
}
|
|
4070
|
+
get treeExpanded() {
|
|
4071
|
+
return this.hasChildren && this.grid.tree.isExpanded(this.key, this.level);
|
|
4072
|
+
}
|
|
4073
|
+
toggleTree = () => {
|
|
4074
|
+
this.grid.tree.toggle(this.key, this.level);
|
|
4075
|
+
};
|
|
4076
|
+
_subtreeKeys = B(() => {
|
|
4077
|
+
let e = [], t = (n) => {
|
|
4078
|
+
n.forEach((n) => {
|
|
4079
|
+
e.push(this.grid.getRowKey(n.data)), t(n.children);
|
|
4080
|
+
});
|
|
4081
|
+
};
|
|
4082
|
+
return e.push(this.key), t(this.node.children), e;
|
|
4083
|
+
});
|
|
4084
|
+
get subtreeKeys() {
|
|
4085
|
+
return this._subtreeKeys.value;
|
|
4086
|
+
}
|
|
4087
|
+
get selected() {
|
|
4088
|
+
return this.grid.tree.cascades ? this.subtreeKeys.every((e) => this.grid.selectedRows.has(e)) : super.selected;
|
|
4089
|
+
}
|
|
4090
|
+
get indeterminate() {
|
|
4091
|
+
return this.grid.tree.cascades ? !this.selected && this.subtreeKeys.some((e) => this.grid.selectedRows.has(e)) : !1;
|
|
4092
|
+
}
|
|
4093
|
+
toggleSelection = () => {
|
|
4094
|
+
if (!this.grid.tree.cascades) {
|
|
4095
|
+
this.grid.toggleRowSelection(this.key);
|
|
4096
|
+
return;
|
|
4097
|
+
}
|
|
4098
|
+
this.grid.toggleRowsSelection(this.subtreeKeys);
|
|
4099
|
+
};
|
|
4100
|
+
get flatRows() {
|
|
4101
|
+
let e = super.flatRows;
|
|
4102
|
+
return this.children.length === 0 ? e : [...e, ...this.children.flatMap((e) => e.flatRows)];
|
|
4103
|
+
}
|
|
4104
|
+
};
|
|
4105
|
+
//#endregion
|
|
4106
|
+
//#region src/components/dataGrid/models/treeModel.ts
|
|
4107
|
+
function Zt(e) {
|
|
4108
|
+
return JSON.stringify(e);
|
|
4109
|
+
}
|
|
4110
|
+
var Qt = class {
|
|
4111
|
+
grid;
|
|
4112
|
+
constructor(e) {
|
|
4113
|
+
this.grid = e;
|
|
4114
|
+
}
|
|
4115
|
+
get config() {
|
|
4116
|
+
return this.grid.props.def.treeData;
|
|
4117
|
+
}
|
|
4118
|
+
get enabled() {
|
|
4119
|
+
return !!this.config;
|
|
4120
|
+
}
|
|
4121
|
+
get isEager() {
|
|
4122
|
+
return this.enabled && !this.grid.source.enabled;
|
|
4123
|
+
}
|
|
4124
|
+
get isLazy() {
|
|
4125
|
+
return this.enabled && this.grid.source.enabled;
|
|
4126
|
+
}
|
|
4127
|
+
rowHasChildren(e) {
|
|
4128
|
+
let { hasChildren: t } = this.config ?? {};
|
|
4129
|
+
return typeof t == "function" ? !!t(e) : t ? !!e[t] : !1;
|
|
4130
|
+
}
|
|
4131
|
+
get columnKey() {
|
|
4132
|
+
if (this.enabled) return this.config?.column ?? this.grid.columns.value.userVisibleLeafs[0]?.key;
|
|
4133
|
+
}
|
|
4134
|
+
get indent() {
|
|
4135
|
+
return this.config?.indent ?? 4;
|
|
4136
|
+
}
|
|
4137
|
+
get cascades() {
|
|
4138
|
+
return this.config?.selection === "cascade" && !this.isLazy;
|
|
4139
|
+
}
|
|
4140
|
+
get isFlat() {
|
|
4141
|
+
return !!(this.config?.getPath || this.config?.pathKey);
|
|
4142
|
+
}
|
|
4143
|
+
childrenOf(e) {
|
|
4144
|
+
let { getChildren: t, childrenKey: n } = this.config ?? {};
|
|
4145
|
+
return t ? t(e) ?? [] : n ? e[n] ?? [] : [];
|
|
4146
|
+
}
|
|
4147
|
+
pathOf(e) {
|
|
4148
|
+
let { getPath: t, pathKey: n } = this.config ?? {};
|
|
4149
|
+
return t ? t(e) ?? [] : n ? e[n] ?? [] : [];
|
|
4150
|
+
}
|
|
4151
|
+
buildNested(e) {
|
|
4152
|
+
return e.map((e) => ({
|
|
4153
|
+
data: e,
|
|
4154
|
+
children: this.buildNested(this.childrenOf(e))
|
|
4155
|
+
}));
|
|
4156
|
+
}
|
|
4157
|
+
buildFlat(e) {
|
|
4158
|
+
let t = [], n = /* @__PURE__ */ new Map();
|
|
4159
|
+
return [...e].sort((e, t) => this.pathOf(e).length - this.pathOf(t).length).forEach((e) => {
|
|
4160
|
+
let r = this.pathOf(e), i = {
|
|
4161
|
+
data: e,
|
|
4162
|
+
children: []
|
|
4163
|
+
};
|
|
4164
|
+
n.set(Zt(r), i);
|
|
4165
|
+
let a;
|
|
4166
|
+
for (let e = r.length - 1; e > 0 && !a; e--) a = n.get(Zt(r.slice(0, e)));
|
|
4167
|
+
(a ? a.children : t).push(i);
|
|
4168
|
+
}), t;
|
|
4169
|
+
}
|
|
4170
|
+
prune(e) {
|
|
4171
|
+
let t = [];
|
|
4172
|
+
return e.forEach((e) => {
|
|
4173
|
+
let n = this.prune(e.children);
|
|
4174
|
+
(n.length > 0 || this.grid.rowMatchesFilters(e.data)) && t.push({
|
|
4175
|
+
data: e.data,
|
|
4176
|
+
children: n
|
|
4177
|
+
});
|
|
4178
|
+
}), t;
|
|
4179
|
+
}
|
|
4180
|
+
sortNodes(e) {
|
|
4181
|
+
let { sortColumn: t, sortDirection: n } = this.grid;
|
|
4182
|
+
return t === void 0 ? e : W.sortBy(e, (e) => e.data[t], n).map((e) => ({
|
|
4183
|
+
data: e.data,
|
|
4184
|
+
children: this.sortNodes(e.children)
|
|
4185
|
+
}));
|
|
4186
|
+
}
|
|
4187
|
+
nodes = B(() => {
|
|
4188
|
+
if (!this.isEager) return [];
|
|
4189
|
+
let e = this.isFlat ? this.buildFlat(this.grid.data) : this.buildNested(this.grid.data);
|
|
4190
|
+
return this.sortNodes(this.grid.hasRowFilters ? this.prune(e) : e);
|
|
4191
|
+
});
|
|
4192
|
+
allRows = B(() => {
|
|
4193
|
+
let e = [], t = (n) => {
|
|
4194
|
+
n.forEach((n) => {
|
|
4195
|
+
e.push(n.data), t(n.children);
|
|
4196
|
+
});
|
|
4197
|
+
};
|
|
4198
|
+
return t(this.nodes.value), e;
|
|
4199
|
+
}, () => [this.nodes]);
|
|
4200
|
+
everyRow() {
|
|
4201
|
+
if (!this.isEager) return [];
|
|
4202
|
+
if (this.isFlat) return this.grid.data;
|
|
4203
|
+
let e = [], t = (n) => {
|
|
4204
|
+
n.forEach((n) => {
|
|
4205
|
+
e.push(n), t(this.childrenOf(n));
|
|
4206
|
+
});
|
|
4207
|
+
};
|
|
4208
|
+
return t(this.grid.data), e;
|
|
4209
|
+
}
|
|
4210
|
+
rowList() {
|
|
4211
|
+
let e = 0, t = (n, r, i) => n.map((a, o) => {
|
|
4212
|
+
let s = new Xt(this.grid, a, e++, r, o, n.length, i);
|
|
4213
|
+
return s.treeExpanded && (s.children = t(a.children, r + 1, s)), s;
|
|
4214
|
+
});
|
|
4215
|
+
return t(this.nodes.value, 0);
|
|
4216
|
+
}
|
|
4217
|
+
_opened = /* @__PURE__ */ new Set();
|
|
4218
|
+
_closed = /* @__PURE__ */ new Set();
|
|
4219
|
+
_cachedKeys;
|
|
4220
|
+
keySet(e) {
|
|
4221
|
+
return this._cachedKeys?.source !== e && (this._cachedKeys = {
|
|
4222
|
+
source: e,
|
|
4223
|
+
set: new Set(e)
|
|
4224
|
+
}), this._cachedKeys.set;
|
|
4225
|
+
}
|
|
4226
|
+
defaultExpanded(e, t) {
|
|
4227
|
+
let n = this.config?.defaultExpanded;
|
|
4228
|
+
return Array.isArray(n) ? this.keySet(n).has(e) : typeof n == "number" ? t < n : n === !0;
|
|
4229
|
+
}
|
|
4230
|
+
get mayExpand() {
|
|
4231
|
+
if (this.grid.props.expandedTreeKeys || this._opened.size > 0) return !0;
|
|
4232
|
+
let e = this.config?.defaultExpanded;
|
|
4233
|
+
return Array.isArray(e) ? e.length > 0 : e === !0 || typeof e == "number" && e > 0;
|
|
4234
|
+
}
|
|
4235
|
+
isExpanded(e, t) {
|
|
4236
|
+
let n = this.grid.props.expandedTreeKeys;
|
|
4237
|
+
return n ? this.keySet(n).has(e) : this._opened.has(e) ? !0 : !this._closed.has(e) && this.defaultExpanded(e, t);
|
|
4238
|
+
}
|
|
4239
|
+
expandedKeys() {
|
|
4240
|
+
if (this.isLazy) return this.grid.source.openTreeKeys();
|
|
4241
|
+
let e = [], t = (n, r) => {
|
|
4242
|
+
n.forEach((n) => {
|
|
4243
|
+
if (n.children.length === 0) return;
|
|
4244
|
+
let i = this.grid.getRowKey(n.data);
|
|
4245
|
+
this.isExpanded(i, r) && (e.push(i), t(n.children, r + 1));
|
|
4246
|
+
});
|
|
4247
|
+
};
|
|
4248
|
+
return t(this.nodes.value, 0), e;
|
|
4249
|
+
}
|
|
4250
|
+
toggle = (e, t) => {
|
|
4251
|
+
let n = !this.isExpanded(e, t);
|
|
4252
|
+
n ? (this._opened.add(e), this._closed.delete(e)) : (this._closed.add(e), this._opened.delete(e)), this.grid.treeExpansionChanged(), this.grid.props.onExpandedTreeKeysChange?.(this.expandedKeys(), { reason: n ? "expand" : "collapse" }), this.grid.notify();
|
|
4253
|
+
};
|
|
4254
|
+
}, $t = class e {
|
|
4255
|
+
grid;
|
|
4256
|
+
static DEFAULT_VISIBLE_ROWS_COUNT = 10;
|
|
4257
|
+
static ROWS_TO_PRELOAD = 20;
|
|
4258
|
+
constructor(e) {
|
|
4259
|
+
this.grid = e;
|
|
4260
|
+
}
|
|
4261
|
+
get showAll() {
|
|
4262
|
+
return this.grid.props.def.visibleRowsCount === "all";
|
|
4263
|
+
}
|
|
4264
|
+
get hasDetailRows() {
|
|
4265
|
+
return !!this.grid.props.def.rowDetail;
|
|
4266
|
+
}
|
|
4267
|
+
get isEmpty() {
|
|
4268
|
+
return this.grid.source.enabled ? this.grid.flatRows.value.length === 0 : this.grid.data.length === 0;
|
|
4269
|
+
}
|
|
4270
|
+
get visibleRowsCount() {
|
|
4271
|
+
if (this.showAll) return this.grid.flatRows.value.length;
|
|
4272
|
+
let t = this.grid.props.def.visibleRowsCount;
|
|
4273
|
+
return typeof t == "number" ? t : e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
4274
|
+
}
|
|
4275
|
+
get pageRows() {
|
|
4276
|
+
let t = this.grid.props.def.visibleRowsCount;
|
|
4277
|
+
return typeof t == "number" ? t : e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
4278
|
+
}
|
|
4279
|
+
get viewHeight() {
|
|
4280
|
+
if (this.showAll) return;
|
|
4281
|
+
let { rowHeight: e } = this.grid;
|
|
4282
|
+
return e * this.visibleRowsCount + e / 5;
|
|
4283
|
+
}
|
|
4284
|
+
get totalHeight() {
|
|
4285
|
+
return this.hasDetailRows ? this.grid.rowOffsets.value.totalHeight : this.grid.flatRows.value.length * this.grid.rowHeight;
|
|
4286
|
+
}
|
|
4287
|
+
get emptyHeight() {
|
|
4288
|
+
return this.viewHeight ?? this.grid.rowHeight * e.DEFAULT_VISIBLE_ROWS_COUNT;
|
|
4289
|
+
}
|
|
4290
|
+
rowTop(e) {
|
|
4291
|
+
return this.hasDetailRows ? this.grid.rowOffsets.value.offsets[e] ?? 0 : e * this.grid.rowHeight;
|
|
4292
|
+
}
|
|
4293
|
+
findStartIndex(e, t) {
|
|
4294
|
+
let n = 0, r = e.length - 1;
|
|
4295
|
+
for (; n < r;) {
|
|
4296
|
+
let i = n + r + 1 >>> 1;
|
|
4297
|
+
e[i] <= t ? n = i : r = i - 1;
|
|
4298
|
+
}
|
|
4299
|
+
return n;
|
|
4300
|
+
}
|
|
4301
|
+
window(t) {
|
|
4302
|
+
let n = this.grid.flatRows.value.length;
|
|
4303
|
+
if (this.showAll) return {
|
|
4304
|
+
startIndex: 0,
|
|
4305
|
+
take: n,
|
|
4306
|
+
translateY: 0,
|
|
4307
|
+
totalHeight: this.totalHeight,
|
|
4308
|
+
viewHeight: void 0
|
|
4309
|
+
};
|
|
4310
|
+
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;
|
|
4311
|
+
return {
|
|
4312
|
+
startIndex: o,
|
|
4313
|
+
take: this.visibleRowsCount + i * 2,
|
|
4314
|
+
translateY: s,
|
|
4315
|
+
totalHeight: this.totalHeight,
|
|
4316
|
+
viewHeight: this.viewHeight
|
|
4317
|
+
};
|
|
4318
|
+
}
|
|
4319
|
+
}, en = {}, tn = class {
|
|
4320
|
+
props;
|
|
4321
|
+
constructor(e, t) {
|
|
4322
|
+
this.props = e, t && this.listeners.add(t);
|
|
4323
|
+
}
|
|
4324
|
+
_version = 0;
|
|
4325
|
+
listeners = /* @__PURE__ */ new Set();
|
|
4326
|
+
subscribe = (e) => (this.listeners.add(e), () => this.listeners.delete(e));
|
|
4327
|
+
getSnapshot = () => this._version;
|
|
4328
|
+
notify = () => {
|
|
4329
|
+
this._version++, this.listeners.forEach((e) => e());
|
|
4330
|
+
};
|
|
4331
|
+
setProps(e) {
|
|
4332
|
+
let t = this.props;
|
|
4333
|
+
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.expandedTreeKeys !== e.expandedTreeKeys || t.page !== e.page || t.pageSize !== e.pageSize) && this.rows.clear(), (t.data !== e.data || t.def !== e.def || t.globalFilterValue !== e.globalFilterValue || t.columnFilters !== e.columnFilters || t.filters !== e.filters) && this.tree.nodes.clear());
|
|
4334
|
+
}
|
|
4335
|
+
get data() {
|
|
4336
|
+
return this.props.data ?? [];
|
|
4337
|
+
}
|
|
4338
|
+
get loadedRows() {
|
|
4339
|
+
return this.source.enabled ? this.source.loadedRows() : this.tree.isEager ? this.tree.allRows.value : this.data;
|
|
4340
|
+
}
|
|
4341
|
+
get componentName() {
|
|
4342
|
+
return this.props.component || "datagrid";
|
|
4343
|
+
}
|
|
4344
|
+
_identifier = "datagrid";
|
|
4345
|
+
get identifier() {
|
|
4346
|
+
return this._identifier;
|
|
4347
|
+
}
|
|
4348
|
+
setIdentifier(e) {
|
|
4349
|
+
this._identifier = e;
|
|
4350
|
+
}
|
|
4351
|
+
get titleId() {
|
|
4352
|
+
return `${this._identifier}-title`;
|
|
4353
|
+
}
|
|
4354
|
+
get resizerStyle() {
|
|
4355
|
+
return this.props.def.resizerStyle ?? "visible";
|
|
4356
|
+
}
|
|
4357
|
+
get resizeMode() {
|
|
4358
|
+
return this.props.def.resizeMode ?? "smooth";
|
|
4359
|
+
}
|
|
4360
|
+
sourceColumns = B(() => {
|
|
4361
|
+
let { def: e } = this.props, t = [];
|
|
4362
|
+
if (this.groupColumns.size > 0 && t.push(new Z({ key: G }, this)), t.push(...e.columns.map((e) => new Z(e, this))), e.rowSelection) {
|
|
4363
|
+
let n = typeof e.rowSelection == "object" && e.rowSelection.pinned ? "START" : void 0;
|
|
4364
|
+
t.unshift(new Z({
|
|
4365
|
+
key: Ee,
|
|
4366
|
+
pin: n,
|
|
4367
|
+
width: 50,
|
|
4368
|
+
align: "center",
|
|
4369
|
+
Cell: At
|
|
4370
|
+
}, this));
|
|
4371
|
+
}
|
|
4372
|
+
if (e.showRowNumber) {
|
|
4373
|
+
let n, r = 70;
|
|
4374
|
+
typeof e.showRowNumber == "object" && (e.showRowNumber.pinned && (n = "START"), r = e.showRowNumber.width ?? 70), t.unshift(new Z({
|
|
4375
|
+
key: Te,
|
|
4376
|
+
pin: n,
|
|
4377
|
+
width: r,
|
|
4378
|
+
align: "end"
|
|
4379
|
+
}, this));
|
|
4380
|
+
}
|
|
4381
|
+
if (e.rowDetail) {
|
|
4382
|
+
let n = e.rowDetail.pinned ? "START" : void 0, r = e.rowDetail.expandColumnWidth ?? 50, i = e.rowDetail.expandColumnHeader ?? "";
|
|
4383
|
+
t.unshift(new Z({
|
|
4384
|
+
key: De,
|
|
4385
|
+
header: i,
|
|
4386
|
+
pin: n,
|
|
4387
|
+
width: r,
|
|
4388
|
+
align: "center",
|
|
4389
|
+
Cell: kt
|
|
4390
|
+
}, this));
|
|
4391
|
+
}
|
|
4392
|
+
return t;
|
|
4393
|
+
});
|
|
4394
|
+
columns = B(() => {
|
|
4395
|
+
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 = [
|
|
4396
|
+
...e,
|
|
4397
|
+
...t,
|
|
4398
|
+
...n
|
|
4399
|
+
].flatMap((e) => e.flatColumns), i = r.filter((e) => e.isLeaf), a = r.filter((e) => e.isLeaf && e.isVisible);
|
|
4400
|
+
return {
|
|
4401
|
+
start: e,
|
|
4402
|
+
middle: t,
|
|
4403
|
+
end: n,
|
|
4404
|
+
flat: r,
|
|
4405
|
+
leafs: i,
|
|
4406
|
+
visibleLeafs: a,
|
|
4407
|
+
userVisibleLeafs: a.filter((e) => ![
|
|
4408
|
+
Te,
|
|
4409
|
+
Ee,
|
|
4410
|
+
G,
|
|
4411
|
+
De
|
|
4412
|
+
].includes(e.key)),
|
|
4413
|
+
maxDeath: W.maxBy(r, (e) => e.death) + 1
|
|
4414
|
+
};
|
|
4415
|
+
}, () => [this.sourceColumns]);
|
|
4416
|
+
headerRows = B(() => W.sortBy(W.groupBy(this.columns.value.flat, (e) => e.death), (e) => e.key).map((e) => {
|
|
4417
|
+
let t = W.toRecord(W.groupBy(e.values, (e) => e.pin ?? "NO_PIN"), (e) => [e.key, e.values]);
|
|
4418
|
+
return [
|
|
4419
|
+
...t.START?.filter((e) => e.isVisible) ?? [],
|
|
4420
|
+
...t.NO_PIN?.filter((e) => e.isVisible) ?? [],
|
|
4421
|
+
...t.END?.filter((e) => e.isVisible) ?? []
|
|
4422
|
+
];
|
|
4423
|
+
}), () => [this.columns]);
|
|
4424
|
+
gridTemplateColumns = B(() => {
|
|
4425
|
+
let { visibleLeafs: e } = this.columns.value, t = W.sumBy(e, (e) => +(e.pin === "END")), n = e.length - t;
|
|
4426
|
+
return `${n > 0 ? `repeat(${n}, max-content)` : ""} ${t > 0 ? `repeat(${t}, max-content)` : ""}`.trim();
|
|
4427
|
+
}, () => [this.columns]);
|
|
4428
|
+
_globalFilterValue = "";
|
|
4429
|
+
get globalFilterValue() {
|
|
4430
|
+
return this.props.globalFilterValue ?? this._globalFilterValue;
|
|
4431
|
+
}
|
|
4432
|
+
_columnFilters = {};
|
|
4433
|
+
get columnFilters() {
|
|
4434
|
+
return this.props.columnFilters ?? this._columnFilters;
|
|
4435
|
+
}
|
|
4436
|
+
globalFilterColumns = B(() => this.props.def.globalFilterKeys ?? 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), () => [this.columns]);
|
|
4437
|
+
rowMatchesFilters(e) {
|
|
4438
|
+
let { filters: t } = this.props;
|
|
4439
|
+
return t && !t.every((t) => t(e)) || this.props.def.globalFilter && !this.matchesGlobalFilter(e) ? !1 : this.matchesColumnFilters(e);
|
|
4440
|
+
}
|
|
4441
|
+
get hasRowFilters() {
|
|
4442
|
+
return (this.props.filters?.length ?? 0) > 0 || !!this.props.def.globalFilter && this.globalFilterValue.trim() !== "" || Object.keys(this.columnFilters).length > 0;
|
|
4443
|
+
}
|
|
4444
|
+
matchesGlobalFilter(e) {
|
|
4445
|
+
let t = this.globalFilterValue.trim();
|
|
4446
|
+
return !t || this.globalFilterColumns.value.some((n) => {
|
|
4447
|
+
let r = e[n];
|
|
4448
|
+
return r != null && Ot(t, String(r));
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
matchesColumnFilters(e) {
|
|
4452
|
+
let t = this.columnFilters;
|
|
4453
|
+
return Object.keys(t).every((n) => {
|
|
4454
|
+
let r = t[n];
|
|
4455
|
+
return !r || this.matchesFilter(e[n], r);
|
|
4456
|
+
});
|
|
4457
|
+
}
|
|
4458
|
+
matchesFilter(e, t) {
|
|
4459
|
+
switch (t.type) {
|
|
4460
|
+
case "text": return !t.value.trim() || e != null && Ot(t.value, String(e));
|
|
4461
|
+
case "number": {
|
|
4462
|
+
if (e == null) return !1;
|
|
4463
|
+
let n = typeof e == "number" ? e : parseFloat(String(e));
|
|
4464
|
+
if (isNaN(n)) return !1;
|
|
4465
|
+
switch (t.operator) {
|
|
4466
|
+
case "eq": return n === t.value;
|
|
4467
|
+
case "ne": return n !== t.value;
|
|
4468
|
+
case "gt": return n > t.value;
|
|
4469
|
+
case "gte": return n >= t.value;
|
|
4470
|
+
case "lt": return n < t.value;
|
|
4471
|
+
case "lte": return n <= t.value;
|
|
4472
|
+
case "between": return t.valueTo === void 0 ? n >= t.value : n >= t.value && n <= t.valueTo;
|
|
4473
|
+
default: return !0;
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
case "multiselect": return t.values.length === 0 || t.values.includes(e);
|
|
4477
|
+
default: return !0;
|
|
4478
|
+
}
|
|
4479
|
+
}
|
|
4480
|
+
get filteredData() {
|
|
4481
|
+
return this.source.enabled || this.isPaginated ? this.data : this.tree.isEager ? this.tree.allRows.value : this.hasRowFilters ? this.data.filter((e) => this.rowMatchesFilters(e)) : this.data;
|
|
4482
|
+
}
|
|
4483
|
+
fireServerStateChange(e, t) {
|
|
4484
|
+
this.props.onServerStateChange?.({
|
|
4485
|
+
page: t?.page ?? this.page,
|
|
4486
|
+
pageSize: t?.pageSize ?? this.pageSize,
|
|
4487
|
+
sortColumn: "sortColumn" in (t ?? {}) ? t.sortColumn : this._sortColumn,
|
|
4488
|
+
sortDirection: "sortDirection" in (t ?? {}) ? t.sortDirection : this._sortDirection,
|
|
4489
|
+
columnFilters: t?.columnFilters ?? this.columnFilters,
|
|
4490
|
+
globalFilterValue: t?.globalFilterValue ?? this.globalFilterValue
|
|
4491
|
+
}, { reason: e });
|
|
4492
|
+
}
|
|
4493
|
+
firePaginationChange(e, t, n) {
|
|
4494
|
+
this.props.onPaginationChange?.({
|
|
4495
|
+
page: e,
|
|
4496
|
+
pageSize: t
|
|
4497
|
+
}, { reason: n }), this.props.onPageChange?.(e, t);
|
|
4498
|
+
}
|
|
4499
|
+
resetToFirstPage(e) {
|
|
4500
|
+
return !this.isPaginated || this.page === 1 ? this.page : (this._page = 1, this.firePaginationChange(1, this.pageSize, e), 1);
|
|
4501
|
+
}
|
|
4502
|
+
setGlobalFilter = (e) => {
|
|
4503
|
+
let t = e === "" ? "clear" : "filter";
|
|
4504
|
+
this._globalFilterValue = e, this.props.onGlobalFilterChange?.(e, { reason: t });
|
|
4505
|
+
let n = this.resetToFirstPage(t);
|
|
4506
|
+
this.fireServerStateChange(t, {
|
|
4507
|
+
globalFilterValue: e,
|
|
4508
|
+
page: n
|
|
4509
|
+
}), this.source.invalidate(), this.tree.nodes.clear(), this.rows.clear(), this.notify();
|
|
4510
|
+
};
|
|
4511
|
+
setColumnFilter = (e, t) => {
|
|
4512
|
+
let n = { ...this.columnFilters }, r = t === void 0 ? "clear" : "filter";
|
|
4513
|
+
t === void 0 ? delete n[e] : n[e] = t, this._columnFilters = n, this.props.onColumnFiltersChange?.(n, { reason: r });
|
|
4514
|
+
let i = this.resetToFirstPage(r);
|
|
4515
|
+
this.fireServerStateChange(r, {
|
|
4516
|
+
columnFilters: n,
|
|
4517
|
+
page: i
|
|
4518
|
+
}), this.source.invalidate(), this.tree.nodes.clear(), this.rows.clear(), this.notify();
|
|
4519
|
+
};
|
|
4520
|
+
clearColumnFilters = () => {
|
|
4521
|
+
this._columnFilters = {}, this.props.onColumnFiltersChange?.({}, { reason: "clear" }), this.fireServerStateChange("clear", { columnFilters: {} }), this.source.invalidate(), this.tree.nodes.clear(), this.rows.clear(), this.notify();
|
|
4522
|
+
};
|
|
4523
|
+
clearAllFilters = () => {
|
|
4524
|
+
this.setGlobalFilter(""), this.clearColumnFilters();
|
|
4525
|
+
};
|
|
4526
|
+
getColumnUniqueValues = (e) => {
|
|
4527
|
+
let t = /* @__PURE__ */ new Set();
|
|
4528
|
+
return (this.tree.isEager ? this.tree.everyRow() : this.data).forEach((n) => {
|
|
4529
|
+
let r = n[e];
|
|
4530
|
+
r !== void 0 && t.add(r);
|
|
4531
|
+
}), 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)));
|
|
4532
|
+
};
|
|
4533
|
+
get hasActiveFilters() {
|
|
4534
|
+
return this.globalFilterValue.trim() !== "" || Object.keys(this.columnFilters).length > 0;
|
|
4535
|
+
}
|
|
4536
|
+
get filterStats() {
|
|
4537
|
+
if (this.source.enabled || this.isPaginated) {
|
|
4538
|
+
let e = this.totalRowCount;
|
|
4539
|
+
return {
|
|
4540
|
+
filtered: e,
|
|
4541
|
+
total: e
|
|
4542
|
+
};
|
|
4543
|
+
}
|
|
4544
|
+
return {
|
|
4545
|
+
filtered: this.filteredData.length,
|
|
4546
|
+
total: this.tree.isEager ? this.tree.everyRow().length : this.data.length
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
get totalRowCount() {
|
|
4550
|
+
return this.source.enabled ? this.source.rowCount : this.tree.isEager ? this.tree.everyRow().length : this.props.def.pagination?.totalCount ?? this.data.length;
|
|
4551
|
+
}
|
|
4552
|
+
rows = B(() => {
|
|
4553
|
+
if (this.source.enabled) return this.source.rowList();
|
|
4554
|
+
if (this.tree.isEager) return this.tree.rowList();
|
|
4555
|
+
let e = this.filteredData;
|
|
4556
|
+
if (this._sortColumn && !this.isPaginated && (e = W.sortBy(e, (e) => e[this._sortColumn], this._sortDirection)), this.groupColumns.size > 0) {
|
|
4557
|
+
let t = (e, n, r) => {
|
|
4558
|
+
let i = n.values().next().value;
|
|
4559
|
+
n.delete(i);
|
|
4560
|
+
let a = W.findOrThrow(this.columns.value.leafs, (e) => e.key === i);
|
|
4561
|
+
return this._sortColumn === "grouping-cell" && (e = W.sortBy(e, (e) => e[i], this._sortDirection)), W.groupBy(e, (e) => e[i]).map((e) => {
|
|
4562
|
+
let i;
|
|
4563
|
+
i = n.size > 0 ? t(e.values, new Set(n), r + 1) : e.values.map((e, t) => new H(this, e, r + 1 + t));
|
|
4564
|
+
let o = new Fe(this, a, i, r, e.key);
|
|
4565
|
+
return r += 1, o.expanded && (r += i.length), o;
|
|
4566
|
+
});
|
|
4567
|
+
};
|
|
4568
|
+
return t(e, new Set(this.groupColumns), 0);
|
|
4569
|
+
}
|
|
4570
|
+
return e.map((e, t) => new H(this, e, t));
|
|
4571
|
+
}, () => [this.columns]);
|
|
4572
|
+
groupingSpan = B(() => {
|
|
4573
|
+
let { visibleLeafs: e } = this.columns.value, t = e.findIndex((e) => e.isGrouping);
|
|
4574
|
+
if (t === -1) return [];
|
|
4575
|
+
let n = (n, r) => r > t && n.pin === e[t].pin && !n.isRowNumber && !n.isRowSelection && !n.isRowDetail, r = e.findIndex((e, t) => n(e, t) && !!e.aggregate), i = r === -1 ? e.length : r;
|
|
4576
|
+
return [e[t], ...e.filter((e, t) => t < i && n(e, t))];
|
|
4577
|
+
}, () => [this.columns]);
|
|
4578
|
+
flatRows = B(() => this.source.enabled ? this.source.flatRowList(this.rows.value) : this.rows.value.flatMap((e) => e.flatRows), () => [this.rows]);
|
|
4579
|
+
get rowHeight() {
|
|
4580
|
+
return this.props.def.rowHeight ?? this.DEFAULT_ROW_HEIGHT_PX;
|
|
4581
|
+
}
|
|
4582
|
+
sizes = B(() => {
|
|
4583
|
+
let e = this.columns.value.flat.reduce((e, t) => {
|
|
4584
|
+
let { inlineWidth: n } = t;
|
|
4585
|
+
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;
|
|
4586
|
+
}, {});
|
|
4587
|
+
e[this.rowHeightVarName] = `${this.rowHeight}px`, e[this.inlineStartEdgeVarName] = `${this.inlineStartEdge}px`, this._containerWidth > 0 && (e[this.viewportWidthVarName] = `${this._containerWidth}px`);
|
|
4588
|
+
let { visibleLeafs: t } = this.columns.value, n = t.find((e) => e.key === G);
|
|
4589
|
+
if (n) {
|
|
4590
|
+
let t = W.sumBy(this.groupingSpan.value, (e) => e.inlineWidth ?? 0);
|
|
4591
|
+
e[n.groupColumnWidthVarName] = `${t}px`;
|
|
4592
|
+
}
|
|
4593
|
+
return this.groupColumns.forEach((n) => {
|
|
4594
|
+
let r = W.findOrThrow(this.columns.value.leafs, (e) => e.key === n);
|
|
4595
|
+
e[r.groupColumnWidthVarName] = `${W.sumBy(t, (e) => e.pin === r.pin ? e.inlineWidth ?? 0 : 0)}px`;
|
|
4596
|
+
}), e;
|
|
4597
|
+
}, () => [this.columns, this.flexWidths]);
|
|
4598
|
+
_containerWidth = 0;
|
|
4599
|
+
get containerWidth() {
|
|
4600
|
+
return this._containerWidth;
|
|
4601
|
+
}
|
|
4602
|
+
_sizingElement = null;
|
|
4603
|
+
get sizingElement() {
|
|
4604
|
+
return this._sizingElement;
|
|
4605
|
+
}
|
|
4606
|
+
setSizingElement = (e) => {
|
|
4607
|
+
this._sizingElement = e;
|
|
4608
|
+
};
|
|
4609
|
+
get isRtl() {
|
|
4610
|
+
return t(this._sizingElement);
|
|
4611
|
+
}
|
|
4612
|
+
setContainerWidth = (e) => {
|
|
4613
|
+
this._containerWidth !== e && (this._containerWidth = e, this.flexWidths.clear(), this.notify());
|
|
4614
|
+
};
|
|
4615
|
+
flexWidths = B(() => {
|
|
4616
|
+
let e = this._containerWidth;
|
|
4617
|
+
if (e <= 0) return {};
|
|
4618
|
+
let t = this.columns.value.visibleLeafs, n = (e) => !e.isFlexible || this.columnWidths.has(e.key), r = W.sumBy(t.filter(n), (e) => e.baseWidth), i = t.filter((e) => !n(e)), a = W.sumBy(i, (e) => e.baseWidth), o = e - r;
|
|
4619
|
+
if (o <= a) return W.toRecord(i, (e) => [e.key, e.baseWidth]);
|
|
4620
|
+
let s = {}, c = 0;
|
|
4621
|
+
return i.forEach((e, t) => {
|
|
4622
|
+
if (t === i.length - 1) s[e.key] = o - c;
|
|
4623
|
+
else {
|
|
4624
|
+
let t = Math.floor(e.baseWidth / a * o);
|
|
4625
|
+
s[e.key] = t, c += t;
|
|
4626
|
+
}
|
|
4627
|
+
}), s;
|
|
4628
|
+
}, () => [this.columns]);
|
|
4629
|
+
getFlexWidth(e) {
|
|
4630
|
+
return this.flexWidths.value[e];
|
|
4631
|
+
}
|
|
4632
|
+
DEFAULT_ROW_HEIGHT_PX = 48;
|
|
4633
|
+
MIN_COLUMN_WIDTH_PX = 48;
|
|
4634
|
+
DEFAULT_COLUMN_WIDTH_PX = 200;
|
|
4635
|
+
expandedGroupRow = /* @__PURE__ */ new Set();
|
|
4636
|
+
_expandedDetailRows = /* @__PURE__ */ new Set();
|
|
4637
|
+
get expandedDetailRows() {
|
|
4638
|
+
return this.props.expandedRowKeys ? new Set(this.props.expandedRowKeys) : this._expandedDetailRows;
|
|
4639
|
+
}
|
|
4640
|
+
_revealDetailKey = null;
|
|
4641
|
+
takeDetailReveal(e) {
|
|
4642
|
+
return this._revealDetailKey === e && (this._revealDetailKey = null, !0);
|
|
4643
|
+
}
|
|
4644
|
+
toggleDetailRow = (e) => {
|
|
4645
|
+
let t = new Set(this.expandedDetailRows);
|
|
4646
|
+
t.has(e) ? t.delete(e) : t.add(e);
|
|
4647
|
+
let n = t.has(e);
|
|
4648
|
+
this._revealDetailKey = n && this.props.def.rowDetail?.scrollIntoView !== !1 ? e : null, this._expandedDetailRows = t, this.props.onExpandedRowKeysChange?.(Array.from(t), { reason: n ? "expand" : "collapse" }), this.rows.clear(), this.notify();
|
|
4649
|
+
};
|
|
4650
|
+
_page = 1;
|
|
4651
|
+
_pageSize;
|
|
4652
|
+
get page() {
|
|
4653
|
+
return this.props.page ?? this._page;
|
|
4654
|
+
}
|
|
4655
|
+
get pageSize() {
|
|
4656
|
+
if (this.props.pageSize !== void 0) return this.props.pageSize;
|
|
4657
|
+
if (this._pageSize !== void 0) return this._pageSize;
|
|
4658
|
+
let e = this.props.def.pagination;
|
|
4659
|
+
if (e?.pageSize) return e.pageSize;
|
|
4660
|
+
let t = this.props.def.visibleRowsCount;
|
|
4661
|
+
return typeof t == "number" ? t : 10;
|
|
4662
|
+
}
|
|
4663
|
+
get pageSizeOptions() {
|
|
4664
|
+
return this.props.def.pagination?.pageSizeOptions;
|
|
4665
|
+
}
|
|
4666
|
+
get isPaginated() {
|
|
4667
|
+
return !!this.props.def.pagination;
|
|
4668
|
+
}
|
|
4669
|
+
get paginationState() {
|
|
4670
|
+
let e = this.props.def.pagination;
|
|
4671
|
+
if (!e) return;
|
|
4672
|
+
let t = e.totalCount ?? (this.source.enabled ? this.source.rowCount : 0), n = this.pageSize;
|
|
4673
|
+
return {
|
|
4674
|
+
page: this.page,
|
|
4675
|
+
pageSize: n,
|
|
4676
|
+
totalItems: t,
|
|
4677
|
+
totalPages: Math.max(1, Math.ceil(t / n))
|
|
4678
|
+
};
|
|
4679
|
+
}
|
|
4680
|
+
changePage = (e) => {
|
|
4681
|
+
let t = this.paginationState;
|
|
4682
|
+
if (!t) return;
|
|
4683
|
+
let n = Math.max(1, Math.min(e, t.totalPages));
|
|
4684
|
+
n !== this.page && (this._page = n, this.firePaginationChange(n, t.pageSize, "page"), this.fireServerStateChange("page", { page: n }), this.rows.clear(), this.notify());
|
|
4685
|
+
};
|
|
4686
|
+
changePageSize = (e) => {
|
|
4687
|
+
e !== this.pageSize && (this._pageSize = e, this._page = 1, this.props.onPageSizeChange?.(e), this.firePaginationChange(1, e, "page-size"), this.fireServerStateChange("page-size", {
|
|
4688
|
+
page: 1,
|
|
4689
|
+
pageSize: e
|
|
4690
|
+
}), this.source.invalidate(), this.tree.nodes.clear(), this.rows.clear(), this.notify());
|
|
4691
|
+
};
|
|
4692
|
+
rowOffsets = B(() => {
|
|
4693
|
+
if (this.source.enabled) return this.source.rowOffsets(this.flatRows.value);
|
|
4694
|
+
let e = [], t = 0;
|
|
4695
|
+
for (let n of this.flatRows.value) e.push(t), t += n instanceof V ? n.heightForOffset : this.rowHeight;
|
|
4696
|
+
return {
|
|
4697
|
+
offsets: e,
|
|
4698
|
+
totalHeight: t
|
|
4699
|
+
};
|
|
4700
|
+
}, () => [this.flatRows]);
|
|
4701
|
+
viewport = new $t(this);
|
|
4702
|
+
columnVisibility = new Pt(this);
|
|
4703
|
+
filter = new Jt(this);
|
|
4704
|
+
pagination = new Yt(this);
|
|
4705
|
+
aggregation = new Me(this);
|
|
4706
|
+
exporter = new qt(this);
|
|
4707
|
+
source = new Ut(this);
|
|
4708
|
+
tree = new Qt(this);
|
|
4709
|
+
edits = new ge(this);
|
|
4710
|
+
refresh = () => {
|
|
4711
|
+
this.edits.clearEdits(), this.source.invalidate();
|
|
4712
|
+
};
|
|
4713
|
+
get exportConfig() {
|
|
4714
|
+
let e = this.props.def.export;
|
|
4715
|
+
if (e) return typeof e == "object" ? e : en;
|
|
4716
|
+
}
|
|
4717
|
+
exportCsv = async (e = {}) => {
|
|
4718
|
+
let { downloadCsv: t } = await import("../gridExport.mjs");
|
|
4719
|
+
t(this.exporter.table(e), this.exporter.fileName(e), e);
|
|
4720
|
+
};
|
|
4721
|
+
exportXlsx = async (e = {}) => {
|
|
4722
|
+
let { downloadXlsx: t } = await import("../gridExport.mjs");
|
|
4723
|
+
t(this.exporter.table(e), this.exporter.fileName(e), e);
|
|
4724
|
+
};
|
|
4725
|
+
get hasVisibleColumns() {
|
|
4726
|
+
return this.columns.value.userVisibleLeafs.length > 0;
|
|
4727
|
+
}
|
|
4728
|
+
get isEmpty() {
|
|
4729
|
+
return this.source.enabled ? this.flatRows.value.length === 0 : this.data.length === 0;
|
|
4730
|
+
}
|
|
4731
|
+
get allRowsSelected() {
|
|
4732
|
+
let e = this.loadedRows.length;
|
|
4733
|
+
return e > 0 && this.selectedRows.size === e;
|
|
4734
|
+
}
|
|
4735
|
+
get someRowsSelected() {
|
|
4736
|
+
return this.selectedRows.size > 0;
|
|
4737
|
+
}
|
|
4738
|
+
_selectionAnnounced = !1;
|
|
4739
|
+
get selectionAnnouncement() {
|
|
4740
|
+
if (!this._selectionAnnounced) return "";
|
|
4741
|
+
let e = this.selectedRows.size;
|
|
4742
|
+
return e === 0 ? "No rows selected" : `${e} of ${this.totalRowCount} rows selected`;
|
|
4743
|
+
}
|
|
4744
|
+
get groupedColumns() {
|
|
4745
|
+
return Array.from(this.groupColumns, (e) => W.findOrThrow(this.columns.value.leafs, (t) => t.key === e));
|
|
4746
|
+
}
|
|
4747
|
+
selectedRows = /* @__PURE__ */ new Set();
|
|
4748
|
+
get inlineStartEdge() {
|
|
4749
|
+
return W.sumBy(this.columns.value.start, (e) => e.inlineWidth ?? 0);
|
|
4750
|
+
}
|
|
4751
|
+
get inlineEndEdge() {
|
|
4752
|
+
return W.sumBy(this.columns.value.end, (e) => e.inlineWidth ?? 0);
|
|
4753
|
+
}
|
|
4754
|
+
inlineStartEdgeVarName = "--inline-start-edge";
|
|
4755
|
+
rowHeightVarName = "--row-height";
|
|
4756
|
+
viewportWidthVarName = "--viewport-width";
|
|
4757
|
+
_idMap = /* @__PURE__ */ new WeakMap();
|
|
4758
|
+
_autoId = 0;
|
|
4759
|
+
_idFactory = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? () => crypto.randomUUID() : () => `auto-row-${this._autoId++}`;
|
|
4760
|
+
getRowKey(e) {
|
|
4761
|
+
let { rowKey: t } = this.props.def;
|
|
4762
|
+
return t ? typeof t == "function" ? t(e) : e[t] : (this._idMap.has(e) || this._idMap.set(e, this._idFactory()), this._idMap.get(e));
|
|
4763
|
+
}
|
|
4764
|
+
setSortColumn = (e, ...t) => {
|
|
4765
|
+
if (t.length > 0) [this._sortDirection] = t, this._sortColumn = this._sortDirection ? e : void 0;
|
|
4766
|
+
else {
|
|
4767
|
+
let { _sortColumn: t, _sortDirection: n } = this;
|
|
4768
|
+
this._sortColumn = t === e && n === "DESC" ? void 0 : e, this._sortDirection = t === e && n === "ASC" ? "DESC" : "ASC";
|
|
4769
|
+
}
|
|
4770
|
+
let n = this._sortColumn !== void 0 && this._sortDirection !== void 0 ? {
|
|
4771
|
+
columnKey: this._sortColumn,
|
|
4772
|
+
direction: this._sortDirection
|
|
4773
|
+
} : void 0;
|
|
4774
|
+
this.props.onSortingChange?.(n, { reason: n ? "sort" : "clear" }), this.props.onSortChange?.(this._sortColumn, this._sortDirection);
|
|
4775
|
+
let r = this.resetToFirstPage("sort");
|
|
4776
|
+
this.fireServerStateChange("sort", {
|
|
4777
|
+
sortColumn: this._sortColumn,
|
|
4778
|
+
sortDirection: this._sortDirection,
|
|
4779
|
+
page: r
|
|
4780
|
+
}), this.source.invalidate(), this.tree.nodes.clear(), this.rows.clear(), this.notify();
|
|
4781
|
+
};
|
|
4782
|
+
pinColumn = (e, t) => {
|
|
4783
|
+
let n = jt(t), r = W.findOrThrow(this.columns.value.flat, (t) => t.uniqueKey === e);
|
|
4784
|
+
r.pin !== n && r.pinColumn(n), this.columns.clear(), this.notify();
|
|
4785
|
+
};
|
|
4786
|
+
toggleGrouping = (e) => {
|
|
4787
|
+
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.collapseGroups(), this.sourceColumns.clear(), this.notify();
|
|
4788
|
+
};
|
|
4789
|
+
unGroupAll = () => {
|
|
4790
|
+
let e = new Set(this.groupColumns);
|
|
4791
|
+
this.groupColumns = /* @__PURE__ */ new Set(), this.hiddenColumns = new Set(Array.from(this.hiddenColumns).filter((t) => !e.has(t))), this.collapseGroups(), this.sourceColumns.clear(), this.notify();
|
|
4792
|
+
};
|
|
4793
|
+
collapseGroups() {
|
|
4794
|
+
this.expandedGroupRow = /* @__PURE__ */ new Set(), this._collapsedGroupRow = /* @__PURE__ */ new Set(), this.source.expansionChanged(), this.source.invalidate();
|
|
4795
|
+
}
|
|
4796
|
+
_expansion = 0;
|
|
4797
|
+
get expansionVersion() {
|
|
4798
|
+
return this._expansion;
|
|
4799
|
+
}
|
|
4800
|
+
isGroupExpanded(e, t) {
|
|
4801
|
+
if (this.expandedGroupRow.has(e)) return !0;
|
|
4802
|
+
if (this._collapsedGroupRow.has(e)) return !1;
|
|
4803
|
+
let n = this.props.def.groupDefaultExpanded;
|
|
4804
|
+
return typeof n == "number" ? t < n : n === !0;
|
|
4805
|
+
}
|
|
4806
|
+
_collapsedGroupRow = /* @__PURE__ */ new Set();
|
|
4807
|
+
toggleGroupRow = (e, t = this.expandedGroupRow.has(e)) => {
|
|
4808
|
+
this._expansion++, this.expandedGroupRow = new Set(this.expandedGroupRow), this._collapsedGroupRow = new Set(this._collapsedGroupRow), t ? (this.expandedGroupRow.delete(e), this._collapsedGroupRow.add(e)) : (this.expandedGroupRow.add(e), this._collapsedGroupRow.delete(e)), this.source.expansionChanged(), this.rows.clear(), this.notify();
|
|
4809
|
+
};
|
|
4810
|
+
treeExpansionChanged() {
|
|
4811
|
+
this._expansion++, this.source.expansionChanged(), this.rows.clear();
|
|
4812
|
+
}
|
|
4813
|
+
toggleRowSelection = (e) => {
|
|
4814
|
+
this.toggleRowsSelection([e]);
|
|
4815
|
+
};
|
|
4816
|
+
toggleRowsSelection = (e, t = !1) => {
|
|
4817
|
+
this.selectedRows = new Set(this.selectedRows), this._selectionAnnounced = !0;
|
|
4818
|
+
let n = e.every((e) => this.selectedRows.has(e));
|
|
4819
|
+
n ? e.forEach((e) => this.selectedRows.delete(e)) : e.forEach((e) => this.selectedRows.add(e)), this.flatRows.clear(), this.notify();
|
|
4820
|
+
let r = Array.from(this.selectedRows), i = t ? n ? "clear" : "select-all" : n ? "deselect" : "select";
|
|
4821
|
+
this.props.onSelectedRowKeysChange?.(r, { reason: i }), this.props.onSelectionChange?.({
|
|
4822
|
+
action: n ? "deselect" : "select",
|
|
4823
|
+
affectedRowKeys: e,
|
|
4824
|
+
selectedRowKeys: r,
|
|
4825
|
+
isAllSelected: this.selectedRows.size === this.loadedRows.length
|
|
4826
|
+
});
|
|
4827
|
+
};
|
|
4828
|
+
toggleSelectAllRows = () => {
|
|
4829
|
+
this.toggleRowsSelection(this.loadedRows.map((e) => this.getRowKey(e)), !0);
|
|
4830
|
+
};
|
|
4831
|
+
toggleColumnVisibility = (e) => {
|
|
4832
|
+
this.hiddenColumns = new Set(this.hiddenColumns), this.hiddenColumns.has(e) ? this.hiddenColumns.delete(e) : this.hiddenColumns.add(e), this.columns.clear(), this.notify();
|
|
4833
|
+
};
|
|
4834
|
+
setWidth = (e, t) => {
|
|
4835
|
+
this.columnWidths.set(e, t);
|
|
4836
|
+
};
|
|
4837
|
+
_groupColumns;
|
|
4838
|
+
get groupColumns() {
|
|
4839
|
+
return this._groupColumns ??= new Set(this.props.def.groupBy ?? []);
|
|
4840
|
+
}
|
|
4841
|
+
set groupColumns(e) {
|
|
4842
|
+
this._groupColumns = e;
|
|
4843
|
+
}
|
|
4844
|
+
_hiddenColumns;
|
|
4845
|
+
get hiddenColumns() {
|
|
4846
|
+
return this._hiddenColumns ??= new Set(this.props.def.groupBy ?? []);
|
|
4847
|
+
}
|
|
4848
|
+
set hiddenColumns(e) {
|
|
4849
|
+
this._hiddenColumns = e;
|
|
4850
|
+
}
|
|
4851
|
+
columnWidths = /* @__PURE__ */ new Map();
|
|
4852
|
+
_sortColumn;
|
|
4853
|
+
get sortColumn() {
|
|
4854
|
+
return this._sortColumn;
|
|
4855
|
+
}
|
|
4856
|
+
_sortDirection = "ASC";
|
|
4857
|
+
get sortDirection() {
|
|
4858
|
+
return this._sortDirection;
|
|
4859
|
+
}
|
|
4860
|
+
};
|
|
4861
|
+
//#endregion
|
|
4862
|
+
//#region src/components/dataGrid/useGrid.ts
|
|
4863
|
+
function nn(e) {
|
|
4864
|
+
let [t] = A(() => new tn(e)), n = s("datagrid");
|
|
4865
|
+
return t.setProps(e), t.setIdentifier(n), P(t.subscribe, t.getSnapshot, t.getSnapshot), t;
|
|
4866
|
+
}
|
|
4867
|
+
//#endregion
|
|
4868
|
+
//#region src/components/dataGrid.tsx
|
|
4869
|
+
function rn(e, t) {
|
|
4870
|
+
let n = nn(e), i = k(null);
|
|
4871
|
+
ee(t, () => ({
|
|
4872
|
+
get element() {
|
|
4873
|
+
return i.current;
|
|
4874
|
+
},
|
|
4875
|
+
exportCsv: n.exportCsv,
|
|
4876
|
+
exportXlsx: n.exportXlsx,
|
|
4877
|
+
refresh: n.refresh,
|
|
4878
|
+
clearEdits: n.edits.clearEdits
|
|
4879
|
+
}), [n]);
|
|
4880
|
+
let { component: a, data: o, def: s, loading: c, filters: l, globalFilterValue: u, columnFilters: d, expandedRowKeys: f, expandedTreeKeys: p, page: m, pageSize: h, onSelectedRowKeysChange: g, onSelectionChange: _, onGlobalFilterChange: v, onColumnFiltersChange: b, onExpandedRowKeysChange: x, onExpandedTreeKeysChange: S, onCellEditsChange: C, onPaginationChange: w, onPageChange: T, onPageSizeChange: E, onSortingChange: D, onSortChange: te, onServerStateChange: A, style: j, ...P } = e;
|
|
4881
|
+
return O(() => {
|
|
4882
|
+
let e = i.current;
|
|
4883
|
+
if (e) return n.setSizingElement(e), () => n.setSizingElement(null);
|
|
4884
|
+
}, [n]), /* @__PURE__ */ N(r, {
|
|
4885
|
+
ref: i,
|
|
4886
|
+
component: n.componentName,
|
|
4887
|
+
...P,
|
|
4888
|
+
style: {
|
|
4889
|
+
...n.sizes.value,
|
|
4890
|
+
...j
|
|
4891
|
+
},
|
|
4892
|
+
children: [
|
|
4893
|
+
n.props.def.topBar && /* @__PURE__ */ M(Et, { grid: n }),
|
|
4894
|
+
/* @__PURE__ */ M(yt, { grid: n }),
|
|
4895
|
+
/* @__PURE__ */ M(vt, { grid: n }),
|
|
4896
|
+
n.props.def.bottomBar && /* @__PURE__ */ M(ce, { grid: n }),
|
|
4897
|
+
/* @__PURE__ */ M(y, {
|
|
4898
|
+
props: { role: "status" },
|
|
4899
|
+
children: n.selectionAnnouncement
|
|
4900
|
+
})
|
|
4901
|
+
]
|
|
4902
|
+
});
|
|
4903
|
+
}
|
|
4904
|
+
var an = w(rn);
|
|
4905
|
+
rn.displayName = "DataGrid";
|
|
4906
|
+
//#endregion
|
|
4907
|
+
export { an as default };
|