mantine-datatable 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
4
  [![License][license-image]][license-url]
5
- [![Stars][stars-image]][repo-url]
5
+ [![Stars][stars-image]][stars-url]
6
6
  [![Last commit][last-commit-image]][repo-url]
7
+ [![Closed issues][closed-issues-image]][closed-issues-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
  [![Mantine DataTable](https://user-images.githubusercontent.com/581999/187723353-0e082dbc-925b-4d0d-a14e-94c00073ee08.png)](https://icflorescu.github.io/mantine-datatable/)
13
14
 
14
- ## Documentation and examples
15
+ ## Full documentation and examples
15
16
 
16
- See [website](https://icflorescu.github.io/mantine-datatable/).
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
 
@@ -35,10 +95,13 @@ The [MIT License](https://github.com/icflorescu/mantine-datatable/blob/master/LI
35
95
 
36
96
  [npm-url]: https://npmjs.org/package/mantine-datatable
37
97
  [repo-url]: https://github.com/icflorescu/mantine-datatable
98
+ [stars-url]: https://github.com/icflorescu/mantine-datatable/stargazers
99
+ [closed-issues-url]: https://github.com/icflorescu/mantine-datatable/issues?q=is%3Aissue+is%3Aclosed
38
100
  [license-url]: LICENSE
39
101
  [npm-image]: https://img.shields.io/npm/v/mantine-datatable.svg?style=flat-square
40
102
  [license-image]: http://img.shields.io/npm/l/mantine-datatable.svg?style=flat-square
41
103
  [downloads-image]: http://img.shields.io/npm/dm/mantine-datatable.svg?style=flat-square
42
104
  [stars-image]: https://img.shields.io/github/stars/icflorescu/mantine-datatable?style=flat-square
43
105
  [last-commit-image]: https://img.shields.io/github/last-commit/icflorescu/mantine-datatable?style=flat-square
106
+ [closed-issues-image]: https://img.shields.io/github/issues-closed-raw/icflorescu/mantine-datatable?style=flat-square
44
107
  [language-image]: https://img.shields.io/github/languages/top/icflorescu/mantine-datatable?style=flat-square
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { DataTableProps } from './DataTable.props';
3
- export default function DataTable<T extends Record<string, unknown>>({ withBorder, borderRadius, withColumnBorders, textSelectionDisabled, 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;
4
4
  //# sourceMappingURL=DataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../DataTable.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAsDnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnE,UAAU,EACV,YAAY,EACZ,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,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,aAA4B,EAC5B,OAAO,EACP,UAAU,EACV,cAAc,EACd,GAAG,UAAU,EACd,EAAE,cAAc,CAAC,CAAC,CAAC,eAsSnB"}
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 DataTableBorderProps = {
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?: MantineNumberSize;
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,17 @@ 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);
182
203
  /**
183
204
  * If true, the user will not be able to select text
184
205
  */
@@ -255,5 +276,5 @@ export declare type DataTableProps<T> = {
255
276
  */
256
277
  items: (record: T) => DataTableContextMenuItemProps[];
257
278
  };
258
- } & Omit<TableProps, 'border'> & DataTableBorderProps & DataTablePaginationProps & DataTableSortProps & DataTableSelectionProps<T>;
279
+ } & Omit<TableProps, 'border'> & DataTableOuterBorderProps & DataTablePaginationProps & DataTableSortProps & DataTableSelectionProps<T>;
259
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;AACzG,OAAO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,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,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;AACvF,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAqB7D,aAAK,oBAAoB,GAAG,wBAAwB,GAAG;IACrD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAClD,CAAC;gCAuCY,oBAAoB,GAAG;IAAE,GAAG,EAAE,aAAa,cAAc,CAAC,CAAA;CAAE,KAAK,WAAW;AArC1F,wBAqC2F"}
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"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Rr=Object.create;var le=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var Fr=(e,r)=>{for(var o in r)le(e,o,{get:r[o],enumerable:!0})},je=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Pr(r))!vr.call(e,t)&&t!==o&&le(e,t,{get:()=>r[t],enumerable:!(a=Lr(r,t))||a.enumerable});return e};var se=(e,r,o)=>(o=e!=null?Rr(Mr(e)):{},je(r||!e||!e.__esModule?le(o,"default",{value:e,enumerable:!0}):o,e)),Hr=e=>je(le({},"__esModule",{value:!0}),e);var oo={};Fr(oo,{DataTable:()=>Ve});module.exports=Hr(oo);var i=se(require("react"),1);var Z=require("@mantine/core"),B=require("@mantine/hooks"),v=require("react");var Je=require("@mantine/core"),Ye=require("react/jsx-runtime"),Nr=(0,Je.createStyles)({root:{"&&":{background:"transparent"}}});function De(){let{classes:e}=Nr();return(0,Ye.jsx)("tr",{className:e.root,children:(0,Ye.jsx)("td",{})})}var D=require("@mantine/core"),er=require("react"),de=require("react/jsx-runtime"),Er=(0,D.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:p,recordsLength:n,horizontalSpacing:u},l){let d;if(r)d="...";else{let c=(o-1)*p+1,C=c+n-1;d=`${c} - ${C}`,f&&(d+=` / ${f}`)}let{classes:x,cx:m}=Er();return(0,de.jsxs)(D.Box,{ref:l,px:u??"xs",py:"xs",className:x.root,children:[(0,de.jsx)(D.Text,{size:t,children:d}),(0,de.jsx)(D.Pagination,{className:m(x.pagination,{[x.paginationFetching]:r||!n}),page:o,onChange:a,size:t,total:Math.ceil(f/p)})]})});var xe=require("@mantine/core"),fr=require("react");var S=require("@mantine/core");function A(){return A=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},A.apply(this,arguments)}function zr(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 V(e,r){if(e==null)return{};var o=zr(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 W=se(require("react")),Vr=["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=V(e,Vr);return W.default.createElement("svg",A({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),W.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),W.default.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),W.default.createElement("line",{x1:"18",y1:"13",x2:"12",y2:"19"}),W.default.createElement("line",{x1:"6",y1:"13",x2:"12",y2:"19"}))}var I=se(require("react")),Wr=["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=V(e,Wr);return I.default.createElement("svg",A({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),I.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),I.default.createElement("polyline",{points:"8 7 12 3 16 7"}),I.default.createElement("polyline",{points:"8 17 12 21 16 17"}),I.default.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"21"}))}var M=se(require("react")),Ir=["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=V(e,Ir);return M.default.createElement("svg",A({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 ue(e){let r=(0,or.useMantineTheme)(),o=typeof e=="function"?e(r):e;return(0,ar.useMediaQuery)(o||"",!0)}function pe(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 me(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 h(e,r){return r?r.match(/([^[.\]])+/g).reduce((a,t)=>a&&a[t],e):void 0}var R=require("react/jsx-runtime"),Gr=(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"},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:p,onSortStatusChange:n}){let{cx:u,classes:l}=Gr();if(!ue(r))return null;let d=o??pe(e);return(0,R.jsx)(S.Box,{component:"th",className:u({[l.sortableColumnHeader]:a}),sx:{"&&":{textAlign:t},width:f,minWidth:f,maxWidth:f},role:a?"button":void 0,onClick:a&&n?()=>{n({columnAccessor:e,direction:p?.direction==="asc"?"desc":"asc"})}:void 0,children:a||p?.columnAccessor===e?(0,R.jsxs)(S.Group,{position:"apart",noWrap:!0,spacing:"xs",children:[(0,R.jsx)(S.Box,{className:u(l.columnHeaderText,l.sortableColumnHeaderText),children:d}),(0,R.jsx)(S.Center,{children:p?.columnAccessor===e?(0,R.jsx)(Ae,{className:u(l.sortableColumnHeaderIcon,{[l.sortableColumnHeaderIconRotated]:p.direction==="desc"}),size:14}):(0,R.jsx)(Re,{className:l.sortableColumnHeaderNeutralIcon,size:14})})]}):(0,R.jsx)(S.Box,{className:l.columnHeaderText,children:d})})}var G=require("react/jsx-runtime"),Ur=(0,xe.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"}}}),lr=(0,fr.forwardRef)(function({sortStatus:r,onSortStatusChange:o,columns:a,selectionVisible:t,selectionChecked:f,selectionIndeterminate:p,onSelectionChange:n,leftShadowVisible:u,bottomShadowVisible:l},d){let{classes:x,cx:m}=Ur();return(0,G.jsx)("thead",{className:m(x.root,{[x.bottomShadowVisible]:l}),ref:d,children:(0,G.jsxs)("tr",{children:[t&&(0,G.jsx)("th",{className:m(x.selectorColumnHeader,{[x.selectorColumnHeaderWithRightShadow]:u}),children:(0,G.jsx)(xe.Checkbox,{classNames:{input:x.selectionCheckboxInput},checked:f,indeterminate:p,disabled:!n,onChange:n})}),a.map(({accessor:c,visibleMediaQuery:C,textAlignment:P,width:O,title:F,sortable:Ce})=>(0,G.jsx)(Pe,{accessor:c,visibleMediaQuery:C,textAlignment:P,width:O,title:F,sortable:Ce,sortStatus:r,onSortStatusChange:o},c))]})})});var U=require("@mantine/core"),sr=require("react/jsx-runtime"),qr=(0,U.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:p,cx:n}=qr();return(0,sr.jsx)(U.Center,{pt:e,pb:r,className:n(p.root,{[p.fetching]:o}),sx:a?{backdropFilter:`blur(${a}px)`}:void 0,children:o&&(0,sr.jsx)(U.Loader,{size:t,variant:f})})}var q=require("@mantine/core");var J=require("react/jsx-runtime"),$r=(0,q.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}=$r();return(0,J.jsxs)(q.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)(q.Text,{size:"sm",color:"dimmed",children:e})]})}var ie=require("@mantine/core");var ne=require("@mantine/core");var Kr=require("react/jsx-runtime"),Zr=(0,ne.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:n,classes:u}=Zr();return ue(e)?(0,Kr.jsx)(ne.Box,{component:"td",className:n({[u.ellipsis]:o}),sx:{width:t,minWidth:t,maxWidth:t,textAlign:a},children:p?p(r):h(r,f)}):null}var ee=require("react/jsx-runtime"),Xr=(0,ie.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:n,leftShadowVisible:u}){let{cx:l,classes:d}=Xr();return(0,ee.jsxs)("tr",{className:l({[d.withClickHandler]:f,[d.selected]:a,[d.contextMenuVisible]:n}),onClick:f,onContextMenu:p,children:[o&&(0,ee.jsx)("td",{className:l(d.selectorCell,{[d.selectorCellWithRightShadow]:u}),children:(0,ee.jsx)(ie.Checkbox,{classNames:{input:d.selectorCheckboxInput},checked:a,disabled:!t,onChange:t,onClick:x=>x.stopPropagation()})}),r.map(({accessor:x,visibleMediaQuery:m,textAlignment:c,ellipsis:C,width:P,render:O})=>(0,ee.jsx)(Fe,{visibleMediaQuery:m,record:e,accessor:x,textAlignment:c,ellipsis:C,width:P,render:O},x))]})}var $=require("@mantine/core"),w=require("@mantine/hooks"),Qr=require("react/jsx-runtime"),_r=(0,$.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,w.useWindowEvent)("resize",f),(0,w.useWindowEvent)("scroll",f);let n=(0,w.useClickOutside)(f),{ref:u,width:l,height:d}=(0,w.useElementSize)(),x=(0,w.useMergedRef)(n,u),{spacing:{xs:m}}=(0,$.useMantineTheme)(),{innerWidth:c,innerHeight:C}=window,P=a+d+m>C?C-d-m:a,O=t+l+m>c?c-l-m:t,{classes:F}=_r();return(0,Qr.jsx)($.Paper,{ref:x,shadow:r,radius:e,className:F.root,sx:{top:P,left:O,zIndex:o},children:p})}var dr=require("@mantine/core"),Yr=require("react/jsx-runtime"),jr=(0,dr.createStyles)(e=>({root:{height:1,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}}));function Ee(){let{classes:e}=jr();return(0,Yr.jsx)("div",{className:e.root})}var L=require("@mantine/core"),ce=require("react/jsx-runtime"),Jr=(0,L.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}=Jr({color:o});return(0,ce.jsxs)(L.UnstyledButton,{className:f.root,disabled:a,onClick:t,children:[e&&(0,ce.jsx)(L.Box,{className:f.icon,children:e}),(0,ce.jsx)(L.Text,{className:f.title,size:"sm",children:r})]})}var ge=require("@mantine/core"),ur=require("react"),re=require("react/jsx-runtime"),eo=(0,ge.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:p},n){let{cx:u,classes:l}=eo();return(0,re.jsxs)(ge.ScrollArea,{viewportRef:n,classNames:{root:l.root,scrollbar:l.scrollbar,thumb:l.thumb,corner:l.corner},styles:{scrollbar:{marginTop:t}},onScrollPositionChange:f,children:[p,(0,re.jsx)("div",{className:u(l.shadow,l.leftShadow,{[l.shadowVisible]:r})}),(0,re.jsx)("div",{className:u(l.shadow,l.rightShadow,{[l.shadowVisible]:o})}),(0,re.jsx)("div",{className:u(l.shadow,l.bottomShadow,{[l.shadowVisible]:a})})]})});var b=require("react/jsx-runtime"),be=200,he={leading:!0},ro=(0,Z.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}},textSelectionDisabled:{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,textSelectionDisabled:a,height:t="100%",minHeight:f,shadow:p,verticalAlignment:n="center",fetching:u,columns:l,idAccessor:d="id",records:x,selectedRecords:m,onSelectedRecordsChange:c,sortStatus:C,onSortStatusChange:P,horizontalSpacing:O,page:F,onPageChange:Ce,totalRecords:mr,recordsPerPage:xr,paginationSize:nr="sm",loaderSize:ir,loaderVariant:cr,loaderBackgroundBlur:gr,noRecordsText:br="No records",striped:hr,onRowClick:Se,rowContextMenu:T,...Cr}){let{ref:K,width:Be,height:we}=(0,B.useElementSize)(),{ref:Sr,height:Oe}=(0,B.useElementSize)(),{ref:Br,width:Te,height:ye}=(0,B.useElementSize)(),{ref:wr,height:We}=(0,B.useElementSize)(),[Or,Ie]=(0,B.useDebouncedState)(!0,be,he),[Tr,Ge]=(0,B.useDebouncedState)(!0,be,he),[Ue,qe]=(0,B.useDebouncedState)(!0,be,he),[yr,$e]=(0,B.useDebouncedState)(!0,be,he),[H,N]=(0,v.useState)(null);(0,v.useEffect)(()=>{u&&N(null)},[u]);let Ze=()=>{if(u||N(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 kr=s=>{K.current.scrollTo({top:0,left:0}),Ce(s)},oe=x?.length,X=x?.map(s=>h(s,d)),_=m?.map(s=>h(s,d)),Ke=X!==void 0&&_!==void 0&&_.length>0,ke=Ke&&X.every(s=>_.includes(s)),Dr=Ke&&X.some(s=>_.includes(s)),[ae,Xe]=(0,v.useState)(null),Ar=X?.join(":")||"";(0,v.useEffect)(()=>{Xe(null)},[Ar]);let _e=!!m&&!Ue,{cx:Qe,classes:E}=ro();return(0,b.jsxs)(Z.Box,{className:Qe(E.root,{[E.tableWithBorder]:e}),sx:s=>({borderRadius:s.radius[r]||r,boxShadow:s.shadows[p]||p,height:t,minHeight:f}),children:[(0,b.jsx)(pr,{ref:K,leftShadowVisible:!(m||Ue),rightShadowVisible:!yr,bottomShadowVisible:!Tr,headerHeight:Oe,onScrollPositionChange:Ze,children:(0,b.jsxs)(Z.Table,{ref:Br,horizontalSpacing:O,className:Qe({[E.tableWithColumnBorders]:o,[E.textSelectionDisabled]:a,[E.verticalAlignmentTop]:n==="top",[E.verticalAlignmentBottom]:n==="bottom"}),striped:oe?hr:!1,...Cr,children:[(0,b.jsx)(lr,{ref:Sr,columns:l,sortStatus:C,onSortStatusChange:P,selectionVisible:!!m,selectionChecked:ke,selectionIndeterminate:Dr&&!ke,onSelectionChange:c?()=>{c(ke?m.filter(s=>!X.includes(h(s,d))):me([...m,...x],s=>h(s,d)))}:void 0,leftShadowVisible:_e,bottomShadowVisible:!Or}),(0,b.jsx)("tbody",{children:oe?x.map((s,y)=>{let z=h(s,d),Q=_?.includes(z)||!1,te=!1,fe=!1;if(T){let{hidden:g}=T;(!g||!(typeof g=="function"?g(s):g))&&(T.trigger==="click"?te=!0:fe=!0)}return(0,b.jsx)(He,{record:s,columns:l,selectionVisible:!!m,selectionChecked:Q,onSelectionChange:c?g=>{if(g.nativeEvent.shiftKey&&ae!==null){let k=x.filter(y>ae?(j,Y)=>Y>=ae&&Y<=y:(j,Y)=>Y>=y&&Y<=ae);c(Q?tr(m,k,j=>h(j,d)):me([...m,...k],j=>h(j,d)))}else c(Q?m.filter(k=>h(k,d)!==z):me([...m,s],k=>h(k,d)));Xe(y)}:void 0,onClick:te?g=>{N({top:g.clientY,left:g.clientX,record:s}),Se?.(s)}:Se?()=>{Se(s)}:void 0,onContextMenu:fe?g=>{g.preventDefault(),N({top:g.clientY,left:g.clientX,record:s})}:void 0,contextMenuVisible:H?h(H.record,d)===z:!1,leftShadowVisible:_e},z)}):(0,b.jsx)(De,{})})]})}),F&&(0,b.jsx)(rr,{ref:wr,horizontalSpacing:O,fetching:u,page:F,onPageChange:kr,totalRecords:mr,recordsPerPage:xr,paginationSize:nr,recordsLength:oe}),(0,b.jsx)(Me,{pt:Oe,pb:We,fetching:u,loaderBackgroundBlur:gr,loaderSize:ir,loaderVariant:cr}),(0,b.jsx)(ve,{pt:Oe,pb:We,text:br,active:!u&&!oe}),T&&H&&(0,b.jsx)(Ne,{zIndex:T.zIndex,borderRadius:T.borderRadius,shadow:T.shadow,top:H.top,left:H.left,onDestroy:()=>N(null),children:T.items(H.record).map(({divider:s,key:y,title:z,icon:Q,color:te,hidden:fe,disabled:g,onClick:k})=>s?(0,b.jsx)(Ee,{},y):fe?null:(0,b.jsx)(ze,{title:z??pe(y),icon:Q,color:te,disabled:g,onClick:()=>{N(null),k()}},y))})]})}
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