@multiplatform.one/table 7.46.0 → 7.47.1
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/dist/cjs/components/DataTable/DataTableDocumentList.cjs +16 -6
- package/dist/cjs/components/DataTable/DataTableDocumentList.native.js +16 -6
- package/dist/cjs/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableMobileCards.cjs +17 -5
- package/dist/cjs/components/DataTable/DataTableMobileCards.native.js +17 -5
- package/dist/cjs/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableRoot.cjs +46 -33
- package/dist/cjs/components/DataTable/DataTableRoot.native.js +58 -36
- package/dist/cjs/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableVirtualized.cjs +8 -3
- package/dist/cjs/components/DataTable/DataTableVirtualized.native.js +9 -3
- package/dist/cjs/components/DataTable/DataTableVirtualized.native.js.map +1 -1
- package/dist/cjs/components/DataTable/dataTableChrome.cjs +12 -0
- package/dist/cjs/components/DataTable/dataTableChrome.native.js +12 -0
- package/dist/cjs/components/DataTable/dataTableChrome.native.js.map +1 -1
- package/dist/cjs/components/DataTable/index.native.js +58 -32
- package/dist/cjs/components/DataTable/index.native.js.map +1 -1
- package/dist/cjs/components/DataTable/rowStateChrome.cjs +3 -2
- package/dist/cjs/components/DataTable/rowStateChrome.native.js +4 -3
- package/dist/cjs/components/DataTable/rowStateChrome.native.js.map +1 -1
- package/dist/cjs/components/DataTableDateFilter/index.cjs +2 -2
- package/dist/cjs/components/DataTableDateFilter/index.native.js +2 -2
- package/dist/cjs/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableExport/index.cjs +4 -4
- package/dist/cjs/components/DataTableExport/index.native.js +4 -4
- package/dist/cjs/components/DataTableExport/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableFilterButton/index.cjs +3 -3
- package/dist/cjs/components/DataTableFilterButton/index.native.js +3 -3
- package/dist/cjs/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableFilters/index.cjs +2 -1
- package/dist/cjs/components/DataTableFilters/index.native.js +2 -1
- package/dist/cjs/components/DataTableFilters/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableGrouping/index.cjs +19 -13
- package/dist/cjs/components/DataTableGrouping/index.native.js +20 -13
- package/dist/cjs/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableSearch/index.cjs +2 -1
- package/dist/cjs/components/DataTableSearch/index.native.js +2 -1
- package/dist/cjs/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableViewOptions/index.cjs +4 -5
- package/dist/cjs/components/DataTableViewOptions/index.native.js +4 -5
- package/dist/cjs/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/cjs/components/FilterManager.cjs +3 -2
- package/dist/cjs/components/FilterManager.native.js +3 -2
- package/dist/cjs/components/FilterManager.native.js.map +1 -1
- package/dist/cjs/components/SimpleTable/index.cjs +16 -2
- package/dist/cjs/components/SimpleTable/index.native.js +17 -2
- package/dist/cjs/components/SimpleTable/index.native.js.map +1 -1
- package/dist/cjs/components/TableInput/index.cjs +3 -3
- package/dist/cjs/components/TableInput/index.native.js +5 -4
- package/dist/cjs/components/TableInput/index.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableDocumentList.mjs +16 -6
- package/dist/esm/components/DataTable/DataTableDocumentList.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableDocumentList.native.js +16 -6
- package/dist/esm/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableMobileCards.mjs +16 -4
- package/dist/esm/components/DataTable/DataTableMobileCards.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableMobileCards.native.js +16 -4
- package/dist/esm/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.mjs +49 -36
- package/dist/esm/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.native.js +61 -39
- package/dist/esm/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableVirtualized.mjs +10 -5
- package/dist/esm/components/DataTable/DataTableVirtualized.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableVirtualized.native.js +11 -5
- package/dist/esm/components/DataTable/DataTableVirtualized.native.js.map +1 -1
- package/dist/esm/components/DataTable/dataTableChrome.mjs +12 -1
- package/dist/esm/components/DataTable/dataTableChrome.mjs.map +1 -1
- package/dist/esm/components/DataTable/dataTableChrome.native.js +12 -1
- package/dist/esm/components/DataTable/dataTableChrome.native.js.map +1 -1
- package/dist/esm/components/DataTable/index.native.js +61 -35
- package/dist/esm/components/DataTable/index.native.js.map +1 -1
- package/dist/esm/components/DataTable/rowStateChrome.mjs +3 -2
- package/dist/esm/components/DataTable/rowStateChrome.mjs.map +1 -1
- package/dist/esm/components/DataTable/rowStateChrome.native.js +4 -3
- package/dist/esm/components/DataTable/rowStateChrome.native.js.map +1 -1
- package/dist/esm/components/DataTableDateFilter/index.mjs +7 -7
- package/dist/esm/components/DataTableDateFilter/index.mjs.map +1 -1
- package/dist/esm/components/DataTableDateFilter/index.native.js +7 -7
- package/dist/esm/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/esm/components/DataTableExport/index.mjs +7 -7
- package/dist/esm/components/DataTableExport/index.mjs.map +1 -1
- package/dist/esm/components/DataTableExport/index.native.js +7 -7
- package/dist/esm/components/DataTableExport/index.native.js.map +1 -1
- package/dist/esm/components/DataTableFilterButton/index.mjs +2 -2
- package/dist/esm/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/esm/components/DataTableFilterButton/index.native.js +2 -2
- package/dist/esm/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/esm/components/DataTableFilters/index.mjs +2 -1
- package/dist/esm/components/DataTableFilters/index.mjs.map +1 -1
- package/dist/esm/components/DataTableFilters/index.native.js +2 -1
- package/dist/esm/components/DataTableFilters/index.native.js.map +1 -1
- package/dist/esm/components/DataTableGrouping/index.mjs +18 -12
- package/dist/esm/components/DataTableGrouping/index.mjs.map +1 -1
- package/dist/esm/components/DataTableGrouping/index.native.js +19 -12
- package/dist/esm/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/esm/components/DataTableSearch/index.mjs +7 -6
- package/dist/esm/components/DataTableSearch/index.mjs.map +1 -1
- package/dist/esm/components/DataTableSearch/index.native.js +7 -6
- package/dist/esm/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/esm/components/DataTableViewOptions/index.mjs +10 -11
- package/dist/esm/components/DataTableViewOptions/index.mjs.map +1 -1
- package/dist/esm/components/DataTableViewOptions/index.native.js +10 -11
- package/dist/esm/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/esm/components/FilterManager.mjs +2 -1
- package/dist/esm/components/FilterManager.mjs.map +1 -1
- package/dist/esm/components/FilterManager.native.js +2 -1
- package/dist/esm/components/FilterManager.native.js.map +1 -1
- package/dist/esm/components/SimpleTable/index.mjs +18 -4
- package/dist/esm/components/SimpleTable/index.mjs.map +1 -1
- package/dist/esm/components/SimpleTable/index.native.js +19 -4
- package/dist/esm/components/SimpleTable/index.native.js.map +1 -1
- package/dist/esm/components/TableInput/index.mjs +2 -2
- package/dist/esm/components/TableInput/index.mjs.map +1 -1
- package/dist/esm/components/TableInput/index.native.js +2 -1
- package/dist/esm/components/TableInput/index.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableDocumentList.mjs +16 -6
- package/dist/jsx/components/DataTable/DataTableDocumentList.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableDocumentList.native.js +16 -6
- package/dist/jsx/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableMobileCards.mjs +16 -4
- package/dist/jsx/components/DataTable/DataTableMobileCards.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableMobileCards.native.js +17 -5
- package/dist/jsx/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.mjs +49 -36
- package/dist/jsx/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.native.js +58 -36
- package/dist/jsx/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableVirtualized.mjs +10 -5
- package/dist/jsx/components/DataTable/DataTableVirtualized.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableVirtualized.native.js +9 -3
- package/dist/jsx/components/DataTable/DataTableVirtualized.native.js.map +1 -1
- package/dist/jsx/components/DataTable/dataTableChrome.mjs +12 -1
- package/dist/jsx/components/DataTable/dataTableChrome.mjs.map +1 -1
- package/dist/jsx/components/DataTable/dataTableChrome.native.js +12 -0
- package/dist/jsx/components/DataTable/dataTableChrome.native.js.map +1 -1
- package/dist/jsx/components/DataTable/index.native.js +58 -32
- package/dist/jsx/components/DataTable/index.native.js.map +1 -1
- package/dist/jsx/components/DataTable/rowStateChrome.mjs +3 -2
- package/dist/jsx/components/DataTable/rowStateChrome.mjs.map +1 -1
- package/dist/jsx/components/DataTable/rowStateChrome.native.js +4 -3
- package/dist/jsx/components/DataTable/rowStateChrome.native.js.map +1 -1
- package/dist/jsx/components/DataTableDateFilter/index.mjs +7 -7
- package/dist/jsx/components/DataTableDateFilter/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableDateFilter/index.native.js +2 -2
- package/dist/jsx/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableExport/index.mjs +7 -7
- package/dist/jsx/components/DataTableExport/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableExport/index.native.js +4 -4
- package/dist/jsx/components/DataTableExport/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableFilterButton/index.mjs +2 -2
- package/dist/jsx/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableFilterButton/index.native.js +3 -3
- package/dist/jsx/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableFilters/index.mjs +2 -1
- package/dist/jsx/components/DataTableFilters/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableFilters/index.native.js +2 -1
- package/dist/jsx/components/DataTableFilters/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableGrouping/index.mjs +18 -12
- package/dist/jsx/components/DataTableGrouping/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableGrouping/index.native.js +20 -13
- package/dist/jsx/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableSearch/index.mjs +7 -6
- package/dist/jsx/components/DataTableSearch/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableSearch/index.native.js +2 -1
- package/dist/jsx/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableViewOptions/index.mjs +10 -11
- package/dist/jsx/components/DataTableViewOptions/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableViewOptions/index.native.js +4 -5
- package/dist/jsx/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/jsx/components/FilterManager.mjs +2 -1
- package/dist/jsx/components/FilterManager.mjs.map +1 -1
- package/dist/jsx/components/FilterManager.native.js +3 -2
- package/dist/jsx/components/FilterManager.native.js.map +1 -1
- package/dist/jsx/components/SimpleTable/index.mjs +18 -4
- package/dist/jsx/components/SimpleTable/index.mjs.map +1 -1
- package/dist/jsx/components/SimpleTable/index.native.js +17 -2
- package/dist/jsx/components/SimpleTable/index.native.js.map +1 -1
- package/dist/jsx/components/TableInput/index.mjs +2 -2
- package/dist/jsx/components/TableInput/index.mjs.map +1 -1
- package/dist/jsx/components/TableInput/index.native.js +5 -4
- package/dist/jsx/components/TableInput/index.native.js.map +1 -1
- package/package.json +12 -12
- package/src/components/DataTable/DataTable.stories.tsx +72 -2
- package/src/components/DataTable/DataTableCardControls.stories.tsx +2 -1
- package/src/components/DataTable/DataTableDocumentList.tsx +17 -3
- package/src/components/DataTable/DataTableMobileCards.tsx +17 -4
- package/src/components/DataTable/DataTableRoot.tsx +126 -89
- package/src/components/DataTable/DataTableVirtualized.tsx +10 -5
- package/src/components/DataTable/FieldsInCells.stories.tsx +4 -3
- package/src/components/DataTable/caretTransform.native.spec.tsx +129 -0
- package/src/components/DataTable/dataTableChrome.ts +21 -0
- package/src/components/DataTable/index.native.tsx +87 -35
- package/src/components/DataTable/numericHeaderEdge.spec.tsx +96 -0
- package/src/components/DataTable/rowStateChrome.ts +9 -2
- package/src/components/DataTableBulkActions/DataTableBulkActions.stories.tsx +2 -1
- package/src/components/DataTableCell/CellOptionsEditor.stories.tsx +2 -1
- package/src/components/DataTableCell/DataTableCell.stories.tsx +8 -7
- package/src/components/DataTableColumnPinning/DataTableColumnPinning.stories.tsx +2 -1
- package/src/components/DataTableDateFilter/DataTableDateFilter.stories.tsx +2 -1
- package/src/components/DataTableDateFilter/index.tsx +20 -12
- package/src/components/DataTableExport/DataTableExport.stories.tsx +2 -1
- package/src/components/DataTableExport/index.tsx +12 -12
- package/src/components/DataTableFilterButton/index.tsx +2 -2
- package/src/components/DataTableFilterChips/FilterChip.stories.tsx +2 -1
- package/src/components/DataTableFilters/DataTableFilters.stories.tsx +2 -2
- package/src/components/DataTableFilters/index.tsx +2 -1
- package/src/components/DataTableGrouping/DataTableGrouping.stories.tsx +2 -1
- package/src/components/DataTableGrouping/index.tsx +22 -19
- package/src/components/DataTablePagination/DataTablePagination.stories.tsx +9 -4
- package/src/components/DataTableSearch/index.tsx +12 -11
- package/src/components/DataTableViewOptions/DataTableViewOptions.stories.tsx +2 -1
- package/src/components/DataTableViewOptions/index.tsx +26 -19
- package/src/components/FilterManager.tsx +2 -1
- package/src/components/FilterOperatorValueEditor/FilterOperatorValueEditor.stories.tsx +2 -1
- package/src/components/KnobDialog.stories.tsx +2 -1
- package/src/components/SimpleTable/SimpleTable.stories.tsx +28 -0
- package/src/components/SimpleTable/index.tsx +27 -4
- package/src/components/SimpleTable/simpleTable.spec.tsx +1 -1
- package/src/components/TableInput/TableInput.stories.tsx +6 -5
- package/src/components/TableInput/index.native.tsx +2 -1
- package/src/components/TableInput/index.tsx +2 -1
- package/src/components/phoneTableBleed.spec.tsx +224 -0
- package/src/components/tableZebraDefault.spec.tsx +98 -0
- package/types/components/DataTable/DataTableDocumentList.d.ts +4 -1
- package/types/components/DataTable/DataTableDocumentList.d.ts.map +1 -1
- package/types/components/DataTable/DataTableMobileCards.d.ts +4 -1
- package/types/components/DataTable/DataTableMobileCards.d.ts.map +1 -1
- package/types/components/DataTable/DataTableRoot.d.ts.map +1 -1
- package/types/components/DataTable/DataTableVirtualized.d.ts.map +1 -1
- package/types/components/DataTable/dataTableChrome.d.ts +6 -0
- package/types/components/DataTable/dataTableChrome.d.ts.map +1 -1
- package/types/components/DataTable/index.native.d.ts.map +1 -1
- package/types/components/DataTable/rowStateChrome.d.ts +6 -0
- package/types/components/DataTable/rowStateChrome.d.ts.map +1 -1
- package/types/components/DataTableDateFilter/index.d.ts.map +1 -1
- package/types/components/DataTableFilters/index.d.ts.map +1 -1
- package/types/components/DataTableGrouping/index.d.ts.map +1 -1
- package/types/components/DataTableSearch/index.d.ts.map +1 -1
- package/types/components/DataTableViewOptions/index.d.ts.map +1 -1
- package/types/components/FilterManager.d.ts.map +1 -1
- package/types/components/SimpleTable/index.d.ts.map +1 -1
- package/types/components/TableInput/index.d.ts.map +1 -1
- package/types/components/TableInput/index.native.d.ts.map +1 -1
|
@@ -14,17 +14,30 @@ import {
|
|
|
14
14
|
TrashIcon,
|
|
15
15
|
} from "@phosphor-icons/react";
|
|
16
16
|
import { FlashList, type FlashListRef } from "@shopify/flash-list";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
AsyncBoundary,
|
|
19
|
+
EmptyState,
|
|
20
|
+
useDirection,
|
|
21
|
+
ScrollView,
|
|
22
|
+
Text,
|
|
23
|
+
} from "@multiplatform.one/components";
|
|
18
24
|
import { Button, Field, useFormField } from "@multiplatform.one/forms";
|
|
19
25
|
import { flexRender } from "@tanstack/react-table";
|
|
20
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
sizeTokenStep,
|
|
28
|
+
useGlyphColor,
|
|
29
|
+
usePhoneTableBleed,
|
|
30
|
+
useResolvedKnobs,
|
|
31
|
+
Surface,
|
|
32
|
+
} from "@multiplatform.one/theme";
|
|
21
33
|
import React, { useRef, useMemo, useCallback } from "react";
|
|
22
34
|
import type { FontSizeTokens, SizeTokens } from "tamagui";
|
|
23
|
-
import { Text, View, useMedia, withStaticProperties } from "tamagui";
|
|
35
|
+
import { Text as TamaguiText, View, useMedia, withStaticProperties } from "tamagui";
|
|
24
36
|
import { useTranslation } from "react-i18next";
|
|
25
37
|
import { useDataTable } from "../../hooks/useDataTable";
|
|
26
38
|
import type { BulkAction, DataTableColumn, DataTableField, SelectAllScope } from "../../types";
|
|
27
39
|
import { DEFAULT_PAGE_SIZE_OPTIONS, INFINITE_TRIGGER_ROWS } from "../../utils/paginationDefaults";
|
|
40
|
+
import { alignToFlex, getDefaultColumnAlign } from "../../utils/columnAlign";
|
|
28
41
|
import { withInterp } from "../../utils/withInterp";
|
|
29
42
|
import { DataTableColumnPinning } from "../DataTableColumnPinning";
|
|
30
43
|
import { DataTablePagination } from "../DataTablePagination";
|
|
@@ -42,7 +55,12 @@ import { DataTableContext } from "./DataTableContext";
|
|
|
42
55
|
import { DataTableDocumentList } from "./DataTableDocumentList";
|
|
43
56
|
import { DataTableInfiniteTail } from "./DataTableInfiniteTail";
|
|
44
57
|
import { DataTableMobileCards } from "./DataTableMobileCards";
|
|
45
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
bledDataTableChrome,
|
|
60
|
+
dataTableChrome,
|
|
61
|
+
resolveDataTableIntent,
|
|
62
|
+
rowIntentProps,
|
|
63
|
+
} from "./dataTableChrome";
|
|
46
64
|
import { NativeInfiniteSentinel } from "./NativeInfiniteSentinel";
|
|
47
65
|
import { tableRowStateProps } from "./rowStateChrome";
|
|
48
66
|
import { DataTableStateContext } from "./DataTableStateContext";
|
|
@@ -75,11 +93,22 @@ function NativeCellContent({
|
|
|
75
93
|
}) {
|
|
76
94
|
const rendered = typeof cellDef === "function" ? cellDef(ctx) : cellDef;
|
|
77
95
|
if (typeof rendered === "string" || typeof rendered === "number") {
|
|
78
|
-
return <
|
|
96
|
+
return <TamaguiText {...(fontSize ? { fontSize } : {})}>{String(rendered)}</TamaguiText>;
|
|
79
97
|
}
|
|
80
98
|
return rendered ?? null;
|
|
81
99
|
}
|
|
82
100
|
|
|
101
|
+
/** DG-TBL-01 column alignment, resolved as the web root resolves it. */
|
|
102
|
+
function resolveColumnAlign(column: DataTableColumn, id: string) {
|
|
103
|
+
return getDefaultColumnAlign({
|
|
104
|
+
id,
|
|
105
|
+
align: column.align,
|
|
106
|
+
field: column.field ?? "input",
|
|
107
|
+
fieldProps: column.fieldProps,
|
|
108
|
+
meta: column.meta as { align?: "left" | "center" | "right"; role?: string } | undefined,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
83
112
|
/** Maps field type to filter-compatible types */
|
|
84
113
|
function mapFieldToFilterType(
|
|
85
114
|
field?: DataTableField,
|
|
@@ -191,13 +220,19 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
191
220
|
// the certified compact pattern; `table` pins the grid.
|
|
192
221
|
const showList = layout === "list";
|
|
193
222
|
const showCards = !showList && (layout === "cards" || (layout === "auto" && !sm));
|
|
223
|
+
// LC-146: on the page line below `$sm` the body runs edge to edge.
|
|
224
|
+
const bleed = usePhoneTableBleed();
|
|
194
225
|
const intent = resolveDataTableIntent({ accent, error, warning, success });
|
|
195
226
|
const { knobProps, disabledState } = useResolvedKnobs({
|
|
196
227
|
intent,
|
|
197
228
|
component: "DataTable",
|
|
198
229
|
size,
|
|
199
230
|
});
|
|
200
|
-
const chrome =
|
|
231
|
+
const chrome = bledDataTableChrome(
|
|
232
|
+
dataTableChrome(String(knobProps.sizeToken)),
|
|
233
|
+
bleed?.inset,
|
|
234
|
+
enableRowSelection,
|
|
235
|
+
);
|
|
201
236
|
const bulkBarPlacement = knobProps.bulkBarPlacement === "bottom" ? "bottom" : "top";
|
|
202
237
|
// House selectAllScope knob (DG-TBL-03): prop overrides knob; default page.
|
|
203
238
|
const selectAllScope: SelectAllScope =
|
|
@@ -205,10 +240,14 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
205
240
|
const rowHeightPx = chrome.rowPx;
|
|
206
241
|
// Collapsed expand-caret points toward inline-end, so it mirrors in RTL via
|
|
207
242
|
// glyph swap (useDirection, Axiom 15); rotation sign flips so expanded
|
|
208
|
-
// still points down.
|
|
243
|
+
// still points down. Carets turn on a wrapping View: a glyph here is
|
|
244
|
+
// react-native-svg's Svg, which throws on a CSS transform string (FZ-7741).
|
|
209
245
|
const isRTL = useDirection() === "rtl";
|
|
210
246
|
const ExpandCaretIcon = isRTL ? CaretLeftIcon : CaretRightIcon;
|
|
211
|
-
const expandedCaretRotation = isRTL ? "
|
|
247
|
+
const expandedCaretRotation = isRTL ? "-90deg" : "90deg";
|
|
248
|
+
const caretInk = useGlyphColor();
|
|
249
|
+
const sortedCaretInk = useGlyphColor("$color10");
|
|
250
|
+
const idleCaretInk = useGlyphColor("$color8");
|
|
212
251
|
const { resolvedForm } = useFormField({ form: formProp });
|
|
213
252
|
|
|
214
253
|
const isFormMode = Boolean(name && resolvedForm);
|
|
@@ -475,10 +514,9 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
475
514
|
})
|
|
476
515
|
}
|
|
477
516
|
>
|
|
478
|
-
<
|
|
479
|
-
size={chrome.iconPx}
|
|
480
|
-
|
|
481
|
-
/>
|
|
517
|
+
<View rotate={row.getIsExpanded() ? expandedCaretRotation : "0deg"}>
|
|
518
|
+
<ExpandCaretIcon size={chrome.iconPx} color={caretInk} />
|
|
519
|
+
</View>
|
|
482
520
|
</View>
|
|
483
521
|
) : (
|
|
484
522
|
<View width={chrome.iconPx} />
|
|
@@ -489,6 +527,10 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
489
527
|
const isFirstDataCell = cellIndex === 0 && !showRowNumbers && !enableRowExpansion;
|
|
490
528
|
const isLastDataCell = cellIndex === row.getVisibleCells().length - 1 && !showDeleteRow;
|
|
491
529
|
const cellLocation = isFirstDataCell ? "first" : isLastDataCell ? "last" : "middle";
|
|
530
|
+
const columnAlign = resolveColumnAlign(
|
|
531
|
+
cell.column.columnDef as DataTableColumn,
|
|
532
|
+
cell.column.id,
|
|
533
|
+
);
|
|
492
534
|
return (
|
|
493
535
|
<Table.Cell
|
|
494
536
|
key={cell.id}
|
|
@@ -496,6 +538,8 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
496
538
|
cellHeight={cellHeight as any}
|
|
497
539
|
cellLocation={cellLocation}
|
|
498
540
|
minWidth={0}
|
|
541
|
+
justifyContent={alignToFlex(columnAlign)}
|
|
542
|
+
data-align={columnAlign}
|
|
499
543
|
>
|
|
500
544
|
{renderCellContent(cell, rowIndex, rowData)}
|
|
501
545
|
</Table.Cell>
|
|
@@ -539,6 +583,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
539
583
|
t,
|
|
540
584
|
ExpandCaretIcon,
|
|
541
585
|
expandedCaretRotation,
|
|
586
|
+
caretInk,
|
|
542
587
|
],
|
|
543
588
|
);
|
|
544
589
|
|
|
@@ -612,6 +657,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
612
657
|
zebraOn: tableZebraOn,
|
|
613
658
|
index,
|
|
614
659
|
pressable: rowPressActive,
|
|
660
|
+
surface: bleed ? "$background" : undefined,
|
|
615
661
|
}) as any)}
|
|
616
662
|
rowLocation="middle"
|
|
617
663
|
key={`${row.id}-${index}`}
|
|
@@ -626,7 +672,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
626
672
|
{renderRowContent(row, index)}
|
|
627
673
|
</Table.Row>
|
|
628
674
|
),
|
|
629
|
-
[renderRowContent, tableZebraOn, t, getRowPressProps, rowPressActive],
|
|
675
|
+
[renderRowContent, tableZebraOn, t, getRowPressProps, rowPressActive, bleed],
|
|
630
676
|
);
|
|
631
677
|
|
|
632
678
|
const renderToolbarComponent = () => {
|
|
@@ -785,6 +831,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
785
831
|
renderCellContent={renderCellContent}
|
|
786
832
|
selectRowLabel={deriveSelectRowLabel}
|
|
787
833
|
queryInFlight={queryInFlight}
|
|
834
|
+
bleed={bleed}
|
|
788
835
|
{...(rowPressActive ? { getRowPressProps } : {})}
|
|
789
836
|
/>
|
|
790
837
|
</Surface>
|
|
@@ -808,6 +855,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
808
855
|
onToggleSelectAll={toggleSelectAll}
|
|
809
856
|
selectRowLabel={deriveSelectRowLabel}
|
|
810
857
|
queryInFlight={queryInFlight}
|
|
858
|
+
bleed={bleed}
|
|
811
859
|
{...(rowPressActive ? { getRowPressProps } : {})}
|
|
812
860
|
/>
|
|
813
861
|
</Surface>
|
|
@@ -819,7 +867,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
819
867
|
</View>
|
|
820
868
|
) : (
|
|
821
869
|
<Surface size={tableSize}>
|
|
822
|
-
<ScrollView horizontal maxWidth
|
|
870
|
+
<ScrollView horizontal {...(bleed ? bleed.frame : { maxWidth: "100%" })}>
|
|
823
871
|
<View
|
|
824
872
|
flex={1}
|
|
825
873
|
flexDirection="column"
|
|
@@ -831,6 +879,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
831
879
|
alignCells={{ x: "start", y: "center" }}
|
|
832
880
|
alignHeaderCells={{ x: "start", y: "center" }}
|
|
833
881
|
cellHeight={cellHeight}
|
|
882
|
+
edgeInset={bleed?.inset ?? null}
|
|
834
883
|
{...knobProps.borderRadiusOuter}
|
|
835
884
|
width="100%"
|
|
836
885
|
aria-label={ariaLabel || "Data table"}
|
|
@@ -876,6 +925,24 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
876
925
|
const sortDirection = header.column.getIsSorted();
|
|
877
926
|
const isLastHeader =
|
|
878
927
|
headerIndex === headerGroup.headers.length - 1 && !showDeleteRow;
|
|
928
|
+
const columnAlign = resolveColumnAlign(
|
|
929
|
+
header.column.columnDef as DataTableColumn,
|
|
930
|
+
header.column.id,
|
|
931
|
+
);
|
|
932
|
+
const isRightAligned = columnAlign === "right";
|
|
933
|
+
const sortGlyph = isSortableHeader ? (
|
|
934
|
+
<View
|
|
935
|
+
aria-hidden={true}
|
|
936
|
+
role="presentation"
|
|
937
|
+
rotate={sortDirection === "desc" ? "180deg" : undefined}
|
|
938
|
+
>
|
|
939
|
+
{sortDirection ? (
|
|
940
|
+
<CaretDownIcon size={chrome.iconPx} color={sortedCaretInk} />
|
|
941
|
+
) : (
|
|
942
|
+
<CaretUpDownIcon size={chrome.iconPx} color={idleCaretInk} />
|
|
943
|
+
)}
|
|
944
|
+
</View>
|
|
945
|
+
) : null;
|
|
879
946
|
return (
|
|
880
947
|
<Table.HeaderCell
|
|
881
948
|
key={header.id}
|
|
@@ -908,9 +975,11 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
908
975
|
flexDirection="row"
|
|
909
976
|
gap="$2"
|
|
910
977
|
alignItems="center"
|
|
911
|
-
justifyContent="flex-start"
|
|
978
|
+
justifyContent={isRightAligned ? "flex-end" : "flex-start"}
|
|
912
979
|
flex={1}
|
|
980
|
+
data-align={columnAlign}
|
|
913
981
|
>
|
|
982
|
+
{isRightAligned ? sortGlyph : null}
|
|
914
983
|
<Text
|
|
915
984
|
fontSize={knobProps.sizeToken}
|
|
916
985
|
selectable={false}
|
|
@@ -923,26 +992,7 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
923
992
|
header.getContext(),
|
|
924
993
|
)}
|
|
925
994
|
</Text>
|
|
926
|
-
{
|
|
927
|
-
<Text
|
|
928
|
-
aria-hidden={true}
|
|
929
|
-
role="presentation"
|
|
930
|
-
color={sortDirection ? "$color10" : "$color8"}
|
|
931
|
-
>
|
|
932
|
-
{sortDirection === "asc" && (
|
|
933
|
-
<CaretDownIcon size={chrome.iconPx} />
|
|
934
|
-
)}
|
|
935
|
-
{sortDirection === "desc" && (
|
|
936
|
-
<CaretDownIcon
|
|
937
|
-
size={chrome.iconPx}
|
|
938
|
-
style={{ transform: "rotate(180deg)" }}
|
|
939
|
-
/>
|
|
940
|
-
)}
|
|
941
|
-
{sortDirection === false && (
|
|
942
|
-
<CaretUpDownIcon size={chrome.iconPx} />
|
|
943
|
-
)}
|
|
944
|
-
</Text>
|
|
945
|
-
)}
|
|
995
|
+
{isRightAligned ? null : sortGlyph}
|
|
946
996
|
{pinning && (
|
|
947
997
|
<View flexDirection="row" gap="$1">
|
|
948
998
|
{/* One compact cycle control (left →
|
|
@@ -1176,6 +1226,8 @@ function DataTableRoot<TData extends Record<string, any> = Record<string, any>>(
|
|
|
1176
1226
|
bulkBarPlacement,
|
|
1177
1227
|
resolvedBulkActions,
|
|
1178
1228
|
t,
|
|
1229
|
+
sortedCaretInk,
|
|
1230
|
+
idleCaretInk,
|
|
1179
1231
|
],
|
|
1180
1232
|
);
|
|
1181
1233
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-7703 / DG-TBL-01: a right-aligned column's header label ends on the
|
|
3
|
+
* same edge as its values.
|
|
4
|
+
*
|
|
5
|
+
* Two things pulled the label off that edge on web: an empty header-tools
|
|
6
|
+
* cluster (no filter, no pin) still took a flex gap after the label, and a
|
|
7
|
+
* sort glyph trailed the label. On native the header and body ignored the
|
|
8
|
+
* column's alignment entirely, so numbers sat left under a left label.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
12
|
+
import { cleanup } from "@testing-library/react";
|
|
13
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
14
|
+
import type { DataTableColumn } from "../../types";
|
|
15
|
+
import { DataTable } from "./index";
|
|
16
|
+
import { DataTable as NativeDataTable } from "./index.native";
|
|
17
|
+
|
|
18
|
+
vi.mock("@shopify/flash-list", () => ({ FlashList: () => null }));
|
|
19
|
+
|
|
20
|
+
afterEach(cleanup);
|
|
21
|
+
|
|
22
|
+
type Stat = { id: string; stat: string; base_stat: number };
|
|
23
|
+
|
|
24
|
+
const rows: Stat[] = [
|
|
25
|
+
{ id: "hp", stat: "hp", base_stat: 45 },
|
|
26
|
+
{ id: "attack", stat: "attack", base_stat: 130 },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const columns: DataTableColumn<Stat>[] = [
|
|
30
|
+
{ id: "stat", accessorKey: "stat", header: "Stat" },
|
|
31
|
+
{ id: "base_stat", accessorKey: "base_stat", header: "Base Stat", align: "right" },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const tableProps = {
|
|
35
|
+
data: rows,
|
|
36
|
+
columns: columns as DataTableColumn<Record<string, any>>[],
|
|
37
|
+
layout: "table" as const,
|
|
38
|
+
enableFiltering: false,
|
|
39
|
+
enableGlobalSearch: false,
|
|
40
|
+
enableColumnVisibility: false,
|
|
41
|
+
enablePagination: false,
|
|
42
|
+
readOnly: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function header(container: HTMLElement, id: string) {
|
|
46
|
+
const el = container.querySelector<HTMLElement>(`[id="${id}-header"]`);
|
|
47
|
+
if (!el) throw new Error(`no ${id} header`);
|
|
48
|
+
return el;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Where the sort glyph sits relative to the header label, in DOM order. */
|
|
52
|
+
function glyphSide(cell: HTMLElement) {
|
|
53
|
+
const label = cell.querySelector("[data-header-label]");
|
|
54
|
+
const glyph = cell.querySelector("svg");
|
|
55
|
+
if (!label || !glyph) throw new Error("header lacks a label or a glyph");
|
|
56
|
+
return label.compareDocumentPosition(glyph) & Node.DOCUMENT_POSITION_PRECEDING
|
|
57
|
+
? "before"
|
|
58
|
+
: "after";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
describe("web DataTable numeric header", () => {
|
|
62
|
+
it("draws no header-tools cluster when the column has no filter or pin", () => {
|
|
63
|
+
const { container } = renderWithProviders(<DataTable {...tableProps} enableSorting />);
|
|
64
|
+
const label = header(container, "base_stat").querySelector("[data-header-label]");
|
|
65
|
+
const labelGroup = label?.parentElement;
|
|
66
|
+
expect(labelGroup?.nextElementSibling).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("leads a right-aligned label with its sort glyph and trails a left one", () => {
|
|
70
|
+
const { container } = renderWithProviders(<DataTable {...tableProps} enableSorting />);
|
|
71
|
+
expect(glyphSide(header(container, "base_stat"))).toBe("before");
|
|
72
|
+
expect(glyphSide(header(container, "stat"))).toBe("after");
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe("native DataTable numeric header", () => {
|
|
77
|
+
it("aligns a right column's header and cells to the trailing edge", () => {
|
|
78
|
+
const { container } = renderWithProviders(<NativeDataTable {...tableProps} enableSorting />);
|
|
79
|
+
const headerRow = header(container, "base_stat").querySelector<HTMLElement>("[data-align]");
|
|
80
|
+
expect(headerRow?.dataset.align).toBe("right");
|
|
81
|
+
expect(getComputedStyle(headerRow!).justifyContent).toBe("flex-end");
|
|
82
|
+
const cells = [...container.querySelectorAll<HTMLElement>('[role="cell"][data-align="right"]')];
|
|
83
|
+
expect(cells).toHaveLength(rows.length);
|
|
84
|
+
for (const cell of cells) expect(getComputedStyle(cell).justifyContent).toBe("flex-end");
|
|
85
|
+
const left = container.querySelector<HTMLElement>('[role="cell"][data-align="left"]');
|
|
86
|
+
expect(getComputedStyle(left!).justifyContent).toBe("flex-start");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("puts the sort glyph before a right-aligned label", () => {
|
|
90
|
+
const { container } = renderWithProviders(<NativeDataTable {...tableProps} enableSorting />);
|
|
91
|
+
const headerRow = header(container, "base_stat").querySelector<HTMLElement>("[data-align]");
|
|
92
|
+
const first = headerRow?.firstElementChild;
|
|
93
|
+
expect(first?.querySelector("svg")).toBeTruthy();
|
|
94
|
+
expect(headerRow?.textContent).toContain("Base Stat");
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -17,12 +17,19 @@ export function tableRowStateProps(opts: {
|
|
|
17
17
|
zebraOn?: boolean;
|
|
18
18
|
index?: number;
|
|
19
19
|
pressable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The fill the rows rest on: the table's own `$color1` surface, or the
|
|
22
|
+
* page's `$background` when a full-bleed table drops its frame (LC-146), so
|
|
23
|
+
* the stripe stays one step up from what is around it (LC-144).
|
|
24
|
+
*/
|
|
25
|
+
surface?: string;
|
|
20
26
|
}): Record<string, unknown> {
|
|
21
27
|
const selected = Boolean(opts.selected);
|
|
22
28
|
const keyboardFocused = Boolean(opts.keyboardFocused);
|
|
23
29
|
const zebra = Boolean(opts.zebraOn) && (opts.index ?? 0) % 2 === 1;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
30
|
+
const surface = opts.surface ?? "$color1";
|
|
31
|
+
const rest = selected ? "$color4" : zebra ? tableZebraFill(surface) : surface;
|
|
32
|
+
const hover = selected || rest === "$color3" ? tablePressFill(rest) : "$color3";
|
|
26
33
|
return {
|
|
27
34
|
backgroundColor: rest,
|
|
28
35
|
hoverStyle: { backgroundColor: hover },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Checkbox } from "@multiplatform.one/forms";
|
|
2
2
|
import { action } from "@multiplatform.one/storybook";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { XStack, YStack } from "tamagui";
|
|
5
5
|
import { type BulkAction, DataTableBulkActions, useRowSelection } from "./index";
|
|
6
|
+
import { Text } from "@multiplatform.one/components";
|
|
6
7
|
|
|
7
8
|
// Define the data type
|
|
8
9
|
type Task = {
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
import type { Meta } from "@storybook/react-native-web-vite";
|
|
19
19
|
import { RadioGroup, ToggleGroup } from "@multiplatform.one/forms";
|
|
20
20
|
import { useState } from "react";
|
|
21
|
-
import {
|
|
21
|
+
import { View, YStack } from "tamagui";
|
|
22
22
|
import { CellOptionsEditor } from "./CellOptionsEditor";
|
|
23
|
+
import { Paragraph } from "@multiplatform.one/components";
|
|
23
24
|
|
|
24
25
|
const meta: Meta<typeof CellOptionsEditor> = {
|
|
25
26
|
title: "Table/CellOptionsEditor",
|
|
@@ -15,9 +15,10 @@ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
|
15
15
|
import { fn } from "storybook/test";
|
|
16
16
|
import { Table } from "@multiplatform.one/table-primitives";
|
|
17
17
|
import React from "react";
|
|
18
|
-
import { Text, View, XStack, YStack } from "tamagui";
|
|
18
|
+
import { Text as TamaguiText, View, XStack, YStack } from "tamagui";
|
|
19
19
|
import type { DataTableCellRenderContext, DataTableField, DataTableFieldProps } from "../../types";
|
|
20
20
|
import { DataTableCell } from "./index";
|
|
21
|
+
import { Text } from "@multiplatform.one/components";
|
|
21
22
|
|
|
22
23
|
// Custom renderers receive the cell's honest state as the 4th argument and
|
|
23
24
|
// must go non-interactive while read-only (commits are blocked there).
|
|
@@ -154,9 +155,9 @@ function CellHarness({ field, initialValue, fieldProps, columnLabel }: CellSpec)
|
|
|
154
155
|
</Table.Body>
|
|
155
156
|
</Table>
|
|
156
157
|
</YStack>
|
|
157
|
-
<
|
|
158
|
+
<TamaguiText testID="committed-value" fontSize="$2" color="$color10" fontFamily="$mono">
|
|
158
159
|
committed: {serialize(value)}
|
|
159
|
-
</
|
|
160
|
+
</TamaguiText>
|
|
160
161
|
</YStack>
|
|
161
162
|
);
|
|
162
163
|
}
|
|
@@ -202,9 +203,9 @@ function OverviewRow({ field, initialValue, fieldProps }: CellSpec) {
|
|
|
202
203
|
return (
|
|
203
204
|
<XStack gap="$3" alignItems="center" borderBottomWidth={1} borderColor="$borderColor">
|
|
204
205
|
<View width={130}>
|
|
205
|
-
<
|
|
206
|
+
<TamaguiText fontSize="$2" fontFamily="$mono">
|
|
206
207
|
{field}
|
|
207
|
-
</
|
|
208
|
+
</TamaguiText>
|
|
208
209
|
</View>
|
|
209
210
|
<View width={260} paddingVertical="$1.5">
|
|
210
211
|
<DataTableCell
|
|
@@ -330,9 +331,9 @@ const PlaygroundHarness = (args: any) => {
|
|
|
330
331
|
</Table.Row>
|
|
331
332
|
</Table.Body>
|
|
332
333
|
</Table>
|
|
333
|
-
<
|
|
334
|
+
<TamaguiText testID="committed-value" fontSize="$2" color="$color10" fontFamily="$mono">
|
|
334
335
|
committed: {serialize(value)}
|
|
335
|
-
</
|
|
336
|
+
</TamaguiText>
|
|
336
337
|
</YStack>
|
|
337
338
|
);
|
|
338
339
|
};
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { formatCurrency, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
12
12
|
import { Button } from "@multiplatform.one/forms";
|
|
13
|
-
import { Card,
|
|
13
|
+
import { Card, ScrollView, Separator, View, XStack, YStack } from "tamagui";
|
|
14
14
|
import { DataTableColumnPinning, useColumnPinning } from "./index";
|
|
15
|
+
import { H3, Paragraph, Text } from "@multiplatform.one/components";
|
|
15
16
|
|
|
16
17
|
interface Person {
|
|
17
18
|
id: number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { action } from "@multiplatform.one/storybook";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { formatAbsoluteDate } from "@multiplatform.one/theme";
|
|
4
|
-
import { Card,
|
|
4
|
+
import { Card, XStack, YStack } from "tamagui";
|
|
5
5
|
import { DataTableDateFilter, type DateFilterValue, applyDateFilter } from "./index";
|
|
6
|
+
import { Text } from "@multiplatform.one/components";
|
|
6
7
|
|
|
7
8
|
// Define the data type
|
|
8
9
|
type Task = {
|
|
@@ -9,8 +9,16 @@ import {
|
|
|
9
9
|
import { formatAbsoluteDate, parseCalendarDate, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
10
10
|
import React, { useState, useMemo } from "react";
|
|
11
11
|
import { Button, DatePicker, FloatingPanel } from "@multiplatform.one/forms";
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import {
|
|
13
|
+
Separator,
|
|
14
|
+
Text as TamaguiText,
|
|
15
|
+
View,
|
|
16
|
+
XStack,
|
|
17
|
+
YStack,
|
|
18
|
+
getTokens,
|
|
19
|
+
getVariableValue,
|
|
20
|
+
} from "tamagui";
|
|
21
|
+
import { ScrollView, Text } from "@multiplatform.one/components";
|
|
14
22
|
import { t } from "../../shared/t";
|
|
15
23
|
import { iconSizeForToken } from "../../utils/chromeIcons";
|
|
16
24
|
|
|
@@ -332,9 +340,9 @@ export function DataTableDateFilter({
|
|
|
332
340
|
<FloatingPanel open={isOpen} onOpenChange={setIsOpen} trigger={trigger} scrollable>
|
|
333
341
|
<YStack {...knobProps.gapLg} minWidth={popoverMinWidth} data-dismiss-class="compose">
|
|
334
342
|
<XStack justifyContent="space-between" alignItems="center">
|
|
335
|
-
<
|
|
343
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
336
344
|
{t("Date Filter")}
|
|
337
|
-
</
|
|
345
|
+
</TamaguiText>
|
|
338
346
|
{value && (
|
|
339
347
|
<Button size={knobProps.sizeToken} onPress={handleClear} icon={<XIcon size={iconPx} />}>
|
|
340
348
|
{t("Clear")}
|
|
@@ -345,9 +353,9 @@ export function DataTableDateFilter({
|
|
|
345
353
|
{/* Quick Presets */}
|
|
346
354
|
{showPresets && (
|
|
347
355
|
<YStack gap="$2">
|
|
348
|
-
<
|
|
356
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
349
357
|
{t("Quick Filters")}
|
|
350
|
-
</
|
|
358
|
+
</TamaguiText>
|
|
351
359
|
<ScrollView maxHeight={presetListMaxHeight}>
|
|
352
360
|
<YStack gap={PRESET_ROW_GAP_TOKEN}>
|
|
353
361
|
{allPresets.map((preset) => (
|
|
@@ -372,9 +380,9 @@ export function DataTableDateFilter({
|
|
|
372
380
|
|
|
373
381
|
{/* Custom Date Selection */}
|
|
374
382
|
<YStack {...knobProps.gap}>
|
|
375
|
-
<
|
|
383
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
376
384
|
{t("Custom Date")}
|
|
377
|
-
</
|
|
385
|
+
</TamaguiText>
|
|
378
386
|
|
|
379
387
|
<XStack gap="$2">
|
|
380
388
|
<Button
|
|
@@ -400,9 +408,9 @@ export function DataTableDateFilter({
|
|
|
400
408
|
|
|
401
409
|
{/* Date Range */}
|
|
402
410
|
<YStack gap="$2">
|
|
403
|
-
<
|
|
411
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
404
412
|
{t("Date Range")}
|
|
405
|
-
</
|
|
413
|
+
</TamaguiText>
|
|
406
414
|
<XStack gap="$2">
|
|
407
415
|
<Button
|
|
408
416
|
flex={1}
|
|
@@ -433,9 +441,9 @@ export function DataTableDateFilter({
|
|
|
433
441
|
|
|
434
442
|
{/* DatePicker-based Custom Range Selection */}
|
|
435
443
|
<YStack gap="$2">
|
|
436
|
-
<
|
|
444
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
437
445
|
{t("Custom Range")}
|
|
438
|
-
</
|
|
446
|
+
</TamaguiText>
|
|
439
447
|
<XStack gap="$2">
|
|
440
448
|
<View flex={1} data-testid="start-date-picker">
|
|
441
449
|
<DatePicker
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { action } from "@multiplatform.one/storybook";
|
|
2
2
|
import { formatAbsoluteDate, formatNumber } from "@multiplatform.one/theme";
|
|
3
|
-
import { Card,
|
|
3
|
+
import { Card, YStack } from "tamagui";
|
|
4
4
|
import { Table } from "@multiplatform.one/table-primitives";
|
|
5
5
|
import { DataTableExport } from "./index";
|
|
6
|
+
import { Text } from "@multiplatform.one/components";
|
|
6
7
|
|
|
7
8
|
// Define the data type
|
|
8
9
|
type Product = {
|
|
@@ -9,8 +9,8 @@ import { downloadBlob } from "@multiplatform.one/platform";
|
|
|
9
9
|
import { formatCalendarDate, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { Button, Checkbox, FloatingPanel, Input } from "@multiplatform.one/forms";
|
|
12
|
-
import { Separator, Text, XStack, YStack, isWeb } from "tamagui";
|
|
13
|
-
import { ScrollView } from "@multiplatform.one/components";
|
|
12
|
+
import { Separator, Text as TamaguiText, XStack, YStack, isWeb } from "tamagui";
|
|
13
|
+
import { ScrollView, Text } from "@multiplatform.one/components";
|
|
14
14
|
import type { DataTableField } from "../../types";
|
|
15
15
|
import { iconSizeForToken } from "../../utils/chromeIcons";
|
|
16
16
|
import { getViewLeafRows } from "../../utils/viewData";
|
|
@@ -315,15 +315,15 @@ function ExportOptionsPanel({
|
|
|
315
315
|
scrollable
|
|
316
316
|
>
|
|
317
317
|
<YStack gap="$4" minWidth={popoverMinWidth} data-dismiss-class="compose">
|
|
318
|
-
<
|
|
318
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
319
319
|
Export Options
|
|
320
|
-
</
|
|
320
|
+
</TamaguiText>
|
|
321
321
|
|
|
322
322
|
{/* Filename */}
|
|
323
323
|
<YStack gap="$2">
|
|
324
|
-
<
|
|
324
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
325
325
|
Filename
|
|
326
|
-
</
|
|
326
|
+
</TamaguiText>
|
|
327
327
|
<Input
|
|
328
328
|
value={exportOptions.filename || ""}
|
|
329
329
|
onChangeText={(text) =>
|
|
@@ -350,9 +350,9 @@ function ExportOptionsPanel({
|
|
|
350
350
|
|
|
351
351
|
{/* Column Selection */}
|
|
352
352
|
<YStack gap="$2">
|
|
353
|
-
<
|
|
353
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
354
354
|
Select Columns ({selectedColumns.size} of {availableColumns.length})
|
|
355
|
-
</
|
|
355
|
+
</TamaguiText>
|
|
356
356
|
<ScrollView maxHeight={200}>
|
|
357
357
|
<YStack gap="$1">
|
|
358
358
|
{availableColumns.map((col) => (
|
|
@@ -383,9 +383,9 @@ function ExportOptionsPanel({
|
|
|
383
383
|
|
|
384
384
|
{/* Export Formats */}
|
|
385
385
|
<YStack gap="$2">
|
|
386
|
-
<
|
|
386
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
387
387
|
Export Formats
|
|
388
|
-
</
|
|
388
|
+
</TamaguiText>
|
|
389
389
|
{exportFormats.map((format) => (
|
|
390
390
|
<Button
|
|
391
391
|
key={format.id}
|
|
@@ -397,9 +397,9 @@ function ExportOptionsPanel({
|
|
|
397
397
|
icon={format.icon}
|
|
398
398
|
>
|
|
399
399
|
<YStack gap="$1">
|
|
400
|
-
<
|
|
400
|
+
<TamaguiText {...knobProps.label} fontWeight="400">
|
|
401
401
|
{format.label}
|
|
402
|
-
</
|
|
402
|
+
</TamaguiText>
|
|
403
403
|
<Text fontSize="$2" color="$color10">
|
|
404
404
|
{format.description}
|
|
405
405
|
</Text>
|