mantine-datatable 1.1.0 → 1.2.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/README.md +63 -2
- package/dist/DataTable.d.ts +2 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.props.d.ts +29 -4
- package/dist/DataTable.props.d.ts.map +1 -1
- package/dist/DataTableEmptyRow.d.ts +1 -0
- package/dist/DataTableEmptyRow.d.ts.map +1 -1
- package/dist/DataTableFooter.d.ts +2 -1
- package/dist/DataTableFooter.d.ts.map +1 -1
- package/dist/DataTableHeader.d.ts.map +1 -1
- package/dist/DataTableHeaderCell.d.ts.map +1 -1
- package/dist/DataTableLoader.d.ts +1 -0
- package/dist/DataTableLoader.d.ts.map +1 -1
- package/dist/DataTableNoRecords.d.ts +1 -0
- package/dist/DataTableNoRecords.d.ts.map +1 -1
- package/dist/DataTableRowCell.d.ts +1 -0
- package/dist/DataTableRowCell.d.ts.map +1 -1
- package/dist/DataTableRowMenuDivider.d.ts +1 -0
- package/dist/DataTableRowMenuDivider.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[![License][license-image]][license-url]
|
|
5
5
|
[![Stars][stars-image]][repo-url]
|
|
6
6
|
[![Last commit][last-commit-image]][repo-url]
|
|
7
|
+
[![Closed issues][closed-issues-image]][repo-url]
|
|
7
8
|
[![Downloads][downloads-image]][npm-url]
|
|
8
9
|
[![Language][language-image]][repo-url]
|
|
9
10
|
|
|
@@ -11,9 +12,68 @@ A "dark-theme aware" **table component** for your Mantine UI data-rich applicati
|
|
|
11
12
|
|
|
12
13
|
[](https://icflorescu.github.io/mantine-datatable/)
|
|
13
14
|
|
|
14
|
-
##
|
|
15
|
+
## Full documentation and examples
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Visit [icflorescu.github.io/mantine-datatable](https://icflorescu.github.io/mantine-datatable/) to view the full documentation and learn how to use it.
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
Install the package and its dependencies:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm i @mantine/core @mantine/hooks @emotion/react mantine-datatable
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Use it in your code:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { Text } from '@mantine/core';
|
|
31
|
+
import { DataTable } from 'mantine-datatable';
|
|
32
|
+
|
|
33
|
+
export default function GettingStartedExample() {
|
|
34
|
+
return (
|
|
35
|
+
<DataTable
|
|
36
|
+
withBorder
|
|
37
|
+
borderRadius="sm"
|
|
38
|
+
withColumnBorders
|
|
39
|
+
striped
|
|
40
|
+
highlightOnHover
|
|
41
|
+
// provide data
|
|
42
|
+
records={[
|
|
43
|
+
{ id: 1, name: 'Joe Biden', bornIn: 1942, party: 'Democratic' },
|
|
44
|
+
// more records...
|
|
45
|
+
]}
|
|
46
|
+
// define columns
|
|
47
|
+
columns={[
|
|
48
|
+
{
|
|
49
|
+
accessor: 'id',
|
|
50
|
+
// this column has a custom title
|
|
51
|
+
title: '#',
|
|
52
|
+
// right-align column
|
|
53
|
+
textAlignment: 'right',
|
|
54
|
+
},
|
|
55
|
+
{ accessor: 'name' },
|
|
56
|
+
{
|
|
57
|
+
accessor: 'party',
|
|
58
|
+
// this column has custom cell data rendering
|
|
59
|
+
render: ({ party }) => (
|
|
60
|
+
<Text weight={700} color={party === 'Democratic' ? 'blue' : 'red'}>
|
|
61
|
+
{party.slice(0, 3).toUpperCase()}
|
|
62
|
+
</Text>
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
// simplest column definition
|
|
66
|
+
{ accessor: 'bornIn' },
|
|
67
|
+
]}
|
|
68
|
+
// execute this callback when a row is clicked
|
|
69
|
+
onRowClick={({ name, party, bornIn }) =>
|
|
70
|
+
alert(`You clicked on ${name}, a ${party.toLowerCase()} president born in ${bornIn}`)
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
Also see the [getting started](https://icflorescu.github.io/mantine-datatable/getting-started) page in the documentation.
|
|
17
77
|
|
|
18
78
|
## Contributors
|
|
19
79
|
|
|
@@ -41,4 +101,5 @@ The [MIT License](https://github.com/icflorescu/mantine-datatable/blob/master/LI
|
|
|
41
101
|
[downloads-image]: http://img.shields.io/npm/dm/mantine-datatable.svg?style=flat-square
|
|
42
102
|
[stars-image]: https://img.shields.io/github/stars/icflorescu/mantine-datatable?style=flat-square
|
|
43
103
|
[last-commit-image]: https://img.shields.io/github/last-commit/icflorescu/mantine-datatable?style=flat-square
|
|
104
|
+
[closed-issues-image]: https://img.shields.io/github/issues-closed-raw/icflorescu/mantine-datatable?style=flat-square
|
|
44
105
|
[language-image]: https://img.shields.io/github/languages/top/icflorescu/mantine-datatable?style=flat-square
|
package/dist/DataTable.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { DataTableProps } from './DataTable.props';
|
|
2
|
-
export default function DataTable<T extends Record<string, unknown>>({ withBorder, borderRadius, withColumnBorders, height, minHeight, shadow, verticalAlignment, fetching, columns, idAccessor, records, selectedRecords, onSelectedRecordsChange, sortStatus, onSortStatusChange, horizontalSpacing, page, onPageChange, totalRecords, recordsPerPage, paginationSize, loaderSize, loaderVariant, loaderBackgroundBlur, noRecordsText, striped, onRowClick, rowContextMenu, ...otherProps }: DataTableProps<T>): JSX.Element;
|
|
3
|
+
export default function DataTable<T extends Record<string, unknown>>({ withBorder, borderRadius, borderColor, rowBorderColor, withColumnBorders, textSelectionDisabled, height, minHeight, shadow, verticalAlignment, fetching, columns, idAccessor, records, selectedRecords, onSelectedRecordsChange, sortStatus, onSortStatusChange, horizontalSpacing, page, onPageChange, totalRecords, recordsPerPage, paginationSize, paginationText, loaderSize, loaderVariant, loaderBackgroundBlur, noRecordsText, striped, onRowClick, rowContextMenu, ...otherProps }: DataTableProps<T>): JSX.Element;
|
|
3
4
|
//# sourceMappingURL=DataTable.d.ts.map
|
package/dist/DataTable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../DataTable.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../DataTable.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgFnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnE,UAAU,EACV,YAAY,EACZ,WAAqG,EACrG,cACiG,EACjG,iBAAiB,EACjB,qBAAqB,EACrB,MAAe,EACf,SAAS,EACT,MAAM,EACN,iBAA4B,EAC5B,QAAQ,EACR,OAAO,EACP,UAAiB,EACjB,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAqB,EACrB,cAAoF,EACpF,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,aAA4B,EAC5B,OAAO,EACP,UAAU,EACV,cAAc,EACd,GAAG,UAAU,EACd,EAAE,cAAc,CAAC,CAAC,CAAC,eAySnB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MantineColor, MantineNumberSize, MantineShadow, MantineTheme, TableProps } from '@mantine/core';
|
|
1
|
+
import { MantineColor, MantineNumberSize, MantineShadow, MantineSize, MantineTheme, TableProps } from '@mantine/core';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export declare type DataTableColumnTextAlignment = 'left' | 'center' | 'right';
|
|
4
4
|
export declare type DataTableVerticalAlignment = 'top' | 'center' | 'bottom';
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type DataTableOuterBorderProps = {
|
|
6
6
|
withBorder?: never;
|
|
7
7
|
borderRadius?: never;
|
|
8
8
|
} | {
|
|
@@ -21,6 +21,7 @@ export declare type DataTablePaginationProps = {
|
|
|
21
21
|
totalRecords?: never;
|
|
22
22
|
recordsPerPage?: never;
|
|
23
23
|
paginationSize?: never;
|
|
24
|
+
paginationText?: never;
|
|
24
25
|
} | {
|
|
25
26
|
/**
|
|
26
27
|
* Current page number (1-based); if provided, a pagination component is shown
|
|
@@ -41,7 +42,16 @@ export declare type DataTablePaginationProps = {
|
|
|
41
42
|
/**
|
|
42
43
|
* Pagination component size; defaults to `sm`
|
|
43
44
|
*/
|
|
44
|
-
paginationSize?:
|
|
45
|
+
paginationSize?: MantineSize;
|
|
46
|
+
/**
|
|
47
|
+
* Pagination text; defaults to ```({ from, to, totalRecords }) => `${from}-${to}/${totalRecords}`
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
paginationText?: (options: {
|
|
51
|
+
from: number;
|
|
52
|
+
to: number;
|
|
53
|
+
totalRecords: number;
|
|
54
|
+
}) => ReactNode;
|
|
45
55
|
};
|
|
46
56
|
export declare type DataTableColumn<T> = {
|
|
47
57
|
/**
|
|
@@ -179,6 +189,21 @@ export declare type DataTableProps<T> = {
|
|
|
179
189
|
* If true, columns will have vertical borders
|
|
180
190
|
*/
|
|
181
191
|
withColumnBorders?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Table border color, applied to the outer border, the header bottom border, and the pagination
|
|
194
|
+
* footer top border; defaults to
|
|
195
|
+
* `(theme) => (theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3])`
|
|
196
|
+
*/
|
|
197
|
+
borderColor?: string | ((theme: MantineTheme) => string);
|
|
198
|
+
/**
|
|
199
|
+
* Row border color; defaults to
|
|
200
|
+
* `(theme) => (theme.fn.rgba(theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3], 0.65))`
|
|
201
|
+
*/
|
|
202
|
+
rowBorderColor?: string | ((theme: MantineTheme) => string);
|
|
203
|
+
/**
|
|
204
|
+
* If true, the user will not be able to select text
|
|
205
|
+
*/
|
|
206
|
+
textSelectionDisabled?: boolean;
|
|
182
207
|
/**
|
|
183
208
|
* Vertical alignment for row cells; defaults to `center`
|
|
184
209
|
*/
|
|
@@ -251,5 +276,5 @@ export declare type DataTableProps<T> = {
|
|
|
251
276
|
*/
|
|
252
277
|
items: (record: T) => DataTableContextMenuItemProps[];
|
|
253
278
|
};
|
|
254
|
-
} & Omit<TableProps, 'border'> &
|
|
279
|
+
} & Omit<TableProps, 'border'> & DataTableOuterBorderProps & DataTablePaginationProps & DataTableSortProps & DataTableSelectionProps<T>;
|
|
255
280
|
//# sourceMappingURL=DataTable.props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.props.d.ts","sourceRoot":"","sources":["../DataTable.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.props.d.ts","sourceRoot":"","sources":["../DataTable.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,oBAAY,4BAA4B,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACvE,oBAAY,0BAA0B,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErE,oBAAY,yBAAyB,GACjC;IACE,UAAU,CAAC,EAAE,KA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AEvC;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;QAEjC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;QAEjC;;WAEG;QACH,MAAM,CAAC,EAAE,aAAa,CAAC;QAEvB;;;WAGG;QACH,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC;QAE5C;;WAEG;QACH,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,6BAA6B,EAAE,CAAC;KACvD,CAAC;CACH,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,GAC5B,yBAAyB,GACzB,wBAAwB,GACxB,kBAAkB,GAClB,uBAAuB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableEmptyRow.d.ts","sourceRoot":"","sources":["../DataTableEmptyRow.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,iBAAiB,gBAOxC"}
|
|
1
|
+
{"version":3,"file":"DataTableEmptyRow.d.ts","sourceRoot":"","sources":["../DataTableEmptyRow.tsx"],"names":[],"mappings":";AAUA,MAAM,CAAC,OAAO,UAAU,iBAAiB,gBAOxC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { MantineNumberSize } from '@mantine/core';
|
|
1
|
+
import { MantineNumberSize, MantineTheme } from '@mantine/core';
|
|
2
2
|
import { ForwardedRef } from 'react';
|
|
3
3
|
import { DataTablePaginationProps } from './DataTable.props';
|
|
4
4
|
declare type DataTableFooterProps = DataTablePaginationProps & {
|
|
5
|
+
topBorderColor: string | ((theme: MantineTheme) => string);
|
|
5
6
|
fetching: boolean | undefined;
|
|
6
7
|
recordsLength: number | undefined;
|
|
7
8
|
horizontalSpacing: MantineNumberSize | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableFooter.d.ts","sourceRoot":"","sources":["../DataTableFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,iBAAiB,EAAoB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTableFooter.d.ts","sourceRoot":"","sources":["../DataTableFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,iBAAiB,EAAE,YAAY,EAAoB,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAuB7D,aAAK,oBAAoB,GAAG,wBAAwB,GAAG;IACrD,cAAc,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,CAAC,CAAC;IAC3D,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAClD,CAAC;gCAwCY,oBAAoB,GAAG;IAAE,GAAG,EAAE,aAAa,cAAc,CAAC,CAAA;CAAE,KAAK,WAAW;AAtC1F,wBAsC2F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableHeader.d.ts","sourceRoot":"","sources":["../DataTableHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTableHeader.d.ts","sourceRoot":"","sources":["../DataTableHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAwEzE,aAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC5C,kBAAkB,EAAE,CAAC,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC5E,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC5C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;;SAoDgD,aAAa,uBAAuB,CAAC;MAAO,WAAW;AAlDzG,wBAkD0G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableHeaderCell.d.ts","sourceRoot":"","sources":["../DataTableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTableHeaderCell.d.ts","sourceRoot":"","sources":["../DataTableHeaderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,m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EAAE,oBAAoB,eAYtB"}
|
|
1
|
+
{"version":3,"file":"DataTableLoader.d.ts","sourceRoot":"","sources":["../DataTableLoader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqB9F,aAAK,oBAAoB,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;CACnD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,EAAE,EACF,EAAE,EACF,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,aAAa,GACd,EAAE,oBAAoB,eAYtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableNoRecords.d.ts","sourceRoot":"","sources":["../DataTableNoRecords.tsx"],"names":[],"mappings":"AA2BA,aAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,uBAAuB,eAY3F"}
|
|
1
|
+
{"version":3,"file":"DataTableNoRecords.d.ts","sourceRoot":"","sources":["../DataTableNoRecords.tsx"],"names":[],"mappings":";AA2BA,aAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,uBAAuB,eAY3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableRowCell.d.ts","sourceRoot":"","sources":["../DataTableRowCell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWpD,aAAK,qBAAqB,CAAC,CAAC,IAAI;IAC9B,MAAM,EAAE,CAAC,CAAC;CACX,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,mBAAmB,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC;AAEnH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,EAAE,EAC1C,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,aAAa,EACb,KAAK,EACL,QAAQ,EACR,MAAM,GACP,EAAE,qBAAqB,CAAC,CAAC,CAAC,sBAkB1B"}
|
|
1
|
+
{"version":3,"file":"DataTableRowCell.d.ts","sourceRoot":"","sources":["../DataTableRowCell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWpD,aAAK,qBAAqB,CAAC,CAAC,IAAI;IAC9B,MAAM,EAAE,CAAC,CAAC;CACX,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,mBAAmB,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC;AAEnH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,EAAE,EAC1C,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,aAAa,EACb,KAAK,EACL,QAAQ,EACR,MAAM,GACP,EAAE,qBAAqB,CAAC,CAAC,CAAC,sBAkB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableRowMenuDivider.d.ts","sourceRoot":"","sources":["../DataTableRowMenuDivider.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,uBAAuB,gBAG9C"}
|
|
1
|
+
{"version":3,"file":"DataTableRowMenuDivider.d.ts","sourceRoot":"","sources":["../DataTableRowMenuDivider.tsx"],"names":[],"mappings":";AASA,MAAM,CAAC,OAAO,UAAU,uBAAuB,gBAG9C"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Ar=Object.create;var se=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Lr=Object.getOwnPropertyNames;var Pr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var vr=(e,r)=>{for(var o in r)se(e,o,{get:r[o],enumerable:!0})},je=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Lr(r))!Mr.call(e,t)&&t!==o&&se(e,t,{get:()=>r[t],enumerable:!(a=Rr(r,t))||a.enumerable});return e};var de=(e,r,o)=>(o=e!=null?Ar(Pr(e)):{},je(r||!e||!e.__esModule?se(o,"default",{value:e,enumerable:!0}):o,e)),Fr=e=>je(se({},"__esModule",{value:!0}),e);var ro={};vr(ro,{DataTable:()=>Ve});module.exports=Fr(ro);var n=de(require("react"),1);var $=require("@mantine/core"),B=require("@mantine/hooks"),v=require("react");var Je=require("@mantine/core"),Ye=require("react/jsx-runtime"),Hr=(0,Je.createStyles)({root:{"&&":{background:"transparent"}}});function De(){let{classes:e}=Hr();return(0,Ye.jsx)("tr",{className:e.root,children:(0,Ye.jsx)("td",{})})}var A=require("@mantine/core"),er=require("react"),ue=require("react/jsx-runtime"),Nr=(0,A.createStyles)(e=>({root:{borderTop:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between",gap:e.spacing.xs,[e.fn.largerThan("xs")]:{flexDirection:"row"}},pagination:{opacity:1,transition:"opacity .15s ease"},paginationFetching:{opacity:0}})),rr=(0,er.forwardRef)(function({fetching:r,page:o,onPageChange:a,paginationSize:t,totalRecords:f,recordsPerPage:m,recordsLength:u,horizontalSpacing:x},l){let p;if(r)p="...";else{let h=(o-1)*m+1,C=h+u-1;p=`${h} - ${C}`,f&&(p+=` / ${f}`)}let{classes:d,cx:i}=Nr();return(0,ue.jsxs)(A.Box,{ref:l,px:x??"xs",py:"xs",className:d.root,children:[(0,ue.jsx)(A.Text,{size:t,children:p}),(0,ue.jsx)(A.Pagination,{className:i(d.pagination,{[d.paginationFetching]:r||!u}),page:o,onChange:a,size:t,total:Math.ceil(f/m)})]})});var ne=require("@mantine/core"),fr=require("react");var S=require("@mantine/core");function R(){return R=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e},R.apply(this,arguments)}function Er(e,r){if(e==null)return{};var o={},a=Object.keys(e),t,f;for(f=0;f<a.length;f++)t=a[f],!(r.indexOf(t)>=0)&&(o[t]=e[t]);return o}function z(e,r){if(e==null)return{};var o=Er(e,r),a,t;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(t=0;t<f.length;t++)a=f[t],!(r.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,a)||(o[a]=e[a]))}return o}var V=de(require("react")),zr=["size","color"];function Ae(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=z(e,zr);return V.default.createElement("svg",R({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-arrow-down",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),V.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),V.default.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),V.default.createElement("line",{x1:"18",y1:"13",x2:"12",y2:"19"}),V.default.createElement("line",{x1:"6",y1:"13",x2:"12",y2:"19"}))}var W=de(require("react")),Vr=["size","color"];function Re(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=z(e,Vr);return W.default.createElement("svg",R({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-arrows-vertical",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),W.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),W.default.createElement("polyline",{points:"8 7 12 3 16 7"}),W.default.createElement("polyline",{points:"8 17 12 21 16 17"}),W.default.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"21"}))}var M=de(require("react")),Wr=["size","color"];function Le(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=z(e,Wr);return M.default.createElement("svg",R({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-database-off",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),M.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),M.default.createElement("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),M.default.createElement("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),M.default.createElement("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),M.default.createElement("line",{x1:"3",y1:"3",x2:"21",y2:"21"}))}var or=require("@mantine/core"),ar=require("@mantine/hooks");function pe(e){let r=(0,or.useMantineTheme)(),o=typeof e=="function"?e(r):e;return(0,ar.useMediaQuery)(o||"",!0)}function me(e){let r=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${r.charAt(0).toUpperCase()}${r.slice(1)}`}function tr(e,r,o){if(typeof o=="string"){let a=o;o=t=>t[a]}return e.filter(a=>!r.map(o).includes(o(a)))}function xe(e,r){if(typeof r=="string"){let o=r;r=a=>a[o]}return e.filter((o,a,t)=>a===t.findIndex(f=>r(o)===r(f)))}function b(e,r){return r?r.match(/([^[.\]])+/g).reduce((a,t)=>a&&a[t],e):void 0}var L=require("react/jsx-runtime"),Ir=(0,S.createStyles)(e=>({sortableColumnHeader:{cursor:"pointer",transition:"background .15s ease","&:hover":{background:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}},columnHeaderText:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",userSelect:"none"},sortableColumnHeaderText:{minWidth:0,flexGrow:1},sortableColumnHeaderIcon:{transition:"transform .15s ease"},sortableColumnHeaderIconRotated:{transform:"rotate3d(0, 0, 1, 180deg)"},sortableColumnHeaderNeutralIcon:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],transition:"color .15s ease","th:hover &":{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]}}}));function Pe({accessor:e,visibleMediaQuery:r,title:o,sortable:a,textAlignment:t,width:f,sortStatus:m,onSortStatusChange:u}){let{cx:x,classes:l}=Ir();if(!pe(r))return null;let p=o??me(e);return(0,L.jsx)(S.Box,{component:"th",className:x({[l.sortableColumnHeader]:a}),sx:{"&&":{textAlign:t},width:f,minWidth:f,maxWidth:f},role:a?"button":void 0,onClick:a&&u?()=>{u({columnAccessor:e,direction:m?.direction==="asc"?"desc":"asc"})}:void 0,children:a||m?.columnAccessor===e?(0,L.jsxs)(S.Group,{position:"apart",noWrap:!0,spacing:"xs",children:[(0,L.jsx)(S.Box,{className:x(l.columnHeaderText,l.sortableColumnHeaderText),children:p}),(0,L.jsx)(S.Center,{children:m?.columnAccessor===e?(0,L.jsx)(Ae,{className:x(l.sortableColumnHeaderIcon,{[l.sortableColumnHeaderIconRotated]:m.direction==="desc"}),size:14}):(0,L.jsx)(Re,{className:l.sortableColumnHeaderNeutralIcon,size:14})})]}):(0,L.jsx)(S.Box,{className:l.columnHeaderText,children:p})})}var I=require("react/jsx-runtime"),Gr=(0,ne.createStyles)(e=>{let r=e.colorScheme==="dark"?.5:.05;return{root:{zIndex:2,position:"sticky",top:0,background:e.colorScheme==="dark"?e.colors.dark[7]:e.white,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:-e.spacing.sm+1,height:e.spacing.sm,borderTop:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,background:`linear-gradient(${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},bottomShadowVisible:{"&::after":{opacity:1}},selectorColumnHeader:{position:"sticky",width:0,left:0,background:"inherit","&::after":{content:'""',position:"absolute",top:0,right:-e.spacing.sm,bottom:0,borderLeft:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,width:e.spacing.sm,background:`linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},selectorColumnHeaderWithRightShadow:{"&::after":{opacity:1}},selectionCheckboxInput:{cursor:"pointer"}}}),lr=(0,fr.forwardRef)(function({sortStatus:r,onSortStatusChange:o,columns:a,selectionVisible:t,selectionChecked:f,selectionIndeterminate:m,onSelectionChange:u,leftShadowVisible:x,bottomShadowVisible:l},p){let{classes:d,cx:i}=Gr();return(0,I.jsx)("thead",{className:i(d.root,{[d.bottomShadowVisible]:l}),ref:p,children:(0,I.jsxs)("tr",{children:[t&&(0,I.jsx)("th",{className:i(d.selectorColumnHeader,{[d.selectorColumnHeaderWithRightShadow]:x}),children:(0,I.jsx)(ne.Checkbox,{classNames:{input:d.selectionCheckboxInput},checked:f,indeterminate:m,disabled:!u,onChange:u})}),a.map(({accessor:h,visibleMediaQuery:C,textAlignment:O,width:T,title:Z,sortable:Se})=>(0,I.jsx)(Pe,{accessor:h,visibleMediaQuery:C,textAlignment:O,width:T,title:Z,sortable:Se,sortStatus:r,onSortStatusChange:o},h))]})})});var G=require("@mantine/core"),sr=require("react/jsx-runtime"),Ur=(0,G.createStyles)(e=>({root:{zIndex:3,position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",background:e.fn.rgba(e.colorScheme==="dark"?e.colors.dark[8]:e.white,.75),opacity:0,transition:"opacity .15s ease"},fetching:{pointerEvents:"all",opacity:1}}));function Me({pt:e,pb:r,fetching:o,loaderBackgroundBlur:a,loaderSize:t,loaderVariant:f}){let{classes:m,cx:u}=Ur();return(0,sr.jsx)(G.Center,{pt:e,pb:r,className:u(m.root,{[m.fetching]:o}),sx:a?{backdropFilter:`blur(${a}px)`}:void 0,children:o&&(0,sr.jsx)(G.Loader,{size:t,variant:f})})}var U=require("@mantine/core");var J=require("react/jsx-runtime"),qr=(0,U.createStyles)(e=>({root:{position:"absolute",top:0,right:0,bottom:0,left:0,flexDirection:"column",pointerEvents:"none",opacity:0,transition:"opacity .15s ease"},active:{opacity:1},icon:{fontSize:0,borderRadius:"50%",padding:e.spacing.xs,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[2],color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[6]}}));function ve({text:e,pt:r,pb:o,active:a}){let{classes:t,cx:f}=qr();return(0,J.jsxs)(U.Center,{pt:r,pb:o,className:f(t.root,{[t.active]:a}),children:[(0,J.jsx)("div",{className:t.icon,children:(0,J.jsx)(Le,{})}),(0,J.jsx)(U.Text,{size:"sm",color:"dimmed",children:e})]})}var ce=require("@mantine/core");var ie=require("@mantine/core");var Zr=require("react/jsx-runtime"),$r=(0,ie.createStyles)({ellipsis:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}});function Fe({visibleMediaQuery:e,record:r,ellipsis:o,textAlignment:a,width:t,accessor:f,render:m}){let{cx:u,classes:x}=$r();return pe(e)?(0,Zr.jsx)(ie.Box,{component:"td",className:u({[x.ellipsis]:o}),sx:{width:t,minWidth:t,maxWidth:t,textAlign:a},children:m?m(r):b(r,f)}):null}var ee=require("react/jsx-runtime"),Kr=(0,ce.createStyles)(e=>{let r=e.colors[e.primaryColor][6],o=e.colorScheme==="dark"?.5:.05;return{withClickHandler:{cursor:"pointer"},selectorCell:{position:"sticky",left:0,background:"inherit","&::after":{content:'""',position:"absolute",top:0,right:-e.spacing.sm,bottom:0,borderLeft:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,width:e.spacing.sm,background:`linear-gradient(to right, ${e.fn.rgba(e.black,o)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,o)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},selectorCellWithRightShadow:{"&::after":{opacity:1}},selectorCheckboxInput:{cursor:"pointer"},selected:{"&&":{"tr&":{background:e.colorScheme==="dark"?e.fn.darken(r,.6):e.fn.lighten(r,.9)},"table[data-striped] tbody &:nth-of-type(odd)":{background:e.colorScheme==="dark"?e.fn.darken(r,.55):e.fn.lighten(r,.85)}}},contextMenuVisible:{"&&":{"tr&":{background:e.colorScheme==="dark"?e.fn.darken(r,.5):e.fn.lighten(r,.7)},"table[data-striped] tbody &:nth-of-type(odd)":{background:e.colorScheme==="dark"?e.fn.darken(r,.45):e.fn.lighten(r,.65)}}}}});function He({record:e,columns:r,selectionVisible:o,selectionChecked:a,onSelectionChange:t,onClick:f,onContextMenu:m,contextMenuVisible:u,leftShadowVisible:x}){let{cx:l,classes:p}=Kr();return(0,ee.jsxs)("tr",{className:l({[p.withClickHandler]:f,[p.selected]:a,[p.contextMenuVisible]:u}),onClick:f,onContextMenu:m,children:[o&&(0,ee.jsx)("td",{className:l(p.selectorCell,{[p.selectorCellWithRightShadow]:x}),children:(0,ee.jsx)(ce.Checkbox,{classNames:{input:p.selectorCheckboxInput},checked:a,disabled:!t,onChange:t,onClick:d=>d.stopPropagation()})}),r.map(({accessor:d,visibleMediaQuery:i,textAlignment:h,ellipsis:C,width:O,render:T})=>(0,ee.jsx)(Fe,{visibleMediaQuery:i,record:e,accessor:d,textAlignment:h,ellipsis:C,width:O,render:T},d))]})}var q=require("@mantine/core"),w=require("@mantine/hooks"),_r=require("react/jsx-runtime"),Xr=(0,q.createStyles)(e=>({root:{position:"fixed",border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,overflow:"hidden",transition:"all .15s ease"}}));function Ne({borderRadius:e="xs",shadow:r="sm",zIndex:o=3,top:a,left:t,onDestroy:f,children:m}){(0,w.useWindowEvent)("resize",f),(0,w.useWindowEvent)("scroll",f);let u=(0,w.useClickOutside)(f),{ref:x,width:l,height:p}=(0,w.useElementSize)(),d=(0,w.useMergedRef)(u,x),{spacing:{xs:i}}=(0,q.useMantineTheme)(),{innerWidth:h,innerHeight:C}=window,O=a+p+i>C?C-p-i:a,T=t+l+i>h?h-l-i:t,{classes:Z}=Xr();return(0,_r.jsx)(q.Paper,{ref:d,shadow:r,radius:e,className:Z.root,sx:{top:O,left:T,zIndex:o},children:m})}var dr=require("@mantine/core"),jr=require("react/jsx-runtime"),Qr=(0,dr.createStyles)(e=>({root:{height:1,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}}));function Ee(){let{classes:e}=Qr();return(0,jr.jsx)("div",{className:e.root})}var P=require("@mantine/core"),ge=require("react/jsx-runtime"),Yr=(0,P.createStyles)((e,{color:r})=>{let o=e.spacing.sm/2;return{root:{width:"100%",display:"flex",alignItems:"center",paddingTop:o,paddingBottom:o,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,color:r&&e.colors[r][6],transition:"background .15s ease","&[disabled]":{cursor:"not-allowed",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:hover:not([disabled])":{background:e.fn.rgba(r?e.colors[r][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],r?e.colorScheme==="dark"?.15:.08:.25)},"&:active:not([disabled])":{background:e.fn.rgba(r?e.colors[r][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],r?e.colorScheme==="dark"?.3:.2:.5)}},icon:{fontSize:0,marginRight:e.spacing.xs},title:{whiteSpace:"nowrap"}}});function ze({icon:e,title:r,color:o,disabled:a,onClick:t}){let{classes:f}=Yr({color:o});return(0,ge.jsxs)(P.UnstyledButton,{className:f.root,disabled:a,onClick:t,children:[e&&(0,ge.jsx)(P.Box,{className:f.icon,children:e}),(0,ge.jsx)(P.Text,{className:f.title,size:"sm",children:r})]})}var be=require("@mantine/core"),ur=require("react"),re=require("react/jsx-runtime"),Jr=(0,be.createStyles)(e=>{let r=e.colorScheme==="dark"?.5:.05;return{root:{flex:"1 1 100%"},scrollbar:{'&[data-state="visible"]':{background:"transparent"},"div::before":{pointerEvents:"none"}},corner:{background:"transparent"},thumb:{zIndex:3},shadow:{position:"absolute",pointerEvents:"none",opacity:0,transition:"opacity .15s ease"},leftShadow:{top:0,left:0,bottom:0,width:e.spacing.sm,zIndex:3,background:`linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`},rightShadow:{top:0,bottom:0,right:0,width:e.spacing.sm,zIndex:2,background:`linear-gradient(to left, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to left, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`},bottomShadow:{left:0,right:0,bottom:0,height:e.spacing.sm,background:`linear-gradient(${e.fn.rgba(e.black,0)}, ${e.fn.rgba(e.black,r)}), linear-gradient(${e.fn.rgba(e.black,0)} 30%, ${e.fn.rgba(e.black,r)})`},shadowVisible:{opacity:1}}}),pr=(0,ur.forwardRef)(function({leftShadowVisible:r,rightShadowVisible:o,bottomShadowVisible:a,headerHeight:t,onScrollPositionChange:f,children:m},u){let{cx:x,classes:l}=Jr();return(0,re.jsxs)(be.ScrollArea,{viewportRef:u,classNames:{root:l.root,scrollbar:l.scrollbar,thumb:l.thumb,corner:l.corner},styles:{scrollbar:{marginTop:t}},onScrollPositionChange:f,children:[m,(0,re.jsx)("div",{className:x(l.shadow,l.leftShadow,{[l.shadowVisible]:r})}),(0,re.jsx)("div",{className:x(l.shadow,l.rightShadow,{[l.shadowVisible]:o})}),(0,re.jsx)("div",{className:x(l.shadow,l.bottomShadow,{[l.shadowVisible]:a})})]})});var g=require("react/jsx-runtime"),he=200,Ce={leading:!0},eo=(0,$.createStyles)(e=>{let r=`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`;return{root:{position:"relative",display:"flex",flexDirection:"column",overflow:"hidden",tr:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white}},browserSelectionDisabled:{userSelect:"none"},tableWithBorder:{border:r},tableWithColumnBorders:{"th, td":{":not(:first-of-type)":{borderLeft:r}}},verticalAlignmentTop:{td:{verticalAlign:"top"}},verticalAlignmentBottom:{td:{verticalAlign:"bottom"}}}});function Ve({withBorder:e,borderRadius:r,withColumnBorders:o,height:a="100%",minHeight:t,shadow:f,verticalAlignment:m="center",fetching:u,columns:x,idAccessor:l="id",records:p,selectedRecords:d,onSelectedRecordsChange:i,sortStatus:h,onSortStatusChange:C,horizontalSpacing:O,page:T,onPageChange:Z,totalRecords:Se,recordsPerPage:mr,paginationSize:xr="sm",loaderSize:nr,loaderVariant:ir,loaderBackgroundBlur:cr,noRecordsText:gr="No records",striped:br,onRowClick:oe,rowContextMenu:y,...hr}){let{ref:K,width:Be,height:we}=(0,B.useElementSize)(),{ref:Cr,height:Oe}=(0,B.useElementSize)(),{ref:Sr,width:Te,height:ye}=(0,B.useElementSize)(),{ref:Br,height:We}=(0,B.useElementSize)(),[wr,Ie]=(0,B.useDebouncedState)(!0,he,Ce),[Or,Ge]=(0,B.useDebouncedState)(!0,he,Ce),[Ue,qe]=(0,B.useDebouncedState)(!0,he,Ce),[Tr,$e]=(0,B.useDebouncedState)(!0,he,Ce),[F,H]=(0,v.useState)(null);(0,v.useEffect)(()=>{u&&H(null)},[u]);let Ze=()=>{if(u||H(null),u||ye<=we)Ie(!0),Ge(!0);else{let s=K.current.scrollTop;Ie(s===0),Ge(Math.round(ye-s)===Math.round(we))}if(u||Te===Be)qe(!0),$e(!0);else{let s=K.current.scrollLeft;qe(s===0),$e(Math.round(Te-s)===Math.round(Be))}};(0,v.useEffect)(Ze,[u,we,K,Be,ye,Te]);let yr=s=>{K.current.scrollTo({top:0,left:0}),Z(s)},ae=p?.length,X=p?.map(s=>b(s,l)),_=d?.map(s=>b(s,l)),Ke=X!==void 0&&_!==void 0&&_.length>0,ke=Ke&&X.every(s=>_.includes(s)),kr=Ke&&X.some(s=>_.includes(s)),[te,Xe]=(0,v.useState)(null),Dr=X?.join(":")||"";(0,v.useEffect)(()=>{Xe(null)},[Dr]);let _e=!!d&&!Ue,{cx:Qe,classes:N}=eo();return(0,g.jsxs)($.Box,{className:Qe(N.root,{[N.tableWithBorder]:e}),sx:s=>({borderRadius:s.radius[r]||r,boxShadow:s.shadows[f]||f,height:a,minHeight:t}),children:[(0,g.jsx)(pr,{ref:K,leftShadowVisible:!(d||Ue),rightShadowVisible:!Tr,bottomShadowVisible:!Or,headerHeight:Oe,onScrollPositionChange:Ze,children:(0,g.jsxs)($.Table,{ref:Sr,horizontalSpacing:O,className:Qe({[N.browserSelectionDisabled]:oe||d,[N.tableWithColumnBorders]:o,[N.verticalAlignmentTop]:m==="top",[N.verticalAlignmentBottom]:m==="bottom"}),striped:ae?br:!1,...hr,children:[(0,g.jsx)(lr,{ref:Cr,columns:x,sortStatus:h,onSortStatusChange:C,selectionVisible:!!d,selectionChecked:ke,selectionIndeterminate:kr&&!ke,onSelectionChange:i?()=>{i(ke?d.filter(s=>!X.includes(b(s,l))):xe([...d,...p],s=>b(s,l)))}:void 0,leftShadowVisible:_e,bottomShadowVisible:!wr}),(0,g.jsx)("tbody",{children:ae?p.map((s,k)=>{let E=b(s,l),Q=_?.includes(E)||!1,fe=!1,le=!1;if(y){let{hidden:c}=y;(!c||!(typeof c=="function"?c(s):c))&&(y.trigger==="click"?fe=!0:le=!0)}return(0,g.jsx)(He,{record:s,columns:x,selectionVisible:!!d,selectionChecked:Q,onSelectionChange:i?c=>{if(c.nativeEvent.shiftKey&&te!==null){let D=p.filter(k>te?(j,Y)=>Y>=te&&Y<=k:(j,Y)=>Y>=k&&Y<=te);i(Q?tr(d,D,j=>b(j,l)):xe([...d,...D],j=>b(j,l)))}else i(Q?d.filter(D=>b(D,l)!==E):xe([...d,s],D=>b(D,l)));Xe(k)}:void 0,onClick:fe?c=>{H({top:c.clientY,left:c.clientX,record:s}),oe?.(s)}:oe?()=>{oe(s)}:void 0,onContextMenu:le?c=>{c.preventDefault(),H({top:c.clientY,left:c.clientX,record:s})}:void 0,contextMenuVisible:F?b(F.record,l)===E:!1,leftShadowVisible:_e},E)}):(0,g.jsx)(De,{})})]})}),T&&(0,g.jsx)(rr,{ref:Br,horizontalSpacing:O,fetching:u,page:T,onPageChange:yr,totalRecords:Se,recordsPerPage:mr,paginationSize:xr,recordsLength:ae}),(0,g.jsx)(Me,{pt:Oe,pb:We,fetching:u,loaderBackgroundBlur:cr,loaderSize:nr,loaderVariant:ir}),(0,g.jsx)(ve,{pt:Oe,pb:We,text:gr,active:!u&&!ae}),y&&F&&(0,g.jsx)(Ne,{zIndex:y.zIndex,borderRadius:y.borderRadius,shadow:y.shadow,top:F.top,left:F.left,onDestroy:()=>H(null),children:y.items(F.record).map(({divider:s,key:k,title:E,icon:Q,color:fe,hidden:le,disabled:c,onClick:D})=>s?(0,g.jsx)(Ee,{},k):le?null:(0,g.jsx)(ze,{title:E??me(k),icon:Q,color:fe,disabled:c,onClick:()=>{H(null),D()}},k))})]})}
|
|
1
|
+
"use strict";var Pr=Object.create;var pe=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Fr=Object.getOwnPropertyNames;var Hr=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Er=(e,r)=>{for(var o in r)pe(e,o,{get:r[o],enumerable:!0})},Ye=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Fr(r))!Nr.call(e,t)&&t!==o&&pe(e,t,{get:()=>r[t],enumerable:!(a=vr(r,t))||a.enumerable});return e};var me=(e,r,o)=>(o=e!=null?Pr(Hr(e)):{},Ye(r||!e||!e.__esModule?pe(o,"default",{value:e,enumerable:!0}):o,e)),zr=e=>Ye(pe({},"__esModule",{value:!0}),e);var fo={};Er(fo,{DataTable:()=>Ve});module.exports=zr(fo);var i=me(require("react"),1);var K=require("@mantine/core"),T=require("@mantine/hooks"),H=require("react");var er=require("@mantine/core"),Je=require("react/jsx-runtime"),Vr=(0,er.createStyles)({root:{"&&":{background:"transparent"}}});function De(){let{classes:e}=Vr();return(0,Je.jsx)("tr",{className:e.root,children:(0,Je.jsx)("td",{})})}var R=require("@mantine/core"),rr=require("react"),xe=require("react/jsx-runtime"),Wr=(0,R.createStyles)((e,{topBorderColor:r})=>({root:{borderTop:`1px solid ${typeof r=="function"?r(e):r}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between",gap:e.spacing.xs,[e.fn.largerThan("xs")]:{flexDirection:"row"}},pagination:{opacity:1,transition:"opacity .15s ease"},paginationFetching:{opacity:0}})),or=(0,rr.forwardRef)(function({topBorderColor:r,fetching:o,page:a,onPageChange:t,paginationSize:f,paginationText:p,totalRecords:m,recordsPerPage:x,recordsLength:l,horizontalSpacing:d},c){let u;if(o||!m)u="...";else{let C=(a-1)*x+1,O=C+l-1;u=p({from:C,to:O,totalRecords:m})}let{classes:g,cx:n}=Wr({topBorderColor:r});return(0,xe.jsxs)(R.Box,{ref:c,px:d??"xs",py:"xs",className:g.root,children:[(0,xe.jsx)(R.Text,{size:f,children:u}),(0,xe.jsx)(R.Pagination,{className:n(g.pagination,{[g.paginationFetching]:o||!l}),page:a,onChange:t,size:f,total:Math.ceil(m/x)})]})});var ge=require("@mantine/core"),lr=require("react");var w=require("@mantine/core");function L(){return L=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e},L.apply(this,arguments)}function Ir(e,r){if(e==null)return{};var o={},a=Object.keys(e),t,f;for(f=0;f<a.length;f++)t=a[f],!(r.indexOf(t)>=0)&&(o[t]=e[t]);return o}function W(e,r){if(e==null)return{};var o=Ir(e,r),a,t;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(t=0;t<f.length;t++)a=f[t],!(r.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,a)||(o[a]=e[a]))}return o}var I=me(require("react")),Gr=["size","color"];function Ae(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=W(e,Gr);return I.default.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-arrow-down",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),I.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),I.default.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),I.default.createElement("line",{x1:"18",y1:"13",x2:"12",y2:"19"}),I.default.createElement("line",{x1:"6",y1:"13",x2:"12",y2:"19"}))}var G=me(require("react")),Ur=["size","color"];function Re(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=W(e,Ur);return G.default.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-arrows-vertical",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),G.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),G.default.createElement("polyline",{points:"8 7 12 3 16 7"}),G.default.createElement("polyline",{points:"8 17 12 21 16 17"}),G.default.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"21"}))}var F=me(require("react")),qr=["size","color"];function Le(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=W(e,qr);return F.default.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-database-off",width:o,height:o,viewBox:"0 0 24 24",stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f),F.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F.default.createElement("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),F.default.createElement("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),F.default.createElement("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),F.default.createElement("line",{x1:"3",y1:"3",x2:"21",y2:"21"}))}var ar=require("@mantine/core"),tr=require("@mantine/hooks");function ne(e){let r=(0,ar.useMantineTheme)(),o=typeof e=="function"?e(r):e;return(0,tr.useMediaQuery)(o||"",!0)}function ie(e){let r=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${r.charAt(0).toUpperCase()}${r.slice(1)}`}function fr(e,r,o){if(typeof o=="string"){let a=o;o=t=>t[a]}return e.filter(a=>!r.map(o).includes(o(a)))}function ce(e,r){if(typeof r=="string"){let o=r;r=a=>a[o]}return e.filter((o,a,t)=>a===t.findIndex(f=>r(o)===r(f)))}function B(e,r){return r?r.match(/([^[.\]])+/g).reduce((a,t)=>a&&a[t],e):void 0}var M=require("react/jsx-runtime"),$r=(0,w.createStyles)(e=>({sortableColumnHeader:{cursor:"pointer",transition:"background .15s ease","&:hover":{background:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}},columnHeaderText:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},sortableColumnHeaderText:{minWidth:0,flexGrow:1},sortableColumnHeaderIcon:{transition:"transform .15s ease"},sortableColumnHeaderIconRotated:{transform:"rotate3d(0, 0, 1, 180deg)"},sortableColumnHeaderNeutralIcon:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],transition:"color .15s ease","th:hover &":{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]}}}));function Me({accessor:e,visibleMediaQuery:r,title:o,sortable:a,textAlignment:t,width:f,sortStatus:p,onSortStatusChange:m}){let{cx:x,classes:l}=$r();if(!ne(r))return null;let d=o??ie(e);return(0,M.jsx)(w.Box,{component:"th",className:x({[l.sortableColumnHeader]:a}),sx:{"&&":{textAlign:t},width:f,minWidth:f,maxWidth:f},role:a?"button":void 0,onClick:a&&m?()=>{m({columnAccessor:e,direction:p?.direction==="asc"?"desc":"asc"})}:void 0,children:a||p?.columnAccessor===e?(0,M.jsxs)(w.Group,{position:"apart",noWrap:!0,spacing:"xs",children:[(0,M.jsx)(w.Box,{className:x(l.columnHeaderText,l.sortableColumnHeaderText),children:d}),(0,M.jsx)(w.Center,{children:p?.columnAccessor===e?(0,M.jsx)(Ae,{className:x(l.sortableColumnHeaderIcon,{[l.sortableColumnHeaderIconRotated]:p.direction==="desc"}),size:14}):(0,M.jsx)(Re,{className:l.sortableColumnHeaderNeutralIcon,size:14})})]}):(0,M.jsx)(w.Box,{className:l.columnHeaderText,children:d})})}var U=require("react/jsx-runtime"),Zr=(0,ge.createStyles)(e=>{let r=e.colorScheme==="dark"?.5:.05;return{root:{zIndex:2,position:"sticky",top:0,background:e.colorScheme==="dark"?e.colors.dark[7]:e.white,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:-e.spacing.sm+1,height:e.spacing.sm,borderTop:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,background:`linear-gradient(${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},bottomShadowVisible:{"&::after":{opacity:1}},textSelectionDisabled:{userSelect:"none"},selectorColumnHeader:{position:"sticky",width:0,left:0,background:"inherit","&::after":{content:'""',position:"absolute",top:0,right:-e.spacing.sm,bottom:0,borderLeft:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,width:e.spacing.sm,background:`linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},selectorColumnHeaderWithRightShadow:{"&::after":{opacity:1}},selectionCheckboxInput:{cursor:"pointer"}}}),sr=(0,lr.forwardRef)(function({sortStatus:r,onSortStatusChange:o,columns:a,selectionVisible:t,selectionChecked:f,selectionIndeterminate:p,onSelectionChange:m,leftShadowVisible:x,bottomShadowVisible:l},d){let{classes:c,cx:u}=Zr();return(0,U.jsx)("thead",{className:u(c.root,{[c.bottomShadowVisible]:l}),ref:d,children:(0,U.jsxs)("tr",{children:[t&&(0,U.jsx)("th",{className:u(c.selectorColumnHeader,{[c.selectorColumnHeaderWithRightShadow]:x}),children:(0,U.jsx)(ge.Checkbox,{classNames:{input:c.selectionCheckboxInput},checked:f,indeterminate:p,disabled:!m,onChange:m})}),a.map(({accessor:g,visibleMediaQuery:n,textAlignment:C,width:O,title:X,sortable:te})=>(0,U.jsx)(Me,{accessor:g,visibleMediaQuery:n,textAlignment:C,width:O,title:X,sortable:te,sortStatus:r,onSortStatusChange:o},g))]})})});var q=require("@mantine/core"),dr=require("react/jsx-runtime"),Kr=(0,q.createStyles)(e=>({root:{zIndex:3,position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",background:e.fn.rgba(e.colorScheme==="dark"?e.colors.dark[8]:e.white,.75),opacity:0,transition:"opacity .15s ease"},fetching:{pointerEvents:"all",opacity:1}}));function Pe({pt:e,pb:r,fetching:o,loaderBackgroundBlur:a,loaderSize:t,loaderVariant:f}){let{classes:p,cx:m}=Kr();return(0,dr.jsx)(q.Center,{pt:e,pb:r,className:m(p.root,{[p.fetching]:o}),sx:a?{backdropFilter:`blur(${a}px)`}:void 0,children:o&&(0,dr.jsx)(q.Loader,{size:t,variant:f})})}var $=require("@mantine/core");var re=require("react/jsx-runtime"),Xr=(0,$.createStyles)(e=>({root:{position:"absolute",top:0,right:0,bottom:0,left:0,flexDirection:"column",pointerEvents:"none",opacity:0,transition:"opacity .15s ease"},active:{opacity:1},icon:{fontSize:0,borderRadius:"50%",padding:e.spacing.xs,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[2],color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[6]}}));function ve({text:e,pt:r,pb:o,active:a}){let{classes:t,cx:f}=Xr();return(0,re.jsxs)($.Center,{pt:r,pb:o,className:f(t.root,{[t.active]:a}),children:[(0,re.jsx)("div",{className:t.icon,children:(0,re.jsx)(Le,{})}),(0,re.jsx)($.Text,{size:"sm",color:"dimmed",children:e})]})}var he=require("@mantine/core");var be=require("@mantine/core");var Qr=require("react/jsx-runtime"),_r=(0,be.createStyles)({ellipsis:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}});function Fe({visibleMediaQuery:e,record:r,ellipsis:o,textAlignment:a,width:t,accessor:f,render:p}){let{cx:m,classes:x}=_r();return ne(e)?(0,Qr.jsx)(be.Box,{component:"td",className:m({[x.ellipsis]:o}),sx:{width:t,minWidth:t,maxWidth:t,textAlign:a},children:p?p(r):B(r,f)}):null}var oe=require("react/jsx-runtime"),jr=(0,he.createStyles)(e=>{let r=e.colors[e.primaryColor][6],o=e.colorScheme==="dark"?.5:.05;return{withClickHandler:{cursor:"pointer"},selectorCell:{position:"sticky",left:0,background:"inherit","&::after":{content:'""',position:"absolute",top:0,right:-e.spacing.sm,bottom:0,borderLeft:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,width:e.spacing.sm,background:`linear-gradient(to right, ${e.fn.rgba(e.black,o)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,o)}, ${e.fn.rgba(e.black,0)} 30%)`,pointerEvents:"none",opacity:0,transition:"opacity .15s ease"}},selectorCellWithRightShadow:{"&::after":{opacity:1}},selectorCheckboxInput:{cursor:"pointer"},selected:{"&&":{"tr&":{background:e.colorScheme==="dark"?e.fn.darken(r,.6):e.fn.lighten(r,.9)},"table[data-striped] tbody &:nth-of-type(odd)":{background:e.colorScheme==="dark"?e.fn.darken(r,.55):e.fn.lighten(r,.85)}}},contextMenuVisible:{"&&":{"tr&":{background:e.colorScheme==="dark"?e.fn.darken(r,.5):e.fn.lighten(r,.7)},"table[data-striped] tbody &:nth-of-type(odd)":{background:e.colorScheme==="dark"?e.fn.darken(r,.45):e.fn.lighten(r,.65)}}}}});function He({record:e,columns:r,selectionVisible:o,selectionChecked:a,onSelectionChange:t,onClick:f,onContextMenu:p,contextMenuVisible:m,leftShadowVisible:x}){let{cx:l,classes:d}=jr();return(0,oe.jsxs)("tr",{className:l({[d.withClickHandler]:f,[d.selected]:a,[d.contextMenuVisible]:m}),onClick:f,onContextMenu:p,children:[o&&(0,oe.jsx)("td",{className:l(d.selectorCell,{[d.selectorCellWithRightShadow]:x}),children:(0,oe.jsx)(he.Checkbox,{classNames:{input:d.selectorCheckboxInput},checked:a,disabled:!t,onChange:t,onClick:c=>c.stopPropagation()})}),r.map(({accessor:c,visibleMediaQuery:u,textAlignment:g,ellipsis:n,width:C,render:O})=>(0,oe.jsx)(Fe,{visibleMediaQuery:u,record:e,accessor:c,textAlignment:g,ellipsis:n,width:C,render:O},c))]})}var Z=require("@mantine/core"),y=require("@mantine/hooks"),Jr=require("react/jsx-runtime"),Yr=(0,Z.createStyles)(e=>({root:{position:"fixed",border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,overflow:"hidden",transition:"all .15s ease"}}));function Ne({borderRadius:e="xs",shadow:r="sm",zIndex:o=3,top:a,left:t,onDestroy:f,children:p}){(0,y.useWindowEvent)("resize",f),(0,y.useWindowEvent)("scroll",f);let m=(0,y.useClickOutside)(f),{ref:x,width:l,height:d}=(0,y.useElementSize)(),c=(0,y.useMergedRef)(m,x),{spacing:{xs:u}}=(0,Z.useMantineTheme)(),{innerWidth:g,innerHeight:n}=window,C=a+d+u>n?n-d-u:a,O=t+l+u>g?g-l-u:t,{classes:X}=Yr();return(0,Jr.jsx)(Z.Paper,{ref:c,shadow:r,radius:e,className:X.root,sx:{top:C,left:O,zIndex:o},children:p})}var ur=require("@mantine/core"),ro=require("react/jsx-runtime"),eo=(0,ur.createStyles)(e=>({root:{height:1,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}}));function Ee(){let{classes:e}=eo();return(0,ro.jsx)("div",{className:e.root})}var P=require("@mantine/core"),Ce=require("react/jsx-runtime"),oo=(0,P.createStyles)((e,{color:r})=>{let o=e.spacing.sm/2;return{root:{width:"100%",display:"flex",alignItems:"center",paddingTop:o,paddingBottom:o,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,color:r&&e.colors[r][6],transition:"background .15s ease","&[disabled]":{cursor:"not-allowed",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:hover:not([disabled])":{background:e.fn.rgba(r?e.colors[r][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],r?e.colorScheme==="dark"?.15:.08:.25)},"&:active:not([disabled])":{background:e.fn.rgba(r?e.colors[r][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],r?e.colorScheme==="dark"?.3:.2:.5)}},icon:{fontSize:0,marginRight:e.spacing.xs},title:{whiteSpace:"nowrap"}}});function ze({icon:e,title:r,color:o,disabled:a,onClick:t}){let{classes:f}=oo({color:o});return(0,Ce.jsxs)(P.UnstyledButton,{className:f.root,disabled:a,onClick:t,children:[e&&(0,Ce.jsx)(P.Box,{className:f.icon,children:e}),(0,Ce.jsx)(P.Text,{className:f.title,size:"sm",children:r})]})}var Se=require("@mantine/core"),pr=require("react"),ae=require("react/jsx-runtime"),ao=(0,Se.createStyles)(e=>{let r=e.colorScheme==="dark"?.5:.05;return{root:{flex:"1 1 100%"},scrollbar:{'&[data-state="visible"]':{background:"transparent"},"div::before":{pointerEvents:"none"}},corner:{background:"transparent"},thumb:{zIndex:3},shadow:{position:"absolute",pointerEvents:"none",opacity:0,transition:"opacity .15s ease"},leftShadow:{top:0,left:0,bottom:0,width:e.spacing.sm,zIndex:3,background:`linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to right, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`},rightShadow:{top:0,bottom:0,right:0,width:e.spacing.sm,zIndex:2,background:`linear-gradient(to left, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)}), linear-gradient(to left, ${e.fn.rgba(e.black,r)}, ${e.fn.rgba(e.black,0)} 30%)`},bottomShadow:{left:0,right:0,bottom:0,height:e.spacing.sm,background:`linear-gradient(${e.fn.rgba(e.black,0)}, ${e.fn.rgba(e.black,r)}), linear-gradient(${e.fn.rgba(e.black,0)} 30%, ${e.fn.rgba(e.black,r)})`},shadowVisible:{opacity:1}}}),mr=(0,pr.forwardRef)(function({leftShadowVisible:r,rightShadowVisible:o,bottomShadowVisible:a,headerHeight:t,onScrollPositionChange:f,children:p},m){let{cx:x,classes:l}=ao();return(0,ae.jsxs)(Se.ScrollArea,{viewportRef:m,classNames:{root:l.root,scrollbar:l.scrollbar,thumb:l.thumb,corner:l.corner},styles:{scrollbar:{marginTop:t}},onScrollPositionChange:f,children:[p,(0,ae.jsx)("div",{className:x(l.shadow,l.leftShadow,{[l.shadowVisible]:r})}),(0,ae.jsx)("div",{className:x(l.shadow,l.rightShadow,{[l.shadowVisible]:o})}),(0,ae.jsx)("div",{className:x(l.shadow,l.bottomShadow,{[l.shadowVisible]:a})})]})});var S=require("react/jsx-runtime"),Be=200,we={leading:!0},to=(0,K.createStyles)((e,{borderColor:r,rowBorderColor:o})=>{let a=typeof r=="function"?r(e):r,t=typeof o=="function"?o(e):o;return{root:{position:"relative",display:"flex",flexDirection:"column",overflow:"hidden",tr:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white},"&&":{"thead tr th":{borderBottomColor:a},"tbody tr td":{borderBottomColor:t}}},lastRowBorderBottomVisible:{"tbody tr:last-of-type td":{borderBottom:`1px solid ${t}`}},textSelectionDisabled:{userSelect:"none"},tableWithBorder:{border:`1px solid ${a}`},tableWithColumnBorders:{"th, td":{":not(:first-of-type)":{borderLeft:`1px solid ${t}`}}},verticalAlignmentTop:{td:{verticalAlign:"top"}},verticalAlignmentBottom:{td:{verticalAlign:"bottom"}}}});function Ve({withBorder:e,borderRadius:r,borderColor:o=b=>b.colorScheme==="dark"?b.colors.dark[4]:b.colors.gray[3],rowBorderColor:a=b=>b.fn.rgba(b.colorScheme==="dark"?b.colors.dark[4]:b.colors.gray[3],.65),withColumnBorders:t,textSelectionDisabled:f,height:p="100%",minHeight:m,shadow:x,verticalAlignment:l="center",fetching:d,columns:c,idAccessor:u="id",records:g,selectedRecords:n,onSelectedRecordsChange:C,sortStatus:O,onSortStatusChange:X,horizontalSpacing:te,page:We,onPageChange:xr,totalRecords:nr,recordsPerPage:ir,paginationSize:cr="sm",paginationText:gr=({from:b,to:_,totalRecords:N})=>`${b} - ${_} / ${N}`,loaderSize:br,loaderVariant:hr,loaderBackgroundBlur:Cr,noRecordsText:Sr="No records",striped:Br,onRowClick:Te,rowContextMenu:k,...wr}){let{ref:b,width:_,height:N}=(0,T.useElementSize)(),{ref:Tr,height:Oe}=(0,T.useElementSize)(),{ref:Or,width:ye,height:fe}=(0,T.useElementSize)(),{ref:yr,height:Ie}=(0,T.useElementSize)(),[kr,Ge]=(0,T.useDebouncedState)(!0,Be,we),[Dr,Ue]=(0,T.useDebouncedState)(!0,Be,we),[qe,$e]=(0,T.useDebouncedState)(!0,Be,we),[Ar,Ze]=(0,T.useDebouncedState)(!0,Be,we),[E,z]=(0,H.useState)(null);(0,H.useEffect)(()=>{d&&z(null)},[d]);let Ke=()=>{if(d||z(null),d||fe<=N)Ge(!0),Ue(!0);else{let s=b.current.scrollTop;Ge(s===0),Ue(Math.round(fe-s)===Math.round(N))}if(d||ye===_)$e(!0),Ze(!0);else{let s=b.current.scrollLeft;$e(s===0),Ze(Math.round(ye-s)===Math.round(_))}};(0,H.useEffect)(Ke,[d,N,b,_,fe,ye]);let Rr=s=>{b.current.scrollTo({top:0,left:0}),xr(s)},le=g?.length,Q=g?.map(s=>B(s,u)),j=n?.map(s=>B(s,u)),Xe=Q!==void 0&&j!==void 0&&j.length>0,ke=Xe&&Q.every(s=>j.includes(s)),Lr=Xe&&Q.some(s=>j.includes(s)),[se,_e]=(0,H.useState)(null),Mr=Q?.join(":")||"";(0,H.useEffect)(()=>{_e(null)},[Mr]);let Qe=!!n&&!qe,{cx:je,classes:v}=to({borderColor:o,rowBorderColor:a});return(0,S.jsxs)(K.Box,{className:je(v.root,{[v.tableWithBorder]:e}),sx:s=>({borderRadius:s.radius[r]||r,boxShadow:s.shadows[x]||x,height:p,minHeight:m}),children:[(0,S.jsx)(mr,{ref:b,leftShadowVisible:!(n||qe),rightShadowVisible:!Ar,bottomShadowVisible:!Dr,headerHeight:Oe,onScrollPositionChange:Ke,children:(0,S.jsxs)(K.Table,{ref:Or,horizontalSpacing:te,className:je({[v.tableWithColumnBorders]:t,[v.lastRowBorderBottomVisible]:fe<N,[v.textSelectionDisabled]:f,[v.verticalAlignmentTop]:l==="top",[v.verticalAlignmentBottom]:l==="bottom"}),striped:le?Br:!1,...wr,children:[(0,S.jsx)(sr,{ref:Tr,columns:c,sortStatus:O,onSortStatusChange:X,selectionVisible:!!n,selectionChecked:ke,selectionIndeterminate:Lr&&!ke,onSelectionChange:C?()=>{C(ke?n.filter(s=>!Q.includes(B(s,u))):ce([...n,...g],s=>B(s,u)))}:void 0,leftShadowVisible:Qe,bottomShadowVisible:!kr}),(0,S.jsx)("tbody",{children:le?g.map((s,D)=>{let V=B(s,u),Y=j?.includes(V)||!1,de=!1,ue=!1;if(k){let{hidden:h}=k;(!h||!(typeof h=="function"?h(s):h))&&(k.trigger==="click"?de=!0:ue=!0)}return(0,S.jsx)(He,{record:s,columns:c,selectionVisible:!!n,selectionChecked:Y,onSelectionChange:C?h=>{if(h.nativeEvent.shiftKey&&se!==null){let A=g.filter(D>se?(J,ee)=>ee>=se&&ee<=D:(J,ee)=>ee>=D&&ee<=se);C(Y?fr(n,A,J=>B(J,u)):ce([...n,...A],J=>B(J,u)))}else C(Y?n.filter(A=>B(A,u)!==V):ce([...n,s],A=>B(A,u)));_e(D)}:void 0,onClick:de?h=>{z({top:h.clientY,left:h.clientX,record:s}),Te?.(s)}:Te?()=>{Te(s)}:void 0,onContextMenu:ue?h=>{h.preventDefault(),z({top:h.clientY,left:h.clientX,record:s})}:void 0,contextMenuVisible:E?B(E.record,u)===V:!1,leftShadowVisible:Qe},V)}):(0,S.jsx)(De,{})})]})}),We&&(0,S.jsx)(or,{ref:yr,topBorderColor:o,horizontalSpacing:te,fetching:d,page:We,onPageChange:Rr,totalRecords:nr,recordsPerPage:ir,paginationSize:cr,paginationText:gr,recordsLength:le}),(0,S.jsx)(Pe,{pt:Oe,pb:Ie,fetching:d,loaderBackgroundBlur:Cr,loaderSize:br,loaderVariant:hr}),(0,S.jsx)(ve,{pt:Oe,pb:Ie,text:Sr,active:!d&&!le}),k&&E&&(0,S.jsx)(Ne,{zIndex:k.zIndex,borderRadius:k.borderRadius,shadow:k.shadow,top:E.top,left:E.left,onDestroy:()=>z(null),children:k.items(E.record).map(({divider:s,key:D,title:V,icon:Y,color:de,hidden:ue,disabled:h,onClick:A})=>s?(0,S.jsx)(Ee,{},D):ue?null:(0,S.jsx)(ze,{title:V??ie(D),icon:Y,color:de,disabled:h,onClick:()=>{z(null),A()}},D))})]})}
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|