@gears-frontx/ui-kit 0.4.0-alpha.7 → 0.4.1

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.
Files changed (230) hide show
  1. package/NOTICE +1 -0
  2. package/README.md +2 -1
  3. package/dist/chunks/data-grid.DIkpRRaf.css +1 -0
  4. package/dist/chunks/deep-equal.js +15 -0
  5. package/dist/chunks/deep-equal.js.map +1 -0
  6. package/dist/chunks/messages.js +42 -0
  7. package/dist/chunks/messages.js.map +1 -0
  8. package/dist/chunks/order.D7Jg_Mg8.css +1 -0
  9. package/dist/chunks/pagination.Cn8tIWMX.css +1 -0
  10. package/dist/chunks/plugins-helpers.js +41 -0
  11. package/dist/chunks/plugins-helpers.js.map +1 -0
  12. package/dist/chunks/segment.js +18 -0
  13. package/dist/chunks/segment.js.map +1 -0
  14. package/dist/chunks/text-search.BeZYac6V.css +1 -0
  15. package/dist/components/data-grid/components/data-grid-content.d.ts +3 -0
  16. package/dist/components/data-grid/components/data-grid-content.d.ts.map +1 -0
  17. package/dist/components/data-grid/components/data-grid-empty-state.d.ts +3 -0
  18. package/dist/components/data-grid/components/data-grid-empty-state.d.ts.map +1 -0
  19. package/dist/components/data-grid/components/data-grid-spinner.d.ts +16 -0
  20. package/dist/components/data-grid/components/data-grid-spinner.d.ts.map +1 -0
  21. package/dist/components/data-grid/components/load-controlled.d.ts +15 -0
  22. package/dist/components/data-grid/components/load-controlled.d.ts.map +1 -0
  23. package/dist/components/data-grid/components/segment.d.ts +15 -0
  24. package/dist/components/data-grid/components/segment.d.ts.map +1 -0
  25. package/dist/components/data-grid/create-data-grid.d.ts +4 -0
  26. package/dist/components/data-grid/create-data-grid.d.ts.map +1 -0
  27. package/dist/components/data-grid/data-grid-types.d.ts +142 -0
  28. package/dist/components/data-grid/data-grid-types.d.ts.map +1 -0
  29. package/dist/components/data-grid/data-grid.d.ts +3 -0
  30. package/dist/components/data-grid/data-grid.d.ts.map +1 -0
  31. package/dist/components/data-grid/messages.d.ts +39 -0
  32. package/dist/components/data-grid/messages.d.ts.map +1 -0
  33. package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts +5 -0
  34. package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts.map +1 -0
  35. package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts +14 -0
  36. package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts.map +1 -0
  37. package/dist/components/data-grid/plugins/empty-state/public.d.ts +3 -0
  38. package/dist/components/data-grid/plugins/empty-state/public.d.ts.map +1 -0
  39. package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts +3 -0
  40. package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts.map +1 -0
  41. package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts +8 -0
  42. package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts.map +1 -0
  43. package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts +7 -0
  44. package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts.map +1 -0
  45. package/dist/components/data-grid/plugins/order/order-plugin.d.ts +4 -0
  46. package/dist/components/data-grid/plugins/order/order-plugin.d.ts.map +1 -0
  47. package/dist/components/data-grid/plugins/order/order-types.d.ts +66 -0
  48. package/dist/components/data-grid/plugins/order/order-types.d.ts.map +1 -0
  49. package/dist/components/data-grid/plugins/order/public.d.ts +5 -0
  50. package/dist/components/data-grid/plugins/order/public.d.ts.map +1 -0
  51. package/dist/components/data-grid/plugins/order/services/order-labels.d.ts +8 -0
  52. package/dist/components/data-grid/plugins/order/services/order-labels.d.ts.map +1 -0
  53. package/dist/components/data-grid/plugins/order/services/order-option.d.ts +3 -0
  54. package/dist/components/data-grid/plugins/order/services/order-option.d.ts.map +1 -0
  55. package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts +3 -0
  56. package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts.map +1 -0
  57. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts +22 -0
  58. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts.map +1 -0
  59. package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts +31 -0
  60. package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts.map +1 -0
  61. package/dist/components/data-grid/plugins/pagination/public.d.ts +3 -0
  62. package/dist/components/data-grid/plugins/pagination/public.d.ts.map +1 -0
  63. package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts +14 -0
  64. package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts.map +1 -0
  65. package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts +3 -0
  66. package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts.map +1 -0
  67. package/dist/components/data-grid/plugins/text-search/public.d.ts +3 -0
  68. package/dist/components/data-grid/plugins/text-search/public.d.ts.map +1 -0
  69. package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts +38 -0
  70. package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts.map +1 -0
  71. package/dist/components/data-grid/public.d.ts +12 -0
  72. package/dist/components/data-grid/public.d.ts.map +1 -0
  73. package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts +7 -0
  74. package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts.map +1 -0
  75. package/dist/components/data-grid/services/core/core-service.d.ts +3 -0
  76. package/dist/components/data-grid/services/core/core-service.d.ts.map +1 -0
  77. package/dist/components/data-grid/services/core/core-types.d.ts +28 -0
  78. package/dist/components/data-grid/services/core/core-types.d.ts.map +1 -0
  79. package/dist/components/data-grid/services/core/data-grid-context.d.ts +17 -0
  80. package/dist/components/data-grid/services/core/data-grid-context.d.ts.map +1 -0
  81. package/dist/components/data-grid/services/hooked/hooked-types.d.ts +34 -0
  82. package/dist/components/data-grid/services/hooked/hooked-types.d.ts.map +1 -0
  83. package/dist/components/data-grid/services/hooked/hooked.d.ts +4 -0
  84. package/dist/components/data-grid/services/hooked/hooked.d.ts.map +1 -0
  85. package/dist/components/data-grid/services/internal/internal-helpers.d.ts +2 -0
  86. package/dist/components/data-grid/services/internal/internal-helpers.d.ts.map +1 -0
  87. package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts +7 -0
  88. package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts.map +1 -0
  89. package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts +4 -0
  90. package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts.map +1 -0
  91. package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts +3 -0
  92. package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts.map +1 -0
  93. package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts +7 -0
  94. package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts.map +1 -0
  95. package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts +3 -0
  96. package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts.map +1 -0
  97. package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts +3 -0
  98. package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts.map +1 -0
  99. package/dist/components/data-grid/services/layout/data-grid-view.d.ts +16 -0
  100. package/dist/components/data-grid/services/layout/data-grid-view.d.ts.map +1 -0
  101. package/dist/components/data-grid/services/layout/layout-service.d.ts +4 -0
  102. package/dist/components/data-grid/services/layout/layout-service.d.ts.map +1 -0
  103. package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts +3 -0
  104. package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts.map +1 -0
  105. package/dist/components/data-grid/services/layout/layout-types.d.ts +74 -0
  106. package/dist/components/data-grid/services/layout/layout-types.d.ts.map +1 -0
  107. package/dist/components/data-grid/services/load/load-instance.d.ts +4 -0
  108. package/dist/components/data-grid/services/load/load-instance.d.ts.map +1 -0
  109. package/dist/components/data-grid/services/load/load-service.d.ts +4 -0
  110. package/dist/components/data-grid/services/load/load-service.d.ts.map +1 -0
  111. package/dist/components/data-grid/services/load/load-types.d.ts +76 -0
  112. package/dist/components/data-grid/services/load/load-types.d.ts.map +1 -0
  113. package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts +16 -0
  114. package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts.map +1 -0
  115. package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts +4 -0
  116. package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts.map +1 -0
  117. package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts +36 -0
  118. package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts.map +1 -0
  119. package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts +49 -0
  120. package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts.map +1 -0
  121. package/dist/components/data-grid/services/plugins/plugins-service.d.ts +4 -0
  122. package/dist/components/data-grid/services/plugins/plugins-service.d.ts.map +1 -0
  123. package/dist/components/data-grid/services/plugins/plugins-types.d.ts +62 -0
  124. package/dist/components/data-grid/services/plugins/plugins-types.d.ts.map +1 -0
  125. package/dist/components/data-grid/services/storage/storage-helpers.d.ts +4 -0
  126. package/dist/components/data-grid/services/storage/storage-helpers.d.ts.map +1 -0
  127. package/dist/components/data-grid/services/storage/storage-service.d.ts +4 -0
  128. package/dist/components/data-grid/services/storage/storage-service.d.ts.map +1 -0
  129. package/dist/components/data-grid/services/storage/storage-types.d.ts +93 -0
  130. package/dist/components/data-grid/services/storage/storage-types.d.ts.map +1 -0
  131. package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts +9 -0
  132. package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts.map +1 -0
  133. package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts +57 -0
  134. package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts.map +1 -0
  135. package/dist/components/data-grid/services/table/components/data-grid-content.d.ts +7 -0
  136. package/dist/components/data-grid/services/table/components/data-grid-content.d.ts.map +1 -0
  137. package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts +8 -0
  138. package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts.map +1 -0
  139. package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts +12 -0
  140. package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts.map +1 -0
  141. package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts +10 -0
  142. package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts.map +1 -0
  143. package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts +7 -0
  144. package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts.map +1 -0
  145. package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts +8 -0
  146. package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts.map +1 -0
  147. package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts +11 -0
  148. package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts.map +1 -0
  149. package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts +10 -0
  150. package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts.map +1 -0
  151. package/dist/components/data-grid/services/table/components/data-grid-row.d.ts +8 -0
  152. package/dist/components/data-grid/services/table/components/data-grid-row.d.ts.map +1 -0
  153. package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts +3 -0
  154. package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts.map +1 -0
  155. package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts +3 -0
  156. package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts.map +1 -0
  157. package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts +8 -0
  158. package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts.map +1 -0
  159. package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts +8 -0
  160. package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts.map +1 -0
  161. package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts +7 -0
  162. package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts.map +1 -0
  163. package/dist/components/data-grid/services/table/components/data-grid-table.d.ts +3 -0
  164. package/dist/components/data-grid/services/table/components/data-grid-table.d.ts.map +1 -0
  165. package/dist/components/data-grid/services/table/data-grid-record-context.d.ts +5 -0
  166. package/dist/components/data-grid/services/table/data-grid-record-context.d.ts.map +1 -0
  167. package/dist/components/data-grid/services/table/ignore-row-click.d.ts +2 -0
  168. package/dist/components/data-grid/services/table/ignore-row-click.d.ts.map +1 -0
  169. package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts +21 -0
  170. package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts.map +1 -0
  171. package/dist/components/data-grid/services/table/resolve-column-style.d.ts +62 -0
  172. package/dist/components/data-grid/services/table/resolve-column-style.d.ts.map +1 -0
  173. package/dist/components/data-grid/services/table/table-columns-persistence.d.ts +19 -0
  174. package/dist/components/data-grid/services/table/table-columns-persistence.d.ts.map +1 -0
  175. package/dist/components/data-grid/services/table/table-columns.d.ts +15 -0
  176. package/dist/components/data-grid/services/table/table-columns.d.ts.map +1 -0
  177. package/dist/components/data-grid/services/table/table-context.d.ts +4 -0
  178. package/dist/components/data-grid/services/table/table-context.d.ts.map +1 -0
  179. package/dist/components/data-grid/services/table/table-extra-columns.d.ts +12 -0
  180. package/dist/components/data-grid/services/table/table-extra-columns.d.ts.map +1 -0
  181. package/dist/components/data-grid/services/table/table-header.d.ts +11 -0
  182. package/dist/components/data-grid/services/table/table-header.d.ts.map +1 -0
  183. package/dist/components/data-grid/services/table/table-helpers.d.ts +13 -0
  184. package/dist/components/data-grid/services/table/table-helpers.d.ts.map +1 -0
  185. package/dist/components/data-grid/services/table/table-min-content-width.d.ts +36 -0
  186. package/dist/components/data-grid/services/table/table-min-content-width.d.ts.map +1 -0
  187. package/dist/components/data-grid/services/table/table-service.d.ts +4 -0
  188. package/dist/components/data-grid/services/table/table-service.d.ts.map +1 -0
  189. package/dist/components/data-grid/services/table/table-slots.d.ts +9 -0
  190. package/dist/components/data-grid/services/table/table-slots.d.ts.map +1 -0
  191. package/dist/components/data-grid/services/table/table-sticky.d.ts +35 -0
  192. package/dist/components/data-grid/services/table/table-sticky.d.ts.map +1 -0
  193. package/dist/components/data-grid/services/table/table-store.d.ts +4 -0
  194. package/dist/components/data-grid/services/table/table-store.d.ts.map +1 -0
  195. package/dist/components/data-grid/services/table/table-types.d.ts +239 -0
  196. package/dist/components/data-grid/services/table/table-types.d.ts.map +1 -0
  197. package/dist/components/data-grid/utils/debounce.d.ts +7 -0
  198. package/dist/components/data-grid/utils/debounce.d.ts.map +1 -0
  199. package/dist/components/data-grid/utils/deep-equal.d.ts +7 -0
  200. package/dist/components/data-grid/utils/deep-equal.d.ts.map +1 -0
  201. package/dist/components/data-grid/utils/hooked.d.ts +17 -0
  202. package/dist/components/data-grid/utils/hooked.d.ts.map +1 -0
  203. package/dist/components/data-grid/utils/is-record.d.ts +3 -0
  204. package/dist/components/data-grid/utils/is-record.d.ts.map +1 -0
  205. package/dist/components/data-grid/utils/load-state.d.ts +22 -0
  206. package/dist/components/data-grid/utils/load-state.d.ts.map +1 -0
  207. package/dist/components/data-grid/utils/use-latest.d.ts +4 -0
  208. package/dist/components/data-grid/utils/use-latest.d.ts.map +1 -0
  209. package/dist/data-grid/empty-state.d.ts +1 -0
  210. package/dist/data-grid/empty-state.js +27 -0
  211. package/dist/data-grid/empty-state.js.map +1 -0
  212. package/dist/data-grid/order.d.ts +1 -0
  213. package/dist/data-grid/order.js +254 -0
  214. package/dist/data-grid/order.js.map +1 -0
  215. package/dist/data-grid/pagination.d.ts +1 -0
  216. package/dist/data-grid/pagination.js +215 -0
  217. package/dist/data-grid/pagination.js.map +1 -0
  218. package/dist/data-grid/text-search.d.ts +1 -0
  219. package/dist/data-grid/text-search.js +112 -0
  220. package/dist/data-grid/text-search.js.map +1 -0
  221. package/dist/data-grid.d.ts +1 -0
  222. package/dist/data-grid.js +1650 -0
  223. package/dist/data-grid.js.map +1 -0
  224. package/dist/docs/data-grid.md +588 -0
  225. package/dist/index.d.ts +5 -0
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.js +385 -367
  228. package/dist/index.js.map +1 -1
  229. package/llms.txt +11 -3
  230. package/package.json +4 -2
