@dloizides/ui-tables 1.22.0 → 1.23.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/CHANGELOG.md +547 -538
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -381,6 +381,9 @@ function RowCells({
|
|
|
381
381
|
col.key
|
|
382
382
|
)) });
|
|
383
383
|
}
|
|
384
|
+
var RowPressContext = React2.createContext(void 0);
|
|
385
|
+
var RowPressProvider = RowPressContext.Provider;
|
|
386
|
+
var useRowPress = () => React2.useContext(RowPressContext);
|
|
384
387
|
var CHECK_GLYPH = "\u2713";
|
|
385
388
|
var MIXED_GLYPH = "\u2013";
|
|
386
389
|
var TRANSPARENT = "transparent";
|
|
@@ -500,6 +503,7 @@ function DataTableRow({
|
|
|
500
503
|
const isExpandable = renderRowDetail !== void 0;
|
|
501
504
|
const { selectable } = selection;
|
|
502
505
|
const isSelected = selectable && selection.isSelected(rowKey);
|
|
506
|
+
const pressRow = onRowPress === void 0 ? void 0 : () => onRowPress(row);
|
|
503
507
|
const a11y = {
|
|
504
508
|
accessibilityLabel: getRowAccessibilityLabel?.(row) ?? t(TABLE_I18N.rowLabel),
|
|
505
509
|
accessibilityHint: t(TABLE_I18N.rowHint),
|
|
@@ -539,8 +543,8 @@ function DataTableRow({
|
|
|
539
543
|
testID: rowID,
|
|
540
544
|
onHoverIn,
|
|
541
545
|
onHoverOut,
|
|
542
|
-
onPress:
|
|
543
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
546
|
+
onPress: pressRow,
|
|
547
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RowPressProvider, { value: pressRow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
548
|
RowCells,
|
|
545
549
|
{
|
|
546
550
|
columns,
|
|
@@ -552,7 +556,7 @@ function DataTableRow({
|
|
|
552
556
|
styleOverrides: o,
|
|
553
557
|
textColor: colors.text
|
|
554
558
|
}
|
|
555
|
-
)
|
|
559
|
+
) })
|
|
556
560
|
}
|
|
557
561
|
);
|
|
558
562
|
if (!isExpandable || !expanded) return rowNode;
|
|
@@ -2133,6 +2137,7 @@ var defaultAbsolute = (ms) => new Date(ms).toLocaleString();
|
|
|
2133
2137
|
function RelativeTime({ value, nowMs, strings, hint, formatAbsolute = defaultAbsolute, testID }) {
|
|
2134
2138
|
const { theme } = uiFeedback.useUi();
|
|
2135
2139
|
const [showAbsolute, setShowAbsolute] = React2.useState(false);
|
|
2140
|
+
const pressRow = useRowPress();
|
|
2136
2141
|
const ms = toEpochMs(value);
|
|
2137
2142
|
const relative = formatRelativeTime(value, nowMs, strings);
|
|
2138
2143
|
const absolute = ms === null ? relative : formatAbsolute(ms);
|
|
@@ -2143,7 +2148,10 @@ function RelativeTime({ value, nowMs, strings, hint, formatAbsolute = defaultAbs
|
|
|
2143
2148
|
accessibilityLabel: absolute,
|
|
2144
2149
|
accessibilityRole: "button",
|
|
2145
2150
|
disabled: ms === null,
|
|
2146
|
-
onPress: () =>
|
|
2151
|
+
onPress: () => {
|
|
2152
|
+
setShowAbsolute((current) => !current);
|
|
2153
|
+
pressRow?.();
|
|
2154
|
+
},
|
|
2147
2155
|
style: styles4.target,
|
|
2148
2156
|
testID,
|
|
2149
2157
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.text }, children: showAbsolute ? absolute : relative })
|