@harpercollins/harpercollins-design-system 1.37.0 → 1.38.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/dist/.DS_Store +0 -0
- package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +26 -3
- package/dist/cjs/components/data-display/DataGrid/filters/FilterComponents.cjs +8 -4
- package/dist/cjs/components/data-display/DataGrid/filters/filterFunctions.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.styles.cjs +1 -2
- package/dist/cjs/components/data-display/Table/hooks/useStickyHeader.cjs +1 -1
- package/dist/esm/components/data-display/DataGrid/TableToolbar.js +51 -28
- package/dist/esm/components/data-display/DataGrid/filters/FilterComponents.js +201 -158
- package/dist/esm/components/data-display/DataGrid/filters/filterFunctions.js +29 -21
- package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +27 -26
- package/dist/esm/components/data-display/Table/Table.styles.js +1 -2
- package/dist/esm/components/data-display/Table/hooks/useStickyHeader.js +41 -32
- package/dist/index.d.ts +6 -2
- package/package.json +4 -4
package/dist/.DS_Store
ADDED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),u=require("react"),n=require("styled-components"),h=require("../Typography/Typography.cjs"),f=require("./ExportToExcelButton.cjs"),g=require("./FilterChipsSection.cjs"),w=require("./ManageColumnsDropdown.cjs"),T=require("./TableSettingsDropdown.cjs"),s=require("../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),m=n(s)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 8px;
|
|
@@ -9,9 +9,32 @@
|
|
|
9
9
|
position: sticky;
|
|
10
10
|
top: 0;
|
|
11
11
|
z-index: 1;
|
|
12
|
-
`,
|
|
12
|
+
`,y=n(s)`
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: space-between;
|
|
16
|
+
gap: 8px;
|
|
16
17
|
width: 100%;
|
|
17
|
-
|
|
18
|
+
/* Allow the start/end groups to wrap onto separate lines when they
|
|
19
|
+
no longer fit side by side (e.g. many filters on a narrow viewport). */
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
`,i=n(s)`
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 8px;
|
|
25
|
+
/* min-width: 0 lets the group shrink below its content width so children
|
|
26
|
+
(filter chips) can wrap or ellipsis instead of overflowing the toolbar. */
|
|
27
|
+
min-width: 0;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
`,j=n(i)`
|
|
30
|
+
flex: 1 1 auto;
|
|
31
|
+
`,b=n(i)`
|
|
32
|
+
flex: 0 0 auto;
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
|
|
35
|
+
/* On small screens, drop the controls onto their own full-width line. */
|
|
36
|
+
@media (max-width: 768px) {
|
|
37
|
+
flex: 1 1 100%;
|
|
38
|
+
justify-content: flex-start;
|
|
39
|
+
}
|
|
40
|
+
`;function R({toolbar:e,columnFilters:r,table:o,resetColumnVisibility:l,wrapText:a,onWrapTextToggle:c},d){const p=o.getFilteredRowModel().rows.length,x=r.length>0;return t.jsx(m,{ref:d,children:t.jsxs(y,{children:[t.jsxs(j,{children:[e.leftContent?e.leftContent:null,e.exportToExcel?.enabled&&t.jsx(f,{onExport:e.exportToExcel.onExport,disabled:e.exportToExcel.disabled}),e.showFilterChips?t.jsx(g,{columnFilters:r,table:o}):null]}),t.jsxs(b,{children:[e.totalResults!==void 0&&t.jsx(h,{level:"body-sm",sx:{fontWeight:500},children:x?`Showing ${p.toLocaleString()} of ${e.totalResults.toLocaleString()} results`:`Total Results: ${e.totalResults.toLocaleString()}`}),e.rightContent?e.rightContent:null,e.manageColumns?.enabled&&t.jsx(w,{table:o,onReset:l}),e.tableSettings?.enabled&&t.jsx(T,{wrapText:a,onWrapTextToggle:c})]})]})})}const q=u.forwardRef(R);module.exports=q;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),I=require("../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),i=require("react"),m=require("styled-components"),T=require("../../../inputs/RadioButton/RadioButton.cjs"),M=require("../../../inputs/Textarea/Textarea.cjs"),E=require("../../../navigation/Dropdown/Dropdown.cjs"),k=require("../../../navigation/Menu/Menu.cjs"),H=require("../../Icon/Icon.cjs"),g=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),C=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.cjs"),y=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.cjs"),L=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.cjs"),h=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Input/Input.cjs"),j=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.cjs"),K=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.cjs"),B=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.cjs"),O=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.cjs");function S(e){const{meta:a}=e.columnDef;if(a?.filterLabel)return a.filterLabel;const{header:n}=e.columnDef;if(typeof n=="string")return n;if(typeof n=="function"){const r=n({column:e});return typeof r=="string"?r:e.id}return e.id}const P=m(g)`
|
|
2
2
|
padding: 12px;
|
|
3
3
|
min-width: 250px;
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
gap: 12px;
|
|
7
|
-
`,
|
|
7
|
+
`,N=m(g)`
|
|
8
8
|
display: flex;
|
|
9
9
|
justify-content: space-between;
|
|
10
10
|
align-items: center;
|
|
11
11
|
font-weight: 600;
|
|
12
12
|
font-size: 14px;
|
|
13
13
|
margin-bottom: 4px;
|
|
14
|
-
`,
|
|
14
|
+
`,W=m(g)`
|
|
15
15
|
display: flex;
|
|
16
16
|
gap: 8px;
|
|
17
17
|
justify-content: flex-end;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
padding-top: 8px;
|
|
20
20
|
border-top: 1px solid var(--palette-divider);
|
|
21
|
-
|
|
21
|
+
`,Y=m(g)`
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
color: var(--palette-text-tertiary);
|
|
24
|
+
margin-top: -6px;
|
|
25
|
+
`;function v({column:e,onApply:a,onClear:n,children:s}){const r=e.columnDef.meta?.filterHelpText;return t.jsxs(P,{children:[t.jsxs(N,{children:["Filter by ",S(e)]}),s,r&&t.jsx(Y,{children:r}),t.jsxs(W,{children:[t.jsx(j.default,{"aria-label":"Clear filter",size:"sm",variant:"plain",onClick:n,children:"Clear"}),t.jsx(j.default,{"aria-label":"Apply filter",size:"sm",variant:"solid",color:"primary",onClick:a,children:"Apply"})]})]})}function b({column:e,onClose:a}){const[n,s]=i.useState(e.getFilterValue()??""),r=()=>{e.setFilterValue(n||void 0),a?.()},o=()=>{s(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:o,children:t.jsx(h.default,{placeholder:"Search...",value:n,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&r()},size:"sm",autoFocus:!0})})}function V({column:e,onClose:a}){const[n,s]=i.useState(e.getFilterValue()??""),r=()=>{e.setFilterValue(n.trim()||void 0),a?.()},o=()=>{s(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:o,children:t.jsx(M,{placeholder:"One term per line or comma-separated...",value:n,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.metaKey||l.ctrlKey)&&(l.preventDefault(),r())},minRows:3,maxRows:6,size:"sm",autoFocus:!0})})}function w({column:e,onClose:a}){const n=e.getFilterValue(),[s,r]=i.useState(n?.min?.toString()??""),[o,l]=i.useState(n?.max?.toString()??""),f=i.useRef(null);i.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]);const p=()=>{const d=s?parseFloat(s):void 0,c=o?parseFloat(o):void 0;d!==void 0||c!==void 0?e.setFilterValue({min:d,max:c}):e.setFilterValue(void 0),a?.()},u=()=>{r(""),l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:p,onClear:u,children:t.jsxs(g,{sx:{display:"flex",gap:1,alignItems:"center"},children:[t.jsx(h.default,{slotProps:{input:{ref:f}},placeholder:"Min",type:"number",value:s,onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p()},size:"sm",sx:{flex:1}}),t.jsx("span",{children:"-"}),t.jsx(h.default,{placeholder:"Max",type:"number",value:o,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p()},size:"sm",sx:{flex:1}})]})})}function D({column:e,onClose:a}){const n=e.getFilterValue(),[s,r]=i.useState(n?.start?n.start.toISOString().split("T")[0]:""),[o,l]=i.useState(n?.end?n.end.toISOString().split("T")[0]:""),f=i.useRef(null),p=i.useRef(null);i.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]);const u=()=>{const c=s?new Date(s):void 0,F=o?new Date(o):void 0;c!==void 0||F!==void 0?e.setFilterValue({start:c,end:F}):e.setFilterValue(void 0),a?.()},d=()=>{r(""),l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:u,onClear:d,children:t.jsxs(g,{ref:f,tabIndex:0,sx:{display:"flex",flexDirection:"column",gap:1,outline:"none","&:focus":{outline:"none"}},children:[t.jsx(h.default,{type:"date",value:s,ref:p,onChange:c=>r(c.target.value),onKeyDown:c=>{c.key==="Enter"&&u()},size:"sm",slotProps:{input:{placeholder:"Start date"}},autoFocus:!0}),t.jsx(h.default,{type:"date",value:o,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&u()},size:"sm",slotProps:{input:{placeholder:"End date"}}})]})})}function q({column:e,options:a,searchable:n=!1,onClose:s}){const[r,o]=i.useState(e.getFilterValue()??""),[l,f]=i.useState(""),p=i.useRef(null),u=i.useRef(null);i.useEffect(()=>{n?p.current?.focus({preventScroll:!0}):u.current?.focus({preventScroll:!0})},[n]);const d=i.useMemo(()=>l?a.filter(x=>x.label.toLowerCase().includes(l.toLowerCase())):a,[a,l]),c=()=>{e.setFilterValue(r||void 0),s?.()},F=()=>{o(""),f(""),e.setFilterValue(void 0)};return t.jsxs(v,{column:e,onApply:c,onClear:F,children:[n&&t.jsx(h.default,{slotProps:{input:{ref:p}},placeholder:"Search...",value:l,onChange:x=>f(x.target.value),size:"sm"}),t.jsxs(C.default,{ref:u,component:"ul",size:"sm",role:"group",tabIndex:0,sx:{maxHeight:n?"200px":"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:[d.map(x=>t.jsx(y.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(T,{value:x.value,label:x.label,size:"sm",checked:r===x.value,onChange:A=>o(A.target.value),sx:{width:"100%"}})},x.value)),d.length===0&&t.jsx(y.default,{component:"li",sx:{color:"text.tertiary"},children:"No options match"})]})]})}function z({column:e,options:a,onClose:n}){const[s,r]=i.useState(e.getFilterValue()??[]),o=i.useRef(null);i.useEffect(()=>{o.current?.focus()},[]);const l=u=>{r(d=>d.includes(u)?d.filter(c=>c!==u):[...d,u])},f=()=>{e.setFilterValue(s.length>0?s:void 0),n?.()},p=()=>{r([]),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:f,onClear:p,children:t.jsx(C.default,{ref:o,component:"ul",size:"sm",tabIndex:0,role:"group",sx:{maxHeight:"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:a.map(u=>t.jsx(y.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(L,{label:u.label,checked:s.includes(u.value),onChange:()=>l(u.value),size:"sm",sx:{width:"100%"}},u.value)},u.value))})})}const R={text:b,textarea:V,number:w,date:D,select:q,multiselect:z};function $({column:e,filterType:a="text",filterOptions:n=[],filterSearchable:s}){const[r,o]=i.useState(!1),l=()=>{o(!1)},f=R[a];return t.jsxs(E,{open:r,onOpenChange:(p,u)=>o(u),children:[t.jsx(K,{badgeContent:"",invisible:!e.getIsFiltered(),color:"primary",variant:"solid",size:"sm",sx:{"& .MuiBadge-badge":{minWidth:"8px",height:"8px",padding:0,borderRadius:"50%"}},children:t.jsx(B.default,{"aria-label":`${e.getIsFiltered()?"Filtered":"Filter"} by ${S(e)}`,slots:{root:O.default},slotProps:{root:{size:"sm",variant:e.getIsFiltered()?"solid":"plain",color:e.getIsFiltered()?"primary":"neutral",sx:{minWidth:"24px",minHeight:"24px",maxWidth:"24px",maxHeight:"24px",width:"24px",height:"24px",padding:"4px",flex:"0 0 auto","& svg":{color:e.getIsFiltered()?"var(--palette-common-white)":"inherit"}}}},children:t.jsx(H,{icon:I.faFilter,size:"xs"})})}),t.jsx(k,{placement:"bottom-start",children:t.jsx(f,{column:e,onClose:l,options:n,searchable:s})})]})}exports.ColumnFilter=$;exports.DateFilter=D;exports.MultiSelectFilter=z;exports.NumericFilter=w;exports.SelectFilter=q;exports.TextAreaFilter=V;exports.TextFilter=b;exports.filterComponentMap=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(e).toLowerCase(),u=String(r).toLowerCase();return t.includes(u)},a=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(r).split(/[\n,]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);if(t.length===0)return!0;const u=String(e).toLowerCase();return t.some(n=>u.includes(n))},o=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=Number(e);if(Number.isNaN(t))return!1;const{min:u,max:n}=r;return u!==void 0&&n!==void 0?t>=u&&t<=n:u!==void 0?t>=u:n!==void 0?t<=n:!0},c=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return!1;const{start:u,end:n}=r;return u&&n?t>=u&&t<=n:u?t>=u:n?t<=n:!0},f=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(e);return Array.isArray(r)?r.length===0||r.includes(t):r?t===r:!0},g=(i,l,r)=>{if(!Array.isArray(r)||r.length===0)return!0;const e=i.getValue(l);return e==null?!1:r.includes(String(e))};exports.dateFilter=c;exports.multiSelectFilter=g;exports.numericFilter=o;exports.selectFilter=f;exports.textFilter=s;exports.textareaFilter=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),ae=require("../../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.cjs"),n=require("react"),z=require("../../../../hooks/useLocalStorage.cjs"),U=require("../../../inputs/Checkbox/Checkbox.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),ae=require("../../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.cjs"),n=require("react"),z=require("../../../../hooks/useLocalStorage.cjs"),U=require("../../../inputs/Checkbox/Checkbox.cjs"),u=require("../filters/filterFunctions.cjs"),a=require("../tableUrlUtils.cjs"),ge=require("./useInfiniteScroll.cjs"),M=require("../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.cjs");function fe({table:i}){return P.jsx(U,{checked:i.getIsAllRowsSelected(),indeterminate:i.getIsSomeRowsSelected(),onChange:l=>i.toggleAllRowsSelected(l.target.checked),size:"md"})}function de({row:i}){return P.jsx(U,{checked:i.getIsSelected(),disabled:!i.getCanSelect(),onChange:l=>i.toggleSelected(l.target.checked),size:"md"})}function me({id:i,loading:l=!1,reactTableOptions:t,gridCheckboxes:m=!1,allSelected:b=!1,onSelectionChange:V,infiniteScroll:c,syncUrl:g=!1,urlParamPrefix:f="",initialWrapText:$=!1}){const{columns:r}=t,A=n.useRef(a.extractColumnFilterTypes(r)),[k,G]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseSortingFromUrl(e,f)}return[]}),[p,W]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseFiltersFromUrl(e,f,A.current)}return[]}),[S,q]=z.useLocalStorage(`table.${i}.wrapText`,$),K=n.useCallback(()=>{q(!S)},[S,q]),[_,J]=z.useLocalStorage(`table.${i}.columnSizing`,{}),Q=n.useRef(r),h=n.useMemo(()=>{const e={};return Q.current.forEach(s=>{const o=s.id??s.accessorKey;o&&s.meta?.hidden&&(e[o]=!1)}),e},[]),[C,d]=z.useLocalStorage(`table.${i}.columnVisibility`,h),X=n.useCallback(()=>{d(h)},[h,d]),Y=n.useCallback(e=>{d(typeof e=="function"?e(C):e)},[C,d]),[Z,T]=n.useState({}),O=n.useCallback(e=>{T(s=>{const o=typeof e=="function"?e(s):e;return V?.(o),o})},[V]),E=n.useRef(null),R=n.useRef(t.data),ee=l&&R.current.length>0?R.current:t.data;n.useEffect(()=>{!l&&t.data.length>0&&(R.current=t.data)},[l,t.data]);const w=n.useRef(null),te=n.useRef(null),ne=n.useMemo(()=>{const e=[],s=[];return r.forEach(o=>{o.meta?.pinned==="left"&&o.id?e.push(o.id):o.meta?.pinned==="right"&&o.id&&s.push(o.id)}),{left:e,right:s}},[r]),oe=n.useMemo(()=>{let e=[...r];return e=e.map(s=>{const o=s.meta?.filterType;if(o&&!s.filterFn){const x={text:u.textFilter,textarea:u.textareaFilter,number:u.numericFilter,date:u.dateFilter,select:u.selectFilter,multiselect:u.multiSelectFilter};return{...s,filterFn:x[o]}}return s}),m&&(e=[{id:"select",size:32,enableSorting:!1,enableResizing:!1,meta:{noSortButton:!0},header:fe,cell:de},...e]),e},[m,r]),F=ae.useReactTable({columnResizeDirection:"ltr",defaultColumn:{size:200,minSize:20,maxSize:500},...t,getCoreRowModel:M.getCoreRowModel(),getSortedRowModel:M.getSortedRowModel(),getFilteredRowModel:M.getFilteredRowModel(),columns:oe,data:ee,enableSorting:t.enableSorting??!0,enableColumnResizing:t.enableColumnResizing??!0,columnResizeMode:t.columnResizeMode??"onChange",onColumnSizingChange:t.onColumnSizingChange??J,onSortingChange:t.onSortingChange??G,onColumnFiltersChange:t.onColumnFiltersChange??W,onColumnVisibilityChange:t.onColumnVisibilityChange??Y,enableRowSelection:m,onRowSelectionChange:t.onRowSelectionChange??O,state:{...t.state,rowSelection:t.state?.rowSelection??Z,sorting:t.state?.sorting??k,columnFilters:t.state?.columnFilters??p,columnSizing:_,columnPinning:ne,columnVisibility:t.state?.columnVisibility??C}}),{rows:v}=F.getRowModel(),{enabled:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue}=ge.useInfiniteScroll(v.length,c,w),I=c?.enabled,L=c?.hasNextPage,N=c?.isFetchingNextPage,D=c?.fetchNextPage,ce=200,y=n.useCallback(e=>{if(!e||!I)return;const{scrollHeight:s,scrollTop:o,clientHeight:x}=e;s-o-x<ce&&!N&&L&&D?.()},[I,L,N,D]);n.useEffect(()=>{y(w.current)},[y]),E.current=F,n.useEffect(()=>{E.current?.toggleAllRowsSelected(b)},[b]);const H=t.state?.sorting??k,j=t.state?.columnFilters??p,B=n.useMemo(()=>a.extractColumnFilterTypes(r),[r]);return n.useEffect(()=>{!g||typeof window>"u"||a.syncStateToUrl(H,j,f,B)},[g,H,j,f,B]),{id:i,table:F,rows:v,isVirtual:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue,wrapperRef:w,toolbarRef:te,loading:l,fetchMoreOnBottomReached:y,resetColumnVisibility:X,wrapText:S,toggleWrapText:K}}exports.useDataGrid=me;
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
-webkit-line-clamp: 3;
|
|
62
62
|
-webkit-box-orient: vertical;
|
|
63
63
|
white-space: normal;
|
|
64
|
-
font-size: 0.75rem;
|
|
65
64
|
`,h=t.div`
|
|
66
65
|
display: flex;
|
|
67
66
|
align-items: center;
|
|
@@ -80,4 +79,4 @@
|
|
|
80
79
|
align-items: flex-start;
|
|
81
80
|
z-index: 1;
|
|
82
81
|
padding-top: 10%;
|
|
83
|
-
`,b=(e,o,n,a,r)=>({...e,tableLayout:"fixed",width:"100%",minWidth:`${o}px`,"& thead":{transition:"opacity 0.1s"},"& thead th":{backgroundColor:"background.body",fontWeight:"bold",fontSize:"
|
|
82
|
+
`,b=(e,o,n,a,r)=>({...e,tableLayout:"fixed",width:"100%",minWidth:`${o}px`,"& thead":{transition:"opacity 0.1s"},"& thead th":{backgroundColor:"background.body",fontWeight:"bold",fontSize:"0.75rem",verticalAlign:"middle",position:"sticky",zIndex:1,top:!r&&a?"var(--header-top, 0px)":0},"& tfoot":{position:"sticky",zIndex:1,bottom:0},"& td, & td>div, & td>a":{whiteSpace:n?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle"},"& th[data-pinned='right'], & td[data-pinned='right']":{position:"sticky",right:0,background:"var(--palette-background-surface)",boxShadow:"-2px 0 4px rgba(0, 0, 0, 0.08)","&::before":{content:'""',position:"absolute",top:0,left:"-10px",width:"10px",height:"100%",background:"linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='right']":{background:"var(--palette-background-surface)"},"& th[data-pinned='left'], & td[data-pinned='left']":{position:"sticky",left:0,background:"var(--palette-background-surface)",boxShadow:"2px 0 4px rgba(0, 0, 0, 0.08)","&::after":{content:'""',position:"absolute",top:0,right:"-10px",width:"10px",height:"100%",background:"linear-gradient(to left, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='left']":{background:"var(--palette-background-surface)",zIndex:2},"& .resizer":{position:"absolute",right:0,top:0,height:"100%",width:"3px",background:"var(--palette-primary-500)",cursor:"col-resize",userSelect:"none",touchAction:"none",zIndex:1,"@media (hover: hover)":{opacity:0}},"& .resizer.isResizing":{background:"var(--palette-primary-500)",opacity:1},"& *:hover > .resizer":{"@media (hover: hover)":{opacity:1}},"& th button":{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:"2px",position:"relative",border:"none",cursor:"pointer",padding:0,textAlign:"left",fontWeight:"inherit",fontSize:"inherit",width:"100%",whiteSpace:"wrap",height:"100%",flex:0,"& i.fade":{opacity:0,transition:"opacity 0.2s ease-in-out"},"&:hover i.fade":{opacity:.5}}});exports.ColumnHeaderContainer=s;exports.HeaderContent=h;exports.HeaderLabel=c;exports.LoadingOverlay=g;exports.SortButton=i;exports.SortIcon=p;exports.TableWrapper=l;exports.getTableStyles=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react");function H({enabled:y,stickyHeaderOffset:h,tableWrapperRef:v,theadRef:a,toolbarRef:m}){const[w,p]=n.useState(!1),c=n.useRef(!1),t=n.useRef(null),l=n.useRef(!1),S=n.useRef(0),u=n.useRef(0);return n.useEffect(()=>{if(!y){p(!1),c.current=!1;const e=a.current;e&&(e.style.setProperty("--header-top","0px"),e.style.opacity="1");return}const i=v.current,r=a.current,f=m.current;if(!i||!r)return;u.current=f?.offsetHeight??0;const s=()=>{const T=r.getBoundingClientRect().top,g=h+u.current;if(T<=g){l.current||(l.current=!0,r.style.opacity="0"),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{l.current=!1,r.style.opacity="1"},150);const E=g-T;r.style.setProperty("--header-top",`${E}px`),c.current||(c.current=!0,p(!0))}else r.style.opacity="1",l.current=!1,t.current&&clearTimeout(t.current),r.style.setProperty("--header-top","0px"),c.current&&(c.current=!1,p(!1))};s(),window.addEventListener("scroll",s,{passive:!0});const R=()=>{const e=i.scrollTop;e!==S.current&&(S.current=e,s())};i.addEventListener("scroll",R,{passive:!0});let d,o=null;return f&&typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{o===null&&(o=requestAnimationFrame(()=>{o=null;const e=f.offsetHeight;e!==u.current&&(u.current=e,s())}))}),d.observe(f)),()=>{window.removeEventListener("scroll",s),i.removeEventListener("scroll",R),d?.disconnect(),o!==null&&cancelAnimationFrame(o),t.current&&clearTimeout(t.current)}},[y,h,v,a,m]),w}exports.useStickyHeader=H;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import x from "react";
|
|
3
|
+
import o from "styled-components";
|
|
4
|
+
import m from "../Typography/Typography.js";
|
|
5
|
+
import u from "./ExportToExcelButton.js";
|
|
6
|
+
import g from "./FilterChipsSection.js";
|
|
7
|
+
import w from "./ManageColumnsDropdown.js";
|
|
8
8
|
import T from "./TableSettingsDropdown.js";
|
|
9
|
-
import
|
|
10
|
-
const
|
|
9
|
+
import l from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
|
|
10
|
+
const y = o(l)`
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: 8px;
|
|
@@ -18,54 +18,77 @@ const w = r(o)`
|
|
|
18
18
|
position: sticky;
|
|
19
19
|
top: 0;
|
|
20
20
|
z-index: 1;
|
|
21
|
-
`,
|
|
21
|
+
`, b = o(l)`
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: center;
|
|
24
24
|
justify-content: space-between;
|
|
25
|
+
gap: 8px;
|
|
25
26
|
width: 100%;
|
|
27
|
+
/* Allow the start/end groups to wrap onto separate lines when they
|
|
28
|
+
no longer fit side by side (e.g. many filters on a narrow viewport). */
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
`, s = o(l)`
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
/* min-width: 0 lets the group shrink below its content width so children
|
|
35
|
+
(filter chips) can wrap or ellipsis instead of overflowing the toolbar. */
|
|
36
|
+
min-width: 0;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
`, R = o(s)`
|
|
39
|
+
flex: 1 1 auto;
|
|
40
|
+
`, C = o(s)`
|
|
41
|
+
flex: 0 0 auto;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
|
|
44
|
+
/* On small screens, drop the controls onto their own full-width line. */
|
|
45
|
+
@media (max-width: 768px) {
|
|
46
|
+
flex: 1 1 100%;
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
}
|
|
26
49
|
`;
|
|
27
|
-
function
|
|
50
|
+
function S({
|
|
28
51
|
toolbar: e,
|
|
29
52
|
columnFilters: i,
|
|
30
53
|
table: n,
|
|
31
|
-
resetColumnVisibility:
|
|
32
|
-
wrapText:
|
|
33
|
-
onWrapTextToggle:
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
return /* @__PURE__ */ t(
|
|
37
|
-
/* @__PURE__ */
|
|
54
|
+
resetColumnVisibility: a,
|
|
55
|
+
wrapText: p,
|
|
56
|
+
onWrapTextToggle: d
|
|
57
|
+
}, c) {
|
|
58
|
+
const f = n.getFilteredRowModel().rows.length, h = i.length > 0;
|
|
59
|
+
return /* @__PURE__ */ t(y, { ref: c, children: /* @__PURE__ */ r(b, { children: [
|
|
60
|
+
/* @__PURE__ */ r(R, { children: [
|
|
38
61
|
e.leftContent ? e.leftContent : null,
|
|
39
62
|
e.exportToExcel?.enabled && /* @__PURE__ */ t(
|
|
40
|
-
|
|
63
|
+
u,
|
|
41
64
|
{
|
|
42
65
|
onExport: e.exportToExcel.onExport,
|
|
43
66
|
disabled: e.exportToExcel.disabled
|
|
44
67
|
}
|
|
45
68
|
),
|
|
46
|
-
e.showFilterChips ? /* @__PURE__ */ t(
|
|
69
|
+
e.showFilterChips ? /* @__PURE__ */ t(g, { columnFilters: i, table: n }) : null
|
|
47
70
|
] }),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
e.totalResults !== void 0 && /* @__PURE__ */ t(
|
|
71
|
+
/* @__PURE__ */ r(C, { children: [
|
|
72
|
+
e.totalResults !== void 0 && /* @__PURE__ */ t(m, { level: "body-sm", sx: { fontWeight: 500 }, children: h ? `Showing ${f.toLocaleString()} of ${e.totalResults.toLocaleString()} results` : `Total Results: ${e.totalResults.toLocaleString()}` }),
|
|
50
73
|
e.rightContent ? e.rightContent : null,
|
|
51
74
|
e.manageColumns?.enabled && /* @__PURE__ */ t(
|
|
52
|
-
|
|
75
|
+
w,
|
|
53
76
|
{
|
|
54
77
|
table: n,
|
|
55
|
-
onReset:
|
|
78
|
+
onReset: a
|
|
56
79
|
}
|
|
57
80
|
),
|
|
58
81
|
e.tableSettings?.enabled && /* @__PURE__ */ t(
|
|
59
82
|
T,
|
|
60
83
|
{
|
|
61
|
-
wrapText:
|
|
62
|
-
onWrapTextToggle:
|
|
84
|
+
wrapText: p,
|
|
85
|
+
onWrapTextToggle: d
|
|
63
86
|
}
|
|
64
87
|
)
|
|
65
88
|
] })
|
|
66
89
|
] }) });
|
|
67
90
|
}
|
|
68
|
-
const
|
|
91
|
+
const B = x.forwardRef(S);
|
|
69
92
|
export {
|
|
70
|
-
|
|
93
|
+
B as default
|
|
71
94
|
};
|