@@ -0,0 +1,1650 @@
1
+ "use client";
2
+ import { jsx as p, jsxs as D, Fragment as G } from "react/jsx-runtime";
3
+ import { useEffect as A, useContext as Et, createContext as Lt, useRef as F, useMemo as It, useState as Dt, Suspense as Gt } from "react";
4
+ import { b as H, u as B, i as U, D as Rt } from "./chunks/plugins-helpers.js";
5
+ import { c as Bn, a as jn } from "./chunks/plugins-helpers.js";
6
+ import { cx as N } from "class-variance-authority";
7
+ import { Spinner as Mt } from "./spinner.js";
8
+ import { SearchXIcon as Ht, OctagonAlertIcon as Ot, TablePropertiesIcon as At } from "lucide-react";
9
+ import { m as V } from "./chunks/messages.js";
10
+ import { Empty as dt, EmptyHeader as ut, EmptyMedia as ft, EmptyTitle as pt, EmptyDescription as St } from "./empty.js";
11
+ import { create as z } from "zustand";
12
+ import { S as Wt } from "./chunks/segment.js";
13
+ import { ToggleGroupItem as Nt } from "./toggle-group.js";
14
+ import { useShallow as Y } from "zustand/react/shallow";
15
+ import { TableHead as mt, TableCell as Vt, TableRow as J, TableBody as zt, TableHeader as Pt, Table as Tt } from "./table.js";
16
+ import './chunks/data-grid.DIkpRRaf.css';const $t = "_delayed_1ys81_5", Ft = {
17
+ delayed: $t
18
+ };
19
+ function X({ className: t }) {
20
+ return /* @__PURE__ */ p("span", { className: N(Ft.delayed, t), children: /* @__PURE__ */ p(Mt, { size: "lg" }) });
21
+ }
22
+ const Bt = "_root_9f4nk_13", jt = {
23
+ root: Bt
24
+ };
25
+ function Kt() {
26
+ const t = H(), e = t.load.useLoadStateStore((o) => o.recordsLoadState), n = t.core.useExternalLoadingStore((o) => o.loading);
27
+ return e === "loading" || n;
28
+ }
29
+ const Ut = "_loaderOverlay_3znr7_29", Jt = {
30
+ loaderOverlay: Ut
31
+ };
32
+ function Yt({ children: t }) {
33
+ const n = H().core.useLoadStateStore((l) => l.loadState), r = Kt() && n === "loaded", s = r || n === "loading";
34
+ return /* @__PURE__ */ D("div", { className: jt.root, "aria-busy": s ? "true" : void 0, children: [
35
+ t,
36
+ r && /* @__PURE__ */ p("div", { className: Jt.loaderOverlay, children: /* @__PURE__ */ p(X, {}) })
37
+ ] });
38
+ }
39
+ const Xt = "_emptyState_1tt1k_3", qt = {
40
+ emptyState: Xt
41
+ };
42
+ function Qt() {
43
+ const { useStore: t } = B(), e = t((n) => n.hasActiveFilters);
44
+ return /* @__PURE__ */ p(dt, { className: qt.emptyState, children: /* @__PURE__ */ D(ut, { children: [
45
+ /* @__PURE__ */ p(ft, { variant: "icon", children: /* @__PURE__ */ p(Ht, {}) }),
46
+ /* @__PURE__ */ p(pt, { children: V.emptyState.noResultsFound }),
47
+ e && /* @__PURE__ */ p(St, { children: V.emptyState.noResultsFoundDescription })
48
+ ] }) });
49
+ }
50
+ const Zt = "_dataGridLayoutMain_ta8be_5", te = {
51
+ dataGridLayoutMain: Zt
52
+ };
53
+ function ee() {
54
+ const { useStore: t } = B(), e = H(), n = t((m) => m.visibleRecords), o = t((m) => m.hasActiveFilters), r = e.layout.useLayoutStore((m) => m.activeSlotIds.get("main")), s = e.layout.useLayoutStore((m) => m.slots.get("main")), l = s == null ? void 0 : s.find((m) => m.id === r), g = e.layout.useLayoutStore((m) => m.slots.get("empty")), a = g == null ? void 0 : g[0], f = n.length === 0, d = l && (!f || o), u = f;
55
+ return /* @__PURE__ */ D("div", { className: te.dataGridLayoutMain, children: [
56
+ d && /* @__PURE__ */ p(l.component, {}),
57
+ u && (a ? /* @__PURE__ */ p(a.component, {}) : /* @__PURE__ */ p(Qt, {}))
58
+ ] });
59
+ }
60
+ function ne({ name: t }) {
61
+ const n = H().layout.useLayoutStore((o) => o.slots.get(t));
62
+ return !n || n.length === 0 ? null : /* @__PURE__ */ p(G, { children: n.map((o) => /* @__PURE__ */ p(o.component, {}, o.id)) });
63
+ }
64
+ const oe = "_dataGridTopDefault_ux66z_1", re = "_topStartSlots_ux66z_8", ie = "_topStartSlot_ux66z_8", se = "_topEndSlot_ux66z_17", ae = "_topEndSlots_ux66z_21", P = {
65
+ dataGridTopDefault: oe,
66
+ topStartSlots: re,
67
+ topStartSlot: ie,
68
+ topEndSlot: se,
69
+ topEndSlots: ae
70
+ };
71
+ function ce() {
72
+ const t = H(), e = t.layout.useLayoutStore(
73
+ (s) => s.slots.get("top-start")
74
+ ), n = t.layout.useLayoutStore((s) => s.slots.get("top-end")), o = ((e == null ? void 0 : e.length) ?? 0) > 0, r = ((n == null ? void 0 : n.length) ?? 0) > 0;
75
+ return !o && !r ? null : /* @__PURE__ */ D("div", { className: P.dataGridTopDefault, children: [
76
+ o && /* @__PURE__ */ p("div", { className: P.topStartSlots, children: e == null ? void 0 : e.map((s) => /* @__PURE__ */ p("div", { className: P.topStartSlot, children: /* @__PURE__ */ p(s.component, {}) }, s.id)) }),
77
+ r && /* @__PURE__ */ p("div", { className: P.topEndSlots, children: n == null ? void 0 : n.map((s) => /* @__PURE__ */ p("div", { className: P.topEndSlot, children: /* @__PURE__ */ p(s.component, {}) }, s.id)) })
78
+ ] });
79
+ }
80
+ function le() {
81
+ const t = H(), e = t.layout.useLayoutStore((s) => s.activeSlotIds.get("top")), n = t.layout.useLayoutStore((s) => s.slots.get("top")), o = n == null ? void 0 : n.find((s) => s.id === e);
82
+ if (!o) return null;
83
+ const r = o.id === "default" ? ce : o.component;
84
+ return /* @__PURE__ */ p(r, {});
85
+ }
86
+ const de = "_center_s4klt_3", et = {
87
+ center: de
88
+ };
89
+ function ue({ loadState: t, children: e }) {
90
+ return t === "loaded" ? /* @__PURE__ */ p(G, { children: e }) : t === "error" ? /* @__PURE__ */ p(dt, { className: et.center, children: /* @__PURE__ */ D(ut, { children: [
91
+ /* @__PURE__ */ p(ft, { variant: "icon", children: /* @__PURE__ */ p(Ot, {}) }),
92
+ /* @__PURE__ */ p(pt, { children: V.loadError.headerDefault }),
93
+ /* @__PURE__ */ p(St, { children: V.loadError.bodyDefault })
94
+ ] }) }) : /* @__PURE__ */ p(X, { className: et.center });
95
+ }
96
+ function fe() {
97
+ const t = B(), { useStore: e } = t, { core: n } = H(), o = e((l) => l.visibleRecords), r = n.useLoadStateStore((l) => l.loadState), s = o.length === 0;
98
+ return A(() => (t.init().catch((l) => {
99
+ process.env.NODE_ENV !== "production" && console.error("[DataGrid] Initial load failed:", l);
100
+ }), () => t.destroy()), [t]), /* @__PURE__ */ p(Yt, { children: /* @__PURE__ */ D(ue, { loadState: r, children: [
101
+ /* @__PURE__ */ p(le, {}),
102
+ /* @__PURE__ */ p(ee, {}),
103
+ !s && /* @__PURE__ */ p(ne, { name: "bottom" })
104
+ ] }) });
105
+ }
106
+ function ht() {
107
+ const t = z()(() => ({
108
+ loadState: "blank"
109
+ }));
110
+ let e = 0;
111
+ return {
112
+ useLoadState: t,
113
+ setLoading: n,
114
+ setLoaded: o,
115
+ setError: r,
116
+ setBlank: s,
117
+ reset: l,
118
+ loadPromise: g
119
+ };
120
+ function n() {
121
+ t.setState({ loadState: "loading" });
122
+ }
123
+ function o() {
124
+ t.setState({ loadState: "loaded" });
125
+ }
126
+ function r() {
127
+ t.setState({ loadState: "error" });
128
+ }
129
+ function s() {
130
+ t.setState({ loadState: "blank" });
131
+ }
132
+ function l() {
133
+ e += 1, s();
134
+ }
135
+ async function g(a) {
136
+ const f = ++e;
137
+ n();
138
+ try {
139
+ const d = await a;
140
+ return f === e && o(), d;
141
+ } catch (d) {
142
+ throw f === e && r(), d;
143
+ }
144
+ }
145
+ }
146
+ function pe() {
147
+ const { useLoadState: t, loadPromise: e, reset: n } = ht(), o = z()(() => ({
148
+ loading: !1
149
+ }));
150
+ return {
151
+ useLoadStateStore: t,
152
+ loadPromise: e,
153
+ resetLoadState: n,
154
+ useExternalLoadingStore: o,
155
+ updateLoading: r
156
+ };
157
+ function r(s) {
158
+ o.setState({ loading: s });
159
+ }
160
+ }
161
+ function Se() {
162
+ const t = /* @__PURE__ */ new Map();
163
+ return { hook: e, callHook: o, callHookParallel: r, callHookSync: s };
164
+ function e(l, g) {
165
+ if (!l || typeof g != "function")
166
+ return () => {
167
+ };
168
+ const a = g, f = t.get(l) ?? [];
169
+ return f.push(a), t.set(l, f), () => {
170
+ const d = t.get(l);
171
+ if (!d) return;
172
+ const u = d.indexOf(a);
173
+ u !== -1 && d.splice(u, 1), d.length === 0 && t.delete(l);
174
+ };
175
+ }
176
+ function n(l) {
177
+ return [...t.get(l) ?? []];
178
+ }
179
+ function o(l, ...g) {
180
+ const a = n(l).reduce((f, d) => {
181
+ const u = f[f.length - 1] ?? Promise.resolve();
182
+ return [...f, u.then(() => d(...g))];
183
+ }, []);
184
+ return Promise.all(a);
185
+ }
186
+ function r(l, ...g) {
187
+ return Promise.all(n(l).map((a) => a(...g)));
188
+ }
189
+ function s(l, ...g) {
190
+ return n(l).map((a) => a(...g));
191
+ }
192
+ }
193
+ function me() {
194
+ const t = Se();
195
+ return {
196
+ hook: t.hook,
197
+ callHook: t.callHook,
198
+ callHookParallel: t.callHookParallel,
199
+ callHookSync: t.callHookSync
200
+ };
201
+ }
202
+ const q = "table_layout", yt = "cards_layout", nt = "view_selector", he = /* @__PURE__ */ new Map([
203
+ [q, V.layoutMainSlotSelector.table],
204
+ [yt, V.layoutMainSlotSelector.cards]
205
+ ]);
206
+ function ye() {
207
+ const t = H(), e = t.layout.useLayoutStore((r) => r.slots.get("main")), n = t.layout.useLayoutStore((r) => r.activeSlotIds.get("main"));
208
+ if (!e || e.length < 2) return null;
209
+ return /* @__PURE__ */ p(Wt, { size: "sm", iconOnly: !0, value: n, onValueChange: o, children: e.map((r) => {
210
+ const s = "icon" in r ? r.icon : void 0;
211
+ return /* @__PURE__ */ p(
212
+ Nt,
213
+ {
214
+ value: r.id,
215
+ "aria-label": he.get(r.id) ?? r.id,
216
+ children: s ? /* @__PURE__ */ p(s, {}) : null
217
+ },
218
+ r.id
219
+ );
220
+ }) });
221
+ function o(r) {
222
+ r && t.layout.setActiveSlotId("main", r);
223
+ }
224
+ }
225
+ function ge(t) {
226
+ const e = z()(() => ({
227
+ slots: /* @__PURE__ */ new Map(),
228
+ activeSlotIds: /* @__PURE__ */ new Map()
229
+ })), n = {
230
+ registerSlot: s,
231
+ setActiveSlotId: l,
232
+ getActiveSlotId: g
233
+ };
234
+ return t.plugins.registerPublicApi(n), {
235
+ ...n,
236
+ useLayoutStore: e
237
+ };
238
+ function o(a, f) {
239
+ return r(a).find((d) => d.id === f);
240
+ }
241
+ function r(a) {
242
+ return e.getState().slots.get(a) ?? [];
243
+ }
244
+ function s(a, f) {
245
+ (a === "top-start" || a === "top-end") && !o("top", "default") && s("top", {
246
+ id: "default",
247
+ active: !0,
248
+ component: () => null
249
+ });
250
+ const d = f.id ?? Math.random().toString(), u = r(a), m = f.order ?? (u.length + 1) * 10, S = { id: d, name: a, ...f, order: m }, i = [...u, S].sort((c, h) => c.order - h.order);
251
+ e.setState((c) => {
252
+ const h = new Map(c.slots);
253
+ return h.set(a, i), { slots: h };
254
+ }), ("active" in f && f.active || i.length === 1) && l(a, S.id), a === "main" && i.length >= 2 && !o("top-end", nt) && s("top-end", {
255
+ id: nt,
256
+ component: ye
257
+ });
258
+ }
259
+ function l(a, f) {
260
+ e.setState((d) => {
261
+ const u = new Map(d.activeSlotIds);
262
+ return u.set(a, f), { activeSlotIds: u };
263
+ });
264
+ }
265
+ function g(a) {
266
+ return e.getState().activeSlotIds.get(a);
267
+ }
268
+ }
269
+ function $(t) {
270
+ return typeof t == "object" && t !== null;
271
+ }
272
+ function Ce(t, e) {
273
+ const n = ((e == null ? void 0 : e.id) ?? Math.random()).toString(), o = new AbortController(), r = ht(), s = structuredClone((e == null ? void 0 : e.loadContext) ?? {});
274
+ let l, g, a;
275
+ const f = {}, d = {
276
+ id: n,
277
+ useLoadState: r.useLoadState,
278
+ signal: o.signal,
279
+ abort: u,
280
+ refresh: (e == null ? void 0 : e.refresh) ?? null,
281
+ get promise() {
282
+ return f.promise;
283
+ },
284
+ get loadContext() {
285
+ return s;
286
+ },
287
+ get processResult() {
288
+ return g;
289
+ },
290
+ get fetchResult() {
291
+ return l;
292
+ },
293
+ get error() {
294
+ return a;
295
+ }
296
+ };
297
+ return f.promise = r.loadPromise(m()), d;
298
+ function u() {
299
+ o.abort();
300
+ }
301
+ async function m() {
302
+ try {
303
+ await t.hooked.callHookParallel("load:prepare", d);
304
+ const c = await t.hooked.callHookParallel("load:context", d);
305
+ i(s, c);
306
+ const h = {
307
+ ...d.loadContext,
308
+ signal: d.signal
309
+ };
310
+ if (l = await t.config.load.current(h), S(l), g = (await t.hooked.callHook("load:process", d))[0] ?? l, S(g), (e == null ? void 0 : e.store) !== !1) {
311
+ const y = t.hooked.callHookSync("load:store", d);
312
+ (!y.length || y.every((C) => C !== !0)) && (t.storage.clearSections(), t.storage.createSection({ loadContext: s }, g.results));
313
+ }
314
+ await t.hooked.callHook("load:success", d);
315
+ } catch (c) {
316
+ throw a = c, await t.hooked.callHook("load:error", d), a;
317
+ }
318
+ }
319
+ function S(c) {
320
+ if (typeof c != "object" || c === null || !("results" in c))
321
+ throw new Error(
322
+ `Load result must be an object with "results" and "total?" properties. Got ${JSON.stringify(c)}`
323
+ );
324
+ }
325
+ function i(c, h) {
326
+ for (const y of h ?? [])
327
+ if ($(y))
328
+ for (const C in y) {
329
+ const b = y[C];
330
+ if ($(b))
331
+ if (Array.isArray(b))
332
+ c[C] = b;
333
+ else {
334
+ c[C] ?? (c[C] = {});
335
+ const v = c[C];
336
+ $(v) && Object.assign(v, b);
337
+ }
338
+ }
339
+ }
340
+ }
341
+ function we(t) {
342
+ const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
343
+ let o;
344
+ const r = z()(() => ({
345
+ loadState: "blank",
346
+ recordsLoadState: "blank"
347
+ })), s = {
348
+ triggerLoad: i,
349
+ refresh: m,
350
+ abort: f,
351
+ getLoadInstances: a,
352
+ useLoadStateStore: r
353
+ };
354
+ return t.plugins.registerPublicApi(s), {
355
+ ...s,
356
+ init: u
357
+ };
358
+ function l() {
359
+ r.setState({
360
+ loadState: e.size > 0 ? "loading" : "blank",
361
+ recordsLoadState: n.size > 0 ? "loading" : "blank"
362
+ });
363
+ }
364
+ function g(c) {
365
+ var h, y;
366
+ return (c == null ? void 0 : c.store) === !1 ? !1 : ((y = (h = c == null ? void 0 : c.loadContext) == null ? void 0 : h.tree) == null ? void 0 : y.parentId) == null;
367
+ }
368
+ function a() {
369
+ return [...e.values()];
370
+ }
371
+ function f() {
372
+ for (const c of e.values())
373
+ c.abort();
374
+ }
375
+ async function d(c) {
376
+ try {
377
+ return await c.promise, !1;
378
+ } catch (h) {
379
+ if (c.signal.aborted) return !0;
380
+ throw h;
381
+ }
382
+ }
383
+ async function u() {
384
+ await t.hooked.callHook("init");
385
+ const c = o;
386
+ if (!await d(i())) return;
387
+ let h = c;
388
+ for (; o !== h; )
389
+ h = o, await h;
390
+ }
391
+ function m(c = {}) {
392
+ return o = S(c), o;
393
+ }
394
+ async function S(c) {
395
+ f();
396
+ const h = { resetFilters: c.resetFilters ?? !0 };
397
+ await t.hooked.callHook("refresh", h), await d(i({ refresh: h }));
398
+ }
399
+ function i(c) {
400
+ const h = Ce(t, c);
401
+ return e.set(h.id, h), g(c) && n.add(h.id), l(), h.promise.finally(() => {
402
+ e.delete(h.id), n.delete(h.id), l();
403
+ }).catch(() => {
404
+ }), h;
405
+ }
406
+ }
407
+ function be(t) {
408
+ const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = t.config.name, r = t.config.persistent ?? "localStorage", s = {
409
+ registerPersistentState: a
410
+ };
411
+ return t.plugins.registerPublicApi(s), s;
412
+ function l(f) {
413
+ return `dataGrid:${o}:${f}`;
414
+ }
415
+ function g(f) {
416
+ if (typeof window > "u") return null;
417
+ try {
418
+ return f === "localStorage" ? localStorage : sessionStorage;
419
+ } catch {
420
+ return null;
421
+ }
422
+ }
423
+ function a(f, d = {}) {
424
+ const u = l(f), m = d.storage ?? r, S = m === "router" && d.router === !1;
425
+ return {
426
+ get value() {
427
+ return i();
428
+ },
429
+ setValue: c,
430
+ buildStorageItem: h
431
+ };
432
+ function i() {
433
+ if (S)
434
+ return;
435
+ if (m === "memory")
436
+ return n.get(f);
437
+ if (m === "router") {
438
+ const C = new URLSearchParams(window.location.search);
439
+ return ot(C.get(f));
440
+ }
441
+ const y = g(m);
442
+ if (y)
443
+ return ot(ve(y, u));
444
+ }
445
+ function c(y) {
446
+ var C;
447
+ if (!S) {
448
+ if (m === "memory")
449
+ y === void 0 ? n.delete(f) : n.set(f, y);
450
+ else if (m === "router") {
451
+ const b = new URLSearchParams(window.location.search);
452
+ y === void 0 ? b.delete(f) : b.set(f, JSON.stringify(y));
453
+ const v = `${window.location.pathname}?${b.toString()}`;
454
+ window.history.replaceState(null, "", v);
455
+ } else {
456
+ const b = g(m);
457
+ if (!b) return;
458
+ try {
459
+ y === void 0 ? b.removeItem(u) : b.setItem(u, JSON.stringify(y));
460
+ } catch {
461
+ }
462
+ }
463
+ (C = e.get(f)) == null || C.forEach((b) => b());
464
+ }
465
+ }
466
+ function h(y) {
467
+ if (!d.schema) return { [f]: y };
468
+ const C = {};
469
+ return Object.entries(d.schema).forEach(([b]) => {
470
+ const v = $(y) ? y[b] : void 0;
471
+ v !== void 0 && (C[b] = v);
472
+ }), C;
473
+ }
474
+ }
475
+ }
476
+ function ve(t, e) {
477
+ try {
478
+ return t.getItem(e);
479
+ } catch {
480
+ return null;
481
+ }
482
+ }
483
+ function ot(t) {
484
+ if (t)
485
+ try {
486
+ return JSON.parse(t);
487
+ } catch {
488
+ return;
489
+ }
490
+ }
491
+ function ke(t) {
492
+ const e = /* @__PURE__ */ new Map(), n = {
493
+ hook: t.hooked.hook,
494
+ getPlugin: g
495
+ }, o = { ...n };
496
+ return {
497
+ ...n,
498
+ registerPlugin: s,
499
+ registerPlugins: l,
500
+ registerPublicApi: r,
501
+ pluginContext: o
502
+ };
503
+ function r(a) {
504
+ Object.assign(o, a);
505
+ }
506
+ function s(a) {
507
+ if (e.has(a.name)) {
508
+ process.env.NODE_ENV !== "production" && console.warn(
509
+ `[DataGrid] Plugin "${a.name}" is already registered. Skipping duplicate.`
510
+ );
511
+ return;
512
+ }
513
+ const f = a.setup(o);
514
+ f !== void 0 && e.set(a.name, f);
515
+ }
516
+ function l(a) {
517
+ a.forEach((f) => s(f));
518
+ }
519
+ function g(a) {
520
+ return e.get(a);
521
+ }
522
+ }
523
+ function rt(t, e) {
524
+ if (typeof e == "string") {
525
+ if (!(e in t))
526
+ throw new Error(`Key "${e}" not found in item ${JSON.stringify(t)}`);
527
+ return t[e];
528
+ }
529
+ return e(t);
530
+ }
531
+ function xe(t) {
532
+ const e = z()(() => ({
533
+ sections: /* @__PURE__ */ new Map(),
534
+ recordSections: /* @__PURE__ */ new Map(),
535
+ visibleRecords: [],
536
+ rootSections: [],
537
+ visibleSections: [],
538
+ hasActiveFilters: !1
539
+ }));
540
+ let n = [];
541
+ const o = {
542
+ useStore: e,
543
+ clearSections: s,
544
+ createSection: r,
545
+ getSections: l,
546
+ getRecord: g,
547
+ getSectionsByParentId: a,
548
+ getRecordsByParentId: f,
549
+ getItemId: d
550
+ };
551
+ return t.plugins.registerPublicApi(o), { ...o, updateImplicitFilterKeys: m };
552
+ function r(i, c) {
553
+ const h = Math.random().toString(), y = i.parentId ?? null, C = {
554
+ id: h,
555
+ visible: !0,
556
+ parentId: y,
557
+ loadContext: i.loadContext,
558
+ records: []
559
+ }, b = t.config.itemKey ?? "id";
560
+ for (const [v, _] of c.entries()) {
561
+ const w = rt(_, b);
562
+ C.records.push({ id: w, item: _, index: v, section: C });
563
+ }
564
+ return e.setState((v) => {
565
+ const _ = new Map(v.sections), w = new Map(v.recordSections);
566
+ _.set(h, C), w.set(y, [...w.get(y) ?? [], h]);
567
+ const { visibleRecords: x, rootSections: L, visibleSections: E, hasActiveFilters: k } = S(_, w);
568
+ return {
569
+ sections: _,
570
+ recordSections: w,
571
+ visibleRecords: x,
572
+ rootSections: L,
573
+ visibleSections: E,
574
+ hasActiveFilters: k
575
+ };
576
+ }), C;
577
+ }
578
+ function s() {
579
+ e.setState({
580
+ sections: /* @__PURE__ */ new Map(),
581
+ recordSections: /* @__PURE__ */ new Map(),
582
+ visibleRecords: [],
583
+ rootSections: [],
584
+ visibleSections: [],
585
+ hasActiveFilters: !1
586
+ });
587
+ }
588
+ function l() {
589
+ return [...e.getState().sections.values()];
590
+ }
591
+ function g(i) {
592
+ for (const c of e.getState().sections.values()) {
593
+ const h = c.records.find((y) => y.id === i);
594
+ if (h)
595
+ return h;
596
+ }
597
+ }
598
+ function a(i) {
599
+ const c = e.getState();
600
+ return (c.recordSections.get(i) ?? []).map((y) => c.sections.get(y)).filter(Boolean);
601
+ }
602
+ function f(i) {
603
+ return a(i).flatMap((c) => c.records);
604
+ }
605
+ function d(i) {
606
+ const c = t.config.itemKey ?? "id";
607
+ return rt(i, c);
608
+ }
609
+ function u(i) {
610
+ return i == null ? !1 : typeof i == "boolean" ? !0 : Array.isArray(i) ? i.length > 0 : !!i;
611
+ }
612
+ function m(i) {
613
+ n !== i && (n = i, e.setState((c) => S(c.sections, c.recordSections)));
614
+ }
615
+ function S(i, c) {
616
+ const y = [...i.values()].filter((w) => w.visible), b = (c.get(null) ?? []).map((w) => i.get(w)).filter((w) => w.visible), v = y.flatMap((w) => w.records), _ = y.some((w) => {
617
+ const { filters: x } = w.loadContext;
618
+ return x ? Object.entries(x).some(
619
+ ([L, E]) => !n.includes(L) && u(E == null ? void 0 : E.value)
620
+ ) : !1;
621
+ });
622
+ return {
623
+ visibleSections: y,
624
+ rootSections: b,
625
+ visibleRecords: v,
626
+ hasActiveFilters: _
627
+ };
628
+ }
629
+ }
630
+ function Q(t) {
631
+ return typeof t == "function" ? t() : t;
632
+ }
633
+ function gt(t, e) {
634
+ return e.split(".").reduce((n, o) => {
635
+ if (n != null && typeof n == "object")
636
+ return n[o];
637
+ }, t);
638
+ }
639
+ function Ct(t, e) {
640
+ if (t.render || t.component) return;
641
+ const n = t.key ?? t.id, o = n.includes(".") ? gt(e, n) : e[n];
642
+ return t.formatter ? t.formatter(o) : o != null ? String(o) : "";
643
+ }
644
+ function _e({
645
+ column: t,
646
+ item: e
647
+ }) {
648
+ if (t.render)
649
+ return typeof t.render == "function" ? /* @__PURE__ */ p(G, { children: t.render(e) }) : /* @__PURE__ */ p(G, { children: t.render });
650
+ if (t.component) {
651
+ const n = t.component, o = t.key ?? t.id, r = o.includes(".") ? gt(e, o) : e[o];
652
+ return /* @__PURE__ */ p(n, { item: e, column: t, value: r });
653
+ }
654
+ return /* @__PURE__ */ p(G, { children: Ct(t, e) });
655
+ }
656
+ function Ee({ children: t }) {
657
+ return /* @__PURE__ */ p(G, { children: t });
658
+ }
659
+ function Le({
660
+ column: t
661
+ }) {
662
+ return /* @__PURE__ */ p("span", { children: Q(t.label) });
663
+ }
664
+ function O() {
665
+ return H().table;
666
+ }
667
+ const Ie = "_cell_5zgpa_2", De = "_stickyCell_5zgpa_16", Ge = "_stickyHeaderCell_5zgpa_33", Re = "_contentRow_5zgpa_38", Me = "_content_5zgpa_37", He = "_endSlot_5zgpa_37", R = {
668
+ cell: Ie,
669
+ stickyCell: De,
670
+ stickyHeaderCell: Ge,
671
+ contentRow: Re,
672
+ content: Me,
673
+ endSlot: He
674
+ }, Oe = "_headerCell_18ulc_1", Ae = "_headerCellContent_18ulc_13", We = "_extraHeaderCell_18ulc_21", j = {
675
+ headerCell: Oe,
676
+ headerCellContent: Ae,
677
+ extraHeaderCell: We
678
+ };
679
+ function wt({ children: t }) {
680
+ return /* @__PURE__ */ p("span", { className: j.headerCellContent, children: t });
681
+ }
682
+ function bt({
683
+ group: t,
684
+ colspan: e,
685
+ className: n
686
+ }) {
687
+ const o = O(), r = o.useGroupStickyOffset(t.id), s = o.useStickyHeader(), l = r !== void 0, g = t.component, a = g ? /* @__PURE__ */ p(g, { group: t }) : /* @__PURE__ */ p(wt, { children: Q(t.label) });
688
+ return /* @__PURE__ */ p(
689
+ mt,
690
+ {
691
+ className: N(
692
+ R.cell,
693
+ j.headerCell,
694
+ l && R.stickyCell,
695
+ s && R.stickyHeaderCell,
696
+ n
697
+ ),
698
+ style: l ? { position: "sticky", insetInlineStart: `${r}px` } : void 0,
699
+ scope: "col",
700
+ colSpan: e,
701
+ children: a
702
+ }
703
+ );
704
+ }
705
+ const vt = Lt(null), Ne = vt.Provider;
706
+ function Vn() {
707
+ const t = Et(vt);
708
+ if (!t)
709
+ throw new Error("useDataGridRecord must be used within a DataGridRow");
710
+ return t;
711
+ }
712
+ const Ve = "--_data-grid-col-max";
713
+ function kt(t) {
714
+ return typeof t == "string" && t.trim().endsWith("%");
715
+ }
716
+ function xt(t) {
717
+ return typeof t == "number" ? `${t}px` : /^-?\d+(\.\d+)?$/.test(t.trim()) ? `${t}px` : t;
718
+ }
719
+ function _t(t, e, n) {
720
+ return e === "auto" ? Pe(t, n) : ze(t, n);
721
+ }
722
+ function ze(t, e) {
723
+ const o = (t.width === "min-content" ? e : t.width) ?? t.minWidth ?? t.maxWidth;
724
+ if (o === void 0) return { headerStyle: {}, contentVars: {}, isCapped: !1 };
725
+ if (kt(o))
726
+ return { headerStyle: { inlineSize: o }, contentVars: {}, isCapped: !1 };
727
+ const r = xt(o);
728
+ return {
729
+ headerStyle: { width: r, minInlineSize: r },
730
+ contentVars: {},
731
+ isCapped: !1
732
+ };
733
+ }
734
+ function Pe(t, e) {
735
+ const { width: n, minWidth: o, maxWidth: r } = t, s = {};
736
+ if (n !== void 0)
737
+ if (n === "min-content" && e !== void 0) {
738
+ const a = `${r !== void 0 ? Math.min(e, r) : e}px`;
739
+ s.width = a, s.minInlineSize = a;
740
+ } else if (kt(n))
741
+ s.inlineSize = n;
742
+ else {
743
+ const g = xt(n);
744
+ s.width = g, s.minInlineSize = g;
745
+ }
746
+ o !== void 0 && (s.minInlineSize = `${o}px`);
747
+ const l = {};
748
+ return r !== void 0 && (n === void 0 && (s.width = `${r}px`), l[Ve] = `${r}px`), { headerStyle: s, contentVars: l, isCapped: r !== void 0 };
749
+ }
750
+ function Te(t, e, n) {
751
+ const o = t.cellOverflow ?? "wrap", { contentVars: r, isCapped: s } = _t(t, n), l = o === "nowrap" ? Ct(t, e) : void 0;
752
+ return { style: r, overflow: o, capped: s, title: l || void 0 };
753
+ }
754
+ const $e = "data-grid-row-ignore-click";
755
+ function Fe(t) {
756
+ if (t != null)
757
+ return typeof t == "number" ? `${t}px` : isNaN(Number(t)) ? t : `${t}px`;
758
+ }
759
+ function K({
760
+ columnId: t,
761
+ rowspan: e,
762
+ className: n,
763
+ style: o,
764
+ width: r,
765
+ children: s,
766
+ header: l,
767
+ endSlot: g,
768
+ overflow: a,
769
+ capped: f,
770
+ title: d,
771
+ contentRowRef: u,
772
+ fillContent: m,
773
+ ignoreRowClick: S
774
+ }) {
775
+ const i = O(), c = i.useColumnStickyOffset(t), h = i.useColumnEndStickyOffset(t), y = c !== void 0, C = h !== void 0, b = /* @__PURE__ */ p("span", { className: R.content, children: s }), v = l ? mt : Vt, _ = Fe(r);
776
+ return /* @__PURE__ */ p(
777
+ v,
778
+ {
779
+ "data-column-id": t,
780
+ "data-overflow": a,
781
+ "data-capped": f || void 0,
782
+ "data-header-fill": m || void 0,
783
+ ...S && { [$e]: "" },
784
+ title: d,
785
+ className: N(R.cell, (y || C) && R.stickyCell, n),
786
+ style: {
787
+ ...o,
788
+ ..._ ? { width: _ } : {},
789
+ ...y ? { position: "sticky", insetInlineStart: `${c}px` } : {},
790
+ ...C ? { position: "sticky", insetInlineEnd: `${h}px` } : {}
791
+ },
792
+ scope: l ? "col" : void 0,
793
+ rowSpan: e,
794
+ children: g ? /* @__PURE__ */ D("span", { className: R.contentRow, ref: u, children: [
795
+ b,
796
+ /* @__PURE__ */ p("span", { className: R.endSlot, children: g })
797
+ ] }) : b
798
+ }
799
+ );
800
+ }
801
+ function it({
802
+ position: t
803
+ }) {
804
+ const n = O().useExtraColumns(t);
805
+ return /* @__PURE__ */ p(G, { children: n.map((o) => /* @__PURE__ */ p(
806
+ K,
807
+ {
808
+ columnId: o.id,
809
+ width: o.width,
810
+ ignoreRowClick: o.ignoreRowClick,
811
+ children: o.body ? /* @__PURE__ */ p(o.body, {}) : null
812
+ },
813
+ o.id
814
+ )) });
815
+ }
816
+ function Be({ record: t }) {
817
+ const e = O(), n = e.useVisibleColumns(), o = e.useTableLayout(), r = e.useComponent(
818
+ "body-cell-content"
819
+ );
820
+ return /* @__PURE__ */ p(Ne, { value: t, children: /* @__PURE__ */ D(J, { children: [
821
+ /* @__PURE__ */ p(it, { position: "start" }),
822
+ n.map((s) => {
823
+ var a;
824
+ const l = (a = s.getClassName) == null ? void 0 : a.call(s, t.item), g = Te(s, t.item, o);
825
+ return /* @__PURE__ */ p(
826
+ K,
827
+ {
828
+ columnId: s.id,
829
+ className: l,
830
+ ...g,
831
+ children: /* @__PURE__ */ p(r, { column: s, item: t.item })
832
+ },
833
+ s.id
834
+ );
835
+ }),
836
+ /* @__PURE__ */ p(it, { position: "end" })
837
+ ] }) });
838
+ }
839
+ const je = "_tableWrapper_1wbrz_6", Ke = "_table_1wbrz_6", Ue = "_layoutFixed_1wbrz_35", Je = "_layoutAuto_1wbrz_42", Ye = "_tableBordered_1wbrz_49", T = {
840
+ tableWrapper: je,
841
+ table: Ke,
842
+ layoutFixed: Ue,
843
+ layoutAuto: Je,
844
+ tableBordered: Ye
845
+ };
846
+ function Xe({
847
+ record: t
848
+ }) {
849
+ const n = O().useComponent("row");
850
+ return /* @__PURE__ */ p(n, { record: t });
851
+ }
852
+ function qe({
853
+ records: t
854
+ }) {
855
+ return /* @__PURE__ */ p(G, { children: t.map((e) => /* @__PURE__ */ p(Xe, { record: e }, e.id)) });
856
+ }
857
+ function Qe() {
858
+ const e = B().useStore((n) => n.rootSections);
859
+ return /* @__PURE__ */ p(G, { children: e.map((n) => /* @__PURE__ */ p(zt, { children: /* @__PURE__ */ p(qe, { records: n.records }) }, n.id)) });
860
+ }
861
+ function Ze({
862
+ column: t,
863
+ rowspan: e,
864
+ className: n,
865
+ children: o
866
+ }) {
867
+ const s = O().useStickyHeader();
868
+ return /* @__PURE__ */ p(
869
+ K,
870
+ {
871
+ header: !0,
872
+ columnId: t.id,
873
+ className: N(j.extraHeaderCell, s && R.stickyHeaderCell, n),
874
+ width: t.width,
875
+ rowspan: e,
876
+ ignoreRowClick: t.ignoreRowClick,
877
+ children: o ? /* @__PURE__ */ p(wt, { children: o }) : null
878
+ }
879
+ );
880
+ }
881
+ function st({
882
+ position: t,
883
+ isGroupRow: e,
884
+ className: n
885
+ }) {
886
+ const o = O(), r = o.useHasGroups(), s = o.useExtraColumns(t), l = !r || e;
887
+ return /* @__PURE__ */ p(G, { children: s.map((g) => /* @__PURE__ */ p(
888
+ Ze,
889
+ {
890
+ column: g,
891
+ rowspan: l && r ? 2 : void 0,
892
+ className: n,
893
+ children: l && g.header ? /* @__PURE__ */ p(g.header, {}) : null
894
+ },
895
+ g.id
896
+ )) });
897
+ }
898
+ function tn(t) {
899
+ return {
900
+ setMinContentWidth: e,
901
+ useMinContentWidth: n
902
+ };
903
+ function e(o, r) {
904
+ const s = t.getState().minContentWidths;
905
+ if (s.get(o) === r) return;
906
+ const l = new Map(s);
907
+ l.set(o, r), t.setState({ minContentWidths: l });
908
+ }
909
+ function n(o) {
910
+ return t((r) => r.minContentWidths.get(o));
911
+ }
912
+ }
913
+ function en(t, e) {
914
+ const n = e ? window.getComputedStyle(e) : void 0, o = n ? parseFloat(n.paddingInlineStart || "0") + parseFloat(n.paddingInlineEnd || "0") : 0, r = n ? parseFloat(n.borderInlineStartWidth || "0") + parseFloat(n.borderInlineEndWidth || "0") : 0;
915
+ return Math.ceil(t.contentRect.width + o + r);
916
+ }
917
+ function at({
918
+ column: t,
919
+ rowspan: e,
920
+ headerCellEndSlots: n,
921
+ className: o
922
+ }) {
923
+ const r = O(), s = F(null), l = r.useComponent("header-cell-label"), g = r.useTableLayout(), a = r.useStickyHeader(), f = r.useMinContentWidth(t.id), d = t.headerComponent ? /* @__PURE__ */ p(t.headerComponent, { column: t }) : (
924
+ // eslint-disable-next-line react-hooks/static-components -- LabelComponent comes from the grid's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
925
+ /* @__PURE__ */ p(l, { column: t })
926
+ ), u = t.headerOverflow ?? "nowrap", m = t.width === "min-content", S = m ? void 0 : u, { headerStyle: i, contentVars: c, isCapped: h } = _t(
927
+ t,
928
+ g,
929
+ f
930
+ ), y = !t.headerComponent && u === "nowrap" ? Q(t.label) : void 0, C = !!t.headerComponent && !m;
931
+ return A(() => {
932
+ if (!m) return;
933
+ const b = s.current;
934
+ if (!b) return;
935
+ const v = b.closest("th, td"), _ = new ResizeObserver((w) => {
936
+ const x = w[w.length - 1];
937
+ r.setMinContentWidth(t.id, en(x, v));
938
+ });
939
+ return _.observe(b), () => _.disconnect();
940
+ }, [m, t.id, r]), /* @__PURE__ */ p(
941
+ K,
942
+ {
943
+ header: !0,
944
+ columnId: t.id,
945
+ className: N(j.headerCell, a && R.stickyHeaderCell, o),
946
+ style: { ...i, ...c },
947
+ rowspan: e,
948
+ overflow: S,
949
+ capped: m ? void 0 : h,
950
+ title: y,
951
+ contentRowRef: m ? s : void 0,
952
+ fillContent: C,
953
+ endSlot: n.map((b) => {
954
+ const v = b.component;
955
+ return /* @__PURE__ */ p(v, { column: t }, b.id);
956
+ }),
957
+ children: d
958
+ }
959
+ );
960
+ }
961
+ const nn = "_theadSticky_1kkfu_11", on = {
962
+ theadSticky: nn
963
+ };
964
+ function rn() {
965
+ const t = O(), e = F(null), n = F(null), o = t.useHasGroups(), r = t.useStickyHeader(), s = t.useFirstRowHeaderCells(), l = t.useSecondRowHeaderColumns(), g = t.useSlots("header-cell-end");
966
+ return A(() => {
967
+ const a = e.current;
968
+ if (!a) return;
969
+ n.current = new ResizeObserver((d) => {
970
+ var u, m;
971
+ for (const S of d) {
972
+ const { columnId: i } = S.target.dataset;
973
+ if (i) {
974
+ const c = ((m = (u = S.borderBoxSize) == null ? void 0 : u[0]) == null ? void 0 : m.inlineSize) ?? S.contentRect.width;
975
+ t.onResizeColumn(i, c);
976
+ }
977
+ }
978
+ });
979
+ const f = a.querySelectorAll("[data-column-id]");
980
+ for (const d of f)
981
+ n.current.observe(d);
982
+ return () => {
983
+ var d;
984
+ (d = n.current) == null || d.disconnect();
985
+ };
986
+ }, [t, s, l]), /* @__PURE__ */ D(
987
+ Pt,
988
+ {
989
+ ref: e,
990
+ className: N(r && o && on.theadSticky),
991
+ children: [
992
+ /* @__PURE__ */ D(J, { children: [
993
+ /* @__PURE__ */ p(st, { position: "start", isGroupRow: !0 }),
994
+ s.map((a) => {
995
+ if (a.type === "group") {
996
+ const d = a.item;
997
+ return /* @__PURE__ */ p(bt, { group: d, colspan: a.colspan }, d.id);
998
+ }
999
+ const f = a.item;
1000
+ return /* @__PURE__ */ p(
1001
+ at,
1002
+ {
1003
+ column: f,
1004
+ rowspan: a.rowspan,
1005
+ headerCellEndSlots: g
1006
+ },
1007
+ f.id
1008
+ );
1009
+ }),
1010
+ /* @__PURE__ */ p(st, { position: "end", isGroupRow: !0 })
1011
+ ] }),
1012
+ o && l.length > 0 && /* @__PURE__ */ p(J, { children: l.map((a) => /* @__PURE__ */ p(
1013
+ at,
1014
+ {
1015
+ column: a,
1016
+ headerCellEndSlots: g
1017
+ },
1018
+ a.id
1019
+ )) })
1020
+ ]
1021
+ }
1022
+ );
1023
+ }
1024
+ function ct({ slots: t }) {
1025
+ return t.length === 0 ? null : /* @__PURE__ */ p(G, { children: t.map((e) => {
1026
+ const n = e.component;
1027
+ return /* @__PURE__ */ p(n, {}, e.id);
1028
+ }) });
1029
+ }
1030
+ const sn = {
1031
+ fixed: T.layoutFixed,
1032
+ auto: T.layoutAuto
1033
+ };
1034
+ function an() {
1035
+ const t = O(), e = t.useHasGroups(), n = t.useSlots("subheader"), o = t.useSlots("footer"), r = t.useTableLayout(), s = t.useStickyHeader(), l = t.useComponent("content");
1036
+ return (
1037
+ // eslint-disable-next-line react-hooks/static-components -- ContentWrapper comes from the grid's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
1038
+ /* @__PURE__ */ p(l, { children: /* @__PURE__ */ D(
1039
+ Tt,
1040
+ {
1041
+ stickyHeader: s,
1042
+ containerClassName: T.tableWrapper,
1043
+ className: N(T.table, sn[r], e && T.tableBordered),
1044
+ children: [
1045
+ /* @__PURE__ */ p(rn, {}),
1046
+ /* @__PURE__ */ p(ct, { slots: n }),
1047
+ /* @__PURE__ */ p(Qe, {}),
1048
+ /* @__PURE__ */ p(ct, { slots: o })
1049
+ ]
1050
+ }
1051
+ ) })
1052
+ );
1053
+ }
1054
+ function M(t) {
1055
+ return "columns" in t && Array.isArray(t.columns);
1056
+ }
1057
+ const cn = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/;
1058
+ function ln(t, e, n) {
1059
+ const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
1060
+ let s = !1;
1061
+ return {
1062
+ initializeColumns: S,
1063
+ useVisibleColumns: m
1064
+ };
1065
+ function l(i) {
1066
+ if (!cn.test(i))
1067
+ throw new Error(`Column id "${i}" must be snake_case (e.g., "user_name", "is_active").`);
1068
+ }
1069
+ function g(i) {
1070
+ return !i.headerTruncate || i.headerOverflow !== void 0 ? i : (process.env.NODE_ENV !== "production" && !r.has(i.id) && (r.add(i.id), console.warn(
1071
+ `[DataGrid] Column "${i.id}": \`headerTruncate\` is deprecated, use \`headerOverflow: 'nowrap'\` instead. \`headerTruncate\` will be removed in a future release.`
1072
+ )), { ...i, headerOverflow: "nowrap" });
1073
+ }
1074
+ function a(i, c) {
1075
+ c !== "fixed" || process.env.NODE_ENV === "production" || i.width === "min-content" || [i.width, i.minWidth, i.maxWidth].filter(
1076
+ (y) => y !== void 0
1077
+ ).length <= 1 || o.has(i.id) || (o.add(i.id), console.warn(
1078
+ `[DataGrid] Column "${i.id}": width, minWidth, and maxWidth cannot all apply under tableLayout="fixed" -- they collapse to a single track (width wins when set). Use tableLayout="auto" for independent min/max constraints, or drop the extra prop(s).`
1079
+ ));
1080
+ }
1081
+ function f(i, c) {
1082
+ c !== "auto" || process.env.NODE_ENV === "production" || s || i.length === 0 || !i.every(
1083
+ (y) => y.width !== void 0 || y.maxWidth !== void 0
1084
+ ) || (s = !0, console.warn(
1085
+ '[DataGrid] Every column has a width or maxWidth under tableLayout="auto" -- if the container is wider than their sum, the browser will grow columns past their caps and capped content will show trailing blank space. Leave at least one column without a width/maxWidth to absorb the extra space.'
1086
+ ));
1087
+ }
1088
+ function d(i) {
1089
+ const c = [];
1090
+ for (const h of i)
1091
+ if (M(h))
1092
+ for (const y of h.columns)
1093
+ c.push(g({ ...y, groupId: h.id }));
1094
+ else
1095
+ c.push(g(h));
1096
+ return c;
1097
+ }
1098
+ function u(i) {
1099
+ const c = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Set();
1100
+ function y(C) {
1101
+ c.set(C.id, C.visible ?? !0), C.visibleToggleDisabled && h.add(C.id);
1102
+ }
1103
+ for (const C of i)
1104
+ if (M(C))
1105
+ for (const b of C.columns)
1106
+ y(b);
1107
+ else
1108
+ y(C);
1109
+ for (const [C, b] of Object.entries((n == null ? void 0 : n.read()) ?? {}))
1110
+ c.has(C) && !h.has(C) && c.set(C, b);
1111
+ return c;
1112
+ }
1113
+ function m() {
1114
+ return t(
1115
+ Y((i) => {
1116
+ const c = i.flatColumns.filter((h) => i.columnVisibility.get(h.id) !== !1);
1117
+ return e.getOrderedColumnsWithSticky(c, i.columnSticky);
1118
+ })
1119
+ );
1120
+ }
1121
+ function S(i) {
1122
+ const c = d(i), { tableLayout: h } = t.getState();
1123
+ for (const y of c)
1124
+ l(y.id), a(y, h);
1125
+ return f(c, h), {
1126
+ columns: i,
1127
+ flatColumns: c,
1128
+ columnVisibility: u(i)
1129
+ };
1130
+ }
1131
+ }
1132
+ const dn = "columnVisibility";
1133
+ function un(t) {
1134
+ if (!t.config.persistentColumnVisibility) return;
1135
+ const e = t.persistentState.registerPersistentState(
1136
+ dn,
1137
+ { storage: "localStorage" }
1138
+ );
1139
+ return { read: n, record: o };
1140
+ function n() {
1141
+ var s;
1142
+ const r = (s = e.value) == null ? void 0 : s.columns;
1143
+ return typeof r != "object" || r === null || Array.isArray(r) ? {} : Object.fromEntries(
1144
+ Object.entries(r).filter(([, l]) => typeof l == "boolean")
1145
+ );
1146
+ }
1147
+ function o(r, s) {
1148
+ e.setValue({ columns: { ...n(), [r]: s } });
1149
+ }
1150
+ }
1151
+ function fn(t) {
1152
+ const e = /* @__PURE__ */ new Set();
1153
+ return {
1154
+ registerExtraColumn: n,
1155
+ updateExtraColumnWidth: r,
1156
+ updateExtraColumnOrder: s,
1157
+ updateExtraColumnSticky: l,
1158
+ useExtraColumns: g
1159
+ };
1160
+ function n(a) {
1161
+ const f = t.getState(), d = a.position ?? "end", u = d === "start" ? f.extraColumnsStart : f.extraColumnsEnd, m = a.order ?? (u.length + 1) * 10, S = {
1162
+ id: a.id ?? Math.random().toString(36).slice(2),
1163
+ header: a.header,
1164
+ body: a.body,
1165
+ width: a.width,
1166
+ sticky: a.sticky,
1167
+ ignoreRowClick: a.ignoreRowClick,
1168
+ order: m,
1169
+ position: d
1170
+ }, i = [...u, S].sort((c, h) => c.order - h.order);
1171
+ d === "start" ? (o(S.id, S.sticky), t.setState({ extraColumnsStart: i })) : t.setState({ extraColumnsEnd: i });
1172
+ }
1173
+ function o(a, f) {
1174
+ process.env.NODE_ENV !== "production" && f && (e.has(a) || (e.add(a), console.warn(
1175
+ `[DataGrid] Extra column "${a}": \`sticky\` pins to the table's inline-end edge and is read only for columns at the \`end\` position -- on a \`start\` column it does nothing. Drop the flag, or register the column at the \`end\` position.`
1176
+ )));
1177
+ }
1178
+ function r(a, f) {
1179
+ const d = t.getState();
1180
+ function u(i) {
1181
+ const c = i.findIndex((y) => y.id === a);
1182
+ if (c === -1) return;
1183
+ const h = [...i];
1184
+ return h[c] = { ...h[c], width: f }, h;
1185
+ }
1186
+ const m = u(d.extraColumnsStart);
1187
+ if (m) {
1188
+ t.setState({ extraColumnsStart: m });
1189
+ return;
1190
+ }
1191
+ const S = u(d.extraColumnsEnd);
1192
+ S && t.setState({ extraColumnsEnd: S });
1193
+ }
1194
+ function s(a, f) {
1195
+ const d = t.getState();
1196
+ function u(i) {
1197
+ const c = i.findIndex((y) => y.id === a);
1198
+ if (c === -1) return;
1199
+ const h = [...i];
1200
+ return h[c] = { ...h[c], order: f }, h.sort((y, C) => y.order - C.order);
1201
+ }
1202
+ const m = u(d.extraColumnsStart);
1203
+ if (m) {
1204
+ t.setState({ extraColumnsStart: m });
1205
+ return;
1206
+ }
1207
+ const S = u(d.extraColumnsEnd);
1208
+ S && t.setState({ extraColumnsEnd: S });
1209
+ }
1210
+ function l(a, f) {
1211
+ const d = t.getState(), u = d.extraColumnsStart.some((h) => h.id === a), m = u ? "extraColumnsStart" : "extraColumnsEnd", S = d[m], i = S.findIndex((h) => h.id === a);
1212
+ if (i === -1 || (u && o(a, f), (S[i].sticky ?? !1) === f)) return;
1213
+ const c = [...S];
1214
+ c[i] = { ...c[i], sticky: f }, t.setState({ [m]: c });
1215
+ }
1216
+ function g(a) {
1217
+ return t((f) => a === "start" ? f.extraColumnsStart : f.extraColumnsEnd);
1218
+ }
1219
+ }
1220
+ function pn(t, e, n) {
1221
+ const o = [];
1222
+ let r = null, s = null;
1223
+ return {
1224
+ useHasGroups: d,
1225
+ useFirstRowHeaderCells: u,
1226
+ useSecondRowHeaderColumns: m
1227
+ };
1228
+ function l() {
1229
+ const S = t.getState(), i = S.flatColumns.filter((c) => S.columnVisibility.get(c.id) !== !1);
1230
+ return e.getOrderedColumnsWithSticky(i, S.columnSticky);
1231
+ }
1232
+ function g() {
1233
+ return t.getState().columns.some(M);
1234
+ }
1235
+ function a() {
1236
+ const S = t.getState(), i = l();
1237
+ if (!g()) {
1238
+ const y = S.components.get("header-cell") ?? n.get("header-cell");
1239
+ return i.map((C) => ({
1240
+ type: "column",
1241
+ item: C,
1242
+ component: y
1243
+ }));
1244
+ }
1245
+ const c = new Map(i.map((y, C) => [y.id, C]));
1246
+ return [...S.columns].sort((y, C) => {
1247
+ const b = M(y) ? Math.min(...y.columns.map((_) => c.get(_.id) ?? 1 / 0)) : c.get(y.id) ?? 1 / 0, v = M(C) ? Math.min(...C.columns.map((_) => c.get(_.id) ?? 1 / 0)) : c.get(C.id) ?? 1 / 0;
1248
+ return b - v;
1249
+ }).flatMap((y) => {
1250
+ if (M(y)) {
1251
+ const C = y.columns.filter(
1252
+ (b) => S.columnVisibility.get(b.id) !== !1
1253
+ ).length;
1254
+ return C === 0 ? [] : {
1255
+ type: "group",
1256
+ item: y,
1257
+ component: S.components.get("header-group") ?? n.get("header-group"),
1258
+ colspan: C
1259
+ };
1260
+ }
1261
+ return S.columnVisibility.get(y.id) === !1 ? [] : {
1262
+ type: "column",
1263
+ item: y,
1264
+ component: S.components.get("header-cell") ?? n.get("header-cell"),
1265
+ rowspan: 2
1266
+ };
1267
+ });
1268
+ }
1269
+ function f() {
1270
+ if (!g()) return o;
1271
+ const S = t.getState();
1272
+ return l().filter((c) => c.groupId && S.columnVisibility.get(c.id) !== !1);
1273
+ }
1274
+ function d() {
1275
+ return t((S) => S.columns.some(M));
1276
+ }
1277
+ function u() {
1278
+ return t((S) => {
1279
+ if (r !== null && r.state === S)
1280
+ return r.result;
1281
+ const i = a();
1282
+ return r = { state: S, result: i }, i;
1283
+ });
1284
+ }
1285
+ function m() {
1286
+ return t((S) => {
1287
+ if (s !== null && s.state === S)
1288
+ return s.result;
1289
+ const i = f();
1290
+ return s = { state: S, result: i }, i;
1291
+ });
1292
+ }
1293
+ }
1294
+ const lt = [];
1295
+ function Sn(t) {
1296
+ return {
1297
+ registerSlot: e,
1298
+ useSlots: n
1299
+ };
1300
+ function e(o, r) {
1301
+ const s = t.getState(), l = Math.random().toString(36).slice(2), g = s.slots.get(o) ?? lt, a = r.order ?? (g.length + 1) * 10, f = {
1302
+ id: l,
1303
+ name: o,
1304
+ component: r.component,
1305
+ order: a
1306
+ }, d = [...g, f].sort((m, S) => m.order - S.order), u = new Map(s.slots);
1307
+ u.set(o, d), t.setState({ slots: u });
1308
+ }
1309
+ function n(o) {
1310
+ return t(Y((r) => r.slots.get(o) ?? lt));
1311
+ }
1312
+ }
1313
+ const mn = /^\s*(\d+(?:\.\d+)?)px\s*$/;
1314
+ function hn(t) {
1315
+ return {
1316
+ initializeStickyState: e,
1317
+ getOrderedColumnsWithSticky: n,
1318
+ onResizeColumn: o,
1319
+ isColumnSticky: r,
1320
+ isGroupSticky: s,
1321
+ useColumnStickyOffset: l,
1322
+ useColumnEndStickyOffset: g,
1323
+ useGroupStickyOffset: a
1324
+ };
1325
+ function e(d) {
1326
+ const u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
1327
+ for (const S of d)
1328
+ if (M(S)) {
1329
+ m.set(S.id, S.sticky ?? !1);
1330
+ for (const i of S.columns)
1331
+ u.set(i.id, i.sticky ?? S.sticky ?? !1);
1332
+ } else
1333
+ u.set(S.id, S.sticky ?? !1);
1334
+ return { columnSticky: u, groupSticky: m };
1335
+ }
1336
+ function n(d, u) {
1337
+ const m = [], S = [];
1338
+ for (const i of d)
1339
+ u.get(i.id) ? m.push(i) : S.push(i);
1340
+ return [...m, ...S];
1341
+ }
1342
+ function o(d, u) {
1343
+ const m = t.getState().columnWidths;
1344
+ if (m.get(d) === u) return;
1345
+ const S = new Map(m);
1346
+ S.set(d, u), t.setState({ columnWidths: S });
1347
+ }
1348
+ function r(d) {
1349
+ return t.getState().columnSticky.get(d) === !0;
1350
+ }
1351
+ function s(d) {
1352
+ return t.getState().groupSticky.get(d) === !0;
1353
+ }
1354
+ function l(d) {
1355
+ return t((u) => {
1356
+ if (!u.columnSticky.get(d)) return;
1357
+ let m = f(u);
1358
+ const S = u.flatColumns.filter((i) => u.columnVisibility.get(i.id) !== !1);
1359
+ for (const i of S) {
1360
+ if (i.id === d) break;
1361
+ u.columnSticky.get(i.id) && (m += u.columnWidths.get(i.id) ?? 0);
1362
+ }
1363
+ return m;
1364
+ });
1365
+ }
1366
+ function g(d) {
1367
+ return t((u) => yn(u, d));
1368
+ }
1369
+ function a(d) {
1370
+ return t((u) => {
1371
+ if (!u.groupSticky.get(d)) return;
1372
+ let m = f(u);
1373
+ const S = u.flatColumns.filter((i) => u.columnVisibility.get(i.id) !== !1);
1374
+ for (const i of S) {
1375
+ if (i.groupId === d) break;
1376
+ u.columnSticky.get(i.id) && (m += u.columnWidths.get(i.id) ?? 0);
1377
+ }
1378
+ return m;
1379
+ });
1380
+ }
1381
+ function f(d) {
1382
+ let u = 0;
1383
+ for (const m of d.extraColumnsStart)
1384
+ m.width && (u += parseInt(m.width, 10) || 0);
1385
+ return u;
1386
+ }
1387
+ }
1388
+ function yn(t, e) {
1389
+ let n = 0;
1390
+ for (let o = t.extraColumnsEnd.length - 1; o >= 0; o--) {
1391
+ const r = t.extraColumnsEnd[o];
1392
+ if (r.sticky) {
1393
+ if (r.id === e) return n;
1394
+ n += gn(t, r);
1395
+ }
1396
+ }
1397
+ }
1398
+ function gn(t, e) {
1399
+ const n = t.columnWidths.get(e.id);
1400
+ if (n !== void 0) return n;
1401
+ const o = mn.exec(e.width ?? "");
1402
+ return o ? Number(o[1]) : 0;
1403
+ }
1404
+ function Cn() {
1405
+ return z(() => ({
1406
+ columns: [],
1407
+ flatColumns: [],
1408
+ columnVisibility: /* @__PURE__ */ new Map(),
1409
+ columnSticky: /* @__PURE__ */ new Map(),
1410
+ groupSticky: /* @__PURE__ */ new Map(),
1411
+ columnWidths: /* @__PURE__ */ new Map(),
1412
+ minContentWidths: /* @__PURE__ */ new Map(),
1413
+ extraColumnsStart: [],
1414
+ extraColumnsEnd: [],
1415
+ slots: /* @__PURE__ */ new Map(),
1416
+ components: /* @__PURE__ */ new Map(),
1417
+ tableLayout: "fixed",
1418
+ stickyHeader: !1
1419
+ }));
1420
+ }
1421
+ function wn(t) {
1422
+ const e = Cn(), n = bn();
1423
+ t.layout.registerSlot("main", {
1424
+ id: q,
1425
+ component: an,
1426
+ active: !0,
1427
+ icon: At
1428
+ });
1429
+ const o = Sn(e), r = fn(e), s = hn(e), l = un(t), g = ln(e, s, l), a = pn(e, s, n), f = tn(e), d = {
1430
+ registerTableSlot: o.registerSlot,
1431
+ registerExtraColumn: r.registerExtraColumn,
1432
+ updateExtraColumnWidth: r.updateExtraColumnWidth,
1433
+ updateExtraColumnOrder: r.updateExtraColumnOrder,
1434
+ updateExtraColumnSticky: r.updateExtraColumnSticky,
1435
+ registerComponent: C,
1436
+ updateColumns: u,
1437
+ updateColumnVisibility: m,
1438
+ updateColumnSticky: y,
1439
+ updateTableLayout: S,
1440
+ updateStickyHeader: c
1441
+ };
1442
+ return t.plugins.registerPublicApi(d), {
1443
+ ...d,
1444
+ updateColumns: u,
1445
+ useComponent: b,
1446
+ useConfigurationColumns: _,
1447
+ useTableLayout: i,
1448
+ useStickyHeader: h,
1449
+ ...o,
1450
+ ...r,
1451
+ ...s,
1452
+ ...g,
1453
+ ...a,
1454
+ ...f
1455
+ };
1456
+ function u(w) {
1457
+ const x = g.initializeColumns(w), { columnSticky: L, groupSticky: E } = s.initializeStickyState(w), k = e.getState();
1458
+ e.setState({
1459
+ ...x,
1460
+ columnSticky: L,
1461
+ groupSticky: E,
1462
+ extraColumnsStart: k.extraColumnsStart,
1463
+ extraColumnsEnd: k.extraColumnsEnd,
1464
+ slots: k.slots,
1465
+ components: k.components,
1466
+ columnWidths: k.columnWidths,
1467
+ minContentWidths: k.minContentWidths
1468
+ });
1469
+ }
1470
+ function m(w, x) {
1471
+ const L = e.getState(), E = new Map(L.columnVisibility);
1472
+ E.set(w, x), e.setState({ columnVisibility: E }), l == null || l.record(w, x);
1473
+ }
1474
+ function S(w) {
1475
+ e.setState({ tableLayout: w });
1476
+ }
1477
+ function i() {
1478
+ return e((w) => w.tableLayout);
1479
+ }
1480
+ function c(w) {
1481
+ e.setState({ stickyHeader: w });
1482
+ }
1483
+ function h() {
1484
+ return e((w) => w.stickyHeader);
1485
+ }
1486
+ function y(w, x) {
1487
+ const L = e.getState();
1488
+ if (L.columns.some((k) => M(k) && k.id === w)) {
1489
+ const k = new Map(L.groupSticky);
1490
+ k.set(w, x), e.setState({ groupSticky: k });
1491
+ } else {
1492
+ const k = new Map(L.columnSticky);
1493
+ k.set(w, x), e.setState({ columnSticky: k });
1494
+ }
1495
+ }
1496
+ function C(w, x) {
1497
+ const L = e.getState(), E = new Map(L.components);
1498
+ E.set(w, x), e.setState({ components: E });
1499
+ }
1500
+ function b(w) {
1501
+ return e(
1502
+ (x) => x.components.get(w) ?? n.get(w)
1503
+ );
1504
+ }
1505
+ function v(w) {
1506
+ return typeof w == "function" ? w() : w;
1507
+ }
1508
+ function _() {
1509
+ const { columns: w, columnVisibility: x, columnSticky: L, groupSticky: E } = e(
1510
+ Y((k) => ({
1511
+ columns: k.columns,
1512
+ columnVisibility: k.columnVisibility,
1513
+ columnSticky: k.columnSticky,
1514
+ groupSticky: k.groupSticky
1515
+ }))
1516
+ );
1517
+ return It(() => {
1518
+ const k = Array.from(x.values()).filter(Boolean).length;
1519
+ function Z(I) {
1520
+ const tt = x.get(I.id) ?? !0;
1521
+ return {
1522
+ id: I.id,
1523
+ label: v(I.label),
1524
+ visible: tt,
1525
+ sticky: L.get(I.id) ?? !1,
1526
+ visibleToggleDisabled: I.visibleToggleDisabled ?? (tt && k === 1)
1527
+ };
1528
+ }
1529
+ return w.map((I) => M(I) ? {
1530
+ id: I.id,
1531
+ label: v(I.label),
1532
+ visible: I.visible ?? !0,
1533
+ sticky: E.get(I.id) ?? !1,
1534
+ columns: I.columns.map(Z)
1535
+ } : Z(I));
1536
+ }, [w, x, L, E]);
1537
+ }
1538
+ }
1539
+ function bn() {
1540
+ const t = /* @__PURE__ */ new Map();
1541
+ return t.set("body-cell-content", _e), t.set("content", Ee), t.set("header-cell-label", Le), t.set("header-group", bt), t.set("row", Be), t;
1542
+ }
1543
+ function vn(t) {
1544
+ const e = me(), n = {}, o = {
1545
+ hooked: e,
1546
+ config: t,
1547
+ get plugins() {
1548
+ return W(n.plugins, "plugins");
1549
+ },
1550
+ get core() {
1551
+ return W(n.core, "core");
1552
+ },
1553
+ get load() {
1554
+ return W(n.load, "load");
1555
+ },
1556
+ get storage() {
1557
+ return W(n.storage, "storage");
1558
+ },
1559
+ get persistentState() {
1560
+ return W(n.persistentState, "persistentState");
1561
+ },
1562
+ get layout() {
1563
+ return W(n.layout, "layout");
1564
+ },
1565
+ get table() {
1566
+ return W(n.table, "table");
1567
+ }
1568
+ };
1569
+ return n.plugins = ke(o), n.core = pe(), n.load = we(o), n.storage = xe(o), n.persistentState = be(o), n.layout = ge(o), n.table = wn(o), {
1570
+ init: s,
1571
+ destroy: r,
1572
+ ...o.plugins.pluginContext,
1573
+ [U]: o
1574
+ };
1575
+ function r() {
1576
+ e.callHookSync("destroy");
1577
+ const l = o.core.useLoadStateStore.getState().loadState === "loading" && o.load.getLoadInstances().length > 0;
1578
+ o.load.abort(), l && o.core.resetLoadState();
1579
+ }
1580
+ async function s() {
1581
+ const { loadState: l } = o.core.useLoadStateStore.getState();
1582
+ l === "loaded" || l === "loading" || await o.core.loadPromise(o.load.init());
1583
+ }
1584
+ }
1585
+ function W(t, e) {
1586
+ if (t === void 0)
1587
+ throw new Error(`[DataGrid] The ${e} service was used before it was created.`);
1588
+ return t;
1589
+ }
1590
+ function kn(t) {
1591
+ const e = F(t);
1592
+ return A(() => {
1593
+ e.current = t;
1594
+ }, [t]), e;
1595
+ }
1596
+ const xn = [];
1597
+ function zn({
1598
+ name: t,
1599
+ load: e,
1600
+ columns: n,
1601
+ children: o,
1602
+ persistent: r,
1603
+ persistentColumnVisibility: s,
1604
+ tableLayout: l = "fixed",
1605
+ stickyHeader: g = !1,
1606
+ loading: a = !1,
1607
+ implicitFilterKeys: f
1608
+ }) {
1609
+ const d = kn(e), [u] = Dt(
1610
+ () => vn({
1611
+ name: t,
1612
+ load: d,
1613
+ persistent: r,
1614
+ persistentColumnVisibility: s
1615
+ })
1616
+ );
1617
+ return A(() => {
1618
+ u.updateTableLayout(l);
1619
+ }, [u, l]), A(() => {
1620
+ u.updateColumns(n);
1621
+ }, [u, n]), A(() => {
1622
+ u.updateStickyHeader(g);
1623
+ }, [u, g]), A(() => {
1624
+ u[U].core.updateLoading(a);
1625
+ }, [u, a]), A(() => {
1626
+ u[U].storage.updateImplicitFilterKeys(
1627
+ f ?? xn
1628
+ );
1629
+ }, [u, f]), /* @__PURE__ */ D(Rt, { value: u, children: [
1630
+ o,
1631
+ /* @__PURE__ */ p(Gt, { fallback: /* @__PURE__ */ p(X, {}), children: /* @__PURE__ */ p(fe, {}) })
1632
+ ] });
1633
+ }
1634
+ const Pn = {
1635
+ table: q,
1636
+ cards: yt
1637
+ };
1638
+ function Tn() {
1639
+ return H().layout.useLayoutStore((e) => e.activeSlotIds.get("main"));
1640
+ }
1641
+ export {
1642
+ Pn as DATA_GRID_VIEW,
1643
+ zn as DataGrid,
1644
+ Bn as createDataGridPlugin,
1645
+ B as useDataGrid,
1646
+ Tn as useDataGridActiveView,
1647
+ jn as useDataGridPluginContext,
1648
+ Vn as useDataGridRecord
1649
+ };
1650
+ //# sourceMappingURL=data-grid.js.map