mantine-datatable 1.0.0 → 1.0.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.
@@ -1,3 +1,3 @@
1
1
  import { DataTableProps } from './DataTable.props';
2
- export default function DataTable<T extends Record<string, unknown>>({ withBorder, borderRadius, withColumnBorders, height, minHeight, 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;
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
3
  //# sourceMappingURL=DataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../DataTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgDnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnE,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,MAAe,EACf,SAAS,EACT,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,eAqPnB"}
1
+ {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../DataTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgDnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnE,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,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,eAwQnB"}
@@ -1,4 +1,4 @@
1
- import { MantineColor, MantineSize, MantineTheme, TableProps } from '@mantine/core';
1
+ import { MantineColor, MantineNumberSize, MantineShadow, 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';
@@ -13,7 +13,7 @@ export declare type DataTableBorderProps = {
13
13
  /**
14
14
  * Table border radius
15
15
  */
16
- borderRadius?: MantineSize | number;
16
+ borderRadius?: MantineNumberSize;
17
17
  };
18
18
  export declare type DataTablePaginationProps = {
19
19
  page?: never;
@@ -41,7 +41,7 @@ export declare type DataTablePaginationProps = {
41
41
  /**
42
42
  * Pagination component size; defaults to `sm`
43
43
  */
44
- paginationSize?: MantineSize;
44
+ paginationSize?: MantineNumberSize;
45
45
  };
46
46
  export declare type DataTableColumn<T> = {
47
47
  /**
@@ -116,6 +116,36 @@ export declare type DataTableSelectionProps<T> = {
116
116
  */
117
117
  onSelectedRecordsChange?: (selectedRecords: T[]) => void;
118
118
  };
119
+ export declare type DataTableContextMenuItemProps = {
120
+ /**
121
+ * Unique item key
122
+ */
123
+ key: string;
124
+ /**
125
+ * Item icon
126
+ */
127
+ icon?: ReactNode;
128
+ /**
129
+ * Item title
130
+ */
131
+ title?: ReactNode;
132
+ /**
133
+ * Item color
134
+ */
135
+ color?: MantineColor;
136
+ /**
137
+ * if true, the menu item will not be shown
138
+ */
139
+ hidden?: boolean;
140
+ /**
141
+ * if true, the menu item will be disabled
142
+ */
143
+ disabled?: boolean;
144
+ /**
145
+ * Function to call when the menu item is clicked
146
+ */
147
+ onClick: () => void;
148
+ };
119
149
  export declare type DataTableProps<T> = {
120
150
  /**
121
151
  * Table height; defaults to `100%`
@@ -125,6 +155,10 @@ export declare type DataTableProps<T> = {
125
155
  * Minimum table height
126
156
  */
127
157
  minHeight?: string | number;
158
+ /**
159
+ * `DataTable` component shadow
160
+ */
161
+ shadow?: MantineShadow;
128
162
  /**
129
163
  * If true, columns will have vertical borders
130
164
  */
@@ -154,7 +188,7 @@ export declare type DataTableProps<T> = {
154
188
  /**
155
189
  * Loader size; defaults to `lg`
156
190
  */
157
- loaderSize?: MantineSize;
191
+ loaderSize?: MantineNumberSize;
158
192
  /**
159
193
  * Loader variant
160
194
  */
@@ -172,52 +206,22 @@ export declare type DataTableProps<T> = {
172
206
  */
173
207
  onRowClick?: (record: T) => void;
174
208
  /**
175
- * Context-menu to show when right-clicking a row
209
+ * Defines a context-menu menu to show when user right-clicks or clicks on a row
176
210
  */
177
211
  rowContextMenu?: {
212
+ /**
213
+ * Context menu trigger; defaults to `rightClick` for classic behavior
214
+ */
215
+ trigger?: 'rightClick' | 'click';
178
216
  /**
179
217
  * Boolean or function accepting the current record as parameter returning boolean;
180
218
  * if true, the menu will not be shown
181
219
  */
182
- disabled?: boolean | ((record: T) => boolean);
220
+ hidden?: boolean | ((record: T) => boolean);
183
221
  /**
184
- * Menu items
222
+ * A function returning the row menu items for the current record
185
223
  */
186
- items: {
187
- /**
188
- * Unique item key
189
- */
190
- key: string;
191
- /**
192
- * Item icon; ReactNode or a function accepting the current record as parameter
193
- * and returning ReactNode
194
- */
195
- icon?: ReactNode | ((record: T) => ReactNode);
196
- /**
197
- * Item title; ReactNode or a function accepting the current record as parameter
198
- * and returning ReactNode
199
- */
200
- title?: ReactNode | ((record: T) => ReactNode);
201
- /**
202
- * Item color; MantineColor or a function accepting the current record as parameter
203
- * and returning MantineColor
204
- */
205
- color?: MantineColor | ((record: T) => MantineColor);
206
- /**
207
- * Boolean or function accepting the current record as parameter and returning boolean;
208
- * if true, the menu item will not be shown
209
- */
210
- hidden?: boolean | ((record: T) => boolean);
211
- /**
212
- * Boolean or function accepting the current record as parameter returning boolean;
213
- * if true, the menu item will be disabled
214
- */
215
- disabled?: boolean | ((record: T) => boolean);
216
- /**
217
- * Function to call when the menu item is clicked; accepts the current record as parameter
218
- */
219
- onClick: (record: T) => void;
220
- }[];
224
+ items: (record: T) => DataTableContextMenuItemProps[];
221
225
  };
222
226
  } & Omit<TableProps, 'border'> & DataTableBorderProps & DataTablePaginationProps & DataTableSortProps & DataTableSelectionProps<T>;
223
227
  //# 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,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,oBAAY,4BAA4B,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACvE,oBAAY,0BAA0B,GAAG,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AAC,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,oBAAoB,GACpB,wBAAwB,GACxB,kBAAkB,GAClB,uBAAuB,CAAC,CAAC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
- import { MantineSize, MantineTheme } from '@mantine/core';
1
+ import { MantineNumberSize, MantineTheme } from '@mantine/core';
2
2
  declare type DataTableLoaderProps = {
3
3
  pt: number;
4
4
  pb: number;
5
5
  fetching: boolean | undefined;
6
6
  loaderBackgroundBlur: number | undefined;
7
- loaderSize: MantineSize | undefined;
7
+ loaderSize: MantineNumberSize | undefined;
8
8
  loaderVariant: MantineTheme['loader'] | undefined;
9
9
  };
10
10
  export default function DataTableLoader({ pt, pb, fetching, loaderBackgroundBlur, loaderSize, loaderVariant, }: DataTableLoaderProps): JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableLoader.d.ts","sourceRoot":"","sources":["../DataTableLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqBxF,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,WAAW,GAAG,SAAS,CAAC;IACpC,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
+ {"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,4 +1,4 @@
1
- import { ChangeEventHandler } from 'react';
1
+ import { ChangeEventHandler, MouseEventHandler } from 'react';
2
2
  import { DataTableColumn } from './DataTable.props';
3
3
  declare type DataTableRowProps<T> = {
4
4
  record: T;
@@ -6,12 +6,8 @@ declare type DataTableRowProps<T> = {
6
6
  selectionVisible: boolean;
7
7
  selectionChecked: boolean;
8
8
  onSelectionChange: ChangeEventHandler<HTMLInputElement> | undefined;
9
- onClick: ((record: T) => void) | undefined;
10
- onContextMenu: ((info: {
11
- top: number;
12
- left: number;
13
- record: T;
14
- }) => void) | undefined;
9
+ onClick: MouseEventHandler<HTMLTableRowElement> | undefined;
10
+ onContextMenu: MouseEventHandler<HTMLTableRowElement> | undefined;
15
11
  contextMenuVisible: boolean;
16
12
  leftShadowVisible: boolean;
17
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableRow.d.ts","sourceRoot":"","sources":["../DataTableRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAA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iB,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IACpE,OAAO,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IAC5D,aAAa,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IAClE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,EACtC,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,CAAC,CAAC,eAsCtB"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var hr=Object.create;var te=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty;var Tr=(e,r)=>{for(var o in r)te(e,o,{get:r[o],enumerable:!0})},qe=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Br(r))!Or.call(e,t)&&t!==o&&te(e,t,{get:()=>r[t],enumerable:!(a=Sr(r,t))||a.enumerable});return e};var fe=(e,r,o)=>(o=e!=null?hr(wr(e)):{},qe(r||!e||!e.__esModule?te(o,"default",{value:e,enumerable:!0}):o,e)),yr=e=>qe(te({},"__esModule",{value:!0}),e);var Ur={};Tr(Ur,{DataTable:()=>Re});module.exports=yr(Ur);var i=fe(require("react"),1);var q=require("@mantine/core"),re=require("@mantine/hooks"),x=require("lodash"),h=require("react");var W=require("@mantine/core");function D(){return D=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},D.apply(this,arguments)}function kr(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 E(e,r){if(e==null)return{};var o=kr(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=fe(require("react")),Dr=["size","color"];function Be(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=E(e,Dr);return V.default.createElement("svg",D({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 z=fe(require("react")),Ar=["size","color"];function we(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=E(e,Ar);return z.default.createElement("svg",D({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),z.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),z.default.createElement("polyline",{points:"8 7 12 3 16 7"}),z.default.createElement("polyline",{points:"8 17 12 21 16 17"}),z.default.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"21"}))}var v=fe(require("react")),Lr=["size","color"];function Oe(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=E(e,Lr);return v.default.createElement("svg",D({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),v.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),v.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"}),v.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"}),v.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"}),v.default.createElement("line",{x1:"3",y1:"3",x2:"21",y2:"21"}))}var _=require("react/jsx-runtime"),Pr=(0,W.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 Te({text:e,pt:r,pb:o,active:a}){let{classes:t,cx:f}=Pr();return(0,_.jsxs)(W.Center,{pt:r,pb:o,className:f(t.root,{[t.active]:a}),children:[(0,_.jsx)("div",{className:t.icon,children:(0,_.jsx)(Oe,{})}),(0,_.jsx)(W.Text,{size:"sm",color:"dimmed",children:e})]})}var A=require("@mantine/core"),$e=require("react"),le=require("react/jsx-runtime"),Rr=(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}})),Ze=(0,$e.forwardRef)(function({fetching:r,page:o,onPageChange:a,paginationSize:t,totalRecords:f,recordsPerPage:d,recordsLength:n,horizontalSpacing:u},l){let s;if(r)s="...";else{let C=(o-1)*d+1,S=C+n-1;s=`${C} - ${S}`,f&&(s+=` / ${f}`)}let{classes:m,cx:b}=Rr();return(0,le.jsxs)(A.Box,{ref:l,px:u??"xs",py:"xs",className:m.root,children:[(0,le.jsx)(A.Text,{size:t,children:s}),(0,le.jsx)(A.Pagination,{className:b(m.pagination,{[m.paginationFetching]:r||!n}),page:o,onChange:a,size:t,total:Math.ceil(f/d)})]})});var de=require("@mantine/core"),je=require("react");var w=require("@mantine/core"),se=require("lodash");var Ke=require("@mantine/core"),Xe=require("@mantine/hooks");function Y(e){let r=(0,Ke.useMantineTheme)(),o=typeof e=="function"?e(r):e;return(0,Xe.useMediaQuery)(o||"",!0)}var L=require("react/jsx-runtime"),Mr=(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",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 ye({accessor:e,visibleMediaQuery:r,title:o,sortable:a,textAlignment:t,width:f,sortStatus:d,onSortStatusChange:n}){let{cx:u,classes:l}=Mr();if(!Y(r))return null;let s=o??(0,se.upperFirst)((0,se.lowerCase)(e));return(0,L.jsx)(w.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:d?.direction==="asc"?"desc":"asc"})}:void 0,children:a||d?.columnAccessor===e?(0,L.jsxs)(w.Group,{position:"apart",noWrap:!0,spacing:"xs",children:[(0,L.jsx)(w.Box,{className:u(l.columnHeaderText,l.sortableColumnHeaderText),children:s}),(0,L.jsx)(w.Center,{children:d?.columnAccessor===e?(0,L.jsx)(Be,{className:u(l.sortableColumnHeaderIcon,{[l.sortableColumnHeaderIconRotated]:d.direction==="desc"}),size:14}):(0,L.jsx)(we,{className:l.sortableColumnHeaderNeutralIcon,size:14})})]}):(0,L.jsx)(w.Box,{className:l.columnHeaderText,children:s})})}var G=require("react/jsx-runtime"),vr=(0,de.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"}}}),Qe=(0,je.forwardRef)(function({sortStatus:r,onSortStatusChange:o,columns:a,selectionVisible:t,selectionChecked:f,selectionIndeterminate:d,onSelectionChange:n,leftShadowVisible:u,bottomShadowVisible:l},s){let{classes:m,cx:b}=vr();return(0,G.jsx)("thead",{className:b(m.root,{[m.bottomShadowVisible]:l}),ref:s,children:(0,G.jsxs)("tr",{children:[t&&(0,G.jsx)("th",{className:b(m.selectorColumnHeader,{[m.selectorColumnHeaderWithRightShadow]:u}),children:(0,G.jsx)(de.Checkbox,{classNames:{input:m.selectionCheckboxInput},checked:f,indeterminate:d,disabled:!n,onChange:n})}),a.map(({accessor:C,visibleMediaQuery:S,textAlignment:y,width:$,title:ne,sortable:ie})=>(0,G.jsx)(ye,{accessor:C,visibleMediaQuery:S,textAlignment:y,width:$,title:ne,sortable:ie,sortStatus:r,onSortStatusChange:o},C))]})})});var I=require("@mantine/core"),_e=require("react/jsx-runtime"),Fr=(0,I.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 ke({pt:e,pb:r,fetching:o,loaderBackgroundBlur:a,loaderSize:t,loaderVariant:f}){let{classes:d,cx:n}=Fr();return(0,_e.jsx)(I.Center,{pt:e,pb:r,className:n(d.root,{[d.fetching]:o}),sx:a?{backdropFilter:`blur(${a}px)`}:void 0,children:o&&(0,_e.jsx)(I.Loader,{size:t,variant:f})})}var pe=require("@mantine/core");var ue=require("@mantine/core"),Ye=require("lodash");var Nr=require("react/jsx-runtime"),Hr=(0,ue.createStyles)({ellipsis:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}});function De({visibleMediaQuery:e,record:r,ellipsis:o,textAlignment:a,width:t,accessor:f,render:d}){let{cx:n,classes:u}=Hr();return Y(e)?(0,Nr.jsx)(ue.Box,{component:"td",className:n({[u.ellipsis]:o}),sx:{width:t,minWidth:t,maxWidth:t,textAlign:a},children:d?d(r):(0,Ye.get)(r,f)}):null}var J=require("react/jsx-runtime"),Er=(0,pe.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 Ae({record:e,columns:r,selectionVisible:o,selectionChecked:a,onSelectionChange:t,onClick:f,onContextMenu:d,contextMenuVisible:n,leftShadowVisible:u}){let{cx:l,classes:s}=Er();return(0,J.jsxs)("tr",{className:l({[s.withClickHandler]:f,[s.selected]:a,[s.contextMenuVisible]:n}),onClick:f?()=>f(e):void 0,onContextMenu:d?m=>{m.preventDefault(),d({top:m.clientY,left:m.clientX,record:e})}:void 0,children:[o&&(0,J.jsx)("td",{className:l(s.selectorCell,{[s.selectorCellWithRightShadow]:u}),children:(0,J.jsx)(pe.Checkbox,{classNames:{input:s.selectorCheckboxInput},checked:a,disabled:!t,onChange:t,onClick:m=>m.stopPropagation()})}),r.map(({accessor:m,visibleMediaQuery:b,textAlignment:C,ellipsis:S,width:y,render:$})=>(0,J.jsx)(De,{visibleMediaQuery:b,record:e,accessor:m,textAlignment:C,ellipsis:S,width:y,render:$},m))]})}var U=require("@mantine/core"),T=require("@mantine/hooks"),zr=require("react/jsx-runtime"),Vr=(0,U.createStyles)(e=>({root:{position:"fixed",padding:4,border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,transition:"all .15s ease"}}));function Le({top:e,left:r,zIndex:o=3,onDestroy:a,children:t}){(0,T.useWindowEvent)("resize",a),(0,T.useWindowEvent)("scroll",a);let f=(0,T.useClickOutside)(a),{ref:d,width:n,height:u}=(0,T.useElementSize)(),l=(0,T.useMergedRef)(f,d),{spacing:{xs:s}}=(0,U.useMantineTheme)(),{innerWidth:m,innerHeight:b}=window,C=e+u+s>b?b-u-s:e,S=r+n+s>m?m-n-s:r,{classes:y}=Vr();return(0,zr.jsx)(U.Paper,{ref:l,shadow:"md",className:y.root,sx:{top:C,left:S,zIndex:o},children:t})}var P=require("@mantine/core"),me=require("react/jsx-runtime"),Wr=(0,P.createStyles)((e,{color:r})=>{let o=e.spacing.sm/2;return{root:{width:"100%",display:"flex",alignItems:"center",borderRadius:e.radius.xs,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 Pe({icon:e,title:r,color:o,disabled:a,onClick:t}){let{classes:f}=Wr({color:o});return(0,me.jsxs)(P.UnstyledButton,{className:f.root,disabled:a,onClick:t,children:[e&&(0,me.jsx)(P.Box,{className:f.icon,children:e}),(0,me.jsx)(P.Text,{className:f.title,size:"sm",children:r})]})}var xe=require("@mantine/core"),Je=require("react"),ee=require("react/jsx-runtime"),Gr=(0,xe.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"}},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}}}),er=(0,Je.forwardRef)(function({leftShadowVisible:r,rightShadowVisible:o,bottomShadowVisible:a,headerHeight:t,onScrollPositionChange:f,children:d},n){let{cx:u,classes:l}=Gr();return(0,ee.jsxs)(xe.ScrollArea,{viewportRef:n,classNames:{root:l.root,scrollbar:l.scrollbar,thumb:l.thumb},styles:{scrollbar:{marginTop:t}},onScrollPositionChange:f,children:[d,(0,ee.jsx)("div",{className:u(l.shadow,l.leftShadow,{[l.shadowVisible]:r})}),(0,ee.jsx)("div",{className:u(l.shadow,l.rightShadow,{[l.shadowVisible]:o})}),(0,ee.jsx)("div",{className:u(l.shadow,l.bottomShadow,{[l.shadowVisible]:a})})]})});var c=require("react/jsx-runtime"),Ir=(0,q.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 Re({withBorder:e,borderRadius:r,withColumnBorders:o,height:a="100%",minHeight:t,verticalAlignment:f="center",fetching:d,columns:n,idAccessor:u="id",records:l,selectedRecords:s,onSelectedRecordsChange:m,sortStatus:b,onSortStatusChange:C,horizontalSpacing:S,page:y,onPageChange:$,totalRecords:ne,recordsPerPage:ie,paginationSize:rr="sm",loaderSize:or,loaderVariant:ar,loaderBackgroundBlur:tr,noRecordsText:fr="No records",striped:lr,onRowClick:Me,rowContextMenu:F,...sr}){let{ref:Z,width:ce,height:ge}=(0,re.useElementSize)(),{ref:dr,height:be}=(0,re.useElementSize)(),{ref:ur,width:Ce,height:he}=(0,re.useElementSize)(),{ref:pr,height:ve}=(0,re.useElementSize)(),[mr,Fe]=(0,h.useState)(!0),[xr,He]=(0,h.useState)(!0),[Ne,Ee]=(0,h.useState)(!0),[nr,Ve]=(0,h.useState)(!0),[H,K]=(0,h.useState)(null);(0,h.useEffect)(()=>{d&&K(null)},[d]);let ze=()=>{if(d||K(null),d||he<=ge)Fe(!0),He(!0);else{let p=Z.current.scrollTop;Fe(p===0),He(Math.round(he-p)===Math.round(ge))}if(d||Ce===ce)Ee(!0),Ve(!0);else{let p=Z.current.scrollLeft;Ee(p===0),Ve(Math.round(Ce-p)===Math.round(ce))}};(0,h.useEffect)(ze,[d,ge,Z,ce,he,Ce]);let ir=(0,x.throttle)(ze,200,{leading:!0,trailing:!0}),cr=p=>{Z.current.scrollTo({top:0,left:0}),$(p)},oe=l?.length,X=l?.map(p=>(0,x.get)(p,u)),j=s?.map(p=>(0,x.get)(p,u)),We=X!==void 0&&j!==void 0&&j.length>0,Se=We&&X.every(p=>j.includes(p)),gr=We&&X.some(p=>j.includes(p)),[ae,Ge]=(0,h.useState)(null),br=X?.join(":")||"";(0,h.useEffect)(()=>{Ge(null)},[br]);let Ie=!!s&&!Ne,{cx:Ue,classes:N}=Ir();return(0,c.jsxs)(q.Box,{className:Ue(N.root,{[N.tableWithBorder]:e}),sx:p=>({borderRadius:r?typeof r=="string"?p.radius[r]:r:void 0,height:a,minHeight:t}),children:[(0,c.jsx)(er,{ref:Z,leftShadowVisible:!(s||Ne),rightShadowVisible:!nr,bottomShadowVisible:!xr,headerHeight:be,onScrollPositionChange:ir,children:(0,c.jsxs)(q.Table,{ref:ur,horizontalSpacing:S,className:Ue({[N.browserSelectionDisabled]:Me||s,[N.tableWithColumnBorders]:o,[N.verticalAlignmentTop]:f==="top",[N.verticalAlignmentBottom]:f==="bottom"}),striped:oe?lr:!1,...sr,children:[(0,c.jsx)(Qe,{ref:dr,columns:n,sortStatus:b,onSortStatusChange:C,selectionVisible:!!s,selectionChecked:Se,selectionIndeterminate:gr&&!Se,onSelectionChange:m?()=>{m(Se?s.filter(p=>!X.includes((0,x.get)(p,u))):(0,x.uniqBy)([...s,...l],p=>(0,x.get)(p,u)))}:void 0,leftShadowVisible:Ie,bottomShadowVisible:!mr}),(0,c.jsx)("tbody",{children:oe?l.map((p,O)=>{let k=(0,x.get)(p,u),R=j?.includes(k)||!1;return(0,c.jsx)(Ae,{record:p,columns:n,selectionVisible:!!s,selectionChecked:R,onSelectionChange:m?Q=>{if(Q.nativeEvent.shiftKey&&ae!==null){let B=l.filter(O>ae?(M,g)=>g>=ae&&g<=O:(M,g)=>g>=O&&g<=ae);m(R?(0,x.differenceBy)(s,B,M=>(0,x.get)(M,u)):(0,x.uniqBy)([...s,...B],M=>(0,x.get)(M,u)))}else m(R?s.filter(B=>(0,x.get)(B,u)!==k):(0,x.uniqBy)([...s,p],B=>(0,x.get)(B,u)));Ge(O)}:void 0,onClick:Me,onContextMenu:F&&!(typeof F.disabled=="function"?F.disabled(p):F.disabled)?K:void 0,contextMenuVisible:H?(0,x.get)(H.record,u)===k:!1,leftShadowVisible:Ie},k)}):(0,c.jsx)("tr",{children:(0,c.jsx)("td",{})})})]})}),y&&(0,c.jsx)(Ze,{ref:pr,horizontalSpacing:S,fetching:d,page:y,onPageChange:cr,totalRecords:ne,recordsPerPage:ie,paginationSize:rr,recordsLength:oe}),(0,c.jsx)(ke,{pt:be,pb:ve,fetching:d,loaderBackgroundBlur:tr,loaderSize:or,loaderVariant:ar}),(0,c.jsx)(Te,{pt:be,pb:ve,text:fr,active:!d&&!oe}),F&&H&&(0,c.jsx)(Le,{top:H.top,left:H.left,onDestroy:()=>K(null),children:F.items.map(({key:p,title:O,icon:k,color:R,hidden:Q,disabled:B,onClick:M})=>{let{record:g}=H;if(typeof Q=="function"?Q(g):Q)return null;let Cr=O?typeof O=="function"?O(g):O:(0,x.upperFirst)((0,x.lowerCase)(p));return(0,c.jsx)(Pe,{title:Cr,icon:typeof k=="function"?k(g):k,color:typeof R=="function"?R(g):R,disabled:typeof B=="function"?B(g):B,onClick:()=>{K(null),M(g)}},p)})})]})}
1
+ "use strict";var Br=Object.create;var se=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Tr=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty;var kr=(e,r)=>{for(var o in r)se(e,o,{get:r[o],enumerable:!0})},Ze=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Or(r))!yr.call(e,t)&&t!==o&&se(e,t,{get:()=>r[t],enumerable:!(a=wr(r,t))||a.enumerable});return e};var de=(e,r,o)=>(o=e!=null?Br(Tr(e)):{},Ze(r||!e||!e.__esModule?se(o,"default",{value:e,enumerable:!0}):o,e)),Dr=e=>Ze(se({},"__esModule",{value:!0}),e);var $r={};kr($r,{DataTable:()=>Fe});module.exports=Dr($r);var i=de(require("react"),1);var U=require("@mantine/core"),re=require("@mantine/hooks"),x=require("lodash"),C=require("react");var V=require("@mantine/core");function T(){return T=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},T.apply(this,arguments)}function Ar(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 N(e,r){if(e==null)return{};var o=Ar(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 E=de(require("react")),Lr=["size","color"];function Te(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=N(e,Lr);return E.default.createElement("svg",T({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),E.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),E.default.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),E.default.createElement("line",{x1:"18",y1:"13",x2:"12",y2:"19"}),E.default.createElement("line",{x1:"6",y1:"13",x2:"12",y2:"19"}))}var z=de(require("react")),Pr=["size","color"];function ye(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=N(e,Pr);return z.default.createElement("svg",T({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),z.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),z.default.createElement("polyline",{points:"8 7 12 3 16 7"}),z.default.createElement("polyline",{points:"8 17 12 21 16 17"}),z.default.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"21"}))}var A=de(require("react")),Rr=["size","color"];function ke(e){var r=e.size,o=r===void 0?24:r,a=e.color,t=a===void 0?"currentColor":a,f=N(e,Rr);return A.default.createElement("svg",T({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),A.default.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),A.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"}),A.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"}),A.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"}),A.default.createElement("line",{x1:"3",y1:"3",x2:"21",y2:"21"}))}var _=require("react/jsx-runtime"),Mr=(0,V.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 De({text:e,pt:r,pb:o,active:a}){let{classes:t,cx:f}=Mr();return(0,_.jsxs)(V.Center,{pt:r,pb:o,className:f(t.root,{[t.active]:a}),children:[(0,_.jsx)("div",{className:t.icon,children:(0,_.jsx)(ke,{})}),(0,_.jsx)(V.Text,{size:"sm",color:"dimmed",children:e})]})}var y=require("@mantine/core"),Ke=require("react"),ue=require("react/jsx-runtime"),vr=(0,y.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}})),Xe=(0,Ke.forwardRef)(function({fetching:r,page:o,onPageChange:a,paginationSize:t,totalRecords:f,recordsPerPage:m,recordsLength:u,horizontalSpacing:n},l){let p;if(r)p="...";else{let h=(o-1)*m+1,B=h+u-1;p=`${h} - ${B}`,f&&(p+=` / ${f}`)}let{classes:d,cx:c}=vr();return(0,ue.jsxs)(y.Box,{ref:l,px:n??"xs",py:"xs",className:d.root,children:[(0,ue.jsx)(y.Text,{size:t,children:p}),(0,ue.jsx)(y.Pagination,{className:c(d.pagination,{[d.paginationFetching]:r||!u}),page:o,onChange:a,size:t,total:Math.ceil(f/m)})]})});var me=require("@mantine/core"),_e=require("react");var S=require("@mantine/core"),pe=require("lodash");var je=require("@mantine/core"),Qe=require("@mantine/hooks");function Y(e){let r=(0,je.useMantineTheme)(),o=typeof e=="function"?e(r):e;return(0,Qe.useMediaQuery)(o||"",!0)}var k=require("react/jsx-runtime"),Fr=(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 Ae({accessor:e,visibleMediaQuery:r,title:o,sortable:a,textAlignment:t,width:f,sortStatus:m,onSortStatusChange:u}){let{cx:n,classes:l}=Fr();if(!Y(r))return null;let p=o??(0,pe.upperFirst)((0,pe.lowerCase)(e));return(0,k.jsx)(S.Box,{component:"th",className:n({[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,k.jsxs)(S.Group,{position:"apart",noWrap:!0,spacing:"xs",children:[(0,k.jsx)(S.Box,{className:n(l.columnHeaderText,l.sortableColumnHeaderText),children:p}),(0,k.jsx)(S.Center,{children:m?.columnAccessor===e?(0,k.jsx)(Te,{className:n(l.sortableColumnHeaderIcon,{[l.sortableColumnHeaderIconRotated]:m.direction==="desc"}),size:14}):(0,k.jsx)(ye,{className:l.sortableColumnHeaderNeutralIcon,size:14})})]}):(0,k.jsx)(S.Box,{className:l.columnHeaderText,children:p})})}var W=require("react/jsx-runtime"),Hr=(0,me.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"}}}),Ye=(0,_e.forwardRef)(function({sortStatus:r,onSortStatusChange:o,columns:a,selectionVisible:t,selectionChecked:f,selectionIndeterminate:m,onSelectionChange:u,leftShadowVisible:n,bottomShadowVisible:l},p){let{classes:d,cx:c}=Hr();return(0,W.jsx)("thead",{className:c(d.root,{[d.bottomShadowVisible]:l}),ref:p,children:(0,W.jsxs)("tr",{children:[t&&(0,W.jsx)("th",{className:c(d.selectorColumnHeader,{[d.selectorColumnHeaderWithRightShadow]:n}),children:(0,W.jsx)(me.Checkbox,{classNames:{input:d.selectionCheckboxInput},checked:f,indeterminate:m,disabled:!u,onChange:u})}),a.map(({accessor:h,visibleMediaQuery:B,textAlignment:O,width:L,title:ge,sortable:be})=>(0,W.jsx)(Ae,{accessor:h,visibleMediaQuery:B,textAlignment:O,width:L,title:ge,sortable:be,sortStatus:r,onSortStatusChange:o},h))]})})});var G=require("@mantine/core"),Je=require("react/jsx-runtime"),Nr=(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 Le({pt:e,pb:r,fetching:o,loaderBackgroundBlur:a,loaderSize:t,loaderVariant:f}){let{classes:m,cx:u}=Nr();return(0,Je.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,Je.jsx)(G.Loader,{size:t,variant:f})})}var ne=require("@mantine/core");var xe=require("@mantine/core"),er=require("lodash");var zr=require("react/jsx-runtime"),Er=(0,xe.createStyles)({ellipsis:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}});function Pe({visibleMediaQuery:e,record:r,ellipsis:o,textAlignment:a,width:t,accessor:f,render:m}){let{cx:u,classes:n}=Er();return Y(e)?(0,zr.jsx)(xe.Box,{component:"td",className:u({[n.ellipsis]:o}),sx:{width:t,minWidth:t,maxWidth:t,textAlign:a},children:m?m(r):(0,er.get)(r,f)}):null}var J=require("react/jsx-runtime"),Vr=(0,ne.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 Re({record:e,columns:r,selectionVisible:o,selectionChecked:a,onSelectionChange:t,onClick:f,onContextMenu:m,contextMenuVisible:u,leftShadowVisible:n}){let{cx:l,classes:p}=Vr();return(0,J.jsxs)("tr",{className:l({[p.withClickHandler]:f,[p.selected]:a,[p.contextMenuVisible]:u}),onClick:f,onContextMenu:m,children:[o&&(0,J.jsx)("td",{className:l(p.selectorCell,{[p.selectorCellWithRightShadow]:n}),children:(0,J.jsx)(ne.Checkbox,{classNames:{input:p.selectorCheckboxInput},checked:a,disabled:!t,onChange:t,onClick:d=>d.stopPropagation()})}),r.map(({accessor:d,visibleMediaQuery:c,textAlignment:h,ellipsis:B,width:O,render:L})=>(0,J.jsx)(Pe,{visibleMediaQuery:c,record:e,accessor:d,textAlignment:h,ellipsis:B,width:O,render:L},d))]})}var I=require("@mantine/core"),w=require("@mantine/hooks"),Gr=require("react/jsx-runtime"),Wr=(0,I.createStyles)(e=>({root:{position:"fixed",padding:4,border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,transition:"all .15s ease"}}));function Me({top:e,left:r,zIndex:o=3,onDestroy:a,children:t}){(0,w.useWindowEvent)("resize",a),(0,w.useWindowEvent)("scroll",a);let f=(0,w.useClickOutside)(a),{ref:m,width:u,height:n}=(0,w.useElementSize)(),l=(0,w.useMergedRef)(f,m),{spacing:{xs:p}}=(0,I.useMantineTheme)(),{innerWidth:d,innerHeight:c}=window,h=e+n+p>c?c-n-p:e,B=r+u+p>d?d-u-p:r,{classes:O}=Wr();return(0,Gr.jsx)(I.Paper,{ref:l,shadow:"md",className:O.root,sx:{top:h,left:B,zIndex:o},children:t})}var D=require("@mantine/core"),ie=require("react/jsx-runtime"),Ir=(0,D.createStyles)((e,{color:r})=>{let o=e.spacing.sm/2;return{root:{width:"100%",display:"flex",alignItems:"center",borderRadius:e.radius.xs,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 ve({icon:e,title:r,color:o,disabled:a,onClick:t}){let{classes:f}=Ir({color:o});return(0,ie.jsxs)(D.UnstyledButton,{className:f.root,disabled:a,onClick:t,children:[e&&(0,ie.jsx)(D.Box,{className:f.icon,children:e}),(0,ie.jsx)(D.Text,{className:f.title,size:"sm",children:r})]})}var ce=require("@mantine/core"),rr=require("react"),ee=require("react/jsx-runtime"),Ur=(0,ce.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"}},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}}}),or=(0,rr.forwardRef)(function({leftShadowVisible:r,rightShadowVisible:o,bottomShadowVisible:a,headerHeight:t,onScrollPositionChange:f,children:m},u){let{cx:n,classes:l}=Ur();return(0,ee.jsxs)(ce.ScrollArea,{viewportRef:u,classNames:{root:l.root,scrollbar:l.scrollbar,thumb:l.thumb},styles:{scrollbar:{marginTop:t}},onScrollPositionChange:f,children:[m,(0,ee.jsx)("div",{className:n(l.shadow,l.leftShadow,{[l.shadowVisible]:r})}),(0,ee.jsx)("div",{className:n(l.shadow,l.rightShadow,{[l.shadowVisible]:o})}),(0,ee.jsx)("div",{className:n(l.shadow,l.bottomShadow,{[l.shadowVisible]:a})})]})});var b=require("react/jsx-runtime"),qr=(0,U.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 Fe({withBorder:e,borderRadius:r,withColumnBorders:o,height:a="100%",minHeight:t,shadow:f,verticalAlignment:m="center",fetching:u,columns:n,idAccessor:l="id",records:p,selectedRecords:d,onSelectedRecordsChange:c,sortStatus:h,onSortStatusChange:B,horizontalSpacing:O,page:L,onPageChange:ge,totalRecords:be,recordsPerPage:ar,paginationSize:tr="sm",loaderSize:fr,loaderVariant:lr,loaderBackgroundBlur:sr,noRecordsText:dr="No records",striped:ur,onRowClick:oe,rowContextMenu:q,...pr}){let{ref:$,width:he,height:Ce}=(0,re.useElementSize)(),{ref:mr,height:Se}=(0,re.useElementSize)(),{ref:xr,width:Be,height:we}=(0,re.useElementSize)(),{ref:nr,height:He}=(0,re.useElementSize)(),[ir,Ne]=(0,C.useState)(!0),[cr,Ee]=(0,C.useState)(!0),[ze,Ve]=(0,C.useState)(!0),[gr,We]=(0,C.useState)(!0),[P,R]=(0,C.useState)(null);(0,C.useEffect)(()=>{u&&R(null)},[u]);let Ge=()=>{if(u||R(null),u||we<=Ce)Ne(!0),Ee(!0);else{let s=$.current.scrollTop;Ne(s===0),Ee(Math.round(we-s)===Math.round(Ce))}if(u||Be===he)Ve(!0),We(!0);else{let s=$.current.scrollLeft;Ve(s===0),We(Math.round(Be-s)===Math.round(he))}};(0,C.useEffect)(Ge,[u,Ce,$,he,we,Be]);let br=(0,x.throttle)(Ge,200,{leading:!0,trailing:!0}),hr=s=>{$.current.scrollTo({top:0,left:0}),ge(s)},ae=p?.length,Z=p?.map(s=>(0,x.get)(s,l)),K=d?.map(s=>(0,x.get)(s,l)),Ie=Z!==void 0&&K!==void 0&&K.length>0,Oe=Ie&&Z.every(s=>K.includes(s)),Cr=Ie&&Z.some(s=>K.includes(s)),[te,Ue]=(0,C.useState)(null),Sr=Z?.join(":")||"";(0,C.useEffect)(()=>{Ue(null)},[Sr]);let qe=!!d&&!ze,{cx:$e,classes:M}=qr();return(0,b.jsxs)(U.Box,{className:$e(M.root,{[M.tableWithBorder]:e}),sx:s=>({borderRadius:s.radius[r]||r,boxShadow:s.shadows[f]||f,height:a,minHeight:t}),children:[(0,b.jsx)(or,{ref:$,leftShadowVisible:!(d||ze),rightShadowVisible:!gr,bottomShadowVisible:!cr,headerHeight:Se,onScrollPositionChange:br,children:(0,b.jsxs)(U.Table,{ref:xr,horizontalSpacing:O,className:$e({[M.browserSelectionDisabled]:oe||d,[M.tableWithColumnBorders]:o,[M.verticalAlignmentTop]:m==="top",[M.verticalAlignmentBottom]:m==="bottom"}),striped:ae?ur:!1,...pr,children:[(0,b.jsx)(Ye,{ref:mr,columns:n,sortStatus:h,onSortStatusChange:B,selectionVisible:!!d,selectionChecked:Oe,selectionIndeterminate:Cr&&!Oe,onSelectionChange:c?()=>{c(Oe?d.filter(s=>!Z.includes((0,x.get)(s,l))):(0,x.uniqBy)([...d,...p],s=>(0,x.get)(s,l)))}:void 0,leftShadowVisible:qe,bottomShadowVisible:!ir}),(0,b.jsx)("tbody",{children:ae?p.map((s,v)=>{let F=(0,x.get)(s,l),X=K?.includes(F)||!1,fe=!1,le=!1;if(q){let{hidden:g}=q;(!g||!(typeof g=="function"?g(s):g))&&(q.trigger==="click"?fe=!0:le=!0)}return(0,b.jsx)(Re,{record:s,columns:n,selectionVisible:!!d,selectionChecked:X,onSelectionChange:c?g=>{if(g.nativeEvent.shiftKey&&te!==null){let H=p.filter(v>te?(j,Q)=>Q>=te&&Q<=v:(j,Q)=>Q>=v&&Q<=te);c(X?(0,x.differenceBy)(d,H,j=>(0,x.get)(j,l)):(0,x.uniqBy)([...d,...H],j=>(0,x.get)(j,l)))}else c(X?d.filter(H=>(0,x.get)(H,l)!==F):(0,x.uniqBy)([...d,s],H=>(0,x.get)(H,l)));Ue(v)}:void 0,onClick:fe?g=>{R({top:g.clientY,left:g.clientX,record:s}),oe?.(s)}:oe?()=>{oe(s)}:void 0,onContextMenu:le?g=>{g.preventDefault(),R({top:g.clientY,left:g.clientX,record:s})}:void 0,contextMenuVisible:P?(0,x.get)(P.record,l)===F:!1,leftShadowVisible:qe},F)}):(0,b.jsx)("tr",{children:(0,b.jsx)("td",{})})})]})}),L&&(0,b.jsx)(Xe,{ref:nr,horizontalSpacing:O,fetching:u,page:L,onPageChange:hr,totalRecords:be,recordsPerPage:ar,paginationSize:tr,recordsLength:ae}),(0,b.jsx)(Le,{pt:Se,pb:He,fetching:u,loaderBackgroundBlur:sr,loaderSize:fr,loaderVariant:lr}),(0,b.jsx)(De,{pt:Se,pb:He,text:dr,active:!u&&!ae}),q&&P&&(0,b.jsx)(Me,{top:P.top,left:P.left,onDestroy:()=>R(null),children:q.items(P.record).map(({key:s,title:v,icon:F,color:X,hidden:fe,disabled:le,onClick:g})=>fe?null:(0,b.jsx)(ve,{title:v??(0,x.upperFirst)((0,x.lowerCase)(s)),icon:F,color:X,disabled:le,onClick:()=>{R(null),g()}},s))})]})}
2
2
  //# sourceMappingURL=index.cjs.map