@dloizides/ui-tables 3.0.2 → 3.1.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 +6 -0
- package/dist/index.d.mts +122 -4
- package/dist/index.d.ts +122 -4
- package/dist/index.js +379 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +358 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var designTokens = require('@dloizides/design-tokens');
|
|
|
9
9
|
var reactDom = require('react-dom');
|
|
10
10
|
var uiForms = require('@dloizides/ui-forms');
|
|
11
11
|
var a11y = require('@dloizides/a11y');
|
|
12
|
+
var uiButtons = require('@dloizides/ui-buttons');
|
|
13
|
+
var utils = require('@dloizides/utils');
|
|
12
14
|
|
|
13
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
16
|
|
|
@@ -1586,6 +1588,7 @@ function ActionButton({ label, hint, tone, disabled = false, onPress, testID })
|
|
|
1586
1588
|
var FILTERS_TEST_ID = "ui-filters-declarative";
|
|
1587
1589
|
var FIELD_MIN_WIDTH = {
|
|
1588
1590
|
select: 150,
|
|
1591
|
+
multiSelect: 200,
|
|
1589
1592
|
text: 200,
|
|
1590
1593
|
number: 130,
|
|
1591
1594
|
date: 160,
|
|
@@ -1647,6 +1650,25 @@ function BooleanField({ field, barTestID, value, onChange }) {
|
|
|
1647
1650
|
)
|
|
1648
1651
|
] });
|
|
1649
1652
|
}
|
|
1653
|
+
|
|
1654
|
+
// src/Filters/utils/toggleValue.ts
|
|
1655
|
+
function toggleValue(list, value) {
|
|
1656
|
+
return list.includes(value) ? list.filter((item) => item !== value) : [...list, value];
|
|
1657
|
+
}
|
|
1658
|
+
function MultiSelectField({ field, barTestID, value, onChange }) {
|
|
1659
|
+
const options = React2.useMemo(() => field.options.map((option) => ({ value: option.value, label: option.label })), [field.options]);
|
|
1660
|
+
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1661
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1662
|
+
uiForms.ChipSelector,
|
|
1663
|
+
{
|
|
1664
|
+
multiple: true,
|
|
1665
|
+
options,
|
|
1666
|
+
value: [...value],
|
|
1667
|
+
onChange: (picked) => onChange(toggleValue(value, picked)),
|
|
1668
|
+
testID: `${testID}-chips`
|
|
1669
|
+
}
|
|
1670
|
+
);
|
|
1671
|
+
}
|
|
1650
1672
|
function SelectField({ field, barTestID, value, onChange, placeholder, dropdownHint, optionHint }) {
|
|
1651
1673
|
const { t } = uiFeedback.useUi();
|
|
1652
1674
|
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
@@ -1729,6 +1751,9 @@ function asString(value) {
|
|
|
1729
1751
|
function asBool(value) {
|
|
1730
1752
|
return value === true;
|
|
1731
1753
|
}
|
|
1754
|
+
function asList(value) {
|
|
1755
|
+
return Array.isArray(value) ? value : [];
|
|
1756
|
+
}
|
|
1732
1757
|
function asRange(value) {
|
|
1733
1758
|
if (typeof value === "object" && value !== null && "from" in value && "to" in value) return value;
|
|
1734
1759
|
return EMPTY_RANGE;
|
|
@@ -1785,6 +1810,16 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1785
1810
|
optionHint: strings.optionHint
|
|
1786
1811
|
}
|
|
1787
1812
|
);
|
|
1813
|
+
case "multiSelect":
|
|
1814
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1815
|
+
MultiSelectField,
|
|
1816
|
+
{
|
|
1817
|
+
field,
|
|
1818
|
+
barTestID,
|
|
1819
|
+
value: asList(raw),
|
|
1820
|
+
onChange: (v) => setField(field.key, v)
|
|
1821
|
+
}
|
|
1822
|
+
);
|
|
1788
1823
|
case "typeahead":
|
|
1789
1824
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1790
1825
|
TypeaheadField,
|
|
@@ -1827,6 +1862,7 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1827
1862
|
uiForms.Field,
|
|
1828
1863
|
{
|
|
1829
1864
|
containerStyle,
|
|
1865
|
+
error: field.kind === "dateRange" ? field.error : void 0,
|
|
1830
1866
|
label: field.label,
|
|
1831
1867
|
labelVariant: "control",
|
|
1832
1868
|
testID,
|
|
@@ -2411,6 +2447,324 @@ var MonthStatusGrid = ({
|
|
|
2411
2447
|
] }, row[0]?.id)) });
|
|
2412
2448
|
};
|
|
2413
2449
|
|
|
2450
|
+
// src/ReportFilters/constants.ts
|
|
2451
|
+
var REPORT_FILTERS_TEST_ID = "ui-report-filters";
|
|
2452
|
+
var REPORT_FIELD_KEYS = {
|
|
2453
|
+
scope: "scope",
|
|
2454
|
+
range: "range",
|
|
2455
|
+
statuses: "statuses",
|
|
2456
|
+
currency: "currency"
|
|
2457
|
+
};
|
|
2458
|
+
var DEFAULT_REPORT_QUERY_KEYS = {
|
|
2459
|
+
scope: "scope",
|
|
2460
|
+
from: "from",
|
|
2461
|
+
to: "to",
|
|
2462
|
+
statuses: "status",
|
|
2463
|
+
currency: "currency"
|
|
2464
|
+
};
|
|
2465
|
+
var EMPTY_REPORT_FILTERS = {
|
|
2466
|
+
scope: "",
|
|
2467
|
+
range: { from: "", to: "" },
|
|
2468
|
+
statuses: [],
|
|
2469
|
+
currency: ""
|
|
2470
|
+
};
|
|
2471
|
+
var LIST_SEPARATOR = ",";
|
|
2472
|
+
var PANEL_MAX_WIDTH = 360;
|
|
2473
|
+
var PANEL_SCREEN_SHARE = 0.88;
|
|
2474
|
+
var openPanelTestID = (testID) => `${testID}-open`;
|
|
2475
|
+
var panelTestID = (testID) => `${testID}-panel`;
|
|
2476
|
+
var panelFiltersTestID = (testID) => `${testID}-panel-filters`;
|
|
2477
|
+
var PANEL_PAD = 16;
|
|
2478
|
+
var HEADER_GAP = 8;
|
|
2479
|
+
var HEADER_BOTTOM = 12;
|
|
2480
|
+
var TITLE_FONT = 16;
|
|
2481
|
+
var PANEL_BORDER = 1;
|
|
2482
|
+
function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, children, testID }) {
|
|
2483
|
+
const { theme } = uiFeedback.useUi();
|
|
2484
|
+
const { width } = reactNative.useWindowDimensions();
|
|
2485
|
+
const panelWidth = Math.min(PANEL_MAX_WIDTH, Math.round(width * PANEL_SCREEN_SHARE));
|
|
2486
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.root, children: [
|
|
2487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2488
|
+
reactNative.Pressable,
|
|
2489
|
+
{
|
|
2490
|
+
accessibilityRole: "button",
|
|
2491
|
+
accessibilityLabel: closeLabel,
|
|
2492
|
+
accessibilityHint: closeHint,
|
|
2493
|
+
onPress: onClose,
|
|
2494
|
+
style: [reactNative.StyleSheet.absoluteFill, { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR }],
|
|
2495
|
+
testID: `${testID}-backdrop`
|
|
2496
|
+
}
|
|
2497
|
+
),
|
|
2498
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2499
|
+
reactNative.View,
|
|
2500
|
+
{
|
|
2501
|
+
accessibilityViewIsModal: true,
|
|
2502
|
+
style: [styles6.panel, { width: panelWidth, backgroundColor: theme.colors.surface, borderColor: theme.colors.border }],
|
|
2503
|
+
testID,
|
|
2504
|
+
children: [
|
|
2505
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.header, children: [
|
|
2506
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles6.title, { color: theme.colors.text }], children: title }),
|
|
2507
|
+
/* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: closeLabel, hint: closeHint, tone: "primary", onPress: onClose, testID: `${testID}-close` })
|
|
2508
|
+
] }),
|
|
2509
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children })
|
|
2510
|
+
]
|
|
2511
|
+
}
|
|
2512
|
+
)
|
|
2513
|
+
] }) });
|
|
2514
|
+
}
|
|
2515
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
2516
|
+
root: { flex: 1, flexDirection: "row", justifyContent: "flex-end" },
|
|
2517
|
+
panel: { height: "100%", padding: PANEL_PAD, borderLeftWidth: PANEL_BORDER },
|
|
2518
|
+
header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: HEADER_GAP, marginBottom: HEADER_BOTTOM },
|
|
2519
|
+
title: { flexShrink: 1, fontSize: TITLE_FONT, fontWeight: "700" }
|
|
2520
|
+
});
|
|
2521
|
+
|
|
2522
|
+
// src/ReportFilters/utils/reportQuery.ts
|
|
2523
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
2524
|
+
var ISO_DATE_LENGTH = 10;
|
|
2525
|
+
function isIsoDate(value) {
|
|
2526
|
+
if (!ISO_DATE.test(value)) return false;
|
|
2527
|
+
const parsed = /* @__PURE__ */ new Date(`${value}T00:00:00Z`);
|
|
2528
|
+
return !Number.isNaN(parsed.getTime()) && parsed.toISOString().slice(0, ISO_DATE_LENGTH) === value;
|
|
2529
|
+
}
|
|
2530
|
+
function isRangeInverted(range) {
|
|
2531
|
+
const bothSet = range.from !== "" && range.to !== "";
|
|
2532
|
+
return bothSet && range.from > range.to;
|
|
2533
|
+
}
|
|
2534
|
+
function countActiveReportFilters(values) {
|
|
2535
|
+
const hasRange = values.range.from !== "" || values.range.to !== "";
|
|
2536
|
+
return [values.scope !== "", hasRange, values.statuses.length > 0, values.currency !== ""].filter(Boolean).length;
|
|
2537
|
+
}
|
|
2538
|
+
function readAll(source, key) {
|
|
2539
|
+
if (source instanceof URLSearchParams) return source.getAll(key);
|
|
2540
|
+
const raw = source[key];
|
|
2541
|
+
if (raw === void 0 || raw === null) return [];
|
|
2542
|
+
return typeof raw === "string" ? [raw] : [...raw];
|
|
2543
|
+
}
|
|
2544
|
+
function readOne(source, key) {
|
|
2545
|
+
return (readAll(source, key)[0] ?? "").trim();
|
|
2546
|
+
}
|
|
2547
|
+
function readDate(source, key) {
|
|
2548
|
+
const value = readOne(source, key);
|
|
2549
|
+
return isIsoDate(value) ? value : "";
|
|
2550
|
+
}
|
|
2551
|
+
function readList(source, key) {
|
|
2552
|
+
const items = readAll(source, key).flatMap((entry) => entry.split(LIST_SEPARATOR)).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
2553
|
+
return Array.from(new Set(items));
|
|
2554
|
+
}
|
|
2555
|
+
function reportFiltersFromQuery(source, keys = DEFAULT_REPORT_QUERY_KEYS) {
|
|
2556
|
+
return {
|
|
2557
|
+
scope: readOne(source, keys.scope),
|
|
2558
|
+
range: { from: readDate(source, keys.from), to: readDate(source, keys.to) },
|
|
2559
|
+
statuses: readList(source, keys.statuses),
|
|
2560
|
+
currency: readOne(source, keys.currency)
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
function reportFiltersToQuery(values, keys = DEFAULT_REPORT_QUERY_KEYS) {
|
|
2564
|
+
const entries = [
|
|
2565
|
+
[keys.scope, values.scope],
|
|
2566
|
+
[keys.from, values.range.from],
|
|
2567
|
+
[keys.to, values.range.to],
|
|
2568
|
+
[keys.statuses, values.statuses.join(LIST_SEPARATOR)],
|
|
2569
|
+
[keys.currency, values.currency]
|
|
2570
|
+
];
|
|
2571
|
+
return Object.fromEntries(entries.filter(([, value]) => value !== ""));
|
|
2572
|
+
}
|
|
2573
|
+
function reportFiltersToSearch(values, keys = DEFAULT_REPORT_QUERY_KEYS) {
|
|
2574
|
+
return new URLSearchParams(reportFiltersToQuery(values, keys)).toString();
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
// src/ReportFilters/hooks/useReportDraft.ts
|
|
2578
|
+
function useReportDraft(value, onChange) {
|
|
2579
|
+
const committedKey = reportFiltersToSearch(value);
|
|
2580
|
+
const [draft, setDraft] = React2.useState(value);
|
|
2581
|
+
const [seenKey, setSeenKey] = React2.useState(committedKey);
|
|
2582
|
+
if (seenKey !== committedKey) {
|
|
2583
|
+
setSeenKey(committedKey);
|
|
2584
|
+
setDraft(value);
|
|
2585
|
+
}
|
|
2586
|
+
const edit = React2.useCallback(
|
|
2587
|
+
(next) => {
|
|
2588
|
+
setDraft(next);
|
|
2589
|
+
if (!isRangeInverted(next.range)) onChange(next);
|
|
2590
|
+
},
|
|
2591
|
+
[onChange]
|
|
2592
|
+
);
|
|
2593
|
+
return { draft, edit };
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
// src/ReportFilters/utils/reportFields.ts
|
|
2597
|
+
var EMPTY_RANGE2 = { from: "", to: "" };
|
|
2598
|
+
function buildReportFields(options, labels, values) {
|
|
2599
|
+
return [
|
|
2600
|
+
{ key: REPORT_FIELD_KEYS.scope, kind: "select", label: labels.scope, options: options.scopes },
|
|
2601
|
+
{
|
|
2602
|
+
key: REPORT_FIELD_KEYS.range,
|
|
2603
|
+
kind: "dateRange",
|
|
2604
|
+
label: labels.range,
|
|
2605
|
+
fromLabel: labels.from,
|
|
2606
|
+
toLabel: labels.to,
|
|
2607
|
+
error: isRangeInverted(values.range) ? labels.invalidRange : void 0
|
|
2608
|
+
},
|
|
2609
|
+
{ key: REPORT_FIELD_KEYS.statuses, kind: "multiSelect", label: labels.statuses, options: options.statuses },
|
|
2610
|
+
{ key: REPORT_FIELD_KEYS.currency, kind: "select", label: labels.currency, options: options.currencies }
|
|
2611
|
+
];
|
|
2612
|
+
}
|
|
2613
|
+
function toFilterValues(values) {
|
|
2614
|
+
return {
|
|
2615
|
+
[REPORT_FIELD_KEYS.scope]: values.scope,
|
|
2616
|
+
[REPORT_FIELD_KEYS.range]: values.range,
|
|
2617
|
+
[REPORT_FIELD_KEYS.statuses]: values.statuses,
|
|
2618
|
+
[REPORT_FIELD_KEYS.currency]: values.currency
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
function asText(value) {
|
|
2622
|
+
return typeof value === "string" ? value : "";
|
|
2623
|
+
}
|
|
2624
|
+
function asList2(value) {
|
|
2625
|
+
return Array.isArray(value) ? value : [];
|
|
2626
|
+
}
|
|
2627
|
+
function asRange2(value) {
|
|
2628
|
+
const isRange = typeof value === "object" && !Array.isArray(value) && "from" in value;
|
|
2629
|
+
return isRange ? value : EMPTY_RANGE2;
|
|
2630
|
+
}
|
|
2631
|
+
function fromFilterValues(map) {
|
|
2632
|
+
return {
|
|
2633
|
+
scope: asText(map[REPORT_FIELD_KEYS.scope]),
|
|
2634
|
+
range: asRange2(map[REPORT_FIELD_KEYS.range]),
|
|
2635
|
+
statuses: asList2(map[REPORT_FIELD_KEYS.statuses]),
|
|
2636
|
+
currency: asText(map[REPORT_FIELD_KEYS.currency])
|
|
2637
|
+
};
|
|
2638
|
+
}
|
|
2639
|
+
var COMPACT_GAP = 8;
|
|
2640
|
+
function ReportFilters({
|
|
2641
|
+
value,
|
|
2642
|
+
onChange,
|
|
2643
|
+
options,
|
|
2644
|
+
labels,
|
|
2645
|
+
actions,
|
|
2646
|
+
compact,
|
|
2647
|
+
renderSelect,
|
|
2648
|
+
testID = REPORT_FILTERS_TEST_ID
|
|
2649
|
+
}) {
|
|
2650
|
+
const { width } = reactNative.useWindowDimensions();
|
|
2651
|
+
const [panelOpen, setPanelOpen] = React2.useState(false);
|
|
2652
|
+
const { draft, edit } = useReportDraft(value, onChange);
|
|
2653
|
+
const fields = React2.useMemo(() => buildReportFields(options, labels, draft), [options, labels, draft]);
|
|
2654
|
+
const values = React2.useMemo(() => toFilterValues(draft), [draft]);
|
|
2655
|
+
const handleChange = React2.useCallback((next) => edit(fromFilterValues(next)), [edit]);
|
|
2656
|
+
const isCompact = compact ?? width < CARD_STACK_BREAKPOINT;
|
|
2657
|
+
const renderBar = (barTestID, barActions) => /* @__PURE__ */ jsxRuntime.jsx(Filters, { fields, values, onChange: handleChange, actions: barActions, renderSelect, testID: barTestID });
|
|
2658
|
+
if (!isCompact) return renderBar(testID, actions);
|
|
2659
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.compactRow, testID, children: [
|
|
2660
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2661
|
+
ActionButton,
|
|
2662
|
+
{
|
|
2663
|
+
label: labels.openPanel,
|
|
2664
|
+
hint: labels.openPanelHint,
|
|
2665
|
+
tone: "ghost",
|
|
2666
|
+
onPress: () => setPanelOpen(true),
|
|
2667
|
+
testID: openPanelTestID(testID)
|
|
2668
|
+
}
|
|
2669
|
+
),
|
|
2670
|
+
actions,
|
|
2671
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2672
|
+
FilterSidePanel,
|
|
2673
|
+
{
|
|
2674
|
+
visible: panelOpen,
|
|
2675
|
+
onClose: () => setPanelOpen(false),
|
|
2676
|
+
title: labels.panelTitle,
|
|
2677
|
+
closeLabel: labels.closePanel,
|
|
2678
|
+
closeHint: labels.closePanelHint,
|
|
2679
|
+
testID: panelTestID(testID),
|
|
2680
|
+
children: renderBar(panelFiltersTestID(testID))
|
|
2681
|
+
}
|
|
2682
|
+
)
|
|
2683
|
+
] });
|
|
2684
|
+
}
|
|
2685
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
2686
|
+
compactRow: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: COMPACT_GAP }
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2689
|
+
// src/ExportCsvAction/ExportOutcome.ts
|
|
2690
|
+
var ExportOutcome = /* @__PURE__ */ ((ExportOutcome2) => {
|
|
2691
|
+
ExportOutcome2["Downloaded"] = "downloaded";
|
|
2692
|
+
ExportOutcome2["Unsupported"] = "unsupported";
|
|
2693
|
+
ExportOutcome2["Failed"] = "failed";
|
|
2694
|
+
return ExportOutcome2;
|
|
2695
|
+
})(ExportOutcome || {});
|
|
2696
|
+
|
|
2697
|
+
// src/ExportCsvAction/utils/downloadCsv.ts
|
|
2698
|
+
var CSV_MIME = "text/csv;charset=utf-8";
|
|
2699
|
+
var UTF8_BOM = "\uFEFF";
|
|
2700
|
+
var CSV_EXTENSION = ".csv";
|
|
2701
|
+
var UNSAFE_FILENAME_CHARS = /[^A-Za-z0-9._-]+/g;
|
|
2702
|
+
var SAFE_REPLACEMENT = "-";
|
|
2703
|
+
var RANGE_JOINER = "--";
|
|
2704
|
+
var PART_JOINER = "_";
|
|
2705
|
+
function csvFilename(base, range) {
|
|
2706
|
+
const safeBase = base.trim().replace(UNSAFE_FILENAME_CHARS, SAFE_REPLACEMENT);
|
|
2707
|
+
if (range === void 0) return `${safeBase}${CSV_EXTENSION}`;
|
|
2708
|
+
const hasRange = range.from !== "" || range.to !== "";
|
|
2709
|
+
const name = hasRange ? `${safeBase}${PART_JOINER}${range.from}${RANGE_JOINER}${range.to}` : safeBase;
|
|
2710
|
+
return `${name}${CSV_EXTENSION}`;
|
|
2711
|
+
}
|
|
2712
|
+
function downloadCsv(csv, filename) {
|
|
2713
|
+
const hasDom = typeof document !== "undefined" && typeof URL !== "undefined";
|
|
2714
|
+
if (!hasDom || typeof URL.createObjectURL !== "function") return false;
|
|
2715
|
+
const url = URL.createObjectURL(new Blob([UTF8_BOM, csv], { type: CSV_MIME }));
|
|
2716
|
+
const link = document.createElement("a");
|
|
2717
|
+
link.href = url;
|
|
2718
|
+
link.download = filename;
|
|
2719
|
+
link.style.display = "none";
|
|
2720
|
+
document.body.appendChild(link);
|
|
2721
|
+
link.click();
|
|
2722
|
+
document.body.removeChild(link);
|
|
2723
|
+
URL.revokeObjectURL(url);
|
|
2724
|
+
return true;
|
|
2725
|
+
}
|
|
2726
|
+
async function runCsvExport(rows, columns, filename, download = downloadCsv) {
|
|
2727
|
+
try {
|
|
2728
|
+
const data = typeof rows === "function" ? await rows() : rows;
|
|
2729
|
+
return download(utils.toCsv(data, columns), filename) ? "downloaded" /* Downloaded */ : "unsupported" /* Unsupported */;
|
|
2730
|
+
} catch {
|
|
2731
|
+
return "failed" /* Failed */;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
var EXPORT_CSV_TEST_ID = "ui-export-csv";
|
|
2735
|
+
function ExportCsvAction({
|
|
2736
|
+
rows,
|
|
2737
|
+
columns,
|
|
2738
|
+
filename,
|
|
2739
|
+
label,
|
|
2740
|
+
hint,
|
|
2741
|
+
disabled = false,
|
|
2742
|
+
onDone,
|
|
2743
|
+
testID = EXPORT_CSV_TEST_ID
|
|
2744
|
+
}) {
|
|
2745
|
+
const [busy, setBusy] = React2.useState(false);
|
|
2746
|
+
const run = React2.useCallback(async () => {
|
|
2747
|
+
setBusy(true);
|
|
2748
|
+
const outcome = await runCsvExport(rows, columns, filename);
|
|
2749
|
+
setBusy(false);
|
|
2750
|
+
onDone?.(outcome);
|
|
2751
|
+
}, [rows, columns, filename, onDone]);
|
|
2752
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2753
|
+
uiButtons.Button,
|
|
2754
|
+
{
|
|
2755
|
+
label,
|
|
2756
|
+
accessibilityLabel: label,
|
|
2757
|
+
accessibilityHint: hint,
|
|
2758
|
+
disabled,
|
|
2759
|
+
loading: busy,
|
|
2760
|
+
onPress: () => {
|
|
2761
|
+
void run();
|
|
2762
|
+
},
|
|
2763
|
+
testID
|
|
2764
|
+
}
|
|
2765
|
+
);
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2414
2768
|
Object.defineProperty(exports, "DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS", {
|
|
2415
2769
|
enumerable: true,
|
|
2416
2770
|
get: function () { return uiForms.DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS; }
|
|
@@ -2430,11 +2784,17 @@ Object.defineProperty(exports, "suggestOptions", {
|
|
|
2430
2784
|
exports.CARD_STACK_BREAKPOINT = CARD_STACK_BREAKPOINT;
|
|
2431
2785
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
2432
2786
|
exports.DEFAULT_PAGE_SIZE_OPTIONS = DEFAULT_PAGE_SIZE_OPTIONS;
|
|
2787
|
+
exports.DEFAULT_REPORT_QUERY_KEYS = DEFAULT_REPORT_QUERY_KEYS;
|
|
2433
2788
|
exports.DataTable = DataTable;
|
|
2789
|
+
exports.EMPTY_REPORT_FILTERS = EMPTY_REPORT_FILTERS;
|
|
2790
|
+
exports.EXPORT_CSV_TEST_ID = EXPORT_CSV_TEST_ID;
|
|
2791
|
+
exports.ExportCsvAction = ExportCsvAction;
|
|
2792
|
+
exports.ExportOutcome = ExportOutcome;
|
|
2434
2793
|
exports.FIELD_MIN_WIDTH = FIELD_MIN_WIDTH;
|
|
2435
2794
|
exports.FILTERS_I18N = FILTERS_I18N;
|
|
2436
2795
|
exports.FILTERS_TEST_ID = FILTERS_TEST_ID;
|
|
2437
2796
|
exports.FilterBar = FilterBar;
|
|
2797
|
+
exports.FilterSidePanel = FilterSidePanel;
|
|
2438
2798
|
exports.Filters = Filters;
|
|
2439
2799
|
exports.LedgerLayout = LedgerLayout;
|
|
2440
2800
|
exports.MONTH_STATUS_GRID_TEST_ID = MONTH_STATUS_GRID_TEST_ID;
|
|
@@ -2443,7 +2803,10 @@ exports.MonthStatusGrid = MonthStatusGrid;
|
|
|
2443
2803
|
exports.PagedTableLayout = PagedTableLayout;
|
|
2444
2804
|
exports.PagedTableLayoutKind = PagedTableLayoutKind;
|
|
2445
2805
|
exports.Pager = Pager;
|
|
2806
|
+
exports.REPORT_FIELD_KEYS = REPORT_FIELD_KEYS;
|
|
2807
|
+
exports.REPORT_FILTERS_TEST_ID = REPORT_FILTERS_TEST_ID;
|
|
2446
2808
|
exports.RelativeTime = RelativeTime;
|
|
2809
|
+
exports.ReportFilters = ReportFilters;
|
|
2447
2810
|
exports.STATUS_LEDGER_TEST_ID = STATUS_LEDGER_TEST_ID;
|
|
2448
2811
|
exports.SortDirection = SortDirection;
|
|
2449
2812
|
exports.StatCard = StatCard;
|
|
@@ -2454,26 +2817,42 @@ exports.StatusTone = StatusTone;
|
|
|
2454
2817
|
exports.TABLE_I18N = TABLE_I18N;
|
|
2455
2818
|
exports.TABLE_TEST_IDS = TABLE_TEST_IDS;
|
|
2456
2819
|
exports.applyTestID = applyTestID;
|
|
2820
|
+
exports.buildReportFields = buildReportFields;
|
|
2457
2821
|
exports.clearTestID = clearTestID;
|
|
2822
|
+
exports.countActiveReportFilters = countActiveReportFilters;
|
|
2823
|
+
exports.csvFilename = csvFilename;
|
|
2458
2824
|
exports.distinctValues = distinctValues;
|
|
2825
|
+
exports.downloadCsv = downloadCsv;
|
|
2459
2826
|
exports.fieldTestID = fieldTestID;
|
|
2460
2827
|
exports.filterLedgerRows = filterLedgerRows;
|
|
2461
2828
|
exports.fitMonthGridColumns = fitMonthGridColumns;
|
|
2462
2829
|
exports.formatRelativeTime = formatRelativeTime;
|
|
2830
|
+
exports.fromFilterValues = fromFilterValues;
|
|
2463
2831
|
exports.isAttentionTone = isAttentionTone;
|
|
2832
|
+
exports.isIsoDate = isIsoDate;
|
|
2833
|
+
exports.isRangeInverted = isRangeInverted;
|
|
2464
2834
|
exports.ledgerSectionTestID = ledgerSectionTestID;
|
|
2465
2835
|
exports.ledgerSortDirectionTestID = ledgerSortDirectionTestID;
|
|
2466
2836
|
exports.monthCellTestID = monthCellTestID;
|
|
2837
|
+
exports.openPanelTestID = openPanelTestID;
|
|
2838
|
+
exports.panelFiltersTestID = panelFiltersTestID;
|
|
2839
|
+
exports.panelTestID = panelTestID;
|
|
2840
|
+
exports.reportFiltersFromQuery = reportFiltersFromQuery;
|
|
2841
|
+
exports.reportFiltersToQuery = reportFiltersToQuery;
|
|
2842
|
+
exports.reportFiltersToSearch = reportFiltersToSearch;
|
|
2467
2843
|
exports.resolveStatToneColor = resolveStatToneColor;
|
|
2468
2844
|
exports.rowDetailTestID = rowDetailTestID;
|
|
2469
2845
|
exports.rowFadeTestID = rowFadeTestID;
|
|
2470
2846
|
exports.rowSelectTestID = rowSelectTestID;
|
|
2471
2847
|
exports.rowTestID = rowTestID;
|
|
2848
|
+
exports.runCsvExport = runCsvExport;
|
|
2472
2849
|
exports.selectAllTestID = selectAllTestID;
|
|
2473
2850
|
exports.sortLedgerRows = sortLedgerRows;
|
|
2474
2851
|
exports.splitNeedsLook = splitNeedsLook;
|
|
2475
2852
|
exports.toEpochMs = toEpochMs;
|
|
2853
|
+
exports.toFilterValues = toFilterValues;
|
|
2476
2854
|
exports.useFilterDraft = useFilterDraft;
|
|
2477
2855
|
exports.usePagedRows = usePagedRows;
|
|
2856
|
+
exports.useReportDraft = useReportDraft;
|
|
2478
2857
|
//# sourceMappingURL=index.js.map
|
|
2479
2858
|
//# sourceMappingURL=index.js.map
|