@dloizides/ui-tables 3.3.0 → 3.5.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 +1 -0
- package/dist/index.d.mts +97 -1
- package/dist/index.d.ts +97 -1
- package/dist/index.js +271 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +257 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1693,6 +1693,10 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1693
1693
|
}
|
|
1694
1694
|
);
|
|
1695
1695
|
}
|
|
1696
|
+
function inputTestID(field, barTestID) {
|
|
1697
|
+
const custom = field.kind === "text" ? field.inputTestID : void 0;
|
|
1698
|
+
return custom ?? `${field.testID ?? fieldTestID(barTestID, field.key)}-input`;
|
|
1699
|
+
}
|
|
1696
1700
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1697
1701
|
const { theme } = uiFeedback.useUi();
|
|
1698
1702
|
const { colors } = theme;
|
|
@@ -1700,7 +1704,7 @@ function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
|
1700
1704
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1701
1705
|
label: field.label,
|
|
1702
1706
|
hint: field.accessibilityHint,
|
|
1703
|
-
testID:
|
|
1707
|
+
testID: inputTestID(field, barTestID)
|
|
1704
1708
|
});
|
|
1705
1709
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1706
1710
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2053,6 +2057,70 @@ var TONE_GLYPH = {
|
|
|
2053
2057
|
};
|
|
2054
2058
|
var ledgerSectionTestID = (testID, section) => `${testID}-section-${section}`;
|
|
2055
2059
|
var ledgerSortDirectionTestID = (testID) => `${testID}-sort-direction`;
|
|
2060
|
+
|
|
2061
|
+
// src/StatusLedger/SortDirection.ts
|
|
2062
|
+
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
|
|
2063
|
+
SortDirection2["Asc"] = "asc";
|
|
2064
|
+
SortDirection2["Desc"] = "desc";
|
|
2065
|
+
return SortDirection2;
|
|
2066
|
+
})(SortDirection || {});
|
|
2067
|
+
function LedgerFilterBar({ view, labels, resultsCount, testID }) {
|
|
2068
|
+
const ascending = view.direction === "asc" /* Asc */;
|
|
2069
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2070
|
+
Filters,
|
|
2071
|
+
{
|
|
2072
|
+
actions: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2073
|
+
ActionButton,
|
|
2074
|
+
{
|
|
2075
|
+
hint: labels.sortDirectionHint,
|
|
2076
|
+
label: ascending ? labels.sortAscending : labels.sortDescending,
|
|
2077
|
+
onPress: view.toggleDirection,
|
|
2078
|
+
testID: ledgerSortDirectionTestID(testID),
|
|
2079
|
+
tone: "ghost"
|
|
2080
|
+
}
|
|
2081
|
+
),
|
|
2082
|
+
clearHint: labels.clearHint,
|
|
2083
|
+
clearLabel: labels.clear,
|
|
2084
|
+
fields: view.fields,
|
|
2085
|
+
onChange: view.setValues,
|
|
2086
|
+
onClear: view.clear,
|
|
2087
|
+
resultsCount,
|
|
2088
|
+
resultsLabel: labels.results,
|
|
2089
|
+
testID: `${testID}-filters`,
|
|
2090
|
+
values: view.values
|
|
2091
|
+
}
|
|
2092
|
+
);
|
|
2093
|
+
}
|
|
2094
|
+
var GAP = 12;
|
|
2095
|
+
var HEADING_FONT = 15;
|
|
2096
|
+
var HEADING_WEIGHT = "700";
|
|
2097
|
+
var styles2 = reactNative.StyleSheet.create({
|
|
2098
|
+
root: { gap: GAP },
|
|
2099
|
+
heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
|
|
2100
|
+
note: { paddingVertical: GAP }
|
|
2101
|
+
});
|
|
2102
|
+
var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
|
|
2103
|
+
function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger, heading }) {
|
|
2104
|
+
const { theme } = uiFeedback.useUi();
|
|
2105
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles2.root, testID, children: [
|
|
2106
|
+
heading ?? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles2.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
|
|
2107
|
+
rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2108
|
+
DataTable,
|
|
2109
|
+
{
|
|
2110
|
+
columns,
|
|
2111
|
+
expandedRowKeys: expandedKeys(ledger.expandedRowKey),
|
|
2112
|
+
getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2113
|
+
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2114
|
+
keyExtractor: ledger.keyExtractor,
|
|
2115
|
+
...pickRowAction(ledger),
|
|
2116
|
+
renderRowDetail: ledger.renderRowDetail,
|
|
2117
|
+
rows,
|
|
2118
|
+
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
2119
|
+
testID: `${testID}-table`
|
|
2120
|
+
}
|
|
2121
|
+
)
|
|
2122
|
+
] });
|
|
2123
|
+
}
|
|
2056
2124
|
var PILL_RADIUS2 = 999;
|
|
2057
2125
|
var PILL_BORDER = 1;
|
|
2058
2126
|
var PILL_PAD_H = 8;
|
|
@@ -2060,7 +2128,7 @@ var PILL_PAD_V = 2;
|
|
|
2060
2128
|
var PILL_GAP = 6;
|
|
2061
2129
|
var PILL_FONT = 13;
|
|
2062
2130
|
var PILL_WEIGHT = "600";
|
|
2063
|
-
var
|
|
2131
|
+
var styles3 = reactNative.StyleSheet.create({
|
|
2064
2132
|
pill: {
|
|
2065
2133
|
flexDirection: "row",
|
|
2066
2134
|
alignItems: "center",
|
|
@@ -2074,19 +2142,12 @@ var styles2 = reactNative.StyleSheet.create({
|
|
|
2074
2142
|
text: { fontSize: PILL_FONT, fontWeight: PILL_WEIGHT }
|
|
2075
2143
|
});
|
|
2076
2144
|
function StatusPill({ label, tone, color, testID }) {
|
|
2077
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityLabel: label, accessibilityRole: "text", style: [
|
|
2078
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [
|
|
2079
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityLabel: label, accessibilityRole: "text", style: [styles3.pill, { borderColor: color }], testID, children: [
|
|
2146
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [styles3.text, { color }], children: TONE_GLYPH[tone] }),
|
|
2147
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.text, { color }], children: label })
|
|
2080
2148
|
] });
|
|
2081
2149
|
}
|
|
2082
2150
|
|
|
2083
|
-
// src/StatusLedger/SortDirection.ts
|
|
2084
|
-
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
|
|
2085
|
-
SortDirection2["Asc"] = "asc";
|
|
2086
|
-
SortDirection2["Desc"] = "desc";
|
|
2087
|
-
return SortDirection2;
|
|
2088
|
-
})(SortDirection || {});
|
|
2089
|
-
|
|
2090
2151
|
// src/StatusLedger/utils/ledgerLogic.ts
|
|
2091
2152
|
var BEFORE = -1;
|
|
2092
2153
|
var AFTER = 1;
|
|
@@ -2199,68 +2260,17 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
|
|
|
2199
2260
|
LedgerLayout2["Feed"] = "feed";
|
|
2200
2261
|
return LedgerLayout2;
|
|
2201
2262
|
})(LedgerLayout || {});
|
|
2202
|
-
var
|
|
2203
|
-
var
|
|
2204
|
-
|
|
2205
|
-
var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
|
|
2206
|
-
var styles3 = reactNative.StyleSheet.create({
|
|
2207
|
-
root: { gap: GAP },
|
|
2208
|
-
heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
|
|
2209
|
-
note: { paddingVertical: GAP }
|
|
2263
|
+
var GAP2 = 12;
|
|
2264
|
+
var styles4 = reactNative.StyleSheet.create({
|
|
2265
|
+
root: { gap: GAP2 }
|
|
2210
2266
|
});
|
|
2211
|
-
function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
|
|
2212
|
-
const { theme } = uiFeedback.useUi();
|
|
2213
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.root, testID, children: [
|
|
2214
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles3.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
|
|
2215
|
-
rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2216
|
-
DataTable,
|
|
2217
|
-
{
|
|
2218
|
-
columns,
|
|
2219
|
-
expandedRowKeys: expandedKeys(ledger.expandedRowKey),
|
|
2220
|
-
getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2221
|
-
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2222
|
-
keyExtractor: ledger.keyExtractor,
|
|
2223
|
-
...pickRowAction(ledger),
|
|
2224
|
-
renderRowDetail: ledger.renderRowDetail,
|
|
2225
|
-
rows,
|
|
2226
|
-
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
2227
|
-
testID: `${testID}-table`
|
|
2228
|
-
}
|
|
2229
|
-
)
|
|
2230
|
-
] });
|
|
2231
|
-
}
|
|
2232
2267
|
function StatusLedger(props) {
|
|
2233
2268
|
const { labels, layout = "auto" /* Auto */, breakpoint = CARD_STACK_BREAKPOINT, loading, testID = STATUS_LEDGER_TEST_ID } = props;
|
|
2234
2269
|
const { width } = reactNative.useWindowDimensions();
|
|
2235
2270
|
const view = useLedgerView(props);
|
|
2236
2271
|
const feed = layout === "feed" /* Feed */ || layout === "auto" /* Auto */ && width < breakpoint;
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
ActionButton,
|
|
2240
|
-
{
|
|
2241
|
-
hint: labels.sortDirectionHint,
|
|
2242
|
-
label: ascending ? labels.sortAscending : labels.sortDescending,
|
|
2243
|
-
onPress: view.toggleDirection,
|
|
2244
|
-
testID: ledgerSortDirectionTestID(testID),
|
|
2245
|
-
tone: "ghost"
|
|
2246
|
-
}
|
|
2247
|
-
);
|
|
2248
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.root, testID, children: [
|
|
2249
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2250
|
-
Filters,
|
|
2251
|
-
{
|
|
2252
|
-
actions: directionButton,
|
|
2253
|
-
clearHint: labels.clearHint,
|
|
2254
|
-
clearLabel: labels.clear,
|
|
2255
|
-
fields: view.fields,
|
|
2256
|
-
onChange: view.setValues,
|
|
2257
|
-
onClear: view.clear,
|
|
2258
|
-
resultsCount: view.visible.length,
|
|
2259
|
-
resultsLabel: labels.results,
|
|
2260
|
-
testID: `${testID}-filters`,
|
|
2261
|
-
values: view.values
|
|
2262
|
-
}
|
|
2263
|
-
),
|
|
2272
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles4.root, testID, children: [
|
|
2273
|
+
/* @__PURE__ */ jsxRuntime.jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID, view }),
|
|
2264
2274
|
feed && !loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2265
2275
|
/* @__PURE__ */ jsxRuntime.jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.allClear, ledger: props, rows: view.split.attention, testID: ledgerSectionTestID(testID, "attention"), title: labels.needsLook }),
|
|
2266
2276
|
/* @__PURE__ */ jsxRuntime.jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.empty, ledger: props, rows: view.split.rest, testID: ledgerSectionTestID(testID, "rest"), title: labels.everythingElse })
|
|
@@ -2310,7 +2320,7 @@ function formatRelativeTime(value, nowMs, strings) {
|
|
|
2310
2320
|
if (distance < MS_PER_DAY) return fill(units.hours, Math.floor(distance / MS_PER_HOUR));
|
|
2311
2321
|
return fill(units.days, Math.floor(distance / MS_PER_DAY));
|
|
2312
2322
|
}
|
|
2313
|
-
var
|
|
2323
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
2314
2324
|
target: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, justifyContent: "center" }
|
|
2315
2325
|
});
|
|
2316
2326
|
var defaultAbsolute = (ms) => new Date(ms).toLocaleString();
|
|
@@ -2332,13 +2342,175 @@ function RelativeTime({ value, nowMs, strings, hint, formatAbsolute = defaultAbs
|
|
|
2332
2342
|
setShowAbsolute((current) => !current);
|
|
2333
2343
|
pressRow?.();
|
|
2334
2344
|
},
|
|
2335
|
-
style:
|
|
2345
|
+
style: styles5.target,
|
|
2336
2346
|
testID,
|
|
2337
2347
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.text }, children: showAbsolute ? absolute : relative })
|
|
2338
2348
|
}
|
|
2339
2349
|
);
|
|
2340
2350
|
}
|
|
2341
2351
|
|
|
2352
|
+
// src/StatusLedger/DurationUnit.ts
|
|
2353
|
+
var DurationUnit = /* @__PURE__ */ ((DurationUnit2) => {
|
|
2354
|
+
DurationUnit2["Minute"] = "minute";
|
|
2355
|
+
DurationUnit2["Hour"] = "hour";
|
|
2356
|
+
DurationUnit2["Day"] = "day";
|
|
2357
|
+
return DurationUnit2;
|
|
2358
|
+
})(DurationUnit || {});
|
|
2359
|
+
|
|
2360
|
+
// src/StatusLedger/utils/duration.ts
|
|
2361
|
+
var MS_PER_SECOND2 = 1e3;
|
|
2362
|
+
var SECONDS_PER_MINUTE2 = 60;
|
|
2363
|
+
var MINUTES_PER_HOUR2 = 60;
|
|
2364
|
+
var HOURS_PER_DAY2 = 24;
|
|
2365
|
+
var MS_PER_MINUTE2 = MS_PER_SECOND2 * SECONDS_PER_MINUTE2;
|
|
2366
|
+
var MS_PER_HOUR2 = MS_PER_MINUTE2 * MINUTES_PER_HOUR2;
|
|
2367
|
+
var MS_PER_DAY2 = MS_PER_HOUR2 * HOURS_PER_DAY2;
|
|
2368
|
+
var TOKEN = /\{\{(\w+)\}\}/g;
|
|
2369
|
+
function fillTemplate(template, values) {
|
|
2370
|
+
return template.replace(TOKEN, (whole, key) => values[key] ?? whole);
|
|
2371
|
+
}
|
|
2372
|
+
var fillCount = (template, count) => fillTemplate(template, { n: String(count) });
|
|
2373
|
+
function elapsedMs(start, nowMs) {
|
|
2374
|
+
const ms = toEpochMs(start);
|
|
2375
|
+
return ms === null ? null : Math.max(0, nowMs - ms);
|
|
2376
|
+
}
|
|
2377
|
+
function formatDuration(durationMs, strings, largestUnit = "day" /* Day */) {
|
|
2378
|
+
if (durationMs === null) return strings.unknown;
|
|
2379
|
+
if (durationMs < MS_PER_MINUTE2) return strings.lessThanMinute;
|
|
2380
|
+
const inMinutes = largestUnit === "minute" /* Minute */ || durationMs < MS_PER_HOUR2;
|
|
2381
|
+
if (inMinutes) return fillCount(strings.minutes, Math.floor(durationMs / MS_PER_MINUTE2));
|
|
2382
|
+
const inHours = largestUnit === "hour" /* Hour */ || durationMs < MS_PER_DAY2;
|
|
2383
|
+
if (inHours) return fillCount(strings.hours, Math.floor(durationMs / MS_PER_HOUR2));
|
|
2384
|
+
return fillCount(strings.days, Math.floor(durationMs / MS_PER_DAY2));
|
|
2385
|
+
}
|
|
2386
|
+
function ageFraction(ageMs, limitMs) {
|
|
2387
|
+
if (ageMs === null) return 0;
|
|
2388
|
+
if (limitMs <= 0) return 1;
|
|
2389
|
+
return Math.min(1, Math.max(0, ageMs / limitMs));
|
|
2390
|
+
}
|
|
2391
|
+
var AGE_FONT = 14;
|
|
2392
|
+
var AGE_WEIGHT = "600";
|
|
2393
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
2394
|
+
text: { fontSize: AGE_FONT, fontWeight: AGE_WEIGHT, fontVariant: ["tabular-nums"] }
|
|
2395
|
+
});
|
|
2396
|
+
function AgeLabel({ ageMs, strings, largestUnit = "day" /* Day */, color, testID }) {
|
|
2397
|
+
const { theme } = uiFeedback.useUi();
|
|
2398
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.text, { color: color ?? theme.colors.text }], testID, children: formatDuration(ageMs, strings, largestUnit) });
|
|
2399
|
+
}
|
|
2400
|
+
var BAR_HEIGHT = 6;
|
|
2401
|
+
var BAR_RADIUS = 3;
|
|
2402
|
+
var GAP3 = 8;
|
|
2403
|
+
var LABEL_FONT = 13;
|
|
2404
|
+
var PERCENT = 100;
|
|
2405
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
2406
|
+
row: { flexDirection: "row", alignItems: "center", gap: GAP3, flexGrow: 1 },
|
|
2407
|
+
track: { flexGrow: 1, flexShrink: 1, height: BAR_HEIGHT, borderRadius: BAR_RADIUS, overflow: "hidden" },
|
|
2408
|
+
fill: { height: BAR_HEIGHT, borderRadius: BAR_RADIUS },
|
|
2409
|
+
label: { fontSize: LABEL_FONT, fontVariant: ["tabular-nums"] }
|
|
2410
|
+
});
|
|
2411
|
+
function AgeBar({ fraction, color, label, testID }) {
|
|
2412
|
+
const { theme } = uiFeedback.useUi();
|
|
2413
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.row, testID, children: [
|
|
2414
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, style: [styles7.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.fill, { width: `${Math.round(fraction * PERCENT)}%`, backgroundColor: color }] }) }),
|
|
2415
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.label, { color: theme.colors.text }], children: label })
|
|
2416
|
+
] });
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
// src/StatusLedger/utils/ageBands.ts
|
|
2420
|
+
var oldestFloorFirst = (bands) => [...bands].sort((a, b) => b.minAgeMs - a.minAgeMs);
|
|
2421
|
+
function assignAgeBand(ageMs, bands) {
|
|
2422
|
+
const ordered = oldestFloorFirst(bands);
|
|
2423
|
+
const youngest = ordered[ordered.length - 1];
|
|
2424
|
+
if (ageMs === null) return youngest;
|
|
2425
|
+
return ordered.find((band) => ageMs >= band.minAgeMs) ?? youngest;
|
|
2426
|
+
}
|
|
2427
|
+
function groupByAgeBand(rows, ageOf, bands) {
|
|
2428
|
+
return oldestFloorFirst(bands).map((band) => ({ band, rows: rows.filter((row) => assignAgeBand(ageOf(row), bands)?.key === band.key) })).filter((group) => group.rows.length > 0);
|
|
2429
|
+
}
|
|
2430
|
+
function sortOldestFirst(rows, ageOf) {
|
|
2431
|
+
return sortLedgerRows(rows, ageOf, "desc" /* Desc */);
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
// src/WorkQueue/constants.ts
|
|
2435
|
+
var WORK_QUEUE_TEST_ID = "ui-work-queue";
|
|
2436
|
+
var AGE_COLUMN_KEY = "age";
|
|
2437
|
+
var AGE_MIN_WIDTH = 88;
|
|
2438
|
+
var AGE_BAR_MIN_WIDTH = 200;
|
|
2439
|
+
var EMPTY_QUEUE_NO_ROW_ACTION = "empty or loading work queue: there is no row to open";
|
|
2440
|
+
var workQueueBandTestID = (testID, bandKey) => `${testID}-band-${bandKey}`;
|
|
2441
|
+
var workQueueLedgerTestID = (testID) => `${testID}-ledger`;
|
|
2442
|
+
var GAP4 = 12;
|
|
2443
|
+
var COUNT_FONT = 13;
|
|
2444
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
2445
|
+
root: { gap: GAP4 },
|
|
2446
|
+
heading: { flexDirection: "row", alignItems: "center", gap: GAP4 },
|
|
2447
|
+
count: { fontSize: COUNT_FONT }
|
|
2448
|
+
});
|
|
2449
|
+
function AgeBandQueue({ ledger, ageOf, bands, bandCountLabel, testID }) {
|
|
2450
|
+
const { theme } = uiFeedback.useUi();
|
|
2451
|
+
const view = useLedgerView(ledger);
|
|
2452
|
+
const toneColor = useToneColor(ledger.toneColors);
|
|
2453
|
+
const groups = React2.useMemo(() => groupByAgeBand(view.visible, ageOf, bands), [view.visible, ageOf, bands]);
|
|
2454
|
+
const { labels } = ledger;
|
|
2455
|
+
const nothingToGroup = ledger.loading === true || groups.length === 0;
|
|
2456
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.root, testID, children: [
|
|
2457
|
+
/* @__PURE__ */ jsxRuntime.jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID: ledger.testID, view }),
|
|
2458
|
+
nothingToGroup ? /* @__PURE__ */ jsxRuntime.jsx(DataTable, { columns: view.tableColumns, emptyLabel: labels.empty, keyExtractor: ledger.keyExtractor, loading: ledger.loading, rowAction: { none: EMPTY_QUEUE_NO_ROW_ACTION }, rows: [], testID: `${ledger.testID}-table` }) : groups.map(({ band, rows }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2459
|
+
LedgerSection,
|
|
2460
|
+
{
|
|
2461
|
+
columns: view.tableColumns,
|
|
2462
|
+
emptyLabel: labels.empty,
|
|
2463
|
+
heading: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityRole: "header", style: styles8.heading, children: [
|
|
2464
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusPill, { color: toneColor(band.tone), label: band.label, tone: band.tone }),
|
|
2465
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.count, { color: theme.colors.textSecondary }], children: fillTemplate(bandCountLabel, { n: String(rows.length) }) })
|
|
2466
|
+
] }),
|
|
2467
|
+
ledger,
|
|
2468
|
+
rows,
|
|
2469
|
+
testID: workQueueBandTestID(testID, band.key),
|
|
2470
|
+
title: band.label
|
|
2471
|
+
},
|
|
2472
|
+
band.key
|
|
2473
|
+
))
|
|
2474
|
+
] });
|
|
2475
|
+
}
|
|
2476
|
+
function AgeLabelCell({ ageMs, color, strings, largestUnit }) {
|
|
2477
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgeLabel, { ageMs, color, largestUnit, strings });
|
|
2478
|
+
}
|
|
2479
|
+
function AgeBarCell({ ageMs, color, strings, limitMs, ageOfLimit, largestUnit }) {
|
|
2480
|
+
const label = fillTemplate(ageOfLimit, { age: formatDuration(ageMs, strings, largestUnit), limit: formatDuration(limitMs, strings, largestUnit) });
|
|
2481
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgeBar, { color, fraction: ageFraction(ageMs, limitMs), label });
|
|
2482
|
+
}
|
|
2483
|
+
function buildAgeColumn(options) {
|
|
2484
|
+
const { Cell, minWidth, ageOf, bands, strings, labels, limitMs, toneColor, largestUnit } = options;
|
|
2485
|
+
const render = (row) => {
|
|
2486
|
+
const age = ageOf(row);
|
|
2487
|
+
const color = toneColor(assignAgeBand(age, bands)?.tone ?? "neutral" /* Neutral */);
|
|
2488
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Cell, { ageMs: age, ageOfLimit: labels.ageOfLimit, color, largestUnit, limitMs, strings });
|
|
2489
|
+
};
|
|
2490
|
+
return { key: AGE_COLUMN_KEY, header: labels.age, minWidth, sortValue: ageOf, render };
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
// src/WorkQueue/WorkQueueVariant.ts
|
|
2494
|
+
var WorkQueueVariant = /* @__PURE__ */ ((WorkQueueVariant2) => {
|
|
2495
|
+
WorkQueueVariant2["Table"] = "table";
|
|
2496
|
+
WorkQueueVariant2["Bands"] = "bands";
|
|
2497
|
+
WorkQueueVariant2["Bar"] = "bar";
|
|
2498
|
+
return WorkQueueVariant2;
|
|
2499
|
+
})(WorkQueueVariant || {});
|
|
2500
|
+
function WorkQueue(props) {
|
|
2501
|
+
const { ledger, getStartedAt, nowMs, bands, durationStrings, labels, variant = "bands" /* Bands */, limitMs, largestUnit, testID = WORK_QUEUE_TEST_ID } = props;
|
|
2502
|
+
const toneColor = useToneColor(ledger.toneColors);
|
|
2503
|
+
const ageOf = React2.useCallback((row) => elapsedMs(getStartedAt(row), nowMs), [getStartedAt, nowMs]);
|
|
2504
|
+
const limit = limitMs ?? Math.max(0, ...bands.map((band) => band.minAgeMs));
|
|
2505
|
+
const queueLedger = React2.useMemo(() => {
|
|
2506
|
+
const asBar = variant === "bar" /* Bar */;
|
|
2507
|
+
const ageColumn = buildAgeColumn({ Cell: asBar ? AgeBarCell : AgeLabelCell, minWidth: asBar ? AGE_BAR_MIN_WIDTH : AGE_MIN_WIDTH, ageOf, bands, strings: durationStrings, labels, limitMs: limit, toneColor, largestUnit });
|
|
2508
|
+
return { ...ledger, rows: sortOldestFirst(ledger.rows, ageOf), columns: [ageColumn, ...ledger.columns], testID: workQueueLedgerTestID(testID) };
|
|
2509
|
+
}, [ledger, ageOf, bands, durationStrings, labels, limit, toneColor, largestUnit, variant, testID]);
|
|
2510
|
+
if (variant === "bands" /* Bands */) return /* @__PURE__ */ jsxRuntime.jsx(AgeBandQueue, { ageOf, bandCountLabel: labels.bandCount, bands, ledger: queueLedger, testID });
|
|
2511
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID, children: /* @__PURE__ */ jsxRuntime.jsx(StatusLedger, { ...queueLedger }) });
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2342
2514
|
// src/MonthStatusGrid/MonthGridColumns.ts
|
|
2343
2515
|
var MonthGridColumns = /* @__PURE__ */ ((MonthGridColumns2) => {
|
|
2344
2516
|
MonthGridColumns2[MonthGridColumns2["Twelve"] = 12] = "Twelve";
|
|
@@ -2370,7 +2542,7 @@ var CELL_INNER_GAP = 4;
|
|
|
2370
2542
|
var LABEL_SIZE = 14;
|
|
2371
2543
|
var SELECTED_BORDER = 2;
|
|
2372
2544
|
var COLOR_STEP = "500";
|
|
2373
|
-
var
|
|
2545
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
2374
2546
|
grid: { gap: GRID_GAP },
|
|
2375
2547
|
row: { flexDirection: "row", gap: GRID_GAP },
|
|
2376
2548
|
filler: { flex: 1 },
|
|
@@ -2402,16 +2574,16 @@ var GridCell = ({ cell, isSelected, onSelect, hint, testID }) => {
|
|
|
2402
2574
|
"aria-pressed": isSelected,
|
|
2403
2575
|
onPress: () => onSelect(cell.id),
|
|
2404
2576
|
style: [
|
|
2405
|
-
|
|
2577
|
+
styles9.cell,
|
|
2406
2578
|
{ backgroundColor: isSelected ? colors.background : colors.surface, borderColor: colors.border },
|
|
2407
|
-
cell.dashed === true &&
|
|
2408
|
-
isSelected &&
|
|
2579
|
+
cell.dashed === true && styles9.dashed,
|
|
2580
|
+
isSelected && styles9.selected,
|
|
2409
2581
|
isSelected && { borderColor: theme.palette.primary[COLOR_STEP] }
|
|
2410
2582
|
],
|
|
2411
2583
|
testID,
|
|
2412
2584
|
children: [
|
|
2413
2585
|
cell.icon !== void 0 && cell.icon !== null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, children: cell.icon }) : null,
|
|
2414
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2586
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.label, { color: colors.text }], children: cell.label })
|
|
2415
2587
|
]
|
|
2416
2588
|
}
|
|
2417
2589
|
);
|
|
@@ -2431,7 +2603,7 @@ var MonthStatusGrid = ({
|
|
|
2431
2603
|
const fitted = fitMonthGridColumns(columns, measuredWidth ?? windowWidth, GRID_GAP);
|
|
2432
2604
|
const rows = React2.useMemo(() => chunkIntoRows(cells, fitted), [cells, fitted]);
|
|
2433
2605
|
const onLayout = (event) => setMeasuredWidth(event.nativeEvent.layout.width);
|
|
2434
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style:
|
|
2606
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style: styles9.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.row, testID: `${testID}-row`, children: [
|
|
2435
2607
|
row.map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2436
2608
|
GridCell,
|
|
2437
2609
|
{
|
|
@@ -2443,7 +2615,7 @@ var MonthStatusGrid = ({
|
|
|
2443
2615
|
},
|
|
2444
2616
|
cell.id
|
|
2445
2617
|
)),
|
|
2446
|
-
Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2618
|
+
Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles9.filler }, index))
|
|
2447
2619
|
] }, row[0]?.id)) });
|
|
2448
2620
|
};
|
|
2449
2621
|
|
|
@@ -2484,7 +2656,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2484
2656
|
const { width } = reactNative.useWindowDimensions();
|
|
2485
2657
|
const panelWidth = Math.min(PANEL_MAX_WIDTH, Math.round(width * PANEL_SCREEN_SHARE));
|
|
2486
2658
|
const focusTitleOnOpen = React2.useCallback((node) => node?.focus(), []);
|
|
2487
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.root, children: [
|
|
2488
2660
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2489
2661
|
reactNative.Pressable,
|
|
2490
2662
|
{
|
|
@@ -2500,11 +2672,11 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2500
2672
|
reactNative.View,
|
|
2501
2673
|
{
|
|
2502
2674
|
accessibilityViewIsModal: true,
|
|
2503
|
-
style: [
|
|
2675
|
+
style: [styles10.panel, { width: panelWidth, backgroundColor: theme.colors.surface, borderColor: theme.colors.border }],
|
|
2504
2676
|
testID,
|
|
2505
2677
|
children: [
|
|
2506
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2507
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ref: focusTitleOnOpen, focusable: true, style:
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.header, children: [
|
|
2679
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ref: focusTitleOnOpen, focusable: true, style: styles10.titleBox, testID: `${testID}-title`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles10.title, { color: theme.colors.text }], children: title }) }),
|
|
2508
2680
|
/* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: closeLabel, hint: closeHint, tone: "primary", onPress: onClose, testID: `${testID}-close` })
|
|
2509
2681
|
] }),
|
|
2510
2682
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children })
|
|
@@ -2513,7 +2685,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2513
2685
|
)
|
|
2514
2686
|
] }) });
|
|
2515
2687
|
}
|
|
2516
|
-
var
|
|
2688
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
2517
2689
|
root: { flex: 1, flexDirection: "row", justifyContent: "flex-end" },
|
|
2518
2690
|
panel: { height: "100%", padding: PANEL_PAD, borderLeftWidth: PANEL_BORDER },
|
|
2519
2691
|
header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: HEADER_GAP, marginBottom: HEADER_BOTTOM },
|
|
@@ -2663,7 +2835,7 @@ function ReportFilters({
|
|
|
2663
2835
|
const isCompact = compact ?? width < CARD_STACK_BREAKPOINT;
|
|
2664
2836
|
const renderBar = (barTestID, barActions) => /* @__PURE__ */ jsxRuntime.jsx(Filters, { fields, values, onChange: handleChange, actions: barActions, renderSelect, testID: barTestID });
|
|
2665
2837
|
if (!isCompact) return renderBar(testID, actions);
|
|
2666
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2838
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.compactRow, testID, children: [
|
|
2667
2839
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2668
2840
|
ActionButton,
|
|
2669
2841
|
{
|
|
@@ -2689,7 +2861,7 @@ function ReportFilters({
|
|
|
2689
2861
|
)
|
|
2690
2862
|
] });
|
|
2691
2863
|
}
|
|
2692
|
-
var
|
|
2864
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
2693
2865
|
compactRow: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: COMPACT_GAP }
|
|
2694
2866
|
});
|
|
2695
2867
|
function useReportFilterQuery({
|
|
@@ -2828,12 +3000,15 @@ Object.defineProperty(exports, "suggestOptions", {
|
|
|
2828
3000
|
enumerable: true,
|
|
2829
3001
|
get: function () { return uiForms.suggestOptions; }
|
|
2830
3002
|
});
|
|
3003
|
+
exports.AgeBar = AgeBar;
|
|
3004
|
+
exports.AgeLabel = AgeLabel;
|
|
2831
3005
|
exports.CARD_STACK_BREAKPOINT = CARD_STACK_BREAKPOINT;
|
|
2832
3006
|
exports.DEFAULT_FETCH_CONCURRENCY = DEFAULT_FETCH_CONCURRENCY;
|
|
2833
3007
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
2834
3008
|
exports.DEFAULT_PAGE_SIZE_OPTIONS = DEFAULT_PAGE_SIZE_OPTIONS;
|
|
2835
3009
|
exports.DEFAULT_REPORT_QUERY_KEYS = DEFAULT_REPORT_QUERY_KEYS;
|
|
2836
3010
|
exports.DataTable = DataTable;
|
|
3011
|
+
exports.DurationUnit = DurationUnit;
|
|
2837
3012
|
exports.EMPTY_REPORT_FILTERS = EMPTY_REPORT_FILTERS;
|
|
2838
3013
|
exports.EXPORT_CSV_TEST_ID = EXPORT_CSV_TEST_ID;
|
|
2839
3014
|
exports.ExportCsvAction = ExportCsvAction;
|
|
@@ -2864,19 +3039,28 @@ exports.StatusPill = StatusPill;
|
|
|
2864
3039
|
exports.StatusTone = StatusTone;
|
|
2865
3040
|
exports.TABLE_I18N = TABLE_I18N;
|
|
2866
3041
|
exports.TABLE_TEST_IDS = TABLE_TEST_IDS;
|
|
3042
|
+
exports.WORK_QUEUE_TEST_ID = WORK_QUEUE_TEST_ID;
|
|
3043
|
+
exports.WorkQueue = WorkQueue;
|
|
3044
|
+
exports.WorkQueueVariant = WorkQueueVariant;
|
|
3045
|
+
exports.ageFraction = ageFraction;
|
|
2867
3046
|
exports.applyTestID = applyTestID;
|
|
3047
|
+
exports.assignAgeBand = assignAgeBand;
|
|
2868
3048
|
exports.buildReportFields = buildReportFields;
|
|
2869
3049
|
exports.clearTestID = clearTestID;
|
|
2870
3050
|
exports.countActiveReportFilters = countActiveReportFilters;
|
|
2871
3051
|
exports.csvFilename = csvFilename;
|
|
2872
3052
|
exports.distinctValues = distinctValues;
|
|
2873
3053
|
exports.downloadCsv = downloadCsv;
|
|
3054
|
+
exports.elapsedMs = elapsedMs;
|
|
2874
3055
|
exports.fetchAllPages = fetchAllPages;
|
|
2875
3056
|
exports.fieldTestID = fieldTestID;
|
|
3057
|
+
exports.fillTemplate = fillTemplate;
|
|
2876
3058
|
exports.filterLedgerRows = filterLedgerRows;
|
|
2877
3059
|
exports.fitMonthGridColumns = fitMonthGridColumns;
|
|
3060
|
+
exports.formatDuration = formatDuration;
|
|
2878
3061
|
exports.formatRelativeTime = formatRelativeTime;
|
|
2879
3062
|
exports.fromFilterValues = fromFilterValues;
|
|
3063
|
+
exports.groupByAgeBand = groupByAgeBand;
|
|
2880
3064
|
exports.isAttentionTone = isAttentionTone;
|
|
2881
3065
|
exports.isIsoDate = isIsoDate;
|
|
2882
3066
|
exports.isRangeInverted = isRangeInverted;
|
|
@@ -2898,6 +3082,7 @@ exports.rowTestID = rowTestID;
|
|
|
2898
3082
|
exports.runCsvExport = runCsvExport;
|
|
2899
3083
|
exports.selectAllTestID = selectAllTestID;
|
|
2900
3084
|
exports.sortLedgerRows = sortLedgerRows;
|
|
3085
|
+
exports.sortOldestFirst = sortOldestFirst;
|
|
2901
3086
|
exports.splitNeedsLook = splitNeedsLook;
|
|
2902
3087
|
exports.toEpochMs = toEpochMs;
|
|
2903
3088
|
exports.toFilterValues = toFilterValues;
|
|
@@ -2905,5 +3090,7 @@ exports.useFilterDraft = useFilterDraft;
|
|
|
2905
3090
|
exports.usePagedRows = usePagedRows;
|
|
2906
3091
|
exports.useReportDraft = useReportDraft;
|
|
2907
3092
|
exports.useReportFilterQuery = useReportFilterQuery;
|
|
3093
|
+
exports.workQueueBandTestID = workQueueBandTestID;
|
|
3094
|
+
exports.workQueueLedgerTestID = workQueueLedgerTestID;
|
|
2908
3095
|
//# sourceMappingURL=index.js.map
|
|
2909
3096
|
//# sourceMappingURL=index.js.map
|