@dloizides/ui-tables 3.0.0 → 3.0.2
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/CHANGELOG.md +40 -0
- package/README.md +15 -0
- package/dist/index.js +22 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `DataTable` / `StatusLedger`: a clickable row (`onRowPress`, no `keyboardNavigation`) renders as a focusable `div` with `role="group"` instead of a native `<button>`, so an Edit or Delete button in a cell is no longer a button inside a button. The row keeps its pointer cursor, hover and pressed tint, focus ring and Enter to open; Space no longer opens it (Space belongs to button roles). Pressing a button inside the row calls only that button. ROW-OPEN-1 "Every list row opens its record".
|
|
8
|
+
|
|
9
|
+
## 3.0.1
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Peer and dev `@dloizides/ui-forms` raised to 1.31.0 (`DateInput`).
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `Filters`: the date filter renders inside the bar `Field` (control label voice, no extra 16px rhythm), so it lines up with the other fields in the bar. FINREG-DATE-2 "Every FinReg date field uses the shared input".
|
|
18
|
+
|
|
19
|
+
## 3.0.0
|
|
20
|
+
|
|
21
|
+
### Breaking
|
|
22
|
+
|
|
23
|
+
- `StatusLedger` props require `onRowPress` or `rowAction={{ none: '<reason>' }}` (`DataTableRowAction`) and forward it to every inner `DataTable`; `StatusLedgerProps` is now a type alias over `StatusLedgerBaseProps`. ROW-OPEN-1 "Every list row opens its record".
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- `DataTable`: the brand focus ring is drawn on the focused row frame on keyboard focus (it was on the inner pressable of a selectable row).
|
|
28
|
+
|
|
29
|
+
## 2.0.0
|
|
30
|
+
|
|
31
|
+
### Breaking
|
|
32
|
+
|
|
33
|
+
- `DataTableProps` require `onRowPress` or `rowAction={{ none: '<reason>' }}`; a table with neither no longer type-checks. ROW-OPEN-1 "Every list row opens its record".
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Clickable rows get a pointer cursor, a pressed brand tint and a brand focus ring; the hover tint is unchanged.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- The `dateRange` filter renders `DateRangeControl` from `@dloizides/ui-forms` (same testIDs); the local `DateRangeField` is gone. Peer and dev `@dloizides/ui-forms` raised to 1.30.0. FINREG-DATE-2 "Every FinReg date field uses the shared input".
|
|
42
|
+
|
|
3
43
|
## 1.29.1
|
|
4
44
|
|
|
5
45
|
### Changed
|
package/README.md
CHANGED
|
@@ -100,6 +100,21 @@ use `@dloizides/ui-layout`'s responsive `ModalDropdown` (modal on mobile/native)
|
|
|
100
100
|
/>
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
#### Row action (required)
|
|
104
|
+
|
|
105
|
+
Every `DataTable` (and `StatusLedger`) declares what a row does: pass `onRowPress` to open the
|
|
106
|
+
record, or `rowAction={{ none: '<reason>' }}` when a row truly opens nothing. A table with
|
|
107
|
+
neither does not type-check.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DataTable columns={columns} rows={rows} keyExtractor={(r) => r.id} onRowPress={(r) => open(r.id)} />
|
|
111
|
+
<DataTable columns={columns} rows={rows} keyExtractor={(r) => r.id} rowAction={{ none: 'read-only audit log' }} />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
A clickable row has a pointer cursor, hover and pressed tint, a focus ring, and opens on click
|
|
115
|
+
or Enter. It is a focusable `role="group"` element, not a `<button>`, so buttons in its cells
|
|
116
|
+
(Edit, Delete) are valid and pressing one runs only that button.
|
|
117
|
+
|
|
103
118
|
#### Expandable rows (optional)
|
|
104
119
|
|
|
105
120
|
For surfaces that open a full-width detail panel under a row (e.g. an audit log's
|
package/dist/index.js
CHANGED
|
@@ -560,7 +560,8 @@ function DataTableRow({
|
|
|
560
560
|
...selectable ? { "aria-selected": isSelected } : null,
|
|
561
561
|
// A navigable table is a real grid, so its rows are grid rows — selectable or not.
|
|
562
562
|
// `role` wins over `accessibilityRole` on RNW.
|
|
563
|
-
...keyboardNavigation ? { role: "row" } : null
|
|
563
|
+
...keyboardNavigation ? { role: "row" } : null,
|
|
564
|
+
...!keyboardNavigation && onRowPress ? { role: "group" } : null
|
|
564
565
|
};
|
|
565
566
|
const rowNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
566
567
|
TableRow,
|
|
@@ -1670,21 +1671,6 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1670
1671
|
}
|
|
1671
1672
|
);
|
|
1672
1673
|
}
|
|
1673
|
-
var NO_HINT = "";
|
|
1674
|
-
function SingleDateField({ field, barTestID, value, onChange, onSubmit, containerStyle }) {
|
|
1675
|
-
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1676
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: containerStyle, testID, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1677
|
-
uiForms.DateField,
|
|
1678
|
-
{
|
|
1679
|
-
accessibilityHint: field.accessibilityHint ?? NO_HINT,
|
|
1680
|
-
label: field.label,
|
|
1681
|
-
testID: `${testID}-input`,
|
|
1682
|
-
value,
|
|
1683
|
-
onChange,
|
|
1684
|
-
onSubmit
|
|
1685
|
-
}
|
|
1686
|
-
) });
|
|
1687
|
-
}
|
|
1688
1674
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1689
1675
|
const { theme } = uiFeedback.useUi();
|
|
1690
1676
|
const { colors } = theme;
|
|
@@ -1736,6 +1722,7 @@ function clampedMinWidth(minWidth) {
|
|
|
1736
1722
|
}
|
|
1737
1723
|
var EMPTY_RANGE = { from: "", to: "" };
|
|
1738
1724
|
var GROW_FLEX = 1;
|
|
1725
|
+
var NO_HINT = "";
|
|
1739
1726
|
function asString(value) {
|
|
1740
1727
|
return typeof value === "string" ? value : "";
|
|
1741
1728
|
}
|
|
@@ -1757,21 +1744,26 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1757
1744
|
return /* @__PURE__ */ jsxRuntime.jsx(BooleanField, { field, barTestID, value: asBool(raw), onChange: (v) => setField(field.key, v) });
|
|
1758
1745
|
}
|
|
1759
1746
|
const containerStyle = fieldContainerStyle(field);
|
|
1760
|
-
|
|
1761
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1762
|
-
SingleDateField,
|
|
1763
|
-
{
|
|
1764
|
-
barTestID,
|
|
1765
|
-
containerStyle,
|
|
1766
|
-
field,
|
|
1767
|
-
value: asString(raw),
|
|
1768
|
-
onChange: (v) => setField(field.key, v),
|
|
1769
|
-
onSubmit
|
|
1770
|
-
}
|
|
1771
|
-
);
|
|
1772
|
-
}
|
|
1747
|
+
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1773
1748
|
const body = (() => {
|
|
1774
1749
|
switch (field.kind) {
|
|
1750
|
+
case "date":
|
|
1751
|
+
return function renderDateInput(context) {
|
|
1752
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1753
|
+
uiForms.DateInput,
|
|
1754
|
+
{
|
|
1755
|
+
context,
|
|
1756
|
+
fieldProps: {
|
|
1757
|
+
accessibilityHint: field.accessibilityHint ?? NO_HINT,
|
|
1758
|
+
label: field.label,
|
|
1759
|
+
testID: `${testID}-input`,
|
|
1760
|
+
value: asString(raw),
|
|
1761
|
+
onChange: (v) => setField(field.key, v),
|
|
1762
|
+
onSubmit
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
);
|
|
1766
|
+
};
|
|
1775
1767
|
case "select":
|
|
1776
1768
|
if (renderSelect !== void 0) {
|
|
1777
1769
|
return renderSelect({
|
|
@@ -1837,7 +1829,7 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1837
1829
|
containerStyle,
|
|
1838
1830
|
label: field.label,
|
|
1839
1831
|
labelVariant: "control",
|
|
1840
|
-
testID
|
|
1832
|
+
testID,
|
|
1841
1833
|
children: body
|
|
1842
1834
|
}
|
|
1843
1835
|
);
|