@multiplatform.one/table 7.69.2 → 7.71.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/dist/cjs/components/DataTable/DataTableCardControls.cjs +74 -12
- package/dist/cjs/components/DataTable/DataTableCardControls.native.js +83 -12
- package/dist/cjs/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableDocumentList.cjs +180 -114
- package/dist/cjs/components/DataTable/DataTableDocumentList.native.js +193 -124
- package/dist/cjs/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableMobileCards.cjs +260 -127
- package/dist/cjs/components/DataTable/DataTableMobileCards.native.js +287 -156
- package/dist/cjs/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableRoot.cjs +34 -5
- package/dist/cjs/components/DataTable/DataTableRoot.native.js +36 -5
- package/dist/cjs/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/cjs/components/DataTable/PhonePager.cjs +56 -0
- package/dist/cjs/components/DataTable/PhonePager.native.js +60 -0
- package/dist/cjs/components/DataTable/PhonePager.native.js.map +1 -0
- package/dist/cjs/components/DataTable/index.native.js +64 -7
- package/dist/cjs/components/DataTable/index.native.js.map +1 -1
- package/dist/cjs/components/DataTable/rowSlotParts.cjs +158 -0
- package/dist/cjs/components/DataTable/rowSlotParts.native.js +170 -0
- package/dist/cjs/components/DataTable/rowSlotParts.native.js.map +1 -0
- package/dist/cjs/components/DataTable/rowSlots.cjs +150 -0
- package/dist/cjs/components/DataTable/rowSlots.native.js +239 -0
- package/dist/cjs/components/DataTable/rowSlots.native.js.map +1 -0
- package/dist/cjs/components/DataTableFilterButton/index.cjs +25 -3
- package/dist/cjs/components/DataTableFilterButton/index.native.js +25 -3
- package/dist/cjs/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/cjs/components/DataTablePagination/index.cjs +23 -0
- package/dist/cjs/components/DataTablePagination/index.native.js +25 -0
- package/dist/cjs/components/DataTablePagination/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableToolbar/glyph.cjs +54 -0
- package/dist/cjs/components/DataTableToolbar/glyph.native.js +57 -0
- package/dist/cjs/components/DataTableToolbar/glyph.native.js.map +1 -0
- package/dist/cjs/components/DataTableToolbar/index.cjs +206 -114
- package/dist/cjs/components/DataTableToolbar/index.native.js +217 -112
- package/dist/cjs/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/cjs/index.cjs +5 -1
- package/dist/cjs/index.native.js +5 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableCardControls.mjs +74 -13
- package/dist/esm/components/DataTable/DataTableCardControls.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableCardControls.native.js +83 -13
- package/dist/esm/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableDocumentList.mjs +179 -113
- package/dist/esm/components/DataTable/DataTableDocumentList.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableDocumentList.native.js +192 -123
- package/dist/esm/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableMobileCards.mjs +261 -129
- package/dist/esm/components/DataTable/DataTableMobileCards.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableMobileCards.native.js +288 -158
- package/dist/esm/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.mjs +36 -7
- package/dist/esm/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.native.js +38 -7
- package/dist/esm/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/esm/components/DataTable/PhonePager.mjs +31 -0
- package/dist/esm/components/DataTable/PhonePager.mjs.map +1 -0
- package/dist/esm/components/DataTable/PhonePager.native.js +32 -0
- package/dist/esm/components/DataTable/PhonePager.native.js.map +1 -0
- package/dist/esm/components/DataTable/index.native.js +67 -10
- package/dist/esm/components/DataTable/index.native.js.map +1 -1
- package/dist/esm/components/DataTable/rowSlotParts.mjs +130 -0
- package/dist/esm/components/DataTable/rowSlotParts.mjs.map +1 -0
- package/dist/esm/components/DataTable/rowSlotParts.native.js +139 -0
- package/dist/esm/components/DataTable/rowSlotParts.native.js.map +1 -0
- package/dist/esm/components/DataTable/rowSlots.mjs +121 -0
- package/dist/esm/components/DataTable/rowSlots.mjs.map +1 -0
- package/dist/esm/components/DataTable/rowSlots.native.js +207 -0
- package/dist/esm/components/DataTable/rowSlots.native.js.map +1 -0
- package/dist/esm/components/DataTableFilterButton/index.mjs +24 -3
- package/dist/esm/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/esm/components/DataTableFilterButton/index.native.js +24 -3
- package/dist/esm/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/esm/components/DataTablePagination/index.mjs +23 -0
- package/dist/esm/components/DataTablePagination/index.mjs.map +1 -1
- package/dist/esm/components/DataTablePagination/index.native.js +25 -0
- package/dist/esm/components/DataTablePagination/index.native.js.map +1 -1
- package/dist/esm/components/DataTableToolbar/glyph.mjs +27 -0
- package/dist/esm/components/DataTableToolbar/glyph.mjs.map +1 -0
- package/dist/esm/components/DataTableToolbar/glyph.native.js +27 -0
- package/dist/esm/components/DataTableToolbar/glyph.native.js.map +1 -0
- package/dist/esm/components/DataTableToolbar/index.mjs +211 -119
- package/dist/esm/components/DataTableToolbar/index.mjs.map +1 -1
- package/dist/esm/components/DataTableToolbar/index.native.js +222 -117
- package/dist/esm/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableCardControls.mjs +74 -13
- package/dist/jsx/components/DataTable/DataTableCardControls.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableCardControls.native.js +83 -12
- package/dist/jsx/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableDocumentList.mjs +179 -113
- package/dist/jsx/components/DataTable/DataTableDocumentList.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableDocumentList.native.js +193 -124
- package/dist/jsx/components/DataTable/DataTableDocumentList.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableMobileCards.mjs +261 -129
- package/dist/jsx/components/DataTable/DataTableMobileCards.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableMobileCards.native.js +287 -156
- package/dist/jsx/components/DataTable/DataTableMobileCards.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.mjs +36 -7
- package/dist/jsx/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.native.js +36 -5
- package/dist/jsx/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/jsx/components/DataTable/PhonePager.mjs +31 -0
- package/dist/jsx/components/DataTable/PhonePager.mjs.map +1 -0
- package/dist/jsx/components/DataTable/PhonePager.native.js +60 -0
- package/dist/jsx/components/DataTable/PhonePager.native.js.map +1 -0
- package/dist/jsx/components/DataTable/index.native.js +64 -7
- package/dist/jsx/components/DataTable/index.native.js.map +1 -1
- package/dist/jsx/components/DataTable/rowSlotParts.mjs +130 -0
- package/dist/jsx/components/DataTable/rowSlotParts.mjs.map +1 -0
- package/dist/jsx/components/DataTable/rowSlotParts.native.js +170 -0
- package/dist/jsx/components/DataTable/rowSlotParts.native.js.map +1 -0
- package/dist/jsx/components/DataTable/rowSlots.mjs +121 -0
- package/dist/jsx/components/DataTable/rowSlots.mjs.map +1 -0
- package/dist/jsx/components/DataTable/rowSlots.native.js +239 -0
- package/dist/jsx/components/DataTable/rowSlots.native.js.map +1 -0
- package/dist/jsx/components/DataTableFilterButton/index.mjs +24 -3
- package/dist/jsx/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableFilterButton/index.native.js +25 -3
- package/dist/jsx/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/jsx/components/DataTablePagination/index.mjs +23 -0
- package/dist/jsx/components/DataTablePagination/index.mjs.map +1 -1
- package/dist/jsx/components/DataTablePagination/index.native.js +25 -0
- package/dist/jsx/components/DataTablePagination/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableToolbar/glyph.mjs +27 -0
- package/dist/jsx/components/DataTableToolbar/glyph.mjs.map +1 -0
- package/dist/jsx/components/DataTableToolbar/glyph.native.js +57 -0
- package/dist/jsx/components/DataTableToolbar/glyph.native.js.map +1 -0
- package/dist/jsx/components/DataTableToolbar/index.mjs +211 -119
- package/dist/jsx/components/DataTableToolbar/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableToolbar/index.native.js +217 -112
- package/dist/jsx/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/jsx/index.js +2 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +5 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +12 -12
- package/src/components/DataTable/DataTable.spec.tsx +12 -9
- package/src/components/DataTable/DataTable.stories.tsx +110 -43
- package/src/components/DataTable/DataTableCardControls.tsx +103 -24
- package/src/components/DataTable/DataTableDocumentList.stories.tsx +113 -0
- package/src/components/DataTable/DataTableDocumentList.tsx +210 -120
- package/src/components/DataTable/DataTableMobileCards.tsx +280 -147
- package/src/components/DataTable/DataTableRoot.tsx +56 -5
- package/src/components/DataTable/PhonePager.tsx +44 -0
- package/src/components/DataTable/cardLayout.spec.tsx +20 -12
- package/src/components/DataTable/cardToolbar.spec.tsx +31 -26
- package/src/components/DataTable/dataTableCardControls.spec.tsx +10 -9
- package/src/components/DataTable/dataTableDocumentList.spec.tsx +98 -10
- package/src/components/DataTable/dataTableMobileCards.spec.tsx +29 -14
- package/src/components/DataTable/index.native.tsx +90 -9
- package/src/components/DataTable/nativeCardParity.spec.tsx +15 -0
- package/src/components/DataTable/pageRange.spec.tsx +12 -1
- package/src/components/DataTable/rowSlotParts.tsx +184 -0
- package/src/components/DataTable/rowSlots.ts +239 -0
- package/src/components/DataTable/smallTableFooter.spec.tsx +10 -0
- package/src/components/DataTableFilterButton/DataTableFilterButton.spec.tsx +3 -3
- package/src/components/DataTableFilterButton/index.tsx +30 -2
- package/src/components/DataTablePagination/index.tsx +30 -0
- package/src/components/DataTableToolbar/DataTableToolbar.spec.tsx +10 -0
- package/src/components/DataTableToolbar/DataTableToolbar.stories.tsx +16 -7
- package/src/components/DataTableToolbar/compactRow.spec.tsx +197 -0
- package/src/components/DataTableToolbar/glyph.ts +33 -0
- package/src/components/DataTableToolbar/index.tsx +269 -131
- package/src/components/Table/accessibility.spec.tsx +4 -3
- package/src/components/noMiddotJoin.spec.tsx +315 -0
- package/src/components/phoneBottomAccessory.spec.tsx +218 -0
- package/src/components/phoneCardPolish.spec.tsx +214 -0
- package/src/components/phoneCardsDefault.spec.tsx +34 -6
- package/src/components/phonePager.spec.tsx +141 -0
- package/src/components/tableDropdowns.spec.tsx +4 -3
- package/src/index.ts +5 -0
- package/src/types.ts +23 -0
- package/types/components/DataTable/DataTableCardControls.d.ts +12 -0
- package/types/components/DataTable/DataTableCardControls.d.ts.map +1 -1
- package/types/components/DataTable/DataTableDocumentList.d.ts +13 -7
- package/types/components/DataTable/DataTableDocumentList.d.ts.map +1 -1
- package/types/components/DataTable/DataTableMobileCards.d.ts +38 -12
- package/types/components/DataTable/DataTableMobileCards.d.ts.map +1 -1
- package/types/components/DataTable/DataTableRoot.d.ts +1 -1
- package/types/components/DataTable/DataTableRoot.d.ts.map +1 -1
- package/types/components/DataTable/PhonePager.d.ts +24 -0
- package/types/components/DataTable/PhonePager.d.ts.map +1 -0
- package/types/components/DataTable/index.native.d.ts +1 -1
- package/types/components/DataTable/index.native.d.ts.map +1 -1
- package/types/components/DataTable/rowSlotParts.d.ts +30 -0
- package/types/components/DataTable/rowSlotParts.d.ts.map +1 -0
- package/types/components/DataTable/rowSlots.d.ts +74 -0
- package/types/components/DataTable/rowSlots.d.ts.map +1 -0
- package/types/components/DataTableFilterButton/index.d.ts +1 -0
- package/types/components/DataTableFilterButton/index.d.ts.map +1 -1
- package/types/components/DataTablePagination/index.d.ts +5 -0
- package/types/components/DataTablePagination/index.d.ts.map +1 -1
- package/types/components/DataTableToolbar/glyph.d.ts +65 -0
- package/types/components/DataTableToolbar/glyph.d.ts.map +1 -0
- package/types/components/DataTableToolbar/index.d.ts +24 -0
- package/types/components/DataTableToolbar/index.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +23 -0
- package/types/types.d.ts.map +1 -1
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { Meta } from "@storybook/react-native-web-vite";
|
|
17
|
+
import { Image, Text } from "@multiplatform.one/components";
|
|
18
|
+
import { formatRelativeTimestamp } from "@multiplatform.one/theme";
|
|
17
19
|
import { YStack } from "tamagui";
|
|
18
20
|
import type { DataTableColumn } from "../../types";
|
|
19
21
|
import { DataTable } from "./index";
|
|
@@ -130,3 +132,114 @@ export const Empty = {
|
|
|
130
132
|
</YStack>
|
|
131
133
|
),
|
|
132
134
|
};
|
|
135
|
+
|
|
136
|
+
interface Pokemon {
|
|
137
|
+
image: string;
|
|
138
|
+
name: string;
|
|
139
|
+
category: string;
|
|
140
|
+
poke_id: number;
|
|
141
|
+
modified: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const now = Date.parse("2026-10-29T12:00:00Z");
|
|
145
|
+
|
|
146
|
+
const sprite = (id: number) =>
|
|
147
|
+
`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${id}.png`;
|
|
148
|
+
|
|
149
|
+
const pokemon: Pokemon[] = [
|
|
150
|
+
{
|
|
151
|
+
image: sprite(25),
|
|
152
|
+
name: "Pikachu",
|
|
153
|
+
category: "Mouse Pokémon",
|
|
154
|
+
poke_id: 25,
|
|
155
|
+
modified: "2026-10-20",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
image: sprite(20),
|
|
159
|
+
name: "Raticate",
|
|
160
|
+
category: "Mouse Pokémon",
|
|
161
|
+
poke_id: 20,
|
|
162
|
+
modified: "2026-10-20",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
image: sprite(19),
|
|
166
|
+
name: "Rattata",
|
|
167
|
+
category: "Mouse Pokémon",
|
|
168
|
+
poke_id: 19,
|
|
169
|
+
modified: "2026-10-19",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
image: sprite(18),
|
|
173
|
+
name: "Pidgeot",
|
|
174
|
+
category: "Bird Pokémon",
|
|
175
|
+
poke_id: 18,
|
|
176
|
+
modified: "2026-10-19",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
image: sprite(17),
|
|
180
|
+
name: "Pidgeotto",
|
|
181
|
+
category: "Bird Pokémon",
|
|
182
|
+
poke_id: 17,
|
|
183
|
+
modified: "2026-10-18",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
image: sprite(16),
|
|
187
|
+
name: "Pidgey",
|
|
188
|
+
category: "Tiny Bird Pokémon",
|
|
189
|
+
poke_id: 16,
|
|
190
|
+
modified: "2026-10-18",
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const pokemonColumns: DataTableColumn<Pokemon>[] = [
|
|
195
|
+
{
|
|
196
|
+
accessorKey: "image",
|
|
197
|
+
header: "Image",
|
|
198
|
+
meta: { role: "media" },
|
|
199
|
+
cell: ({ getValue }) => <Image src={String(getValue())} alt="" size="extraSmall" framed />,
|
|
200
|
+
},
|
|
201
|
+
{ accessorKey: "name", header: "Name", meta: { role: "title" } },
|
|
202
|
+
{ accessorKey: "category", header: "Category", meta: { role: "subtitle" } },
|
|
203
|
+
{
|
|
204
|
+
accessorKey: "poke_id",
|
|
205
|
+
header: "Poke ID",
|
|
206
|
+
align: "right",
|
|
207
|
+
meta: { role: "trailing", fieldtype: "Int" },
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "_activity",
|
|
211
|
+
accessorKey: "modified",
|
|
212
|
+
header: "Last Updated On",
|
|
213
|
+
meta: { role: "actions" },
|
|
214
|
+
cell: ({ getValue }) => (
|
|
215
|
+
<Text fontSize="$2" color="$color9">
|
|
216
|
+
{formatRelativeTimestamp(String(getValue()), now)}
|
|
217
|
+
</Text>
|
|
218
|
+
),
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
function DeskList(props: Record<string, any>) {
|
|
223
|
+
return (
|
|
224
|
+
<DataTable
|
|
225
|
+
data={pokemon}
|
|
226
|
+
columns={pokemonColumns}
|
|
227
|
+
layout="list"
|
|
228
|
+
enableRowSelection
|
|
229
|
+
aria-label="Pokémon"
|
|
230
|
+
{...props}
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** The desk list on a phone at rest: no selection marks until select mode. */
|
|
236
|
+
export const DeskPhone = {
|
|
237
|
+
name: "Desk phone",
|
|
238
|
+
render: () => <DeskList />,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/** Select mode (the "…" menu's Select, or a long press): Mail's round marks, centred. */
|
|
242
|
+
export const DeskPhoneSelect = {
|
|
243
|
+
name: "Desk phone select",
|
|
244
|
+
render: () => <DeskList selectMode />,
|
|
245
|
+
};
|
|
@@ -7,19 +7,24 @@
|
|
|
7
7
|
* no wrapping into a column grid (Polaris Index / Frappe list). Stacked-group
|
|
8
8
|
* radius (LC-72): first row top corners, last row bottom, interiors square.
|
|
9
9
|
* A `media` column (the doctype's image) leads the row as a thumbnail. In
|
|
10
|
-
* the compact size class
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* the compact size class each value takes its LC-261 slot (`resolveRowSlots`):
|
|
11
|
+
* one descriptor and its glyph-and-value facts (two, or one beside a
|
|
12
|
+
* descriptor) under the subject, the status as a tone dot and a word beside
|
|
13
|
+
* it, the time at the top right
|
|
14
|
+
* and the actions on the right like desk's phone row (FZ-7684). Nothing is
|
|
15
|
+
* strung together with separators or column labels ("Poke ID 25"); a value
|
|
16
|
+
* with no slot stays off the row. An empty field is left out (FZ-7374).
|
|
14
17
|
* LC-71: selected = fill; keyboard ring rides the row when it is the tab stop.
|
|
15
18
|
*
|
|
16
19
|
* LC-155 ROW-ANATOMY (compact): the subject paints the headline role, the
|
|
17
20
|
* meta line the meta role, and the row is a two-line Mail row. Selection
|
|
18
|
-
*
|
|
19
|
-
*
|
|
21
|
+
* marks (Mail's round check, centred before the thumbnail) appear only in
|
|
22
|
+
* select mode: the screen's Select entry or a long-press enters it, a tap
|
|
23
|
+
* then toggles rows, and clearing the selection leaves it. No stripes.
|
|
20
24
|
*/
|
|
21
25
|
|
|
22
|
-
import {
|
|
26
|
+
import { CalendarBlankIcon } from "@phosphor-icons/react";
|
|
27
|
+
import { EmptyState, ListRowMeta } from "@multiplatform.one/components";
|
|
23
28
|
import { Checkbox } from "@multiplatform.one/forms";
|
|
24
29
|
import {
|
|
25
30
|
getGroupPosition,
|
|
@@ -37,6 +42,8 @@ import { View, XStack, YStack } from "tamagui";
|
|
|
37
42
|
import type { DataTableColumn } from "../../types";
|
|
38
43
|
import { withInterp } from "../../utils/withInterp";
|
|
39
44
|
import { partitionDocumentListCells } from "./documentListSlots";
|
|
45
|
+
import { hasValue, resolveRowSlots } from "./rowSlots";
|
|
46
|
+
import { RowFact, RowSelectMark, RowStatus } from "./rowSlotParts";
|
|
40
47
|
import { dataTableChrome, rowIntentProps } from "./dataTableChrome";
|
|
41
48
|
import { tableRowStateProps } from "./rowStateChrome";
|
|
42
49
|
|
|
@@ -69,18 +76,14 @@ export interface DataTableDocumentListProps<TData> {
|
|
|
69
76
|
queryInFlight?: boolean;
|
|
70
77
|
/** LC-146: rows run edge to edge and take the gutter as their inset. */
|
|
71
78
|
bleed?: PhoneTableBleed | null;
|
|
79
|
+
/** Compact select mode before any row is selected (the screen's Select entry). */
|
|
80
|
+
selectMode?: boolean;
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
const plainCell = { inTableCell: true, isHeader: false } as const;
|
|
75
84
|
const headlineCell = { inTableCell: true, isHeader: false, textRole: "headline" } as const;
|
|
76
85
|
const metaCell = { inTableCell: true, isHeader: false, textRole: "meta" } as const;
|
|
77
86
|
const captionCell = { inTableCell: true, isHeader: false, textRole: "caption" } as const;
|
|
78
|
-
const DATE_FIELDS = new Set(["datepicker", "datetimepicker", "timepicker"]);
|
|
79
|
-
|
|
80
|
-
function isDateCell(cell: any): boolean {
|
|
81
|
-
const field = (cell.column?.columnDef as DataTableColumn | undefined)?.field;
|
|
82
|
-
return field != null && DATE_FIELDS.has(field);
|
|
83
|
-
}
|
|
84
87
|
|
|
85
88
|
/**
|
|
86
89
|
* LC-155: wide rows always carry their selection checkbox; a compact row
|
|
@@ -122,22 +125,36 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
122
125
|
getRowPressProps,
|
|
123
126
|
queryInFlight = false,
|
|
124
127
|
bleed = null,
|
|
128
|
+
selectMode: selectModeOn = false,
|
|
125
129
|
}: DataTableDocumentListProps<TData>) {
|
|
126
130
|
const { t } = useTranslation();
|
|
127
131
|
const { knobProps } = useResolvedKnobs({ component: "DataTable" });
|
|
128
132
|
const compact = useLayoutSizeClass() === "compact";
|
|
129
133
|
const chrome = dataTableChrome(String(knobProps.sizeToken));
|
|
130
|
-
|
|
134
|
+
// A phone list is one inset group: no stripes (LC-144).
|
|
135
|
+
const tableZebraOn = knobProps.tableZebra === "on" && !compact;
|
|
131
136
|
const rowPad = bleed ? bleed.inset : knobProps.panelPadding.padding;
|
|
137
|
+
// A phone list off the page edge is one inset group on the Card theme, as
|
|
138
|
+
// DataTableMobileCards is: its fill steps off the page in both schemes.
|
|
139
|
+
const grouped = compact && !bleed;
|
|
140
|
+
const {
|
|
141
|
+
padding: _groupPadding,
|
|
142
|
+
elevation: _groupElevation,
|
|
143
|
+
...groupSurface
|
|
144
|
+
} = knobProps.cardSurface as typeof knobProps.cardSurface & Record<string, unknown>;
|
|
132
145
|
const selectMode =
|
|
133
|
-
enableRowSelection &&
|
|
146
|
+
enableRowSelection &&
|
|
147
|
+
(selectModeOn || tableRows.some((row: any) => Boolean(row.getIsSelected?.())));
|
|
134
148
|
const showCheckboxes = documentListShowsCheckboxes({ enableRowSelection, compact, selectMode });
|
|
135
149
|
|
|
136
150
|
const renderRow = useCallback(
|
|
137
151
|
(row: any, index: number) => {
|
|
138
152
|
const rowData = row.original as TData;
|
|
139
153
|
const visibleCells = row.getVisibleCells();
|
|
140
|
-
|
|
154
|
+
// LC-261: a compact row's title is its slot title, so a leading id or
|
|
155
|
+
// avatar column never doubles as the title and a fact or the media.
|
|
156
|
+
const slots = compact ? resolveRowSlots<any>(visibleCells) : null;
|
|
157
|
+
const titleCell = slots?.title ?? pickDocumentListTitleCell(visibleCells);
|
|
141
158
|
const {
|
|
142
159
|
media,
|
|
143
160
|
indicators,
|
|
@@ -145,12 +162,21 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
145
162
|
metas: metaCells,
|
|
146
163
|
actions,
|
|
147
164
|
} = partitionDocumentListCells(visibleCells, titleCell);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
// the top right
|
|
152
|
-
const
|
|
153
|
-
|
|
165
|
+
// LC-261: a compact row puts each value in its role's slot: one
|
|
166
|
+
// descriptor and its glyph facts (two, or one beside a descriptor)
|
|
167
|
+
// under the subject, the status as a dot and a word beside it, the
|
|
168
|
+
// time at the top right (LC-155).
|
|
169
|
+
const metas = slots
|
|
170
|
+
? hasValue(slots.subtitle)
|
|
171
|
+
? [slots.subtitle]
|
|
172
|
+
: []
|
|
173
|
+
: metaCells.filter((cell: any) => !isEmptyMetaCell(cell));
|
|
174
|
+
const facts = slots ? slots.facts.filter(hasValue) : [];
|
|
175
|
+
const statuses = slots ? slots.status.filter(hasValue) : [];
|
|
176
|
+
const titleStatuses = statuses.slice(0, 1);
|
|
177
|
+
const lineStatuses = statuses.slice(1);
|
|
178
|
+
const stampCell = slots && hasValue(slots.stamp) ? slots.stamp : undefined;
|
|
179
|
+
const stampInLine = Boolean(stampCell && slots && slots.controls.length > 0);
|
|
154
180
|
const slotCell = (cell: any, slot: "indicator" | "actions") => (
|
|
155
181
|
<View
|
|
156
182
|
key={cell.id}
|
|
@@ -166,6 +192,9 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
166
192
|
);
|
|
167
193
|
const indicatorCells = indicators.map((cell: any) => slotCell(cell, "indicator"));
|
|
168
194
|
const actionCells = actions.map((cell: any) => slotCell(cell, "actions"));
|
|
195
|
+
const compactActions = slots
|
|
196
|
+
? slots.controls.map((cell: any) => slotCell(cell, "actions"))
|
|
197
|
+
: actionCells;
|
|
169
198
|
// A compact row drops the fixed column width: the values wrap under
|
|
170
199
|
// the subject with the indicators and actions.
|
|
171
200
|
const trailingCells = trailing.map((cell: any) => (
|
|
@@ -175,30 +204,35 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
175
204
|
</TableCellContext.Provider>
|
|
176
205
|
</ListRowMeta>
|
|
177
206
|
));
|
|
178
|
-
const mediaCell = media[0];
|
|
207
|
+
const mediaCell = slots?.media ?? media[0];
|
|
179
208
|
const position = getGroupPosition(index, tableRows.length);
|
|
180
209
|
// A full-bleed row meets the screen edge, so it has no corners.
|
|
181
210
|
const corners = bleed
|
|
182
211
|
? {}
|
|
183
|
-
: stackRadiusProps(
|
|
212
|
+
: stackRadiusProps(
|
|
213
|
+
position,
|
|
214
|
+
grouped ? knobProps.cardSurface.borderRadius : knobProps.borderRadiusOuter.borderRadius,
|
|
215
|
+
);
|
|
184
216
|
const selected = Boolean(enableRowSelection && row.getIsSelected?.());
|
|
185
217
|
const rowState = tableRowStateProps({
|
|
186
218
|
selected,
|
|
187
219
|
zebraOn: tableZebraOn,
|
|
188
220
|
index,
|
|
189
221
|
pressable: Boolean(getRowPressProps),
|
|
190
|
-
surface: bleed
|
|
222
|
+
surface: bleed
|
|
223
|
+
? "$background"
|
|
224
|
+
: grouped
|
|
225
|
+
? knobProps.cardSurface.backgroundColor
|
|
226
|
+
: undefined,
|
|
191
227
|
});
|
|
192
228
|
|
|
193
229
|
return (
|
|
194
230
|
<View key={`${row.id}-${index}`}>
|
|
195
|
-
{index > 0 ? <View {...hairline.line} /> : null}
|
|
196
231
|
<XStack
|
|
197
232
|
testID="data-table-list-row"
|
|
198
233
|
alignItems={compact ? "flex-start" : "center"}
|
|
199
234
|
gap="$3"
|
|
200
|
-
|
|
201
|
-
paddingVertical={compact ? "$3" : "$2"}
|
|
235
|
+
paddingLeft={rowPad}
|
|
202
236
|
minHeight={chrome.rowPx}
|
|
203
237
|
overflow="hidden"
|
|
204
238
|
display="flex"
|
|
@@ -225,7 +259,18 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
225
259
|
: {})}
|
|
226
260
|
{...(rowIntentProps(rowData) as any)}
|
|
227
261
|
>
|
|
228
|
-
{showCheckboxes && (
|
|
262
|
+
{showCheckboxes && compact ? (
|
|
263
|
+
<RowSelectMark
|
|
264
|
+
checked={Boolean(row.getIsSelected())}
|
|
265
|
+
disabled={disabled}
|
|
266
|
+
label={
|
|
267
|
+
selectRowLabel?.(row, index) ??
|
|
268
|
+
withInterp(t("Select row {{row}}", { row: index + 1 }), { row: index + 1 })
|
|
269
|
+
}
|
|
270
|
+
onToggle={(checked) => row.toggleSelected(checked)}
|
|
271
|
+
/>
|
|
272
|
+
) : null}
|
|
273
|
+
{showCheckboxes && !compact && (
|
|
229
274
|
<Checkbox
|
|
230
275
|
checked={row.getIsSelected()}
|
|
231
276
|
onChange={(checked) => {
|
|
@@ -249,105 +294,146 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
249
294
|
</TableCellContext.Provider>
|
|
250
295
|
</View>
|
|
251
296
|
) : null}
|
|
252
|
-
<
|
|
253
|
-
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
overflow="hidden"
|
|
270
|
-
{...({ "data-list-slot": "meta-line" } as any)}
|
|
271
|
-
>
|
|
272
|
-
{metas.map((cell: any) => (
|
|
273
|
-
<View
|
|
274
|
-
key={cell.id}
|
|
275
|
-
minWidth={0}
|
|
276
|
-
flexShrink={1}
|
|
277
|
-
overflow="hidden"
|
|
278
|
-
{...({ "data-list-slot": "meta" } as any)}
|
|
279
|
-
>
|
|
280
|
-
<TableCellContext.Provider value={metaCell}>
|
|
281
|
-
{renderCellContent(cell, index, rowData)}
|
|
297
|
+
<XStack
|
|
298
|
+
flex={1}
|
|
299
|
+
minWidth={0}
|
|
300
|
+
alignSelf="stretch"
|
|
301
|
+
alignItems={compact ? "flex-start" : "center"}
|
|
302
|
+
gap="$3"
|
|
303
|
+
paddingVertical={compact ? "$3" : "$2"}
|
|
304
|
+
paddingRight={rowPad}
|
|
305
|
+
{...(index > 0 ? { ...hairline.top, borderColor: "$borderColor" } : null)}
|
|
306
|
+
{...({ "data-list-slot": "content" } as any)}
|
|
307
|
+
>
|
|
308
|
+
<YStack flex={1} minWidth={0} gap="$1" overflow="hidden">
|
|
309
|
+
{titleCell ? (
|
|
310
|
+
<XStack alignItems="center" gap="$2" minWidth={0}>
|
|
311
|
+
<View flex={1} minWidth={0} {...({ "data-list-slot": "title" } as any)}>
|
|
312
|
+
<TableCellContext.Provider value={compact ? headlineCell : plainCell}>
|
|
313
|
+
{renderCellContent(titleCell, index, rowData)}
|
|
282
314
|
</TableCellContext.Provider>
|
|
283
315
|
</View>
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
316
|
+
{titleStatuses.map((cell: any) => (
|
|
317
|
+
<View
|
|
318
|
+
key={cell.id}
|
|
319
|
+
flexShrink={0}
|
|
320
|
+
{...({ "data-list-slot": "status" } as any)}
|
|
321
|
+
>
|
|
322
|
+
<RowStatus cell={cell} />
|
|
323
|
+
</View>
|
|
324
|
+
))}
|
|
325
|
+
</XStack>
|
|
326
|
+
) : (
|
|
327
|
+
<View flex={1} />
|
|
328
|
+
)}
|
|
329
|
+
{metas.length + facts.length + lineStatuses.length + (stampInLine ? 1 : 0) > 0 ? (
|
|
330
|
+
<XStack
|
|
331
|
+
minWidth={0}
|
|
332
|
+
flexWrap={compact ? "nowrap" : "wrap"}
|
|
333
|
+
alignItems="center"
|
|
334
|
+
columnGap="$3"
|
|
335
|
+
rowGap="$1"
|
|
336
|
+
overflow="hidden"
|
|
337
|
+
{...({ "data-list-slot": "meta-line" } as any)}
|
|
338
|
+
>
|
|
339
|
+
{lineStatuses.map((cell: any) => (
|
|
340
|
+
<View
|
|
341
|
+
key={cell.id}
|
|
342
|
+
flexShrink={0}
|
|
343
|
+
{...({ "data-list-slot": "status" } as any)}
|
|
344
|
+
>
|
|
345
|
+
<RowStatus cell={cell} />
|
|
346
|
+
</View>
|
|
347
|
+
))}
|
|
348
|
+
{metas.map((cell: any) => (
|
|
349
|
+
<View
|
|
350
|
+
key={cell.id}
|
|
351
|
+
minWidth={0}
|
|
352
|
+
flexShrink={1}
|
|
353
|
+
overflow="hidden"
|
|
354
|
+
{...({ "data-list-slot": "meta" } as any)}
|
|
355
|
+
>
|
|
297
356
|
<TableCellContext.Provider value={metaCell}>
|
|
298
357
|
{renderCellContent(cell, index, rowData)}
|
|
299
358
|
</TableCellContext.Provider>
|
|
300
359
|
</View>
|
|
301
|
-
|
|
302
|
-
|
|
360
|
+
))}
|
|
361
|
+
{facts.map((cell: any) => (
|
|
362
|
+
<View key={cell.id} flexShrink={0} {...({ "data-list-slot": "fact" } as any)}>
|
|
363
|
+
<RowFact cell={cell} label={columnLabel(cell)}>
|
|
364
|
+
<TableCellContext.Provider value={metaCell}>
|
|
365
|
+
{renderCellContent(cell, index, rowData)}
|
|
366
|
+
</TableCellContext.Provider>
|
|
367
|
+
</RowFact>
|
|
368
|
+
</View>
|
|
369
|
+
))}
|
|
370
|
+
{stampInLine && stampCell ? (
|
|
371
|
+
<View flexShrink={0} {...({ "data-list-slot": "fact" } as any)}>
|
|
372
|
+
<RowFact
|
|
373
|
+
cell={stampCell}
|
|
374
|
+
label={columnLabel(stampCell)}
|
|
375
|
+
icon={CalendarBlankIcon}
|
|
376
|
+
>
|
|
377
|
+
<TableCellContext.Provider value={metaCell}>
|
|
378
|
+
{renderCellContent(stampCell, index, rowData)}
|
|
379
|
+
</TableCellContext.Provider>
|
|
380
|
+
</RowFact>
|
|
381
|
+
</View>
|
|
382
|
+
) : null}
|
|
383
|
+
</XStack>
|
|
384
|
+
) : null}
|
|
385
|
+
</YStack>
|
|
386
|
+
{stampCell && !stampInLine ? (
|
|
387
|
+
<View
|
|
388
|
+
flexShrink={0}
|
|
389
|
+
alignSelf="flex-start"
|
|
390
|
+
{...({ "data-list-slot": "stamp" } as any)}
|
|
391
|
+
>
|
|
392
|
+
<TableCellContext.Provider value={captionCell}>
|
|
393
|
+
{renderCellContent(stampCell, index, rowData)}
|
|
394
|
+
</TableCellContext.Provider>
|
|
395
|
+
</View>
|
|
396
|
+
) : null}
|
|
397
|
+
{compact && compactActions.length > 0 ? (
|
|
398
|
+
<XStack
|
|
399
|
+
flexShrink={0}
|
|
400
|
+
gap="$2"
|
|
401
|
+
alignSelf="flex-start"
|
|
402
|
+
alignItems="center"
|
|
403
|
+
flexWrap="nowrap"
|
|
404
|
+
{...({ "data-list-slot": "trailing-cluster" } as any)}
|
|
405
|
+
>
|
|
406
|
+
{compactActions}
|
|
303
407
|
</XStack>
|
|
304
408
|
) : null}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
{
|
|
314
|
-
</
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
gap="$3"
|
|
334
|
-
alignItems="center"
|
|
335
|
-
flexWrap="nowrap"
|
|
336
|
-
{...({ "data-list-slot": "trailing-cluster" } as any)}
|
|
337
|
-
>
|
|
338
|
-
{trailingCells}
|
|
339
|
-
</XStack>
|
|
340
|
-
) : null}
|
|
341
|
-
{!compact && indicators.length > 0 ? (
|
|
342
|
-
<XStack flexShrink={0} gap="$2" alignItems="center" flexWrap="nowrap" maxWidth="40%">
|
|
343
|
-
{indicatorCells}
|
|
344
|
-
</XStack>
|
|
345
|
-
) : null}
|
|
346
|
-
{!compact && actions.length > 0 ? (
|
|
347
|
-
<XStack flexShrink={0} gap="$1" alignItems="center" flexWrap="nowrap">
|
|
348
|
-
{actionCells}
|
|
349
|
-
</XStack>
|
|
350
|
-
) : null}
|
|
409
|
+
{!compact && trailing.length > 0 ? (
|
|
410
|
+
<XStack
|
|
411
|
+
flexShrink={0}
|
|
412
|
+
gap="$3"
|
|
413
|
+
alignItems="center"
|
|
414
|
+
flexWrap="nowrap"
|
|
415
|
+
{...({ "data-list-slot": "trailing-cluster" } as any)}
|
|
416
|
+
>
|
|
417
|
+
{trailingCells}
|
|
418
|
+
</XStack>
|
|
419
|
+
) : null}
|
|
420
|
+
{!compact && indicators.length > 0 ? (
|
|
421
|
+
<XStack
|
|
422
|
+
flexShrink={0}
|
|
423
|
+
gap="$2"
|
|
424
|
+
alignItems="center"
|
|
425
|
+
flexWrap="nowrap"
|
|
426
|
+
maxWidth="40%"
|
|
427
|
+
>
|
|
428
|
+
{indicatorCells}
|
|
429
|
+
</XStack>
|
|
430
|
+
) : null}
|
|
431
|
+
{!compact && actions.length > 0 ? (
|
|
432
|
+
<XStack flexShrink={0} gap="$1" alignItems="center" flexWrap="nowrap">
|
|
433
|
+
{actionCells}
|
|
434
|
+
</XStack>
|
|
435
|
+
) : null}
|
|
436
|
+
</XStack>
|
|
351
437
|
</XStack>
|
|
352
438
|
</View>
|
|
353
439
|
);
|
|
@@ -360,6 +446,9 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
360
446
|
showCheckboxes,
|
|
361
447
|
getRowPressProps,
|
|
362
448
|
knobProps.borderRadiusOuter.borderRadius,
|
|
449
|
+
knobProps.cardSurface.borderRadius,
|
|
450
|
+
knobProps.cardSurface.backgroundColor,
|
|
451
|
+
grouped,
|
|
363
452
|
renderCellContent,
|
|
364
453
|
rowPad,
|
|
365
454
|
selectRowLabel,
|
|
@@ -378,6 +467,7 @@ export function DataTableDocumentList<TData extends Record<string, any>>({
|
|
|
378
467
|
testID="data-table-list"
|
|
379
468
|
{...({ "data-list-layout": "list" } as any)}
|
|
380
469
|
{...(bleed ? { ...bleed.frame, "data-phone-bleed": "true" } : {})}
|
|
470
|
+
{...(grouped && tableRows.length > 0 ? { componentName: "Card", ...groupSurface } : {})}
|
|
381
471
|
{...(getRowPressProps ? ({ "data-row-press-scope": "true" } as any) : {})}
|
|
382
472
|
>
|
|
383
473
|
{tableRows.length === 0 ? (
|