@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.mjs
CHANGED
|
@@ -1688,6 +1688,10 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1688
1688
|
}
|
|
1689
1689
|
);
|
|
1690
1690
|
}
|
|
1691
|
+
function inputTestID(field, barTestID) {
|
|
1692
|
+
const custom = field.kind === "text" ? field.inputTestID : void 0;
|
|
1693
|
+
return custom ?? `${field.testID ?? fieldTestID(barTestID, field.key)}-input`;
|
|
1694
|
+
}
|
|
1691
1695
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1692
1696
|
const { theme } = useUi();
|
|
1693
1697
|
const { colors } = theme;
|
|
@@ -1695,7 +1699,7 @@ function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
|
1695
1699
|
const { a11yProps, hintNode } = useA11y({
|
|
1696
1700
|
label: field.label,
|
|
1697
1701
|
hint: field.accessibilityHint,
|
|
1698
|
-
testID:
|
|
1702
|
+
testID: inputTestID(field, barTestID)
|
|
1699
1703
|
});
|
|
1700
1704
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1701
1705
|
/* @__PURE__ */ jsx(
|
|
@@ -2048,6 +2052,70 @@ var TONE_GLYPH = {
|
|
|
2048
2052
|
};
|
|
2049
2053
|
var ledgerSectionTestID = (testID, section) => `${testID}-section-${section}`;
|
|
2050
2054
|
var ledgerSortDirectionTestID = (testID) => `${testID}-sort-direction`;
|
|
2055
|
+
|
|
2056
|
+
// src/StatusLedger/SortDirection.ts
|
|
2057
|
+
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
|
|
2058
|
+
SortDirection2["Asc"] = "asc";
|
|
2059
|
+
SortDirection2["Desc"] = "desc";
|
|
2060
|
+
return SortDirection2;
|
|
2061
|
+
})(SortDirection || {});
|
|
2062
|
+
function LedgerFilterBar({ view, labels, resultsCount, testID }) {
|
|
2063
|
+
const ascending = view.direction === "asc" /* Asc */;
|
|
2064
|
+
return /* @__PURE__ */ jsx(
|
|
2065
|
+
Filters,
|
|
2066
|
+
{
|
|
2067
|
+
actions: /* @__PURE__ */ jsx(
|
|
2068
|
+
ActionButton,
|
|
2069
|
+
{
|
|
2070
|
+
hint: labels.sortDirectionHint,
|
|
2071
|
+
label: ascending ? labels.sortAscending : labels.sortDescending,
|
|
2072
|
+
onPress: view.toggleDirection,
|
|
2073
|
+
testID: ledgerSortDirectionTestID(testID),
|
|
2074
|
+
tone: "ghost"
|
|
2075
|
+
}
|
|
2076
|
+
),
|
|
2077
|
+
clearHint: labels.clearHint,
|
|
2078
|
+
clearLabel: labels.clear,
|
|
2079
|
+
fields: view.fields,
|
|
2080
|
+
onChange: view.setValues,
|
|
2081
|
+
onClear: view.clear,
|
|
2082
|
+
resultsCount,
|
|
2083
|
+
resultsLabel: labels.results,
|
|
2084
|
+
testID: `${testID}-filters`,
|
|
2085
|
+
values: view.values
|
|
2086
|
+
}
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
2089
|
+
var GAP = 12;
|
|
2090
|
+
var HEADING_FONT = 15;
|
|
2091
|
+
var HEADING_WEIGHT = "700";
|
|
2092
|
+
var styles2 = StyleSheet.create({
|
|
2093
|
+
root: { gap: GAP },
|
|
2094
|
+
heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
|
|
2095
|
+
note: { paddingVertical: GAP }
|
|
2096
|
+
});
|
|
2097
|
+
var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
|
|
2098
|
+
function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger, heading }) {
|
|
2099
|
+
const { theme } = useUi();
|
|
2100
|
+
return /* @__PURE__ */ jsxs(View, { style: styles2.root, testID, children: [
|
|
2101
|
+
heading ?? /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles2.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
|
|
2102
|
+
rows.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles2.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsx(
|
|
2103
|
+
DataTable,
|
|
2104
|
+
{
|
|
2105
|
+
columns,
|
|
2106
|
+
expandedRowKeys: expandedKeys(ledger.expandedRowKey),
|
|
2107
|
+
getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2108
|
+
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2109
|
+
keyExtractor: ledger.keyExtractor,
|
|
2110
|
+
...pickRowAction(ledger),
|
|
2111
|
+
renderRowDetail: ledger.renderRowDetail,
|
|
2112
|
+
rows,
|
|
2113
|
+
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
2114
|
+
testID: `${testID}-table`
|
|
2115
|
+
}
|
|
2116
|
+
)
|
|
2117
|
+
] });
|
|
2118
|
+
}
|
|
2051
2119
|
var PILL_RADIUS2 = 999;
|
|
2052
2120
|
var PILL_BORDER = 1;
|
|
2053
2121
|
var PILL_PAD_H = 8;
|
|
@@ -2055,7 +2123,7 @@ var PILL_PAD_V = 2;
|
|
|
2055
2123
|
var PILL_GAP = 6;
|
|
2056
2124
|
var PILL_FONT = 13;
|
|
2057
2125
|
var PILL_WEIGHT = "600";
|
|
2058
|
-
var
|
|
2126
|
+
var styles3 = StyleSheet.create({
|
|
2059
2127
|
pill: {
|
|
2060
2128
|
flexDirection: "row",
|
|
2061
2129
|
alignItems: "center",
|
|
@@ -2069,19 +2137,12 @@ var styles2 = StyleSheet.create({
|
|
|
2069
2137
|
text: { fontSize: PILL_FONT, fontWeight: PILL_WEIGHT }
|
|
2070
2138
|
});
|
|
2071
2139
|
function StatusPill({ label, tone, color, testID }) {
|
|
2072
|
-
return /* @__PURE__ */ jsxs(View, { accessibilityLabel: label, accessibilityRole: "text", style: [
|
|
2073
|
-
/* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [
|
|
2074
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
2140
|
+
return /* @__PURE__ */ jsxs(View, { accessibilityLabel: label, accessibilityRole: "text", style: [styles3.pill, { borderColor: color }], testID, children: [
|
|
2141
|
+
/* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles3.text, { color }], children: TONE_GLYPH[tone] }),
|
|
2142
|
+
/* @__PURE__ */ jsx(Text, { style: [styles3.text, { color }], children: label })
|
|
2075
2143
|
] });
|
|
2076
2144
|
}
|
|
2077
2145
|
|
|
2078
|
-
// src/StatusLedger/SortDirection.ts
|
|
2079
|
-
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
|
|
2080
|
-
SortDirection2["Asc"] = "asc";
|
|
2081
|
-
SortDirection2["Desc"] = "desc";
|
|
2082
|
-
return SortDirection2;
|
|
2083
|
-
})(SortDirection || {});
|
|
2084
|
-
|
|
2085
2146
|
// src/StatusLedger/utils/ledgerLogic.ts
|
|
2086
2147
|
var BEFORE = -1;
|
|
2087
2148
|
var AFTER = 1;
|
|
@@ -2194,68 +2255,17 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
|
|
|
2194
2255
|
LedgerLayout2["Feed"] = "feed";
|
|
2195
2256
|
return LedgerLayout2;
|
|
2196
2257
|
})(LedgerLayout || {});
|
|
2197
|
-
var
|
|
2198
|
-
var
|
|
2199
|
-
|
|
2200
|
-
var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
|
|
2201
|
-
var styles3 = StyleSheet.create({
|
|
2202
|
-
root: { gap: GAP },
|
|
2203
|
-
heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
|
|
2204
|
-
note: { paddingVertical: GAP }
|
|
2258
|
+
var GAP2 = 12;
|
|
2259
|
+
var styles4 = StyleSheet.create({
|
|
2260
|
+
root: { gap: GAP2 }
|
|
2205
2261
|
});
|
|
2206
|
-
function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
|
|
2207
|
-
const { theme } = useUi();
|
|
2208
|
-
return /* @__PURE__ */ jsxs(View, { style: styles3.root, testID, children: [
|
|
2209
|
-
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles3.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
|
|
2210
|
-
rows.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles3.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsx(
|
|
2211
|
-
DataTable,
|
|
2212
|
-
{
|
|
2213
|
-
columns,
|
|
2214
|
-
expandedRowKeys: expandedKeys(ledger.expandedRowKey),
|
|
2215
|
-
getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2216
|
-
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2217
|
-
keyExtractor: ledger.keyExtractor,
|
|
2218
|
-
...pickRowAction(ledger),
|
|
2219
|
-
renderRowDetail: ledger.renderRowDetail,
|
|
2220
|
-
rows,
|
|
2221
|
-
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
2222
|
-
testID: `${testID}-table`
|
|
2223
|
-
}
|
|
2224
|
-
)
|
|
2225
|
-
] });
|
|
2226
|
-
}
|
|
2227
2262
|
function StatusLedger(props) {
|
|
2228
2263
|
const { labels, layout = "auto" /* Auto */, breakpoint = CARD_STACK_BREAKPOINT, loading, testID = STATUS_LEDGER_TEST_ID } = props;
|
|
2229
2264
|
const { width } = useWindowDimensions();
|
|
2230
2265
|
const view = useLedgerView(props);
|
|
2231
2266
|
const feed = layout === "feed" /* Feed */ || layout === "auto" /* Auto */ && width < breakpoint;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
ActionButton,
|
|
2235
|
-
{
|
|
2236
|
-
hint: labels.sortDirectionHint,
|
|
2237
|
-
label: ascending ? labels.sortAscending : labels.sortDescending,
|
|
2238
|
-
onPress: view.toggleDirection,
|
|
2239
|
-
testID: ledgerSortDirectionTestID(testID),
|
|
2240
|
-
tone: "ghost"
|
|
2241
|
-
}
|
|
2242
|
-
);
|
|
2243
|
-
return /* @__PURE__ */ jsxs(View, { style: styles3.root, testID, children: [
|
|
2244
|
-
/* @__PURE__ */ jsx(
|
|
2245
|
-
Filters,
|
|
2246
|
-
{
|
|
2247
|
-
actions: directionButton,
|
|
2248
|
-
clearHint: labels.clearHint,
|
|
2249
|
-
clearLabel: labels.clear,
|
|
2250
|
-
fields: view.fields,
|
|
2251
|
-
onChange: view.setValues,
|
|
2252
|
-
onClear: view.clear,
|
|
2253
|
-
resultsCount: view.visible.length,
|
|
2254
|
-
resultsLabel: labels.results,
|
|
2255
|
-
testID: `${testID}-filters`,
|
|
2256
|
-
values: view.values
|
|
2257
|
-
}
|
|
2258
|
-
),
|
|
2267
|
+
return /* @__PURE__ */ jsxs(View, { style: styles4.root, testID, children: [
|
|
2268
|
+
/* @__PURE__ */ jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID, view }),
|
|
2259
2269
|
feed && !loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2260
2270
|
/* @__PURE__ */ jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.allClear, ledger: props, rows: view.split.attention, testID: ledgerSectionTestID(testID, "attention"), title: labels.needsLook }),
|
|
2261
2271
|
/* @__PURE__ */ jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.empty, ledger: props, rows: view.split.rest, testID: ledgerSectionTestID(testID, "rest"), title: labels.everythingElse })
|
|
@@ -2305,7 +2315,7 @@ function formatRelativeTime(value, nowMs, strings) {
|
|
|
2305
2315
|
if (distance < MS_PER_DAY) return fill(units.hours, Math.floor(distance / MS_PER_HOUR));
|
|
2306
2316
|
return fill(units.days, Math.floor(distance / MS_PER_DAY));
|
|
2307
2317
|
}
|
|
2308
|
-
var
|
|
2318
|
+
var styles5 = StyleSheet.create({
|
|
2309
2319
|
target: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, justifyContent: "center" }
|
|
2310
2320
|
});
|
|
2311
2321
|
var defaultAbsolute = (ms) => new Date(ms).toLocaleString();
|
|
@@ -2327,13 +2337,175 @@ function RelativeTime({ value, nowMs, strings, hint, formatAbsolute = defaultAbs
|
|
|
2327
2337
|
setShowAbsolute((current) => !current);
|
|
2328
2338
|
pressRow?.();
|
|
2329
2339
|
},
|
|
2330
|
-
style:
|
|
2340
|
+
style: styles5.target,
|
|
2331
2341
|
testID,
|
|
2332
2342
|
children: /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.text }, children: showAbsolute ? absolute : relative })
|
|
2333
2343
|
}
|
|
2334
2344
|
);
|
|
2335
2345
|
}
|
|
2336
2346
|
|
|
2347
|
+
// src/StatusLedger/DurationUnit.ts
|
|
2348
|
+
var DurationUnit = /* @__PURE__ */ ((DurationUnit2) => {
|
|
2349
|
+
DurationUnit2["Minute"] = "minute";
|
|
2350
|
+
DurationUnit2["Hour"] = "hour";
|
|
2351
|
+
DurationUnit2["Day"] = "day";
|
|
2352
|
+
return DurationUnit2;
|
|
2353
|
+
})(DurationUnit || {});
|
|
2354
|
+
|
|
2355
|
+
// src/StatusLedger/utils/duration.ts
|
|
2356
|
+
var MS_PER_SECOND2 = 1e3;
|
|
2357
|
+
var SECONDS_PER_MINUTE2 = 60;
|
|
2358
|
+
var MINUTES_PER_HOUR2 = 60;
|
|
2359
|
+
var HOURS_PER_DAY2 = 24;
|
|
2360
|
+
var MS_PER_MINUTE2 = MS_PER_SECOND2 * SECONDS_PER_MINUTE2;
|
|
2361
|
+
var MS_PER_HOUR2 = MS_PER_MINUTE2 * MINUTES_PER_HOUR2;
|
|
2362
|
+
var MS_PER_DAY2 = MS_PER_HOUR2 * HOURS_PER_DAY2;
|
|
2363
|
+
var TOKEN = /\{\{(\w+)\}\}/g;
|
|
2364
|
+
function fillTemplate(template, values) {
|
|
2365
|
+
return template.replace(TOKEN, (whole, key) => values[key] ?? whole);
|
|
2366
|
+
}
|
|
2367
|
+
var fillCount = (template, count) => fillTemplate(template, { n: String(count) });
|
|
2368
|
+
function elapsedMs(start, nowMs) {
|
|
2369
|
+
const ms = toEpochMs(start);
|
|
2370
|
+
return ms === null ? null : Math.max(0, nowMs - ms);
|
|
2371
|
+
}
|
|
2372
|
+
function formatDuration(durationMs, strings, largestUnit = "day" /* Day */) {
|
|
2373
|
+
if (durationMs === null) return strings.unknown;
|
|
2374
|
+
if (durationMs < MS_PER_MINUTE2) return strings.lessThanMinute;
|
|
2375
|
+
const inMinutes = largestUnit === "minute" /* Minute */ || durationMs < MS_PER_HOUR2;
|
|
2376
|
+
if (inMinutes) return fillCount(strings.minutes, Math.floor(durationMs / MS_PER_MINUTE2));
|
|
2377
|
+
const inHours = largestUnit === "hour" /* Hour */ || durationMs < MS_PER_DAY2;
|
|
2378
|
+
if (inHours) return fillCount(strings.hours, Math.floor(durationMs / MS_PER_HOUR2));
|
|
2379
|
+
return fillCount(strings.days, Math.floor(durationMs / MS_PER_DAY2));
|
|
2380
|
+
}
|
|
2381
|
+
function ageFraction(ageMs, limitMs) {
|
|
2382
|
+
if (ageMs === null) return 0;
|
|
2383
|
+
if (limitMs <= 0) return 1;
|
|
2384
|
+
return Math.min(1, Math.max(0, ageMs / limitMs));
|
|
2385
|
+
}
|
|
2386
|
+
var AGE_FONT = 14;
|
|
2387
|
+
var AGE_WEIGHT = "600";
|
|
2388
|
+
var styles6 = StyleSheet.create({
|
|
2389
|
+
text: { fontSize: AGE_FONT, fontWeight: AGE_WEIGHT, fontVariant: ["tabular-nums"] }
|
|
2390
|
+
});
|
|
2391
|
+
function AgeLabel({ ageMs, strings, largestUnit = "day" /* Day */, color, testID }) {
|
|
2392
|
+
const { theme } = useUi();
|
|
2393
|
+
return /* @__PURE__ */ jsx(Text, { style: [styles6.text, { color: color ?? theme.colors.text }], testID, children: formatDuration(ageMs, strings, largestUnit) });
|
|
2394
|
+
}
|
|
2395
|
+
var BAR_HEIGHT = 6;
|
|
2396
|
+
var BAR_RADIUS = 3;
|
|
2397
|
+
var GAP3 = 8;
|
|
2398
|
+
var LABEL_FONT = 13;
|
|
2399
|
+
var PERCENT = 100;
|
|
2400
|
+
var styles7 = StyleSheet.create({
|
|
2401
|
+
row: { flexDirection: "row", alignItems: "center", gap: GAP3, flexGrow: 1 },
|
|
2402
|
+
track: { flexGrow: 1, flexShrink: 1, height: BAR_HEIGHT, borderRadius: BAR_RADIUS, overflow: "hidden" },
|
|
2403
|
+
fill: { height: BAR_HEIGHT, borderRadius: BAR_RADIUS },
|
|
2404
|
+
label: { fontSize: LABEL_FONT, fontVariant: ["tabular-nums"] }
|
|
2405
|
+
});
|
|
2406
|
+
function AgeBar({ fraction, color, label, testID }) {
|
|
2407
|
+
const { theme } = useUi();
|
|
2408
|
+
return /* @__PURE__ */ jsxs(View, { style: styles7.row, testID, children: [
|
|
2409
|
+
/* @__PURE__ */ jsx(View, { "aria-hidden": true, style: [styles7.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles7.fill, { width: `${Math.round(fraction * PERCENT)}%`, backgroundColor: color }] }) }),
|
|
2410
|
+
/* @__PURE__ */ jsx(Text, { style: [styles7.label, { color: theme.colors.text }], children: label })
|
|
2411
|
+
] });
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
// src/StatusLedger/utils/ageBands.ts
|
|
2415
|
+
var oldestFloorFirst = (bands) => [...bands].sort((a, b) => b.minAgeMs - a.minAgeMs);
|
|
2416
|
+
function assignAgeBand(ageMs, bands) {
|
|
2417
|
+
const ordered = oldestFloorFirst(bands);
|
|
2418
|
+
const youngest = ordered[ordered.length - 1];
|
|
2419
|
+
if (ageMs === null) return youngest;
|
|
2420
|
+
return ordered.find((band) => ageMs >= band.minAgeMs) ?? youngest;
|
|
2421
|
+
}
|
|
2422
|
+
function groupByAgeBand(rows, ageOf, bands) {
|
|
2423
|
+
return oldestFloorFirst(bands).map((band) => ({ band, rows: rows.filter((row) => assignAgeBand(ageOf(row), bands)?.key === band.key) })).filter((group) => group.rows.length > 0);
|
|
2424
|
+
}
|
|
2425
|
+
function sortOldestFirst(rows, ageOf) {
|
|
2426
|
+
return sortLedgerRows(rows, ageOf, "desc" /* Desc */);
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
// src/WorkQueue/constants.ts
|
|
2430
|
+
var WORK_QUEUE_TEST_ID = "ui-work-queue";
|
|
2431
|
+
var AGE_COLUMN_KEY = "age";
|
|
2432
|
+
var AGE_MIN_WIDTH = 88;
|
|
2433
|
+
var AGE_BAR_MIN_WIDTH = 200;
|
|
2434
|
+
var EMPTY_QUEUE_NO_ROW_ACTION = "empty or loading work queue: there is no row to open";
|
|
2435
|
+
var workQueueBandTestID = (testID, bandKey) => `${testID}-band-${bandKey}`;
|
|
2436
|
+
var workQueueLedgerTestID = (testID) => `${testID}-ledger`;
|
|
2437
|
+
var GAP4 = 12;
|
|
2438
|
+
var COUNT_FONT = 13;
|
|
2439
|
+
var styles8 = StyleSheet.create({
|
|
2440
|
+
root: { gap: GAP4 },
|
|
2441
|
+
heading: { flexDirection: "row", alignItems: "center", gap: GAP4 },
|
|
2442
|
+
count: { fontSize: COUNT_FONT }
|
|
2443
|
+
});
|
|
2444
|
+
function AgeBandQueue({ ledger, ageOf, bands, bandCountLabel, testID }) {
|
|
2445
|
+
const { theme } = useUi();
|
|
2446
|
+
const view = useLedgerView(ledger);
|
|
2447
|
+
const toneColor = useToneColor(ledger.toneColors);
|
|
2448
|
+
const groups = useMemo(() => groupByAgeBand(view.visible, ageOf, bands), [view.visible, ageOf, bands]);
|
|
2449
|
+
const { labels } = ledger;
|
|
2450
|
+
const nothingToGroup = ledger.loading === true || groups.length === 0;
|
|
2451
|
+
return /* @__PURE__ */ jsxs(View, { style: styles8.root, testID, children: [
|
|
2452
|
+
/* @__PURE__ */ jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID: ledger.testID, view }),
|
|
2453
|
+
nothingToGroup ? /* @__PURE__ */ 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__ */ jsx(
|
|
2454
|
+
LedgerSection,
|
|
2455
|
+
{
|
|
2456
|
+
columns: view.tableColumns,
|
|
2457
|
+
emptyLabel: labels.empty,
|
|
2458
|
+
heading: /* @__PURE__ */ jsxs(View, { accessibilityRole: "header", style: styles8.heading, children: [
|
|
2459
|
+
/* @__PURE__ */ jsx(StatusPill, { color: toneColor(band.tone), label: band.label, tone: band.tone }),
|
|
2460
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.count, { color: theme.colors.textSecondary }], children: fillTemplate(bandCountLabel, { n: String(rows.length) }) })
|
|
2461
|
+
] }),
|
|
2462
|
+
ledger,
|
|
2463
|
+
rows,
|
|
2464
|
+
testID: workQueueBandTestID(testID, band.key),
|
|
2465
|
+
title: band.label
|
|
2466
|
+
},
|
|
2467
|
+
band.key
|
|
2468
|
+
))
|
|
2469
|
+
] });
|
|
2470
|
+
}
|
|
2471
|
+
function AgeLabelCell({ ageMs, color, strings, largestUnit }) {
|
|
2472
|
+
return /* @__PURE__ */ jsx(AgeLabel, { ageMs, color, largestUnit, strings });
|
|
2473
|
+
}
|
|
2474
|
+
function AgeBarCell({ ageMs, color, strings, limitMs, ageOfLimit, largestUnit }) {
|
|
2475
|
+
const label = fillTemplate(ageOfLimit, { age: formatDuration(ageMs, strings, largestUnit), limit: formatDuration(limitMs, strings, largestUnit) });
|
|
2476
|
+
return /* @__PURE__ */ jsx(AgeBar, { color, fraction: ageFraction(ageMs, limitMs), label });
|
|
2477
|
+
}
|
|
2478
|
+
function buildAgeColumn(options) {
|
|
2479
|
+
const { Cell, minWidth, ageOf, bands, strings, labels, limitMs, toneColor, largestUnit } = options;
|
|
2480
|
+
const render = (row) => {
|
|
2481
|
+
const age = ageOf(row);
|
|
2482
|
+
const color = toneColor(assignAgeBand(age, bands)?.tone ?? "neutral" /* Neutral */);
|
|
2483
|
+
return /* @__PURE__ */ jsx(Cell, { ageMs: age, ageOfLimit: labels.ageOfLimit, color, largestUnit, limitMs, strings });
|
|
2484
|
+
};
|
|
2485
|
+
return { key: AGE_COLUMN_KEY, header: labels.age, minWidth, sortValue: ageOf, render };
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
// src/WorkQueue/WorkQueueVariant.ts
|
|
2489
|
+
var WorkQueueVariant = /* @__PURE__ */ ((WorkQueueVariant2) => {
|
|
2490
|
+
WorkQueueVariant2["Table"] = "table";
|
|
2491
|
+
WorkQueueVariant2["Bands"] = "bands";
|
|
2492
|
+
WorkQueueVariant2["Bar"] = "bar";
|
|
2493
|
+
return WorkQueueVariant2;
|
|
2494
|
+
})(WorkQueueVariant || {});
|
|
2495
|
+
function WorkQueue(props) {
|
|
2496
|
+
const { ledger, getStartedAt, nowMs, bands, durationStrings, labels, variant = "bands" /* Bands */, limitMs, largestUnit, testID = WORK_QUEUE_TEST_ID } = props;
|
|
2497
|
+
const toneColor = useToneColor(ledger.toneColors);
|
|
2498
|
+
const ageOf = useCallback((row) => elapsedMs(getStartedAt(row), nowMs), [getStartedAt, nowMs]);
|
|
2499
|
+
const limit = limitMs ?? Math.max(0, ...bands.map((band) => band.minAgeMs));
|
|
2500
|
+
const queueLedger = useMemo(() => {
|
|
2501
|
+
const asBar = variant === "bar" /* Bar */;
|
|
2502
|
+
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 });
|
|
2503
|
+
return { ...ledger, rows: sortOldestFirst(ledger.rows, ageOf), columns: [ageColumn, ...ledger.columns], testID: workQueueLedgerTestID(testID) };
|
|
2504
|
+
}, [ledger, ageOf, bands, durationStrings, labels, limit, toneColor, largestUnit, variant, testID]);
|
|
2505
|
+
if (variant === "bands" /* Bands */) return /* @__PURE__ */ jsx(AgeBandQueue, { ageOf, bandCountLabel: labels.bandCount, bands, ledger: queueLedger, testID });
|
|
2506
|
+
return /* @__PURE__ */ jsx(View, { testID, children: /* @__PURE__ */ jsx(StatusLedger, { ...queueLedger }) });
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2337
2509
|
// src/MonthStatusGrid/MonthGridColumns.ts
|
|
2338
2510
|
var MonthGridColumns = /* @__PURE__ */ ((MonthGridColumns2) => {
|
|
2339
2511
|
MonthGridColumns2[MonthGridColumns2["Twelve"] = 12] = "Twelve";
|
|
@@ -2365,7 +2537,7 @@ var CELL_INNER_GAP = 4;
|
|
|
2365
2537
|
var LABEL_SIZE = 14;
|
|
2366
2538
|
var SELECTED_BORDER = 2;
|
|
2367
2539
|
var COLOR_STEP = "500";
|
|
2368
|
-
var
|
|
2540
|
+
var styles9 = StyleSheet.create({
|
|
2369
2541
|
grid: { gap: GRID_GAP },
|
|
2370
2542
|
row: { flexDirection: "row", gap: GRID_GAP },
|
|
2371
2543
|
filler: { flex: 1 },
|
|
@@ -2397,16 +2569,16 @@ var GridCell = ({ cell, isSelected, onSelect, hint, testID }) => {
|
|
|
2397
2569
|
"aria-pressed": isSelected,
|
|
2398
2570
|
onPress: () => onSelect(cell.id),
|
|
2399
2571
|
style: [
|
|
2400
|
-
|
|
2572
|
+
styles9.cell,
|
|
2401
2573
|
{ backgroundColor: isSelected ? colors.background : colors.surface, borderColor: colors.border },
|
|
2402
|
-
cell.dashed === true &&
|
|
2403
|
-
isSelected &&
|
|
2574
|
+
cell.dashed === true && styles9.dashed,
|
|
2575
|
+
isSelected && styles9.selected,
|
|
2404
2576
|
isSelected && { borderColor: theme.palette.primary[COLOR_STEP] }
|
|
2405
2577
|
],
|
|
2406
2578
|
testID,
|
|
2407
2579
|
children: [
|
|
2408
2580
|
cell.icon !== void 0 && cell.icon !== null ? /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: cell.icon }) : null,
|
|
2409
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
2581
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.label, { color: colors.text }], children: cell.label })
|
|
2410
2582
|
]
|
|
2411
2583
|
}
|
|
2412
2584
|
);
|
|
@@ -2426,7 +2598,7 @@ var MonthStatusGrid = ({
|
|
|
2426
2598
|
const fitted = fitMonthGridColumns(columns, measuredWidth ?? windowWidth, GRID_GAP);
|
|
2427
2599
|
const rows = useMemo(() => chunkIntoRows(cells, fitted), [cells, fitted]);
|
|
2428
2600
|
const onLayout = (event) => setMeasuredWidth(event.nativeEvent.layout.width);
|
|
2429
|
-
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style:
|
|
2601
|
+
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style: styles9.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxs(View, { style: styles9.row, testID: `${testID}-row`, children: [
|
|
2430
2602
|
row.map((cell) => /* @__PURE__ */ jsx(
|
|
2431
2603
|
GridCell,
|
|
2432
2604
|
{
|
|
@@ -2438,7 +2610,7 @@ var MonthStatusGrid = ({
|
|
|
2438
2610
|
},
|
|
2439
2611
|
cell.id
|
|
2440
2612
|
)),
|
|
2441
|
-
Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsx(View, { style:
|
|
2613
|
+
Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsx(View, { style: styles9.filler }, index))
|
|
2442
2614
|
] }, row[0]?.id)) });
|
|
2443
2615
|
};
|
|
2444
2616
|
|
|
@@ -2479,7 +2651,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2479
2651
|
const { width } = useWindowDimensions();
|
|
2480
2652
|
const panelWidth = Math.min(PANEL_MAX_WIDTH, Math.round(width * PANEL_SCREEN_SHARE));
|
|
2481
2653
|
const focusTitleOnOpen = useCallback((node) => node?.focus(), []);
|
|
2482
|
-
return /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style:
|
|
2654
|
+
return /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles10.root, children: [
|
|
2483
2655
|
/* @__PURE__ */ jsx(
|
|
2484
2656
|
Pressable,
|
|
2485
2657
|
{
|
|
@@ -2495,11 +2667,11 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2495
2667
|
View,
|
|
2496
2668
|
{
|
|
2497
2669
|
accessibilityViewIsModal: true,
|
|
2498
|
-
style: [
|
|
2670
|
+
style: [styles10.panel, { width: panelWidth, backgroundColor: theme.colors.surface, borderColor: theme.colors.border }],
|
|
2499
2671
|
testID,
|
|
2500
2672
|
children: [
|
|
2501
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
2502
|
-
/* @__PURE__ */ jsx(View, { ref: focusTitleOnOpen, focusable: true, style:
|
|
2673
|
+
/* @__PURE__ */ jsxs(View, { style: styles10.header, children: [
|
|
2674
|
+
/* @__PURE__ */ jsx(View, { ref: focusTitleOnOpen, focusable: true, style: styles10.titleBox, testID: `${testID}-title`, children: /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles10.title, { color: theme.colors.text }], children: title }) }),
|
|
2503
2675
|
/* @__PURE__ */ jsx(ActionButton, { label: closeLabel, hint: closeHint, tone: "primary", onPress: onClose, testID: `${testID}-close` })
|
|
2504
2676
|
] }),
|
|
2505
2677
|
/* @__PURE__ */ jsx(ScrollView, { children })
|
|
@@ -2508,7 +2680,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
|
|
|
2508
2680
|
)
|
|
2509
2681
|
] }) });
|
|
2510
2682
|
}
|
|
2511
|
-
var
|
|
2683
|
+
var styles10 = StyleSheet.create({
|
|
2512
2684
|
root: { flex: 1, flexDirection: "row", justifyContent: "flex-end" },
|
|
2513
2685
|
panel: { height: "100%", padding: PANEL_PAD, borderLeftWidth: PANEL_BORDER },
|
|
2514
2686
|
header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: HEADER_GAP, marginBottom: HEADER_BOTTOM },
|
|
@@ -2658,7 +2830,7 @@ function ReportFilters({
|
|
|
2658
2830
|
const isCompact = compact ?? width < CARD_STACK_BREAKPOINT;
|
|
2659
2831
|
const renderBar = (barTestID, barActions) => /* @__PURE__ */ jsx(Filters, { fields, values, onChange: handleChange, actions: barActions, renderSelect, testID: barTestID });
|
|
2660
2832
|
if (!isCompact) return renderBar(testID, actions);
|
|
2661
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
2833
|
+
return /* @__PURE__ */ jsxs(View, { style: styles11.compactRow, testID, children: [
|
|
2662
2834
|
/* @__PURE__ */ jsx(
|
|
2663
2835
|
ActionButton,
|
|
2664
2836
|
{
|
|
@@ -2684,7 +2856,7 @@ function ReportFilters({
|
|
|
2684
2856
|
)
|
|
2685
2857
|
] });
|
|
2686
2858
|
}
|
|
2687
|
-
var
|
|
2859
|
+
var styles11 = StyleSheet.create({
|
|
2688
2860
|
compactRow: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: COMPACT_GAP }
|
|
2689
2861
|
});
|
|
2690
2862
|
function useReportFilterQuery({
|
|
@@ -2807,6 +2979,6 @@ async function fetchAllPages(fetchPage, { pageSize, maxPages, concurrency = DEFA
|
|
|
2807
2979
|
return { rows: pages.flatMap((page) => [...page.items]), truncated: first.totalPages > maxPages };
|
|
2808
2980
|
}
|
|
2809
2981
|
|
|
2810
|
-
export { CARD_STACK_BREAKPOINT, DEFAULT_FETCH_CONCURRENCY, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_REPORT_QUERY_KEYS, DataTable, EMPTY_REPORT_FILTERS, EXPORT_CSV_TEST_ID, ExportCsvAction, ExportOutcome, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, FilterBar, FilterSidePanel, Filters, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, MonthStatusGrid, PagedTableLayout, PagedTableLayoutKind, Pager, REPORT_FIELD_KEYS, REPORT_FILTERS_TEST_ID, RelativeTime, ReportFilters, STATUS_LEDGER_TEST_ID, SortDirection, StatCard, StatTone, StatusLedger, StatusPill, StatusTone, TABLE_I18N, TABLE_TEST_IDS, applyTestID, buildReportFields, clearTestID, countActiveReportFilters, csvFilename, distinctValues, downloadCsv, fetchAllPages, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, fromFilterValues, isAttentionTone, isIsoDate, isRangeInverted, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, openPanelTestID, panelFiltersTestID, panelTestID, reportFiltersFromQuery, reportFiltersToParams, reportFiltersToQuery, reportFiltersToSearch, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, runCsvExport, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, toFilterValues, useFilterDraft, usePagedRows, useReportDraft, useReportFilterQuery };
|
|
2982
|
+
export { AgeBar, AgeLabel, CARD_STACK_BREAKPOINT, DEFAULT_FETCH_CONCURRENCY, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_REPORT_QUERY_KEYS, DataTable, DurationUnit, EMPTY_REPORT_FILTERS, EXPORT_CSV_TEST_ID, ExportCsvAction, ExportOutcome, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, FilterBar, FilterSidePanel, Filters, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, MonthStatusGrid, PagedTableLayout, PagedTableLayoutKind, Pager, REPORT_FIELD_KEYS, REPORT_FILTERS_TEST_ID, RelativeTime, ReportFilters, STATUS_LEDGER_TEST_ID, SortDirection, StatCard, StatTone, StatusLedger, StatusPill, StatusTone, TABLE_I18N, TABLE_TEST_IDS, WORK_QUEUE_TEST_ID, WorkQueue, WorkQueueVariant, ageFraction, applyTestID, assignAgeBand, buildReportFields, clearTestID, countActiveReportFilters, csvFilename, distinctValues, downloadCsv, elapsedMs, fetchAllPages, fieldTestID, fillTemplate, filterLedgerRows, fitMonthGridColumns, formatDuration, formatRelativeTime, fromFilterValues, groupByAgeBand, isAttentionTone, isIsoDate, isRangeInverted, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, openPanelTestID, panelFiltersTestID, panelTestID, reportFiltersFromQuery, reportFiltersToParams, reportFiltersToQuery, reportFiltersToSearch, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, runCsvExport, selectAllTestID, sortLedgerRows, sortOldestFirst, splitNeedsLook, toEpochMs, toFilterValues, useFilterDraft, usePagedRows, useReportDraft, useReportFilterQuery, workQueueBandTestID, workQueueLedgerTestID };
|
|
2811
2983
|
//# sourceMappingURL=index.mjs.map
|
|
2812
2984
|
//# sourceMappingURL=index.mjs.map
|