@gp-grid/react 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.js +1 -1
- package/dist/styles.css +249 -86
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<a href="https://www.gp-grid.io">
|
|
5
5
|
<picture>
|
|
6
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://
|
|
7
|
-
<source media="(prefers-color-scheme: light)" srcset="https://
|
|
8
|
-
<img width="50%" alt="
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://www.gp-grid.io/logo-light.svg"/>
|
|
7
|
+
<source media="(prefers-color-scheme: light)" srcset="https://www.gp-grid.io/logo-dark.svg"/>
|
|
8
|
+
<img width="50%" alt="gp-grid Logo" src="https://www.gp-grid.io/logo-dark.svg"/>
|
|
9
9
|
</picture>
|
|
10
10
|
</a>
|
|
11
11
|
<div align="center">
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useCallback as t,useEffect as n,useLayoutEffect as r,useMemo as i,useReducer as a,useRef as o,useState as s}from"react";import{GridCore as c,GridCore as l,applyInstruction as u,buildCellClasses as d,calculateFillHandlePosition as f,calculateFilterPopupPosition as p,calculateScaledColumnPositions as m,createClientDataSource as h,createClientDataSource as g,createDataSourceFromArray as _,createDataSourceFromArray as v,createInitialState as y,createInitialState as b,createMutableClientDataSource as x,createMutableClientDataSource as S,createServerDataSource as C,formatCellValue as w,getFieldValue as T,getFieldValue as E,getTotalWidth as D,isCellActive as O,isCellEditing as k,isCellInFillPreview as A,isCellSelected as j,scrollCellIntoView as ee}from"@gp-grid/core";import{Fragment as M,jsx as N,jsxs as P}from"react/jsx-runtime";const F=[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Is not blank`}];function I({distinctValues:e,valueFormatter:n,currentFilter:r,onApply:a,onClose:o}){let c=t(e=>n?n(e):Array.isArray(e)?e.join(`, `):String(e??``),[n]),l=t(e=>c(e),[c]),u=i(()=>{let t=new Set,n=[];for(let r of e){if(r==null||r===``||Array.isArray(r)&&r.length===0)continue;let e=c(r);t.has(e)||(t.add(e),n.push({key:e,label:l(r)}))}return n.sort((e,t)=>{let n=parseFloat(e.label),r=parseFloat(t.label);return!isNaN(n)&&!isNaN(r)?n-r:e.label.localeCompare(t.label,void 0,{numeric:!0,sensitivity:`base`})}),n},[e,c,l]),d=u.length>100,[f,p]=s(i(()=>{if(!r?.conditions[0])return d?`condition`:`values`;let e=r.conditions[0];return e.selectedValues&&e.selectedValues.size>0?`values`:`condition`},[r,d])),m=i(()=>r?.conditions[0]?r.conditions[0].selectedValues??new Set:new Set,[r]),h=i(()=>r?.conditions[0]?r.conditions[0].includeBlank??!0:!0,[r]),[g,_]=s(``),[v,y]=s(m),[b,x]=s(h),[S,C]=s(i(()=>{if(!r?.conditions.length)return[{operator:`contains`,value:``,nextOperator:`and`}];let e=r.conditions[0];if(e.selectedValues&&e.selectedValues.size>0)return[{operator:`contains`,value:``,nextOperator:`and`}];let t=r.combination??`and`;return r.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value??``,nextOperator:n.nextOperator??t}})},[r])),w=i(()=>{if(!g)return u;let e=g.toLowerCase();return u.filter(t=>t.label.toLowerCase().includes(e))},[u,g]),T=i(()=>e.some(e=>e==null||e===``),[e]),E=i(()=>w.every(e=>v.has(e.key))&&(!T||b),[w,v,T,b]),D=t(()=>{y(new Set(w.map(e=>e.key))),T&&x(!0)},[w,T]),O=t(()=>{y(new Set),x(!1)},[]),k=t(e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),A=t((e,t)=>{C(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),j=t(()=>{C(e=>[...e,{operator:`contains`,value:``,nextOperator:`and`}])},[]),ee=t(e=>{C(t=>t.filter((t,n)=>n!==e))},[]),I=t(()=>{if(f===`values`){if(u.every(e=>v.has(e.key))&&(!T||b)){a(null);return}a({conditions:[{type:`text`,operator:`equals`,selectedValues:v,includeBlank:b}],combination:`and`})}else{let e=S.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.value.trim()!==``);if(e.length===0){a(null);return}a({conditions:e.map(e=>({type:`text`,operator:e.operator,value:e.value,nextOperator:e.nextOperator})),combination:`and`})}},[f,u,v,b,T,S,a]),L=t(()=>{a(null)},[a]);return P(`div`,{className:`gp-grid-filter-content gp-grid-filter-text`,children:[!d&&P(`div`,{className:`gp-grid-filter-mode-toggle`,children:[N(`button`,{type:`button`,className:f===`values`?`active`:``,onClick:()=>p(`values`),children:`Values`}),N(`button`,{type:`button`,className:f===`condition`?`active`:``,onClick:()=>p(`condition`),children:`Condition`})]}),d&&f===`condition`&&P(`div`,{className:`gp-grid-filter-info`,children:[`Too many unique values (`,u.length,`). Use conditions to filter.`]}),f===`values`&&P(M,{children:[N(`input`,{className:`gp-grid-filter-search`,type:`text`,placeholder:`Search...`,value:g,onChange:e=>_(e.target.value),autoFocus:!0}),P(`div`,{className:`gp-grid-filter-actions`,children:[N(`button`,{type:`button`,onClick:D,disabled:E,children:`Select All`}),N(`button`,{type:`button`,onClick:O,children:`Deselect All`})]}),P(`div`,{className:`gp-grid-filter-list`,children:[T&&P(`label`,{className:`gp-grid-filter-option`,children:[N(`input`,{type:`checkbox`,checked:b,onChange:()=>x(!b)}),N(`span`,{className:`gp-grid-filter-blank`,children:`(Blanks)`})]}),w.map(e=>P(`label`,{className:`gp-grid-filter-option`,children:[N(`input`,{type:`checkbox`,checked:v.has(e.key),onChange:()=>k(e.key)}),N(`span`,{children:e.label})]},e.key))]})]}),f===`condition`&&P(M,{children:[S.map((e,t)=>P(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&P(`div`,{className:`gp-grid-filter-combination`,children:[N(`button`,{type:`button`,className:S[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>A(t-1,{nextOperator:`and`}),children:`AND`}),N(`button`,{type:`button`,className:S[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>A(t-1,{nextOperator:`or`}),children:`OR`})]}),P(`div`,{className:`gp-grid-filter-row`,children:[N(`select`,{value:e.operator,onChange:e=>A(t,{operator:e.target.value}),autoFocus:t===0,children:F.map(e=>N(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&N(`input`,{type:`text`,value:e.value,onChange:e=>A(t,{value:e.target.value}),placeholder:`Value`,className:`gp-grid-filter-text-input`}),S.length>1&&N(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>ee(t),children:`×`})]})]},t)),N(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:j,children:`+ Add condition`})]}),P(`div`,{className:`gp-grid-filter-buttons`,children:[N(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:L,children:`Clear`}),N(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:I,children:`Apply`})]})]})}const L=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`>=`,label:`≥`},{value:`<=`,label:`≤`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}];function R({currentFilter:e,onApply:n,onClose:r}){let[a,o]=s(i(()=>{if(!e?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let t=e.combination??`and`;return e.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value==null?``:String(n.value),valueTo:n.valueTo==null?``:String(n.valueTo),nextOperator:n.nextOperator??t}})},[e])),c=t((e,t)=>{o(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),l=t(()=>{o(e=>[...e,{operator:`=`,value:``,valueTo:``,nextOperator:`and`}])},[]),u=t(e=>{o(t=>t.filter((t,n)=>n!==e))},[]),d=t(()=>{let e=a.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){n(null);return}n({conditions:e.map(e=>({type:`number`,operator:e.operator,value:e.value?parseFloat(e.value):void 0,valueTo:e.valueTo?parseFloat(e.valueTo):void 0,nextOperator:e.nextOperator})),combination:`and`})},[a,n]),f=t(()=>{n(null)},[n]);return P(`div`,{className:`gp-grid-filter-content gp-grid-filter-number`,children:[a.map((e,t)=>P(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&P(`div`,{className:`gp-grid-filter-combination`,children:[N(`button`,{type:`button`,className:a[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>c(t-1,{nextOperator:`and`}),children:`AND`}),N(`button`,{type:`button`,className:a[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>c(t-1,{nextOperator:`or`}),children:`OR`})]}),P(`div`,{className:`gp-grid-filter-row`,children:[N(`select`,{value:e.operator,onChange:e=>c(t,{operator:e.target.value}),children:L.map(e=>N(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&N(`input`,{type:`number`,value:e.value,onChange:e=>c(t,{value:e.target.value}),placeholder:`Value`}),e.operator===`between`&&P(M,{children:[N(`span`,{className:`gp-grid-filter-to`,children:`to`}),N(`input`,{type:`number`,value:e.valueTo,onChange:e=>c(t,{valueTo:e.target.value}),placeholder:`Value`})]}),a.length>1&&N(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>u(t),children:`×`})]})]},t)),N(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:l,children:`+ Add condition`}),P(`div`,{className:`gp-grid-filter-buttons`,children:[N(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:f,children:`Clear`}),N(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:d,children:`Apply`})]})]})}const z=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}];function B(e){if(!e)return``;let t=typeof e==`string`?new Date(e):e;return isNaN(t.getTime())?``:t.toISOString().split(`T`)[0]}function te({currentFilter:e,onApply:n,onClose:r}){let[a,o]=s(i(()=>{if(!e?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let t=e.combination??`and`;return e.conditions.map(e=>{let n=e;return{operator:n.operator,value:B(n.value),valueTo:B(n.valueTo),nextOperator:n.nextOperator??t}})},[e])),c=t((e,t)=>{o(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),l=t(()=>{o(e=>[...e,{operator:`=`,value:``,valueTo:``,nextOperator:`and`}])},[]),u=t(e=>{o(t=>t.filter((t,n)=>n!==e))},[]),d=t(()=>{let e=a.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){n(null);return}n({conditions:e.map(e=>({type:`date`,operator:e.operator,value:e.value||void 0,valueTo:e.valueTo||void 0,nextOperator:e.nextOperator})),combination:`and`})},[a,n]),f=t(()=>{n(null)},[n]);return P(`div`,{className:`gp-grid-filter-content gp-grid-filter-date`,children:[a.map((e,t)=>P(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&P(`div`,{className:`gp-grid-filter-combination`,children:[N(`button`,{type:`button`,className:a[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>c(t-1,{nextOperator:`and`}),children:`AND`}),N(`button`,{type:`button`,className:a[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>c(t-1,{nextOperator:`or`}),children:`OR`})]}),P(`div`,{className:`gp-grid-filter-row`,children:[N(`select`,{value:e.operator,onChange:e=>c(t,{operator:e.target.value}),children:z.map(e=>N(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&N(`input`,{type:`date`,value:e.value,onChange:e=>c(t,{value:e.target.value})}),e.operator===`between`&&P(M,{children:[N(`span`,{className:`gp-grid-filter-to`,children:`to`}),N(`input`,{type:`date`,value:e.valueTo,onChange:e=>c(t,{valueTo:e.target.value})})]}),a.length>1&&N(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>u(t),children:`×`})]})]},t)),N(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:l,children:`+ Add condition`}),P(`div`,{className:`gp-grid-filter-buttons`,children:[N(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:f,children:`Clear`}),N(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:d,children:`Apply`})]})]})}function ne({column:e,colIndex:i,containerRef:a,distinctValues:c,currentFilter:l,onApply:u,onClose:d}){let f=o(null),[m,h]=s({position:`fixed`,zIndex:1e4,visibility:`hidden`}),g=t(()=>{let e=a.current,t=f.current;if(!e||!t)return;let n=e.querySelector(`[data-col-index="${i}"]`);if(!n)return;let r=p(n,t);h({position:`fixed`,top:r.top,left:r.left,minWidth:r.minWidth,zIndex:1e4,visibility:`visible`})},[a,i]);r(()=>{g()},[g]),n(()=>{let e=null,t=()=>{e===null&&(e=requestAnimationFrame(()=>{e=null,g()}))};return window.addEventListener(`scroll`,t,{passive:!0,capture:!0}),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,t),e!==null&&cancelAnimationFrame(e)}},[g]),n(()=>{let e=e=>{let t=e.target;t.closest(`.gp-grid-filter-icon`)||f.current&&!f.current.contains(t)&&d()},t=e=>{e.key===`Escape`&&d()};return requestAnimationFrame(()=>{document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t)}),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[d]);let _=t(t=>{u(e.colId??e.field,t),d()},[e,u,d]),v=e.cellDataType,y=v===`text`||v===`object`,b=v===`number`,x=v===`date`||v===`dateString`||v===`dateTime`||v===`dateTimeString`;return P(`div`,{ref:f,className:`gp-grid-filter-popup`,style:m,children:[P(`div`,{className:`gp-grid-filter-header`,children:[`Filter: `,e.headerName??e.field]}),y&&N(I,{distinctValues:c,valueFormatter:e.valueFormatter,currentFilter:l,onApply:_,onClose:d}),b&&N(R,{currentFilter:l,onApply:_,onClose:d}),x&&N(te,{currentFilter:l,onApply:_,onClose:d}),!y&&!b&&!x&&N(I,{distinctValues:c,valueFormatter:e.valueFormatter,currentFilter:l,onApply:_,onClose:d})]})}function re(e){let{column:t,colIndex:n,sortDirection:r,sortIndex:i,sortable:a,filterable:o,hasFilter:s,coreRef:c,containerRef:l,headerRenderers:u,globalHeaderRenderer:d}=e,f=c.current,p={column:t,colIndex:n,sortDirection:r,sortIndex:i,sortable:a,filterable:o,hasFilter:s,onSort:(e,n)=>{f&&a&&f.setSort(t.colId??t.field,e,n)},onFilterClick:()=>{if(f&&o){let e=l.current?.querySelector(`[data-col-index="${n}"]`);if(e){let t=e.getBoundingClientRect();f.openFilterPopup(n,{top:t.top,left:t.left,width:t.width,height:t.height})}}}};if(t.headerRenderer){if(typeof t.headerRenderer==`function`)return t.headerRenderer(p);let e=u[t.headerRenderer];if(e)return e(p)}return d?d(p):P(M,{children:[N(`span`,{className:`gp-grid-header-text`,children:t.headerName??t.field}),P(`span`,{className:`gp-grid-header-icons`,children:[a&&P(`span`,{className:`gp-grid-sort-arrows`,children:[P(`span`,{className:`gp-grid-sort-arrows-stack`,children:[N(`svg`,{className:`gp-grid-sort-arrow-up${r===`asc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`,children:N(`path`,{d:`M4 0L8 6H0L4 0Z`,fill:`currentColor`})}),N(`svg`,{className:`gp-grid-sort-arrow-down${r===`desc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`,children:N(`path`,{d:`M4 6L0 0H8L4 6Z`,fill:`currentColor`})})]}),i!==void 0&&i>0&&N(`span`,{className:`gp-grid-sort-index`,children:i})]}),o&&N(`span`,{className:`gp-grid-filter-icon${s?` active`:``}`,onPointerDown:e=>{e.stopPropagation(),e.preventDefault(),p.onFilterClick()},onClick:e=>{e.stopPropagation()},children:N(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,children:N(`path`,{d:`M4 4h16l-6 8v5l-4 2v-7L4 4z`})})})]})]})}const ie=e=>{let{headerHeight:t,scrollLeft:n,contentWidth:r,totalWidth:i,isLoading:a,visibleColumnsWithIndices:o,columnPositions:s,columnWidths:c,headers:l,sortingEnabled:u,onHeaderMouseDown:d,onHeaderResizeMouseDown:f,coreRef:p,outerContainerRef:m,headerRenderers:h,globalHeaderRenderer:g}=e;return N(`div`,{className:`gp-grid-header${a?` gp-grid-header--loading`:``}`,style:{height:t},children:N(`div`,{style:{position:`absolute`,top:0,left:0,transform:`translateX(${-n}px)`,width:Math.max(r,i),height:t},children:o.map(({column:e,originalIndex:n},r)=>{let i=l.get(n),a=c[r]??0;return P(`div`,{className:`gp-grid-header-cell`,"data-col-index":n,style:{left:`${s[r]}px`,width:`${a}px`,height:`${t}px`},onPointerDown:e=>d(n,a,t,e),children:[re({column:e,colIndex:n,sortDirection:i?.sortDirection,sortIndex:i?.sortIndex,sortable:e.sortable!==!1&&u,filterable:e.filterable!==!1,hasFilter:i?.hasFilter??!1,coreRef:p,containerRef:m,headerRenderers:h,globalHeaderRenderer:g}),e.resizable!==!1&&N(`div`,{className:`gp-grid-header-resize-handle`,onPointerDown:e=>{e.stopPropagation(),f(n,a,e)}})]},e.colId??e.field)})})})};function ae(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,isActive:a,isSelected:o,isEditing:s,cellRenderers:c,globalCellRenderer:l}=e,u=T(n,t.field),d={value:t.valueFormatter?t.valueFormatter(u):u,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:a,isSelected:o,isEditing:s};if(t.cellRenderer){if(typeof t.cellRenderer==`function`)return t.cellRenderer(d);let e=c[t.cellRenderer];if(e)return e(d)}return l?l(d):w(u,t.valueFormatter)}function V(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,initialValue:a,coreRef:o,editRenderers:s,globalEditRenderer:c}=e,l=o.current;if(!l)return null;let u=E(n,t.field),d={value:t.valueFormatter?t.valueFormatter(u):u,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:!0,isSelected:!0,isEditing:!0,initialValue:a,onValueChange:e=>l.updateEditValue(e),onCommit:()=>l.commitEdit(),onCancel:()=>l.cancelEdit()};if(t.editRenderer){if(typeof t.editRenderer==`function`)return t.editRenderer(d);let e=s[t.editRenderer];if(e)return e(d)}return c?c(d):N(`input`,{className:`gp-grid-edit-input`,type:`text`,defaultValue:a==null?``:String(a),autoFocus:!0,onFocus:e=>e.target.select(),onChange:e=>l.updateEditValue(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?l.commitEdit():e.key===`Escape`?l.cancelEdit():e.key===`Tab`&&(e.preventDefault(),l.commitEdit(),l.selection.moveFocus(e.shiftKey?`left`:`right`,!1))},onBlur:()=>l.commitEdit()})}const oe=e.forwardRef((e,t)=>{let{rowHeight:n,totalHeaderHeight:r,contentWidth:i,contentHeight:a,totalWidth:o,rowsWrapperOffset:s,activeCell:c,selectionRange:l,editingCell:u,error:f,isLoading:p,totalRows:m,slotsArray:h,visibleColumnsWithIndices:g,columnPositions:_,columnWidths:v,fillHandlePosition:y,dragState:b,onScroll:x,onCellMouseDown:S,onCellDoubleClick:C,onCellMouseEnter:w,onCellMouseLeave:T,onFillHandleMouseDown:E,coreRef:D,cellRenderers:ee,editRenderers:M,globalCellRenderer:F,globalEditRenderer:I}=e;return P(`div`,{ref:t,style:{flex:1,overflow:`auto`,position:`relative`},onScroll:x,children:[N(`div`,{style:{width:Math.max(i,o),height:Math.max(a-r,0),position:`relative`,minWidth:`100%`},children:P(`div`,{className:`gp-grid-rows-wrapper`,style:{width:`${Math.max(i,o)}px`,transform:`translateY(${s}px)`},children:[h.map(e=>e.rowIndex<0?null:N(`div`,{className:[`gp-grid-row`,...D.current?.highlight?.computeRowClasses(e.rowIndex,e.rowData)??[]].filter(Boolean).join(` `),style:{position:`absolute`,top:0,left:0,transform:`translateY(${e.translateY}px)`,width:`${Math.max(i,o)}px`,height:`${n}px`},children:g.map(({column:t,originalIndex:r},i)=>{let a=k(e.rowIndex,r,u),o=O(e.rowIndex,r,c),s=j(e.rowIndex,r,l),f=d(o,s,a,A(e.rowIndex,r,b.dragType===`fill`,b.fillSourceRange,b.fillTarget)),p=D.current?.highlight?.computeCombinedCellClasses(e.rowIndex,r,t,e.rowData)??[],m=t.rowDrag===!0;return N(`div`,{className:[f,...p,m?`gp-grid-cell--row-drag-handle`:``].filter(Boolean).join(` `),style:{position:`absolute`,left:`${_[i]}px`,top:0,width:`${v[i]}px`,height:`${n}px`},onPointerDown:t=>S(e.rowIndex,r,t),onDoubleClick:()=>C(e.rowIndex,r),onMouseEnter:()=>w(e.rowIndex,r),onMouseLeave:T,children:a&&u?V({column:t,rowData:e.rowData,rowIndex:e.rowIndex,colIndex:r,initialValue:u.initialValue,coreRef:D,editRenderers:M,globalEditRenderer:I}):ae({column:t,rowData:e.rowData,rowIndex:e.rowIndex,colIndex:r,isActive:o,isSelected:s,isEditing:a,cellRenderers:ee,globalCellRenderer:F})},`${e.slotId}-${r}`)})},e.slotId)),y&&!u&&N(`div`,{className:`gp-grid-fill-handle`,style:{top:y.top,left:y.left},onPointerDown:E}),b.dragType===`row-drag`&&b.rowDrag?.dropTargetIndex!==null&&N(`div`,{className:`gp-grid-row-drop-indicator`,style:{transform:`translateY(${b.rowDrag.dropIndicatorY}px)`,width:`${Math.max(i,o)}px`}})]})}),f&&P(`div`,{className:`gp-grid-error`,children:[`Error: `,f]}),!p&&!f&&m===0&&N(`div`,{className:`gp-grid-empty`,children:`No data to display`})]})});function se(e,t){if(t.type===`RESET`)return y();let{instructions:n}=t;if(n.length===0)return e;let r=new Map(e.slots),i=new Map(e.headers),a={pendingScrollTop:null};for(let e of n){let t=u(e,r,i);t&&(a={...a,...t})}return{...e,...a,slots:r,headers:i}}function ce(e,r,i,a){let{activeCell:c,selectionRange:l,editingCell:u,filterPopupOpen:d,rowHeight:f,headerHeight:p,columnPositions:m,visibleColumnsWithIndices:h,slots:g,rowsWrapperOffset:_}=a,v=o(null),y=o(null),b=o(null),x=o(null),S=o(null),C=t(e=>{e.preventDefault()},[]),[w,T]=s({isDragging:!1,dragType:null,fillSourceRange:null,fillTarget:null,columnResize:null,columnMove:null,rowDrag:null});n(()=>{let t=e.current;t?.input&&t.input.updateDeps({getHeaderHeight:()=>p,getRowHeight:()=>f,getColumnPositions:()=>m,getColumnCount:()=>h.length,getOriginalColumnIndex:e=>{let t=h[e];return t?t.originalIndex:e}})},[e,p,f,m,h]);let E=t(()=>{let e=r.current;if(!e)return null;let t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}},[r]),D=t((t,n)=>{v.current&&clearInterval(v.current),v.current=setInterval(()=>{let i=r.current,a=e.current;if(i){i.scrollTop+=n,i.scrollLeft+=t;let e=y.current;if(e&&a?.input){let t=E();t&&(a.input.handleDragMove(e,t),T(a.input.getDragState()))}}},16)},[r,e,E]),O=t(()=>{v.current&&=(clearInterval(v.current),null)},[]),k=e=>({clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,pointerId:e.pointerId,pointerType:e.pointerType}),A=t(()=>{let t=t=>{t.preventDefault();let n=e.current,r=E();if(!n?.input||!r)return;let i=k(t);y.current=i;let a=n.input.handleDragMove(i,r);a&&(a.autoScroll?D(a.autoScroll.dx,a.autoScroll.dy):O(),T(n.input.getDragState()))},n=()=>{let i=e.current;i?.input&&(i.input.handleDragEnd(),T(i.input.getDragState())),y.current=null,O(),document.removeEventListener(`touchmove`,C),S.current!==null&&r.current&&(r.current.style.overflow=S.current,S.current=null),document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n),document.removeEventListener(`pointercancel`,n)};document.addEventListener(`pointermove`,t,{passive:!1}),document.addEventListener(`pointerup`,n),document.addEventListener(`pointercancel`,n)},[e,E,D,O]),j=t(()=>{b.current!==null&&(clearTimeout(b.current),b.current=null,e.current?.input?.cancelPendingRowDrag()),x.current=null},[e]),M=t((t,n,i)=>{let a=e.current;if(!a?.input)return;let o=a.input.handleCellMouseDown(t,n,k(i));if(o.focusContainer&&r.current?.focus(),o.startDrag===`selection`)a.input.startSelectionDrag(),T(a.input.getDragState()),A();else if(o.startDrag===`row-drag`)T(a.input.getDragState()),A();else if(o.startDrag===`row-drag-pending`){j(),x.current={pointerId:i.pointerId,target:i.currentTarget};let e=i.clientX,t=i.clientY,n=n=>{let r=n.clientX-e,i=n.clientY-t;(Math.abs(r)>10||Math.abs(i)>10)&&(j(),s())},o=()=>{j(),s()},s=()=>{document.removeEventListener(`pointermove`,n),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o)};document.addEventListener(`pointermove`,n),document.addEventListener(`pointerup`,o,{once:!0}),document.addEventListener(`pointercancel`,o,{once:!0}),b.current=setTimeout(()=>{b.current=null,s();let e=x.current;if(x.current=null,a.input.confirmPendingRowDrag()){if(r.current&&(S.current=r.current.style.overflow,r.current.style.overflow=`hidden`),document.addEventListener(`touchmove`,C,{passive:!1}),e)try{e.target.setPointerCapture(e.pointerId)}catch{}T(a.input.getDragState()),A()}},300)}},[e,r,A,j]),N=t((t,n)=>{let r=e.current;r?.input&&r.input.handleCellDoubleClick(t,n)},[e]),P=t(t=>{let n=e.current;if(!n?.input)return;let r=n.input.handleFillHandleMouseDown(c,l,k(t));if(r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),r.startDrag===`fill`){try{t.target.setPointerCapture(t.pointerId)}catch{}T(n.input.getDragState()),A()}},[e,c,l,A]),F=t((t,n)=>{let r=e.current;if(!r?.input)return;let a=i[t];if(!a)return;let o=a.colId??a.field;r.input.handleHeaderClick(o,n.shiftKey)},[e,i]),I=t((t,n,r,i)=>{let a=e.current;if(!a?.input)return;let o=a.input.handleHeaderMouseDown(t,n,r,k(i));if(o.preventDefault&&i.preventDefault(),o.stopPropagation&&i.stopPropagation(),o.startDrag===`column-move`){try{i.target.setPointerCapture(i.pointerId)}catch{}T(a.input.getDragState()),A()}},[e,A]),L=t((t,n,r)=>{let i=e.current;if(!i?.input)return;let a=i.input.handleHeaderResizeMouseDown(t,n,k(r));a.preventDefault&&r.preventDefault(),a.stopPropagation&&r.stopPropagation(),a.startDrag===`column-resize`&&(T(i.input.getDragState()),A())},[e,A]),R=t(t=>{let n=e.current,i=r.current;if(!n?.input)return;let a=n.input.handleKeyDown({key:t.key,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey},c,u,d);a.preventDefault&&t.preventDefault(),a.scrollToCell&&i&&ee(n,i,a.scrollToCell.row,f,g,_)},[e,r,c,u,d,f,g,_]),z=t(t=>{let n=e.current;if(!n||u!==null||d)return;let r=t.clipboardData.getData(`text/plain`);n.pasteClipboardText(r)&&t.preventDefault()},[e,u,d]),B=t((t,n)=>{let i=e.current,a=r.current;if(!i?.input||!a)return;let o=i.input.handleWheel(t.deltaY,t.deltaX,n);o&&(t.preventDefault(),a.scrollTop+=o.dy,a.scrollLeft+=o.dx)},[e,r]);return n(()=>()=>{O(),j(),document.removeEventListener(`touchmove`,C),S.current!==null&&r.current&&(r.current.style.overflow=S.current,S.current=null)},[O,j,C,r]),{handleCellMouseDown:M,handleCellDoubleClick:N,handleFillHandleMouseDown:P,handleHeaderClick:F,handleHeaderMouseDown:I,handleHeaderResizeMouseDown:L,handleKeyDown:R,handlePaste:z,handleWheel:B,dragState:w}}function H(s){let{columns:c,dataSource:u,rowData:d,rowHeight:p,headerHeight:h=p,overscan:_=3,rowLoading:y,sortingEnabled:x=!0,darkMode:S=!1,wheelDampening:C=.1,cellRenderers:w={},editRenderers:T={},headerRenderers:E={},cellRenderer:O,editRenderer:k,headerRenderer:A,initialWidth:j,initialHeight:ee,gridRef:F,highlighting:I,getRowId:L,onCellValueChanged:R,loadingComponent:z,rowDragEntireRow:B=!1,onRowDragEnd:te,onColumnResized:re,onColumnMoved:ae}=s,V=o(null),H=o(null),U=o(null),le=o(null),ue=o(!1),[W,de]=a(se,{initialWidth:j,initialHeight:ee},b),G=h,K=o(null),q=K.current;(!q||q.providedDataSource!==u||q.rowData!==d)&&(q&&d&&d.length>1e4&&console.warn(`[gp-grid] rowData prop changed with ${d.length} rows — this triggers a full rebuild. Use useGridData() for efficient updates.`),q?.ownsDataSource&&q.dataSource.destroy?.(),u?K.current={dataSource:u,ownsDataSource:!1,providedDataSource:u,rowData:d}:d?K.current={dataSource:v(d),ownsDataSource:!0,providedDataSource:u,rowData:d}:K.current={dataSource:g([]),ownsDataSource:!0,providedDataSource:u,rowData:d});let{dataSource:J}=K.current;n(()=>()=>{K.current?.ownsDataSource&&(K.current.dataSource.destroy?.(),K.current=null)},[]);let fe=o(L);fe.current=L;let pe=o(R);pe.current=R;let me=o(te);me.current=te;let he=o(re);he.current=re;let ge=o(ae);ge.current=ae;let _e=o(I);_e.current=I;let ve=o(J);ve.current=J;let Y=W.columns??c,X=i(()=>Y.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden),[Y]),{positions:Z,widths:ye}=i(()=>m(X.map(e=>e.column),W.viewportWidth),[X,W.viewportWidth]),be=D(Z),{handleCellMouseDown:xe,handleCellDoubleClick:Se,handleFillHandleMouseDown:Ce,handleHeaderMouseDown:we,handleHeaderResizeMouseDown:Te,handleKeyDown:Ee,handlePaste:De,handleWheel:Oe,dragState:Q}=ce(U,H,Y,{activeCell:W.activeCell,selectionRange:W.selectionRange,editingCell:W.editingCell,filterPopupOpen:W.filterPopup?.isOpen??!1,rowHeight:p,headerHeight:G,columnPositions:Z,visibleColumnsWithIndices:X,slots:W.slots,rowsWrapperOffset:W.rowsWrapperOffset});n(()=>{ue.current&&de({type:`RESET`}),ue.current=!0;let e=new l({columns:c,dataSource:ve.current,rowHeight:p,headerHeight:G,overscan:_,rowLoading:y,sortingEnabled:x,highlighting:_e.current,getRowId:fe.current,onCellValueChanged:pe.current?e=>pe.current?.(e):void 0,rowDragEntireRow:B,onRowDragEnd:(e,t)=>me.current?.(e,t),onColumnResized:(e,t)=>he.current?.(e,t),onColumnMoved:(e,t)=>ge.current?.(e,t)});U.current=e,e.input.updateDeps({getHeaderHeight:()=>G,getRowHeight:()=>p,getColumnPositions:()=>Z,getColumnCount:()=>X.length,getOriginalColumnIndex:e=>{let t=X[e];return t?t.originalIndex:e}}),F&&(F.current={core:e});let t=e.onBatchInstruction(e=>{de({type:`BATCH_INSTRUCTIONS`,instructions:e})});e.initialize();let n=H.current;return n&&e.setViewport(n.scrollTop,n.scrollLeft,n.clientWidth,n.clientHeight),()=>{t(),e.destroy(),U.current=null,F&&(F.current=null)}},[c,p,G,_,y,x,F,B]),n(()=>{let e=U.current;if(!e)return;let t=le.current;if(!t||t===J){le.current=J;return}le.current=J,e.setDataSource(J)},[J]),n(()=>{let e=J;if(e.subscribe)return e.subscribe(()=>{U.current?.refreshFromTransaction()})},[J]),n(()=>{let e=U.current;!e?.highlight||!I||e.highlight.updateOptions(I)},[I]);let $=t(()=>{let e=H.current,t=U.current;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)},[]);n(()=>{let e=H.current,t=U.current;if(!e||!t)return;if(typeof ResizeObserver>`u`){$();return}let n=new ResizeObserver(()=>{t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)});return n.observe(e),$(),()=>n.disconnect()},[$]),n(()=>{let e=H.current;if(!e)return;let t=e=>{Oe(e,C)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[Oe,C]),r(()=>{if(W.pendingScrollTop!==null){let e=H.current;e&&(e.scrollTop=W.pendingScrollTop)}},[W.pendingScrollTop]);let ke=t((e,t)=>{let n=U.current;n&&n.setFilter(e,t)},[]),Ae=t(()=>{let e=U.current;e&&e.closeFilterPopup()},[]),je=t((e,t)=>{U.current?.input.handleCellMouseEnter(e,t)},[]),Me=t(()=>{U.current?.input.handleCellMouseLeave()},[]),Ne=i(()=>Array.from(W.slots.values()),[W.slots]),Pe=i(()=>f({activeCell:W.activeCell,selectionRange:W.selectionRange,slots:W.slots,columns:Y,visibleColumnsWithIndices:X,columnPositions:Z,columnWidths:ye,rowHeight:p}),[W.activeCell,W.selectionRange,W.slots,p,Z,ye,Y,X]),[Fe,Ie]=e.useState(0),Le=t(()=>{let e=H.current;e&&(Ie(e.scrollLeft),$())},[$]);return P(`div`,{ref:V,className:`gp-grid-container${S?` gp-grid-container--dark`:``}`,style:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,flexDirection:`column`},onKeyDown:Ee,onPaste:De,tabIndex:0,children:[N(ie,{headerHeight:h,scrollLeft:Fe,contentWidth:W.contentWidth,totalWidth:be,isLoading:W.isLoading,visibleColumnsWithIndices:X,columnPositions:Z,columnWidths:ye,headers:W.headers,sortingEnabled:x,onHeaderMouseDown:we,onHeaderResizeMouseDown:Te,coreRef:U,outerContainerRef:V,headerRenderers:E,globalHeaderRenderer:A}),N(oe,{ref:H,rowHeight:p,totalHeaderHeight:G,contentWidth:W.contentWidth,contentHeight:W.contentHeight,totalWidth:be,rowsWrapperOffset:W.rowsWrapperOffset,activeCell:W.activeCell,selectionRange:W.selectionRange,editingCell:W.editingCell,error:W.error,isLoading:W.isLoading,totalRows:W.totalRows,slotsArray:Ne,visibleColumnsWithIndices:X,columnPositions:Z,columnWidths:ye,fillHandlePosition:Pe,dragState:Q,onScroll:Le,onCellMouseDown:xe,onCellDoubleClick:Se,onCellMouseEnter:je,onCellMouseLeave:Me,onFillHandleMouseDown:Ce,coreRef:U,cellRenderers:w,editRenderers:T,globalCellRenderer:O,globalEditRenderer:k}),W.isLoading&&P(`div`,{style:{position:`absolute`,top:h,left:0,right:0,bottom:0,zIndex:50,pointerEvents:`none`},children:[N(`div`,{className:`gp-grid-loading-overlay`}),z?e.createElement(z,{isLoading:!0}):N(`div`,{className:`gp-grid-loading`,children:N(`div`,{className:`gp-grid-loading-spinner`})})]}),W.filterPopup?.isOpen&&W.filterPopup.column&&N(ne,{column:W.filterPopup.column,colIndex:W.filterPopup.colIndex,containerRef:V,distinctValues:W.filterPopup.distinctValues,currentFilter:W.filterPopup.currentFilter,onApply:ke,onClose:Ae}),Q.dragType===`column-resize`&&Q.columnResize&&(()=>{let e=X.findIndex(e=>e.originalIndex===Q.columnResize.colIndex);return e===-1?null:N(`div`,{className:`gp-grid-column-resize-line`,style:{left:(Z[e]??0)+Q.columnResize.currentWidth-Fe}})})(),Q.dragType===`column-move`&&Q.columnMove&&(()=>{let e=Q.columnMove,t=Y[e.sourceColIndex],n=t?.headerName??t?.field??``;return P(M,{children:[N(`div`,{className:`gp-grid-column-move-ghost`,style:{left:e.currentX-e.ghostWidth/2,top:e.currentY-e.ghostHeight/2,width:e.ghostWidth,height:e.ghostHeight},children:n}),e.dropTargetIndex!==null&&N(`div`,{className:`gp-grid-column-drop-indicator`,style:{position:`absolute`,top:0,left:(Z[e.dropTargetIndex]??0)-Fe,height:h}})]})})(),Q.dragType===`row-drag`&&Q.rowDrag&&N(`div`,{className:`gp-grid-row-drag-ghost`,style:{left:Q.rowDrag.currentX+12,top:Q.rowDrag.currentY-p/2,width:Math.min(300,be),height:p}})]})}const U=(e,t)=>{let n=i(()=>S(e,{getRowId:t.getRowId,debounceMs:t.debounceMs??0,useWorker:t.useWorker,parallelSort:t.parallelSort}),[]);return{dataSource:n,updateRow:n.updateRow,addRows:n.addRows,removeRows:n.removeRows,updateCell:n.updateCell,clear:n.clear,getRowById:n.getRowById,getTotalRowCount:n.getTotalRowCount,flushTransactions:n.flushTransactions}};export{H as GpGrid,H as Grid,c as GridCore,h as createClientDataSource,_ as createDataSourceFromArray,x as createMutableClientDataSource,C as createServerDataSource,U as useGridData};
|
|
1
|
+
import e,{useCallback as t,useEffect as n,useLayoutEffect as r,useMemo as i,useReducer as a,useRef as o,useState as s}from"react";import{GridCore as c,GridCore as l,applyInstruction as u,bindPeekSelectAll as d,buildCellClasses as f,calculateFillHandlePosition as p,calculateFilterPopupPosition as m,calculateScaledColumnPositions as h,createClientDataSource as g,createClientDataSource as _,createDataSourceFromArray as v,createDataSourceFromArray as y,createInitialState as b,createInitialState as x,createMutableClientDataSource as S,createMutableClientDataSource as C,createServerDataSource as w,formatCellValue as T,getFieldValue as E,getFieldValue as D,getTotalWidth as O,isCellActive as k,isCellEditing as A,isCellInFillPreview as j,isCellSelected as ee,scrollCellIntoView as M}from"@gp-grid/core";import{Fragment as N,jsx as P,jsxs as F}from"react/jsx-runtime";const I=[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Is not blank`}];function L({distinctValues:e,valueFormatter:n,currentFilter:r,onApply:a,onClose:o}){let c=t(e=>n?n(e):Array.isArray(e)?e.join(`, `):String(e??``),[n]),l=t(e=>c(e),[c]),u=i(()=>{let t=new Set,n=[];for(let r of e){if(r==null||r===``||Array.isArray(r)&&r.length===0)continue;let e=c(r);t.has(e)||(t.add(e),n.push({key:e,label:l(r)}))}return n.sort((e,t)=>{let n=parseFloat(e.label),r=parseFloat(t.label);return!isNaN(n)&&!isNaN(r)?n-r:e.label.localeCompare(t.label,void 0,{numeric:!0,sensitivity:`base`})}),n},[e,c,l]),d=u.length>100,[f,p]=s(i(()=>{if(!r?.conditions[0])return d?`condition`:`values`;let e=r.conditions[0];return e.selectedValues&&e.selectedValues.size>0?`values`:`condition`},[r,d])),m=i(()=>r?.conditions[0]?r.conditions[0].selectedValues??new Set:new Set,[r]),h=i(()=>r?.conditions[0]?r.conditions[0].includeBlank??!0:!0,[r]),[g,_]=s(``),[v,y]=s(m),[b,x]=s(h),[S,C]=s(i(()=>{if(!r?.conditions.length)return[{operator:`contains`,value:``,nextOperator:`and`}];let e=r.conditions[0];if(e.selectedValues&&e.selectedValues.size>0)return[{operator:`contains`,value:``,nextOperator:`and`}];let t=r.combination??`and`;return r.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value??``,nextOperator:n.nextOperator??t}})},[r])),w=i(()=>{if(!g)return u;let e=g.toLowerCase();return u.filter(t=>t.label.toLowerCase().includes(e))},[u,g]),T=i(()=>e.some(e=>e==null||e===``),[e]),E=i(()=>w.every(e=>v.has(e.key))&&(!T||b),[w,v,T,b]),D=t(()=>{y(new Set(w.map(e=>e.key))),T&&x(!0)},[w,T]),O=t(()=>{y(new Set),x(!1)},[]),k=t(e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),A=t((e,t)=>{C(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),j=t(()=>{C(e=>[...e,{operator:`contains`,value:``,nextOperator:`and`}])},[]),ee=t(e=>{C(t=>t.filter((t,n)=>n!==e))},[]),M=t(()=>{if(f===`values`){if(u.every(e=>v.has(e.key))&&(!T||b)){a(null);return}a({conditions:[{type:`text`,operator:`equals`,selectedValues:v,includeBlank:b}],combination:`and`})}else{let e=S.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.value.trim()!==``);if(e.length===0){a(null);return}a({conditions:e.map(e=>({type:`text`,operator:e.operator,value:e.value,nextOperator:e.nextOperator})),combination:`and`})}},[f,u,v,b,T,S,a]),L=t(()=>{a(null)},[a]);return F(`div`,{className:`gp-grid-filter-content gp-grid-filter-text`,children:[!d&&F(`div`,{className:`gp-grid-filter-mode-toggle`,children:[P(`button`,{type:`button`,className:f===`values`?`active`:``,onClick:()=>p(`values`),children:`Values`}),P(`button`,{type:`button`,className:f===`condition`?`active`:``,onClick:()=>p(`condition`),children:`Condition`})]}),d&&f===`condition`&&F(`div`,{className:`gp-grid-filter-info`,children:[`Too many unique values (`,u.length,`). Use conditions to filter.`]}),f===`values`&&F(N,{children:[P(`input`,{className:`gp-grid-filter-search`,type:`text`,placeholder:`Search...`,value:g,onChange:e=>_(e.target.value),autoFocus:!0}),F(`div`,{className:`gp-grid-filter-actions`,children:[P(`button`,{type:`button`,onClick:D,disabled:E,children:`Select All`}),P(`button`,{type:`button`,onClick:O,children:`Deselect All`})]}),F(`div`,{className:`gp-grid-filter-list`,children:[T&&F(`label`,{className:`gp-grid-filter-option`,children:[P(`input`,{type:`checkbox`,checked:b,onChange:()=>x(!b)}),P(`span`,{className:`gp-grid-filter-blank`,children:`(Blanks)`})]}),w.map(e=>F(`label`,{className:`gp-grid-filter-option`,children:[P(`input`,{type:`checkbox`,checked:v.has(e.key),onChange:()=>k(e.key)}),P(`span`,{children:e.label})]},e.key))]})]}),f===`condition`&&F(N,{children:[S.map((e,t)=>F(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&F(`div`,{className:`gp-grid-filter-combination`,children:[P(`button`,{type:`button`,className:S[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>A(t-1,{nextOperator:`and`}),children:`AND`}),P(`button`,{type:`button`,className:S[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>A(t-1,{nextOperator:`or`}),children:`OR`})]}),F(`div`,{className:`gp-grid-filter-row`,children:[P(`select`,{value:e.operator,onChange:e=>A(t,{operator:e.target.value}),autoFocus:t===0,children:I.map(e=>P(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&P(`input`,{type:`text`,value:e.value,onChange:e=>A(t,{value:e.target.value}),placeholder:`Value`,className:`gp-grid-filter-text-input`}),S.length>1&&P(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>ee(t),children:`×`})]})]},t)),P(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:j,children:`+ Add condition`})]}),F(`div`,{className:`gp-grid-filter-buttons`,children:[P(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:L,children:`Clear`}),P(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:M,children:`Apply`})]})]})}const R=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`>=`,label:`≥`},{value:`<=`,label:`≤`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}];function te({currentFilter:e,onApply:n,onClose:r}){let[a,o]=s(i(()=>{if(!e?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let t=e.combination??`and`;return e.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value==null?``:String(n.value),valueTo:n.valueTo==null?``:String(n.valueTo),nextOperator:n.nextOperator??t}})},[e])),c=t((e,t)=>{o(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),l=t(()=>{o(e=>[...e,{operator:`=`,value:``,valueTo:``,nextOperator:`and`}])},[]),u=t(e=>{o(t=>t.filter((t,n)=>n!==e))},[]),d=t(()=>{let e=a.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){n(null);return}n({conditions:e.map(e=>({type:`number`,operator:e.operator,value:e.value?parseFloat(e.value):void 0,valueTo:e.valueTo?parseFloat(e.valueTo):void 0,nextOperator:e.nextOperator})),combination:`and`})},[a,n]),f=t(()=>{n(null)},[n]);return F(`div`,{className:`gp-grid-filter-content gp-grid-filter-number`,children:[a.map((e,t)=>F(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&F(`div`,{className:`gp-grid-filter-combination`,children:[P(`button`,{type:`button`,className:a[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>c(t-1,{nextOperator:`and`}),children:`AND`}),P(`button`,{type:`button`,className:a[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>c(t-1,{nextOperator:`or`}),children:`OR`})]}),F(`div`,{className:`gp-grid-filter-row`,children:[P(`select`,{value:e.operator,onChange:e=>c(t,{operator:e.target.value}),children:R.map(e=>P(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&P(`input`,{type:`number`,value:e.value,onChange:e=>c(t,{value:e.target.value}),placeholder:`Value`}),e.operator===`between`&&F(N,{children:[P(`span`,{className:`gp-grid-filter-to`,children:`to`}),P(`input`,{type:`number`,value:e.valueTo,onChange:e=>c(t,{valueTo:e.target.value}),placeholder:`Value`})]}),a.length>1&&P(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>u(t),children:`×`})]})]},t)),P(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:l,children:`+ Add condition`}),F(`div`,{className:`gp-grid-filter-buttons`,children:[P(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:f,children:`Clear`}),P(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:d,children:`Apply`})]})]})}const ne=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}];function re(e){if(!e)return``;let t=typeof e==`string`?new Date(e):e;return isNaN(t.getTime())?``:t.toISOString().split(`T`)[0]}function ie({currentFilter:e,onApply:n,onClose:r}){let[a,o]=s(i(()=>{if(!e?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let t=e.combination??`and`;return e.conditions.map(e=>{let n=e;return{operator:n.operator,value:re(n.value),valueTo:re(n.valueTo),nextOperator:n.nextOperator??t}})},[e])),c=t((e,t)=>{o(n=>{let r=[...n];return r[e]={...r[e],...t},r})},[]),l=t(()=>{o(e=>[...e,{operator:`=`,value:``,valueTo:``,nextOperator:`and`}])},[]),u=t(e=>{o(t=>t.filter((t,n)=>n!==e))},[]),d=t(()=>{let e=a.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){n(null);return}n({conditions:e.map(e=>({type:`date`,operator:e.operator,value:e.value||void 0,valueTo:e.valueTo||void 0,nextOperator:e.nextOperator})),combination:`and`})},[a,n]),f=t(()=>{n(null)},[n]);return F(`div`,{className:`gp-grid-filter-content gp-grid-filter-date`,children:[a.map((e,t)=>F(`div`,{className:`gp-grid-filter-condition`,children:[t>0&&F(`div`,{className:`gp-grid-filter-combination`,children:[P(`button`,{type:`button`,className:a[t-1]?.nextOperator===`and`?`active`:``,onClick:()=>c(t-1,{nextOperator:`and`}),children:`AND`}),P(`button`,{type:`button`,className:a[t-1]?.nextOperator===`or`?`active`:``,onClick:()=>c(t-1,{nextOperator:`or`}),children:`OR`})]}),F(`div`,{className:`gp-grid-filter-row`,children:[P(`select`,{value:e.operator,onChange:e=>c(t,{operator:e.target.value}),children:ne.map(e=>P(`option`,{value:e.value,children:e.label},e.value))}),e.operator!==`blank`&&e.operator!==`notBlank`&&P(`input`,{type:`date`,value:e.value,onChange:e=>c(t,{value:e.target.value})}),e.operator===`between`&&F(N,{children:[P(`span`,{className:`gp-grid-filter-to`,children:`to`}),P(`input`,{type:`date`,value:e.valueTo,onChange:e=>c(t,{valueTo:e.target.value})})]}),a.length>1&&P(`button`,{type:`button`,className:`gp-grid-filter-remove`,onClick:()=>u(t),children:`×`})]})]},t)),P(`button`,{type:`button`,className:`gp-grid-filter-add`,onClick:l,children:`+ Add condition`}),F(`div`,{className:`gp-grid-filter-buttons`,children:[P(`button`,{type:`button`,className:`gp-grid-filter-btn-clear`,onClick:f,children:`Clear`}),P(`button`,{type:`button`,className:`gp-grid-filter-btn-apply`,onClick:d,children:`Apply`})]})]})}function ae({column:e,colIndex:i,containerRef:a,distinctValues:c,currentFilter:l,onApply:u,onClose:d}){let f=o(null),[p,h]=s({position:`fixed`,zIndex:1e4,visibility:`hidden`}),g=t(()=>{let e=a.current,t=f.current;if(!e||!t)return;let n=e.querySelector(`[data-col-index="${i}"]`);if(!n)return;let r=m(n,t);h({position:`fixed`,top:r.top,left:r.left,minWidth:r.minWidth,zIndex:1e4,visibility:`visible`})},[a,i]);r(()=>{g()},[g]),n(()=>{let e=null,t=()=>{e===null&&(e=requestAnimationFrame(()=>{e=null,g()}))};return window.addEventListener(`scroll`,t,{passive:!0,capture:!0}),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,t),e!==null&&cancelAnimationFrame(e)}},[g]),n(()=>{let e=e=>{let t=e.target;t.closest(`.gp-grid-filter-icon`)||f.current&&!f.current.contains(t)&&d()},t=e=>{e.key===`Escape`&&d()};return requestAnimationFrame(()=>{document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t)}),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[d]);let _=t(t=>{u(e.colId??e.field,t),d()},[e,u,d]),v=e.cellDataType,y=v===`text`||v===`object`,b=v===`number`,x=v===`date`||v===`dateString`||v===`dateTime`||v===`dateTimeString`;return F(`div`,{ref:f,className:`gp-grid-filter-popup`,style:p,children:[F(`div`,{className:`gp-grid-filter-header`,children:[`Filter: `,e.headerName??e.field]}),y&&P(L,{distinctValues:c,valueFormatter:e.valueFormatter,currentFilter:l,onApply:_,onClose:d}),b&&P(te,{currentFilter:l,onApply:_,onClose:d}),x&&P(ie,{currentFilter:l,onApply:_,onClose:d}),!y&&!b&&!x&&P(L,{distinctValues:c,valueFormatter:e.valueFormatter,currentFilter:l,onApply:_,onClose:d})]})}function oe(e){let{column:t,colIndex:n,sortDirection:r,sortIndex:i,sortable:a,filterable:o,hasFilter:s,coreRef:c,containerRef:l,headerRenderers:u,globalHeaderRenderer:d}=e,f=c.current,p={column:t,colIndex:n,sortDirection:r,sortIndex:i,sortable:a,filterable:o,hasFilter:s,onSort:(e,n)=>{f&&a&&f.setSort(t.colId??t.field,e,n)},onFilterClick:()=>{if(f&&o){let e=l.current?.querySelector(`[data-col-index="${n}"]`);if(e){let t=e.getBoundingClientRect();f.openFilterPopup(n,{top:t.top,left:t.left,width:t.width,height:t.height})}}}};if(t.headerRenderer){if(typeof t.headerRenderer==`function`)return t.headerRenderer(p);let e=u[t.headerRenderer];if(e)return e(p)}return d?d(p):F(N,{children:[P(`span`,{className:`gp-grid-header-text`,children:t.headerName??t.field}),F(`span`,{className:`gp-grid-header-icons`,children:[a&&F(`span`,{className:`gp-grid-sort-arrows`,children:[F(`span`,{className:`gp-grid-sort-arrows-stack`,children:[P(`svg`,{className:`gp-grid-sort-arrow-up${r===`asc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`,children:P(`path`,{d:`M4 0L8 6H0L4 0Z`,fill:`currentColor`})}),P(`svg`,{className:`gp-grid-sort-arrow-down${r===`desc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`,children:P(`path`,{d:`M4 6L0 0H8L4 6Z`,fill:`currentColor`})})]}),i!==void 0&&i>0&&P(`span`,{className:`gp-grid-sort-index`,children:i})]}),o&&P(`span`,{className:`gp-grid-filter-icon${s?` active`:``}`,onPointerDown:e=>{e.stopPropagation(),e.preventDefault(),p.onFilterClick()},onClick:e=>{e.stopPropagation()},children:P(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,children:P(`path`,{d:`M4 4h16l-6 8v5l-4 2v-7L4 4z`})})})]})]})}const se=e=>{let{headerHeight:t,scrollLeft:n,contentWidth:r,totalWidth:i,isLoading:a,visibleColumnsWithIndices:o,columnPositions:s,columnWidths:c,headers:l,sortingEnabled:u,onHeaderMouseDown:d,onHeaderResizeMouseDown:f,coreRef:p,outerContainerRef:m,headerRenderers:h,globalHeaderRenderer:g}=e;return P(`div`,{className:`gp-grid-header${a?` gp-grid-header--loading`:``}`,style:{height:t},children:P(`div`,{style:{position:`absolute`,top:0,left:0,transform:`translateX(${-n}px)`,width:Math.max(r,i),height:t},children:o.map(({column:e,originalIndex:n},r)=>{let i=l.get(n),a=c[r]??0;return F(`div`,{className:`gp-grid-header-cell`,"data-col-index":n,style:{left:`${s[r]}px`,width:`${a}px`,height:`${t}px`},onPointerDown:e=>d(n,a,t,e),children:[oe({column:e,colIndex:n,sortDirection:i?.sortDirection,sortIndex:i?.sortIndex,sortable:e.sortable!==!1&&u,filterable:e.filterable!==!1,hasFilter:i?.hasFilter??!1,coreRef:p,containerRef:m,headerRenderers:h,globalHeaderRenderer:g}),e.resizable!==!1&&P(`div`,{className:`gp-grid-header-resize-handle`,onPointerDown:e=>{e.stopPropagation(),f(n,a,e)}})]},e.colId??e.field)})})})};function z(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,isActive:a,isSelected:o,isEditing:s,cellRenderers:c,globalCellRenderer:l}=e,u=E(n,t.field),d={value:t.valueFormatter?t.valueFormatter(u):u,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:a,isSelected:o,isEditing:s};if(t.cellRenderer){if(typeof t.cellRenderer==`function`)return t.cellRenderer(d);let e=c[t.cellRenderer];if(e)return e(d)}return l?l(d):T(u,t.valueFormatter)}function B(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,initialValue:a,coreRef:o,editRenderers:s,globalEditRenderer:c}=e,l=o.current;if(!l)return null;let u=D(n,t.field),d={value:t.valueFormatter?t.valueFormatter(u):u,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:!0,isSelected:!0,isEditing:!0,initialValue:a,onValueChange:e=>l.updateEditValue(e),onCommit:()=>l.commitEdit(),onCancel:()=>l.cancelEdit()};if(t.editRenderer){if(typeof t.editRenderer==`function`)return t.editRenderer(d);let e=s[t.editRenderer];if(e)return e(d)}return c?c(d):P(`input`,{className:`gp-grid-edit-input`,type:`text`,defaultValue:a==null?``:String(a),autoFocus:!0,onFocus:e=>e.target.select(),onChange:e=>l.updateEditValue(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?l.commitEdit():e.key===`Escape`?l.cancelEdit():e.key===`Tab`&&(e.preventDefault(),l.commitEdit(),l.selection.moveFocus(e.shiftKey?`left`:`right`,!1))},onBlur:()=>l.commitEdit()})}const ce=e.forwardRef((e,t)=>{let{rowHeight:n,totalHeaderHeight:r,contentWidth:i,contentHeight:a,totalWidth:o,rowsWrapperOffset:s,activeCell:c,selectionRange:l,editingCell:u,error:d,isLoading:p,totalRows:m,slotsArray:h,visibleColumnsWithIndices:g,columnPositions:_,columnWidths:v,fillHandlePosition:y,dragState:b,onScroll:x,onCellMouseDown:S,onCellDoubleClick:C,onCellMouseEnter:w,onCellMouseLeave:D,onFillHandleMouseDown:O,coreRef:M,cellRenderers:N,editRenderers:I,globalCellRenderer:L,globalEditRenderer:R}=e;return F(`div`,{ref:t,style:{flex:1,overflow:`auto`,position:`relative`},onScroll:x,children:[P(`div`,{style:{width:Math.max(i,o),height:Math.max(a-r,0),position:`relative`,minWidth:`100%`},children:F(`div`,{className:`gp-grid-rows-wrapper`,style:{width:`${Math.max(i,o)}px`,transform:`translateY(${s}px)`},children:[h.map(e=>e.rowIndex<0?null:P(`div`,{className:[`gp-grid-row`,...M.current?.highlight?.computeRowClasses(e.rowIndex,e.rowData)??[]].filter(Boolean).join(` `),style:{position:`absolute`,top:0,left:0,transform:`translateY(${e.translateY}px)`,width:`${Math.max(i,o)}px`,height:`${n}px`},children:g.map(({column:t,originalIndex:r},i)=>{let a=A(e.rowIndex,r,u),o=k(e.rowIndex,r,c),s=ee(e.rowIndex,r,l),d=f(o,s,a,j(e.rowIndex,r,b.dragType===`fill`,b.fillSourceRange,b.fillTarget)),p=M.current?.highlight?.computeCombinedCellClasses(e.rowIndex,r,t,e.rowData)??[],m=t.rowDrag===!0,h=[d,...p,m?`gp-grid-cell--row-drag-handle`:``].filter(Boolean).join(` `),g=t.tooltip===!1||a?``:T(E(e.rowData,t.field),t.valueFormatter);return P(`div`,{className:h,"data-cell-row":e.rowIndex,"data-cell-col":r,title:g||void 0,style:{position:`absolute`,left:`${_[i]}px`,top:0,width:`${v[i]}px`,height:`${n}px`},onPointerDown:t=>S(e.rowIndex,r,t),onDoubleClick:()=>C(e.rowIndex,r),onMouseEnter:()=>w(e.rowIndex,r),onMouseLeave:D,children:a&&u?B({column:t,rowData:e.rowData,rowIndex:e.rowIndex,colIndex:r,initialValue:u.initialValue,coreRef:M,editRenderers:I,globalEditRenderer:R}):z({column:t,rowData:e.rowData,rowIndex:e.rowIndex,colIndex:r,isActive:o,isSelected:s,isEditing:a,cellRenderers:N,globalCellRenderer:L})},`${e.slotId}-${r}`)})},e.slotId)),y&&!u&&P(`div`,{className:`gp-grid-fill-handle`,style:{top:y.top,left:y.left},onPointerDown:O}),b.dragType===`row-drag`&&b.rowDrag?.dropTargetIndex!==null&&P(`div`,{className:`gp-grid-row-drop-indicator`,style:{transform:`translateY(${b.rowDrag.dropIndicatorY}px)`,width:`${Math.max(i,o)}px`}})]})}),d&&F(`div`,{className:`gp-grid-error`,children:[`Error: `,d]}),!p&&!d&&m===0&&P(`div`,{className:`gp-grid-empty`,children:`No data to display`})]})}),V={top:0,left:0,width:0,visibility:`hidden`};function le({peekCell:e,column:i,rowData:a,containerRef:c,cellRenderers:l,globalCellRenderer:u,onClose:f}){let p=o(null),[m,h]=s(V),g=t(()=>{let t=c.current,n=p.current;if(!t||!n)return;let r=t.querySelector(`[data-cell-row="${e.row}"][data-cell-col="${e.col}"]`);if(!r){f();return}let i=r.getBoundingClientRect();h({top:i.top,left:i.left,width:i.width,visibility:`visible`})},[c,e.row,e.col,f]);r(()=>{g()},[g]),n(()=>{let e=null,t=()=>{e===null&&(e=requestAnimationFrame(()=>{e=null,g()}))};return window.addEventListener(`scroll`,t,{passive:!0,capture:!0}),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,t),e!==null&&cancelAnimationFrame(e)}},[g]),n(()=>{let e=e=>{let t=e.target;p.current?.contains(t)||f()},t=requestAnimationFrame(()=>{document.addEventListener(`pointerdown`,e)});return()=>{cancelAnimationFrame(t),document.removeEventListener(`pointerdown`,e)}},[f]),n(()=>{let e=p.current;if(e)return d(e)},[]);let _=z({column:i,rowData:a,rowIndex:e.row,colIndex:e.col,isActive:!0,isSelected:!1,isEditing:!1,cellRenderers:l,globalCellRenderer:u});return P(`div`,{ref:p,className:`gp-grid-cell-peek`,style:{position:`fixed`,top:m.top,left:m.left,width:m.width,visibility:m.visibility},children:_})}function ue(e,t){if(t.type===`RESET`)return b();let{instructions:n}=t;if(n.length===0)return e;let r=new Map(e.slots),i=new Map(e.headers),a={pendingScrollTop:null};for(let e of n){let t=u(e,r,i);t&&(a={...a,...t})}return{...e,...a,slots:r,headers:i}}function de(e,r,i,a){let{activeCell:c,selectionRange:l,editingCell:u,filterPopupOpen:d,rowHeight:f,headerHeight:p,columnPositions:m,visibleColumnsWithIndices:h,slots:g,rowsWrapperOffset:_}=a,v=o(null),y=o(null),b=o(null),x=o(null),S=o(null),C=t(e=>{e.preventDefault()},[]),[w,T]=s({isDragging:!1,dragType:null,fillSourceRange:null,fillTarget:null,columnResize:null,columnMove:null,rowDrag:null});n(()=>{let t=e.current;t?.input&&t.input.updateDeps({getHeaderHeight:()=>p,getRowHeight:()=>f,getColumnPositions:()=>m,getColumnCount:()=>h.length,getOriginalColumnIndex:e=>{let t=h[e];return t?t.originalIndex:e}})},[e,p,f,m,h]);let E=t(()=>{let e=r.current;if(!e)return null;let t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}},[r]),D=t((t,n)=>{v.current&&clearInterval(v.current),v.current=setInterval(()=>{let i=r.current,a=e.current;if(i){i.scrollTop+=n,i.scrollLeft+=t;let e=y.current;if(e&&a?.input){let t=E();t&&(a.input.handleDragMove(e,t),T(a.input.getDragState()))}}},16)},[r,e,E]),O=t(()=>{v.current&&=(clearInterval(v.current),null)},[]),k=e=>({clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,pointerId:e.pointerId,pointerType:e.pointerType}),A=t(()=>{let t=t=>{t.preventDefault();let n=e.current,r=E();if(!n?.input||!r)return;let i=k(t);y.current=i;let a=n.input.handleDragMove(i,r);a&&(a.autoScroll?D(a.autoScroll.dx,a.autoScroll.dy):O(),T(n.input.getDragState()))},n=()=>{let i=e.current;i?.input&&(i.input.handleDragEnd(),T(i.input.getDragState())),y.current=null,O(),document.removeEventListener(`touchmove`,C),S.current!==null&&r.current&&(r.current.style.overflow=S.current,S.current=null),document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n),document.removeEventListener(`pointercancel`,n)};document.addEventListener(`pointermove`,t,{passive:!1}),document.addEventListener(`pointerup`,n),document.addEventListener(`pointercancel`,n)},[e,E,D,O]),j=t(()=>{b.current!==null&&(clearTimeout(b.current),b.current=null,e.current?.input?.cancelPendingRowDrag()),x.current=null},[e]),ee=t((t,n,i)=>{let a=e.current;if(!a?.input)return;let o=a.input.handleCellMouseDown(t,n,k(i));if(o.focusContainer&&r.current?.focus(),o.startDrag===`selection`)a.input.startSelectionDrag(),T(a.input.getDragState()),A();else if(o.startDrag===`row-drag`)T(a.input.getDragState()),A();else if(o.startDrag===`row-drag-pending`){j(),x.current={pointerId:i.pointerId,target:i.currentTarget};let e=i.clientX,t=i.clientY,n=n=>{let r=n.clientX-e,i=n.clientY-t;(Math.abs(r)>10||Math.abs(i)>10)&&(j(),s())},o=()=>{j(),s()},s=()=>{document.removeEventListener(`pointermove`,n),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o)};document.addEventListener(`pointermove`,n),document.addEventListener(`pointerup`,o,{once:!0}),document.addEventListener(`pointercancel`,o,{once:!0}),b.current=setTimeout(()=>{b.current=null,s();let e=x.current;if(x.current=null,a.input.confirmPendingRowDrag()){if(r.current&&(S.current=r.current.style.overflow,r.current.style.overflow=`hidden`),document.addEventListener(`touchmove`,C,{passive:!1}),e)try{e.target.setPointerCapture(e.pointerId)}catch{}T(a.input.getDragState()),A()}},300)}},[e,r,A,j]),N=t((t,n)=>{let r=e.current;r?.input&&r.input.handleCellDoubleClick(t,n)},[e]),P=t(t=>{let n=e.current;if(!n?.input)return;let r=n.input.handleFillHandleMouseDown(c,l,k(t));if(r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),r.startDrag===`fill`){try{t.target.setPointerCapture(t.pointerId)}catch{}T(n.input.getDragState()),A()}},[e,c,l,A]),F=t((t,n)=>{let r=e.current;if(!r?.input)return;let a=i[t];if(!a)return;let o=a.colId??a.field;r.input.handleHeaderClick(o,n.shiftKey)},[e,i]),I=t((t,n,r,i)=>{let a=e.current;if(!a?.input)return;let o=a.input.handleHeaderMouseDown(t,n,r,k(i));if(o.preventDefault&&i.preventDefault(),o.stopPropagation&&i.stopPropagation(),o.startDrag===`column-move`){try{i.target.setPointerCapture(i.pointerId)}catch{}T(a.input.getDragState()),A()}},[e,A]),L=t((t,n,r)=>{let i=e.current;if(!i?.input)return;let a=i.input.handleHeaderResizeMouseDown(t,n,k(r));a.preventDefault&&r.preventDefault(),a.stopPropagation&&r.stopPropagation(),a.startDrag===`column-resize`&&(T(i.input.getDragState()),A())},[e,A]),R=t(t=>{let n=e.current,i=r.current;if(!n?.input)return;let a=n.input.handleKeyDown({key:t.key,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey},c,u,d);a.preventDefault&&t.preventDefault(),a.scrollToCell&&i&&M(n,i,a.scrollToCell.row,f,g,_)},[e,r,c,u,d,f,g,_]),te=t(t=>{let n=e.current;if(!n||u!==null||d)return;let r=t.clipboardData.getData(`text/plain`);n.pasteClipboardText(r)&&t.preventDefault()},[e,u,d]),ne=t((t,n)=>{let i=e.current,a=r.current;if(!i?.input||!a)return;let o=i.input.handleWheel(t.deltaY,t.deltaX,n);o&&(t.preventDefault(),a.scrollTop+=o.dy,a.scrollLeft+=o.dx)},[e,r]);return n(()=>()=>{O(),j(),document.removeEventListener(`touchmove`,C),S.current!==null&&r.current&&(r.current.style.overflow=S.current,S.current=null)},[O,j,C,r]),{handleCellMouseDown:ee,handleCellDoubleClick:N,handleFillHandleMouseDown:P,handleHeaderClick:F,handleHeaderMouseDown:I,handleHeaderResizeMouseDown:L,handleKeyDown:R,handlePaste:te,handleWheel:ne,dragState:w}}function H(s){let{columns:c,dataSource:u,rowData:d,rowHeight:f,headerHeight:m=f,overscan:g=3,rowLoading:v,sortingEnabled:b=!0,darkMode:S=!1,wheelDampening:C=.1,cellRenderers:w={},editRenderers:T={},headerRenderers:E={},cellRenderer:D,editRenderer:k,headerRenderer:A,initialWidth:j,initialHeight:ee,gridRef:M,highlighting:I,getRowId:L,onCellValueChanged:R,loadingComponent:te,rowDragEntireRow:ne=!1,onRowDragEnd:re,onColumnResized:ie,onColumnMoved:oe}=s,z=o(null),B=o(null),V=o(null),H=o(null),fe=o(!1),[U,pe]=a(ue,{initialWidth:j,initialHeight:ee},x),W=m,G=o(null),K=G.current;(!K||K.providedDataSource!==u||K.rowData!==d)&&(K&&d&&d.length>1e4&&console.warn(`[gp-grid] rowData prop changed with ${d.length} rows — this triggers a full rebuild. Use useGridData() for efficient updates.`),K?.ownsDataSource&&K.dataSource.destroy?.(),u?G.current={dataSource:u,ownsDataSource:!1,providedDataSource:u,rowData:d}:d?G.current={dataSource:y(d),ownsDataSource:!0,providedDataSource:u,rowData:d}:G.current={dataSource:_([]),ownsDataSource:!0,providedDataSource:u,rowData:d});let{dataSource:q}=G.current;n(()=>()=>{G.current?.ownsDataSource&&(G.current.dataSource.destroy?.(),G.current=null)},[]);let me=o(L);me.current=L;let he=o(R);he.current=R;let ge=o(re);ge.current=re;let _e=o(ie);_e.current=ie;let ve=o(oe);ve.current=oe;let ye=o(I);ye.current=I;let be=o(q);be.current=q;let J=U.columns??c,Y=i(()=>J.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden),[J]),{positions:X,widths:Z}=i(()=>h(Y.map(e=>e.column),U.viewportWidth),[Y,U.viewportWidth]),xe=O(X),{handleCellMouseDown:Se,handleCellDoubleClick:Ce,handleFillHandleMouseDown:we,handleHeaderMouseDown:Te,handleHeaderResizeMouseDown:Ee,handleKeyDown:De,handlePaste:Oe,handleWheel:ke,dragState:Q}=de(V,B,J,{activeCell:U.activeCell,selectionRange:U.selectionRange,editingCell:U.editingCell,filterPopupOpen:U.filterPopup?.isOpen??!1,rowHeight:f,headerHeight:W,columnPositions:X,visibleColumnsWithIndices:Y,slots:U.slots,rowsWrapperOffset:U.rowsWrapperOffset});n(()=>{fe.current&&pe({type:`RESET`}),fe.current=!0;let e=new l({columns:c,dataSource:be.current,rowHeight:f,headerHeight:W,overscan:g,rowLoading:v,sortingEnabled:b,highlighting:ye.current,getRowId:me.current,onCellValueChanged:he.current?e=>he.current?.(e):void 0,rowDragEntireRow:ne,onRowDragEnd:(e,t)=>ge.current?.(e,t),onColumnResized:(e,t)=>_e.current?.(e,t),onColumnMoved:(e,t)=>ve.current?.(e,t)});V.current=e,e.input.updateDeps({getHeaderHeight:()=>W,getRowHeight:()=>f,getColumnPositions:()=>X,getColumnCount:()=>Y.length,getOriginalColumnIndex:e=>{let t=Y[e];return t?t.originalIndex:e}}),M&&(M.current={core:e});let t=e.onBatchInstruction(e=>{pe({type:`BATCH_INSTRUCTIONS`,instructions:e})});e.initialize();let n=B.current;return n&&e.setViewport(n.scrollTop,n.scrollLeft,n.clientWidth,n.clientHeight),()=>{t(),e.destroy(),V.current=null,M&&(M.current=null)}},[c,f,W,g,v,b,M,ne]),n(()=>{let e=V.current;if(!e)return;let t=H.current;if(!t||t===q){H.current=q;return}H.current=q,e.setDataSource(q)},[q]),n(()=>{let e=q;if(e.subscribe)return e.subscribe(()=>{V.current?.refreshFromTransaction()})},[q]),n(()=>{let e=V.current;!e?.highlight||!I||e.highlight.updateOptions(I)},[I]);let $=t(()=>{let e=B.current,t=V.current;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)},[]);n(()=>{let e=B.current,t=V.current;if(!e||!t)return;if(typeof ResizeObserver>`u`){$();return}let n=new ResizeObserver(()=>{t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)});return n.observe(e),$(),()=>n.disconnect()},[$]),n(()=>{let e=B.current;if(!e)return;let t=e=>{ke(e,C)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[ke,C]),r(()=>{if(U.pendingScrollTop!==null){let e=B.current;e&&(e.scrollTop=U.pendingScrollTop)}},[U.pendingScrollTop]);let Ae=t((e,t)=>{let n=V.current;n&&n.setFilter(e,t)},[]),je=t(()=>{let e=V.current;e&&e.closeFilterPopup()},[]),Me=t(()=>{V.current?.stopPeek()},[]),Ne=t((e,t)=>{V.current?.input.handleCellMouseEnter(e,t)},[]),Pe=t(()=>{V.current?.input.handleCellMouseLeave()},[]),Fe=i(()=>Array.from(U.slots.values()),[U.slots]),Ie=i(()=>p({activeCell:U.activeCell,selectionRange:U.selectionRange,slots:U.slots,columns:J,visibleColumnsWithIndices:Y,columnPositions:X,columnWidths:Z,rowHeight:f}),[U.activeCell,U.selectionRange,U.slots,f,X,Z,J,Y]),[Le,Re]=e.useState(0),ze=t(()=>{let e=B.current;e&&(Re(e.scrollLeft),$())},[$]);return F(`div`,{ref:z,className:`gp-grid-container${S?` gp-grid-container--dark`:``}`,style:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,flexDirection:`column`},onKeyDown:De,onPaste:Oe,tabIndex:0,children:[P(se,{headerHeight:m,scrollLeft:Le,contentWidth:U.contentWidth,totalWidth:xe,isLoading:U.isLoading,visibleColumnsWithIndices:Y,columnPositions:X,columnWidths:Z,headers:U.headers,sortingEnabled:b,onHeaderMouseDown:Te,onHeaderResizeMouseDown:Ee,coreRef:V,outerContainerRef:z,headerRenderers:E,globalHeaderRenderer:A}),P(ce,{ref:B,rowHeight:f,totalHeaderHeight:W,contentWidth:U.contentWidth,contentHeight:U.contentHeight,totalWidth:xe,rowsWrapperOffset:U.rowsWrapperOffset,activeCell:U.activeCell,selectionRange:U.selectionRange,editingCell:U.editingCell,error:U.error,isLoading:U.isLoading,totalRows:U.totalRows,slotsArray:Fe,visibleColumnsWithIndices:Y,columnPositions:X,columnWidths:Z,fillHandlePosition:Ie,dragState:Q,onScroll:ze,onCellMouseDown:Se,onCellDoubleClick:Ce,onCellMouseEnter:Ne,onCellMouseLeave:Pe,onFillHandleMouseDown:we,coreRef:V,cellRenderers:w,editRenderers:T,globalCellRenderer:D,globalEditRenderer:k}),U.isLoading&&F(`div`,{style:{position:`absolute`,top:m,left:0,right:0,bottom:0,zIndex:50,pointerEvents:`none`},children:[P(`div`,{className:`gp-grid-loading-overlay`}),te?e.createElement(te,{isLoading:!0}):P(`div`,{className:`gp-grid-loading`,children:P(`div`,{className:`gp-grid-loading-spinner`})})]}),U.filterPopup?.isOpen&&U.filterPopup.column&&P(ae,{column:U.filterPopup.column,colIndex:U.filterPopup.colIndex,containerRef:z,distinctValues:U.filterPopup.distinctValues,currentFilter:U.filterPopup.currentFilter,onApply:Ae,onClose:je}),U.peekCell&&(()=>{let e=J[U.peekCell.col],t=Fe.find(e=>e.rowIndex===U.peekCell.row);return!e||!t?null:P(le,{peekCell:U.peekCell,column:e,rowData:t.rowData,containerRef:z,cellRenderers:w,globalCellRenderer:D,onClose:Me})})(),Q.dragType===`column-resize`&&Q.columnResize&&(()=>{let e=Y.findIndex(e=>e.originalIndex===Q.columnResize.colIndex);return e===-1?null:P(`div`,{className:`gp-grid-column-resize-line`,style:{left:(X[e]??0)+Q.columnResize.currentWidth-Le}})})(),Q.dragType===`column-move`&&Q.columnMove&&(()=>{let e=Q.columnMove,t=J[e.sourceColIndex],n=t?.headerName??t?.field??``;return F(N,{children:[P(`div`,{className:`gp-grid-column-move-ghost`,style:{left:e.currentX-e.ghostWidth/2,top:e.currentY-e.ghostHeight/2,width:e.ghostWidth,height:e.ghostHeight},children:n}),e.dropTargetIndex!==null&&P(`div`,{className:`gp-grid-column-drop-indicator`,style:{position:`absolute`,top:0,left:(X[e.dropTargetIndex]??0)-Le,height:m}})]})})(),Q.dragType===`row-drag`&&Q.rowDrag&&P(`div`,{className:`gp-grid-row-drag-ghost`,style:{left:Q.rowDrag.currentX+12,top:Q.rowDrag.currentY-f/2,width:Math.min(300,xe),height:f}})]})}const fe=(e,t)=>{let n=i(()=>C(e,{getRowId:t.getRowId,debounceMs:t.debounceMs??0,useWorker:t.useWorker,parallelSort:t.parallelSort}),[]);return{dataSource:n,updateRow:n.updateRow,addRows:n.addRows,removeRows:n.removeRows,updateCell:n.updateCell,clear:n.clear,getRowById:n.getRowById,getTotalRowCount:n.getTotalRowCount,flushTransactions:n.flushTransactions}};export{H as GpGrid,H as Grid,c as GridCore,g as createClientDataSource,v as createDataSourceFromArray,S as createMutableClientDataSource,w as createServerDataSource,fe as useGridData};
|
package/dist/styles.css
CHANGED
|
@@ -88,9 +88,15 @@
|
|
|
88
88
|
GP Grid - Clean Flat Design
|
|
89
89
|
============================================================================= */
|
|
90
90
|
|
|
91
|
-
/* Grid Container */
|
|
91
|
+
/* Grid Container - structural */
|
|
92
92
|
.gp-grid-container {
|
|
93
93
|
outline: none;
|
|
94
|
+
user-select: none;
|
|
95
|
+
-webkit-user-select: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Visual properties - :where() for zero specificity, consumers can override with a single class */
|
|
99
|
+
:where(.gp-grid-container) {
|
|
94
100
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
95
101
|
font-size: 13px;
|
|
96
102
|
line-height: 1.5;
|
|
@@ -98,12 +104,13 @@
|
|
|
98
104
|
background-color: var(--gp-grid-bg);
|
|
99
105
|
border: 1px solid var(--gp-grid-border);
|
|
100
106
|
border-radius: 6px;
|
|
101
|
-
user-select: none;
|
|
102
|
-
-webkit-user-select: none;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
.gp-grid-container:focus {
|
|
106
110
|
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:where(.gp-grid-container:focus) {
|
|
107
114
|
border-color: var(--gp-grid-primary);
|
|
108
115
|
}
|
|
109
116
|
|
|
@@ -116,39 +123,43 @@
|
|
|
116
123
|
position: sticky;
|
|
117
124
|
top: 0;
|
|
118
125
|
left: 0;
|
|
119
|
-
/* z-index set inline (100) to ensure header stays above rows wrapper */
|
|
120
|
-
background-color: var(--gp-grid-header-bg);
|
|
121
|
-
border-bottom: 1px solid var(--gp-grid-border);
|
|
122
126
|
flex-shrink: 0;
|
|
123
127
|
z-index: 11;
|
|
124
128
|
overflow: hidden;
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
:where(.gp-grid-header) {
|
|
132
|
+
background-color: var(--gp-grid-header-bg);
|
|
133
|
+
border-bottom: 1px solid var(--gp-grid-border);
|
|
134
|
+
}
|
|
135
|
+
|
|
127
136
|
.gp-grid-container .gp-grid-header-cell {
|
|
128
137
|
position: absolute;
|
|
129
138
|
box-sizing: border-box;
|
|
139
|
+
user-select: none;
|
|
140
|
+
display: flex;
|
|
141
|
+
top: 0;
|
|
142
|
+
touch-action: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where(.gp-grid-header-cell) {
|
|
146
|
+
align-items: center;
|
|
147
|
+
padding: 0 12px;
|
|
130
148
|
border-right: 1px solid var(--gp-grid-border);
|
|
131
149
|
font-weight: 600;
|
|
132
150
|
font-size: 12px;
|
|
133
151
|
letter-spacing: 0.5px;
|
|
134
152
|
color: var(--gp-grid-header-text);
|
|
135
153
|
cursor: pointer;
|
|
136
|
-
user-select: none;
|
|
137
|
-
display: flex;
|
|
138
|
-
align-items: center;
|
|
139
|
-
padding: 0 12px;
|
|
140
154
|
background-color: transparent;
|
|
141
155
|
transition: background-color 0.1s ease;
|
|
142
|
-
top: 0;
|
|
143
|
-
background: transparent;
|
|
144
|
-
touch-action: none;
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
.gp-grid-
|
|
158
|
+
:where(.gp-grid-header-cell:hover) {
|
|
148
159
|
background-color: var(--gp-grid-hover);
|
|
149
160
|
}
|
|
150
161
|
|
|
151
|
-
.gp-grid-
|
|
162
|
+
:where(.gp-grid-header-cell:active) {
|
|
152
163
|
background-color: var(--gp-grid-border-light);
|
|
153
164
|
}
|
|
154
165
|
|
|
@@ -157,6 +168,9 @@
|
|
|
157
168
|
overflow: hidden;
|
|
158
169
|
text-overflow: ellipsis;
|
|
159
170
|
white-space: nowrap;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:where(.gp-grid-header-text) {
|
|
160
174
|
color: var(--gp-grid-header-text);
|
|
161
175
|
}
|
|
162
176
|
|
|
@@ -184,20 +198,20 @@
|
|
|
184
198
|
gap: 2px;
|
|
185
199
|
}
|
|
186
200
|
|
|
187
|
-
.gp-grid-sort-arrow-up,
|
|
188
|
-
.gp-grid-sort-arrow-down {
|
|
201
|
+
:where(.gp-grid-sort-arrow-up),
|
|
202
|
+
:where(.gp-grid-sort-arrow-down) {
|
|
189
203
|
opacity: 0.35;
|
|
190
204
|
transition: opacity 0.15s ease, color 0.15s ease;
|
|
191
205
|
color: var(--gp-grid-text);
|
|
192
206
|
}
|
|
193
207
|
|
|
194
|
-
.gp-grid-sort-arrow-up.active,
|
|
195
|
-
.gp-grid-sort-arrow-down.active {
|
|
208
|
+
:where(.gp-grid-sort-arrow-up.active),
|
|
209
|
+
:where(.gp-grid-sort-arrow-down.active) {
|
|
196
210
|
opacity: 1;
|
|
197
211
|
color: var(--gp-grid-primary);
|
|
198
212
|
}
|
|
199
213
|
|
|
200
|
-
.gp-grid-sort-index {
|
|
214
|
+
:where(.gp-grid-sort-index) {
|
|
201
215
|
font-size: 9px;
|
|
202
216
|
color: var(--gp-grid-primary);
|
|
203
217
|
font-weight: 600;
|
|
@@ -210,6 +224,9 @@
|
|
|
210
224
|
justify-content: center;
|
|
211
225
|
width: 20px;
|
|
212
226
|
height: 20px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
:where(.gp-grid-filter-icon) {
|
|
213
230
|
border-radius: 4px;
|
|
214
231
|
cursor: pointer;
|
|
215
232
|
color: var(--gp-grid-text-secondary);
|
|
@@ -217,12 +234,12 @@
|
|
|
217
234
|
margin-left: 2px;
|
|
218
235
|
}
|
|
219
236
|
|
|
220
|
-
.gp-grid-filter-icon:hover {
|
|
237
|
+
:where(.gp-grid-filter-icon:hover) {
|
|
221
238
|
background-color: var(--gp-grid-hover);
|
|
222
239
|
color: var(--gp-grid-primary);
|
|
223
240
|
}
|
|
224
241
|
|
|
225
|
-
.gp-grid-filter-icon.active {
|
|
242
|
+
:where(.gp-grid-filter-icon.active) {
|
|
226
243
|
color: var(--gp-grid-primary);
|
|
227
244
|
background-color: var(--gp-grid-primary-light);
|
|
228
245
|
}
|
|
@@ -234,6 +251,8 @@
|
|
|
234
251
|
min-height: 44px;
|
|
235
252
|
width: 44px;
|
|
236
253
|
height: 44px;
|
|
254
|
+
}
|
|
255
|
+
:where(.gp-grid-filter-icon) {
|
|
237
256
|
margin-left: 0;
|
|
238
257
|
}
|
|
239
258
|
|
|
@@ -246,6 +265,9 @@
|
|
|
246
265
|
/* Disabled header state during data loading */
|
|
247
266
|
.gp-grid-header--loading .gp-grid-header-cell {
|
|
248
267
|
pointer-events: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
:where(.gp-grid-header--loading .gp-grid-header-cell) {
|
|
249
271
|
opacity: 0.6;
|
|
250
272
|
cursor: default;
|
|
251
273
|
}
|
|
@@ -265,8 +287,8 @@
|
|
|
265
287
|
touch-action: none;
|
|
266
288
|
}
|
|
267
289
|
|
|
268
|
-
.gp-grid-header-resize-handle:hover,
|
|
269
|
-
.gp-grid-header-resize-handle--active {
|
|
290
|
+
:where(.gp-grid-header-resize-handle:hover),
|
|
291
|
+
:where(.gp-grid-header-resize-handle--active) {
|
|
270
292
|
background-color: var(--gp-grid-primary);
|
|
271
293
|
opacity: 0.4;
|
|
272
294
|
}
|
|
@@ -284,11 +306,14 @@
|
|
|
284
306
|
top: 0;
|
|
285
307
|
width: 2px;
|
|
286
308
|
height: 100%;
|
|
287
|
-
background-color: var(--gp-grid-primary);
|
|
288
309
|
z-index: 1000;
|
|
289
310
|
pointer-events: none;
|
|
290
311
|
}
|
|
291
312
|
|
|
313
|
+
:where(.gp-grid-column-resize-line) {
|
|
314
|
+
background-color: var(--gp-grid-primary);
|
|
315
|
+
}
|
|
316
|
+
|
|
292
317
|
/* =============================================================================
|
|
293
318
|
Column Move
|
|
294
319
|
============================================================================= */
|
|
@@ -296,23 +321,26 @@
|
|
|
296
321
|
.gp-grid-column-move-ghost {
|
|
297
322
|
position: fixed;
|
|
298
323
|
pointer-events: none;
|
|
299
|
-
opacity: 0.7;
|
|
300
324
|
z-index: 2000;
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
box-sizing: border-box;
|
|
328
|
+
overflow: hidden;
|
|
329
|
+
white-space: nowrap;
|
|
330
|
+
text-overflow: ellipsis;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:where(.gp-grid-column-move-ghost) {
|
|
334
|
+
opacity: 0.7;
|
|
301
335
|
background-color: var(--gp-grid-header-bg);
|
|
302
336
|
border: 2px solid var(--gp-grid-primary);
|
|
303
337
|
border-radius: 4px;
|
|
304
338
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
305
|
-
display: flex;
|
|
306
|
-
align-items: center;
|
|
307
339
|
padding: 0 12px;
|
|
308
340
|
font-weight: 600;
|
|
309
341
|
font-size: 12px;
|
|
310
342
|
letter-spacing: 0.5px;
|
|
311
343
|
color: var(--gp-grid-header-text);
|
|
312
|
-
box-sizing: border-box;
|
|
313
|
-
overflow: hidden;
|
|
314
|
-
white-space: nowrap;
|
|
315
|
-
text-overflow: ellipsis;
|
|
316
344
|
}
|
|
317
345
|
|
|
318
346
|
.gp-grid-column-drop-indicator {
|
|
@@ -321,9 +349,12 @@
|
|
|
321
349
|
left: 0;
|
|
322
350
|
width: 3px;
|
|
323
351
|
height: 100%;
|
|
324
|
-
background-color: var(--gp-grid-primary);
|
|
325
352
|
z-index: 1000;
|
|
326
353
|
pointer-events: none;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
:where(.gp-grid-column-drop-indicator) {
|
|
357
|
+
background-color: var(--gp-grid-primary);
|
|
327
358
|
border-radius: 2px;
|
|
328
359
|
}
|
|
329
360
|
|
|
@@ -359,7 +390,6 @@
|
|
|
359
390
|
top: 0;
|
|
360
391
|
box-sizing: border-box;
|
|
361
392
|
display: flex;
|
|
362
|
-
align-items: center;
|
|
363
393
|
overflow: hidden;
|
|
364
394
|
text-overflow: ellipsis;
|
|
365
395
|
white-space: nowrap;
|
|
@@ -369,6 +399,7 @@
|
|
|
369
399
|
|
|
370
400
|
/* Visual properties - :where() for zero specificity, so user highlight classes always win */
|
|
371
401
|
:where(.gp-grid-cell) {
|
|
402
|
+
align-items: center;
|
|
372
403
|
padding: 0 12px;
|
|
373
404
|
cursor: cell;
|
|
374
405
|
color: var(--gp-grid-text);
|
|
@@ -411,17 +442,20 @@
|
|
|
411
442
|
position: absolute;
|
|
412
443
|
width: 8px;
|
|
413
444
|
height: 8px;
|
|
414
|
-
background-color: var(--gp-grid-primary);
|
|
415
|
-
border: 2px solid var(--gp-grid-bg);
|
|
416
|
-
cursor: crosshair;
|
|
417
445
|
z-index: 11;
|
|
418
446
|
pointer-events: auto;
|
|
419
447
|
box-sizing: border-box;
|
|
420
|
-
border-radius: 1px;
|
|
421
448
|
touch-action: none;
|
|
422
449
|
}
|
|
423
450
|
|
|
424
|
-
.gp-grid-fill-handle
|
|
451
|
+
:where(.gp-grid-fill-handle) {
|
|
452
|
+
background-color: var(--gp-grid-primary);
|
|
453
|
+
border: 2px solid var(--gp-grid-bg);
|
|
454
|
+
cursor: crosshair;
|
|
455
|
+
border-radius: 1px;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
:where(.gp-grid-fill-handle:hover) {
|
|
425
459
|
transform: scale(1.2);
|
|
426
460
|
}
|
|
427
461
|
|
|
@@ -429,13 +463,15 @@
|
|
|
429
463
|
.gp-grid-fill-handle {
|
|
430
464
|
width: 24px;
|
|
431
465
|
height: 24px;
|
|
466
|
+
}
|
|
467
|
+
:where(.gp-grid-fill-handle) {
|
|
432
468
|
border-width: 3px;
|
|
433
469
|
border-radius: 3px;
|
|
434
470
|
}
|
|
435
471
|
}
|
|
436
472
|
|
|
437
473
|
/* Fill preview (cells being filled) */
|
|
438
|
-
.gp-grid-cell.gp-grid-cell--fill-preview {
|
|
474
|
+
:where(.gp-grid-cell.gp-grid-cell--fill-preview) {
|
|
439
475
|
background-color: var(--gp-grid-primary-light);
|
|
440
476
|
border: 1px dashed var(--gp-grid-primary);
|
|
441
477
|
}
|
|
@@ -447,6 +483,9 @@
|
|
|
447
483
|
.gp-grid-edit-input {
|
|
448
484
|
width: 100%;
|
|
449
485
|
height: 100%;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
:where(.gp-grid-edit-input) {
|
|
450
489
|
padding: 0 11px;
|
|
451
490
|
font-family: inherit;
|
|
452
491
|
font-size: inherit;
|
|
@@ -459,6 +498,38 @@
|
|
|
459
498
|
outline: none;
|
|
460
499
|
}
|
|
461
500
|
|
|
501
|
+
/* =============================================================================
|
|
502
|
+
Cell Peek (read-only multi-line overlay on dblclick of non-editable cell)
|
|
503
|
+
============================================================================= */
|
|
504
|
+
|
|
505
|
+
/* Structural: positioned absolutely by the framework wrapper; must sit above
|
|
506
|
+
selection (z:5), editing (z:10), fill handle (z:11). */
|
|
507
|
+
.gp-grid-cell-peek {
|
|
508
|
+
position: absolute;
|
|
509
|
+
z-index: 20;
|
|
510
|
+
box-sizing: border-box;
|
|
511
|
+
overflow: auto;
|
|
512
|
+
max-height: 320px;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
:where(.gp-grid-cell-peek) {
|
|
516
|
+
padding: 8px 11px;
|
|
517
|
+
background-color: var(--gp-grid-bg);
|
|
518
|
+
color: var(--gp-grid-text);
|
|
519
|
+
border: 2px solid var(--gp-grid-primary);
|
|
520
|
+
border-radius: 3px;
|
|
521
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
522
|
+
font-family: inherit;
|
|
523
|
+
font-size: inherit;
|
|
524
|
+
line-height: 1.4;
|
|
525
|
+
white-space: pre-wrap;
|
|
526
|
+
overflow-wrap: anywhere;
|
|
527
|
+
cursor: text;
|
|
528
|
+
user-select: text;
|
|
529
|
+
-webkit-user-select: text;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
|
|
462
533
|
|
|
463
534
|
/* =============================================================================
|
|
464
535
|
Loading & Error States
|
|
@@ -481,12 +552,15 @@
|
|
|
481
552
|
top: 0;
|
|
482
553
|
left: 0;
|
|
483
554
|
width: 100%;
|
|
484
|
-
height: 100%;
|
|
555
|
+
height: 100%;
|
|
485
556
|
pointer-events: none;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
:where(.gp-grid-loading-overlay) {
|
|
486
560
|
background-color: var(--gp-grid-loading-overlay-bg, rgba(255, 255, 255, 0.4));
|
|
487
561
|
}
|
|
488
562
|
|
|
489
|
-
.gp-grid-container--dark .gp-grid-loading-overlay {
|
|
563
|
+
:where(.gp-grid-container--dark .gp-grid-loading-overlay) {
|
|
490
564
|
background-color: var(--gp-grid-loading-overlay-bg, rgba(0, 0, 0, 0.3));
|
|
491
565
|
}
|
|
492
566
|
|
|
@@ -496,6 +570,13 @@
|
|
|
496
570
|
top: 50%;
|
|
497
571
|
left: 50%;
|
|
498
572
|
transform: translate(-50%, -50%);
|
|
573
|
+
z-index: 1000;
|
|
574
|
+
display: flex;
|
|
575
|
+
pointer-events: auto;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
:where(.gp-grid-loading) {
|
|
579
|
+
align-items: center;
|
|
499
580
|
padding: 12px 20px;
|
|
500
581
|
background-color: var(--gp-grid-loading-bg);
|
|
501
582
|
color: var(--gp-grid-loading-text);
|
|
@@ -503,20 +584,19 @@
|
|
|
503
584
|
border: 1px solid var(--gp-grid-border);
|
|
504
585
|
font-weight: 500;
|
|
505
586
|
font-size: 13px;
|
|
506
|
-
z-index: 1000;
|
|
507
|
-
display: flex;
|
|
508
|
-
align-items: center;
|
|
509
587
|
gap: 10px;
|
|
510
|
-
pointer-events: auto;
|
|
511
588
|
}
|
|
512
589
|
|
|
513
590
|
.gp-grid-loading-spinner {
|
|
514
591
|
width: 16px;
|
|
515
592
|
height: 16px;
|
|
593
|
+
animation: gp-grid-spin 0.7s linear infinite;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
:where(.gp-grid-loading-spinner) {
|
|
516
597
|
border: 2px solid var(--gp-grid-border);
|
|
517
598
|
border-top-color: var(--gp-grid-primary);
|
|
518
599
|
border-radius: 50%;
|
|
519
|
-
animation: gp-grid-spin 0.7s linear infinite;
|
|
520
600
|
}
|
|
521
601
|
|
|
522
602
|
@keyframes gp-grid-spin {
|
|
@@ -530,6 +610,12 @@
|
|
|
530
610
|
top: 50%;
|
|
531
611
|
left: 50%;
|
|
532
612
|
transform: translate(-50%, -50%);
|
|
613
|
+
z-index: 1000;
|
|
614
|
+
user-select: text;
|
|
615
|
+
-webkit-user-select: text;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
:where(.gp-grid-error) {
|
|
533
619
|
padding: 12px 20px;
|
|
534
620
|
background-color: var(--gp-grid-error-bg);
|
|
535
621
|
color: var(--gp-grid-error-text);
|
|
@@ -537,11 +623,8 @@
|
|
|
537
623
|
border: 1px solid var(--gp-grid-error-text);
|
|
538
624
|
font-weight: 500;
|
|
539
625
|
font-size: 13px;
|
|
540
|
-
z-index: 1000;
|
|
541
626
|
max-width: 80%;
|
|
542
627
|
text-align: center;
|
|
543
|
-
user-select: text;
|
|
544
|
-
-webkit-user-select: text;
|
|
545
628
|
cursor: text;
|
|
546
629
|
}
|
|
547
630
|
|
|
@@ -554,6 +637,9 @@
|
|
|
554
637
|
top: 50%;
|
|
555
638
|
left: 50%;
|
|
556
639
|
transform: translate(-50%, -50%);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
:where(.gp-grid-empty) {
|
|
557
643
|
color: var(--gp-grid-text-muted);
|
|
558
644
|
font-size: 14px;
|
|
559
645
|
text-align: center;
|
|
@@ -569,20 +655,20 @@
|
|
|
569
655
|
height: 8px;
|
|
570
656
|
}
|
|
571
657
|
|
|
572
|
-
.gp-grid-container::-webkit-scrollbar-track {
|
|
658
|
+
:where(.gp-grid-container)::-webkit-scrollbar-track {
|
|
573
659
|
background-color: var(--gp-grid-scrollbar-track);
|
|
574
660
|
}
|
|
575
661
|
|
|
576
|
-
.gp-grid-container::-webkit-scrollbar-thumb {
|
|
662
|
+
:where(.gp-grid-container)::-webkit-scrollbar-thumb {
|
|
577
663
|
background-color: var(--gp-grid-scrollbar-thumb);
|
|
578
664
|
border-radius: 4px;
|
|
579
665
|
}
|
|
580
666
|
|
|
581
|
-
.gp-grid-container::-webkit-scrollbar-thumb:hover {
|
|
667
|
+
:where(.gp-grid-container)::-webkit-scrollbar-thumb:hover {
|
|
582
668
|
background-color: var(--gp-grid-scrollbar-thumb-hover);
|
|
583
669
|
}
|
|
584
670
|
|
|
585
|
-
.gp-grid-container::-webkit-scrollbar-corner {
|
|
671
|
+
:where(.gp-grid-container)::-webkit-scrollbar-corner {
|
|
586
672
|
background-color: var(--gp-grid-scrollbar-track);
|
|
587
673
|
}
|
|
588
674
|
|
|
@@ -592,17 +678,21 @@
|
|
|
592
678
|
============================================================================= */
|
|
593
679
|
|
|
594
680
|
.gp-grid-filter-popup {
|
|
681
|
+
max-height: 400px;
|
|
682
|
+
max-width: min(360px, calc(100vw - 16px));
|
|
683
|
+
display: flex;
|
|
684
|
+
flex-direction: column;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
:where(.gp-grid-filter-popup) {
|
|
595
688
|
background-color: var(--gp-grid-bg);
|
|
596
689
|
border: 1px solid var(--gp-grid-border);
|
|
597
690
|
border-radius: 6px;
|
|
598
691
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
599
|
-
max-height: 400px;
|
|
600
|
-
display: flex;
|
|
601
|
-
flex-direction: column;
|
|
602
692
|
font-size: 13px;
|
|
603
693
|
}
|
|
604
694
|
|
|
605
|
-
.gp-grid-filter-header {
|
|
695
|
+
:where(.gp-grid-filter-header) {
|
|
606
696
|
padding: 10px 12px;
|
|
607
697
|
font-weight: 600;
|
|
608
698
|
border-bottom: 1px solid var(--gp-grid-border-light);
|
|
@@ -610,17 +700,23 @@
|
|
|
610
700
|
}
|
|
611
701
|
|
|
612
702
|
.gp-grid-filter-content {
|
|
613
|
-
padding: 10px 12px;
|
|
614
703
|
display: flex;
|
|
615
704
|
flex-direction: column;
|
|
616
|
-
gap: 10px;
|
|
617
705
|
overflow-y: auto;
|
|
618
706
|
min-height: 0;
|
|
619
707
|
}
|
|
620
708
|
|
|
709
|
+
:where(.gp-grid-filter-content) {
|
|
710
|
+
padding: 10px 12px;
|
|
711
|
+
gap: 10px;
|
|
712
|
+
}
|
|
713
|
+
|
|
621
714
|
/* Mode toggle (Values / Condition) */
|
|
622
715
|
.gp-grid-filter-mode-toggle {
|
|
623
716
|
display: flex;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
:where(.gp-grid-filter-mode-toggle) {
|
|
624
720
|
gap: 4px;
|
|
625
721
|
background-color: var(--gp-grid-bg-alt);
|
|
626
722
|
border-radius: 4px;
|
|
@@ -629,6 +725,9 @@
|
|
|
629
725
|
|
|
630
726
|
.gp-grid-filter-mode-toggle button {
|
|
631
727
|
flex: 1;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
:where(.gp-grid-filter-mode-toggle button) {
|
|
632
731
|
padding: 6px 10px;
|
|
633
732
|
font-size: 11px;
|
|
634
733
|
font-family: inherit;
|
|
@@ -640,18 +739,18 @@
|
|
|
640
739
|
transition: background-color 0.15s ease, color 0.15s ease;
|
|
641
740
|
}
|
|
642
741
|
|
|
643
|
-
.gp-grid-filter-mode-toggle button:hover {
|
|
742
|
+
:where(.gp-grid-filter-mode-toggle button:hover) {
|
|
644
743
|
color: var(--gp-grid-text);
|
|
645
744
|
}
|
|
646
745
|
|
|
647
|
-
.gp-grid-filter-mode-toggle button.active {
|
|
746
|
+
:where(.gp-grid-filter-mode-toggle button.active) {
|
|
648
747
|
background-color: var(--gp-grid-bg);
|
|
649
748
|
color: var(--gp-grid-text);
|
|
650
749
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
651
750
|
}
|
|
652
751
|
|
|
653
752
|
/* Info message for too many values */
|
|
654
|
-
.gp-grid-filter-info {
|
|
753
|
+
:where(.gp-grid-filter-info) {
|
|
655
754
|
font-size: 11px;
|
|
656
755
|
color: var(--gp-grid-text-secondary);
|
|
657
756
|
padding: 6px 8px;
|
|
@@ -663,6 +762,10 @@
|
|
|
663
762
|
.gp-grid-filter-search {
|
|
664
763
|
width: 100%;
|
|
665
764
|
height: 30px;
|
|
765
|
+
box-sizing: border-box;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
:where(.gp-grid-filter-search) {
|
|
666
769
|
padding: 0 10px;
|
|
667
770
|
font-family: inherit;
|
|
668
771
|
font-size: 12px;
|
|
@@ -670,10 +773,9 @@
|
|
|
670
773
|
border-radius: 4px;
|
|
671
774
|
background-color: var(--gp-grid-input-bg);
|
|
672
775
|
color: var(--gp-grid-text);
|
|
673
|
-
box-sizing: border-box;
|
|
674
776
|
}
|
|
675
777
|
|
|
676
|
-
.gp-grid-filter-search:focus {
|
|
778
|
+
:where(.gp-grid-filter-search:focus) {
|
|
677
779
|
outline: none;
|
|
678
780
|
border-color: var(--gp-grid-primary);
|
|
679
781
|
}
|
|
@@ -681,11 +783,17 @@
|
|
|
681
783
|
/* Select All / Deselect All actions */
|
|
682
784
|
.gp-grid-filter-actions {
|
|
683
785
|
display: flex;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
:where(.gp-grid-filter-actions) {
|
|
684
789
|
gap: 8px;
|
|
685
790
|
}
|
|
686
791
|
|
|
687
792
|
.gp-grid-filter-actions button {
|
|
688
793
|
flex: 1;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
:where(.gp-grid-filter-actions button) {
|
|
689
797
|
padding: 4px 8px;
|
|
690
798
|
font-size: 11px;
|
|
691
799
|
font-family: inherit;
|
|
@@ -696,11 +804,11 @@
|
|
|
696
804
|
cursor: pointer;
|
|
697
805
|
}
|
|
698
806
|
|
|
699
|
-
.gp-grid-filter-actions button:hover:not(:disabled) {
|
|
807
|
+
:where(.gp-grid-filter-actions button:hover:not(:disabled)) {
|
|
700
808
|
background-color: var(--gp-grid-hover);
|
|
701
809
|
}
|
|
702
810
|
|
|
703
|
-
.gp-grid-filter-actions button:disabled {
|
|
811
|
+
:where(.gp-grid-filter-actions button:disabled) {
|
|
704
812
|
opacity: 0.5;
|
|
705
813
|
cursor: not-allowed;
|
|
706
814
|
}
|
|
@@ -711,6 +819,9 @@
|
|
|
711
819
|
overflow-y: auto;
|
|
712
820
|
display: flex;
|
|
713
821
|
flex-direction: column;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
:where(.gp-grid-filter-list) {
|
|
714
825
|
gap: 4px;
|
|
715
826
|
border: 1px solid var(--gp-grid-border-light);
|
|
716
827
|
border-radius: 4px;
|
|
@@ -720,18 +831,24 @@
|
|
|
720
831
|
.gp-grid-filter-option {
|
|
721
832
|
display: flex;
|
|
722
833
|
align-items: center;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
:where(.gp-grid-filter-option) {
|
|
723
837
|
gap: 8px;
|
|
724
838
|
padding: 4px 6px;
|
|
725
839
|
border-radius: 3px;
|
|
726
840
|
cursor: pointer;
|
|
727
841
|
}
|
|
728
842
|
|
|
729
|
-
.gp-grid-filter-option:hover {
|
|
843
|
+
:where(.gp-grid-filter-option:hover) {
|
|
730
844
|
background-color: var(--gp-grid-hover);
|
|
731
845
|
}
|
|
732
846
|
|
|
733
847
|
.gp-grid-filter-option input[type="checkbox"] {
|
|
734
848
|
margin: 0;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
:where(.gp-grid-filter-option input[type="checkbox"]) {
|
|
735
852
|
cursor: pointer;
|
|
736
853
|
}
|
|
737
854
|
|
|
@@ -742,7 +859,7 @@
|
|
|
742
859
|
white-space: nowrap;
|
|
743
860
|
}
|
|
744
861
|
|
|
745
|
-
.gp-grid-filter-blank {
|
|
862
|
+
:where(.gp-grid-filter-blank) {
|
|
746
863
|
font-style: italic;
|
|
747
864
|
color: var(--gp-grid-text-muted);
|
|
748
865
|
}
|
|
@@ -751,17 +868,26 @@
|
|
|
751
868
|
.gp-grid-filter-condition {
|
|
752
869
|
display: flex;
|
|
753
870
|
flex-direction: column;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
:where(.gp-grid-filter-condition) {
|
|
754
874
|
gap: 6px;
|
|
755
875
|
}
|
|
756
876
|
|
|
757
877
|
.gp-grid-filter-row {
|
|
758
878
|
display: flex;
|
|
759
879
|
align-items: center;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
:where(.gp-grid-filter-row) {
|
|
760
883
|
gap: 6px;
|
|
761
884
|
}
|
|
762
885
|
|
|
763
886
|
.gp-grid-filter-row select {
|
|
764
887
|
height: 30px;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
:where(.gp-grid-filter-row select) {
|
|
765
891
|
padding: 0 6px;
|
|
766
892
|
font-family: inherit;
|
|
767
893
|
font-size: 12px;
|
|
@@ -778,6 +904,14 @@
|
|
|
778
904
|
.gp-grid-filter-text-input {
|
|
779
905
|
flex: 1;
|
|
780
906
|
height: 30px;
|
|
907
|
+
min-width: 0;
|
|
908
|
+
box-sizing: border-box;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
:where(.gp-grid-filter-row input[type="number"]),
|
|
912
|
+
:where(.gp-grid-filter-row input[type="date"]),
|
|
913
|
+
:where(.gp-grid-filter-row input[type="text"]),
|
|
914
|
+
:where(.gp-grid-filter-text-input) {
|
|
781
915
|
padding: 0 8px;
|
|
782
916
|
font-family: inherit;
|
|
783
917
|
font-size: 12px;
|
|
@@ -785,16 +919,14 @@
|
|
|
785
919
|
border-radius: 4px;
|
|
786
920
|
background-color: var(--gp-grid-input-bg);
|
|
787
921
|
color: var(--gp-grid-text);
|
|
788
|
-
min-width: 0;
|
|
789
|
-
box-sizing: border-box;
|
|
790
922
|
}
|
|
791
923
|
|
|
792
|
-
.gp-grid-filter-row input:focus {
|
|
924
|
+
:where(.gp-grid-filter-row input:focus) {
|
|
793
925
|
outline: none;
|
|
794
926
|
border-color: var(--gp-grid-primary);
|
|
795
927
|
}
|
|
796
928
|
|
|
797
|
-
.gp-grid-filter-to {
|
|
929
|
+
:where(.gp-grid-filter-to) {
|
|
798
930
|
font-size: 11px;
|
|
799
931
|
color: var(--gp-grid-text-secondary);
|
|
800
932
|
}
|
|
@@ -802,6 +934,9 @@
|
|
|
802
934
|
.gp-grid-filter-remove {
|
|
803
935
|
width: 24px;
|
|
804
936
|
height: 24px;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
:where(.gp-grid-filter-remove) {
|
|
805
940
|
padding: 0;
|
|
806
941
|
font-size: 16px;
|
|
807
942
|
line-height: 1;
|
|
@@ -812,7 +947,7 @@
|
|
|
812
947
|
cursor: pointer;
|
|
813
948
|
}
|
|
814
949
|
|
|
815
|
-
.gp-grid-filter-remove:hover {
|
|
950
|
+
:where(.gp-grid-filter-remove:hover) {
|
|
816
951
|
background-color: var(--gp-grid-error-bg);
|
|
817
952
|
color: var(--gp-grid-error-text);
|
|
818
953
|
}
|
|
@@ -820,12 +955,18 @@
|
|
|
820
955
|
/* AND/OR combination toggle */
|
|
821
956
|
.gp-grid-filter-combination {
|
|
822
957
|
display: flex;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
:where(.gp-grid-filter-combination) {
|
|
823
961
|
gap: 4px;
|
|
824
962
|
margin-bottom: 4px;
|
|
825
963
|
}
|
|
826
964
|
|
|
827
965
|
.gp-grid-filter-combination button {
|
|
828
966
|
flex: 1;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
:where(.gp-grid-filter-combination button) {
|
|
829
970
|
padding: 4px 8px;
|
|
830
971
|
font-size: 10px;
|
|
831
972
|
font-family: inherit;
|
|
@@ -836,7 +977,7 @@
|
|
|
836
977
|
cursor: pointer;
|
|
837
978
|
}
|
|
838
979
|
|
|
839
|
-
.gp-grid-filter-combination button.active {
|
|
980
|
+
:where(.gp-grid-filter-combination button.active) {
|
|
840
981
|
background-color: var(--gp-grid-primary);
|
|
841
982
|
border-color: var(--gp-grid-primary);
|
|
842
983
|
color: #fff;
|
|
@@ -845,6 +986,9 @@
|
|
|
845
986
|
/* Add condition button */
|
|
846
987
|
.gp-grid-filter-add {
|
|
847
988
|
width: 100%;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
:where(.gp-grid-filter-add) {
|
|
848
992
|
padding: 6px;
|
|
849
993
|
font-size: 11px;
|
|
850
994
|
font-family: inherit;
|
|
@@ -855,7 +999,7 @@
|
|
|
855
999
|
cursor: pointer;
|
|
856
1000
|
}
|
|
857
1001
|
|
|
858
|
-
.gp-grid-filter-add:hover {
|
|
1002
|
+
:where(.gp-grid-filter-add:hover) {
|
|
859
1003
|
background-color: var(--gp-grid-hover);
|
|
860
1004
|
border-color: var(--gp-grid-primary);
|
|
861
1005
|
color: var(--gp-grid-primary);
|
|
@@ -864,6 +1008,9 @@
|
|
|
864
1008
|
/* Apply / Clear buttons */
|
|
865
1009
|
.gp-grid-filter-buttons {
|
|
866
1010
|
display: flex;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
:where(.gp-grid-filter-buttons) {
|
|
867
1014
|
gap: 8px;
|
|
868
1015
|
padding-top: 8px;
|
|
869
1016
|
border-top: 1px solid var(--gp-grid-border-light);
|
|
@@ -872,6 +1019,10 @@
|
|
|
872
1019
|
.gp-grid-filter-btn-clear,
|
|
873
1020
|
.gp-grid-filter-btn-apply {
|
|
874
1021
|
flex: 1;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
:where(.gp-grid-filter-btn-clear),
|
|
1025
|
+
:where(.gp-grid-filter-btn-apply) {
|
|
875
1026
|
padding: 8px 12px;
|
|
876
1027
|
font-size: 12px;
|
|
877
1028
|
font-family: inherit;
|
|
@@ -879,23 +1030,23 @@
|
|
|
879
1030
|
cursor: pointer;
|
|
880
1031
|
}
|
|
881
1032
|
|
|
882
|
-
.gp-grid-filter-btn-clear {
|
|
1033
|
+
:where(.gp-grid-filter-btn-clear) {
|
|
883
1034
|
border: 1px solid var(--gp-grid-input-border);
|
|
884
1035
|
background-color: var(--gp-grid-bg);
|
|
885
1036
|
color: var(--gp-grid-text);
|
|
886
1037
|
}
|
|
887
1038
|
|
|
888
|
-
.gp-grid-filter-btn-clear:hover {
|
|
1039
|
+
:where(.gp-grid-filter-btn-clear:hover) {
|
|
889
1040
|
background-color: var(--gp-grid-hover);
|
|
890
1041
|
}
|
|
891
1042
|
|
|
892
|
-
.gp-grid-filter-btn-apply {
|
|
1043
|
+
:where(.gp-grid-filter-btn-apply) {
|
|
893
1044
|
border: 1px solid var(--gp-grid-primary);
|
|
894
1045
|
background-color: var(--gp-grid-primary);
|
|
895
1046
|
color: #fff;
|
|
896
1047
|
}
|
|
897
1048
|
|
|
898
|
-
.gp-grid-filter-btn-apply:hover {
|
|
1049
|
+
:where(.gp-grid-filter-btn-apply:hover) {
|
|
899
1050
|
opacity: 0.9;
|
|
900
1051
|
}
|
|
901
1052
|
|
|
@@ -905,11 +1056,14 @@
|
|
|
905
1056
|
============================================================================= */
|
|
906
1057
|
|
|
907
1058
|
.gp-grid-cell--row-drag-handle {
|
|
908
|
-
cursor: grab;
|
|
909
1059
|
touch-action: none;
|
|
910
1060
|
}
|
|
911
1061
|
|
|
912
|
-
.gp-grid-cell--row-drag-handle
|
|
1062
|
+
:where(.gp-grid-cell--row-drag-handle) {
|
|
1063
|
+
cursor: grab;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
:where(.gp-grid-cell--row-drag-handle:active) {
|
|
913
1067
|
cursor: grabbing;
|
|
914
1068
|
}
|
|
915
1069
|
|
|
@@ -919,6 +1073,9 @@
|
|
|
919
1073
|
justify-content: center;
|
|
920
1074
|
width: 100%;
|
|
921
1075
|
height: 100%;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
:where(.gp-grid-row-drag-icon) {
|
|
922
1079
|
color: var(--gp-grid-text-secondary);
|
|
923
1080
|
}
|
|
924
1081
|
|
|
@@ -930,14 +1087,17 @@
|
|
|
930
1087
|
.gp-grid-row-drag-ghost {
|
|
931
1088
|
position: fixed;
|
|
932
1089
|
pointer-events: none;
|
|
933
|
-
opacity: 0.8;
|
|
934
1090
|
z-index: 2000;
|
|
1091
|
+
overflow: hidden;
|
|
1092
|
+
box-sizing: border-box;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
:where(.gp-grid-row-drag-ghost) {
|
|
1096
|
+
opacity: 0.8;
|
|
935
1097
|
background-color: var(--gp-grid-bg, #fff);
|
|
936
1098
|
border: 2px solid var(--gp-grid-primary);
|
|
937
1099
|
border-radius: 4px;
|
|
938
1100
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
939
|
-
overflow: hidden;
|
|
940
|
-
box-sizing: border-box;
|
|
941
1101
|
}
|
|
942
1102
|
|
|
943
1103
|
.gp-grid-row-drop-indicator {
|
|
@@ -945,8 +1105,11 @@
|
|
|
945
1105
|
left: 0;
|
|
946
1106
|
width: 100%;
|
|
947
1107
|
height: 3px;
|
|
948
|
-
background-color: var(--gp-grid-primary);
|
|
949
1108
|
z-index: 1000;
|
|
950
1109
|
pointer-events: none;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
:where(.gp-grid-row-drop-indicator) {
|
|
1113
|
+
background-color: var(--gp-grid-primary);
|
|
951
1114
|
border-radius: 2px;
|
|
952
1115
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gp-grid/react",
|
|
3
3
|
"description": "A high-performance React data grid component with virtual scrolling, cell selection, sorting, filtering, and Excel-like editing",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"link-workspace-packages": false
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@gp-grid/core": "0.
|
|
55
|
+
"@gp-grid/core": "0.17.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": "^18.0.0 || ^19.0.0",
|