@tcn/ui-table 2.3.6 → 2.3.7
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/components/cells/header_cell.d.ts.map +1 -1
- package/dist/components/cells/header_cell.js +6 -6
- package/dist/components/cells/header_cell.js.map +1 -1
- package/package.json +4 -4
- package/src/__stories__/aip_table.stories.tsx +3 -3
- package/src/__stories__/demo.stories.tsx +4 -4
- package/src/__stories__/table.stories.tsx +9 -9
- package/src/components/cells/header_cell.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header_cell.d.ts","sourceRoot":"","sources":["../../../src/components/cells/header_cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"header_cell.d.ts","sourceRoot":"","sources":["../../../src/components/cells/header_cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAM3C,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,GACR,EAAE,eAAe,2CA2CjB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as x } from "react";
|
|
3
3
|
import { Box as r, HStack as h } from "@tcn/ui/stacks";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { TH as f } from "@tcn/ui/layouts";
|
|
5
|
+
import { c as u } from "../../cell.module-WpHnQBVu.js";
|
|
6
|
+
import { SortControl as y } from "./sort_control.js";
|
|
7
7
|
function H({
|
|
8
8
|
heading: n,
|
|
9
9
|
sticky: l,
|
|
@@ -20,9 +20,9 @@ function H({
|
|
|
20
20
|
[i]
|
|
21
21
|
);
|
|
22
22
|
return /* @__PURE__ */ e(
|
|
23
|
-
|
|
23
|
+
f,
|
|
24
24
|
{
|
|
25
|
-
className:
|
|
25
|
+
className: u["table-cell"],
|
|
26
26
|
"data-stick-to": l,
|
|
27
27
|
style: { width: `${o}px`, zIndex: m },
|
|
28
28
|
children: /* @__PURE__ */ e(
|
|
@@ -46,7 +46,7 @@ function H({
|
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
48
|
/* @__PURE__ */ e(
|
|
49
|
-
|
|
49
|
+
y,
|
|
50
50
|
{
|
|
51
51
|
canSort: d,
|
|
52
52
|
onSortModeChange: a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header_cell.js","sources":["../../../src/components/cells/header_cell.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\n\nimport { Box, HStack } from '@tcn/ui/stacks';\n\nimport cellStyles from './cell.module.css';\nimport { SortControl, type SortControlProps } from './sort_control.js';\
|
|
1
|
+
{"version":3,"file":"header_cell.js","sources":["../../../src/components/cells/header_cell.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\n\nimport { Box, HStack } from '@tcn/ui/stacks';\n\nimport { TH } from '@tcn/ui/layouts';\nimport cellStyles from './cell.module.css';\nimport { SortControl, type SortControlProps } from './sort_control.js';\n\nexport interface HeaderCellProps extends SortControlProps {\n heading: React.ReactNode;\n index: number;\n sticky?: 'start' | 'end';\n onResize?: (width: number) => void;\n width?: number;\n}\n\nexport function HeaderCell({\n heading,\n sticky,\n onResize,\n width,\n sortMode,\n onSortModeChange,\n canSort,\n}: HeaderCellProps) {\n const zIndex = sticky != null ? 2 : 1;\n\n const handleResize = useCallback(\n (newSize: number) => {\n onResize?.(Math.max(newSize, 20));\n },\n [onResize]\n );\n\n return (\n <TH\n className={cellStyles['table-cell']}\n data-stick-to={sticky}\n style={{ width: `${width}px`, zIndex }}\n >\n <Box\n padding=\"0px 8px\" // FIXME: should be on theme ideally.\n overflow=\"hidden\"\n minWidth=\"24px\"\n enableResizeOnEnd\n onWidthResize={handleResize}\n style={{ width: `${width}px`, minWidth: '20px' }}\n onClick={e => e.stopPropagation()}\n >\n <HStack>\n <Box\n minWidth=\"24px\"\n className=\"ellipsis\"\n style={{ alignItems: 'center', display: 'flex' }}\n >\n {heading}\n </Box>\n\n <SortControl\n canSort={canSort}\n onSortModeChange={onSortModeChange}\n sortMode={sortMode}\n />\n </HStack>\n </Box>\n </TH>\n );\n}\n"],"names":["HeaderCell","heading","sticky","onResize","width","sortMode","onSortModeChange","canSort","zIndex","handleResize","useCallback","newSize","jsx","TH","cellStyles","Box","e","HStack","SortControl"],"mappings":";;;;;;AAgBO,SAASA,EAAW;AAAA,EACzB,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AACF,GAAoB;AAClB,QAAMC,IAASN,KAAU,OAAO,IAAI,GAE9BO,IAAeC;AAAA,IACnB,CAACC,MAAoB;AACnB,MAAAR,IAAW,KAAK,IAAIQ,GAAS,EAAE,CAAC;AAAA,IAClC;AAAA,IACA,CAACR,CAAQ;AAAA,EAAA;AAGX,SACE,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,YAAY;AAAA,MAClC,iBAAeZ;AAAA,MACf,OAAO,EAAE,OAAO,GAAGE,CAAK,MAAM,QAAAI,EAAA;AAAA,MAE9B,UAAA,gBAAAI;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,UAAS;AAAA,UACT,UAAS;AAAA,UACT,mBAAiB;AAAA,UACjB,eAAeN;AAAA,UACf,OAAO,EAAE,OAAO,GAAGL,CAAK,MAAM,UAAU,OAAA;AAAA,UACxC,SAAS,CAAAY,MAAKA,EAAE,gBAAA;AAAA,UAEhB,4BAACC,GAAA,EACC,UAAA;AAAA,YAAA,gBAAAL;AAAA,cAACG;AAAA,cAAA;AAAA,gBACC,UAAS;AAAA,gBACT,WAAU;AAAA,gBACV,OAAO,EAAE,YAAY,UAAU,SAAS,OAAA;AAAA,gBAEvC,UAAAd;AAAA,cAAA;AAAA,YAAA;AAAA,YAGH,gBAAAW;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,SAAAX;AAAA,gBACA,kBAAAD;AAAA,gBACA,UAAAD;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tcn/ui-table",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React table component library",
|
|
6
6
|
"author": "TCN",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"clarity-pattern-parser": "^11.5.4",
|
|
42
42
|
"@tcn/aip-160": "1.2.5",
|
|
43
|
-
"@tcn/resource-store": "2.5.1",
|
|
44
43
|
"@tcn/icons": "2.2.1",
|
|
45
|
-
"@tcn/
|
|
46
|
-
"@tcn/
|
|
44
|
+
"@tcn/state": "1.2.0",
|
|
45
|
+
"@tcn/ui": "0.10.0",
|
|
46
|
+
"@tcn/resource-store": "2.5.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^18.2.0",
|
|
@@ -15,7 +15,7 @@ import { Title } from '@tcn/ui/typography';
|
|
|
15
15
|
|
|
16
16
|
import styles from './table.module.css';
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { Panel } from '@tcn/ui/surfaces';
|
|
19
19
|
import { AuthContext, useToken } from './auth_provider.js';
|
|
20
20
|
|
|
21
21
|
const meta: Meta = {
|
|
@@ -94,7 +94,7 @@ function BasicContent() {
|
|
|
94
94
|
return (
|
|
95
95
|
<VStack>
|
|
96
96
|
<HStack height="auto">{tokenValue === '' ? 'Sign in to load data' : ''}</HStack>
|
|
97
|
-
<
|
|
97
|
+
<Panel>
|
|
98
98
|
<HStack className={styles.header} padding="8px" vAlign="center">
|
|
99
99
|
<Title>Organizations</Title>
|
|
100
100
|
<Spacer />
|
|
@@ -172,7 +172,7 @@ function BasicContent() {
|
|
|
172
172
|
<HStack padding="8px">
|
|
173
173
|
<TablePager dataSource={source} />
|
|
174
174
|
</HStack>
|
|
175
|
-
</
|
|
175
|
+
</Panel>
|
|
176
176
|
</VStack>
|
|
177
177
|
);
|
|
178
178
|
}
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
import { useSignalValue } from '@tcn/state';
|
|
9
9
|
import { Button } from '@tcn/ui/actions';
|
|
10
10
|
import { Box, HStack, Spacer } from '@tcn/ui/stacks';
|
|
11
|
-
import {
|
|
11
|
+
import { Panel } from '@tcn/ui/surfaces';
|
|
12
12
|
import { Title } from '@tcn/ui/typography';
|
|
13
|
-
import
|
|
13
|
+
import { useState } from 'react';
|
|
14
14
|
import { GlobalSearch } from '../components/global_search.js';
|
|
15
15
|
import { Table } from '../components/table/table.js';
|
|
16
16
|
import { TableColumn } from '../components/table/table_column.js';
|
|
@@ -59,7 +59,7 @@ export function Demo() {
|
|
|
59
59
|
const isFiltered = filterString !== '';
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<
|
|
62
|
+
<Panel height="100%">
|
|
63
63
|
<HStack padding="8px" vAlign="center">
|
|
64
64
|
<Title>Cosmerinas</Title>
|
|
65
65
|
<Spacer />
|
|
@@ -132,6 +132,6 @@ export function Demo() {
|
|
|
132
132
|
</Box>
|
|
133
133
|
<TablePager dataSource={source} />
|
|
134
134
|
</HStack>
|
|
135
|
-
</
|
|
135
|
+
</Panel>
|
|
136
136
|
);
|
|
137
137
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-vite';
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
|
|
4
|
+
import { CrossIcon } from '@tcn/icons/cross_icon.js';
|
|
4
5
|
import {
|
|
5
6
|
StaticDataSource,
|
|
6
7
|
StaticDateField,
|
|
@@ -9,8 +10,9 @@ import {
|
|
|
9
10
|
} from '@tcn/resource-store';
|
|
10
11
|
import { useSignalValue } from '@tcn/state';
|
|
11
12
|
import { Button } from '@tcn/ui/actions';
|
|
13
|
+
import { Footer, Header, HBody, Rail, Side, VBody } from '@tcn/ui/layouts';
|
|
12
14
|
import { Box, HStack, Spacer, VStack, ZStack } from '@tcn/ui/stacks';
|
|
13
|
-
import {
|
|
15
|
+
import { Panel } from '@tcn/ui/surfaces';
|
|
14
16
|
import { Title } from '@tcn/ui/typography';
|
|
15
17
|
import { GlobalSearch } from '../components/global_search.js';
|
|
16
18
|
import { Table } from '../components/table/table.js';
|
|
@@ -22,9 +24,7 @@ import { StringFieldFilter } from '../components/table_filter_panel/field_filter
|
|
|
22
24
|
import { TableFilterPanel } from '../components/table_filter_panel/table_filter_panel.js';
|
|
23
25
|
import { TablePager } from '../components/table_pager.js';
|
|
24
26
|
import { DataItem, items, stickyItems } from './sample_data.js';
|
|
25
|
-
import { CrossIcon } from '@tcn/icons/cross_icon.js';
|
|
26
27
|
import styles from './table.module.css';
|
|
27
|
-
import { Footer, Header, Main, Rail, Side, VBody } from '@tcn/ui/layouts';
|
|
28
28
|
|
|
29
29
|
const meta: Meta = {
|
|
30
30
|
title: 'Table',
|
|
@@ -302,7 +302,7 @@ export function WithTableHeaderAndTableFooter() {
|
|
|
302
302
|
|
|
303
303
|
return (
|
|
304
304
|
<StoryWrapper>
|
|
305
|
-
<
|
|
305
|
+
<Panel>
|
|
306
306
|
<Header className={styles.header} padding="8px" vAlign="center">
|
|
307
307
|
<Title>The Table</Title>
|
|
308
308
|
<Spacer />
|
|
@@ -327,7 +327,7 @@ export function WithTableHeaderAndTableFooter() {
|
|
|
327
327
|
<Footer>
|
|
328
328
|
<TablePager dataSource={source} />
|
|
329
329
|
</Footer>
|
|
330
|
-
</
|
|
330
|
+
</Panel>
|
|
331
331
|
</StoryWrapper>
|
|
332
332
|
);
|
|
333
333
|
}
|
|
@@ -409,7 +409,7 @@ export function WithFilterPanel() {
|
|
|
409
409
|
|
|
410
410
|
return (
|
|
411
411
|
<StoryWrapper>
|
|
412
|
-
<
|
|
412
|
+
<Panel height="100%">
|
|
413
413
|
<Header>The Table</Header>
|
|
414
414
|
<VBody>
|
|
415
415
|
<Rail>
|
|
@@ -431,7 +431,7 @@ export function WithFilterPanel() {
|
|
|
431
431
|
</TableFilterPanel>
|
|
432
432
|
</Box>
|
|
433
433
|
</Side>
|
|
434
|
-
<
|
|
434
|
+
<HBody>
|
|
435
435
|
<Table dataSource={source} height="100%" width="flex">
|
|
436
436
|
<TableColumn heading="Name" fieldName="name" sticky="start" />
|
|
437
437
|
<TableColumn heading="Age" fieldName="age" width={150} canSort />
|
|
@@ -446,13 +446,13 @@ export function WithFilterPanel() {
|
|
|
446
446
|
<TableColumn heading="Occupation" fieldName="occupation" width={200} />
|
|
447
447
|
<TableColumn heading="Active" fieldName="isActive" />
|
|
448
448
|
</Table>
|
|
449
|
-
</
|
|
449
|
+
</HBody>
|
|
450
450
|
</Rail>
|
|
451
451
|
</VBody>
|
|
452
452
|
<Footer>
|
|
453
453
|
<TablePager dataSource={source} />
|
|
454
454
|
</Footer>
|
|
455
|
-
</
|
|
455
|
+
</Panel>
|
|
456
456
|
</StoryWrapper>
|
|
457
457
|
);
|
|
458
458
|
}
|
|
@@ -2,9 +2,9 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Box, HStack } from '@tcn/ui/stacks';
|
|
4
4
|
|
|
5
|
+
import { TH } from '@tcn/ui/layouts';
|
|
5
6
|
import cellStyles from './cell.module.css';
|
|
6
7
|
import { SortControl, type SortControlProps } from './sort_control.js';
|
|
7
|
-
import { TH } from '@tcn/ui/layouts';
|
|
8
8
|
|
|
9
9
|
export interface HeaderCellProps extends SortControlProps {
|
|
10
10
|
heading: React.ReactNode;
|