@proyecto-viviana/solidaria-components 0.3.2 → 0.4.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/dist/ActionBar.js +184 -0
- package/dist/ActionBar.js.map +1 -0
- package/dist/ActionBar.jsx +128 -0
- package/dist/ActionBar.jsx.map +1 -0
- package/dist/ActionGroup.js +179 -0
- package/dist/ActionGroup.js.map +1 -0
- package/dist/ActionGroup.jsx +129 -0
- package/dist/ActionGroup.jsx.map +1 -0
- package/dist/Alert.js +111 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Alert.jsx +82 -0
- package/dist/Alert.jsx.map +1 -0
- package/dist/Autocomplete.js +130 -0
- package/dist/Autocomplete.js.map +1 -0
- package/dist/Autocomplete.jsx +116 -0
- package/dist/Autocomplete.jsx.map +1 -0
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +334 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/Breadcrumbs.jsx +266 -0
- package/dist/Breadcrumbs.jsx.map +1 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +348 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.jsx +314 -0
- package/dist/Button.jsx.map +1 -0
- package/dist/Calendar.d.ts +4 -4
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +538 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/Calendar.jsx +333 -0
- package/dist/Calendar.jsx.map +1 -0
- package/dist/CalendarPicker.d.ts +33 -0
- package/dist/CalendarPicker.d.ts.map +1 -0
- package/dist/CalendarPicker.js +44 -0
- package/dist/CalendarPicker.js.map +1 -0
- package/dist/CalendarPicker.jsx +44 -0
- package/dist/CalendarPicker.jsx.map +1 -0
- package/dist/Checkbox.d.ts +83 -4
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +923 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.jsx +707 -0
- package/dist/Checkbox.jsx.map +1 -0
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +202 -0
- package/dist/Collection.js.map +1 -0
- package/dist/Collection.jsx +152 -0
- package/dist/Collection.jsx.map +1 -0
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +1720 -0
- package/dist/Color.js.map +1 -0
- package/dist/Color.jsx +1344 -0
- package/dist/Color.jsx.map +1 -0
- package/dist/ColorEditor.js +208 -0
- package/dist/ColorEditor.js.map +1 -0
- package/dist/ColorEditor.jsx +120 -0
- package/dist/ColorEditor.jsx.map +1 -0
- package/dist/ComboBox.d.ts +4 -4
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +992 -0
- package/dist/ComboBox.js.map +1 -0
- package/dist/ComboBox.jsx +714 -0
- package/dist/ComboBox.jsx.map +1 -0
- package/dist/ContextualHelpTrigger.js +146 -0
- package/dist/ContextualHelpTrigger.js.map +1 -0
- package/dist/ContextualHelpTrigger.jsx +109 -0
- package/dist/ContextualHelpTrigger.jsx.map +1 -0
- package/dist/DateField.d.ts +3 -3
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +4 -0
- package/dist/DateField.jsx +4 -0
- package/dist/DateField2.js +499 -0
- package/dist/DateField2.js.map +1 -0
- package/dist/DateField2.jsx +317 -0
- package/dist/DateField2.jsx.map +1 -0
- package/dist/DatePicker.d.ts +4 -4
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +991 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.jsx +682 -0
- package/dist/DatePicker.jsx.map +1 -0
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +337 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/Dialog.jsx +192 -0
- package/dist/Dialog.jsx.map +1 -0
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +328 -0
- package/dist/Disclosure.js.map +1 -0
- package/dist/Disclosure.jsx +230 -0
- package/dist/Disclosure.jsx.map +1 -0
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +176 -0
- package/dist/DragAndDrop.js.map +1 -0
- package/dist/DragAndDrop.jsx +160 -0
- package/dist/DragAndDrop.jsx.map +1 -0
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +189 -0
- package/dist/DropZone.js.map +1 -0
- package/dist/DropZone.jsx +144 -0
- package/dist/DropZone.jsx.map +1 -0
- package/dist/FieldError.js +66 -0
- package/dist/FieldError.js.map +1 -0
- package/dist/FieldError.jsx +47 -0
- package/dist/FieldError.jsx.map +1 -0
- package/dist/FileTrigger.js +79 -0
- package/dist/FileTrigger.js.map +1 -0
- package/dist/FileTrigger.jsx +49 -0
- package/dist/FileTrigger.jsx.map +1 -0
- package/dist/Focusable.js +70 -0
- package/dist/Focusable.js.map +1 -0
- package/dist/Focusable.jsx +69 -0
- package/dist/Focusable.jsx.map +1 -0
- package/dist/Form.js +99 -0
- package/dist/Form.js.map +1 -0
- package/dist/Form.jsx +73 -0
- package/dist/Form.jsx.map +1 -0
- package/dist/GridList.d.ts +34 -2
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +723 -0
- package/dist/GridList.js.map +1 -0
- package/dist/GridList.jsx +552 -0
- package/dist/GridList.jsx.map +1 -0
- package/dist/HiddenTimeInput.js +104 -0
- package/dist/HiddenTimeInput.js.map +1 -0
- package/dist/HiddenTimeInput.jsx +69 -0
- package/dist/HiddenTimeInput.jsx.map +1 -0
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +127 -0
- package/dist/Icon.js.map +1 -0
- package/dist/Icon.jsx +72 -0
- package/dist/Icon.jsx.map +1 -0
- package/dist/Keyboard.js +30 -0
- package/dist/Keyboard.js.map +1 -0
- package/dist/Keyboard.jsx +24 -0
- package/dist/Keyboard.jsx.map +1 -0
- package/dist/Landmark.js +134 -0
- package/dist/Landmark.js.map +1 -0
- package/dist/Landmark.jsx +118 -0
- package/dist/Landmark.jsx.map +1 -0
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +219 -0
- package/dist/Link.js.map +1 -0
- package/dist/Link.jsx +189 -0
- package/dist/Link.jsx.map +1 -0
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +670 -0
- package/dist/ListBox.js.map +1 -0
- package/dist/ListBox.jsx +508 -0
- package/dist/ListBox.jsx.map +1 -0
- package/dist/Menu.d.ts +27 -9
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +1254 -0
- package/dist/Menu.js.map +1 -0
- package/dist/Menu.jsx +1042 -0
- package/dist/Menu.jsx.map +1 -0
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +123 -0
- package/dist/Meter.js.map +1 -0
- package/dist/Meter.jsx +107 -0
- package/dist/Meter.jsx.map +1 -0
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +380 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.jsx +314 -0
- package/dist/Modal.jsx.map +1 -0
- package/dist/NumberField.d.ts +3 -3
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +573 -0
- package/dist/NumberField.js.map +1 -0
- package/dist/NumberField.jsx +443 -0
- package/dist/NumberField.jsx.map +1 -0
- package/dist/Popover.d.ts +10 -2
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +464 -0
- package/dist/Popover.js.map +1 -0
- package/dist/Popover.jsx +333 -0
- package/dist/Popover.jsx.map +1 -0
- package/dist/Pressable.js +69 -0
- package/dist/Pressable.js.map +1 -0
- package/dist/Pressable.jsx +68 -0
- package/dist/Pressable.jsx.map +1 -0
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +130 -0
- package/dist/ProgressBar.js.map +1 -0
- package/dist/ProgressBar.jsx +114 -0
- package/dist/ProgressBar.jsx.map +1 -0
- package/dist/RadioGroup.d.ts +82 -4
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +931 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/RadioGroup.jsx +681 -0
- package/dist/RadioGroup.jsx.map +1 -0
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +410 -0
- package/dist/RangeCalendar.js.map +1 -0
- package/dist/RangeCalendar.jsx +253 -0
- package/dist/RangeCalendar.jsx.map +1 -0
- package/dist/RouterProvider.js +118 -0
- package/dist/RouterProvider.js.map +1 -0
- package/dist/RouterProvider.jsx +112 -0
- package/dist/RouterProvider.jsx.map +1 -0
- package/dist/SearchField.d.ts +2 -2
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +643 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/SearchField.jsx +526 -0
- package/dist/SearchField.jsx.map +1 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +1031 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.jsx +744 -0
- package/dist/Select.jsx.map +1 -0
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +86 -0
- package/dist/SelectionIndicator.js.map +1 -0
- package/dist/SelectionIndicator.jsx +50 -0
- package/dist/SelectionIndicator.jsx.map +1 -0
- package/dist/Separator.js +97 -0
- package/dist/Separator.js.map +1 -0
- package/dist/Separator.jsx +85 -0
- package/dist/Separator.jsx.map +1 -0
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +165 -0
- package/dist/SharedElementTransition.js.map +1 -0
- package/dist/SharedElementTransition.jsx +138 -0
- package/dist/SharedElementTransition.jsx.map +1 -0
- package/dist/Slider.d.ts +33 -1
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +515 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Slider.jsx +403 -0
- package/dist/Slider.jsx.map +1 -0
- package/dist/StepList.js +198 -0
- package/dist/StepList.js.map +1 -0
- package/dist/StepList.jsx +141 -0
- package/dist/StepList.jsx.map +1 -0
- package/dist/Switch.d.ts +65 -2
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +534 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Switch.jsx +393 -0
- package/dist/Switch.jsx.map +1 -0
- package/dist/Table.d.ts +48 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +1759 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.jsx +1348 -0
- package/dist/Table.jsx.map +1 -0
- package/dist/Tabs.d.ts +0 -4
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +595 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.jsx +367 -0
- package/dist/Tabs.jsx.map +1 -0
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +378 -0
- package/dist/TagGroup.js.map +1 -0
- package/dist/TagGroup.jsx +270 -0
- package/dist/TagGroup.jsx.map +1 -0
- package/dist/Text.d.ts +18 -6
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +42 -0
- package/dist/Text.js.map +1 -0
- package/dist/Text.jsx +35 -0
- package/dist/Text.jsx.map +1 -0
- package/dist/TextField.d.ts +6 -6
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +436 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextField.jsx +403 -0
- package/dist/TextField.jsx.map +1 -0
- package/dist/TimeField.d.ts +3 -3
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +372 -0
- package/dist/TimeField.js.map +1 -0
- package/dist/TimeField.jsx +224 -0
- package/dist/TimeField.jsx.map +1 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +551 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.jsx +361 -0
- package/dist/Toast.jsx.map +1 -0
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +123 -0
- package/dist/ToggleButton.js.map +1 -0
- package/dist/ToggleButton.jsx +88 -0
- package/dist/ToggleButton.jsx.map +1 -0
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +114 -0
- package/dist/ToggleButtonGroup.js.map +1 -0
- package/dist/ToggleButtonGroup.jsx +85 -0
- package/dist/ToggleButtonGroup.jsx.map +1 -0
- package/dist/Toolbar.js +112 -0
- package/dist/Toolbar.js.map +1 -0
- package/dist/Toolbar.jsx +92 -0
- package/dist/Toolbar.jsx.map +1 -0
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +539 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.jsx +465 -0
- package/dist/Tooltip.jsx.map +1 -0
- package/dist/Tree.d.ts +14 -2
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +1424 -0
- package/dist/Tree.js.map +1 -0
- package/dist/Tree.jsx +1172 -0
- package/dist/Tree.jsx.map +1 -0
- package/dist/Virtualizer.d.ts +16 -2
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -0
- package/dist/Virtualizer.jsx +2 -0
- package/dist/Virtualizer2.js +751 -0
- package/dist/Virtualizer2.js.map +1 -0
- package/dist/Virtualizer2.jsx +730 -0
- package/dist/Virtualizer2.jsx.map +1 -0
- package/dist/VirtualizerLayouts.d.ts +18 -0
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +42 -0
- package/dist/VisuallyHidden.js.map +1 -0
- package/dist/VisuallyHidden.jsx +35 -0
- package/dist/VisuallyHidden.jsx.map +1 -0
- package/dist/contexts.js +33 -0
- package/dist/contexts.js.map +1 -0
- package/dist/contexts.jsx +33 -0
- package/dist/contexts.jsx.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -23932
- package/dist/index.jsx +70 -18337
- package/dist/useDragAndDrop.js +2 -0
- package/dist/useDragAndDrop.jsx +2 -0
- package/dist/useDragAndDrop2.js +395 -0
- package/dist/useDragAndDrop2.js.map +1 -0
- package/dist/useDragAndDrop2.jsx +395 -0
- package/dist/useDragAndDrop2.jsx.map +1 -0
- package/dist/utils.d.ts +83 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +285 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.jsx +277 -0
- package/dist/utils.jsx.map +1 -0
- package/dist/virtualizer/Layout.js +144 -0
- package/dist/virtualizer/Layout.js.map +1 -0
- package/dist/virtualizer/Layout.jsx +144 -0
- package/dist/virtualizer/Layout.jsx.map +1 -0
- package/package.json +401 -4
- package/src/Breadcrumbs.tsx +3 -1
- package/src/Button.tsx +22 -2
- package/src/Calendar.tsx +27 -10
- package/src/CalendarPicker.tsx +73 -0
- package/src/Checkbox.tsx +539 -3
- package/src/Collection.tsx +9 -3
- package/src/Color.tsx +42 -14
- package/src/ComboBox.tsx +50 -6
- package/src/DateField.tsx +20 -2
- package/src/DatePicker.tsx +57 -5
- package/src/Dialog.tsx +13 -5
- package/src/Disclosure.tsx +3 -1
- package/src/DragAndDrop.tsx +3 -1
- package/src/DropZone.tsx +3 -1
- package/src/GridList.tsx +125 -24
- package/src/Icon.tsx +3 -1
- package/src/Link.tsx +3 -1
- package/src/ListBox.tsx +31 -4
- package/src/Menu.tsx +252 -128
- package/src/Meter.tsx +3 -1
- package/src/Modal.tsx +100 -52
- package/src/NumberField.tsx +51 -8
- package/src/Popover.tsx +40 -10
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +468 -4
- package/src/RangeCalendar.tsx +3 -1
- package/src/SearchField.tsx +27 -3
- package/src/Select.tsx +22 -7
- package/src/SelectionIndicator.tsx +3 -1
- package/src/SharedElementTransition.tsx +3 -1
- package/src/Slider.tsx +159 -13
- package/src/Switch.tsx +395 -2
- package/src/Table.tsx +409 -95
- package/src/Tabs.tsx +16 -45
- package/src/TagGroup.tsx +3 -1
- package/src/Text.tsx +31 -10
- package/src/TextField.tsx +43 -5
- package/src/TimeField.tsx +20 -2
- package/src/Toast.tsx +79 -14
- package/src/ToggleButton.tsx +3 -1
- package/src/ToggleButtonGroup.tsx +3 -1
- package/src/Tooltip.tsx +3 -1
- package/src/Tree.tsx +77 -9
- package/src/Virtualizer.tsx +180 -31
- package/src/VirtualizerLayouts.ts +45 -10
- package/src/index.ts +50 -0
- package/src/utils.tsx +243 -27
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
package/dist/Table.js
ADDED
|
@@ -0,0 +1,1759 @@
|
|
|
1
|
+
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.js";
|
|
2
|
+
import { ButtonContext } from "./Button.js";
|
|
3
|
+
import { SharedElementTransition } from "./SharedElementTransition.js";
|
|
4
|
+
import { useLinkProps, useRouter } from "./RouterProvider.js";
|
|
5
|
+
import { CollectionRendererContext, useCollectionRenderer } from "./Collection.js";
|
|
6
|
+
import { r as useVirtualizerContext } from "./Virtualizer2.js";
|
|
7
|
+
import { getNormalizedDropTargetKey, mergePersistedKeysIntoVirtualRange, useDndPersistedKeys, useRenderDropIndicator } from "./DragAndDrop.js";
|
|
8
|
+
import { className, createComponent, effect, getNextElement, getNextMarker, insert, memo, mergeProps, runHydrationEvents, setAttribute, setStyleProperty, spread, style, template, use } from "solid-js/web";
|
|
9
|
+
import { For, Show, createContext, createEffect, createMemo, createSignal, createUniqueId, onCleanup, splitProps, untrack, useContext } from "solid-js";
|
|
10
|
+
import { createFocusRing, createHover, createTable, createTableCell, createTableColumnHeader, createTableColumnResize, createTableRow, createTableRowGroup, createTableSelectAllCheckbox, createTableSelectionCheckbox, getTableData, isFocusVisible, mergeProps as mergeProps$2 } from "@proyecto-viviana/solidaria";
|
|
11
|
+
import { createTableCollection, createTableColumnResizeState, createTableState, createTreeGridState } from "@proyecto-viviana/solid-stately";
|
|
12
|
+
//#region src/Table.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Table component for solidaria-components
|
|
15
|
+
*
|
|
16
|
+
* A pre-wired headless table that combines state + aria hooks.
|
|
17
|
+
* Based on react-aria-components/src/Table.tsx
|
|
18
|
+
*/
|
|
19
|
+
var _tmpl$ = /*#__PURE__*/ template(`<table>`), _tmpl$2 = /*#__PURE__*/ template(`<tr role=row>`), _tmpl$3 = /*#__PURE__*/ template(`<thead><tr role=row>`), _tmpl$4 = /*#__PURE__*/ template(`<th>`), _tmpl$5 = /*#__PURE__*/ template(`<tr role=row data-empty-state><th role=rowheader>`), _tmpl$6 = /*#__PURE__*/ template(`<tr role=presentation aria-hidden=true data-virtualizer-spacer=top><td style=padding:0;border:0>`), _tmpl$7 = /*#__PURE__*/ template(`<tr role=presentation aria-hidden=true data-virtualizer-spacer=bottom><td style=padding:0;border:0>`), _tmpl$8 = /*#__PURE__*/ template(`<tbody><!$><!/><!$><!/>`), _tmpl$9 = /*#__PURE__*/ template(`<tfoot>`), _tmpl$0 = /*#__PURE__*/ template(`<div role=progressbar aria-label=loading>`), _tmpl$1 = /*#__PURE__*/ template(`<tr inert style=position:relative;width:0;height:0;overflow:hidden><td><div data-testid=loadMoreSentinel style=position:absolute;height:1px;width:1px>`), _tmpl$10 = /*#__PURE__*/ template(`<tr role=row tabindex=0 data-loading><td role=rowheader>`), _tmpl$11 = /*#__PURE__*/ template(`<tr>`), _tmpl$12 = /*#__PURE__*/ template(`<td>`), _tmpl$13 = /*#__PURE__*/ template(`<input>`), _tmpl$14 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/>`), _tmpl$15 = /*#__PURE__*/ template(`<div>`);
|
|
20
|
+
function assignRef(ref, el) {
|
|
21
|
+
if (!ref) return;
|
|
22
|
+
if (typeof ref === "function") ref(el);
|
|
23
|
+
else ref.current = el;
|
|
24
|
+
}
|
|
25
|
+
function normalizeColumnDefinitions(columns, parentKey) {
|
|
26
|
+
return columns.map((column, index) => {
|
|
27
|
+
const key = column.key ?? column.id ?? (parentKey == null ? index : `${parentKey}-${index}`);
|
|
28
|
+
const id = column.id ?? column.key;
|
|
29
|
+
return {
|
|
30
|
+
...column,
|
|
31
|
+
key,
|
|
32
|
+
id,
|
|
33
|
+
children: column.children ? normalizeColumnDefinitions(column.children, key) : void 0
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** Resolves a stable, unique key for a tree-grid item (keys must be unique across levels). */
|
|
38
|
+
function resolveItemKey(item, getKey, index) {
|
|
39
|
+
if (getKey) return getKey(item);
|
|
40
|
+
const record = item;
|
|
41
|
+
return record.id ?? record.key ?? index;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Turns the flat `items` into nested {@link RowDefinition}s by recursively expanding each
|
|
45
|
+
* item's children via `getChildItems`. The result feeds the tree-grid collection.
|
|
46
|
+
*/
|
|
47
|
+
function toTreeRowDefinitions(items, getKey, getChildItems) {
|
|
48
|
+
return Array.from(items).map((item, index) => {
|
|
49
|
+
const childItems = getChildItems?.(item);
|
|
50
|
+
const childRows = childItems ? toTreeRowDefinitions(childItems, getKey, getChildItems) : void 0;
|
|
51
|
+
return {
|
|
52
|
+
key: resolveItemKey(item, getKey, index),
|
|
53
|
+
value: item,
|
|
54
|
+
childRows: childRows && childRows.length > 0 ? childRows : void 0
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function getRowHeaderColumnKeys(columns) {
|
|
59
|
+
const keys = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const column of columns) {
|
|
61
|
+
if (column.isRowHeader) keys.add(column.key);
|
|
62
|
+
if (column.children) for (const key of getRowHeaderColumnKeys(column.children)) keys.add(key);
|
|
63
|
+
}
|
|
64
|
+
return keys;
|
|
65
|
+
}
|
|
66
|
+
const TableContext = createContext(null);
|
|
67
|
+
const TableStateContext = createContext(null);
|
|
68
|
+
/** The resize context carries a getter for the resize state. The getter may return null before columns register. */
|
|
69
|
+
const TableColumnResizeStateContext = createContext(null);
|
|
70
|
+
const TableRowContext = createContext(null);
|
|
71
|
+
/**
|
|
72
|
+
* A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys,
|
|
73
|
+
* and optionally supports row selection and sorting.
|
|
74
|
+
*/
|
|
75
|
+
function Table(props) {
|
|
76
|
+
const [local, stateProps, ariaProps] = splitProps(props, [
|
|
77
|
+
"class",
|
|
78
|
+
"style",
|
|
79
|
+
"render",
|
|
80
|
+
"slot",
|
|
81
|
+
"renderEmptyState",
|
|
82
|
+
"dragAndDropHooks",
|
|
83
|
+
"ref"
|
|
84
|
+
], [
|
|
85
|
+
"items",
|
|
86
|
+
"columns",
|
|
87
|
+
"getKey",
|
|
88
|
+
"getTextValue",
|
|
89
|
+
"disabledKeys",
|
|
90
|
+
"disabledBehavior",
|
|
91
|
+
"escapeKeyBehavior",
|
|
92
|
+
"selectionMode",
|
|
93
|
+
"selectionBehavior",
|
|
94
|
+
"selectedKeys",
|
|
95
|
+
"defaultSelectedKeys",
|
|
96
|
+
"onSelectionChange",
|
|
97
|
+
"sortDescriptor",
|
|
98
|
+
"onSortChange",
|
|
99
|
+
"showSelectionCheckboxes",
|
|
100
|
+
"UNSTABLE_childItems",
|
|
101
|
+
"UNSTABLE_expandedKeys",
|
|
102
|
+
"UNSTABLE_defaultExpandedKeys",
|
|
103
|
+
"UNSTABLE_onExpandedChange"
|
|
104
|
+
]);
|
|
105
|
+
const [ref, setRef] = createSignal(null);
|
|
106
|
+
const normalizedColumns = createMemo(() => normalizeColumnDefinitions(stateProps.columns));
|
|
107
|
+
const rowHeaderColumnKeys = createMemo(() => getRowHeaderColumnKeys(normalizedColumns()));
|
|
108
|
+
const isTreeGrid = stateProps.UNSTABLE_childItems !== void 0 || stateProps.UNSTABLE_expandedKeys !== void 0 || stateProps.UNSTABLE_defaultExpandedKeys !== void 0 || stateProps.UNSTABLE_onExpandedChange !== void 0;
|
|
109
|
+
const getTextValue = () => stateProps.getTextValue;
|
|
110
|
+
const state = isTreeGrid ? createTreeGridState(() => ({
|
|
111
|
+
columns: normalizedColumns(),
|
|
112
|
+
rows: toTreeRowDefinitions(stateProps.items, stateProps.getKey, stateProps.UNSTABLE_childItems),
|
|
113
|
+
getKey: stateProps.getKey,
|
|
114
|
+
getTextValue: getTextValue(),
|
|
115
|
+
showSelectionCheckboxes: stateProps.showSelectionCheckboxes ?? false,
|
|
116
|
+
rowHeaderColumnKeys: rowHeaderColumnKeys().size > 0 ? rowHeaderColumnKeys() : void 0,
|
|
117
|
+
disabledKeys: stateProps.disabledKeys,
|
|
118
|
+
disabledBehavior: stateProps.disabledBehavior,
|
|
119
|
+
selectionMode: stateProps.selectionMode,
|
|
120
|
+
selectionBehavior: stateProps.selectionBehavior,
|
|
121
|
+
selectedKeys: stateProps.selectedKeys,
|
|
122
|
+
defaultSelectedKeys: stateProps.defaultSelectedKeys,
|
|
123
|
+
onSelectionChange: stateProps.onSelectionChange,
|
|
124
|
+
sortDescriptor: stateProps.sortDescriptor,
|
|
125
|
+
onSortChange: stateProps.onSortChange,
|
|
126
|
+
UNSTABLE_expandedKeys: stateProps.UNSTABLE_expandedKeys,
|
|
127
|
+
UNSTABLE_defaultExpandedKeys: stateProps.UNSTABLE_defaultExpandedKeys,
|
|
128
|
+
UNSTABLE_onExpandedChange: stateProps.UNSTABLE_onExpandedChange
|
|
129
|
+
})) : createTableState(() => ({
|
|
130
|
+
collection: createTableCollection({
|
|
131
|
+
columns: normalizedColumns(),
|
|
132
|
+
rows: stateProps.items,
|
|
133
|
+
getKey: stateProps.getKey,
|
|
134
|
+
getTextValue: getTextValue(),
|
|
135
|
+
showSelectionCheckboxes: stateProps.showSelectionCheckboxes ?? false,
|
|
136
|
+
rowHeaderColumnKeys: rowHeaderColumnKeys().size > 0 ? rowHeaderColumnKeys() : void 0
|
|
137
|
+
}),
|
|
138
|
+
disabledKeys: stateProps.disabledKeys,
|
|
139
|
+
disabledBehavior: stateProps.disabledBehavior,
|
|
140
|
+
selectionMode: stateProps.selectionMode,
|
|
141
|
+
selectionBehavior: stateProps.selectionBehavior,
|
|
142
|
+
selectedKeys: stateProps.selectedKeys,
|
|
143
|
+
defaultSelectedKeys: stateProps.defaultSelectedKeys,
|
|
144
|
+
onSelectionChange: stateProps.onSelectionChange,
|
|
145
|
+
sortDescriptor: stateProps.sortDescriptor,
|
|
146
|
+
onSortChange: stateProps.onSortChange,
|
|
147
|
+
showSelectionCheckboxes: stateProps.showSelectionCheckboxes
|
|
148
|
+
}));
|
|
149
|
+
const collection = () => state.collection;
|
|
150
|
+
const parentCollectionRenderer = useCollectionRenderer();
|
|
151
|
+
const { gridProps } = createTable(() => ({
|
|
152
|
+
id: ariaProps.id,
|
|
153
|
+
"aria-label": ariaProps["aria-label"],
|
|
154
|
+
"aria-labelledby": ariaProps["aria-labelledby"],
|
|
155
|
+
"aria-describedby": ariaProps["aria-describedby"],
|
|
156
|
+
isVirtualized: ariaProps.isVirtualized ?? parentCollectionRenderer?.isVirtualized,
|
|
157
|
+
onRowAction: ariaProps.onRowAction,
|
|
158
|
+
onCellAction: ariaProps.onCellAction,
|
|
159
|
+
shouldSelectOnPressUp: ariaProps.shouldSelectOnPressUp,
|
|
160
|
+
focusMode: ariaProps.focusMode,
|
|
161
|
+
escapeKeyBehavior: stateProps.escapeKeyBehavior
|
|
162
|
+
}), () => state, ref);
|
|
163
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
164
|
+
const renderValues = createMemo(() => ({
|
|
165
|
+
isFocused: state.isFocused || isFocused(),
|
|
166
|
+
isFocusVisible: isFocusVisible(),
|
|
167
|
+
isDisabled: false,
|
|
168
|
+
isEmpty: stateProps.items.length === 0
|
|
169
|
+
}));
|
|
170
|
+
const renderProps = useRenderProps({
|
|
171
|
+
class: local.class,
|
|
172
|
+
style: local.style,
|
|
173
|
+
defaultClassName: "solidaria-Table"
|
|
174
|
+
}, renderValues);
|
|
175
|
+
const domProps = createMemo(() => {
|
|
176
|
+
return filterDOMProps(ariaProps, { global: true });
|
|
177
|
+
});
|
|
178
|
+
const cleanGridProps = () => {
|
|
179
|
+
const { ref: _ref1, ...rest } = gridProps;
|
|
180
|
+
return rest;
|
|
181
|
+
};
|
|
182
|
+
const cleanFocusProps = () => {
|
|
183
|
+
const { ref: _ref2, ...rest } = focusProps;
|
|
184
|
+
return rest;
|
|
185
|
+
};
|
|
186
|
+
const getItemNodes = createMemo(() => Array.from(state.collection).filter((node) => node.type === "item"));
|
|
187
|
+
const getDropTargetByIndex = (index, position) => {
|
|
188
|
+
const node = getItemNodes()[index];
|
|
189
|
+
if (!node) return null;
|
|
190
|
+
return {
|
|
191
|
+
type: "item",
|
|
192
|
+
key: node.key,
|
|
193
|
+
dropPosition: position
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
const hasDroppableDnd = createMemo(() => {
|
|
197
|
+
const hooks = local.dragAndDropHooks;
|
|
198
|
+
return Boolean(hooks?.useDroppableCollectionState && hooks.useDroppableCollection && (hooks.dropTargetDelegate || parentCollectionRenderer?.dropTargetDelegate || hooks.ListDropTargetDelegate));
|
|
199
|
+
});
|
|
200
|
+
const hasDraggableDnd = createMemo(() => {
|
|
201
|
+
const hooks = local.dragAndDropHooks;
|
|
202
|
+
return Boolean(hooks?.useDraggableCollectionState && hooks.useDraggableCollection);
|
|
203
|
+
});
|
|
204
|
+
const dragState = createMemo(() => {
|
|
205
|
+
if (!hasDraggableDnd()) return void 0;
|
|
206
|
+
return local.dragAndDropHooks?.useDraggableCollectionState?.({ items: stateProps.items });
|
|
207
|
+
});
|
|
208
|
+
const dropState = createMemo(() => {
|
|
209
|
+
if (!hasDroppableDnd()) return void 0;
|
|
210
|
+
return local.dragAndDropHooks?.useDroppableCollectionState?.({});
|
|
211
|
+
});
|
|
212
|
+
createEffect(() => {
|
|
213
|
+
if (!hasDraggableDnd()) return;
|
|
214
|
+
const hooks = local.dragAndDropHooks;
|
|
215
|
+
const activeDragState = dragState();
|
|
216
|
+
if (!hooks?.useDraggableCollection || !activeDragState) return;
|
|
217
|
+
hooks.useDraggableCollection({}, activeDragState, () => ref());
|
|
218
|
+
});
|
|
219
|
+
const droppableCollection = createMemo(() => {
|
|
220
|
+
if (!hasDroppableDnd()) return void 0;
|
|
221
|
+
const hooks = local.dragAndDropHooks;
|
|
222
|
+
const activeDropState = dropState();
|
|
223
|
+
if (!hooks?.useDroppableCollection || !activeDropState) return void 0;
|
|
224
|
+
const resolveDirection = () => {
|
|
225
|
+
const el = ref();
|
|
226
|
+
if (el && typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
|
|
227
|
+
if (window.getComputedStyle(el).direction === "rtl") return "rtl";
|
|
228
|
+
}
|
|
229
|
+
return typeof document !== "undefined" && document.dir === "rtl" ? "rtl" : "ltr";
|
|
230
|
+
};
|
|
231
|
+
const dropTargetDelegate = hooks.dropTargetDelegate ?? parentCollectionRenderer?.dropTargetDelegate ?? (hooks.ListDropTargetDelegate ? new hooks.ListDropTargetDelegate(() => state.collection, () => ref(), {
|
|
232
|
+
layout: "grid",
|
|
233
|
+
orientation: "vertical",
|
|
234
|
+
direction: resolveDirection()
|
|
235
|
+
}) : void 0);
|
|
236
|
+
if (!dropTargetDelegate) return void 0;
|
|
237
|
+
return hooks.useDroppableCollection({
|
|
238
|
+
dropTargetDelegate,
|
|
239
|
+
keyboardDelegate: {
|
|
240
|
+
getFirstKey: () => state.collection.getFirstKey?.() ?? null,
|
|
241
|
+
getLastKey: () => state.collection.getLastKey?.() ?? null,
|
|
242
|
+
getKeyBelow: (key) => state.collection.getKeyAfter?.(key) ?? null,
|
|
243
|
+
getKeyAbove: (key) => state.collection.getKeyBefore?.(key) ?? null,
|
|
244
|
+
getKeyLeftOf: (key) => resolveDirection() === "rtl" ? state.collection.getKeyAfter?.(key) ?? null : state.collection.getKeyBefore?.(key) ?? null,
|
|
245
|
+
getKeyRightOf: (key) => resolveDirection() === "rtl" ? state.collection.getKeyBefore?.(key) ?? null : state.collection.getKeyAfter?.(key) ?? null,
|
|
246
|
+
getKeyPageBelow: (key) => state.collection.getKeyAfter?.(key) ?? null,
|
|
247
|
+
getKeyPageAbove: (key) => state.collection.getKeyBefore?.(key) ?? null
|
|
248
|
+
},
|
|
249
|
+
get collection() {
|
|
250
|
+
return state.collection;
|
|
251
|
+
},
|
|
252
|
+
get selectedKeys() {
|
|
253
|
+
return state.selectedKeys;
|
|
254
|
+
},
|
|
255
|
+
setSelectedKeys: (keys) => {
|
|
256
|
+
if (state.selectionMode === "none") return;
|
|
257
|
+
state.clearSelection();
|
|
258
|
+
for (const key of keys) state.toggleSelection(key);
|
|
259
|
+
},
|
|
260
|
+
setFocusedKey: (key) => state.setFocusedKey(key)
|
|
261
|
+
}, activeDropState, () => ref());
|
|
262
|
+
});
|
|
263
|
+
const isRootDropTarget = createMemo(() => {
|
|
264
|
+
return Boolean(dropState()?.target?.type === "root");
|
|
265
|
+
});
|
|
266
|
+
const dndRenderDropIndicator = createMemo(() => useRenderDropIndicator(local.dragAndDropHooks, dropState()));
|
|
267
|
+
const dndDropIndicator = (index, position) => {
|
|
268
|
+
const target = getDropTargetByIndex(index, position);
|
|
269
|
+
if (!target || target.type !== "item") return void 0;
|
|
270
|
+
return dndRenderDropIndicator()?.(target);
|
|
271
|
+
};
|
|
272
|
+
const contextValue = {
|
|
273
|
+
state,
|
|
274
|
+
get collection() {
|
|
275
|
+
return collection();
|
|
276
|
+
},
|
|
277
|
+
get items() {
|
|
278
|
+
return stateProps.items;
|
|
279
|
+
},
|
|
280
|
+
get columns() {
|
|
281
|
+
return normalizedColumns();
|
|
282
|
+
},
|
|
283
|
+
isDisabled: false,
|
|
284
|
+
get showSelectionCheckboxes() {
|
|
285
|
+
return stateProps.showSelectionCheckboxes ?? false;
|
|
286
|
+
},
|
|
287
|
+
get dragAndDropHooks() {
|
|
288
|
+
return local.dragAndDropHooks;
|
|
289
|
+
},
|
|
290
|
+
get dragState() {
|
|
291
|
+
return dragState();
|
|
292
|
+
},
|
|
293
|
+
get dropState() {
|
|
294
|
+
return dropState();
|
|
295
|
+
},
|
|
296
|
+
get isVirtualized() {
|
|
297
|
+
return ariaProps.isVirtualized ?? parentCollectionRenderer?.isVirtualized ?? false;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const collectionRenderer = createMemo(() => ({
|
|
301
|
+
...parentCollectionRenderer,
|
|
302
|
+
renderItem: (item) => item,
|
|
303
|
+
renderDropIndicator: (index, position) => dndDropIndicator(index, position) ?? parentCollectionRenderer?.renderDropIndicator?.(index, position)
|
|
304
|
+
}));
|
|
305
|
+
const tableChildren = () => typeof props.children === "function" ? props.children(untrack(renderValues)) : props.children;
|
|
306
|
+
const tableProps = () => ({
|
|
307
|
+
ref: (el) => {
|
|
308
|
+
setRef(el);
|
|
309
|
+
assignRef(local.ref, el);
|
|
310
|
+
},
|
|
311
|
+
...mergeProps$2(domProps(), cleanGridProps(), cleanFocusProps(), droppableCollection()?.collectionProps ?? {}),
|
|
312
|
+
class: renderProps.class(),
|
|
313
|
+
style: renderProps.style(),
|
|
314
|
+
"data-focused": state.isFocused || void 0,
|
|
315
|
+
"data-focus-visible": isFocusVisible() || void 0,
|
|
316
|
+
"data-empty": stateProps.items.length === 0 || void 0,
|
|
317
|
+
"data-drop-target": isRootDropTarget() || void 0,
|
|
318
|
+
slot: local.slot
|
|
319
|
+
});
|
|
320
|
+
return createComponent(TableContext.Provider, {
|
|
321
|
+
value: contextValue,
|
|
322
|
+
get children() {
|
|
323
|
+
return createComponent(TableStateContext.Provider, {
|
|
324
|
+
value: state,
|
|
325
|
+
get children() {
|
|
326
|
+
return createComponent(CollectionRendererContext.Provider, {
|
|
327
|
+
get value() {
|
|
328
|
+
return collectionRenderer();
|
|
329
|
+
},
|
|
330
|
+
get children() {
|
|
331
|
+
return memo(() => !!local.render)() ? local.render({
|
|
332
|
+
...tableProps(),
|
|
333
|
+
children: tableChildren()
|
|
334
|
+
}, renderValues()) : (() => {
|
|
335
|
+
var _el$ = getNextElement(_tmpl$);
|
|
336
|
+
spread(_el$, mergeProps(tableProps), false, true);
|
|
337
|
+
insert(_el$, tableChildren);
|
|
338
|
+
runHydrationEvents();
|
|
339
|
+
return _el$;
|
|
340
|
+
})();
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* A header row in a table containing column headers.
|
|
350
|
+
*/
|
|
351
|
+
function TableHeader(props) {
|
|
352
|
+
const [local, domProps] = splitProps(props, [
|
|
353
|
+
"class",
|
|
354
|
+
"style",
|
|
355
|
+
"render",
|
|
356
|
+
"slot",
|
|
357
|
+
"children",
|
|
358
|
+
"ref"
|
|
359
|
+
]);
|
|
360
|
+
if (!useContext(TableContext)) throw new Error("TableHeader must be used within a Table");
|
|
361
|
+
const { rowGroupProps } = createTableRowGroup(() => ({ type: "thead" }));
|
|
362
|
+
const { isHovered, hoverProps } = createHover({
|
|
363
|
+
isDisabled: false,
|
|
364
|
+
onHoverStart(e) {
|
|
365
|
+
domProps.onHoverStart?.(e);
|
|
366
|
+
},
|
|
367
|
+
onHoverEnd(e) {
|
|
368
|
+
domProps.onHoverEnd?.(e);
|
|
369
|
+
},
|
|
370
|
+
onHoverChange(isHovering) {
|
|
371
|
+
domProps.onHoverChange?.(isHovering);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
const renderValues = createMemo(() => ({
|
|
375
|
+
isFocused: false,
|
|
376
|
+
isHovered: isHovered()
|
|
377
|
+
}));
|
|
378
|
+
const renderProps = useRenderProps({
|
|
379
|
+
class: local.class,
|
|
380
|
+
style: local.style,
|
|
381
|
+
defaultClassName: "solidaria-Table-header"
|
|
382
|
+
}, renderValues);
|
|
383
|
+
const cleanRowGroupProps = () => {
|
|
384
|
+
const { ref: _ref, ...rest } = rowGroupProps;
|
|
385
|
+
return rest;
|
|
386
|
+
};
|
|
387
|
+
const cleanHoverProps = () => {
|
|
388
|
+
const { ref: _ref, ...rest } = hoverProps;
|
|
389
|
+
return rest;
|
|
390
|
+
};
|
|
391
|
+
const headerProps = () => ({
|
|
392
|
+
ref: (el) => assignRef(local.ref, el),
|
|
393
|
+
...domProps,
|
|
394
|
+
...cleanRowGroupProps(),
|
|
395
|
+
...cleanHoverProps(),
|
|
396
|
+
class: renderProps.class(),
|
|
397
|
+
style: renderProps.style(),
|
|
398
|
+
"data-hovered": isHovered() || void 0,
|
|
399
|
+
children: (() => {
|
|
400
|
+
var _el$2 = getNextElement(_tmpl$2);
|
|
401
|
+
insert(_el$2, () => local.children);
|
|
402
|
+
return _el$2;
|
|
403
|
+
})()
|
|
404
|
+
});
|
|
405
|
+
return local.render ? local.render(headerProps(), renderValues()) : (() => {
|
|
406
|
+
var _el$3 = getNextElement(_tmpl$3), _el$4 = _el$3.firstChild;
|
|
407
|
+
use((el) => assignRef(local.ref, el), _el$3);
|
|
408
|
+
spread(_el$3, mergeProps(domProps, cleanRowGroupProps, cleanHoverProps, {
|
|
409
|
+
get ["class"]() {
|
|
410
|
+
return renderProps.class();
|
|
411
|
+
},
|
|
412
|
+
get style() {
|
|
413
|
+
return renderProps.style();
|
|
414
|
+
},
|
|
415
|
+
get ["data-hovered"]() {
|
|
416
|
+
return isHovered() || void 0;
|
|
417
|
+
}
|
|
418
|
+
}), false, true);
|
|
419
|
+
insert(_el$4, () => local.children);
|
|
420
|
+
runHydrationEvents();
|
|
421
|
+
return _el$3;
|
|
422
|
+
})();
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* A column header in a table.
|
|
426
|
+
*/
|
|
427
|
+
function TableColumn(props) {
|
|
428
|
+
const [local, domProps] = splitProps(props, [
|
|
429
|
+
"class",
|
|
430
|
+
"style",
|
|
431
|
+
"render",
|
|
432
|
+
"slot",
|
|
433
|
+
"id",
|
|
434
|
+
"allowsSorting",
|
|
435
|
+
"allowsResizing",
|
|
436
|
+
"width",
|
|
437
|
+
"defaultWidth",
|
|
438
|
+
"minWidth",
|
|
439
|
+
"maxWidth",
|
|
440
|
+
"children",
|
|
441
|
+
"ref"
|
|
442
|
+
]);
|
|
443
|
+
const context = useContext(TableContext);
|
|
444
|
+
if (!context) throw new Error("TableColumn must be used within a Table");
|
|
445
|
+
const { state, collection } = context;
|
|
446
|
+
const [ref, setRef] = createSignal(null);
|
|
447
|
+
const columnNode = createMemo(() => {
|
|
448
|
+
const node = collection.getItem(local.id);
|
|
449
|
+
if (!node) return {
|
|
450
|
+
type: "column",
|
|
451
|
+
key: local.id,
|
|
452
|
+
value: null,
|
|
453
|
+
textValue: String(local.id),
|
|
454
|
+
level: 0,
|
|
455
|
+
index: 0,
|
|
456
|
+
hasChildNodes: false,
|
|
457
|
+
childNodes: []
|
|
458
|
+
};
|
|
459
|
+
return node;
|
|
460
|
+
});
|
|
461
|
+
const columnHeaderAria = createTableColumnHeader(() => ({
|
|
462
|
+
node: columnNode(),
|
|
463
|
+
allowsSorting: local.allowsSorting
|
|
464
|
+
}), () => state, ref);
|
|
465
|
+
const { isHovered, hoverProps } = createHover({
|
|
466
|
+
get isDisabled() {
|
|
467
|
+
return !local.allowsSorting;
|
|
468
|
+
},
|
|
469
|
+
onHoverStart(e) {
|
|
470
|
+
domProps.onHoverStart?.(e);
|
|
471
|
+
},
|
|
472
|
+
onHoverEnd(e) {
|
|
473
|
+
domProps.onHoverEnd?.(e);
|
|
474
|
+
},
|
|
475
|
+
onHoverChange(isHovering) {
|
|
476
|
+
domProps.onHoverChange?.(isHovering);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
const { isFocusVisible, focusProps } = createFocusRing();
|
|
480
|
+
const sortDirection = createMemo(() => {
|
|
481
|
+
const sortDescriptor = state.sortDescriptor;
|
|
482
|
+
if (sortDescriptor?.column === local.id) return sortDescriptor.direction;
|
|
483
|
+
});
|
|
484
|
+
const resizeCtx = useContext(TableColumnResizeStateContext);
|
|
485
|
+
const isResizing = createMemo(() => {
|
|
486
|
+
const rs = resizeCtx?.getState();
|
|
487
|
+
if (!rs) return false;
|
|
488
|
+
return rs.resizingColumn() === local.id;
|
|
489
|
+
});
|
|
490
|
+
const resizeWidth = createMemo(() => {
|
|
491
|
+
const rs = resizeCtx?.getState();
|
|
492
|
+
if (!rs) return void 0;
|
|
493
|
+
const w = rs.getColumnWidth(local.id);
|
|
494
|
+
return w > 0 ? w : void 0;
|
|
495
|
+
});
|
|
496
|
+
const renderValues = createMemo(() => ({
|
|
497
|
+
isFocused: state.focusedKey === local.id,
|
|
498
|
+
isFocusVisible: isFocusVisible() && state.focusedKey === local.id,
|
|
499
|
+
isSortable: local.allowsSorting ?? false,
|
|
500
|
+
sortDirection: sortDirection(),
|
|
501
|
+
isHovered: isHovered(),
|
|
502
|
+
allowsResizing: local.allowsResizing ?? false,
|
|
503
|
+
isResizing: isResizing()
|
|
504
|
+
}));
|
|
505
|
+
const renderProps = useRenderProps({
|
|
506
|
+
class: local.class,
|
|
507
|
+
style: local.style,
|
|
508
|
+
defaultClassName: "solidaria-Table-column"
|
|
509
|
+
}, renderValues);
|
|
510
|
+
const cleanColumnHeaderProps = () => {
|
|
511
|
+
const { ref: _ref1, ...rest } = columnHeaderAria.columnHeaderProps;
|
|
512
|
+
return rest;
|
|
513
|
+
};
|
|
514
|
+
const cleanHoverProps = () => {
|
|
515
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
516
|
+
return rest;
|
|
517
|
+
};
|
|
518
|
+
const cleanFocusProps = () => {
|
|
519
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
520
|
+
return rest;
|
|
521
|
+
};
|
|
522
|
+
const columnStyle = createMemo(() => {
|
|
523
|
+
const base = renderProps.style();
|
|
524
|
+
const rw = resizeWidth();
|
|
525
|
+
if (rw == null) return base;
|
|
526
|
+
const widthStyle = {
|
|
527
|
+
width: `${rw}px`,
|
|
528
|
+
"min-width": `${rw}px`,
|
|
529
|
+
"max-width": `${rw}px`
|
|
530
|
+
};
|
|
531
|
+
if (!base) return widthStyle;
|
|
532
|
+
if (typeof base === "string") return widthStyle;
|
|
533
|
+
return {
|
|
534
|
+
...base,
|
|
535
|
+
...widthStyle
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
const columnChildren = () => typeof local.children === "function" ? local.children(renderValues()) : local.children;
|
|
539
|
+
const columnProps = () => ({
|
|
540
|
+
ref: (el) => {
|
|
541
|
+
setRef(el);
|
|
542
|
+
assignRef(local.ref, el);
|
|
543
|
+
},
|
|
544
|
+
...domProps,
|
|
545
|
+
...mergeProps$2(cleanColumnHeaderProps(), cleanHoverProps(), cleanFocusProps()),
|
|
546
|
+
class: renderProps.class(),
|
|
547
|
+
style: columnStyle(),
|
|
548
|
+
"data-sortable": local.allowsSorting || void 0,
|
|
549
|
+
"data-sort-direction": sortDirection() || void 0,
|
|
550
|
+
"data-resizable": local.allowsResizing || void 0,
|
|
551
|
+
"data-resizing": isResizing() || void 0,
|
|
552
|
+
"data-hovered": isHovered() || void 0,
|
|
553
|
+
"data-focused": state.focusedKey === local.id || void 0,
|
|
554
|
+
"data-focus-visible": isFocusVisible() && state.focusedKey === local.id || void 0,
|
|
555
|
+
children: columnChildren()
|
|
556
|
+
});
|
|
557
|
+
return local.render ? local.render(columnProps(), renderValues()) : (() => {
|
|
558
|
+
var _el$5 = getNextElement(_tmpl$4);
|
|
559
|
+
use((el) => {
|
|
560
|
+
setRef(el);
|
|
561
|
+
assignRef(local.ref, el);
|
|
562
|
+
}, _el$5);
|
|
563
|
+
spread(_el$5, mergeProps(domProps, () => mergeProps$2(cleanColumnHeaderProps(), cleanHoverProps(), cleanFocusProps()), {
|
|
564
|
+
get ["class"]() {
|
|
565
|
+
return renderProps.class();
|
|
566
|
+
},
|
|
567
|
+
get style() {
|
|
568
|
+
return columnStyle();
|
|
569
|
+
},
|
|
570
|
+
get ["data-sortable"]() {
|
|
571
|
+
return local.allowsSorting || void 0;
|
|
572
|
+
},
|
|
573
|
+
get ["data-sort-direction"]() {
|
|
574
|
+
return sortDirection() || void 0;
|
|
575
|
+
},
|
|
576
|
+
get ["data-resizable"]() {
|
|
577
|
+
return local.allowsResizing || void 0;
|
|
578
|
+
},
|
|
579
|
+
get ["data-resizing"]() {
|
|
580
|
+
return isResizing() || void 0;
|
|
581
|
+
},
|
|
582
|
+
get ["data-hovered"]() {
|
|
583
|
+
return isHovered() || void 0;
|
|
584
|
+
},
|
|
585
|
+
get ["data-focused"]() {
|
|
586
|
+
return state.focusedKey === local.id || void 0;
|
|
587
|
+
},
|
|
588
|
+
get ["data-focus-visible"]() {
|
|
589
|
+
return memo(() => !!isFocusVisible())() && state.focusedKey === local.id || void 0;
|
|
590
|
+
}
|
|
591
|
+
}), false, true);
|
|
592
|
+
insert(_el$5, columnChildren);
|
|
593
|
+
runHydrationEvents();
|
|
594
|
+
return _el$5;
|
|
595
|
+
})();
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* The body of a table containing data rows.
|
|
599
|
+
*/
|
|
600
|
+
function TableBody(props) {
|
|
601
|
+
const [local, domProps] = splitProps(props, [
|
|
602
|
+
"items",
|
|
603
|
+
"class",
|
|
604
|
+
"style",
|
|
605
|
+
"render",
|
|
606
|
+
"slot",
|
|
607
|
+
"renderEmptyState",
|
|
608
|
+
"hasMore",
|
|
609
|
+
"isLoading",
|
|
610
|
+
"onLoadMore",
|
|
611
|
+
"children",
|
|
612
|
+
"ref"
|
|
613
|
+
]);
|
|
614
|
+
const context = useContext(TableContext);
|
|
615
|
+
if (!context) throw new Error("TableBody must be used within a Table");
|
|
616
|
+
const { rowGroupProps } = createTableRowGroup(() => ({ type: "tbody" }));
|
|
617
|
+
const items = createMemo(() => local.items ?? context.items);
|
|
618
|
+
const renderValues = createMemo(() => ({ isEmpty: items().length === 0 }));
|
|
619
|
+
const renderProps = useRenderProps({
|
|
620
|
+
class: local.class,
|
|
621
|
+
style: local.style,
|
|
622
|
+
defaultClassName: "solidaria-Table-body"
|
|
623
|
+
}, renderValues);
|
|
624
|
+
const cleanRowGroupProps = () => {
|
|
625
|
+
const { ref: _ref, ...rest } = rowGroupProps;
|
|
626
|
+
return rest;
|
|
627
|
+
};
|
|
628
|
+
const isEmpty = () => items().length === 0;
|
|
629
|
+
const virtualizer = useVirtualizerContext();
|
|
630
|
+
const parentCollectionRenderer = useCollectionRenderer();
|
|
631
|
+
const rowNodes = createMemo(() => Array.from(context.collection).filter((node) => node.type === "item"));
|
|
632
|
+
const persistedKeys = useDndPersistedKeys({ focusedKey: () => context.state.focusedKey }, context.dragAndDropHooks, context.dropState, context.collection);
|
|
633
|
+
const virtualRange = createMemo(() => {
|
|
634
|
+
if (context.state.treeColumn != null) return null;
|
|
635
|
+
if (!virtualizer || !parentCollectionRenderer?.isVirtualized) return null;
|
|
636
|
+
const rowCount = items().length;
|
|
637
|
+
const baseRange = virtualizer.getVisibleRange(rowCount);
|
|
638
|
+
const persistedIndexes = Array.from(persistedKeys()).map((key) => rowNodes().findIndex((node) => node.key === key)).filter((index) => index >= 0);
|
|
639
|
+
const dropTarget = context.dropState?.target;
|
|
640
|
+
const normalizedDropKey = getNormalizedDropTargetKey(dropTarget, context.collection);
|
|
641
|
+
const focusedKey = context.state.focusedKey;
|
|
642
|
+
const focusedIndex = focusedKey != null ? rowNodes().findIndex((node) => node.key === focusedKey) : -1;
|
|
643
|
+
return mergePersistedKeysIntoVirtualRange(baseRange, persistedIndexes, rowCount, virtualizer, 80, {
|
|
644
|
+
forceIncludeIndexes: [
|
|
645
|
+
dropTarget?.type === "item" ? rowNodes().findIndex((node) => node.key === dropTarget.key) : -1,
|
|
646
|
+
normalizedDropKey != null ? rowNodes().findIndex((node) => node.key === normalizedDropKey) : -1,
|
|
647
|
+
dropTarget?.type === "item" ? -1 : focusedIndex
|
|
648
|
+
].filter((index) => index >= 0),
|
|
649
|
+
forceIncludeMaxSpan: 320
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
createEffect(() => {
|
|
653
|
+
if (!virtualizer || !parentCollectionRenderer?.isVirtualized) return;
|
|
654
|
+
virtualizer.setDropTargetItemCountResolver(() => items().length);
|
|
655
|
+
virtualizer.setDropTargetIndexResolver((key) => {
|
|
656
|
+
const index = rowNodes().findIndex((node) => node.key === key);
|
|
657
|
+
return index >= 0 ? index : null;
|
|
658
|
+
});
|
|
659
|
+
virtualizer.setDropTargetResolver((target) => {
|
|
660
|
+
const node = rowNodes()[target.index];
|
|
661
|
+
if (!node) return target;
|
|
662
|
+
return {
|
|
663
|
+
...target,
|
|
664
|
+
key: typeof node.key === "string" || typeof node.key === "number" ? node.key : void 0
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
onCleanup(() => {
|
|
668
|
+
virtualizer.setDropTargetIndexResolver(void 0);
|
|
669
|
+
virtualizer.setDropTargetItemCountResolver(void 0);
|
|
670
|
+
virtualizer.setDropTargetResolver(void 0);
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
const visibleItems = createMemo(() => {
|
|
674
|
+
if (context.state.treeColumn != null) return rowNodes().map((node) => node.value);
|
|
675
|
+
const range = virtualRange();
|
|
676
|
+
if (!range) return items();
|
|
677
|
+
return items().slice(range.start, range.end);
|
|
678
|
+
});
|
|
679
|
+
const spacerColSpan = () => context.columns.length + (context.showSelectionCheckboxes ? 1 : 0);
|
|
680
|
+
const bodyChildren = () => [createComponent(SharedElementTransition, { get children() {
|
|
681
|
+
return createComponent(Show, {
|
|
682
|
+
get when() {
|
|
683
|
+
return memo(() => !!(isEmpty() && local.renderEmptyState))() && !local.isLoading;
|
|
684
|
+
},
|
|
685
|
+
get fallback() {
|
|
686
|
+
return [
|
|
687
|
+
memo(() => memo(() => !!virtualRange()?.offsetTop)() ? (() => {
|
|
688
|
+
var _el$8 = getNextElement(_tmpl$6), _el$9 = _el$8.firstChild;
|
|
689
|
+
effect((_p$) => {
|
|
690
|
+
var _v$ = spacerColSpan(), _v$2 = `${virtualRange().offsetTop}px`;
|
|
691
|
+
_v$ !== _p$.e && setAttribute(_el$9, "colspan", _p$.e = _v$);
|
|
692
|
+
_v$2 !== _p$.t && setStyleProperty(_el$9, "height", _p$.t = _v$2);
|
|
693
|
+
return _p$;
|
|
694
|
+
}, {
|
|
695
|
+
e: void 0,
|
|
696
|
+
t: void 0
|
|
697
|
+
});
|
|
698
|
+
return _el$8;
|
|
699
|
+
})() : null),
|
|
700
|
+
createComponent(For, {
|
|
701
|
+
get each() {
|
|
702
|
+
return visibleItems();
|
|
703
|
+
},
|
|
704
|
+
children: (item, index) => {
|
|
705
|
+
const itemIndex = () => (virtualRange()?.start ?? 0) + index();
|
|
706
|
+
const beforeIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "before");
|
|
707
|
+
const onIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "on");
|
|
708
|
+
const afterIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "after");
|
|
709
|
+
return [
|
|
710
|
+
memo(beforeIndicator),
|
|
711
|
+
memo(onIndicator),
|
|
712
|
+
memo(() => local.children?.(item)),
|
|
713
|
+
memo(afterIndicator)
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
}),
|
|
717
|
+
memo(() => memo(() => !!virtualRange()?.offsetBottom)() ? (() => {
|
|
718
|
+
var _el$0 = getNextElement(_tmpl$7), _el$1 = _el$0.firstChild;
|
|
719
|
+
effect((_p$) => {
|
|
720
|
+
var _v$3 = spacerColSpan(), _v$4 = `${virtualRange().offsetBottom}px`;
|
|
721
|
+
_v$3 !== _p$.e && setAttribute(_el$1, "colspan", _p$.e = _v$3);
|
|
722
|
+
_v$4 !== _p$.t && setStyleProperty(_el$1, "height", _p$.t = _v$4);
|
|
723
|
+
return _p$;
|
|
724
|
+
}, {
|
|
725
|
+
e: void 0,
|
|
726
|
+
t: void 0
|
|
727
|
+
});
|
|
728
|
+
return _el$0;
|
|
729
|
+
})() : null)
|
|
730
|
+
];
|
|
731
|
+
},
|
|
732
|
+
get children() {
|
|
733
|
+
var _el$6 = getNextElement(_tmpl$5), _el$7 = _el$6.firstChild;
|
|
734
|
+
insert(_el$7, () => local.renderEmptyState?.());
|
|
735
|
+
effect(() => setAttribute(_el$7, "colspan", spacerColSpan()));
|
|
736
|
+
return _el$6;
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
} }), createComponent(Show, {
|
|
740
|
+
get when() {
|
|
741
|
+
return memo(() => !!local.hasMore)() && local.onLoadMore;
|
|
742
|
+
},
|
|
743
|
+
get children() {
|
|
744
|
+
return createComponent(TableLoadMoreItem, {
|
|
745
|
+
get onLoadMore() {
|
|
746
|
+
return local.onLoadMore;
|
|
747
|
+
},
|
|
748
|
+
get isLoading() {
|
|
749
|
+
return local.isLoading;
|
|
750
|
+
},
|
|
751
|
+
get colSpan() {
|
|
752
|
+
return spacerColSpan();
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
})];
|
|
757
|
+
const bodyProps = () => ({
|
|
758
|
+
ref: (el) => assignRef(local.ref, el),
|
|
759
|
+
...domProps,
|
|
760
|
+
...cleanRowGroupProps(),
|
|
761
|
+
class: renderProps.class(),
|
|
762
|
+
style: renderProps.style(),
|
|
763
|
+
"data-empty": isEmpty() || void 0,
|
|
764
|
+
children: bodyChildren()
|
|
765
|
+
});
|
|
766
|
+
return local.render ? local.render(bodyProps(), renderValues()) : (() => {
|
|
767
|
+
var _el$10 = getNextElement(_tmpl$8), _el$13 = _el$10.firstChild, [_el$14, _co$] = getNextMarker(_el$13.nextSibling), _el$15 = _el$14.nextSibling, [_el$16, _co$2] = getNextMarker(_el$15.nextSibling);
|
|
768
|
+
use((el) => assignRef(local.ref, el), _el$10);
|
|
769
|
+
spread(_el$10, mergeProps(domProps, cleanRowGroupProps, {
|
|
770
|
+
get ["class"]() {
|
|
771
|
+
return renderProps.class();
|
|
772
|
+
},
|
|
773
|
+
get style() {
|
|
774
|
+
return renderProps.style();
|
|
775
|
+
},
|
|
776
|
+
get ["data-empty"]() {
|
|
777
|
+
return isEmpty() || void 0;
|
|
778
|
+
}
|
|
779
|
+
}), false, true);
|
|
780
|
+
insert(_el$10, createComponent(SharedElementTransition, { get children() {
|
|
781
|
+
return createComponent(Show, {
|
|
782
|
+
get when() {
|
|
783
|
+
return memo(() => !!(isEmpty() && local.renderEmptyState))() && !local.isLoading;
|
|
784
|
+
},
|
|
785
|
+
get fallback() {
|
|
786
|
+
return [
|
|
787
|
+
memo(() => memo(() => !!virtualRange()?.offsetTop)() ? (() => {
|
|
788
|
+
var _el$17 = getNextElement(_tmpl$6), _el$18 = _el$17.firstChild;
|
|
789
|
+
effect((_p$) => {
|
|
790
|
+
var _v$5 = spacerColSpan(), _v$6 = `${virtualRange().offsetTop}px`;
|
|
791
|
+
_v$5 !== _p$.e && setAttribute(_el$18, "colspan", _p$.e = _v$5);
|
|
792
|
+
_v$6 !== _p$.t && setStyleProperty(_el$18, "height", _p$.t = _v$6);
|
|
793
|
+
return _p$;
|
|
794
|
+
}, {
|
|
795
|
+
e: void 0,
|
|
796
|
+
t: void 0
|
|
797
|
+
});
|
|
798
|
+
return _el$17;
|
|
799
|
+
})() : null),
|
|
800
|
+
createComponent(For, {
|
|
801
|
+
get each() {
|
|
802
|
+
return visibleItems();
|
|
803
|
+
},
|
|
804
|
+
children: (item, index) => {
|
|
805
|
+
const itemIndex = () => (virtualRange()?.start ?? 0) + index();
|
|
806
|
+
const beforeIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "before");
|
|
807
|
+
const onIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "on");
|
|
808
|
+
const afterIndicator = () => parentCollectionRenderer?.renderDropIndicator?.(itemIndex(), "after");
|
|
809
|
+
return [
|
|
810
|
+
memo(beforeIndicator),
|
|
811
|
+
memo(onIndicator),
|
|
812
|
+
memo(() => local.children?.(item)),
|
|
813
|
+
memo(afterIndicator)
|
|
814
|
+
];
|
|
815
|
+
}
|
|
816
|
+
}),
|
|
817
|
+
memo(() => memo(() => !!virtualRange()?.offsetBottom)() ? (() => {
|
|
818
|
+
var _el$19 = getNextElement(_tmpl$7), _el$20 = _el$19.firstChild;
|
|
819
|
+
effect((_p$) => {
|
|
820
|
+
var _v$7 = spacerColSpan(), _v$8 = `${virtualRange().offsetBottom}px`;
|
|
821
|
+
_v$7 !== _p$.e && setAttribute(_el$20, "colspan", _p$.e = _v$7);
|
|
822
|
+
_v$8 !== _p$.t && setStyleProperty(_el$20, "height", _p$.t = _v$8);
|
|
823
|
+
return _p$;
|
|
824
|
+
}, {
|
|
825
|
+
e: void 0,
|
|
826
|
+
t: void 0
|
|
827
|
+
});
|
|
828
|
+
return _el$19;
|
|
829
|
+
})() : null)
|
|
830
|
+
];
|
|
831
|
+
},
|
|
832
|
+
get children() {
|
|
833
|
+
var _el$11 = getNextElement(_tmpl$5), _el$12 = _el$11.firstChild;
|
|
834
|
+
insert(_el$12, () => local.renderEmptyState?.());
|
|
835
|
+
effect(() => setAttribute(_el$12, "colspan", spacerColSpan()));
|
|
836
|
+
return _el$11;
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
} }), _el$14, _co$);
|
|
840
|
+
insert(_el$10, createComponent(Show, {
|
|
841
|
+
get when() {
|
|
842
|
+
return memo(() => !!local.hasMore)() && local.onLoadMore;
|
|
843
|
+
},
|
|
844
|
+
get children() {
|
|
845
|
+
return createComponent(TableLoadMoreItem, {
|
|
846
|
+
get onLoadMore() {
|
|
847
|
+
return local.onLoadMore;
|
|
848
|
+
},
|
|
849
|
+
get isLoading() {
|
|
850
|
+
return local.isLoading;
|
|
851
|
+
},
|
|
852
|
+
get colSpan() {
|
|
853
|
+
return spacerColSpan();
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
}), _el$16, _co$2);
|
|
858
|
+
runHydrationEvents();
|
|
859
|
+
return _el$10;
|
|
860
|
+
})();
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* The footer of a table containing summary rows.
|
|
864
|
+
*/
|
|
865
|
+
function TableFooter(props) {
|
|
866
|
+
const [local, domProps] = splitProps(props, [
|
|
867
|
+
"items",
|
|
868
|
+
"class",
|
|
869
|
+
"style",
|
|
870
|
+
"slot",
|
|
871
|
+
"children"
|
|
872
|
+
]);
|
|
873
|
+
if (!useContext(TableContext)) throw new Error("TableFooter must be used within a Table");
|
|
874
|
+
const { rowGroupProps } = createTableRowGroup(() => ({ type: "tfoot" }));
|
|
875
|
+
const items = createMemo(() => local.items ?? []);
|
|
876
|
+
const renderValues = createMemo(() => ({ isEmpty: items().length === 0 }));
|
|
877
|
+
const renderProps = useRenderProps({
|
|
878
|
+
class: local.class,
|
|
879
|
+
style: local.style,
|
|
880
|
+
defaultClassName: "solidaria-Table-footer"
|
|
881
|
+
}, renderValues);
|
|
882
|
+
const cleanRowGroupProps = () => {
|
|
883
|
+
const { ref: _ref, ...rest } = rowGroupProps;
|
|
884
|
+
return rest;
|
|
885
|
+
};
|
|
886
|
+
return (() => {
|
|
887
|
+
var _el$21 = getNextElement(_tmpl$9);
|
|
888
|
+
spread(_el$21, mergeProps(domProps, cleanRowGroupProps, {
|
|
889
|
+
get ["class"]() {
|
|
890
|
+
return renderProps.class();
|
|
891
|
+
},
|
|
892
|
+
get style() {
|
|
893
|
+
return renderProps.style();
|
|
894
|
+
}
|
|
895
|
+
}), false, true);
|
|
896
|
+
insert(_el$21, createComponent(Show, {
|
|
897
|
+
get when() {
|
|
898
|
+
return memo(() => !!local.items)() && typeof local.children === "function";
|
|
899
|
+
},
|
|
900
|
+
get fallback() {
|
|
901
|
+
return local.children;
|
|
902
|
+
},
|
|
903
|
+
get children() {
|
|
904
|
+
return createComponent(For, {
|
|
905
|
+
get each() {
|
|
906
|
+
return items();
|
|
907
|
+
},
|
|
908
|
+
children: (item) => local.children(item)
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}));
|
|
912
|
+
runHydrationEvents();
|
|
913
|
+
return _el$21;
|
|
914
|
+
})();
|
|
915
|
+
}
|
|
916
|
+
function TableLoadMoreItem(props) {
|
|
917
|
+
let sentinelRef;
|
|
918
|
+
const [isPending, setIsPending] = createSignal(false);
|
|
919
|
+
const isLoading = () => !!props.isLoading || isPending();
|
|
920
|
+
const triggerLoadMore = async () => {
|
|
921
|
+
if (isPending()) return;
|
|
922
|
+
setIsPending(true);
|
|
923
|
+
try {
|
|
924
|
+
await props.onLoadMore();
|
|
925
|
+
} finally {
|
|
926
|
+
setIsPending(false);
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
createEffect(() => {
|
|
930
|
+
if (!sentinelRef || typeof IntersectionObserver !== "function") return;
|
|
931
|
+
const margin = `0px 0px ${100 * (props.scrollOffset ?? 1)}% 0px`;
|
|
932
|
+
const observer = new IntersectionObserver((entries) => {
|
|
933
|
+
if (entries[0]?.isIntersecting) triggerLoadMore();
|
|
934
|
+
}, { rootMargin: margin });
|
|
935
|
+
observer.observe(sentinelRef);
|
|
936
|
+
return () => observer.disconnect();
|
|
937
|
+
});
|
|
938
|
+
const renderProps = useRenderProps({
|
|
939
|
+
children: props.children ?? (() => isLoading() ? getNextElement(_tmpl$0) : null),
|
|
940
|
+
class: props.class,
|
|
941
|
+
style: props.style,
|
|
942
|
+
defaultClassName: "solidaria-Table-loadMore"
|
|
943
|
+
}, () => ({ isLoading: isLoading() }));
|
|
944
|
+
return [(() => {
|
|
945
|
+
var _el$23 = getNextElement(_tmpl$1), _el$25 = _el$23.firstChild.firstChild;
|
|
946
|
+
var _ref$ = sentinelRef;
|
|
947
|
+
typeof _ref$ === "function" ? use(_ref$, _el$25) : sentinelRef = _el$25;
|
|
948
|
+
return _el$23;
|
|
949
|
+
})(), createComponent(Show, {
|
|
950
|
+
get when() {
|
|
951
|
+
return isLoading();
|
|
952
|
+
},
|
|
953
|
+
get children() {
|
|
954
|
+
var _el$26 = getNextElement(_tmpl$10), _el$27 = _el$26.firstChild;
|
|
955
|
+
_el$26.addEventListener("focus", () => {
|
|
956
|
+
triggerLoadMore();
|
|
957
|
+
});
|
|
958
|
+
insert(_el$27, () => renderProps.renderChildren());
|
|
959
|
+
effect((_p$) => {
|
|
960
|
+
var _v$9 = renderProps.class(), _v$0 = renderProps.style(), _v$1 = props.colSpan ?? 1;
|
|
961
|
+
_v$9 !== _p$.e && className(_el$26, _p$.e = _v$9);
|
|
962
|
+
_p$.t = style(_el$26, _v$0, _p$.t);
|
|
963
|
+
_v$1 !== _p$.a && setAttribute(_el$27, "colspan", _p$.a = _v$1);
|
|
964
|
+
return _p$;
|
|
965
|
+
}, {
|
|
966
|
+
e: void 0,
|
|
967
|
+
t: void 0,
|
|
968
|
+
a: void 0
|
|
969
|
+
});
|
|
970
|
+
return _el$26;
|
|
971
|
+
}
|
|
972
|
+
})];
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* A row in a table.
|
|
976
|
+
*/
|
|
977
|
+
function TableRow(props) {
|
|
978
|
+
const [local, domProps] = splitProps(props, [
|
|
979
|
+
"class",
|
|
980
|
+
"style",
|
|
981
|
+
"render",
|
|
982
|
+
"slot",
|
|
983
|
+
"id",
|
|
984
|
+
"item",
|
|
985
|
+
"columns",
|
|
986
|
+
"isDisabled",
|
|
987
|
+
"onAction",
|
|
988
|
+
"children",
|
|
989
|
+
"ref",
|
|
990
|
+
"href",
|
|
991
|
+
"target",
|
|
992
|
+
"rel",
|
|
993
|
+
"download",
|
|
994
|
+
"ping",
|
|
995
|
+
"referrerPolicy",
|
|
996
|
+
"routerOptions"
|
|
997
|
+
]);
|
|
998
|
+
const context = useContext(TableContext);
|
|
999
|
+
if (!context) throw new Error("TableRow must be used within a Table");
|
|
1000
|
+
const { state } = context;
|
|
1001
|
+
const tableContext = context;
|
|
1002
|
+
const registeredCellIds = [];
|
|
1003
|
+
const generatedId = createUniqueId();
|
|
1004
|
+
const rowKey = () => local.id ?? generatedId;
|
|
1005
|
+
const router = useRouter();
|
|
1006
|
+
const linkProps = createMemo(() => useLinkProps({
|
|
1007
|
+
href: local.href,
|
|
1008
|
+
target: local.target,
|
|
1009
|
+
rel: local.rel,
|
|
1010
|
+
download: local.download,
|
|
1011
|
+
ping: local.ping,
|
|
1012
|
+
referrerPolicy: local.referrerPolicy
|
|
1013
|
+
}));
|
|
1014
|
+
const [ref, setRef] = createSignal(null);
|
|
1015
|
+
const rowNode = createMemo(() => {
|
|
1016
|
+
const node = state.collection.getItem(rowKey());
|
|
1017
|
+
if (!node) return {
|
|
1018
|
+
type: "item",
|
|
1019
|
+
key: rowKey(),
|
|
1020
|
+
value: local.item ?? null,
|
|
1021
|
+
textValue: String(local.id),
|
|
1022
|
+
level: 0,
|
|
1023
|
+
index: 0,
|
|
1024
|
+
hasChildNodes: true,
|
|
1025
|
+
childNodes: []
|
|
1026
|
+
};
|
|
1027
|
+
return node;
|
|
1028
|
+
});
|
|
1029
|
+
const rowAria = createTableRow(() => ({
|
|
1030
|
+
node: rowNode(),
|
|
1031
|
+
isVirtualized: tableContext.isVirtualized,
|
|
1032
|
+
isDisabled: local.isDisabled,
|
|
1033
|
+
onAction: local.onAction,
|
|
1034
|
+
href: linkProps().href,
|
|
1035
|
+
onLinkAction: (event) => {
|
|
1036
|
+
const target = ref();
|
|
1037
|
+
if (!target || !local.href) return;
|
|
1038
|
+
router.open(target, event, local.href, local.routerOptions);
|
|
1039
|
+
}
|
|
1040
|
+
}), () => state, ref);
|
|
1041
|
+
const isSelected = () => rowAria.isSelected;
|
|
1042
|
+
const isDisabled = () => rowAria.isDisabled;
|
|
1043
|
+
const isPressed = () => rowAria.isPressed;
|
|
1044
|
+
const isInteractive = () => {
|
|
1045
|
+
const tableData = getTableData(state);
|
|
1046
|
+
return state.selectionMode !== "none" || !!tableData?.actions.onRowAction || !!local.onAction || !!local.href;
|
|
1047
|
+
};
|
|
1048
|
+
const { isHovered, hoverProps } = createHover({
|
|
1049
|
+
get isDisabled() {
|
|
1050
|
+
return isDisabled() || !isInteractive();
|
|
1051
|
+
},
|
|
1052
|
+
onHoverStart(e) {
|
|
1053
|
+
domProps.onHoverStart?.(e);
|
|
1054
|
+
},
|
|
1055
|
+
onHoverEnd(e) {
|
|
1056
|
+
domProps.onHoverEnd?.(e);
|
|
1057
|
+
},
|
|
1058
|
+
onHoverChange(isHovering) {
|
|
1059
|
+
domProps.onHoverChange?.(isHovering);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
const { isFocusVisible: isFocusVisible$1, focusProps } = createFocusRing();
|
|
1063
|
+
const [isFocusWithin, setIsFocusWithin] = createSignal(false);
|
|
1064
|
+
const focusWithinProps = {
|
|
1065
|
+
onFocusIn() {
|
|
1066
|
+
setIsFocusWithin(true);
|
|
1067
|
+
},
|
|
1068
|
+
onFocusOut(e) {
|
|
1069
|
+
const currentTarget = e.currentTarget;
|
|
1070
|
+
const nextTarget = e.relatedTarget;
|
|
1071
|
+
if (!nextTarget || !currentTarget.contains(nextTarget)) setIsFocusWithin(false);
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
const isFocused = createMemo(() => state.focusedKey === rowKey());
|
|
1075
|
+
const draggableItem = createMemo(() => {
|
|
1076
|
+
if (!tableContext.dragAndDropHooks?.useDraggableItem || !tableContext.dragState) return void 0;
|
|
1077
|
+
return tableContext.dragAndDropHooks.useDraggableItem({
|
|
1078
|
+
key: rowKey(),
|
|
1079
|
+
hasDragButton: true
|
|
1080
|
+
}, tableContext.dragState);
|
|
1081
|
+
});
|
|
1082
|
+
const droppableItem = createMemo(() => {
|
|
1083
|
+
if (!tableContext.dragAndDropHooks?.useDroppableItem || !tableContext.dropState) return void 0;
|
|
1084
|
+
return tableContext.dragAndDropHooks.useDroppableItem({ key: rowKey() }, tableContext.dropState, () => ref());
|
|
1085
|
+
});
|
|
1086
|
+
const isTreeRow = () => state.treeColumn != null;
|
|
1087
|
+
const rowLevel = () => rowNode().level + 1;
|
|
1088
|
+
const hasChildItems = () => rowAria.hasChildRows;
|
|
1089
|
+
const isExpanded = () => rowAria.isExpanded;
|
|
1090
|
+
const renderValues = createMemo(() => ({
|
|
1091
|
+
isSelected: isSelected(),
|
|
1092
|
+
isFocused: isFocused(),
|
|
1093
|
+
isFocusVisible: isFocusVisible$1() && isFocused(),
|
|
1094
|
+
isPressed: isPressed(),
|
|
1095
|
+
isHovered: isHovered(),
|
|
1096
|
+
isDisabled: isDisabled(),
|
|
1097
|
+
isExpanded: isExpanded(),
|
|
1098
|
+
hasChildItems: hasChildItems(),
|
|
1099
|
+
level: rowLevel()
|
|
1100
|
+
}));
|
|
1101
|
+
const renderProps = useRenderProps({
|
|
1102
|
+
class: local.class,
|
|
1103
|
+
style: local.style,
|
|
1104
|
+
defaultClassName: "solidaria-Table-row"
|
|
1105
|
+
}, renderValues);
|
|
1106
|
+
const cleanRowProps = () => {
|
|
1107
|
+
const { ref: _ref1, ...rest } = rowAria.rowProps;
|
|
1108
|
+
return rest;
|
|
1109
|
+
};
|
|
1110
|
+
const cleanHoverProps = () => {
|
|
1111
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
1112
|
+
return rest;
|
|
1113
|
+
};
|
|
1114
|
+
const cleanFocusProps = () => {
|
|
1115
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
1116
|
+
return rest;
|
|
1117
|
+
};
|
|
1118
|
+
const rowContextValue = {
|
|
1119
|
+
rowKey: rowKey(),
|
|
1120
|
+
rowNode: rowNode(),
|
|
1121
|
+
getCellColumnKey(cellId, explicitId) {
|
|
1122
|
+
if (explicitId === "__selection__") return explicitId;
|
|
1123
|
+
let index = registeredCellIds.indexOf(cellId);
|
|
1124
|
+
if (index < 0) {
|
|
1125
|
+
index = registeredCellIds.length;
|
|
1126
|
+
registeredCellIds.push(cellId);
|
|
1127
|
+
}
|
|
1128
|
+
return explicitId ?? tableContext.columns[index]?.key;
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
const dragButtonProps = createMemo(() => {
|
|
1132
|
+
const props = draggableItem()?.dragButtonProps ?? {};
|
|
1133
|
+
const textValue = (rowNode().textValue || String(rowKey())).trim();
|
|
1134
|
+
return {
|
|
1135
|
+
...props,
|
|
1136
|
+
"aria-label": `Drag ${textValue}`,
|
|
1137
|
+
style: {
|
|
1138
|
+
...typeof props.style === "object" ? props.style : {},
|
|
1139
|
+
"pointer-events": "none"
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
});
|
|
1143
|
+
const buttonContextValue = { slots: {
|
|
1144
|
+
default: {},
|
|
1145
|
+
get drag() {
|
|
1146
|
+
return dragButtonProps();
|
|
1147
|
+
},
|
|
1148
|
+
get chevron() {
|
|
1149
|
+
return rowAria.expandButtonProps;
|
|
1150
|
+
}
|
|
1151
|
+
} };
|
|
1152
|
+
const childRenderProps = {
|
|
1153
|
+
get isSelected() {
|
|
1154
|
+
return isSelected();
|
|
1155
|
+
},
|
|
1156
|
+
get isFocused() {
|
|
1157
|
+
return isFocused();
|
|
1158
|
+
},
|
|
1159
|
+
get isFocusVisible() {
|
|
1160
|
+
return isFocusVisible$1() && isFocused();
|
|
1161
|
+
},
|
|
1162
|
+
get isPressed() {
|
|
1163
|
+
return isPressed();
|
|
1164
|
+
},
|
|
1165
|
+
get isHovered() {
|
|
1166
|
+
return isHovered();
|
|
1167
|
+
},
|
|
1168
|
+
get isDisabled() {
|
|
1169
|
+
return isDisabled();
|
|
1170
|
+
},
|
|
1171
|
+
get isExpanded() {
|
|
1172
|
+
return isExpanded();
|
|
1173
|
+
},
|
|
1174
|
+
get hasChildItems() {
|
|
1175
|
+
return hasChildItems();
|
|
1176
|
+
},
|
|
1177
|
+
get level() {
|
|
1178
|
+
return rowLevel();
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
const rowStyle = () => {
|
|
1182
|
+
const base = renderProps.style();
|
|
1183
|
+
if (!isTreeRow()) return base;
|
|
1184
|
+
return {
|
|
1185
|
+
...base ?? {},
|
|
1186
|
+
"--table-row-level": rowLevel()
|
|
1187
|
+
};
|
|
1188
|
+
};
|
|
1189
|
+
return createComponent(TableRowContext.Provider, {
|
|
1190
|
+
value: rowContextValue,
|
|
1191
|
+
get children() {
|
|
1192
|
+
return createComponent(ButtonContext.Provider, {
|
|
1193
|
+
value: buttonContextValue,
|
|
1194
|
+
get children() {
|
|
1195
|
+
return (() => {
|
|
1196
|
+
registeredCellIds.length = 0;
|
|
1197
|
+
const rowChildrenContent = typeof local.children === "function" ? local.columns ? createComponent(For, {
|
|
1198
|
+
get each() {
|
|
1199
|
+
return local.columns;
|
|
1200
|
+
},
|
|
1201
|
+
children: (column) => local.children(column)
|
|
1202
|
+
}) : local.children(childRenderProps) : local.children;
|
|
1203
|
+
const tableRowProps = () => ({
|
|
1204
|
+
ref: (el) => {
|
|
1205
|
+
setRef(el);
|
|
1206
|
+
assignRef(local.ref, el);
|
|
1207
|
+
},
|
|
1208
|
+
...domProps,
|
|
1209
|
+
...mergeProps$2(cleanRowProps(), cleanHoverProps(), cleanFocusProps(), focusWithinProps, draggableItem()?.dragProps ?? {}, droppableItem()?.dropProps ?? {}),
|
|
1210
|
+
class: renderProps.class(),
|
|
1211
|
+
style: rowStyle(),
|
|
1212
|
+
"data-key": rowKey(),
|
|
1213
|
+
"data-selected": isSelected() || void 0,
|
|
1214
|
+
"data-focused": isFocused() || void 0,
|
|
1215
|
+
"data-focus-visible": isFocusVisible$1() && isFocused() || void 0,
|
|
1216
|
+
"data-focus-visible-within": dataAttr(isFocusWithin() && isFocusVisible()),
|
|
1217
|
+
"data-pressed": isPressed() || void 0,
|
|
1218
|
+
"data-hovered": isHovered() || void 0,
|
|
1219
|
+
"data-disabled": isDisabled() || void 0,
|
|
1220
|
+
"data-href": linkProps().href,
|
|
1221
|
+
"data-target": linkProps().target,
|
|
1222
|
+
"data-rel": linkProps().rel,
|
|
1223
|
+
"data-download": typeof linkProps().download === "string" ? linkProps().download : linkProps().download ? "" : void 0,
|
|
1224
|
+
"data-ping": linkProps().ping,
|
|
1225
|
+
"data-referrer-policy": linkProps().referrerPolicy,
|
|
1226
|
+
"data-dragging": draggableItem()?.isDragging || void 0,
|
|
1227
|
+
"data-drop-target": droppableItem()?.isDropTarget || void 0,
|
|
1228
|
+
"data-expanded": isTreeRow() && isExpanded() || void 0,
|
|
1229
|
+
"data-has-child-items": isTreeRow() && hasChildItems() || void 0,
|
|
1230
|
+
"data-level": isTreeRow() ? rowLevel() : void 0,
|
|
1231
|
+
children: rowChildrenContent
|
|
1232
|
+
});
|
|
1233
|
+
return createComponent(Show, {
|
|
1234
|
+
get when() {
|
|
1235
|
+
return local.render;
|
|
1236
|
+
},
|
|
1237
|
+
get fallback() {
|
|
1238
|
+
return (() => {
|
|
1239
|
+
var _el$28 = getNextElement(_tmpl$11);
|
|
1240
|
+
use((el) => {
|
|
1241
|
+
setRef(el);
|
|
1242
|
+
assignRef(local.ref, el);
|
|
1243
|
+
}, _el$28);
|
|
1244
|
+
spread(_el$28, mergeProps(domProps, () => mergeProps$2(cleanRowProps(), cleanHoverProps(), cleanFocusProps(), focusWithinProps, draggableItem()?.dragProps ?? {}, droppableItem()?.dropProps ?? {}), {
|
|
1245
|
+
get ["class"]() {
|
|
1246
|
+
return renderProps.class();
|
|
1247
|
+
},
|
|
1248
|
+
get style() {
|
|
1249
|
+
return rowStyle();
|
|
1250
|
+
},
|
|
1251
|
+
get ["data-key"]() {
|
|
1252
|
+
return rowKey();
|
|
1253
|
+
},
|
|
1254
|
+
get ["data-selected"]() {
|
|
1255
|
+
return isSelected() || void 0;
|
|
1256
|
+
},
|
|
1257
|
+
get ["data-focused"]() {
|
|
1258
|
+
return isFocused() || void 0;
|
|
1259
|
+
},
|
|
1260
|
+
get ["data-focus-visible"]() {
|
|
1261
|
+
return memo(() => !!isFocusVisible$1())() && isFocused() || void 0;
|
|
1262
|
+
},
|
|
1263
|
+
get ["data-focus-visible-within"]() {
|
|
1264
|
+
return dataAttr(isFocusWithin() && isFocusVisible());
|
|
1265
|
+
},
|
|
1266
|
+
get ["data-pressed"]() {
|
|
1267
|
+
return isPressed() || void 0;
|
|
1268
|
+
},
|
|
1269
|
+
get ["data-hovered"]() {
|
|
1270
|
+
return isHovered() || void 0;
|
|
1271
|
+
},
|
|
1272
|
+
get ["data-disabled"]() {
|
|
1273
|
+
return isDisabled() || void 0;
|
|
1274
|
+
},
|
|
1275
|
+
get ["data-href"]() {
|
|
1276
|
+
return linkProps().href;
|
|
1277
|
+
},
|
|
1278
|
+
get ["data-target"]() {
|
|
1279
|
+
return linkProps().target;
|
|
1280
|
+
},
|
|
1281
|
+
get ["data-rel"]() {
|
|
1282
|
+
return linkProps().rel;
|
|
1283
|
+
},
|
|
1284
|
+
get ["data-download"]() {
|
|
1285
|
+
return memo(() => typeof linkProps().download === "string")() ? linkProps().download : linkProps().download ? "" : void 0;
|
|
1286
|
+
},
|
|
1287
|
+
get ["data-ping"]() {
|
|
1288
|
+
return linkProps().ping;
|
|
1289
|
+
},
|
|
1290
|
+
get ["data-referrer-policy"]() {
|
|
1291
|
+
return linkProps().referrerPolicy;
|
|
1292
|
+
},
|
|
1293
|
+
get ["data-dragging"]() {
|
|
1294
|
+
return draggableItem()?.isDragging || void 0;
|
|
1295
|
+
},
|
|
1296
|
+
get ["data-drop-target"]() {
|
|
1297
|
+
return droppableItem()?.isDropTarget || void 0;
|
|
1298
|
+
},
|
|
1299
|
+
get ["data-expanded"]() {
|
|
1300
|
+
return memo(() => !!isTreeRow())() && isExpanded() || void 0;
|
|
1301
|
+
},
|
|
1302
|
+
get ["data-has-child-items"]() {
|
|
1303
|
+
return memo(() => !!isTreeRow())() && hasChildItems() || void 0;
|
|
1304
|
+
},
|
|
1305
|
+
get ["data-level"]() {
|
|
1306
|
+
return memo(() => !!isTreeRow())() ? rowLevel() : void 0;
|
|
1307
|
+
}
|
|
1308
|
+
}), false, true);
|
|
1309
|
+
insert(_el$28, rowChildrenContent);
|
|
1310
|
+
runHydrationEvents();
|
|
1311
|
+
return _el$28;
|
|
1312
|
+
})();
|
|
1313
|
+
},
|
|
1314
|
+
get children() {
|
|
1315
|
+
return local.render(tableRowProps(), renderValues());
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
})();
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* A cell in a table row.
|
|
1326
|
+
*/
|
|
1327
|
+
function TableCell(props) {
|
|
1328
|
+
const [local, domProps] = splitProps(props, [
|
|
1329
|
+
"class",
|
|
1330
|
+
"style",
|
|
1331
|
+
"render",
|
|
1332
|
+
"slot",
|
|
1333
|
+
"id",
|
|
1334
|
+
"colSpan",
|
|
1335
|
+
"children",
|
|
1336
|
+
"ref"
|
|
1337
|
+
]);
|
|
1338
|
+
const tableContext = useContext(TableContext);
|
|
1339
|
+
const rowContext = useContext(TableRowContext);
|
|
1340
|
+
if (!tableContext) throw new Error("TableCell must be used within a Table");
|
|
1341
|
+
if (!rowContext) throw new Error("TableCell must be used within a Table");
|
|
1342
|
+
const { state } = tableContext;
|
|
1343
|
+
const { rowKey, rowNode } = rowContext;
|
|
1344
|
+
const [ref, setRef] = createSignal(null);
|
|
1345
|
+
const cellId = createUniqueId();
|
|
1346
|
+
const columnKey = createMemo(() => rowContext.getCellColumnKey(cellId, local.id));
|
|
1347
|
+
const cellNode = createMemo(() => {
|
|
1348
|
+
const key = columnKey();
|
|
1349
|
+
if (key != null) {
|
|
1350
|
+
const cellKey = `${rowKey}-${key}`;
|
|
1351
|
+
const node = state.collection.getItem(cellKey);
|
|
1352
|
+
if (node) return node;
|
|
1353
|
+
}
|
|
1354
|
+
return {
|
|
1355
|
+
type: "cell",
|
|
1356
|
+
key: key ?? `${rowKey}-cell`,
|
|
1357
|
+
value: rowNode.value,
|
|
1358
|
+
textValue: "",
|
|
1359
|
+
level: 1,
|
|
1360
|
+
index: 0,
|
|
1361
|
+
parentKey: rowKey,
|
|
1362
|
+
hasChildNodes: false,
|
|
1363
|
+
childNodes: []
|
|
1364
|
+
};
|
|
1365
|
+
});
|
|
1366
|
+
const cellColumnIndex = createMemo(() => {
|
|
1367
|
+
const key = columnKey();
|
|
1368
|
+
if (key == null) return void 0;
|
|
1369
|
+
const cellKey = `${rowKey}-${key}`;
|
|
1370
|
+
return state.collection.getItem(cellKey) ? cellNode().index ?? 0 : void 0;
|
|
1371
|
+
});
|
|
1372
|
+
const isTreeGridCell = () => state.treeColumn != null;
|
|
1373
|
+
const parentRowNode = createMemo(() => state.collection.getItem(rowKey));
|
|
1374
|
+
const cellLevel = () => (parentRowNode()?.level ?? rowNode.level ?? 0) + 1;
|
|
1375
|
+
const cellHasChildItems = () => parentRowNode()?.isExpandable ?? false;
|
|
1376
|
+
const cellIsExpanded = () => {
|
|
1377
|
+
if (!isTreeGridCell() || !cellHasChildItems()) return false;
|
|
1378
|
+
return state.expandedKeys === "all" || state.expandedKeys.has(rowKey);
|
|
1379
|
+
};
|
|
1380
|
+
const isTreeColumn = () => isTreeGridCell() && columnKey() === state.treeColumn;
|
|
1381
|
+
const cellAria = createTableCell(() => ({ node: cellNode() }), () => state, ref);
|
|
1382
|
+
const isPressed = () => cellAria.isPressed;
|
|
1383
|
+
const { isHovered, hoverProps } = createHover({ isDisabled: false });
|
|
1384
|
+
const { isFocusVisible, focusProps } = createFocusRing();
|
|
1385
|
+
const isFocused = createMemo(() => state.focusedKey === cellNode().key);
|
|
1386
|
+
const renderValues = createMemo(() => ({
|
|
1387
|
+
isFocused: isFocused(),
|
|
1388
|
+
isFocusVisible: isFocusVisible() && isFocused(),
|
|
1389
|
+
columnIndex: cellColumnIndex() ?? 0,
|
|
1390
|
+
isPressed: isPressed(),
|
|
1391
|
+
isHovered: isHovered(),
|
|
1392
|
+
isTreeColumn: isTreeColumn(),
|
|
1393
|
+
isExpanded: cellIsExpanded(),
|
|
1394
|
+
hasChildItems: cellHasChildItems(),
|
|
1395
|
+
level: cellLevel()
|
|
1396
|
+
}));
|
|
1397
|
+
const renderProps = useRenderProps({
|
|
1398
|
+
class: local.class,
|
|
1399
|
+
style: local.style,
|
|
1400
|
+
defaultClassName: "solidaria-Table-cell"
|
|
1401
|
+
}, renderValues);
|
|
1402
|
+
const cleanCellProps = () => {
|
|
1403
|
+
const { ref: _ref1, ...rest } = cellAria.gridCellProps;
|
|
1404
|
+
return rest;
|
|
1405
|
+
};
|
|
1406
|
+
const cleanHoverProps = () => {
|
|
1407
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
1408
|
+
return rest;
|
|
1409
|
+
};
|
|
1410
|
+
const cleanFocusProps = () => {
|
|
1411
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
1412
|
+
return rest;
|
|
1413
|
+
};
|
|
1414
|
+
const cellChildren = () => typeof local.children === "function" ? local.children(renderValues()) : local.children;
|
|
1415
|
+
const tableCellProps = () => ({
|
|
1416
|
+
ref: (el) => {
|
|
1417
|
+
setRef(el);
|
|
1418
|
+
assignRef(local.ref, el);
|
|
1419
|
+
},
|
|
1420
|
+
...domProps,
|
|
1421
|
+
...mergeProps$2(cleanCellProps(), cleanHoverProps(), cleanFocusProps()),
|
|
1422
|
+
colSpan: local.colSpan,
|
|
1423
|
+
class: renderProps.class(),
|
|
1424
|
+
style: renderProps.style(),
|
|
1425
|
+
"data-key": cellNode().key,
|
|
1426
|
+
"data-focused": isFocused() || void 0,
|
|
1427
|
+
"data-focus-visible": isFocusVisible() && isFocused() || void 0,
|
|
1428
|
+
"data-column-index": cellColumnIndex(),
|
|
1429
|
+
"data-pressed": isPressed() || void 0,
|
|
1430
|
+
"data-hovered": isHovered() || void 0,
|
|
1431
|
+
"data-tree-column": isTreeColumn() || void 0,
|
|
1432
|
+
"data-expanded": isTreeGridCell() && cellIsExpanded() || void 0,
|
|
1433
|
+
"data-has-child-items": isTreeGridCell() && cellHasChildItems() || void 0,
|
|
1434
|
+
"data-level": isTreeGridCell() ? cellLevel() : void 0,
|
|
1435
|
+
children: cellChildren()
|
|
1436
|
+
});
|
|
1437
|
+
return local.render ? local.render(tableCellProps(), renderValues()) : (() => {
|
|
1438
|
+
var _el$29 = getNextElement(_tmpl$12);
|
|
1439
|
+
use((el) => {
|
|
1440
|
+
setRef(el);
|
|
1441
|
+
assignRef(local.ref, el);
|
|
1442
|
+
}, _el$29);
|
|
1443
|
+
spread(_el$29, mergeProps(domProps, () => mergeProps$2(cleanCellProps(), cleanHoverProps(), cleanFocusProps()), {
|
|
1444
|
+
get colSpan() {
|
|
1445
|
+
return local.colSpan;
|
|
1446
|
+
},
|
|
1447
|
+
get ["class"]() {
|
|
1448
|
+
return renderProps.class();
|
|
1449
|
+
},
|
|
1450
|
+
get style() {
|
|
1451
|
+
return renderProps.style();
|
|
1452
|
+
},
|
|
1453
|
+
get ["data-key"]() {
|
|
1454
|
+
return cellNode().key;
|
|
1455
|
+
},
|
|
1456
|
+
get ["data-focused"]() {
|
|
1457
|
+
return isFocused() || void 0;
|
|
1458
|
+
},
|
|
1459
|
+
get ["data-focus-visible"]() {
|
|
1460
|
+
return memo(() => !!isFocusVisible())() && isFocused() || void 0;
|
|
1461
|
+
},
|
|
1462
|
+
get ["data-column-index"]() {
|
|
1463
|
+
return cellColumnIndex();
|
|
1464
|
+
},
|
|
1465
|
+
get ["data-pressed"]() {
|
|
1466
|
+
return isPressed() || void 0;
|
|
1467
|
+
},
|
|
1468
|
+
get ["data-hovered"]() {
|
|
1469
|
+
return isHovered() || void 0;
|
|
1470
|
+
},
|
|
1471
|
+
get ["data-tree-column"]() {
|
|
1472
|
+
return isTreeColumn() || void 0;
|
|
1473
|
+
},
|
|
1474
|
+
get ["data-expanded"]() {
|
|
1475
|
+
return memo(() => !!isTreeGridCell())() && cellIsExpanded() || void 0;
|
|
1476
|
+
},
|
|
1477
|
+
get ["data-has-child-items"]() {
|
|
1478
|
+
return memo(() => !!isTreeGridCell())() && cellHasChildItems() || void 0;
|
|
1479
|
+
},
|
|
1480
|
+
get ["data-level"]() {
|
|
1481
|
+
return memo(() => !!isTreeGridCell())() ? cellLevel() : void 0;
|
|
1482
|
+
}
|
|
1483
|
+
}), false, true);
|
|
1484
|
+
insert(_el$29, cellChildren);
|
|
1485
|
+
runHydrationEvents();
|
|
1486
|
+
return _el$29;
|
|
1487
|
+
})();
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* A checkbox cell for row selection.
|
|
1491
|
+
*/
|
|
1492
|
+
function TableSelectionCheckbox(props) {
|
|
1493
|
+
const context = useContext(TableContext);
|
|
1494
|
+
if (!context) throw new Error("TableSelectionCheckbox must be used within a Table");
|
|
1495
|
+
const { state } = context;
|
|
1496
|
+
const selectionCheckboxAria = createTableSelectionCheckbox(() => ({ key: props.rowKey }), () => state);
|
|
1497
|
+
return (() => {
|
|
1498
|
+
var _el$30 = getNextElement(_tmpl$13);
|
|
1499
|
+
spread(_el$30, mergeProps(() => selectionCheckboxAria.checkboxProps, {
|
|
1500
|
+
get ["class"]() {
|
|
1501
|
+
return props.class;
|
|
1502
|
+
},
|
|
1503
|
+
get style() {
|
|
1504
|
+
return props.style;
|
|
1505
|
+
},
|
|
1506
|
+
get tabIndex() {
|
|
1507
|
+
return memo(() => !!props.excludeFromTabOrder)() ? -1 : selectionCheckboxAria.checkboxProps.tabIndex;
|
|
1508
|
+
},
|
|
1509
|
+
get ["aria-label"]() {
|
|
1510
|
+
return props["aria-label"] ?? selectionCheckboxAria.checkboxProps["aria-label"];
|
|
1511
|
+
},
|
|
1512
|
+
"onClick": (event) => event.stopPropagation(),
|
|
1513
|
+
"onKeyDown": (event) => event.stopPropagation(),
|
|
1514
|
+
"onKeyUp": (event) => event.stopPropagation(),
|
|
1515
|
+
"onPointerDown": (event) => event.stopPropagation(),
|
|
1516
|
+
"onPointerUp": (event) => event.stopPropagation()
|
|
1517
|
+
}), false, false);
|
|
1518
|
+
runHydrationEvents();
|
|
1519
|
+
return _el$30;
|
|
1520
|
+
})();
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* A checkbox for select-all functionality.
|
|
1524
|
+
*/
|
|
1525
|
+
function TableSelectAllCheckbox(props = {}) {
|
|
1526
|
+
const context = useContext(TableContext);
|
|
1527
|
+
if (!context) throw new Error("TableSelectAllCheckbox must be used within a Table");
|
|
1528
|
+
const { state } = context;
|
|
1529
|
+
const selectAllCheckboxAria = createTableSelectAllCheckbox(() => state);
|
|
1530
|
+
let inputRef;
|
|
1531
|
+
createEffect(() => {
|
|
1532
|
+
if (inputRef) inputRef.indeterminate = selectAllCheckboxAria.isIndeterminate;
|
|
1533
|
+
});
|
|
1534
|
+
return (() => {
|
|
1535
|
+
var _el$31 = getNextElement(_tmpl$13);
|
|
1536
|
+
var _ref$2 = inputRef;
|
|
1537
|
+
typeof _ref$2 === "function" ? use(_ref$2, _el$31) : inputRef = _el$31;
|
|
1538
|
+
spread(_el$31, mergeProps(() => selectAllCheckboxAria.checkboxProps, {
|
|
1539
|
+
get ["class"]() {
|
|
1540
|
+
return props.class;
|
|
1541
|
+
},
|
|
1542
|
+
get style() {
|
|
1543
|
+
return props.style;
|
|
1544
|
+
},
|
|
1545
|
+
get ["aria-label"]() {
|
|
1546
|
+
return props["aria-label"] ?? selectAllCheckboxAria.checkboxProps["aria-label"];
|
|
1547
|
+
}
|
|
1548
|
+
}), false, false);
|
|
1549
|
+
runHydrationEvents();
|
|
1550
|
+
return _el$31;
|
|
1551
|
+
})();
|
|
1552
|
+
}
|
|
1553
|
+
Table.Header = TableHeader;
|
|
1554
|
+
Table.Column = TableColumn;
|
|
1555
|
+
Table.Body = TableBody;
|
|
1556
|
+
Table.LoadMoreItem = TableLoadMoreItem;
|
|
1557
|
+
Table.Row = TableRow;
|
|
1558
|
+
Table.Cell = TableCell;
|
|
1559
|
+
Table.SelectionCheckbox = TableSelectionCheckbox;
|
|
1560
|
+
Table.SelectAllCheckbox = TableSelectAllCheckbox;
|
|
1561
|
+
function ColumnResizer(props) {
|
|
1562
|
+
const [local, domProps] = splitProps(props, [
|
|
1563
|
+
"column",
|
|
1564
|
+
"aria-label",
|
|
1565
|
+
"isDisabled",
|
|
1566
|
+
"onResizeStart",
|
|
1567
|
+
"onResize",
|
|
1568
|
+
"onResizeEnd",
|
|
1569
|
+
"class",
|
|
1570
|
+
"style",
|
|
1571
|
+
"slot",
|
|
1572
|
+
"children"
|
|
1573
|
+
]);
|
|
1574
|
+
const registerColumn = useContext(ResizableTableRegisterContext);
|
|
1575
|
+
if (registerColumn) registerColumn(local.column.key, { key: local.column.key });
|
|
1576
|
+
const resizeCtx = useContext(TableColumnResizeStateContext);
|
|
1577
|
+
const hasResizeContext = !!resizeCtx;
|
|
1578
|
+
const noopResizeState = {
|
|
1579
|
+
resizingColumn: () => null,
|
|
1580
|
+
columnWidths: () => /* @__PURE__ */ new Map(),
|
|
1581
|
+
startResize() {},
|
|
1582
|
+
endResize() {},
|
|
1583
|
+
updateResizedColumns(_key, _width) {
|
|
1584
|
+
return /* @__PURE__ */ new Map();
|
|
1585
|
+
},
|
|
1586
|
+
getColumnWidth() {
|
|
1587
|
+
return 0;
|
|
1588
|
+
},
|
|
1589
|
+
getColumnMinWidth() {
|
|
1590
|
+
return 75;
|
|
1591
|
+
},
|
|
1592
|
+
getColumnMaxWidth() {
|
|
1593
|
+
return Infinity;
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
const { isHovered, hoverProps } = createHover({ isDisabled: local.isDisabled ?? false });
|
|
1597
|
+
const [isFocused, setIsFocused] = createSignal(false);
|
|
1598
|
+
const columnResize = createTableColumnResize(() => ({
|
|
1599
|
+
column: local.column,
|
|
1600
|
+
"aria-label": local["aria-label"] ?? "Resizer",
|
|
1601
|
+
isDisabled: local.isDisabled,
|
|
1602
|
+
onResizeStart: (widths) => {
|
|
1603
|
+
resizeCtx?.getCallbacks?.().onResizeStart?.(widths);
|
|
1604
|
+
local.onResizeStart?.(widths);
|
|
1605
|
+
},
|
|
1606
|
+
onResize: (widths) => {
|
|
1607
|
+
resizeCtx?.getCallbacks?.().onResize?.(widths);
|
|
1608
|
+
local.onResize?.(widths);
|
|
1609
|
+
},
|
|
1610
|
+
onResizeEnd: (widths) => {
|
|
1611
|
+
resizeCtx?.getCallbacks?.().onResizeEnd?.(widths);
|
|
1612
|
+
local.onResizeEnd?.(widths);
|
|
1613
|
+
}
|
|
1614
|
+
}), () => resizeCtx?.getState() ?? noopResizeState);
|
|
1615
|
+
const renderValues = createMemo(() => ({
|
|
1616
|
+
isHovered: isHovered(),
|
|
1617
|
+
isFocused: isFocused(),
|
|
1618
|
+
isResizing: columnResize.isResizing(),
|
|
1619
|
+
resizableDirection: "both"
|
|
1620
|
+
}));
|
|
1621
|
+
const renderProps = useRenderProps({
|
|
1622
|
+
class: local.class,
|
|
1623
|
+
style: local.style,
|
|
1624
|
+
defaultClassName: "solidaria-Table-columnResizer"
|
|
1625
|
+
}, renderValues);
|
|
1626
|
+
const cleanHoverProps = () => {
|
|
1627
|
+
const { ref: _ref, ...rest } = hoverProps;
|
|
1628
|
+
return rest;
|
|
1629
|
+
};
|
|
1630
|
+
return (() => {
|
|
1631
|
+
var _el$32 = getNextElement(_tmpl$14), _el$34 = _el$32.firstChild, [_el$35, _co$3] = getNextMarker(_el$34.nextSibling), _el$36 = _el$35.nextSibling, [_el$37, _co$4] = getNextMarker(_el$36.nextSibling);
|
|
1632
|
+
spread(_el$32, mergeProps(domProps, () => columnResize.resizerProps, cleanHoverProps, {
|
|
1633
|
+
get ["class"]() {
|
|
1634
|
+
return renderProps.class();
|
|
1635
|
+
},
|
|
1636
|
+
get style() {
|
|
1637
|
+
return renderProps.style();
|
|
1638
|
+
},
|
|
1639
|
+
get ["data-hovered"]() {
|
|
1640
|
+
return isHovered() || void 0;
|
|
1641
|
+
},
|
|
1642
|
+
get ["data-resizing"]() {
|
|
1643
|
+
return columnResize.isResizing() || void 0;
|
|
1644
|
+
}
|
|
1645
|
+
}), false, true);
|
|
1646
|
+
insert(_el$32, createComponent(Show, {
|
|
1647
|
+
when: hasResizeContext,
|
|
1648
|
+
get children() {
|
|
1649
|
+
var _el$33 = getNextElement(_tmpl$13);
|
|
1650
|
+
spread(_el$33, mergeProps(() => columnResize.inputProps, {
|
|
1651
|
+
"onFocus": () => setIsFocused(true),
|
|
1652
|
+
"onBlur": () => setIsFocused(false)
|
|
1653
|
+
}), false, false);
|
|
1654
|
+
runHydrationEvents();
|
|
1655
|
+
return _el$33;
|
|
1656
|
+
}
|
|
1657
|
+
}), _el$35, _co$3);
|
|
1658
|
+
insert(_el$32, (() => {
|
|
1659
|
+
var _c$ = memo(() => typeof local.children === "function");
|
|
1660
|
+
return () => _c$() ? local.children(renderValues()) : local.children;
|
|
1661
|
+
})(), _el$37, _co$4);
|
|
1662
|
+
runHydrationEvents();
|
|
1663
|
+
return _el$32;
|
|
1664
|
+
})();
|
|
1665
|
+
}
|
|
1666
|
+
function ResizableTableContainer(props) {
|
|
1667
|
+
const [local, domProps] = splitProps(props, [
|
|
1668
|
+
"class",
|
|
1669
|
+
"style",
|
|
1670
|
+
"slot",
|
|
1671
|
+
"children",
|
|
1672
|
+
"columns",
|
|
1673
|
+
"onResizeStart",
|
|
1674
|
+
"onResize",
|
|
1675
|
+
"onResizeEnd"
|
|
1676
|
+
]);
|
|
1677
|
+
const [containerRef, setContainerRef] = createSignal(null);
|
|
1678
|
+
const [tableWidth, setTableWidth] = createSignal(0);
|
|
1679
|
+
createEffect(() => {
|
|
1680
|
+
const el = containerRef();
|
|
1681
|
+
if (!el) return;
|
|
1682
|
+
setTableWidth(el.clientWidth);
|
|
1683
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
1684
|
+
const observer = new ResizeObserver((entries) => {
|
|
1685
|
+
for (const entry of entries) setTableWidth(entry.contentRect.width);
|
|
1686
|
+
});
|
|
1687
|
+
observer.observe(el);
|
|
1688
|
+
onCleanup(() => observer.disconnect());
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
const [autoColumns, setAutoColumns] = createSignal(/* @__PURE__ */ new Map());
|
|
1692
|
+
const registerColumn = (key, def) => {
|
|
1693
|
+
setAutoColumns((prev) => {
|
|
1694
|
+
const next = new Map(prev);
|
|
1695
|
+
next.set(key, def);
|
|
1696
|
+
return next;
|
|
1697
|
+
});
|
|
1698
|
+
};
|
|
1699
|
+
const effectiveColumns = createMemo(() => {
|
|
1700
|
+
if (local.columns && local.columns.length > 0) return local.columns;
|
|
1701
|
+
return Array.from(autoColumns().values());
|
|
1702
|
+
});
|
|
1703
|
+
const effectiveWidth = createMemo(() => {
|
|
1704
|
+
const w = tableWidth();
|
|
1705
|
+
return w > 0 ? w : 800;
|
|
1706
|
+
});
|
|
1707
|
+
const resizeState = createMemo(() => {
|
|
1708
|
+
const cols = effectiveColumns();
|
|
1709
|
+
if (cols.length === 0) return null;
|
|
1710
|
+
return createTableColumnResizeState(() => ({
|
|
1711
|
+
tableWidth: effectiveWidth(),
|
|
1712
|
+
columns: cols
|
|
1713
|
+
}));
|
|
1714
|
+
});
|
|
1715
|
+
const contextValue = {
|
|
1716
|
+
getState: () => resizeState(),
|
|
1717
|
+
getCallbacks: () => ({
|
|
1718
|
+
onResizeStart: local.onResizeStart,
|
|
1719
|
+
onResize: local.onResize,
|
|
1720
|
+
onResizeEnd: local.onResizeEnd
|
|
1721
|
+
})
|
|
1722
|
+
};
|
|
1723
|
+
return createComponent(ResizableTableRegisterContext.Provider, {
|
|
1724
|
+
value: registerColumn,
|
|
1725
|
+
get children() {
|
|
1726
|
+
return createComponent(TableColumnResizeStateContext.Provider, {
|
|
1727
|
+
value: contextValue,
|
|
1728
|
+
get children() {
|
|
1729
|
+
var _el$38 = getNextElement(_tmpl$15);
|
|
1730
|
+
use(setContainerRef, _el$38);
|
|
1731
|
+
spread(_el$38, mergeProps(domProps, {
|
|
1732
|
+
get ["class"]() {
|
|
1733
|
+
return local.class ?? "solidaria-ResizableTableContainer";
|
|
1734
|
+
},
|
|
1735
|
+
get style() {
|
|
1736
|
+
return {
|
|
1737
|
+
position: "relative",
|
|
1738
|
+
overflow: "auto",
|
|
1739
|
+
...local.style
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
}), false, true);
|
|
1743
|
+
insert(_el$38, () => local.children);
|
|
1744
|
+
runHydrationEvents();
|
|
1745
|
+
return _el$38;
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
/** Internal context for ColumnResizer to register itself with ResizableTableContainer */
|
|
1752
|
+
const ResizableTableRegisterContext = createContext(null);
|
|
1753
|
+
function useTableOptions() {
|
|
1754
|
+
return useContext(TableContext);
|
|
1755
|
+
}
|
|
1756
|
+
//#endregion
|
|
1757
|
+
export { ColumnResizer, ResizableTableContainer, Table, TableBody, TableCell, TableColumn, TableColumnResizeStateContext, TableContext, TableFooter, TableHeader, TableLoadMoreItem, TableRow, TableRowContext, TableSelectAllCheckbox, TableSelectionCheckbox, TableStateContext, useTableOptions };
|
|
1758
|
+
|
|
1759
|
+
//# sourceMappingURL=Table.js.map
|