@hpcc-js/dgrid2 2.3.8 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +1188 -1418
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1188 -1418
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -6
- package/src/__package__.ts +2 -2
- package/src/reactTable.tsx +3 -3
- package/types/__package__.d.ts +2 -2
- package/types/reactTable.d.ts +1 -1
- package/types/reactTable.d.ts.map +1 -1
- package/types/table.d.ts +1 -1
- package/types/table.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/reactTable.d.ts +1 -1
- package/types-3.4/table.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
})(this, (function (exports, common) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var PKG_NAME = "@hpcc-js/dgrid2";
|
|
8
|
-
var PKG_VERSION = "2.3.
|
|
9
|
-
var BUILD_VERSION = "2.104.
|
|
8
|
+
var PKG_VERSION = "2.3.9";
|
|
9
|
+
var BUILD_VERSION = "2.104.20";
|
|
10
10
|
|
|
11
11
|
/******************************************************************************
|
|
12
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -71,255 +71,21 @@
|
|
|
71
71
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
var n,l$1,u$1,t$1,o$2,r$2,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$2(n,l){if(null==l)return n.__?_$2(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$2(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$2.__r++||o$2!==l$1.debounceRendering)&&((o$2=l$1.debounceRendering)||setTimeout)(g$2);}function g$2(){for(var n;g$2.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$2(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$2(t):o,t.__h),z$2(u,t),t.__e!=o&&k$1(t)));});}function w$2(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$2(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A$1(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$2(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N$1(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M$1(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A$1(u,i,i,t,i.__e,l));return l}function x$1(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){x$1(n,l);}):l.push(n)),l}function A$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$1(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$2:I$1,o):n.removeEventListener(l,o?T$2:I$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I$1(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$2(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$2(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$1(g,x),h.constructor=T,h.render=O$1),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$2(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$1(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$2(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L$1(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$2(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$2(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H$1(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H$1(l,"checked",k,y.checked,!1));}return l}function M$1(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N$1(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$1(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N$1(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O$1(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$2(i,u=(!o&&t||i).__k=h$1(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$2(e,u);}function B$2(n,l){var u={__c:l="__cC"+r$2++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$2.__r=0,r$2=0;
|
|
74
|
+
var n,l$1,u$1,t$1,o$2,r$2,f$1,e$1,c$1={},s$1=[],a$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v$1=Array.isArray;function h$1(n,l){for(var u in l)n[u]=l[u];return n}function p$1(n){var l=n.parentNode;l&&l.removeChild(n);}function y$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d$1(l,f,t,o,null)}function d$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$2(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function g$2(n,l){if(null==l)return n.__?g$2(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?g$2(n):null}function m$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return m$1(n)}}function w$2(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!x$1.__r++||o$2!==l$1.debounceRendering)&&((o$2=l$1.debounceRendering)||r$2)(x$1);}function x$1(){var n,l,u,i,o,r,e,c;for(t$1.sort(f$1);n=t$1.shift();)n.__d&&(l=t$1.length,i=void 0,o=void 0,e=(r=(u=n).__v).__e,(c=u.__P)&&(i=[],(o=h$1({},r)).__v=r.__v+1,L$1(c,r,o,u.__n,void 0!==c.ownerSVGElement,null!=r.__h?[e]:null,i,null==e?g$2(r):e,r.__h),M(i,r),r.__e!=e&&m$1(r)),t$1.length>l&&t$1.sort(f$1));x$1.__r=0;}function P(n,l,u,i,t,o,r,f,e,a){var h,p,y,_,b,m,w,x=i&&i.__k||s$1,P=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _||"function"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?d$1(null,_,null,null,_):v$1(_)?d$1(k$2,{children:_},null,null,null):_.__b>0?d$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(y=x[h])||y&&_.key==y.key&&_.type===y.type)x[h]=void 0;else for(p=0;p<P;p++){if((y=x[p])&&_.key==y.key&&_.type===y.type){x[p]=void 0;break}y=null;}L$1(n,_,y=y||c$1,t,o,r,f,e,a),b=_.__e,(p=_.ref)&&y.ref!=p&&(w||(w=[]),y.ref&&w.push(y.ref,null,_),w.push(p,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===y.__k?_.__d=e=C$1(_,e,n):e=$$1(n,_,y,x,b,e),"function"==typeof u.type&&(u.__d=e)):e&&y.__e==e&&e.parentNode!=n&&(e=g$2(y));}for(u.__e=m,h=P;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=A$1(i).nextSibling),q$2(x[h],x[h]));if(w)for(h=0;h<w.length;h++)O(w[h],w[++h],w[++h]);}function C$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?C$1(i,l,u):$$1(u,i,i,t,i.__e,l));return l}function S(n,l){return l=l||[],null==n||"boolean"==typeof n||(v$1(n)?n.some(function(n){S(n,l);}):l.push(n)),l}function $$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A$1(n){var l,u,i;if(null==n.type||"string"==typeof n.type)return n.__e;if(n.__k)for(l=n.__k.length-1;l>=0;l--)if((u=n.__k[l])&&(i=A$1(u)))return i;return null}function H$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||T$2(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||T$2(n,o,l[o],u[o],i);}function I$1(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$1.test(l)?u:u+"px";}function T$2(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||I$1(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||I$1(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?z$1:j$1,o):n.removeEventListener(l,o?z$1:j$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function j$1(n){return this.l[n.type+!1](l$1.event?l$1.event(n):n)}function z$1(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function L$1(n,u,i,t,o,r,f,e,c){var s,a,p,y,d,_,g,m,w,x,C,S,$,A,H,I=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof I){if(m=u.props,w=(s=I.contextType)&&t[s.__c],x=s?w?w.props.value:s.__:t,i.__c?g=(a=u.__c=i.__c).__=a.__E:("prototype"in I&&I.prototype.render?u.__c=a=new I(m,x):(u.__c=a=new b$1(m,x),a.constructor=I,a.render=B$2),w&&w.sub(a),a.props=m,a.state||(a.state={}),a.context=x,a.__n=t,p=a.__d=!0,a.__h=[],a._sb=[]),null==a.__s&&(a.__s=a.state),null!=I.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=h$1({},a.__s)),h$1(a.__s,I.getDerivedStateFromProps(m,a.__s))),y=a.props,d=a.state,a.__v=u,p)null==I.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else {if(null==I.getDerivedStateFromProps&&m!==y&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(m,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(m,a.__s,x)||u.__v===i.__v){for(u.__v!==i.__v&&(a.props=m,a.state=a.__s,a.__d=!1),a.__e=!1,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),C=0;C<a._sb.length;C++)a.__h.push(a._sb[C]);a._sb=[],a.__h.length&&f.push(a);break n}null!=a.componentWillUpdate&&a.componentWillUpdate(m,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(y,d,_);});}if(a.context=x,a.props=m,a.__P=n,S=l$1.__r,$=0,"prototype"in I&&I.prototype.render){for(a.state=a.__s,a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),A=0;A<a._sb.length;A++)a.__h.push(a._sb[A]);a._sb=[];}else do{a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),a.state=a.__s;}while(a.__d&&++$<25);a.state=a.__s,null!=a.getChildContext&&(t=h$1(h$1({},t),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(_=a.getSnapshotBeforeUpdate(y,d)),P(n,v$1(H=null!=s&&s.type===k$2&&null==s.key?s.props.children:s)?H:[H],u,i,t,o,r,f,e,c),a.base=u.__e,u.__h=null,a.__h.length&&f.push(a),g&&(a.__E=a.__=null),a.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=N$1(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function M(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function N$1(l,u,i,t,o,r,f,e){var s,a,h,y=i.props,d=u.props,_=u.type,k=0;if("svg"===_&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!_&&(_?s.localName===_:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===_)return document.createTextNode(d);l=o?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),r=null,e=!1;}if(null===_)y===d||e&&l.data===d||(l.data=d);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||c$1).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!e){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(h||a)&&(h&&(a&&h.__html==a.__html||h.__html===l.innerHTML)||(l.innerHTML=h&&h.__html||""));}if(H$1(l,d,y,o,e),h)u.__k=[];else if(P(l,v$1(k=u.props.children)?k:[k],u,i,t,o&&"foreignObject"!==_,r,f,r?r[0]:i.__k&&g$2(i,0),e),null!=r)for(k=r.length;k--;)null!=r[k]&&p$1(r[k]);e||("value"in d&&void 0!==(k=d.value)&&(k!==l.value||"progress"===_&&!k||"option"===_&&k!==y.value)&&T$2(l,"value",k,y.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==l.checked&&T$2(l,"checked",k,y.checked,!1));}return l}function O(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function q$2(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||O(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&q$2(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function B$2(n,l,u){return this.constructor(n,u)}function D$1(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],L$1(i,u=(!o&&t||i).__k=y$1(k$2,null,[u]),r||c$1,c$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),M(f,u);}function G$1(n,l){var u={__c:l="__cC"+e$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w$2(n);});},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h$1({},this.state),"function"==typeof n&&(n=n(h$1({},u),this.props)),n&&h$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w$2(this));},b$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w$2(this));},b$1.prototype.render=k$2,t$1=[],r$2="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},x$1.__r=0,e$1=0;
|
|
75
75
|
|
|
76
|
-
var t,r$1,u,i,o$1=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r$1,t,o$1||u),o$1=0;var i=r$1.__H||(r$1.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function
|
|
76
|
+
var t,r$1,u,i,o$1=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r$1,t,o$1||u),o$1=0;var i=r$1.__H||(r$1.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o$1=1,s(B$1,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$1,!r$1.u)){var f=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r$1.u=!0;var c=r$1.shouldComponentUpdate,e=r$1.componentWillUpdate;r$1.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r$1.shouldComponentUpdate=f;}return o.__N||o.__}function p(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__H.__h.push(o));}function y(u,i){var o=d(t++,4);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__h.push(o));}function _$1(n){return o$1=5,F$1(function(){return {current:n}},[])}function A(n,t,r){o$1=6,y(function(){return "function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n));}function F$1(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$1(n,t){return o$1=8,F$1(function(){return n},t)}function q$1(n){var u=r$1.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r$1)),u.props.value):n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$1),t.__H.__h.forEach(w$1),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r$1=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r$1=n.__c).__H;i&&(u===r$1?(i.__h=[],r$1.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k$1),i.__h.forEach(w$1),i.__h=[],t=0)),u=r$1;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r$1=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$1),t.__h=t.__h.filter(function(n){return !n.__||w$1(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$1(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g$1="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g$1&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$1&&(t=requestAnimationFrame(r));}function k$1(n){var t=r$1,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$1=t;}function w$1(n){var t=r$1;n.__c=n.__(),r$1=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
|
|
77
77
|
|
|
78
|
-
function g(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function
|
|
78
|
+
function g(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function w(n){this.props=n;}function x(n,e){function r(n){var t=this.props.ref,r=t==n.ref;return !r&&t&&(t.call?t(null):t.current=null),e?!e(this.props,n)||!r:C(this.props,n)}function u(e){return this.shouldComponentUpdate=r,y$1(n,e)}return u.displayName="Memo("+(n.displayName||n.name)+")",u.prototype.isReactComponent=!0,u.__f=!0,u}(w.prototype=new b$1).isPureReactComponent=!0,w.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var R=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),R&&R(n);};var N="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function k(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=N,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var T=l$1.__e;l$1.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);T(n,t,e,r);};var I=l$1.unmount;function L(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return L(n,t,e)})),n}function U(n,t,e){return n&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return U(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.insertBefore(n.__e,n.__d),n.__c.__e=!0,n.__c.__P=e)),n}function D(){this.__u=0,this.t=null,this.__b=null;}function F(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function V(){this.u=null,this.o=null;}l$1.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),I&&I(n);},(D.prototype=new b$1).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=F(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=U(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate();}},c=!0===t.__h;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i);},D.prototype.componentWillUnmount=function(){this.t=[];},D.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=L(this.__b,r,o.__O=o.__P);}this.__b=null;}var i=e.__a&&y$1(k$2,null,n.fallback);return i&&(i.__h=null),[y$1(k$2,null,e.__a?null:n.children),i]};var W=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.u=e=e[2];}};(V.prototype=new b$1).__a=function(n){var t=this,e=F(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),W(t,n,r)):u();};e?e(o):o();}},V.prototype.render=function(n){this.u=null,this.o=new Map;var t=S(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},V.prototype.componentDidUpdate=V.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){W(n,e,t);});};var B="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,H=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Z=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Y=/[A-Z0-9]/g,$="undefined"!=typeof document,q=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function G(n,t,e){return null==t.__k&&(t.textContent=""),D$1(n,t),"function"==typeof e&&e(),n?n.__c:null}b$1.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(b$1.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n});}});});var K=l$1.event;function Q(){}function X(){return this.cancelBubble}function nn(){return this.defaultPrevented}l$1.event=function(n){return K&&(n=K(n)),n.persist=Q,n.isPropagationStopped=X,n.isDefaultPrevented=nn,n.nativeEvent=n};var en={enumerable:!1,configurable:!0,get:function(){return this.class}},rn=l$1.vnode;l$1.vnode=function(n){"string"==typeof n.type&&function(n){var t=n.props,e=n.type,u={};for(var o in t){var i=t[o];if(!("value"===o&&"defaultValue"in t&&null==i||$&&"children"===o&&"noscript"===e||"class"===o||"className"===o)){var l=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===i?i="":"ondoubleclick"===l?o="ondblclick":"onchange"!==l||"input"!==e&&"textarea"!==e||q(t.type)?"onfocus"===l?o="onfocusin":"onblur"===l?o="onfocusout":Z.test(o)?o=l:-1===e.indexOf("-")&&H.test(o)?o=o.replace(Y,"-$&").toLowerCase():null===i&&(i=void 0):l=o="oninput","oninput"===l&&u[o=l]&&(o="oninputCapture"),u[o]=i;}}"select"==e&&u.multiple&&Array.isArray(u.value)&&(u.value=S(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value);})),"select"==e&&null!=u.defaultValue&&(u.value=S(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value;})),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,"className",en)):(t.className&&!t.class||t.class&&t.className)&&(u.class=u.className=t.className),n.props=u;}(n),n.$$typeof=B,rn&&rn(n);};var un=l$1.__r;l$1.__r=function(n){un&&un(n),n.__c;};var on=l$1.diffed;l$1.diffed=function(n){on&&on(n);var t=n.props,e=n.__e;null!=e&&"textarea"===n.type&&"value"in t&&t.value!==e.value&&(e.value=null==t.value?"":t.value);};function hn(n){return !!n.__k&&(D$1(null,n),!0)}var pn=function(n,t){return n(t)};
|
|
79
79
|
|
|
80
80
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
81
81
|
|
|
82
|
-
var _=0;function o(o,e,n,t,f){var
|
|
83
|
-
|
|
84
|
-
const cell = "c1wupbe7-0-0-beta-19";
|
|
85
|
-
const cellClassname = `rdg-cell ${cell}`;
|
|
86
|
-
const cellFrozen = "cd0kgiy7-0-0-beta-19";
|
|
87
|
-
const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
|
|
88
|
-
const cellFrozenLast = "c1730fa47-0-0-beta-19";
|
|
89
|
-
const cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;
|
|
90
|
-
|
|
91
|
-
const root = "r104f42s7-0-0-beta-19";
|
|
92
|
-
const rootClassname = `rdg ${root}`;
|
|
93
|
-
const viewportDragging = "v7ly7s7-0-0-beta-19";
|
|
94
|
-
const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
|
|
95
|
-
const focusSinkClassname = "fc4f4zb7-0-0-beta-19";
|
|
96
|
-
|
|
97
|
-
const row = "r1otpg647-0-0-beta-19";
|
|
98
|
-
const rowClassname = `rdg-row ${row}`;
|
|
99
|
-
const rowSelected = "rel5gk27-0-0-beta-19";
|
|
100
|
-
const rowSelectedClassname = `rdg-row-selected`;
|
|
101
|
-
const rowSelectedWithFrozenCell = "r1qymf1z7-0-0-beta-19";
|
|
102
|
-
|
|
103
|
-
const checkboxLabel = "c8rwwhf7-0-0-beta-19";
|
|
104
|
-
const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
|
|
105
|
-
const checkboxInput = "c1rb4brs7-0-0-beta-19";
|
|
106
|
-
const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
|
|
107
|
-
const checkbox = "c1bvvwcc7-0-0-beta-19";
|
|
108
|
-
const checkboxClassname = `rdg-checkbox ${checkbox}`;
|
|
109
|
-
const checkboxLabelDisabled = "c1yg790j7-0-0-beta-19";
|
|
110
|
-
const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
|
|
111
|
-
function checkboxFormatter({
|
|
112
|
-
onChange,
|
|
113
|
-
...props
|
|
114
|
-
}, ref) {
|
|
115
|
-
function handleChange(e) {
|
|
116
|
-
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return /*#__PURE__*/o("label", {
|
|
120
|
-
className: clsx(checkboxLabelClassname, props.disabled && checkboxLabelDisabledClassname),
|
|
121
|
-
children: [/*#__PURE__*/o("input", {
|
|
122
|
-
type: "checkbox",
|
|
123
|
-
ref: ref,
|
|
124
|
-
...props,
|
|
125
|
-
className: checkboxInputClassname,
|
|
126
|
-
onChange: handleChange
|
|
127
|
-
}), /*#__PURE__*/o("div", {
|
|
128
|
-
className: checkboxClassname
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const useLayoutEffect = typeof window === 'undefined' ? h : s;
|
|
134
|
-
|
|
135
|
-
function useFocusRef(isSelected) {
|
|
136
|
-
const ref = _$1(null);
|
|
137
|
-
useLayoutEffect(() => {
|
|
138
|
-
if (!isSelected) return;
|
|
139
|
-
ref.current?.focus({
|
|
140
|
-
preventScroll: true
|
|
141
|
-
});
|
|
142
|
-
}, [isSelected]);
|
|
143
|
-
return {
|
|
144
|
-
ref,
|
|
145
|
-
tabIndex: isSelected ? 0 : -1
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const DataGridDefaultComponentsContext = /*#__PURE__*/B$2(undefined);
|
|
150
|
-
const DataGridDefaultComponentsProvider = DataGridDefaultComponentsContext.Provider;
|
|
151
|
-
function useDefaultComponents() {
|
|
152
|
-
return q$1(DataGridDefaultComponentsContext);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function SelectCellFormatter({
|
|
156
|
-
value,
|
|
157
|
-
isCellSelected,
|
|
158
|
-
disabled,
|
|
159
|
-
onChange,
|
|
160
|
-
'aria-label': ariaLabel,
|
|
161
|
-
'aria-labelledby': ariaLabelledBy
|
|
162
|
-
}) {
|
|
163
|
-
const {
|
|
164
|
-
ref,
|
|
165
|
-
tabIndex
|
|
166
|
-
} = useFocusRef(isCellSelected);
|
|
167
|
-
const checkboxFormatter = useDefaultComponents().checkboxFormatter;
|
|
168
|
-
return /*#__PURE__*/o(p$1, {
|
|
169
|
-
children: checkboxFormatter({
|
|
170
|
-
'aria-label': ariaLabel,
|
|
171
|
-
'aria-labelledby': ariaLabelledBy,
|
|
172
|
-
tabIndex,
|
|
173
|
-
disabled,
|
|
174
|
-
checked: value,
|
|
175
|
-
onChange
|
|
176
|
-
}, ref)
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function valueFormatter(props) {
|
|
181
|
-
try {
|
|
182
|
-
return /*#__PURE__*/o(p$1, {
|
|
183
|
-
children: props.row[props.column.key]
|
|
184
|
-
});
|
|
185
|
-
} catch {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const groupCellContent = "gb8l2vs7-0-0-beta-19";
|
|
191
|
-
const groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;
|
|
192
|
-
const caret = "c1ggynjl7-0-0-beta-19";
|
|
193
|
-
const caretClassname = `rdg-caret ${caret}`;
|
|
194
|
-
function toggleGroupFormatter(props) {
|
|
195
|
-
return /*#__PURE__*/o(ToggleGroup, { ...props
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
function ToggleGroup({
|
|
199
|
-
groupKey,
|
|
200
|
-
isExpanded,
|
|
201
|
-
isCellSelected,
|
|
202
|
-
toggleGroup
|
|
203
|
-
}) {
|
|
204
|
-
const {
|
|
205
|
-
ref,
|
|
206
|
-
tabIndex
|
|
207
|
-
} = useFocusRef(isCellSelected);
|
|
208
|
-
|
|
209
|
-
function handleKeyDown({
|
|
210
|
-
key
|
|
211
|
-
}) {
|
|
212
|
-
if (key === 'Enter') {
|
|
213
|
-
toggleGroup();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const d = isExpanded ? 'M1 1 L 7 7 L 13 1' : 'M1 7 L 7 1 L 13 7';
|
|
218
|
-
return /*#__PURE__*/o("span", {
|
|
219
|
-
ref: ref,
|
|
220
|
-
className: groupCellContentClassname,
|
|
221
|
-
tabIndex: tabIndex,
|
|
222
|
-
onKeyDown: handleKeyDown,
|
|
223
|
-
children: [groupKey, /*#__PURE__*/o("svg", {
|
|
224
|
-
viewBox: "0 0 14 8",
|
|
225
|
-
width: "14",
|
|
226
|
-
height: "8",
|
|
227
|
-
className: caretClassname,
|
|
228
|
-
"aria-hidden": true,
|
|
229
|
-
children: /*#__PURE__*/o("path", {
|
|
230
|
-
d: d
|
|
231
|
-
})
|
|
232
|
-
})]
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const RowSelectionContext = /*#__PURE__*/B$2(undefined);
|
|
237
|
-
const RowSelectionProvider = RowSelectionContext.Provider;
|
|
238
|
-
const RowSelectionChangeContext = /*#__PURE__*/B$2(undefined);
|
|
239
|
-
const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;
|
|
240
|
-
function useRowSelection() {
|
|
241
|
-
const rowSelectionContext = q$1(RowSelectionContext);
|
|
242
|
-
const rowSelectionChangeContext = q$1(RowSelectionChangeContext);
|
|
243
|
-
|
|
244
|
-
if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {
|
|
245
|
-
throw new Error('useRowSelection must be used within DataGrid cells');
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return [rowSelectionContext, rowSelectionChangeContext];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const SELECT_COLUMN_KEY = 'select-row';
|
|
252
|
-
|
|
253
|
-
function SelectFormatter(props) {
|
|
254
|
-
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
255
|
-
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
256
|
-
"aria-label": "Select",
|
|
257
|
-
isCellSelected: props.isCellSelected,
|
|
258
|
-
value: isRowSelected,
|
|
259
|
-
onChange: (checked, isShiftClick) => {
|
|
260
|
-
onRowSelectionChange({
|
|
261
|
-
row: props.row,
|
|
262
|
-
checked,
|
|
263
|
-
isShiftClick
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function SelectGroupFormatter(props) {
|
|
270
|
-
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
271
|
-
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
272
|
-
"aria-label": "Select Group",
|
|
273
|
-
isCellSelected: props.isCellSelected,
|
|
274
|
-
value: isRowSelected,
|
|
275
|
-
onChange: checked => {
|
|
276
|
-
onRowSelectionChange({
|
|
277
|
-
row: props.row,
|
|
278
|
-
checked,
|
|
279
|
-
isShiftClick: false
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const SelectColumn = {
|
|
286
|
-
key: SELECT_COLUMN_KEY,
|
|
287
|
-
name: '',
|
|
288
|
-
width: 35,
|
|
289
|
-
minWidth: 35,
|
|
290
|
-
maxWidth: 35,
|
|
291
|
-
resizable: false,
|
|
292
|
-
sortable: false,
|
|
293
|
-
frozen: true,
|
|
294
|
-
|
|
295
|
-
headerRenderer(props) {
|
|
296
|
-
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
297
|
-
"aria-label": "Select All",
|
|
298
|
-
isCellSelected: props.isCellSelected,
|
|
299
|
-
value: props.allRowsSelected,
|
|
300
|
-
onChange: props.onAllRowsSelectionChange
|
|
301
|
-
});
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
formatter(props) {
|
|
305
|
-
return /*#__PURE__*/o(SelectFormatter, { ...props
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
groupFormatter(props) {
|
|
310
|
-
return /*#__PURE__*/o(SelectGroupFormatter, { ...props
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
};
|
|
82
|
+
var _=0;function o(o,e,n,t,f,l){var s,u,a={};for(u in e)"ref"==u?s=e[u]:a[u]=e[u];var i={type:o,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--_,__source:f,__self:l};if("function"==typeof o&&(s=o.defaultProps))for(u in s)void 0===a[u]&&(a[u]=s[u]);return l$1.vnode&&l$1.vnode(i),i}
|
|
315
83
|
|
|
316
84
|
function getColSpan(column, lastFrozenColumnIndex, args) {
|
|
317
85
|
const colSpan = typeof column.colSpan === 'function' ? column.colSpan(args) : 1;
|
|
318
|
-
|
|
319
86
|
if (Number.isInteger(colSpan) && colSpan > 1 && (!column.frozen || column.idx + colSpan - 1 <= lastFrozenColumnIndex)) {
|
|
320
87
|
return colSpan;
|
|
321
88
|
}
|
|
322
|
-
|
|
323
89
|
return undefined;
|
|
324
90
|
}
|
|
325
91
|
|
|
@@ -330,6 +96,21 @@
|
|
|
330
96
|
});
|
|
331
97
|
}
|
|
332
98
|
|
|
99
|
+
function createCellEvent(event) {
|
|
100
|
+
let defaultPrevented = false;
|
|
101
|
+
const cellEvent = {
|
|
102
|
+
...event,
|
|
103
|
+
preventGridDefault() {
|
|
104
|
+
defaultPrevented = true;
|
|
105
|
+
},
|
|
106
|
+
isGridDefaultPrevented() {
|
|
107
|
+
return defaultPrevented;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
Object.setPrototypeOf(cellEvent, Object.getPrototypeOf(event));
|
|
111
|
+
return cellEvent;
|
|
112
|
+
}
|
|
113
|
+
|
|
333
114
|
const nonInputKeys = new Set(['Unidentified', 'Alt', 'AltGraph', 'CapsLock', 'Control', 'Fn', 'FnLock', 'Meta', 'NumLock', 'ScrollLock', 'Shift', 'Tab', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'End', 'Home', 'PageDown', 'PageUp', 'Insert', 'ContextMenu', 'Escape', 'Pause', 'Play', 'PrintScreen', 'F1', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12']);
|
|
334
115
|
function isCtrlKeyHeldDown(e) {
|
|
335
116
|
return (e.ctrlKey || e.metaKey) && e.key !== 'Control';
|
|
@@ -342,30 +123,27 @@
|
|
|
342
123
|
target
|
|
343
124
|
}) {
|
|
344
125
|
if (key === 'Tab' && (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement)) {
|
|
345
|
-
return target.matches('.rdg-editor-container > :only-child, .rdg-editor-container > label:only-child > :only-child');
|
|
126
|
+
return target.matches('.rdg-editor-container > :only-child, .rdg-editor-container > label:only-child > :only-child, .rdg-editor-container > div:only-child > label:only-child > :only-child');
|
|
346
127
|
}
|
|
347
|
-
|
|
348
128
|
return false;
|
|
349
129
|
}
|
|
350
130
|
|
|
351
|
-
const measuringCellClassname = "m1l09lto7-0-0-beta-
|
|
131
|
+
const measuringCellClassname = "m1l09lto7-0-0-beta-33";
|
|
352
132
|
function renderMeasuringCells(viewportColumns) {
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
133
|
+
return viewportColumns.map(({
|
|
134
|
+
key,
|
|
135
|
+
idx,
|
|
136
|
+
minWidth,
|
|
137
|
+
maxWidth
|
|
138
|
+
}) => /*#__PURE__*/o("div", {
|
|
139
|
+
className: measuringCellClassname,
|
|
140
|
+
style: {
|
|
141
|
+
gridColumnStart: idx + 1,
|
|
357
142
|
minWidth,
|
|
358
143
|
maxWidth
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
gridColumnStart: idx + 1,
|
|
363
|
-
minWidth,
|
|
364
|
-
maxWidth
|
|
365
|
-
},
|
|
366
|
-
"data-measuring-cell-key": key
|
|
367
|
-
}, key))
|
|
368
|
-
});
|
|
144
|
+
},
|
|
145
|
+
"data-measuring-cell-key": key
|
|
146
|
+
}, key));
|
|
369
147
|
}
|
|
370
148
|
|
|
371
149
|
function isSelectedCellEditable({
|
|
@@ -379,7 +157,7 @@
|
|
|
379
157
|
return !isGroupRow(row) && isCellEditable(column, row);
|
|
380
158
|
}
|
|
381
159
|
function isCellEditable(column, row) {
|
|
382
|
-
return column.
|
|
160
|
+
return column.renderEditCell != null && !column.rowGroup && (typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false;
|
|
383
161
|
}
|
|
384
162
|
function getSelectedCellColSpan({
|
|
385
163
|
rows,
|
|
@@ -392,40 +170,33 @@
|
|
|
392
170
|
}) {
|
|
393
171
|
const topSummaryRowsCount = topSummaryRows?.length ?? 0;
|
|
394
172
|
const minRowIdx = -1 - topSummaryRowsCount;
|
|
395
|
-
|
|
396
173
|
if (rowIdx === minRowIdx) {
|
|
397
174
|
return getColSpan(column, lastFrozenColumnIndex, {
|
|
398
175
|
type: 'HEADER'
|
|
399
176
|
});
|
|
400
177
|
}
|
|
401
|
-
|
|
402
178
|
if (topSummaryRows && rowIdx > minRowIdx && rowIdx <= topSummaryRowsCount + minRowIdx) {
|
|
403
179
|
return getColSpan(column, lastFrozenColumnIndex, {
|
|
404
180
|
type: 'SUMMARY',
|
|
405
181
|
row: topSummaryRows[rowIdx + topSummaryRowsCount]
|
|
406
182
|
});
|
|
407
183
|
}
|
|
408
|
-
|
|
409
184
|
if (rowIdx >= 0 && rowIdx < rows.length) {
|
|
410
185
|
const row = rows[rowIdx];
|
|
411
|
-
|
|
412
186
|
if (!isGroupRow(row)) {
|
|
413
187
|
return getColSpan(column, lastFrozenColumnIndex, {
|
|
414
188
|
type: 'ROW',
|
|
415
189
|
row
|
|
416
190
|
});
|
|
417
191
|
}
|
|
418
|
-
|
|
419
|
-
return undefined;
|
|
192
|
+
return;
|
|
420
193
|
}
|
|
421
|
-
|
|
422
194
|
if (bottomSummaryRows) {
|
|
423
195
|
return getColSpan(column, lastFrozenColumnIndex, {
|
|
424
196
|
type: 'SUMMARY',
|
|
425
197
|
row: bottomSummaryRows[rowIdx - rows.length]
|
|
426
198
|
});
|
|
427
199
|
}
|
|
428
|
-
|
|
429
200
|
return undefined;
|
|
430
201
|
}
|
|
431
202
|
function getNextSelectedCellPosition({
|
|
@@ -449,13 +220,11 @@
|
|
|
449
220
|
idx: nextIdx,
|
|
450
221
|
rowIdx: nextRowIdx
|
|
451
222
|
} = nextPosition;
|
|
452
|
-
|
|
453
223
|
const setColSpan = moveRight => {
|
|
454
224
|
if (nextRowIdx >= 0 && nextRowIdx < rows.length) {
|
|
455
225
|
const row = rows[nextRowIdx];
|
|
456
226
|
if (isGroupRow(row)) return;
|
|
457
227
|
}
|
|
458
|
-
|
|
459
228
|
for (const column of colSpanColumns) {
|
|
460
229
|
const colIdx = column.idx;
|
|
461
230
|
if (colIdx > nextIdx) break;
|
|
@@ -468,57 +237,40 @@
|
|
|
468
237
|
column,
|
|
469
238
|
isGroupRow
|
|
470
239
|
});
|
|
471
|
-
|
|
472
240
|
if (colSpan && nextIdx > colIdx && nextIdx < colSpan + colIdx) {
|
|
473
241
|
nextIdx = colIdx + (moveRight ? colSpan : 0);
|
|
474
242
|
break;
|
|
475
243
|
}
|
|
476
244
|
}
|
|
477
245
|
};
|
|
478
|
-
|
|
479
246
|
if (isCellWithinBounds(nextPosition)) {
|
|
480
247
|
setColSpan(nextIdx - currentIdx > 0);
|
|
481
248
|
}
|
|
482
|
-
|
|
483
|
-
if (cellNavigationMode !== 'NONE') {
|
|
249
|
+
if (cellNavigationMode === 'CHANGE_ROW') {
|
|
484
250
|
const columnsCount = columns.length;
|
|
485
251
|
const isAfterLastColumn = nextIdx === columnsCount;
|
|
486
252
|
const isBeforeFirstColumn = nextIdx === -1;
|
|
487
|
-
|
|
488
253
|
if (isAfterLastColumn) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (!isLastRow) {
|
|
493
|
-
nextIdx = 0;
|
|
494
|
-
nextRowIdx += 1;
|
|
495
|
-
}
|
|
496
|
-
} else {
|
|
254
|
+
const isLastRow = nextRowIdx === maxRowIdx;
|
|
255
|
+
if (!isLastRow) {
|
|
497
256
|
nextIdx = 0;
|
|
257
|
+
nextRowIdx += 1;
|
|
498
258
|
}
|
|
499
259
|
} else if (isBeforeFirstColumn) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
if (!isFirstRow) {
|
|
504
|
-
nextRowIdx -= 1;
|
|
505
|
-
nextIdx = columnsCount - 1;
|
|
506
|
-
}
|
|
507
|
-
} else {
|
|
260
|
+
const isFirstRow = nextRowIdx === minRowIdx;
|
|
261
|
+
if (!isFirstRow) {
|
|
262
|
+
nextRowIdx -= 1;
|
|
508
263
|
nextIdx = columnsCount - 1;
|
|
509
264
|
}
|
|
510
|
-
|
|
511
265
|
setColSpan(false);
|
|
512
266
|
}
|
|
513
267
|
}
|
|
514
|
-
|
|
515
268
|
return {
|
|
516
269
|
idx: nextIdx,
|
|
517
270
|
rowIdx: nextRowIdx
|
|
518
271
|
};
|
|
519
272
|
}
|
|
520
273
|
function canExitGrid({
|
|
521
|
-
cellNavigationMode,
|
|
522
274
|
maxColIdx,
|
|
523
275
|
minRowIdx,
|
|
524
276
|
maxRowIdx,
|
|
@@ -528,17 +280,20 @@
|
|
|
528
280
|
},
|
|
529
281
|
shiftKey
|
|
530
282
|
}) {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
return false;
|
|
283
|
+
const atLastCellInRow = idx === maxColIdx;
|
|
284
|
+
const atFirstCellInRow = idx === 0;
|
|
285
|
+
const atLastRow = rowIdx === maxRowIdx;
|
|
286
|
+
const atFirstRow = rowIdx === minRowIdx;
|
|
287
|
+
return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;
|
|
540
288
|
}
|
|
541
289
|
|
|
290
|
+
const cell = "c1wupbe7-0-0-beta-33";
|
|
291
|
+
const cellClassname = `rdg-cell ${cell}`;
|
|
292
|
+
const cellFrozen = "cd0kgiy7-0-0-beta-33";
|
|
293
|
+
const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
|
|
294
|
+
const cellFrozenLast = "c1730fa47-0-0-beta-33";
|
|
295
|
+
const cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;
|
|
296
|
+
|
|
542
297
|
function getRowStyle(rowIdx, height) {
|
|
543
298
|
if (height !== undefined) {
|
|
544
299
|
return {
|
|
@@ -546,7 +301,6 @@
|
|
|
546
301
|
'--rdg-row-height': `${height}px`
|
|
547
302
|
};
|
|
548
303
|
}
|
|
549
|
-
|
|
550
304
|
return {
|
|
551
305
|
'--rdg-grid-row-start': rowIdx
|
|
552
306
|
};
|
|
@@ -580,63 +334,247 @@
|
|
|
580
334
|
maxWidth
|
|
581
335
|
}) {
|
|
582
336
|
width = max(width, minWidth);
|
|
583
|
-
|
|
584
337
|
if (typeof maxWidth === 'number' && maxWidth >= minWidth) {
|
|
585
338
|
return min(width, maxWidth);
|
|
586
339
|
}
|
|
587
|
-
|
|
588
340
|
return width;
|
|
589
341
|
}
|
|
590
342
|
|
|
591
|
-
const
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
343
|
+
const checkboxLabel = "c1hs68w07-0-0-beta-33";
|
|
344
|
+
const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
|
|
345
|
+
const checkboxInput = "cojpd0n7-0-0-beta-33";
|
|
346
|
+
const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
|
|
347
|
+
const checkbox = "cwsfieb7-0-0-beta-33";
|
|
348
|
+
const checkboxClassname = `rdg-checkbox ${checkbox}`;
|
|
349
|
+
const checkboxLabelDisabled = "c1fgadbl7-0-0-beta-33";
|
|
350
|
+
const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
|
|
351
|
+
function renderCheckbox({
|
|
352
|
+
onChange,
|
|
353
|
+
...props
|
|
601
354
|
}) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
355
|
+
function handleChange(e) {
|
|
356
|
+
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
357
|
+
}
|
|
358
|
+
return /*#__PURE__*/o("label", {
|
|
359
|
+
className: clsx(checkboxLabelClassname, props.disabled && checkboxLabelDisabledClassname),
|
|
360
|
+
children: [/*#__PURE__*/o("input", {
|
|
361
|
+
type: "checkbox",
|
|
362
|
+
...props,
|
|
363
|
+
className: checkboxInputClassname,
|
|
364
|
+
onChange: handleChange
|
|
365
|
+
}), /*#__PURE__*/o("div", {
|
|
366
|
+
className: checkboxClassname
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const groupCellContent = "g1w3c5217-0-0-beta-33";
|
|
372
|
+
const groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;
|
|
373
|
+
const caret = "cm5tyhw7-0-0-beta-33";
|
|
374
|
+
const caretClassname = `rdg-caret ${caret}`;
|
|
375
|
+
function renderToggleGroup(props) {
|
|
376
|
+
return /*#__PURE__*/o(ToggleGroup, {
|
|
377
|
+
...props
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function ToggleGroup({
|
|
381
|
+
groupKey,
|
|
382
|
+
isExpanded,
|
|
383
|
+
tabIndex,
|
|
384
|
+
toggleGroup
|
|
385
|
+
}) {
|
|
386
|
+
function handleKeyDown({
|
|
387
|
+
key
|
|
388
|
+
}) {
|
|
389
|
+
if (key === 'Enter') {
|
|
390
|
+
toggleGroup();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const d = isExpanded ? 'M1 1 L 7 7 L 13 1' : 'M1 7 L 7 1 L 13 7';
|
|
394
|
+
return /*#__PURE__*/o("span", {
|
|
395
|
+
className: groupCellContentClassname,
|
|
396
|
+
tabIndex: tabIndex,
|
|
397
|
+
onKeyDown: handleKeyDown,
|
|
398
|
+
children: [groupKey, /*#__PURE__*/o("svg", {
|
|
399
|
+
viewBox: "0 0 14 8",
|
|
400
|
+
width: "14",
|
|
401
|
+
height: "8",
|
|
402
|
+
className: caretClassname,
|
|
403
|
+
"aria-hidden": true,
|
|
404
|
+
children: /*#__PURE__*/o("path", {
|
|
405
|
+
d: d
|
|
406
|
+
})
|
|
407
|
+
})]
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function renderValue(props) {
|
|
412
|
+
try {
|
|
413
|
+
return props.row[props.column.key];
|
|
414
|
+
} catch {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const DataGridDefaultRenderersContext = /*#__PURE__*/G$1(undefined);
|
|
420
|
+
const DataGridDefaultRenderersProvider = DataGridDefaultRenderersContext.Provider;
|
|
421
|
+
function useDefaultRenderers() {
|
|
422
|
+
return q$1(DataGridDefaultRenderersContext);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function SelectCellFormatter({
|
|
426
|
+
value,
|
|
427
|
+
tabIndex,
|
|
428
|
+
disabled,
|
|
429
|
+
onChange,
|
|
430
|
+
'aria-label': ariaLabel,
|
|
431
|
+
'aria-labelledby': ariaLabelledBy
|
|
432
|
+
}) {
|
|
433
|
+
const renderCheckbox = useDefaultRenderers().renderCheckbox;
|
|
434
|
+
return renderCheckbox({
|
|
435
|
+
'aria-label': ariaLabel,
|
|
436
|
+
'aria-labelledby': ariaLabelledBy,
|
|
437
|
+
tabIndex,
|
|
438
|
+
disabled,
|
|
439
|
+
checked: value,
|
|
440
|
+
onChange
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const RowSelectionContext = /*#__PURE__*/G$1(undefined);
|
|
445
|
+
const RowSelectionProvider = RowSelectionContext.Provider;
|
|
446
|
+
const RowSelectionChangeContext = /*#__PURE__*/G$1(undefined);
|
|
447
|
+
const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;
|
|
448
|
+
function useRowSelection() {
|
|
449
|
+
const rowSelectionContext = q$1(RowSelectionContext);
|
|
450
|
+
const rowSelectionChangeContext = q$1(RowSelectionChangeContext);
|
|
451
|
+
if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {
|
|
452
|
+
throw new Error('useRowSelection must be used within DataGrid cells');
|
|
453
|
+
}
|
|
454
|
+
return [rowSelectionContext, rowSelectionChangeContext];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const SELECT_COLUMN_KEY = 'select-row';
|
|
458
|
+
function HeaderRenderer(props) {
|
|
459
|
+
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
460
|
+
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
461
|
+
"aria-label": "Select All",
|
|
462
|
+
tabIndex: props.tabIndex,
|
|
463
|
+
value: isRowSelected,
|
|
464
|
+
onChange: checked => {
|
|
465
|
+
onRowSelectionChange({
|
|
466
|
+
type: 'HEADER',
|
|
467
|
+
checked
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function SelectFormatter(props) {
|
|
473
|
+
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
474
|
+
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
475
|
+
"aria-label": "Select",
|
|
476
|
+
tabIndex: props.tabIndex,
|
|
477
|
+
value: isRowSelected,
|
|
478
|
+
onChange: (checked, isShiftClick) => {
|
|
479
|
+
onRowSelectionChange({
|
|
480
|
+
type: 'ROW',
|
|
481
|
+
row: props.row,
|
|
482
|
+
checked,
|
|
483
|
+
isShiftClick
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function SelectGroupFormatter(props) {
|
|
489
|
+
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
490
|
+
return /*#__PURE__*/o(SelectCellFormatter, {
|
|
491
|
+
"aria-label": "Select Group",
|
|
492
|
+
tabIndex: props.tabIndex,
|
|
493
|
+
value: isRowSelected,
|
|
494
|
+
onChange: checked => {
|
|
495
|
+
onRowSelectionChange({
|
|
496
|
+
type: 'ROW',
|
|
497
|
+
row: props.row,
|
|
498
|
+
checked,
|
|
499
|
+
isShiftClick: false
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
const SelectColumn = {
|
|
505
|
+
key: SELECT_COLUMN_KEY,
|
|
506
|
+
name: '',
|
|
507
|
+
width: 35,
|
|
508
|
+
minWidth: 35,
|
|
509
|
+
maxWidth: 35,
|
|
510
|
+
resizable: false,
|
|
511
|
+
sortable: false,
|
|
512
|
+
frozen: true,
|
|
513
|
+
renderHeaderCell(props) {
|
|
514
|
+
return /*#__PURE__*/o(HeaderRenderer, {
|
|
515
|
+
...props
|
|
516
|
+
});
|
|
517
|
+
},
|
|
518
|
+
renderCell(props) {
|
|
519
|
+
return /*#__PURE__*/o(SelectFormatter, {
|
|
520
|
+
...props
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
renderGroupCell(props) {
|
|
524
|
+
return /*#__PURE__*/o(SelectGroupFormatter, {
|
|
525
|
+
...props
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
};
|
|
635
529
|
|
|
530
|
+
const DEFAULT_COLUMN_WIDTH = 'auto';
|
|
531
|
+
const DEFAULT_COLUMN_MIN_WIDTH = 50;
|
|
532
|
+
function useCalculatedColumns({
|
|
533
|
+
rawColumns,
|
|
534
|
+
measuredColumnWidths,
|
|
535
|
+
resizedColumnWidths,
|
|
536
|
+
viewportWidth,
|
|
537
|
+
scrollLeft,
|
|
538
|
+
defaultColumnOptions,
|
|
539
|
+
rawGroupBy,
|
|
540
|
+
enableVirtualization
|
|
541
|
+
}) {
|
|
542
|
+
const defaultWidth = defaultColumnOptions?.width ?? DEFAULT_COLUMN_WIDTH;
|
|
543
|
+
const defaultMinWidth = defaultColumnOptions?.minWidth ?? DEFAULT_COLUMN_MIN_WIDTH;
|
|
544
|
+
const defaultMaxWidth = defaultColumnOptions?.maxWidth ?? undefined;
|
|
545
|
+
const defaultFormatter = defaultColumnOptions?.renderCell ?? renderValue;
|
|
546
|
+
const defaultSortable = defaultColumnOptions?.sortable ?? false;
|
|
547
|
+
const defaultResizable = defaultColumnOptions?.resizable ?? false;
|
|
548
|
+
const {
|
|
549
|
+
columns,
|
|
550
|
+
colSpanColumns,
|
|
551
|
+
lastFrozenColumnIndex,
|
|
552
|
+
groupBy
|
|
553
|
+
} = F$1(() => {
|
|
554
|
+
const groupBy = [];
|
|
555
|
+
let lastFrozenColumnIndex = -1;
|
|
556
|
+
const columns = rawColumns.map(rawColumn => {
|
|
557
|
+
const rowGroup = rawGroupBy?.includes(rawColumn.key) ?? false;
|
|
558
|
+
const frozen = rowGroup || rawColumn.frozen || false;
|
|
559
|
+
const column = {
|
|
560
|
+
...rawColumn,
|
|
561
|
+
idx: 0,
|
|
562
|
+
frozen,
|
|
563
|
+
isLastFrozenColumn: false,
|
|
564
|
+
rowGroup,
|
|
565
|
+
width: rawColumn.width ?? defaultWidth,
|
|
566
|
+
minWidth: rawColumn.minWidth ?? defaultMinWidth,
|
|
567
|
+
maxWidth: rawColumn.maxWidth ?? defaultMaxWidth,
|
|
568
|
+
sortable: rawColumn.sortable ?? defaultSortable,
|
|
569
|
+
resizable: rawColumn.resizable ?? defaultResizable,
|
|
570
|
+
renderCell: rawColumn.renderCell ?? defaultFormatter
|
|
571
|
+
};
|
|
572
|
+
if (rowGroup) {
|
|
573
|
+
column.renderGroupCell ??= renderToggleGroup;
|
|
574
|
+
}
|
|
636
575
|
if (frozen) {
|
|
637
576
|
lastFrozenColumnIndex++;
|
|
638
577
|
}
|
|
639
|
-
|
|
640
578
|
return column;
|
|
641
579
|
});
|
|
642
580
|
columns.sort(({
|
|
@@ -648,42 +586,33 @@
|
|
|
648
586
|
}) => {
|
|
649
587
|
if (aKey === SELECT_COLUMN_KEY) return -1;
|
|
650
588
|
if (bKey === SELECT_COLUMN_KEY) return 1;
|
|
651
|
-
|
|
652
589
|
if (rawGroupBy?.includes(aKey)) {
|
|
653
590
|
if (rawGroupBy.includes(bKey)) {
|
|
654
591
|
return rawGroupBy.indexOf(aKey) - rawGroupBy.indexOf(bKey);
|
|
655
592
|
}
|
|
656
|
-
|
|
657
593
|
return -1;
|
|
658
594
|
}
|
|
659
|
-
|
|
660
595
|
if (rawGroupBy?.includes(bKey)) return 1;
|
|
661
|
-
|
|
662
596
|
if (frozenA) {
|
|
663
597
|
if (frozenB) return 0;
|
|
664
598
|
return -1;
|
|
665
599
|
}
|
|
666
|
-
|
|
667
600
|
if (frozenB) return 1;
|
|
668
601
|
return 0;
|
|
669
602
|
});
|
|
670
603
|
const colSpanColumns = [];
|
|
671
604
|
columns.forEach((column, idx) => {
|
|
672
605
|
column.idx = idx;
|
|
673
|
-
|
|
674
606
|
if (column.rowGroup) {
|
|
675
607
|
groupBy.push(column.key);
|
|
676
608
|
}
|
|
677
|
-
|
|
678
609
|
if (column.colSpan != null) {
|
|
679
610
|
colSpanColumns.push(column);
|
|
680
611
|
}
|
|
681
612
|
});
|
|
682
|
-
|
|
683
613
|
if (lastFrozenColumnIndex !== -1) {
|
|
684
614
|
columns[lastFrozenColumnIndex].isLastFrozenColumn = true;
|
|
685
615
|
}
|
|
686
|
-
|
|
687
616
|
return {
|
|
688
617
|
columns,
|
|
689
618
|
colSpanColumns,
|
|
@@ -696,21 +625,18 @@
|
|
|
696
625
|
layoutCssVars,
|
|
697
626
|
totalFrozenColumnWidth,
|
|
698
627
|
columnMetrics
|
|
699
|
-
} = F(() => {
|
|
628
|
+
} = F$1(() => {
|
|
700
629
|
const columnMetrics = new Map();
|
|
701
630
|
let left = 0;
|
|
702
631
|
let totalFrozenColumnWidth = 0;
|
|
703
632
|
const templateColumns = [];
|
|
704
|
-
|
|
705
633
|
for (const column of columns) {
|
|
706
|
-
let width =
|
|
707
|
-
|
|
634
|
+
let width = resizedColumnWidths.get(column.key) ?? measuredColumnWidths.get(column.key) ?? column.width;
|
|
708
635
|
if (typeof width === 'number') {
|
|
709
636
|
width = clampColumnWidth(width, column);
|
|
710
637
|
} else {
|
|
711
638
|
width = column.minWidth;
|
|
712
639
|
}
|
|
713
|
-
|
|
714
640
|
templateColumns.push(`${width}px`);
|
|
715
641
|
columnMetrics.set(column, {
|
|
716
642
|
width,
|
|
@@ -718,72 +644,55 @@
|
|
|
718
644
|
});
|
|
719
645
|
left += width;
|
|
720
646
|
}
|
|
721
|
-
|
|
722
647
|
if (lastFrozenColumnIndex !== -1) {
|
|
723
648
|
const columnMetric = columnMetrics.get(columns[lastFrozenColumnIndex]);
|
|
724
649
|
totalFrozenColumnWidth = columnMetric.left + columnMetric.width;
|
|
725
650
|
}
|
|
726
|
-
|
|
727
|
-
const layoutCssVars = {
|
|
728
|
-
gridTemplateColumns: templateColumns.join(' ')
|
|
729
|
-
};
|
|
730
|
-
|
|
651
|
+
const layoutCssVars = {};
|
|
731
652
|
for (let i = 0; i <= lastFrozenColumnIndex; i++) {
|
|
732
653
|
const column = columns[i];
|
|
733
654
|
layoutCssVars[`--rdg-frozen-left-${column.idx}`] = `${columnMetrics.get(column).left}px`;
|
|
734
655
|
}
|
|
735
|
-
|
|
736
656
|
return {
|
|
737
657
|
templateColumns,
|
|
738
658
|
layoutCssVars,
|
|
739
659
|
totalFrozenColumnWidth,
|
|
740
660
|
columnMetrics
|
|
741
661
|
};
|
|
742
|
-
}, [
|
|
743
|
-
const [colOverscanStartIdx, colOverscanEndIdx] = F(() => {
|
|
662
|
+
}, [measuredColumnWidths, resizedColumnWidths, columns, lastFrozenColumnIndex]);
|
|
663
|
+
const [colOverscanStartIdx, colOverscanEndIdx] = F$1(() => {
|
|
744
664
|
if (!enableVirtualization) {
|
|
745
665
|
return [0, columns.length - 1];
|
|
746
666
|
}
|
|
747
|
-
|
|
748
667
|
const viewportLeft = scrollLeft + totalFrozenColumnWidth;
|
|
749
668
|
const viewportRight = scrollLeft + viewportWidth;
|
|
750
669
|
const lastColIdx = columns.length - 1;
|
|
751
670
|
const firstUnfrozenColumnIdx = min(lastFrozenColumnIndex + 1, lastColIdx);
|
|
752
|
-
|
|
753
671
|
if (viewportLeft >= viewportRight) {
|
|
754
672
|
return [firstUnfrozenColumnIdx, firstUnfrozenColumnIdx];
|
|
755
673
|
}
|
|
756
|
-
|
|
757
674
|
let colVisibleStartIdx = firstUnfrozenColumnIdx;
|
|
758
|
-
|
|
759
675
|
while (colVisibleStartIdx < lastColIdx) {
|
|
760
676
|
const {
|
|
761
677
|
left,
|
|
762
678
|
width
|
|
763
679
|
} = columnMetrics.get(columns[colVisibleStartIdx]);
|
|
764
|
-
|
|
765
680
|
if (left + width > viewportLeft) {
|
|
766
681
|
break;
|
|
767
682
|
}
|
|
768
|
-
|
|
769
683
|
colVisibleStartIdx++;
|
|
770
684
|
}
|
|
771
|
-
|
|
772
685
|
let colVisibleEndIdx = colVisibleStartIdx;
|
|
773
|
-
|
|
774
686
|
while (colVisibleEndIdx < lastColIdx) {
|
|
775
687
|
const {
|
|
776
688
|
left,
|
|
777
689
|
width
|
|
778
690
|
} = columnMetrics.get(columns[colVisibleEndIdx]);
|
|
779
|
-
|
|
780
691
|
if (left + width >= viewportRight) {
|
|
781
692
|
break;
|
|
782
693
|
}
|
|
783
|
-
|
|
784
694
|
colVisibleEndIdx++;
|
|
785
695
|
}
|
|
786
|
-
|
|
787
696
|
const colOverscanStartIdx = max(firstUnfrozenColumnIdx, colVisibleStartIdx - 1);
|
|
788
697
|
const colOverscanEndIdx = min(lastColIdx, colVisibleEndIdx + 1);
|
|
789
698
|
return [colOverscanStartIdx, colOverscanEndIdx];
|
|
@@ -795,18 +704,98 @@
|
|
|
795
704
|
colOverscanEndIdx,
|
|
796
705
|
templateColumns,
|
|
797
706
|
layoutCssVars,
|
|
798
|
-
columnMetrics,
|
|
799
707
|
lastFrozenColumnIndex,
|
|
800
708
|
totalFrozenColumnWidth,
|
|
801
709
|
groupBy
|
|
802
710
|
};
|
|
803
711
|
}
|
|
804
712
|
|
|
713
|
+
const useLayoutEffect = typeof window === 'undefined' ? p : y;
|
|
714
|
+
|
|
715
|
+
function useColumnWidths(columns, viewportColumns, templateColumns, gridRef, gridWidth, resizedColumnWidths, measuredColumnWidths, setResizedColumnWidths, setMeasuredColumnWidths, onColumnResize) {
|
|
716
|
+
const prevGridWidthRef = _$1(gridWidth);
|
|
717
|
+
const columnsCanFlex = columns.length === viewportColumns.length;
|
|
718
|
+
const ignorePreviouslyMeasuredColumns = columnsCanFlex && gridWidth !== prevGridWidthRef.current;
|
|
719
|
+
const newTemplateColumns = [...templateColumns];
|
|
720
|
+
const columnsToMeasure = [];
|
|
721
|
+
for (const {
|
|
722
|
+
key,
|
|
723
|
+
idx,
|
|
724
|
+
width
|
|
725
|
+
} of viewportColumns) {
|
|
726
|
+
if (typeof width === 'string' && (ignorePreviouslyMeasuredColumns || !measuredColumnWidths.has(key)) && !resizedColumnWidths.has(key)) {
|
|
727
|
+
newTemplateColumns[idx] = width;
|
|
728
|
+
columnsToMeasure.push(key);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const gridTemplateColumns = newTemplateColumns.join(' ');
|
|
732
|
+
useLayoutEffect(() => {
|
|
733
|
+
prevGridWidthRef.current = gridWidth;
|
|
734
|
+
updateMeasuredWidths(columnsToMeasure);
|
|
735
|
+
});
|
|
736
|
+
function updateMeasuredWidths(columnsToMeasure) {
|
|
737
|
+
if (columnsToMeasure.length === 0) return;
|
|
738
|
+
setMeasuredColumnWidths(measuredColumnWidths => {
|
|
739
|
+
const newMeasuredColumnWidths = new Map(measuredColumnWidths);
|
|
740
|
+
let hasChanges = false;
|
|
741
|
+
for (const key of columnsToMeasure) {
|
|
742
|
+
const measuredWidth = measureColumnWidth(gridRef, key);
|
|
743
|
+
hasChanges ||= measuredWidth !== measuredColumnWidths.get(key);
|
|
744
|
+
if (measuredWidth === undefined) {
|
|
745
|
+
newMeasuredColumnWidths.delete(key);
|
|
746
|
+
} else {
|
|
747
|
+
newMeasuredColumnWidths.set(key, measuredWidth);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return hasChanges ? newMeasuredColumnWidths : measuredColumnWidths;
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
function handleColumnResize(column, nextWidth) {
|
|
754
|
+
const {
|
|
755
|
+
key: resizingKey
|
|
756
|
+
} = column;
|
|
757
|
+
const newTemplateColumns = [...templateColumns];
|
|
758
|
+
const columnsToMeasure = [];
|
|
759
|
+
for (const {
|
|
760
|
+
key,
|
|
761
|
+
idx,
|
|
762
|
+
width
|
|
763
|
+
} of viewportColumns) {
|
|
764
|
+
if (resizingKey === key) {
|
|
765
|
+
const width = typeof nextWidth === 'number' ? `${nextWidth}px` : nextWidth;
|
|
766
|
+
newTemplateColumns[idx] = width;
|
|
767
|
+
} else if (columnsCanFlex && typeof width === 'string' && !resizedColumnWidths.has(key)) {
|
|
768
|
+
newTemplateColumns[idx] = width;
|
|
769
|
+
columnsToMeasure.push(key);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
gridRef.current.style.gridTemplateColumns = newTemplateColumns.join(' ');
|
|
773
|
+
const measuredWidth = typeof nextWidth === 'number' ? nextWidth : measureColumnWidth(gridRef, resizingKey);
|
|
774
|
+
pn(() => {
|
|
775
|
+
setResizedColumnWidths(resizedColumnWidths => {
|
|
776
|
+
const newResizedColumnWidths = new Map(resizedColumnWidths);
|
|
777
|
+
newResizedColumnWidths.set(resizingKey, measuredWidth);
|
|
778
|
+
return newResizedColumnWidths;
|
|
779
|
+
});
|
|
780
|
+
updateMeasuredWidths(columnsToMeasure);
|
|
781
|
+
});
|
|
782
|
+
onColumnResize?.(column.idx, measuredWidth);
|
|
783
|
+
}
|
|
784
|
+
return {
|
|
785
|
+
gridTemplateColumns,
|
|
786
|
+
handleColumnResize
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function measureColumnWidth(gridRef, key) {
|
|
790
|
+
const selector = `[data-measuring-cell-key="${CSS.escape(key)}"]`;
|
|
791
|
+
const measuringCell = gridRef.current.querySelector(selector);
|
|
792
|
+
return measuringCell?.getBoundingClientRect().width;
|
|
793
|
+
}
|
|
794
|
+
|
|
805
795
|
function useGridDimensions() {
|
|
806
796
|
const gridRef = _$1(null);
|
|
807
|
-
const [inlineSize, setInlineSize] =
|
|
808
|
-
const [blockSize, setBlockSize] =
|
|
809
|
-
const [isWidthInitialized, setWidthInitialized] = p(false);
|
|
797
|
+
const [inlineSize, setInlineSize] = h(1);
|
|
798
|
+
const [blockSize, setBlockSize] = h(1);
|
|
810
799
|
useLayoutEffect(() => {
|
|
811
800
|
const {
|
|
812
801
|
ResizeObserver
|
|
@@ -826,23 +815,24 @@
|
|
|
826
815
|
const initialHeight = height - offsetHeight + clientHeight;
|
|
827
816
|
setInlineSize(initialWidth);
|
|
828
817
|
setBlockSize(initialHeight);
|
|
829
|
-
setWidthInitialized(true);
|
|
830
818
|
const resizeObserver = new ResizeObserver(entries => {
|
|
831
819
|
const size = entries[0].contentBoxSize[0];
|
|
832
|
-
|
|
833
|
-
|
|
820
|
+
pn(() => {
|
|
821
|
+
setInlineSize(size.inlineSize);
|
|
822
|
+
setBlockSize(size.blockSize);
|
|
823
|
+
});
|
|
834
824
|
});
|
|
835
825
|
resizeObserver.observe(gridRef.current);
|
|
836
826
|
return () => {
|
|
837
827
|
resizeObserver.disconnect();
|
|
838
828
|
};
|
|
839
829
|
}, []);
|
|
840
|
-
return [gridRef, inlineSize, blockSize
|
|
830
|
+
return [gridRef, inlineSize, blockSize];
|
|
841
831
|
}
|
|
842
832
|
|
|
843
833
|
function useLatestFunc(fn) {
|
|
844
834
|
const ref = _$1(fn);
|
|
845
|
-
|
|
835
|
+
p(() => {
|
|
846
836
|
ref.current = fn;
|
|
847
837
|
});
|
|
848
838
|
const callbackFn = T$1((...args) => {
|
|
@@ -851,32 +841,20 @@
|
|
|
851
841
|
return fn ? callbackFn : fn;
|
|
852
842
|
}
|
|
853
843
|
|
|
854
|
-
function
|
|
855
|
-
const [isChildFocused, setIsChildFocused] =
|
|
856
|
-
|
|
844
|
+
function useRovingTabIndex(isSelected) {
|
|
845
|
+
const [isChildFocused, setIsChildFocused] = h(false);
|
|
857
846
|
if (isChildFocused && !isSelected) {
|
|
858
847
|
setIsChildFocused(false);
|
|
859
848
|
}
|
|
860
|
-
|
|
861
|
-
const ref = T$1(cell => {
|
|
862
|
-
if (cell === null) return;
|
|
863
|
-
scrollIntoView(cell);
|
|
864
|
-
if (cell.contains(document.activeElement)) return;
|
|
865
|
-
cell.focus({
|
|
866
|
-
preventScroll: true
|
|
867
|
-
});
|
|
868
|
-
}, []);
|
|
869
|
-
|
|
870
849
|
function onFocus(event) {
|
|
871
850
|
if (event.target !== event.currentTarget) {
|
|
872
851
|
setIsChildFocused(true);
|
|
873
852
|
}
|
|
874
853
|
}
|
|
875
|
-
|
|
876
|
-
const isFocused = isSelected && !isChildFocused;
|
|
854
|
+
const isFocusable = isSelected && !isChildFocused;
|
|
877
855
|
return {
|
|
878
|
-
|
|
879
|
-
|
|
856
|
+
tabIndex: isFocusable ? 0 : -1,
|
|
857
|
+
childTabIndex: isSelected ? 0 : -1,
|
|
880
858
|
onFocus: isSelected ? onFocus : undefined
|
|
881
859
|
};
|
|
882
860
|
}
|
|
@@ -892,36 +870,29 @@
|
|
|
892
870
|
lastFrozenColumnIndex,
|
|
893
871
|
rowOverscanStartIdx,
|
|
894
872
|
rowOverscanEndIdx,
|
|
895
|
-
columnWidths,
|
|
896
873
|
isGroupRow
|
|
897
874
|
}) {
|
|
898
|
-
const startIdx = F(() => {
|
|
875
|
+
const startIdx = F$1(() => {
|
|
899
876
|
if (colOverscanStartIdx === 0) return 0;
|
|
900
877
|
let startIdx = colOverscanStartIdx;
|
|
901
|
-
|
|
902
878
|
const updateStartIdx = (colIdx, colSpan) => {
|
|
903
879
|
if (colSpan !== undefined && colIdx + colSpan > colOverscanStartIdx) {
|
|
904
880
|
startIdx = colIdx;
|
|
905
881
|
return true;
|
|
906
882
|
}
|
|
907
|
-
|
|
908
883
|
return false;
|
|
909
884
|
};
|
|
910
|
-
|
|
911
885
|
for (const column of colSpanColumns) {
|
|
912
886
|
const colIdx = column.idx;
|
|
913
887
|
if (colIdx >= startIdx) break;
|
|
914
|
-
|
|
915
888
|
if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, {
|
|
916
889
|
type: 'HEADER'
|
|
917
890
|
}))) {
|
|
918
891
|
break;
|
|
919
892
|
}
|
|
920
|
-
|
|
921
893
|
for (let rowIdx = rowOverscanStartIdx; rowIdx <= rowOverscanEndIdx; rowIdx++) {
|
|
922
894
|
const row = rows[rowIdx];
|
|
923
895
|
if (isGroupRow(row)) continue;
|
|
924
|
-
|
|
925
896
|
if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, {
|
|
926
897
|
type: 'ROW',
|
|
927
898
|
row
|
|
@@ -929,7 +900,6 @@
|
|
|
929
900
|
break;
|
|
930
901
|
}
|
|
931
902
|
}
|
|
932
|
-
|
|
933
903
|
if (topSummaryRows != null) {
|
|
934
904
|
for (const row of topSummaryRows) {
|
|
935
905
|
if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, {
|
|
@@ -940,7 +910,6 @@
|
|
|
940
910
|
}
|
|
941
911
|
}
|
|
942
912
|
}
|
|
943
|
-
|
|
944
913
|
if (bottomSummaryRows != null) {
|
|
945
914
|
for (const row of bottomSummaryRows) {
|
|
946
915
|
if (updateStartIdx(colIdx, getColSpan(column, lastFrozenColumnIndex, {
|
|
@@ -952,44 +921,22 @@
|
|
|
952
921
|
}
|
|
953
922
|
}
|
|
954
923
|
}
|
|
955
|
-
|
|
956
924
|
return startIdx;
|
|
957
925
|
}, [rowOverscanStartIdx, rowOverscanEndIdx, rows, topSummaryRows, bottomSummaryRows, colOverscanStartIdx, lastFrozenColumnIndex, colSpanColumns, isGroupRow]);
|
|
958
|
-
|
|
959
|
-
viewportColumns,
|
|
960
|
-
flexWidthViewportColumns
|
|
961
|
-
} = F(() => {
|
|
926
|
+
return F$1(() => {
|
|
962
927
|
const viewportColumns = [];
|
|
963
|
-
const flexWidthViewportColumns = [];
|
|
964
|
-
|
|
965
928
|
for (let colIdx = 0; colIdx <= colOverscanEndIdx; colIdx++) {
|
|
966
929
|
const column = columns[colIdx];
|
|
967
930
|
if (colIdx < startIdx && !column.frozen) continue;
|
|
968
931
|
viewportColumns.push(column);
|
|
969
|
-
|
|
970
|
-
if (typeof column.width === 'string') {
|
|
971
|
-
flexWidthViewportColumns.push(column);
|
|
972
|
-
}
|
|
973
932
|
}
|
|
974
|
-
|
|
975
|
-
return {
|
|
976
|
-
viewportColumns,
|
|
977
|
-
flexWidthViewportColumns
|
|
978
|
-
};
|
|
933
|
+
return viewportColumns;
|
|
979
934
|
}, [startIdx, colOverscanEndIdx, columns]);
|
|
980
|
-
const unsizedFlexWidthViewportColumns = F(() => {
|
|
981
|
-
return flexWidthViewportColumns.filter(column => !columnWidths.has(column.key));
|
|
982
|
-
}, [flexWidthViewportColumns, columnWidths]);
|
|
983
|
-
return {
|
|
984
|
-
viewportColumns,
|
|
985
|
-
flexWidthViewportColumns: unsizedFlexWidthViewportColumns
|
|
986
|
-
};
|
|
987
935
|
}
|
|
988
936
|
|
|
989
937
|
function isReadonlyArray(arr) {
|
|
990
938
|
return Array.isArray(arr);
|
|
991
939
|
}
|
|
992
|
-
|
|
993
940
|
function useViewportRows({
|
|
994
941
|
rawRows,
|
|
995
942
|
rowHeight,
|
|
@@ -1000,13 +947,11 @@
|
|
|
1000
947
|
expandedGroupIds,
|
|
1001
948
|
enableVirtualization
|
|
1002
949
|
}) {
|
|
1003
|
-
const [groupedRows, rowsCount] = F(() => {
|
|
950
|
+
const [groupedRows, rowsCount] = F$1(() => {
|
|
1004
951
|
if (groupBy.length === 0 || rowGrouper == null) return [undefined, rawRows.length];
|
|
1005
|
-
|
|
1006
952
|
const groupRows = (rows, [groupByKey, ...remainingGroupByKeys], startRowIndex) => {
|
|
1007
953
|
let groupRowsCount = 0;
|
|
1008
954
|
const groups = {};
|
|
1009
|
-
|
|
1010
955
|
for (const [key, childRows] of Object.entries(rowGrouper(rows, groupByKey))) {
|
|
1011
956
|
const [childGroups, childRowsCount] = remainingGroupByKeys.length === 0 ? [childRows, childRows.length] : groupRows(childRows, remainingGroupByKeys, startRowIndex + groupRowsCount + 1);
|
|
1012
957
|
groups[key] = {
|
|
@@ -1016,23 +961,19 @@
|
|
|
1016
961
|
};
|
|
1017
962
|
groupRowsCount += childRowsCount + 1;
|
|
1018
963
|
}
|
|
1019
|
-
|
|
1020
964
|
return [groups, groupRowsCount];
|
|
1021
965
|
};
|
|
1022
|
-
|
|
1023
966
|
return groupRows(rawRows, groupBy, 0);
|
|
1024
967
|
}, [groupBy, rowGrouper, rawRows]);
|
|
1025
|
-
const [rows, isGroupRow] = F(() => {
|
|
968
|
+
const [rows, isGroupRow] = F$1(() => {
|
|
1026
969
|
const allGroupRows = new Set();
|
|
1027
970
|
if (!groupedRows) return [rawRows, isGroupRow];
|
|
1028
971
|
const flattenedRows = [];
|
|
1029
|
-
|
|
1030
972
|
const expandGroup = (rows, parentId, level) => {
|
|
1031
973
|
if (isReadonlyArray(rows)) {
|
|
1032
974
|
flattenedRows.push(...rows);
|
|
1033
975
|
return;
|
|
1034
976
|
}
|
|
1035
|
-
|
|
1036
977
|
Object.keys(rows).forEach((groupKey, posInSet, keys) => {
|
|
1037
978
|
const id = parentId !== undefined ? `${parentId}__${groupKey}` : groupKey;
|
|
1038
979
|
const isExpanded = expandedGroupIds?.has(id) ?? false;
|
|
@@ -1054,16 +995,13 @@
|
|
|
1054
995
|
};
|
|
1055
996
|
flattenedRows.push(groupRow);
|
|
1056
997
|
allGroupRows.add(groupRow);
|
|
1057
|
-
|
|
1058
998
|
if (isExpanded) {
|
|
1059
999
|
expandGroup(childGroups, id, level + 1);
|
|
1060
1000
|
}
|
|
1061
1001
|
});
|
|
1062
1002
|
};
|
|
1063
|
-
|
|
1064
1003
|
expandGroup(groupedRows, undefined, 0);
|
|
1065
1004
|
return [flattenedRows, isGroupRow];
|
|
1066
|
-
|
|
1067
1005
|
function isGroupRow(row) {
|
|
1068
1006
|
return allGroupRows.has(row);
|
|
1069
1007
|
}
|
|
@@ -1074,7 +1012,7 @@
|
|
|
1074
1012
|
getRowTop,
|
|
1075
1013
|
getRowHeight,
|
|
1076
1014
|
findRowIdx
|
|
1077
|
-
} = F(() => {
|
|
1015
|
+
} = F$1(() => {
|
|
1078
1016
|
if (typeof rowHeight === 'number') {
|
|
1079
1017
|
return {
|
|
1080
1018
|
totalRowHeight: rowHeight * rows.length,
|
|
@@ -1084,7 +1022,6 @@
|
|
|
1084
1022
|
findRowIdx: offset => floor(offset / rowHeight)
|
|
1085
1023
|
};
|
|
1086
1024
|
}
|
|
1087
|
-
|
|
1088
1025
|
let totalRowHeight = 0;
|
|
1089
1026
|
let gridTemplateRows = ' ';
|
|
1090
1027
|
const rowPositions = rows.map(row => {
|
|
@@ -1103,43 +1040,34 @@
|
|
|
1103
1040
|
totalRowHeight += currentRowHeight;
|
|
1104
1041
|
return position;
|
|
1105
1042
|
});
|
|
1106
|
-
|
|
1107
1043
|
const validateRowIdx = rowIdx => {
|
|
1108
1044
|
return max(0, min(rows.length - 1, rowIdx));
|
|
1109
1045
|
};
|
|
1110
|
-
|
|
1111
1046
|
return {
|
|
1112
1047
|
totalRowHeight,
|
|
1113
1048
|
gridTemplateRows,
|
|
1114
1049
|
getRowTop: rowIdx => rowPositions[validateRowIdx(rowIdx)].top,
|
|
1115
1050
|
getRowHeight: rowIdx => rowPositions[validateRowIdx(rowIdx)].height,
|
|
1116
|
-
|
|
1117
1051
|
findRowIdx(offset) {
|
|
1118
1052
|
let start = 0;
|
|
1119
1053
|
let end = rowPositions.length - 1;
|
|
1120
|
-
|
|
1121
1054
|
while (start <= end) {
|
|
1122
1055
|
const middle = start + floor((end - start) / 2);
|
|
1123
1056
|
const currentOffset = rowPositions[middle].top;
|
|
1124
1057
|
if (currentOffset === offset) return middle;
|
|
1125
|
-
|
|
1126
1058
|
if (currentOffset < offset) {
|
|
1127
1059
|
start = middle + 1;
|
|
1128
1060
|
} else if (currentOffset > offset) {
|
|
1129
1061
|
end = middle - 1;
|
|
1130
1062
|
}
|
|
1131
|
-
|
|
1132
1063
|
if (start > end) return end;
|
|
1133
1064
|
}
|
|
1134
|
-
|
|
1135
1065
|
return 0;
|
|
1136
1066
|
}
|
|
1137
|
-
|
|
1138
1067
|
};
|
|
1139
1068
|
}, [isGroupRow, rowHeight, rows]);
|
|
1140
1069
|
let rowOverscanStartIdx = 0;
|
|
1141
1070
|
let rowOverscanEndIdx = rows.length - 1;
|
|
1142
|
-
|
|
1143
1071
|
if (enableVirtualization) {
|
|
1144
1072
|
const overscanThreshold = 4;
|
|
1145
1073
|
const rowVisibleStartIdx = findRowIdx(scrollTop);
|
|
@@ -1147,7 +1075,6 @@
|
|
|
1147
1075
|
rowOverscanStartIdx = max(0, rowVisibleStartIdx - overscanThreshold);
|
|
1148
1076
|
rowOverscanEndIdx = min(rows.length - 1, rowVisibleEndIdx + overscanThreshold);
|
|
1149
1077
|
}
|
|
1150
|
-
|
|
1151
1078
|
return {
|
|
1152
1079
|
rowOverscanStartIdx,
|
|
1153
1080
|
rowOverscanEndIdx,
|
|
@@ -1162,107 +1089,371 @@
|
|
|
1162
1089
|
};
|
|
1163
1090
|
}
|
|
1164
1091
|
|
|
1165
|
-
const
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1092
|
+
const cellDragHandle = "cadd3bp7-0-0-beta-33";
|
|
1093
|
+
const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
|
|
1094
|
+
function DragHandle({
|
|
1095
|
+
rows,
|
|
1096
|
+
columns,
|
|
1097
|
+
selectedPosition,
|
|
1098
|
+
latestDraggedOverRowIdx,
|
|
1099
|
+
isCellEditable,
|
|
1100
|
+
onRowsChange,
|
|
1101
|
+
onFill,
|
|
1102
|
+
setDragging,
|
|
1103
|
+
setDraggedOverRowIdx
|
|
1175
1104
|
}) {
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1105
|
+
function handleMouseDown(event) {
|
|
1106
|
+
if (event.buttons !== 1) return;
|
|
1107
|
+
setDragging(true);
|
|
1108
|
+
window.addEventListener('mouseover', onMouseOver);
|
|
1109
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
1110
|
+
function onMouseOver(event) {
|
|
1111
|
+
if (event.buttons !== 1) onMouseUp();
|
|
1112
|
+
}
|
|
1113
|
+
function onMouseUp() {
|
|
1114
|
+
window.removeEventListener('mouseover', onMouseOver);
|
|
1115
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
1116
|
+
setDragging(false);
|
|
1117
|
+
handleDragEnd();
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
function handleDragEnd() {
|
|
1121
|
+
const overRowIdx = latestDraggedOverRowIdx.current;
|
|
1122
|
+
if (overRowIdx === undefined) return;
|
|
1123
|
+
const {
|
|
1124
|
+
rowIdx
|
|
1125
|
+
} = selectedPosition;
|
|
1126
|
+
const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;
|
|
1127
|
+
const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;
|
|
1128
|
+
updateRows(startRowIndex, endRowIndex);
|
|
1129
|
+
setDraggedOverRowIdx(undefined);
|
|
1130
|
+
}
|
|
1131
|
+
function handleDoubleClick(event) {
|
|
1132
|
+
event.stopPropagation();
|
|
1133
|
+
updateRows(selectedPosition.rowIdx + 1, rows.length);
|
|
1134
|
+
}
|
|
1135
|
+
function updateRows(startRowIdx, endRowIdx) {
|
|
1136
|
+
const {
|
|
1137
|
+
idx,
|
|
1138
|
+
rowIdx
|
|
1139
|
+
} = selectedPosition;
|
|
1140
|
+
const column = columns[idx];
|
|
1141
|
+
const sourceRow = rows[rowIdx];
|
|
1142
|
+
const updatedRows = [...rows];
|
|
1143
|
+
const indexes = [];
|
|
1144
|
+
for (let i = startRowIdx; i < endRowIdx; i++) {
|
|
1145
|
+
if (isCellEditable({
|
|
1146
|
+
rowIdx: i,
|
|
1147
|
+
idx
|
|
1148
|
+
})) {
|
|
1149
|
+
const updatedRow = onFill({
|
|
1150
|
+
columnKey: column.key,
|
|
1151
|
+
sourceRow,
|
|
1152
|
+
targetRow: rows[i]
|
|
1153
|
+
});
|
|
1154
|
+
if (updatedRow !== rows[i]) {
|
|
1155
|
+
updatedRows[i] = updatedRow;
|
|
1156
|
+
indexes.push(i);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (indexes.length > 0) {
|
|
1161
|
+
onRowsChange?.(updatedRows, {
|
|
1162
|
+
indexes,
|
|
1163
|
+
column
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
return /*#__PURE__*/o("div", {
|
|
1168
|
+
className: cellDragHandleClassname,
|
|
1169
|
+
onMouseDown: handleMouseDown,
|
|
1170
|
+
onDoubleClick: handleDoubleClick
|
|
1185
1171
|
});
|
|
1186
1172
|
}
|
|
1187
1173
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1174
|
+
const cellEditing = "c1tngyp17-0-0-beta-33";
|
|
1175
|
+
function EditCell({
|
|
1176
|
+
column,
|
|
1177
|
+
colSpan,
|
|
1178
|
+
row,
|
|
1179
|
+
rowIdx,
|
|
1180
|
+
onRowChange,
|
|
1181
|
+
closeEditor,
|
|
1182
|
+
onKeyDown,
|
|
1183
|
+
navigate
|
|
1194
1184
|
}) {
|
|
1195
|
-
const
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1185
|
+
const frameRequestRef = _$1();
|
|
1186
|
+
const commitOnOutsideClick = column.editorOptions?.commitOnOutsideClick !== false;
|
|
1187
|
+
const commitOnOutsideMouseDown = useLatestFunc(() => {
|
|
1188
|
+
onClose(true, false);
|
|
1189
|
+
});
|
|
1190
|
+
p(() => {
|
|
1191
|
+
if (!commitOnOutsideClick) return;
|
|
1192
|
+
function onWindowCaptureMouseDown() {
|
|
1193
|
+
frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);
|
|
1194
|
+
}
|
|
1195
|
+
addEventListener('mousedown', onWindowCaptureMouseDown, {
|
|
1196
|
+
capture: true
|
|
1197
|
+
});
|
|
1198
|
+
return () => {
|
|
1199
|
+
removeEventListener('mousedown', onWindowCaptureMouseDown, {
|
|
1200
|
+
capture: true
|
|
1201
|
+
});
|
|
1202
|
+
cancelFrameRequest();
|
|
1203
|
+
};
|
|
1204
|
+
}, [commitOnOutsideClick, commitOnOutsideMouseDown]);
|
|
1205
|
+
function cancelFrameRequest() {
|
|
1206
|
+
cancelAnimationFrame(frameRequestRef.current);
|
|
1207
|
+
}
|
|
1201
1208
|
function handleKeyDown(event) {
|
|
1202
|
-
if (
|
|
1203
|
-
event
|
|
1204
|
-
|
|
1209
|
+
if (onKeyDown) {
|
|
1210
|
+
const cellEvent = createCellEvent(event);
|
|
1211
|
+
onKeyDown({
|
|
1212
|
+
mode: 'EDIT',
|
|
1213
|
+
row,
|
|
1214
|
+
column,
|
|
1215
|
+
rowIdx,
|
|
1216
|
+
navigate() {
|
|
1217
|
+
navigate(event);
|
|
1218
|
+
},
|
|
1219
|
+
onClose
|
|
1220
|
+
}, cellEvent);
|
|
1221
|
+
if (cellEvent.isGridDefaultPrevented()) return;
|
|
1222
|
+
}
|
|
1223
|
+
if (event.key === 'Escape') {
|
|
1224
|
+
onClose();
|
|
1225
|
+
} else if (event.key === 'Enter') {
|
|
1226
|
+
onClose(true);
|
|
1227
|
+
} else if (onEditorNavigation(event)) {
|
|
1228
|
+
navigate(event);
|
|
1205
1229
|
}
|
|
1206
1230
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1231
|
+
function onClose(commitChanges = false, shouldFocusCell = true) {
|
|
1232
|
+
if (commitChanges) {
|
|
1233
|
+
onRowChange(row, true, shouldFocusCell);
|
|
1234
|
+
} else {
|
|
1235
|
+
closeEditor(shouldFocusCell);
|
|
1236
|
+
}
|
|
1210
1237
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1238
|
+
function onEditorRowChange(row, commitChangesAndFocus = false) {
|
|
1239
|
+
onRowChange(row, commitChangesAndFocus, commitChangesAndFocus);
|
|
1240
|
+
}
|
|
1241
|
+
const {
|
|
1242
|
+
cellClass
|
|
1243
|
+
} = column;
|
|
1244
|
+
const className = getCellClassname(column, 'rdg-editor-container', typeof cellClass === 'function' ? cellClass(row) : cellClass, !column.editorOptions?.displayCellContent && cellEditing);
|
|
1245
|
+
return /*#__PURE__*/o("div", {
|
|
1246
|
+
role: "gridcell",
|
|
1247
|
+
"aria-colindex": column.idx + 1,
|
|
1248
|
+
"aria-colspan": colSpan,
|
|
1249
|
+
"aria-selected": true,
|
|
1250
|
+
className: className,
|
|
1251
|
+
style: getCellStyle(column, colSpan),
|
|
1217
1252
|
onKeyDown: handleKeyDown,
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
children:
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
})
|
|
1226
|
-
|
|
1253
|
+
onMouseDownCapture: cancelFrameRequest,
|
|
1254
|
+
children: column.renderEditCell != null && /*#__PURE__*/o(k$2, {
|
|
1255
|
+
children: [column.renderEditCell({
|
|
1256
|
+
column,
|
|
1257
|
+
row,
|
|
1258
|
+
onRowChange: onEditorRowChange,
|
|
1259
|
+
onClose
|
|
1260
|
+
}), column.editorOptions?.displayCellContent && column.renderCell({
|
|
1261
|
+
column,
|
|
1262
|
+
row,
|
|
1263
|
+
isCellEditable: true,
|
|
1264
|
+
tabIndex: -1,
|
|
1265
|
+
onRowChange: onEditorRowChange
|
|
1266
|
+
})]
|
|
1267
|
+
})
|
|
1227
1268
|
});
|
|
1228
1269
|
}
|
|
1229
1270
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1271
|
+
function GroupCell({
|
|
1272
|
+
id,
|
|
1273
|
+
groupKey,
|
|
1274
|
+
childRows,
|
|
1275
|
+
isExpanded,
|
|
1235
1276
|
isCellSelected,
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
onSortColumnsChange,
|
|
1241
|
-
selectCell,
|
|
1242
|
-
shouldFocusGrid,
|
|
1243
|
-
direction
|
|
1277
|
+
column,
|
|
1278
|
+
row,
|
|
1279
|
+
groupColumnIndex,
|
|
1280
|
+
toggleGroup: toggleGroupWrapper
|
|
1244
1281
|
}) {
|
|
1245
|
-
const isRtl = direction === 'rtl';
|
|
1246
1282
|
const {
|
|
1247
|
-
ref,
|
|
1248
1283
|
tabIndex,
|
|
1284
|
+
childTabIndex,
|
|
1249
1285
|
onFocus
|
|
1250
|
-
} =
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1286
|
+
} = useRovingTabIndex(isCellSelected);
|
|
1287
|
+
function toggleGroup() {
|
|
1288
|
+
toggleGroupWrapper(id);
|
|
1289
|
+
}
|
|
1290
|
+
const isLevelMatching = column.rowGroup && groupColumnIndex === column.idx;
|
|
1291
|
+
return /*#__PURE__*/o("div", {
|
|
1292
|
+
role: "gridcell",
|
|
1293
|
+
"aria-colindex": column.idx + 1,
|
|
1294
|
+
"aria-selected": isCellSelected,
|
|
1295
|
+
tabIndex: tabIndex,
|
|
1296
|
+
className: getCellClassname(column),
|
|
1297
|
+
style: {
|
|
1298
|
+
...getCellStyle(column),
|
|
1299
|
+
cursor: isLevelMatching ? 'pointer' : 'default'
|
|
1300
|
+
},
|
|
1301
|
+
onClick: isLevelMatching ? toggleGroup : undefined,
|
|
1302
|
+
onFocus: onFocus,
|
|
1303
|
+
children: (!column.rowGroup || groupColumnIndex === column.idx) && column.renderGroupCell?.({
|
|
1304
|
+
groupKey,
|
|
1305
|
+
childRows,
|
|
1306
|
+
column,
|
|
1307
|
+
row,
|
|
1308
|
+
isExpanded,
|
|
1309
|
+
tabIndex: childTabIndex,
|
|
1310
|
+
toggleGroup
|
|
1311
|
+
})
|
|
1312
|
+
}, column.key);
|
|
1313
|
+
}
|
|
1314
|
+
const GroupCell$1 = /*#__PURE__*/x(GroupCell);
|
|
1258
1315
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1316
|
+
const row = "r1otpg647-0-0-beta-33";
|
|
1317
|
+
const rowClassname = `rdg-row ${row}`;
|
|
1318
|
+
const rowSelected = "rel5gk27-0-0-beta-33";
|
|
1319
|
+
const rowSelectedClassname = 'rdg-row-selected';
|
|
1320
|
+
const rowSelectedWithFrozenCell = "r1qymf1z7-0-0-beta-33";
|
|
1263
1321
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1322
|
+
const groupRow = "gyxx7e97-0-0-beta-33";
|
|
1323
|
+
const groupRowClassname = `rdg-group-row ${groupRow}`;
|
|
1324
|
+
function GroupedRow({
|
|
1325
|
+
id,
|
|
1326
|
+
groupKey,
|
|
1327
|
+
viewportColumns,
|
|
1328
|
+
childRows,
|
|
1329
|
+
rowIdx,
|
|
1330
|
+
row,
|
|
1331
|
+
gridRowStart,
|
|
1332
|
+
height,
|
|
1333
|
+
level,
|
|
1334
|
+
isExpanded,
|
|
1335
|
+
selectedCellIdx,
|
|
1336
|
+
isRowSelected,
|
|
1337
|
+
selectGroup,
|
|
1338
|
+
toggleGroup,
|
|
1339
|
+
...props
|
|
1340
|
+
}) {
|
|
1341
|
+
const idx = viewportColumns[0].key === SELECT_COLUMN_KEY ? level + 1 : level;
|
|
1342
|
+
function handleSelectGroup() {
|
|
1343
|
+
selectGroup(rowIdx);
|
|
1344
|
+
}
|
|
1345
|
+
return /*#__PURE__*/o(RowSelectionProvider, {
|
|
1346
|
+
value: isRowSelected,
|
|
1347
|
+
children: /*#__PURE__*/o("div", {
|
|
1348
|
+
role: "row",
|
|
1349
|
+
"aria-level": level,
|
|
1350
|
+
"aria-expanded": isExpanded,
|
|
1351
|
+
className: clsx(rowClassname, groupRowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, selectedCellIdx === -1 && rowSelectedClassname),
|
|
1352
|
+
onClick: handleSelectGroup,
|
|
1353
|
+
style: getRowStyle(gridRowStart, height),
|
|
1354
|
+
...props,
|
|
1355
|
+
children: viewportColumns.map(column => /*#__PURE__*/o(GroupCell$1, {
|
|
1356
|
+
id: id,
|
|
1357
|
+
groupKey: groupKey,
|
|
1358
|
+
childRows: childRows,
|
|
1359
|
+
isExpanded: isExpanded,
|
|
1360
|
+
isCellSelected: selectedCellIdx === column.idx,
|
|
1361
|
+
column: column,
|
|
1362
|
+
row: row,
|
|
1363
|
+
groupColumnIndex: idx,
|
|
1364
|
+
toggleGroup: toggleGroup
|
|
1365
|
+
}, column.key))
|
|
1366
|
+
})
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
const GroupRowRenderer = /*#__PURE__*/x(GroupedRow);
|
|
1370
|
+
|
|
1371
|
+
const headerSortCell = "hizp7y17-0-0-beta-33";
|
|
1372
|
+
const headerSortCellClassname = `rdg-header-sort-cell ${headerSortCell}`;
|
|
1373
|
+
const headerSortName = "h14cojrm7-0-0-beta-33";
|
|
1374
|
+
const headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;
|
|
1375
|
+
function renderHeaderCell({
|
|
1376
|
+
column,
|
|
1377
|
+
sortDirection,
|
|
1378
|
+
priority,
|
|
1379
|
+
onSort,
|
|
1380
|
+
tabIndex
|
|
1381
|
+
}) {
|
|
1382
|
+
if (!column.sortable) return column.name;
|
|
1383
|
+
return /*#__PURE__*/o(SortableHeaderCell, {
|
|
1384
|
+
onSort: onSort,
|
|
1385
|
+
sortDirection: sortDirection,
|
|
1386
|
+
priority: priority,
|
|
1387
|
+
tabIndex: tabIndex,
|
|
1388
|
+
children: column.name
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
function SortableHeaderCell({
|
|
1392
|
+
onSort,
|
|
1393
|
+
sortDirection,
|
|
1394
|
+
priority,
|
|
1395
|
+
children,
|
|
1396
|
+
tabIndex
|
|
1397
|
+
}) {
|
|
1398
|
+
const renderSortStatus = useDefaultRenderers().renderSortStatus;
|
|
1399
|
+
function handleKeyDown(event) {
|
|
1400
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
1401
|
+
event.preventDefault();
|
|
1402
|
+
onSort(event.ctrlKey || event.metaKey);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
function handleClick(event) {
|
|
1406
|
+
onSort(event.ctrlKey || event.metaKey);
|
|
1407
|
+
}
|
|
1408
|
+
return /*#__PURE__*/o("span", {
|
|
1409
|
+
tabIndex: tabIndex,
|
|
1410
|
+
className: headerSortCellClassname,
|
|
1411
|
+
onClick: handleClick,
|
|
1412
|
+
onKeyDown: handleKeyDown,
|
|
1413
|
+
children: [/*#__PURE__*/o("span", {
|
|
1414
|
+
className: headerSortNameClassname,
|
|
1415
|
+
children: children
|
|
1416
|
+
}), /*#__PURE__*/o("span", {
|
|
1417
|
+
children: renderSortStatus({
|
|
1418
|
+
sortDirection,
|
|
1419
|
+
priority
|
|
1420
|
+
})
|
|
1421
|
+
})]
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
const cellResizable = "celq7o97-0-0-beta-33";
|
|
1426
|
+
const cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;
|
|
1427
|
+
function HeaderCell({
|
|
1428
|
+
column,
|
|
1429
|
+
colSpan,
|
|
1430
|
+
isCellSelected,
|
|
1431
|
+
onColumnResize,
|
|
1432
|
+
sortColumns,
|
|
1433
|
+
onSortColumnsChange,
|
|
1434
|
+
selectCell,
|
|
1435
|
+
shouldFocusGrid,
|
|
1436
|
+
direction
|
|
1437
|
+
}) {
|
|
1438
|
+
const isRtl = direction === 'rtl';
|
|
1439
|
+
const {
|
|
1440
|
+
tabIndex,
|
|
1441
|
+
childTabIndex,
|
|
1442
|
+
onFocus
|
|
1443
|
+
} = useRovingTabIndex(isCellSelected);
|
|
1444
|
+
const sortIndex = sortColumns?.findIndex(sort => sort.columnKey === column.key);
|
|
1445
|
+
const sortColumn = sortIndex !== undefined && sortIndex > -1 ? sortColumns[sortIndex] : undefined;
|
|
1446
|
+
const sortDirection = sortColumn?.direction;
|
|
1447
|
+
const priority = sortColumn !== undefined && sortColumns.length > 1 ? sortIndex + 1 : undefined;
|
|
1448
|
+
const ariaSort = sortDirection && !priority ? sortDirection === 'ASC' ? 'ascending' : 'descending' : undefined;
|
|
1449
|
+
const className = getCellClassname(column, column.headerCellClass, column.resizable && cellResizableClassname);
|
|
1450
|
+
const renderHeaderCell$1 = column.renderHeaderCell ?? renderHeaderCell;
|
|
1451
|
+
function onPointerDown(event) {
|
|
1452
|
+
if (event.pointerType === 'mouse' && event.buttons !== 1) {
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
const {
|
|
1456
|
+
currentTarget,
|
|
1266
1457
|
pointerId
|
|
1267
1458
|
} = event;
|
|
1268
1459
|
const {
|
|
@@ -1270,11 +1461,9 @@
|
|
|
1270
1461
|
left
|
|
1271
1462
|
} = currentTarget.getBoundingClientRect();
|
|
1272
1463
|
const offset = isRtl ? event.clientX - left : right - event.clientX;
|
|
1273
|
-
|
|
1274
1464
|
if (offset > 11) {
|
|
1275
1465
|
return;
|
|
1276
1466
|
}
|
|
1277
|
-
|
|
1278
1467
|
function onPointerMove(event) {
|
|
1279
1468
|
event.preventDefault();
|
|
1280
1469
|
const {
|
|
@@ -1282,28 +1471,23 @@
|
|
|
1282
1471
|
left
|
|
1283
1472
|
} = currentTarget.getBoundingClientRect();
|
|
1284
1473
|
const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left;
|
|
1285
|
-
|
|
1286
1474
|
if (width > 0) {
|
|
1287
|
-
onColumnResize(column, width);
|
|
1475
|
+
onColumnResize(column, clampColumnWidth(width, column));
|
|
1288
1476
|
}
|
|
1289
1477
|
}
|
|
1290
|
-
|
|
1291
1478
|
function onLostPointerCapture() {
|
|
1292
1479
|
currentTarget.removeEventListener('pointermove', onPointerMove);
|
|
1293
1480
|
currentTarget.removeEventListener('lostpointercapture', onLostPointerCapture);
|
|
1294
1481
|
}
|
|
1295
|
-
|
|
1296
1482
|
currentTarget.setPointerCapture(pointerId);
|
|
1297
1483
|
currentTarget.addEventListener('pointermove', onPointerMove);
|
|
1298
1484
|
currentTarget.addEventListener('lostpointercapture', onLostPointerCapture);
|
|
1299
1485
|
}
|
|
1300
|
-
|
|
1301
1486
|
function onSort(ctrlClick) {
|
|
1302
1487
|
if (onSortColumnsChange == null) return;
|
|
1303
1488
|
const {
|
|
1304
1489
|
sortDescendingFirst
|
|
1305
1490
|
} = column;
|
|
1306
|
-
|
|
1307
1491
|
if (sortColumn === undefined) {
|
|
1308
1492
|
const nextSort = {
|
|
1309
1493
|
columnKey: column.key,
|
|
@@ -1312,63 +1496,51 @@
|
|
|
1312
1496
|
onSortColumnsChange(sortColumns && ctrlClick ? [...sortColumns, nextSort] : [nextSort]);
|
|
1313
1497
|
} else {
|
|
1314
1498
|
let nextSortColumn;
|
|
1315
|
-
|
|
1316
|
-
if (sortDescendingFirst && sortDirection === 'DESC' || !sortDescendingFirst && sortDirection === 'ASC') {
|
|
1499
|
+
if (sortDescendingFirst === true && sortDirection === 'DESC' || sortDescendingFirst !== true && sortDirection === 'ASC') {
|
|
1317
1500
|
nextSortColumn = {
|
|
1318
1501
|
columnKey: column.key,
|
|
1319
1502
|
direction: sortDirection === 'ASC' ? 'DESC' : 'ASC'
|
|
1320
1503
|
};
|
|
1321
1504
|
}
|
|
1322
|
-
|
|
1323
1505
|
if (ctrlClick) {
|
|
1324
1506
|
const nextSortColumns = [...sortColumns];
|
|
1325
|
-
|
|
1326
1507
|
if (nextSortColumn) {
|
|
1327
1508
|
nextSortColumns[sortIndex] = nextSortColumn;
|
|
1328
1509
|
} else {
|
|
1329
1510
|
nextSortColumns.splice(sortIndex, 1);
|
|
1330
1511
|
}
|
|
1331
|
-
|
|
1332
1512
|
onSortColumnsChange(nextSortColumns);
|
|
1333
1513
|
} else {
|
|
1334
1514
|
onSortColumnsChange(nextSortColumn ? [nextSortColumn] : []);
|
|
1335
1515
|
}
|
|
1336
1516
|
}
|
|
1337
1517
|
}
|
|
1338
|
-
|
|
1339
1518
|
function onClick() {
|
|
1340
1519
|
selectCell(column.idx);
|
|
1341
1520
|
}
|
|
1342
|
-
|
|
1343
1521
|
function onDoubleClick(event) {
|
|
1344
1522
|
const {
|
|
1345
1523
|
right,
|
|
1346
1524
|
left
|
|
1347
1525
|
} = event.currentTarget.getBoundingClientRect();
|
|
1348
1526
|
const offset = isRtl ? event.clientX - left : right - event.clientX;
|
|
1349
|
-
|
|
1350
1527
|
if (offset > 11) {
|
|
1351
1528
|
return;
|
|
1352
1529
|
}
|
|
1353
|
-
|
|
1354
1530
|
onColumnResize(column, 'max-content');
|
|
1355
1531
|
}
|
|
1356
|
-
|
|
1357
1532
|
function handleFocus(event) {
|
|
1358
1533
|
onFocus?.(event);
|
|
1359
|
-
|
|
1360
1534
|
if (shouldFocusGrid) {
|
|
1361
1535
|
selectCell(0);
|
|
1362
1536
|
}
|
|
1363
1537
|
}
|
|
1364
|
-
|
|
1365
1538
|
return /*#__PURE__*/o("div", {
|
|
1366
1539
|
role: "columnheader",
|
|
1367
1540
|
"aria-colindex": column.idx + 1,
|
|
1368
1541
|
"aria-selected": isCellSelected,
|
|
1369
1542
|
"aria-sort": ariaSort,
|
|
1370
1543
|
"aria-colspan": colSpan,
|
|
1371
|
-
ref: ref,
|
|
1372
1544
|
tabIndex: shouldFocusGrid ? 0 : tabIndex,
|
|
1373
1545
|
className: className,
|
|
1374
1546
|
style: getCellStyle(column, colSpan),
|
|
@@ -1376,25 +1548,20 @@
|
|
|
1376
1548
|
onClick: onClick,
|
|
1377
1549
|
onDoubleClick: column.resizable ? onDoubleClick : undefined,
|
|
1378
1550
|
onPointerDown: column.resizable ? onPointerDown : undefined,
|
|
1379
|
-
children:
|
|
1551
|
+
children: renderHeaderCell$1({
|
|
1380
1552
|
column,
|
|
1381
1553
|
sortDirection,
|
|
1382
1554
|
priority,
|
|
1383
1555
|
onSort,
|
|
1384
|
-
|
|
1385
|
-
onAllRowsSelectionChange,
|
|
1386
|
-
isCellSelected
|
|
1556
|
+
tabIndex: childTabIndex
|
|
1387
1557
|
})
|
|
1388
1558
|
});
|
|
1389
1559
|
}
|
|
1390
1560
|
|
|
1391
|
-
const headerRow = "h197vzie7-0-0-beta-
|
|
1561
|
+
const headerRow = "h197vzie7-0-0-beta-33";
|
|
1392
1562
|
const headerRowClassname = `rdg-header-row ${headerRow}`;
|
|
1393
|
-
|
|
1394
1563
|
function HeaderRow({
|
|
1395
1564
|
columns,
|
|
1396
|
-
allRowsSelected,
|
|
1397
|
-
onAllRowsSelectionChange,
|
|
1398
1565
|
onColumnResize,
|
|
1399
1566
|
sortColumns,
|
|
1400
1567
|
onSortColumnsChange,
|
|
@@ -1405,24 +1572,19 @@
|
|
|
1405
1572
|
direction
|
|
1406
1573
|
}) {
|
|
1407
1574
|
const cells = [];
|
|
1408
|
-
|
|
1409
1575
|
for (let index = 0; index < columns.length; index++) {
|
|
1410
1576
|
const column = columns[index];
|
|
1411
1577
|
const colSpan = getColSpan(column, lastFrozenColumnIndex, {
|
|
1412
1578
|
type: 'HEADER'
|
|
1413
1579
|
});
|
|
1414
|
-
|
|
1415
1580
|
if (colSpan !== undefined) {
|
|
1416
1581
|
index += colSpan - 1;
|
|
1417
1582
|
}
|
|
1418
|
-
|
|
1419
1583
|
cells.push( /*#__PURE__*/o(HeaderCell, {
|
|
1420
1584
|
column: column,
|
|
1421
1585
|
colSpan: colSpan,
|
|
1422
1586
|
isCellSelected: selectedCellIdx === column.idx,
|
|
1423
1587
|
onColumnResize: onColumnResize,
|
|
1424
|
-
allRowsSelected: allRowsSelected,
|
|
1425
|
-
onAllRowsSelectionChange: onAllRowsSelectionChange,
|
|
1426
1588
|
onSortColumnsChange: onSortColumnsChange,
|
|
1427
1589
|
sortColumns: sortColumns,
|
|
1428
1590
|
selectCell: selectCell,
|
|
@@ -1430,7 +1592,6 @@
|
|
|
1430
1592
|
direction: direction
|
|
1431
1593
|
}, column.key));
|
|
1432
1594
|
}
|
|
1433
|
-
|
|
1434
1595
|
return /*#__PURE__*/o("div", {
|
|
1435
1596
|
role: "row",
|
|
1436
1597
|
"aria-rowindex": 1,
|
|
@@ -1439,14 +1600,12 @@
|
|
|
1439
1600
|
children: cells
|
|
1440
1601
|
});
|
|
1441
1602
|
}
|
|
1603
|
+
const HeaderRow$1 = /*#__PURE__*/x(HeaderRow);
|
|
1442
1604
|
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
const cellCopied = "ccpfvsn7-0-0-beta-19";
|
|
1605
|
+
const cellCopied = "ccpfvsn7-0-0-beta-33";
|
|
1446
1606
|
const cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;
|
|
1447
|
-
const cellDraggedOver = "c1bmg16t7-0-0-beta-
|
|
1607
|
+
const cellDraggedOver = "c1bmg16t7-0-0-beta-33";
|
|
1448
1608
|
const cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;
|
|
1449
|
-
|
|
1450
1609
|
function Cell({
|
|
1451
1610
|
column,
|
|
1452
1611
|
colSpan,
|
|
@@ -1454,52 +1613,76 @@
|
|
|
1454
1613
|
isCopied,
|
|
1455
1614
|
isDraggedOver,
|
|
1456
1615
|
row,
|
|
1616
|
+
rowIdx,
|
|
1457
1617
|
dragHandle,
|
|
1458
|
-
|
|
1459
|
-
|
|
1618
|
+
onClick,
|
|
1619
|
+
onDoubleClick,
|
|
1620
|
+
onContextMenu,
|
|
1460
1621
|
onRowChange,
|
|
1461
1622
|
selectCell,
|
|
1462
1623
|
...props
|
|
1463
1624
|
}) {
|
|
1464
1625
|
const {
|
|
1465
|
-
ref,
|
|
1466
1626
|
tabIndex,
|
|
1627
|
+
childTabIndex,
|
|
1467
1628
|
onFocus
|
|
1468
|
-
} =
|
|
1629
|
+
} = useRovingTabIndex(isCellSelected);
|
|
1469
1630
|
const {
|
|
1470
1631
|
cellClass
|
|
1471
1632
|
} = column;
|
|
1472
1633
|
const className = getCellClassname(column, typeof cellClass === 'function' ? cellClass(row) : cellClass, isCopied && cellCopiedClassname, isDraggedOver && cellDraggedOverClassname);
|
|
1473
|
-
|
|
1634
|
+
const isEditable = isCellEditable(column, row);
|
|
1474
1635
|
function selectCellWrapper(openEditor) {
|
|
1475
|
-
selectCell(
|
|
1636
|
+
selectCell({
|
|
1637
|
+
rowIdx,
|
|
1638
|
+
idx: column.idx
|
|
1639
|
+
}, openEditor);
|
|
1476
1640
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1641
|
+
function handleClick(event) {
|
|
1642
|
+
if (onClick) {
|
|
1643
|
+
const cellEvent = createCellEvent(event);
|
|
1644
|
+
onClick({
|
|
1645
|
+
row,
|
|
1646
|
+
column,
|
|
1647
|
+
selectCell: selectCellWrapper
|
|
1648
|
+
}, cellEvent);
|
|
1649
|
+
if (cellEvent.isGridDefaultPrevented()) return;
|
|
1650
|
+
}
|
|
1651
|
+
selectCellWrapper();
|
|
1481
1652
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1653
|
+
function handleContextMenu(event) {
|
|
1654
|
+
if (onContextMenu) {
|
|
1655
|
+
const cellEvent = createCellEvent(event);
|
|
1656
|
+
onContextMenu({
|
|
1657
|
+
row,
|
|
1658
|
+
column,
|
|
1659
|
+
selectCell: selectCellWrapper
|
|
1660
|
+
}, cellEvent);
|
|
1661
|
+
if (cellEvent.isGridDefaultPrevented()) return;
|
|
1662
|
+
}
|
|
1484
1663
|
selectCellWrapper();
|
|
1485
1664
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1665
|
+
function handleDoubleClick(event) {
|
|
1666
|
+
if (onDoubleClick) {
|
|
1667
|
+
const cellEvent = createCellEvent(event);
|
|
1668
|
+
onDoubleClick({
|
|
1669
|
+
row,
|
|
1670
|
+
column,
|
|
1671
|
+
selectCell: selectCellWrapper
|
|
1672
|
+
}, cellEvent);
|
|
1673
|
+
if (cellEvent.isGridDefaultPrevented()) return;
|
|
1674
|
+
}
|
|
1488
1675
|
selectCellWrapper(true);
|
|
1489
|
-
onRowDoubleClick?.(row, column);
|
|
1490
1676
|
}
|
|
1491
|
-
|
|
1492
1677
|
function handleRowChange(newRow) {
|
|
1493
1678
|
onRowChange(column, newRow);
|
|
1494
1679
|
}
|
|
1495
|
-
|
|
1496
1680
|
return /*#__PURE__*/o("div", {
|
|
1497
1681
|
role: "gridcell",
|
|
1498
1682
|
"aria-colindex": column.idx + 1,
|
|
1499
1683
|
"aria-selected": isCellSelected,
|
|
1500
1684
|
"aria-colspan": colSpan,
|
|
1501
|
-
"aria-readonly": !
|
|
1502
|
-
ref: ref,
|
|
1685
|
+
"aria-readonly": !isEditable || undefined,
|
|
1503
1686
|
tabIndex: tabIndex,
|
|
1504
1687
|
className: className,
|
|
1505
1688
|
style: getCellStyle(column, colSpan),
|
|
@@ -1508,18 +1691,18 @@
|
|
|
1508
1691
|
onContextMenu: handleContextMenu,
|
|
1509
1692
|
onFocus: onFocus,
|
|
1510
1693
|
...props,
|
|
1511
|
-
children: !column.rowGroup && /*#__PURE__*/o(
|
|
1512
|
-
children: [column.
|
|
1694
|
+
children: !column.rowGroup && /*#__PURE__*/o(k$2, {
|
|
1695
|
+
children: [column.renderCell({
|
|
1513
1696
|
column,
|
|
1514
1697
|
row,
|
|
1515
|
-
|
|
1698
|
+
isCellEditable: isEditable,
|
|
1699
|
+
tabIndex: childTabIndex,
|
|
1516
1700
|
onRowChange: handleRowChange
|
|
1517
1701
|
}), dragHandle]
|
|
1518
1702
|
})
|
|
1519
1703
|
});
|
|
1520
1704
|
}
|
|
1521
|
-
|
|
1522
|
-
const Cell$1 = /*#__PURE__*/w(Cell);
|
|
1705
|
+
const Cell$1 = /*#__PURE__*/x(Cell);
|
|
1523
1706
|
|
|
1524
1707
|
function Row({
|
|
1525
1708
|
className,
|
|
@@ -1535,8 +1718,9 @@
|
|
|
1535
1718
|
viewportColumns,
|
|
1536
1719
|
selectedCellEditor,
|
|
1537
1720
|
selectedCellDragHandle,
|
|
1538
|
-
|
|
1539
|
-
|
|
1721
|
+
onCellClick,
|
|
1722
|
+
onCellDoubleClick,
|
|
1723
|
+
onCellContextMenu,
|
|
1540
1724
|
rowClass,
|
|
1541
1725
|
setDraggedOverRowIdx,
|
|
1542
1726
|
onMouseEnter,
|
|
@@ -1547,15 +1731,12 @@
|
|
|
1547
1731
|
const handleRowChange = useLatestFunc((column, newRow) => {
|
|
1548
1732
|
onRowChange(column, rowIdx, newRow);
|
|
1549
1733
|
});
|
|
1550
|
-
|
|
1551
1734
|
function handleDragEnter(event) {
|
|
1552
1735
|
setDraggedOverRowIdx?.(rowIdx);
|
|
1553
1736
|
onMouseEnter?.(event);
|
|
1554
1737
|
}
|
|
1555
|
-
|
|
1556
|
-
className = clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, rowClass?.(row), className, selectedCellIdx === -1 && rowSelectedClassname);
|
|
1738
|
+
className = clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, rowClass?.(row, rowIdx), className, selectedCellIdx === -1 && rowSelectedClassname);
|
|
1557
1739
|
const cells = [];
|
|
1558
|
-
|
|
1559
1740
|
for (let index = 0; index < viewportColumns.length; index++) {
|
|
1560
1741
|
const column = viewportColumns[index];
|
|
1561
1742
|
const {
|
|
@@ -1565,13 +1746,10 @@
|
|
|
1565
1746
|
type: 'ROW',
|
|
1566
1747
|
row
|
|
1567
1748
|
});
|
|
1568
|
-
|
|
1569
1749
|
if (colSpan !== undefined) {
|
|
1570
1750
|
index += colSpan - 1;
|
|
1571
1751
|
}
|
|
1572
|
-
|
|
1573
1752
|
const isCellSelected = selectedCellIdx === idx;
|
|
1574
|
-
|
|
1575
1753
|
if (isCellSelected && selectedCellEditor) {
|
|
1576
1754
|
cells.push(selectedCellEditor);
|
|
1577
1755
|
} else {
|
|
@@ -1579,18 +1757,19 @@
|
|
|
1579
1757
|
column: column,
|
|
1580
1758
|
colSpan: colSpan,
|
|
1581
1759
|
row: row,
|
|
1760
|
+
rowIdx: rowIdx,
|
|
1582
1761
|
isCopied: copiedCellIdx === idx,
|
|
1583
1762
|
isDraggedOver: draggedOverCellIdx === idx,
|
|
1584
1763
|
isCellSelected: isCellSelected,
|
|
1585
1764
|
dragHandle: isCellSelected ? selectedCellDragHandle : undefined,
|
|
1586
|
-
|
|
1587
|
-
|
|
1765
|
+
onClick: onCellClick,
|
|
1766
|
+
onDoubleClick: onCellDoubleClick,
|
|
1767
|
+
onContextMenu: onCellContextMenu,
|
|
1588
1768
|
onRowChange: handleRowChange,
|
|
1589
1769
|
selectCell: selectCell
|
|
1590
1770
|
}, column.key));
|
|
1591
1771
|
}
|
|
1592
1772
|
}
|
|
1593
|
-
|
|
1594
1773
|
return /*#__PURE__*/o(RowSelectionProvider, {
|
|
1595
1774
|
value: isRowSelected,
|
|
1596
1775
|
children: /*#__PURE__*/o("div", {
|
|
@@ -1604,435 +1783,184 @@
|
|
|
1604
1783
|
})
|
|
1605
1784
|
});
|
|
1606
1785
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1786
|
+
const RowComponent = /*#__PURE__*/x( /*#__PURE__*/k(Row));
|
|
1787
|
+
function defaultRenderRow(key, props) {
|
|
1788
|
+
return /*#__PURE__*/o(RowComponent, {
|
|
1789
|
+
...props
|
|
1611
1790
|
}, key);
|
|
1612
1791
|
}
|
|
1613
1792
|
|
|
1614
|
-
function
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1793
|
+
function ScrollToCell({
|
|
1794
|
+
scrollToPosition: {
|
|
1795
|
+
idx,
|
|
1796
|
+
rowIdx
|
|
1797
|
+
},
|
|
1798
|
+
gridElement,
|
|
1799
|
+
setScrollToCellPosition
|
|
1800
|
+
}) {
|
|
1801
|
+
const ref = _$1(null);
|
|
1802
|
+
useLayoutEffect(() => {
|
|
1803
|
+
scrollIntoView(ref.current);
|
|
1804
|
+
});
|
|
1805
|
+
useLayoutEffect(() => {
|
|
1806
|
+
function removeScrollToCell() {
|
|
1807
|
+
setScrollToCellPosition(null);
|
|
1808
|
+
}
|
|
1809
|
+
const observer = new IntersectionObserver(removeScrollToCell, {
|
|
1810
|
+
root: gridElement,
|
|
1811
|
+
threshold: 1.0
|
|
1812
|
+
});
|
|
1813
|
+
observer.observe(ref.current);
|
|
1814
|
+
return () => {
|
|
1815
|
+
observer.disconnect();
|
|
1816
|
+
};
|
|
1817
|
+
}, [gridElement, setScrollToCellPosition]);
|
|
1818
|
+
return /*#__PURE__*/o("div", {
|
|
1819
|
+
ref: ref,
|
|
1820
|
+
style: {
|
|
1821
|
+
gridColumn: idx === undefined ? '1/-1' : idx + 1,
|
|
1822
|
+
gridRow: rowIdx === undefined ? '1/-1' : rowIdx + 2
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
const arrow = "a1mygwml7-0-0-beta-33";
|
|
1828
|
+
const arrowClassname = `rdg-sort-arrow ${arrow}`;
|
|
1829
|
+
function renderSortStatus({
|
|
1830
|
+
sortDirection,
|
|
1831
|
+
priority
|
|
1832
|
+
}) {
|
|
1833
|
+
return /*#__PURE__*/o(k$2, {
|
|
1834
|
+
children: [renderSortIcon({
|
|
1835
|
+
sortDirection
|
|
1836
|
+
}), renderSortPriority({
|
|
1837
|
+
priority
|
|
1838
|
+
})]
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
function renderSortIcon({
|
|
1842
|
+
sortDirection
|
|
1843
|
+
}) {
|
|
1844
|
+
if (sortDirection === undefined) return null;
|
|
1845
|
+
return /*#__PURE__*/o("svg", {
|
|
1846
|
+
viewBox: "0 0 12 8",
|
|
1847
|
+
width: "12",
|
|
1848
|
+
height: "8",
|
|
1849
|
+
className: arrowClassname,
|
|
1850
|
+
"aria-hidden": true,
|
|
1851
|
+
children: /*#__PURE__*/o("path", {
|
|
1852
|
+
d: sortDirection === 'ASC' ? 'M0 8 6 0 12 8' : 'M0 0 6 8 12 0'
|
|
1853
|
+
})
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
function renderSortPriority({
|
|
1857
|
+
priority
|
|
1858
|
+
}) {
|
|
1859
|
+
return priority;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
const root = "r104f42s7-0-0-beta-33";
|
|
1863
|
+
const rootClassname = `rdg ${root}`;
|
|
1864
|
+
const viewportDragging = "v7ly7s7-0-0-beta-33";
|
|
1865
|
+
const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
|
|
1866
|
+
const focusSinkClassname = "fc4f4zb7-0-0-beta-33";
|
|
1867
|
+
|
|
1868
|
+
const summaryCellClassname = "s1n3hxke7-0-0-beta-33";
|
|
1869
|
+
function SummaryCell({
|
|
1620
1870
|
column,
|
|
1871
|
+
colSpan,
|
|
1621
1872
|
row,
|
|
1622
|
-
|
|
1623
|
-
|
|
1873
|
+
rowIdx,
|
|
1874
|
+
isCellSelected,
|
|
1875
|
+
selectCell
|
|
1624
1876
|
}) {
|
|
1625
1877
|
const {
|
|
1626
|
-
ref,
|
|
1627
1878
|
tabIndex,
|
|
1879
|
+
childTabIndex,
|
|
1628
1880
|
onFocus
|
|
1629
|
-
} =
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1881
|
+
} = useRovingTabIndex(isCellSelected);
|
|
1882
|
+
const {
|
|
1883
|
+
summaryCellClass
|
|
1884
|
+
} = column;
|
|
1885
|
+
const className = getCellClassname(column, summaryCellClassname, typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass);
|
|
1886
|
+
function onClick() {
|
|
1887
|
+
selectCell({
|
|
1888
|
+
rowIdx,
|
|
1889
|
+
idx: column.idx
|
|
1890
|
+
});
|
|
1633
1891
|
}
|
|
1634
|
-
|
|
1635
|
-
const isLevelMatching = column.rowGroup && groupColumnIndex === column.idx;
|
|
1636
1892
|
return /*#__PURE__*/o("div", {
|
|
1637
1893
|
role: "gridcell",
|
|
1638
1894
|
"aria-colindex": column.idx + 1,
|
|
1895
|
+
"aria-colspan": colSpan,
|
|
1639
1896
|
"aria-selected": isCellSelected,
|
|
1640
|
-
ref: ref,
|
|
1641
|
-
tabIndex: tabIndex,
|
|
1642
|
-
className: getCellClassname(column),
|
|
1643
|
-
style: { ...getCellStyle(column),
|
|
1644
|
-
cursor: isLevelMatching ? 'pointer' : 'default'
|
|
1645
|
-
},
|
|
1646
|
-
onClick: isLevelMatching ? toggleGroup : undefined,
|
|
1647
|
-
onFocus: onFocus,
|
|
1648
|
-
children: (!column.rowGroup || groupColumnIndex === column.idx) && column.groupFormatter?.({
|
|
1649
|
-
groupKey,
|
|
1650
|
-
childRows,
|
|
1651
|
-
column,
|
|
1652
|
-
row,
|
|
1653
|
-
isExpanded,
|
|
1654
|
-
isCellSelected,
|
|
1655
|
-
toggleGroup
|
|
1656
|
-
})
|
|
1657
|
-
}, column.key);
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
const GroupCell$1 = /*#__PURE__*/w(GroupCell);
|
|
1661
|
-
|
|
1662
|
-
const groupRow = "gyxx7e97-0-0-beta-19";
|
|
1663
|
-
const groupRowClassname = `rdg-group-row ${groupRow}`;
|
|
1664
|
-
|
|
1665
|
-
function GroupedRow({
|
|
1666
|
-
id,
|
|
1667
|
-
groupKey,
|
|
1668
|
-
viewportColumns,
|
|
1669
|
-
childRows,
|
|
1670
|
-
rowIdx,
|
|
1671
|
-
row,
|
|
1672
|
-
gridRowStart,
|
|
1673
|
-
height,
|
|
1674
|
-
level,
|
|
1675
|
-
isExpanded,
|
|
1676
|
-
selectedCellIdx,
|
|
1677
|
-
isRowSelected,
|
|
1678
|
-
selectGroup,
|
|
1679
|
-
toggleGroup,
|
|
1680
|
-
...props
|
|
1681
|
-
}) {
|
|
1682
|
-
const idx = viewportColumns[0].key === SELECT_COLUMN_KEY ? level + 1 : level;
|
|
1683
|
-
|
|
1684
|
-
function handleSelectGroup() {
|
|
1685
|
-
selectGroup(rowIdx);
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
return /*#__PURE__*/o(RowSelectionProvider, {
|
|
1689
|
-
value: isRowSelected,
|
|
1690
|
-
children: /*#__PURE__*/o("div", {
|
|
1691
|
-
role: "row",
|
|
1692
|
-
"aria-level": level,
|
|
1693
|
-
"aria-expanded": isExpanded,
|
|
1694
|
-
className: clsx(rowClassname, groupRowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, selectedCellIdx === -1 && rowSelectedClassname),
|
|
1695
|
-
onClick: handleSelectGroup,
|
|
1696
|
-
style: getRowStyle(gridRowStart, height),
|
|
1697
|
-
...props,
|
|
1698
|
-
children: viewportColumns.map(column => /*#__PURE__*/o(GroupCell$1, {
|
|
1699
|
-
id: id,
|
|
1700
|
-
groupKey: groupKey,
|
|
1701
|
-
childRows: childRows,
|
|
1702
|
-
isExpanded: isExpanded,
|
|
1703
|
-
isCellSelected: selectedCellIdx === column.idx,
|
|
1704
|
-
column: column,
|
|
1705
|
-
row: row,
|
|
1706
|
-
groupColumnIndex: idx,
|
|
1707
|
-
toggleGroup: toggleGroup
|
|
1708
|
-
}, column.key))
|
|
1709
|
-
})
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
const GroupRowRenderer = /*#__PURE__*/w(GroupedRow);
|
|
1714
|
-
|
|
1715
|
-
const summaryCellClassname = "s1n3hxke7-0-0-beta-19";
|
|
1716
|
-
|
|
1717
|
-
function SummaryCell({
|
|
1718
|
-
column,
|
|
1719
|
-
colSpan,
|
|
1720
|
-
row,
|
|
1721
|
-
isCellSelected,
|
|
1722
|
-
selectCell
|
|
1723
|
-
}) {
|
|
1724
|
-
const {
|
|
1725
|
-
ref,
|
|
1726
|
-
tabIndex,
|
|
1727
|
-
onFocus
|
|
1728
|
-
} = useRovingCellRef(isCellSelected);
|
|
1729
|
-
const {
|
|
1730
|
-
summaryCellClass
|
|
1731
|
-
} = column;
|
|
1732
|
-
const className = getCellClassname(column, summaryCellClassname, typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass);
|
|
1733
|
-
|
|
1734
|
-
function onClick() {
|
|
1735
|
-
selectCell(row, column);
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
return /*#__PURE__*/o("div", {
|
|
1739
|
-
role: "gridcell",
|
|
1740
|
-
"aria-colindex": column.idx + 1,
|
|
1741
|
-
"aria-colspan": colSpan,
|
|
1742
|
-
"aria-selected": isCellSelected,
|
|
1743
|
-
ref: ref,
|
|
1744
1897
|
tabIndex: tabIndex,
|
|
1745
1898
|
className: className,
|
|
1746
1899
|
style: getCellStyle(column, colSpan),
|
|
1747
1900
|
onClick: onClick,
|
|
1748
1901
|
onFocus: onFocus,
|
|
1749
|
-
children: column.
|
|
1902
|
+
children: column.renderSummaryCell?.({
|
|
1750
1903
|
column,
|
|
1751
1904
|
row,
|
|
1752
|
-
|
|
1905
|
+
tabIndex: childTabIndex
|
|
1753
1906
|
})
|
|
1754
1907
|
});
|
|
1755
1908
|
}
|
|
1909
|
+
const SummaryCell$1 = /*#__PURE__*/x(SummaryCell);
|
|
1756
1910
|
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
const
|
|
1760
|
-
const
|
|
1761
|
-
const topSummaryRowBorderClassname = "t14bmecc7-0-0-beta-19";
|
|
1762
|
-
const bottomSummaryRowBorderClassname = "b1odhhml7-0-0-beta-19";
|
|
1911
|
+
const summaryRow = "snfqesz7-0-0-beta-33";
|
|
1912
|
+
const topSummaryRow = "t1jijrjz7-0-0-beta-33";
|
|
1913
|
+
const topSummaryRowBorderClassname = "t14bmecc7-0-0-beta-33";
|
|
1914
|
+
const bottomSummaryRowBorderClassname = "b1odhhml7-0-0-beta-33";
|
|
1763
1915
|
const summaryRowClassname = `rdg-summary-row ${summaryRow}`;
|
|
1764
1916
|
const topSummaryRowClassname = `rdg-top-summary-row ${topSummaryRow}`;
|
|
1765
|
-
|
|
1766
1917
|
function SummaryRow({
|
|
1767
1918
|
rowIdx,
|
|
1768
1919
|
gridRowStart,
|
|
1769
1920
|
row,
|
|
1770
1921
|
viewportColumns,
|
|
1771
|
-
top,
|
|
1772
|
-
bottom,
|
|
1773
|
-
lastFrozenColumnIndex,
|
|
1774
|
-
selectedCellIdx,
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
const cells = [];
|
|
1780
|
-
|
|
1781
|
-
for (let index = 0; index < viewportColumns.length; index++) {
|
|
1782
|
-
const column = viewportColumns[index];
|
|
1783
|
-
const colSpan = getColSpan(column, lastFrozenColumnIndex, {
|
|
1784
|
-
type: 'SUMMARY',
|
|
1785
|
-
row
|
|
1786
|
-
});
|
|
1787
|
-
|
|
1788
|
-
if (colSpan !== undefined) {
|
|
1789
|
-
index += colSpan - 1;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
const isCellSelected = selectedCellIdx === column.idx;
|
|
1793
|
-
cells.push( /*#__PURE__*/o(SummaryCell$1, {
|
|
1794
|
-
column: column,
|
|
1795
|
-
colSpan: colSpan,
|
|
1796
|
-
row: row,
|
|
1797
|
-
isCellSelected: isCellSelected,
|
|
1798
|
-
selectCell: selectCell
|
|
1799
|
-
}, column.key));
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
const isTop = lastTopRowIdx !== undefined;
|
|
1803
|
-
return /*#__PURE__*/o("div", {
|
|
1804
|
-
role: "row",
|
|
1805
|
-
"aria-rowindex": ariaRowIndex,
|
|
1806
|
-
className: clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, summaryRowClassname, isTop ? [topSummaryRowClassname, lastTopRowIdx === rowIdx && topSummaryRowBorderClassname] : ['rdg-bottom-summary-row', rowIdx === 0 && bottomSummaryRowBorderClassname], selectedCellIdx === -1 && rowSelectedClassname),
|
|
1807
|
-
style: { ...getRowStyle(gridRowStart),
|
|
1808
|
-
'--rdg-summary-row-top': top !== undefined ? `${top}px` : undefined,
|
|
1809
|
-
'--rdg-summary-row-bottom': bottom !== undefined ? `${bottom}px` : undefined
|
|
1810
|
-
},
|
|
1811
|
-
children: cells
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
const SummaryRow$1 = /*#__PURE__*/w(SummaryRow);
|
|
1816
|
-
|
|
1817
|
-
const cellEditing = "c1tngyp17-0-0-beta-19";
|
|
1818
|
-
function EditCell({
|
|
1819
|
-
column,
|
|
1820
|
-
colSpan,
|
|
1821
|
-
row,
|
|
1822
|
-
onRowChange,
|
|
1823
|
-
closeEditor
|
|
1824
|
-
}) {
|
|
1825
|
-
const frameRequestRef = _$1();
|
|
1826
|
-
const commitOnOutsideClick = column.editorOptions?.commitOnOutsideClick !== false;
|
|
1827
|
-
const commitOnOutsideMouseDown = useLatestFunc(() => {
|
|
1828
|
-
onClose(true);
|
|
1829
|
-
});
|
|
1830
|
-
h(() => {
|
|
1831
|
-
if (!commitOnOutsideClick) return;
|
|
1832
|
-
|
|
1833
|
-
function onWindowCaptureMouseDown() {
|
|
1834
|
-
frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
addEventListener('mousedown', onWindowCaptureMouseDown, {
|
|
1838
|
-
capture: true
|
|
1839
|
-
});
|
|
1840
|
-
return () => {
|
|
1841
|
-
removeEventListener('mousedown', onWindowCaptureMouseDown, {
|
|
1842
|
-
capture: true
|
|
1843
|
-
});
|
|
1844
|
-
cancelFrameRequest();
|
|
1845
|
-
};
|
|
1846
|
-
}, [commitOnOutsideClick, commitOnOutsideMouseDown]);
|
|
1847
|
-
|
|
1848
|
-
function cancelFrameRequest() {
|
|
1849
|
-
cancelAnimationFrame(frameRequestRef.current);
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
function onKeyDown(event) {
|
|
1853
|
-
if (event.key === 'Escape') {
|
|
1854
|
-
event.stopPropagation();
|
|
1855
|
-
onClose();
|
|
1856
|
-
} else if (event.key === 'Enter') {
|
|
1857
|
-
event.stopPropagation();
|
|
1858
|
-
onClose(true);
|
|
1859
|
-
} else {
|
|
1860
|
-
const onNavigation = column.editorOptions?.onNavigation ?? onEditorNavigation;
|
|
1861
|
-
|
|
1862
|
-
if (!onNavigation(event)) {
|
|
1863
|
-
event.stopPropagation();
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
function onClose(commitChanges) {
|
|
1869
|
-
if (commitChanges) {
|
|
1870
|
-
onRowChange(row, true);
|
|
1871
|
-
} else {
|
|
1872
|
-
closeEditor();
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
const {
|
|
1877
|
-
cellClass
|
|
1878
|
-
} = column;
|
|
1879
|
-
const className = getCellClassname(column, 'rdg-editor-container', typeof cellClass === 'function' ? cellClass(row) : cellClass, !column.editorOptions?.renderFormatter && cellEditing);
|
|
1880
|
-
return /*#__PURE__*/o("div", {
|
|
1881
|
-
role: "gridcell",
|
|
1882
|
-
"aria-colindex": column.idx + 1,
|
|
1883
|
-
"aria-colspan": colSpan,
|
|
1884
|
-
"aria-selected": true,
|
|
1885
|
-
className: className,
|
|
1886
|
-
style: getCellStyle(column, colSpan),
|
|
1887
|
-
onKeyDown: onKeyDown,
|
|
1888
|
-
onMouseDownCapture: commitOnOutsideClick ? cancelFrameRequest : undefined,
|
|
1889
|
-
children: column.editor != null && /*#__PURE__*/o(p$1, {
|
|
1890
|
-
children: [column.editor({
|
|
1891
|
-
column,
|
|
1892
|
-
row,
|
|
1893
|
-
onRowChange,
|
|
1894
|
-
onClose
|
|
1895
|
-
}), column.editorOptions?.renderFormatter && column.formatter({
|
|
1896
|
-
column,
|
|
1897
|
-
row,
|
|
1898
|
-
isCellSelected: true,
|
|
1899
|
-
onRowChange
|
|
1900
|
-
})]
|
|
1901
|
-
})
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
const cellDragHandle = "cadd3bp7-0-0-beta-19";
|
|
1906
|
-
const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
|
|
1907
|
-
function DragHandle({
|
|
1908
|
-
rows,
|
|
1909
|
-
columns,
|
|
1910
|
-
selectedPosition,
|
|
1911
|
-
latestDraggedOverRowIdx,
|
|
1912
|
-
isCellEditable,
|
|
1913
|
-
onRowsChange,
|
|
1914
|
-
onFill,
|
|
1915
|
-
setDragging,
|
|
1916
|
-
setDraggedOverRowIdx
|
|
1917
|
-
}) {
|
|
1918
|
-
function handleMouseDown(event) {
|
|
1919
|
-
if (event.buttons !== 1) return;
|
|
1920
|
-
setDragging(true);
|
|
1921
|
-
window.addEventListener('mouseover', onMouseOver);
|
|
1922
|
-
window.addEventListener('mouseup', onMouseUp);
|
|
1923
|
-
|
|
1924
|
-
function onMouseOver(event) {
|
|
1925
|
-
if (event.buttons !== 1) onMouseUp();
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
function onMouseUp() {
|
|
1929
|
-
window.removeEventListener('mouseover', onMouseOver);
|
|
1930
|
-
window.removeEventListener('mouseup', onMouseUp);
|
|
1931
|
-
setDragging(false);
|
|
1932
|
-
handleDragEnd();
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
function handleDragEnd() {
|
|
1937
|
-
const overRowIdx = latestDraggedOverRowIdx.current;
|
|
1938
|
-
if (overRowIdx === undefined) return;
|
|
1939
|
-
const {
|
|
1940
|
-
rowIdx
|
|
1941
|
-
} = selectedPosition;
|
|
1942
|
-
const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;
|
|
1943
|
-
const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;
|
|
1944
|
-
updateRows(startRowIndex, endRowIndex);
|
|
1945
|
-
setDraggedOverRowIdx(undefined);
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
function handleDoubleClick(event) {
|
|
1949
|
-
event.stopPropagation();
|
|
1950
|
-
updateRows(selectedPosition.rowIdx + 1, rows.length);
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
function updateRows(startRowIdx, endRowIdx) {
|
|
1954
|
-
const {
|
|
1955
|
-
idx,
|
|
1956
|
-
rowIdx
|
|
1957
|
-
} = selectedPosition;
|
|
1958
|
-
const column = columns[idx];
|
|
1959
|
-
const sourceRow = rows[rowIdx];
|
|
1960
|
-
const updatedRows = [...rows];
|
|
1961
|
-
const indexes = [];
|
|
1962
|
-
|
|
1963
|
-
for (let i = startRowIdx; i < endRowIdx; i++) {
|
|
1964
|
-
if (isCellEditable({
|
|
1965
|
-
rowIdx: i,
|
|
1966
|
-
idx
|
|
1967
|
-
})) {
|
|
1968
|
-
const updatedRow = onFill({
|
|
1969
|
-
columnKey: column.key,
|
|
1970
|
-
sourceRow,
|
|
1971
|
-
targetRow: rows[i]
|
|
1972
|
-
});
|
|
1973
|
-
|
|
1974
|
-
if (updatedRow !== rows[i]) {
|
|
1975
|
-
updatedRows[i] = updatedRow;
|
|
1976
|
-
indexes.push(i);
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
if (indexes.length > 0) {
|
|
1982
|
-
onRowsChange?.(updatedRows, {
|
|
1983
|
-
indexes,
|
|
1984
|
-
column
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
return /*#__PURE__*/o("div", {
|
|
1990
|
-
className: cellDragHandleClassname,
|
|
1991
|
-
onMouseDown: handleMouseDown,
|
|
1992
|
-
onDoubleClick: handleDoubleClick
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
const arrow = "a1mygwml7-0-0-beta-19";
|
|
1997
|
-
const arrowClassname = `rdg-sort-arrow ${arrow}`;
|
|
1998
|
-
function sortStatus({
|
|
1999
|
-
sortDirection,
|
|
2000
|
-
priority
|
|
2001
|
-
}) {
|
|
2002
|
-
return /*#__PURE__*/o(p$1, {
|
|
2003
|
-
children: [sortIcon({
|
|
2004
|
-
sortDirection
|
|
2005
|
-
}), sortPriority({
|
|
2006
|
-
priority
|
|
2007
|
-
})]
|
|
2008
|
-
});
|
|
2009
|
-
}
|
|
2010
|
-
function sortIcon({
|
|
2011
|
-
sortDirection
|
|
2012
|
-
}) {
|
|
2013
|
-
if (sortDirection === undefined) return null;
|
|
2014
|
-
return /*#__PURE__*/o("svg", {
|
|
2015
|
-
viewBox: "0 0 12 8",
|
|
2016
|
-
width: "12",
|
|
2017
|
-
height: "8",
|
|
2018
|
-
className: arrowClassname,
|
|
2019
|
-
"aria-hidden": true,
|
|
2020
|
-
children: /*#__PURE__*/o("path", {
|
|
2021
|
-
d: sortDirection === 'ASC' ? 'M0 8 6 0 12 8' : 'M0 0 6 8 12 0'
|
|
2022
|
-
})
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
function sortPriority({
|
|
2026
|
-
priority
|
|
1922
|
+
top,
|
|
1923
|
+
bottom,
|
|
1924
|
+
lastFrozenColumnIndex,
|
|
1925
|
+
selectedCellIdx,
|
|
1926
|
+
isTop,
|
|
1927
|
+
showBorder,
|
|
1928
|
+
selectCell,
|
|
1929
|
+
'aria-rowindex': ariaRowIndex
|
|
2027
1930
|
}) {
|
|
2028
|
-
|
|
1931
|
+
const cells = [];
|
|
1932
|
+
for (let index = 0; index < viewportColumns.length; index++) {
|
|
1933
|
+
const column = viewportColumns[index];
|
|
1934
|
+
const colSpan = getColSpan(column, lastFrozenColumnIndex, {
|
|
1935
|
+
type: 'SUMMARY',
|
|
1936
|
+
row
|
|
1937
|
+
});
|
|
1938
|
+
if (colSpan !== undefined) {
|
|
1939
|
+
index += colSpan - 1;
|
|
1940
|
+
}
|
|
1941
|
+
const isCellSelected = selectedCellIdx === column.idx;
|
|
1942
|
+
cells.push( /*#__PURE__*/o(SummaryCell$1, {
|
|
1943
|
+
column: column,
|
|
1944
|
+
colSpan: colSpan,
|
|
1945
|
+
row: row,
|
|
1946
|
+
rowIdx: rowIdx,
|
|
1947
|
+
isCellSelected: isCellSelected,
|
|
1948
|
+
selectCell: selectCell
|
|
1949
|
+
}, column.key));
|
|
1950
|
+
}
|
|
1951
|
+
return /*#__PURE__*/o("div", {
|
|
1952
|
+
role: "row",
|
|
1953
|
+
"aria-rowindex": ariaRowIndex,
|
|
1954
|
+
className: clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, summaryRowClassname, isTop ? [topSummaryRowClassname, showBorder && topSummaryRowBorderClassname] : ['rdg-bottom-summary-row', showBorder && bottomSummaryRowBorderClassname], selectedCellIdx === -1 && rowSelectedClassname),
|
|
1955
|
+
style: {
|
|
1956
|
+
...getRowStyle(gridRowStart),
|
|
1957
|
+
'--rdg-summary-row-top': top !== undefined ? `${top}px` : undefined,
|
|
1958
|
+
'--rdg-summary-row-bottom': bottom !== undefined ? `${bottom}px` : undefined
|
|
1959
|
+
},
|
|
1960
|
+
children: cells
|
|
1961
|
+
});
|
|
2029
1962
|
}
|
|
2030
|
-
|
|
2031
|
-
const initialPosition = {
|
|
2032
|
-
idx: -1,
|
|
2033
|
-
rowIdx: -2,
|
|
2034
|
-
mode: 'SELECT'
|
|
2035
|
-
};
|
|
1963
|
+
const SummaryRow$1 = /*#__PURE__*/x(SummaryRow);
|
|
2036
1964
|
|
|
2037
1965
|
function DataGrid(props, ref) {
|
|
2038
1966
|
const {
|
|
@@ -2054,14 +1982,15 @@
|
|
|
2054
1982
|
rowGrouper,
|
|
2055
1983
|
expandedGroupIds,
|
|
2056
1984
|
onExpandedGroupIdsChange,
|
|
2057
|
-
|
|
2058
|
-
|
|
1985
|
+
onCellClick,
|
|
1986
|
+
onCellDoubleClick,
|
|
1987
|
+
onCellContextMenu,
|
|
1988
|
+
onCellKeyDown,
|
|
2059
1989
|
onScroll,
|
|
2060
1990
|
onColumnResize,
|
|
2061
1991
|
onFill,
|
|
2062
1992
|
onCopy,
|
|
2063
1993
|
onPaste,
|
|
2064
|
-
cellNavigationMode: rawCellNavigationMode,
|
|
2065
1994
|
enableVirtualization: rawEnableVirtualization,
|
|
2066
1995
|
renderers,
|
|
2067
1996
|
className,
|
|
@@ -2073,43 +2002,51 @@
|
|
|
2073
2002
|
'aria-describedby': ariaDescribedBy,
|
|
2074
2003
|
'data-testid': testId
|
|
2075
2004
|
} = props;
|
|
2076
|
-
const
|
|
2005
|
+
const defaultRenderers = useDefaultRenderers();
|
|
2077
2006
|
const rowHeight = rawRowHeight ?? 35;
|
|
2078
2007
|
const headerRowHeight = rawHeaderRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);
|
|
2079
2008
|
const summaryRowHeight = rawSummaryRowHeight ?? (typeof rowHeight === 'number' ? rowHeight : 35);
|
|
2080
|
-
const
|
|
2081
|
-
const
|
|
2082
|
-
const
|
|
2083
|
-
const noRowsFallback = renderers?.noRowsFallback ??
|
|
2084
|
-
const cellNavigationMode = rawCellNavigationMode ?? 'NONE';
|
|
2009
|
+
const renderRow = renderers?.renderRow ?? defaultRenderers?.renderRow ?? defaultRenderRow;
|
|
2010
|
+
const renderSortStatus$1 = renderers?.renderSortStatus ?? defaultRenderers?.renderSortStatus ?? renderSortStatus;
|
|
2011
|
+
const renderCheckbox$1 = renderers?.renderCheckbox ?? defaultRenderers?.renderCheckbox ?? renderCheckbox;
|
|
2012
|
+
const noRowsFallback = renderers?.noRowsFallback ?? defaultRenderers?.noRowsFallback;
|
|
2085
2013
|
const enableVirtualization = rawEnableVirtualization ?? true;
|
|
2086
2014
|
const direction = rawDirection ?? 'ltr';
|
|
2087
|
-
const [scrollTop, setScrollTop] = p(0);
|
|
2088
|
-
const [scrollLeft, setScrollLeft] = p(0);
|
|
2089
|
-
const [columnWidths, setColumnWidths] = p(() => new Map());
|
|
2090
|
-
const [selectedPosition, setSelectedPosition] = p(initialPosition);
|
|
2091
|
-
const [copiedCell, setCopiedCell] = p(null);
|
|
2092
|
-
const [isDragging, setDragging] = p(false);
|
|
2093
|
-
const [draggedOverRowIdx, setOverRowIdx] = p(undefined);
|
|
2094
|
-
const prevSelectedPosition = _$1(selectedPosition);
|
|
2095
|
-
const latestDraggedOverRowIdx = _$1(draggedOverRowIdx);
|
|
2096
|
-
const lastSelectedRowIdx = _$1(-1);
|
|
2097
|
-
const rowRef = _$1(null);
|
|
2098
|
-
const [gridRef, gridWidth, gridHeight, isWidthInitialized] = useGridDimensions();
|
|
2099
2015
|
const headerRowsCount = 1;
|
|
2100
2016
|
const topSummaryRowsCount = topSummaryRows?.length ?? 0;
|
|
2101
2017
|
const bottomSummaryRowsCount = bottomSummaryRows?.length ?? 0;
|
|
2102
2018
|
const summaryRowsCount = topSummaryRowsCount + bottomSummaryRowsCount;
|
|
2019
|
+
const headerAndTopSummaryRowsCount = headerRowsCount + topSummaryRowsCount;
|
|
2020
|
+
const minRowIdx = -headerAndTopSummaryRowsCount;
|
|
2021
|
+
const [scrollTop, setScrollTop] = h(0);
|
|
2022
|
+
const [scrollLeft, setScrollLeft] = h(0);
|
|
2023
|
+
const [resizedColumnWidths, setResizedColumnWidths] = h(() => new Map());
|
|
2024
|
+
const [measuredColumnWidths, setMeasuredColumnWidths] = h(() => new Map());
|
|
2025
|
+
const [selectedPosition, setSelectedPosition] = h(() => ({
|
|
2026
|
+
idx: -1,
|
|
2027
|
+
rowIdx: minRowIdx - 1,
|
|
2028
|
+
mode: 'SELECT'
|
|
2029
|
+
}));
|
|
2030
|
+
const [copiedCell, setCopiedCell] = h(null);
|
|
2031
|
+
const [isDragging, setDragging] = h(false);
|
|
2032
|
+
const [draggedOverRowIdx, setOverRowIdx] = h(undefined);
|
|
2033
|
+
const [scrollToPosition, setScrollToPosition] = h(null);
|
|
2034
|
+
const prevSelectedPosition = _$1(selectedPosition);
|
|
2035
|
+
const latestDraggedOverRowIdx = _$1(draggedOverRowIdx);
|
|
2036
|
+
const lastSelectedRowIdx = _$1(-1);
|
|
2037
|
+
const rowRef = _$1(null);
|
|
2038
|
+
const shouldFocusCellRef = _$1(false);
|
|
2039
|
+
const [gridRef, gridWidth, gridHeight] = useGridDimensions();
|
|
2103
2040
|
const clientHeight = gridHeight - headerRowHeight - summaryRowsCount * summaryRowHeight;
|
|
2104
2041
|
const isSelectable = selectedRows != null && onSelectedRowsChange != null;
|
|
2105
2042
|
const isRtl = direction === 'rtl';
|
|
2106
2043
|
const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
2107
2044
|
const rightKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
2108
|
-
const defaultGridComponents = F(() => ({
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
}), [
|
|
2112
|
-
const allRowsSelected = F(() => {
|
|
2045
|
+
const defaultGridComponents = F$1(() => ({
|
|
2046
|
+
renderCheckbox: renderCheckbox$1,
|
|
2047
|
+
renderSortStatus: renderSortStatus$1
|
|
2048
|
+
}), [renderCheckbox$1, renderSortStatus$1]);
|
|
2049
|
+
const allRowsSelected = F$1(() => {
|
|
2113
2050
|
const {
|
|
2114
2051
|
length
|
|
2115
2052
|
} = rawRows;
|
|
@@ -2122,13 +2059,13 @@
|
|
|
2122
2059
|
colOverscanEndIdx,
|
|
2123
2060
|
templateColumns,
|
|
2124
2061
|
layoutCssVars,
|
|
2125
|
-
columnMetrics,
|
|
2126
2062
|
lastFrozenColumnIndex,
|
|
2127
2063
|
totalFrozenColumnWidth,
|
|
2128
2064
|
groupBy
|
|
2129
2065
|
} = useCalculatedColumns({
|
|
2130
2066
|
rawColumns,
|
|
2131
|
-
|
|
2067
|
+
measuredColumnWidths,
|
|
2068
|
+
resizedColumnWidths,
|
|
2132
2069
|
scrollLeft,
|
|
2133
2070
|
viewportWidth: gridWidth,
|
|
2134
2071
|
defaultColumnOptions,
|
|
@@ -2156,10 +2093,7 @@
|
|
|
2156
2093
|
expandedGroupIds,
|
|
2157
2094
|
enableVirtualization
|
|
2158
2095
|
});
|
|
2159
|
-
const {
|
|
2160
|
-
viewportColumns,
|
|
2161
|
-
flexWidthViewportColumns
|
|
2162
|
-
} = useViewportColumns({
|
|
2096
|
+
const viewportColumns = useViewportColumns({
|
|
2163
2097
|
columns,
|
|
2164
2098
|
colSpanColumns,
|
|
2165
2099
|
colOverscanStartIdx,
|
|
@@ -2170,30 +2104,26 @@
|
|
|
2170
2104
|
rows,
|
|
2171
2105
|
topSummaryRows,
|
|
2172
2106
|
bottomSummaryRows,
|
|
2173
|
-
columnWidths,
|
|
2174
2107
|
isGroupRow
|
|
2175
2108
|
});
|
|
2109
|
+
const {
|
|
2110
|
+
gridTemplateColumns,
|
|
2111
|
+
handleColumnResize
|
|
2112
|
+
} = useColumnWidths(columns, viewportColumns, templateColumns, gridRef, gridWidth, resizedColumnWidths, measuredColumnWidths, setResizedColumnWidths, setMeasuredColumnWidths, onColumnResize);
|
|
2176
2113
|
const hasGroups = groupBy.length > 0 && typeof rowGrouper === 'function';
|
|
2177
2114
|
const minColIdx = hasGroups ? -1 : 0;
|
|
2178
2115
|
const maxColIdx = columns.length - 1;
|
|
2179
|
-
const minRowIdx = -1 - topSummaryRowsCount;
|
|
2180
2116
|
const maxRowIdx = rows.length + bottomSummaryRowsCount - 1;
|
|
2181
2117
|
const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);
|
|
2182
2118
|
const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);
|
|
2183
2119
|
const handleColumnResizeLatest = useLatestFunc(handleColumnResize);
|
|
2184
2120
|
const onSortColumnsChangeLatest = useLatestFunc(onSortColumnsChange);
|
|
2185
|
-
const
|
|
2186
|
-
const
|
|
2121
|
+
const onCellClickLatest = useLatestFunc(onCellClick);
|
|
2122
|
+
const onCellDoubleClickLatest = useLatestFunc(onCellDoubleClick);
|
|
2123
|
+
const onCellContextMenuLatest = useLatestFunc(onCellContextMenu);
|
|
2187
2124
|
const selectRowLatest = useLatestFunc(selectRow);
|
|
2188
|
-
const selectAllRowsLatest = useLatestFunc(selectAllRows);
|
|
2189
2125
|
const handleFormatterRowChangeLatest = useLatestFunc(updateRow);
|
|
2190
|
-
const
|
|
2191
|
-
const rowIdx = rows.indexOf(row);
|
|
2192
|
-
selectCell({
|
|
2193
|
-
rowIdx,
|
|
2194
|
-
idx: column.idx
|
|
2195
|
-
}, enableEditor);
|
|
2196
|
-
});
|
|
2126
|
+
const selectCellLatest = useLatestFunc(selectCell);
|
|
2197
2127
|
const selectGroupLatest = useLatestFunc(rowIdx => {
|
|
2198
2128
|
selectCell({
|
|
2199
2129
|
rowIdx,
|
|
@@ -2206,29 +2136,13 @@
|
|
|
2206
2136
|
idx
|
|
2207
2137
|
});
|
|
2208
2138
|
});
|
|
2209
|
-
const selectTopSummaryCellLatest = useLatestFunc((summaryRow, column) => {
|
|
2210
|
-
const rowIdx = topSummaryRows.indexOf(summaryRow);
|
|
2211
|
-
selectCell({
|
|
2212
|
-
rowIdx: rowIdx + minRowIdx + 1,
|
|
2213
|
-
idx: column.idx
|
|
2214
|
-
});
|
|
2215
|
-
});
|
|
2216
|
-
const selectBottomSummaryCellLatest = useLatestFunc((summaryRow, column) => {
|
|
2217
|
-
const rowIdx = bottomSummaryRows.indexOf(summaryRow) + rows.length;
|
|
2218
|
-
selectCell({
|
|
2219
|
-
rowIdx,
|
|
2220
|
-
idx: column.idx
|
|
2221
|
-
});
|
|
2222
|
-
});
|
|
2223
2139
|
const toggleGroupLatest = useLatestFunc(toggleGroup);
|
|
2224
2140
|
useLayoutEffect(() => {
|
|
2225
2141
|
if (!selectedCellIsWithinSelectionBounds || isSamePosition(selectedPosition, prevSelectedPosition.current)) {
|
|
2226
2142
|
prevSelectedPosition.current = selectedPosition;
|
|
2227
2143
|
return;
|
|
2228
2144
|
}
|
|
2229
|
-
|
|
2230
2145
|
prevSelectedPosition.current = selectedPosition;
|
|
2231
|
-
|
|
2232
2146
|
if (selectedPosition.idx === -1) {
|
|
2233
2147
|
rowRef.current.focus({
|
|
2234
2148
|
preventScroll: true
|
|
@@ -2237,102 +2151,79 @@
|
|
|
2237
2151
|
}
|
|
2238
2152
|
});
|
|
2239
2153
|
useLayoutEffect(() => {
|
|
2240
|
-
if (!
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
width
|
|
2249
|
-
} = measuringCell.getBoundingClientRect();
|
|
2250
|
-
newColumnWidths.set(column.key, width);
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
return newColumnWidths;
|
|
2154
|
+
if (!shouldFocusCellRef.current) return;
|
|
2155
|
+
shouldFocusCellRef.current = false;
|
|
2156
|
+
const cell = getCellToScroll(gridRef.current);
|
|
2157
|
+
if (cell === null) return;
|
|
2158
|
+
scrollIntoView(cell);
|
|
2159
|
+
const elementToFocus = cell.querySelector('[tabindex="0"]') ?? cell;
|
|
2160
|
+
elementToFocus.focus({
|
|
2161
|
+
preventScroll: true
|
|
2254
2162
|
});
|
|
2255
|
-
}
|
|
2163
|
+
});
|
|
2256
2164
|
A(ref, () => ({
|
|
2257
2165
|
element: gridRef.current,
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2166
|
+
scrollToCell({
|
|
2167
|
+
idx,
|
|
2168
|
+
rowIdx
|
|
2169
|
+
}) {
|
|
2170
|
+
const scrollToIdx = idx !== undefined && idx > lastFrozenColumnIndex && idx < columns.length ? idx : undefined;
|
|
2171
|
+
const scrollToRowIdx = rowIdx !== undefined && isRowIdxWithinViewportBounds(rowIdx) ? rowIdx : undefined;
|
|
2172
|
+
if (scrollToIdx !== undefined || scrollToRowIdx !== undefined) {
|
|
2173
|
+
setScrollToPosition({
|
|
2174
|
+
idx: scrollToIdx,
|
|
2175
|
+
rowIdx: scrollToRowIdx
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2269
2178
|
},
|
|
2270
|
-
|
|
2271
2179
|
selectCell
|
|
2272
2180
|
}));
|
|
2273
2181
|
const setDraggedOverRowIdx = T$1(rowIdx => {
|
|
2274
2182
|
setOverRowIdx(rowIdx);
|
|
2275
2183
|
latestDraggedOverRowIdx.current = rowIdx;
|
|
2276
2184
|
}, []);
|
|
2277
|
-
|
|
2278
|
-
function handleColumnResize(column, width) {
|
|
2279
|
-
const {
|
|
2280
|
-
style
|
|
2281
|
-
} = gridRef.current;
|
|
2282
|
-
const newTemplateColumns = [...templateColumns];
|
|
2283
|
-
newTemplateColumns[column.idx] = width === 'max-content' ? width : `${width}px`;
|
|
2284
|
-
style.gridTemplateColumns = newTemplateColumns.join(' ');
|
|
2285
|
-
const measuringCell = gridRef.current.querySelector(`[data-measuring-cell-key="${column.key}"]`);
|
|
2286
|
-
const measuredWidth = measuringCell.getBoundingClientRect().width;
|
|
2287
|
-
const measuredWidthPx = `${measuredWidth}px`;
|
|
2288
|
-
|
|
2289
|
-
if (newTemplateColumns[column.idx] !== measuredWidthPx) {
|
|
2290
|
-
newTemplateColumns[column.idx] = measuredWidthPx;
|
|
2291
|
-
style.gridTemplateColumns = newTemplateColumns.join(' ');
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
if (columnWidths.get(column.key) === measuredWidth) return;
|
|
2295
|
-
const newColumnWidths = new Map(columnWidths);
|
|
2296
|
-
newColumnWidths.set(column.key, measuredWidth);
|
|
2297
|
-
setColumnWidths(newColumnWidths);
|
|
2298
|
-
onColumnResize?.(column.idx, measuredWidth);
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
function selectRow({
|
|
2302
|
-
row,
|
|
2303
|
-
checked,
|
|
2304
|
-
isShiftClick
|
|
2305
|
-
}) {
|
|
2185
|
+
function selectRow(args) {
|
|
2306
2186
|
if (!onSelectedRowsChange) return;
|
|
2307
2187
|
assertIsValidKeyGetter(rowKeyGetter);
|
|
2188
|
+
if (args.type === 'HEADER') {
|
|
2189
|
+
const newSelectedRows = new Set(selectedRows);
|
|
2190
|
+
for (const row of rawRows) {
|
|
2191
|
+
const rowKey = rowKeyGetter(row);
|
|
2192
|
+
if (args.checked) {
|
|
2193
|
+
newSelectedRows.add(rowKey);
|
|
2194
|
+
} else {
|
|
2195
|
+
newSelectedRows.delete(rowKey);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
onSelectedRowsChange(newSelectedRows);
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
const {
|
|
2202
|
+
row,
|
|
2203
|
+
checked,
|
|
2204
|
+
isShiftClick
|
|
2205
|
+
} = args;
|
|
2308
2206
|
const newSelectedRows = new Set(selectedRows);
|
|
2309
|
-
|
|
2310
2207
|
if (isGroupRow(row)) {
|
|
2311
2208
|
for (const childRow of row.childRows) {
|
|
2312
2209
|
const rowKey = rowKeyGetter(childRow);
|
|
2313
|
-
|
|
2314
2210
|
if (checked) {
|
|
2315
2211
|
newSelectedRows.add(rowKey);
|
|
2316
2212
|
} else {
|
|
2317
2213
|
newSelectedRows.delete(rowKey);
|
|
2318
2214
|
}
|
|
2319
2215
|
}
|
|
2320
|
-
|
|
2321
2216
|
onSelectedRowsChange(newSelectedRows);
|
|
2322
2217
|
return;
|
|
2323
2218
|
}
|
|
2324
|
-
|
|
2325
2219
|
const rowKey = rowKeyGetter(row);
|
|
2326
|
-
|
|
2327
2220
|
if (checked) {
|
|
2328
2221
|
newSelectedRows.add(rowKey);
|
|
2329
2222
|
const previousRowIdx = lastSelectedRowIdx.current;
|
|
2330
2223
|
const rowIdx = rows.indexOf(row);
|
|
2331
2224
|
lastSelectedRowIdx.current = rowIdx;
|
|
2332
|
-
|
|
2333
2225
|
if (isShiftClick && previousRowIdx !== -1 && previousRowIdx !== rowIdx) {
|
|
2334
2226
|
const step = sign(rowIdx - previousRowIdx);
|
|
2335
|
-
|
|
2336
2227
|
for (let i = previousRowIdx + step; i !== rowIdx; i += step) {
|
|
2337
2228
|
const row = rows[i];
|
|
2338
2229
|
if (isGroupRow(row)) continue;
|
|
@@ -2343,42 +2234,37 @@
|
|
|
2343
2234
|
newSelectedRows.delete(rowKey);
|
|
2344
2235
|
lastSelectedRowIdx.current = -1;
|
|
2345
2236
|
}
|
|
2346
|
-
|
|
2347
|
-
onSelectedRowsChange(newSelectedRows);
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
function selectAllRows(checked) {
|
|
2351
|
-
if (!onSelectedRowsChange) return;
|
|
2352
|
-
assertIsValidKeyGetter(rowKeyGetter);
|
|
2353
|
-
const newSelectedRows = new Set(selectedRows);
|
|
2354
|
-
|
|
2355
|
-
for (const row of rawRows) {
|
|
2356
|
-
const rowKey = rowKeyGetter(row);
|
|
2357
|
-
|
|
2358
|
-
if (checked) {
|
|
2359
|
-
newSelectedRows.add(rowKey);
|
|
2360
|
-
} else {
|
|
2361
|
-
newSelectedRows.delete(rowKey);
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
2237
|
onSelectedRowsChange(newSelectedRows);
|
|
2366
2238
|
}
|
|
2367
|
-
|
|
2368
2239
|
function toggleGroup(expandedGroupId) {
|
|
2369
2240
|
if (!onExpandedGroupIdsChange) return;
|
|
2370
2241
|
const newExpandedGroupIds = new Set(expandedGroupIds);
|
|
2371
|
-
|
|
2372
2242
|
if (newExpandedGroupIds.has(expandedGroupId)) {
|
|
2373
2243
|
newExpandedGroupIds.delete(expandedGroupId);
|
|
2374
2244
|
} else {
|
|
2375
2245
|
newExpandedGroupIds.add(expandedGroupId);
|
|
2376
2246
|
}
|
|
2377
|
-
|
|
2378
2247
|
onExpandedGroupIdsChange(newExpandedGroupIds);
|
|
2379
2248
|
}
|
|
2380
|
-
|
|
2381
2249
|
function handleKeyDown(event) {
|
|
2250
|
+
const {
|
|
2251
|
+
idx,
|
|
2252
|
+
rowIdx,
|
|
2253
|
+
mode
|
|
2254
|
+
} = selectedPosition;
|
|
2255
|
+
if (mode === 'EDIT') return;
|
|
2256
|
+
const row = rows[rowIdx];
|
|
2257
|
+
if (!isGroupRow(row) && onCellKeyDown) {
|
|
2258
|
+
const cellEvent = createCellEvent(event);
|
|
2259
|
+
onCellKeyDown({
|
|
2260
|
+
mode: 'SELECT',
|
|
2261
|
+
row,
|
|
2262
|
+
column: columns[idx],
|
|
2263
|
+
rowIdx,
|
|
2264
|
+
selectCell
|
|
2265
|
+
}, cellEvent);
|
|
2266
|
+
if (cellEvent.isGridDefaultPrevented()) return;
|
|
2267
|
+
}
|
|
2382
2268
|
if (!(event.target instanceof Element)) return;
|
|
2383
2269
|
const isCellEvent = event.target.closest('.rdg-cell') !== null;
|
|
2384
2270
|
const isRowEvent = hasGroups && event.target === rowRef.current;
|
|
@@ -2387,40 +2273,27 @@
|
|
|
2387
2273
|
key,
|
|
2388
2274
|
keyCode
|
|
2389
2275
|
} = event;
|
|
2390
|
-
|
|
2391
|
-
rowIdx
|
|
2392
|
-
} = selectedPosition;
|
|
2393
|
-
|
|
2394
|
-
if (selectedCellIsWithinViewportBounds && (onPaste != null || onCopy != null) && isCtrlKeyHeldDown(event) && !isGroupRow(rows[rowIdx]) && selectedPosition.mode === 'SELECT') {
|
|
2276
|
+
if (selectedCellIsWithinViewportBounds && (onPaste != null || onCopy != null) && isCtrlKeyHeldDown(event) && !isGroupRow(rows[rowIdx])) {
|
|
2395
2277
|
const cKey = 67;
|
|
2396
2278
|
const vKey = 86;
|
|
2397
|
-
|
|
2398
2279
|
if (keyCode === cKey) {
|
|
2399
2280
|
handleCopy();
|
|
2400
2281
|
return;
|
|
2401
2282
|
}
|
|
2402
|
-
|
|
2403
2283
|
if (keyCode === vKey) {
|
|
2404
2284
|
handlePaste();
|
|
2405
2285
|
return;
|
|
2406
2286
|
}
|
|
2407
2287
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
if (isGroupRow(row) && selectedPosition.idx === -1 && (key === leftKey && row.isExpanded || key === rightKey && !row.isExpanded)) {
|
|
2413
|
-
event.preventDefault();
|
|
2414
|
-
toggleGroup(row.id);
|
|
2415
|
-
return;
|
|
2416
|
-
}
|
|
2288
|
+
if (isRowIdxWithinViewportBounds(rowIdx) && isGroupRow(row) && selectedPosition.idx === -1 && (key === leftKey && row.isExpanded || key === rightKey && !row.isExpanded)) {
|
|
2289
|
+
event.preventDefault();
|
|
2290
|
+
toggleGroup(row.id);
|
|
2291
|
+
return;
|
|
2417
2292
|
}
|
|
2418
|
-
|
|
2419
2293
|
switch (event.key) {
|
|
2420
2294
|
case 'Escape':
|
|
2421
2295
|
setCopiedCell(null);
|
|
2422
2296
|
return;
|
|
2423
|
-
|
|
2424
2297
|
case 'ArrowUp':
|
|
2425
2298
|
case 'ArrowDown':
|
|
2426
2299
|
case 'ArrowLeft':
|
|
@@ -2432,29 +2305,25 @@
|
|
|
2432
2305
|
case 'PageDown':
|
|
2433
2306
|
navigate(event);
|
|
2434
2307
|
break;
|
|
2435
|
-
|
|
2436
2308
|
default:
|
|
2437
2309
|
handleCellInput(event);
|
|
2438
2310
|
break;
|
|
2439
2311
|
}
|
|
2440
2312
|
}
|
|
2441
|
-
|
|
2442
2313
|
function handleScroll(event) {
|
|
2443
2314
|
const {
|
|
2444
2315
|
scrollTop,
|
|
2445
2316
|
scrollLeft
|
|
2446
2317
|
} = event.currentTarget;
|
|
2447
|
-
|
|
2318
|
+
pn(() => {
|
|
2448
2319
|
setScrollTop(scrollTop);
|
|
2449
2320
|
setScrollLeft(abs(scrollLeft));
|
|
2450
2321
|
});
|
|
2451
2322
|
onScroll?.(event);
|
|
2452
2323
|
}
|
|
2453
|
-
|
|
2454
2324
|
function getRawRowIdx(rowIdx) {
|
|
2455
2325
|
return hasGroups ? rawRows.indexOf(rows[rowIdx]) : rowIdx;
|
|
2456
2326
|
}
|
|
2457
|
-
|
|
2458
2327
|
function updateRow(column, rowIdx, row) {
|
|
2459
2328
|
if (typeof onRowsChange !== 'function') return;
|
|
2460
2329
|
const rawRowIdx = getRawRowIdx(rowIdx);
|
|
@@ -2466,12 +2335,10 @@
|
|
|
2466
2335
|
column
|
|
2467
2336
|
});
|
|
2468
2337
|
}
|
|
2469
|
-
|
|
2470
2338
|
function commitEditorChanges() {
|
|
2471
2339
|
if (selectedPosition.mode !== 'EDIT') return;
|
|
2472
2340
|
updateRow(columns[selectedPosition.idx], selectedPosition.rowIdx, selectedPosition.row);
|
|
2473
2341
|
}
|
|
2474
|
-
|
|
2475
2342
|
function handleCopy() {
|
|
2476
2343
|
const {
|
|
2477
2344
|
idx,
|
|
@@ -2488,12 +2355,10 @@
|
|
|
2488
2355
|
sourceColumnKey
|
|
2489
2356
|
});
|
|
2490
2357
|
}
|
|
2491
|
-
|
|
2492
2358
|
function handlePaste() {
|
|
2493
2359
|
if (!onPaste || !onRowsChange || copiedCell === null || !isCellEditable(selectedPosition)) {
|
|
2494
2360
|
return;
|
|
2495
2361
|
}
|
|
2496
|
-
|
|
2497
2362
|
const {
|
|
2498
2363
|
idx,
|
|
2499
2364
|
rowIdx
|
|
@@ -2508,7 +2373,6 @@
|
|
|
2508
2373
|
});
|
|
2509
2374
|
updateRow(targetColumn, rowIdx, updatedTargetRow);
|
|
2510
2375
|
}
|
|
2511
|
-
|
|
2512
2376
|
function handleCellInput(event) {
|
|
2513
2377
|
if (!selectedCellIsWithinViewportBounds) return;
|
|
2514
2378
|
const row = rows[selectedPosition.rowIdx];
|
|
@@ -2517,11 +2381,11 @@
|
|
|
2517
2381
|
key,
|
|
2518
2382
|
shiftKey
|
|
2519
2383
|
} = event;
|
|
2520
|
-
|
|
2521
2384
|
if (isSelectable && shiftKey && key === ' ') {
|
|
2522
2385
|
assertIsValidKeyGetter(rowKeyGetter);
|
|
2523
2386
|
const rowKey = rowKeyGetter(row);
|
|
2524
2387
|
selectRow({
|
|
2388
|
+
type: 'ROW',
|
|
2525
2389
|
row,
|
|
2526
2390
|
checked: !selectedRows.has(rowKey),
|
|
2527
2391
|
isShiftClick: false
|
|
@@ -2529,11 +2393,6 @@
|
|
|
2529
2393
|
event.preventDefault();
|
|
2530
2394
|
return;
|
|
2531
2395
|
}
|
|
2532
|
-
|
|
2533
|
-
const column = columns[selectedPosition.idx];
|
|
2534
|
-
column.editorOptions?.onCellKeyDown?.(event);
|
|
2535
|
-
if (event.isDefaultPrevented()) return;
|
|
2536
|
-
|
|
2537
2396
|
if (isCellEditable(selectedPosition) && isDefaultCellInput(event)) {
|
|
2538
2397
|
setSelectedPosition(({
|
|
2539
2398
|
idx,
|
|
@@ -2547,29 +2406,24 @@
|
|
|
2547
2406
|
}));
|
|
2548
2407
|
}
|
|
2549
2408
|
}
|
|
2550
|
-
|
|
2551
2409
|
function isColIdxWithinSelectionBounds(idx) {
|
|
2552
2410
|
return idx >= minColIdx && idx <= maxColIdx;
|
|
2553
2411
|
}
|
|
2554
|
-
|
|
2555
2412
|
function isRowIdxWithinViewportBounds(rowIdx) {
|
|
2556
2413
|
return rowIdx >= 0 && rowIdx < rows.length;
|
|
2557
2414
|
}
|
|
2558
|
-
|
|
2559
2415
|
function isCellWithinSelectionBounds({
|
|
2560
2416
|
idx,
|
|
2561
2417
|
rowIdx
|
|
2562
2418
|
}) {
|
|
2563
2419
|
return rowIdx >= minRowIdx && rowIdx <= maxRowIdx && isColIdxWithinSelectionBounds(idx);
|
|
2564
2420
|
}
|
|
2565
|
-
|
|
2566
2421
|
function isCellWithinViewportBounds({
|
|
2567
2422
|
idx,
|
|
2568
2423
|
rowIdx
|
|
2569
2424
|
}) {
|
|
2570
2425
|
return isRowIdxWithinViewportBounds(rowIdx) && isColIdxWithinSelectionBounds(idx);
|
|
2571
2426
|
}
|
|
2572
|
-
|
|
2573
2427
|
function isCellEditable(position) {
|
|
2574
2428
|
return isCellWithinViewportBounds(position) && isSelectedCellEditable({
|
|
2575
2429
|
columns,
|
|
@@ -2578,80 +2432,27 @@
|
|
|
2578
2432
|
isGroupRow
|
|
2579
2433
|
});
|
|
2580
2434
|
}
|
|
2581
|
-
|
|
2582
2435
|
function selectCell(position, enableEditor) {
|
|
2583
2436
|
if (!isCellWithinSelectionBounds(position)) return;
|
|
2584
2437
|
commitEditorChanges();
|
|
2585
|
-
|
|
2586
2438
|
if (enableEditor && isCellEditable(position)) {
|
|
2587
2439
|
const row = rows[position.rowIdx];
|
|
2588
|
-
setSelectedPosition({
|
|
2440
|
+
setSelectedPosition({
|
|
2441
|
+
...position,
|
|
2589
2442
|
mode: 'EDIT',
|
|
2590
2443
|
row,
|
|
2591
2444
|
originalRow: row
|
|
2592
2445
|
});
|
|
2593
2446
|
} else if (isSamePosition(selectedPosition, position)) {
|
|
2594
|
-
scrollIntoView(gridRef.current
|
|
2447
|
+
scrollIntoView(getCellToScroll(gridRef.current));
|
|
2595
2448
|
} else {
|
|
2596
|
-
|
|
2449
|
+
shouldFocusCellRef.current = true;
|
|
2450
|
+
setSelectedPosition({
|
|
2451
|
+
...position,
|
|
2597
2452
|
mode: 'SELECT'
|
|
2598
2453
|
});
|
|
2599
2454
|
}
|
|
2600
2455
|
}
|
|
2601
|
-
|
|
2602
|
-
function scrollToColumn(idx) {
|
|
2603
|
-
const {
|
|
2604
|
-
current
|
|
2605
|
-
} = gridRef;
|
|
2606
|
-
if (!current) return;
|
|
2607
|
-
|
|
2608
|
-
if (idx > lastFrozenColumnIndex) {
|
|
2609
|
-
const {
|
|
2610
|
-
rowIdx
|
|
2611
|
-
} = selectedPosition;
|
|
2612
|
-
if (!isCellWithinSelectionBounds({
|
|
2613
|
-
rowIdx,
|
|
2614
|
-
idx
|
|
2615
|
-
})) return;
|
|
2616
|
-
const {
|
|
2617
|
-
clientWidth
|
|
2618
|
-
} = current;
|
|
2619
|
-
const column = columns[idx];
|
|
2620
|
-
const {
|
|
2621
|
-
left,
|
|
2622
|
-
width
|
|
2623
|
-
} = columnMetrics.get(column);
|
|
2624
|
-
let right = left + width;
|
|
2625
|
-
const colSpan = getSelectedCellColSpan({
|
|
2626
|
-
rows,
|
|
2627
|
-
topSummaryRows,
|
|
2628
|
-
bottomSummaryRows,
|
|
2629
|
-
rowIdx,
|
|
2630
|
-
lastFrozenColumnIndex,
|
|
2631
|
-
column,
|
|
2632
|
-
isGroupRow
|
|
2633
|
-
});
|
|
2634
|
-
|
|
2635
|
-
if (colSpan !== undefined) {
|
|
2636
|
-
const {
|
|
2637
|
-
left,
|
|
2638
|
-
width
|
|
2639
|
-
} = columnMetrics.get(columns[column.idx + colSpan - 1]);
|
|
2640
|
-
right = left + width;
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
|
-
const isCellAtLeftBoundary = left < scrollLeft + totalFrozenColumnWidth;
|
|
2644
|
-
const isCellAtRightBoundary = right > clientWidth + scrollLeft;
|
|
2645
|
-
const sign = isRtl ? -1 : 1;
|
|
2646
|
-
|
|
2647
|
-
if (isCellAtLeftBoundary) {
|
|
2648
|
-
current.scrollLeft = (left - totalFrozenColumnWidth) * sign;
|
|
2649
|
-
} else if (isCellAtRightBoundary) {
|
|
2650
|
-
current.scrollLeft = (right - clientWidth) * sign;
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
2456
|
function getNextPosition(key, ctrlKey, shiftKey) {
|
|
2656
2457
|
const {
|
|
2657
2458
|
idx,
|
|
@@ -2659,19 +2460,15 @@
|
|
|
2659
2460
|
} = selectedPosition;
|
|
2660
2461
|
const row = rows[rowIdx];
|
|
2661
2462
|
const isRowSelected = selectedCellIsWithinSelectionBounds && idx === -1;
|
|
2662
|
-
|
|
2663
2463
|
if (key === leftKey && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) {
|
|
2664
2464
|
let parentRowIdx = -1;
|
|
2665
|
-
|
|
2666
2465
|
for (let i = selectedPosition.rowIdx - 1; i >= 0; i--) {
|
|
2667
2466
|
const parentRow = rows[i];
|
|
2668
|
-
|
|
2669
2467
|
if (isGroupRow(parentRow) && parentRow.id === row.parentId) {
|
|
2670
2468
|
parentRowIdx = i;
|
|
2671
2469
|
break;
|
|
2672
2470
|
}
|
|
2673
2471
|
}
|
|
2674
|
-
|
|
2675
2472
|
if (parentRowIdx !== -1) {
|
|
2676
2473
|
return {
|
|
2677
2474
|
idx,
|
|
@@ -2679,38 +2476,32 @@
|
|
|
2679
2476
|
};
|
|
2680
2477
|
}
|
|
2681
2478
|
}
|
|
2682
|
-
|
|
2683
2479
|
switch (key) {
|
|
2684
2480
|
case 'ArrowUp':
|
|
2685
2481
|
return {
|
|
2686
2482
|
idx,
|
|
2687
2483
|
rowIdx: rowIdx - 1
|
|
2688
2484
|
};
|
|
2689
|
-
|
|
2690
2485
|
case 'ArrowDown':
|
|
2691
2486
|
return {
|
|
2692
2487
|
idx,
|
|
2693
2488
|
rowIdx: rowIdx + 1
|
|
2694
2489
|
};
|
|
2695
|
-
|
|
2696
2490
|
case leftKey:
|
|
2697
2491
|
return {
|
|
2698
2492
|
idx: idx - 1,
|
|
2699
2493
|
rowIdx
|
|
2700
2494
|
};
|
|
2701
|
-
|
|
2702
2495
|
case rightKey:
|
|
2703
2496
|
return {
|
|
2704
2497
|
idx: idx + 1,
|
|
2705
2498
|
rowIdx
|
|
2706
2499
|
};
|
|
2707
|
-
|
|
2708
2500
|
case 'Tab':
|
|
2709
2501
|
return {
|
|
2710
2502
|
idx: idx + (shiftKey ? -1 : 1),
|
|
2711
2503
|
rowIdx
|
|
2712
2504
|
};
|
|
2713
|
-
|
|
2714
2505
|
case 'Home':
|
|
2715
2506
|
if (isRowSelected) return {
|
|
2716
2507
|
idx,
|
|
@@ -2720,7 +2511,6 @@
|
|
|
2720
2511
|
idx: 0,
|
|
2721
2512
|
rowIdx: ctrlKey ? minRowIdx : rowIdx
|
|
2722
2513
|
};
|
|
2723
|
-
|
|
2724
2514
|
case 'End':
|
|
2725
2515
|
if (isRowSelected) return {
|
|
2726
2516
|
idx,
|
|
@@ -2730,7 +2520,6 @@
|
|
|
2730
2520
|
idx: maxColIdx,
|
|
2731
2521
|
rowIdx: ctrlKey ? maxRowIdx : rowIdx
|
|
2732
2522
|
};
|
|
2733
|
-
|
|
2734
2523
|
case 'PageUp':
|
|
2735
2524
|
{
|
|
2736
2525
|
if (selectedPosition.rowIdx === minRowIdx) return selectedPosition;
|
|
@@ -2740,7 +2529,6 @@
|
|
|
2740
2529
|
rowIdx: nextRowY > 0 ? findRowIdx(nextRowY) : 0
|
|
2741
2530
|
};
|
|
2742
2531
|
}
|
|
2743
|
-
|
|
2744
2532
|
case 'PageDown':
|
|
2745
2533
|
{
|
|
2746
2534
|
if (selectedPosition.rowIdx >= rows.length) return selectedPosition;
|
|
@@ -2750,23 +2538,19 @@
|
|
|
2750
2538
|
rowIdx: nextRowY < totalRowHeight ? findRowIdx(nextRowY) : rows.length - 1
|
|
2751
2539
|
};
|
|
2752
2540
|
}
|
|
2753
|
-
|
|
2754
2541
|
default:
|
|
2755
2542
|
return selectedPosition;
|
|
2756
2543
|
}
|
|
2757
2544
|
}
|
|
2758
|
-
|
|
2759
2545
|
function navigate(event) {
|
|
2760
2546
|
const {
|
|
2761
2547
|
key,
|
|
2762
2548
|
shiftKey
|
|
2763
2549
|
} = event;
|
|
2764
|
-
let
|
|
2765
|
-
|
|
2550
|
+
let cellNavigationMode = 'NONE';
|
|
2766
2551
|
if (key === 'Tab') {
|
|
2767
2552
|
if (canExitGrid({
|
|
2768
2553
|
shiftKey,
|
|
2769
|
-
cellNavigationMode,
|
|
2770
2554
|
maxColIdx,
|
|
2771
2555
|
minRowIdx,
|
|
2772
2556
|
maxRowIdx,
|
|
@@ -2775,10 +2559,8 @@
|
|
|
2775
2559
|
commitEditorChanges();
|
|
2776
2560
|
return;
|
|
2777
2561
|
}
|
|
2778
|
-
|
|
2779
|
-
mode = cellNavigationMode === 'NONE' ? 'CHANGE_ROW' : cellNavigationMode;
|
|
2562
|
+
cellNavigationMode = 'CHANGE_ROW';
|
|
2780
2563
|
}
|
|
2781
|
-
|
|
2782
2564
|
event.preventDefault();
|
|
2783
2565
|
const ctrlKey = isCtrlKeyHeldDown(event);
|
|
2784
2566
|
const nextPosition = getNextPosition(key, ctrlKey, shiftKey);
|
|
@@ -2792,7 +2574,7 @@
|
|
|
2792
2574
|
minRowIdx,
|
|
2793
2575
|
maxRowIdx,
|
|
2794
2576
|
lastFrozenColumnIndex,
|
|
2795
|
-
cellNavigationMode
|
|
2577
|
+
cellNavigationMode,
|
|
2796
2578
|
currentPosition: selectedPosition,
|
|
2797
2579
|
nextPosition,
|
|
2798
2580
|
isCellWithinBounds: isCellWithinSelectionBounds,
|
|
@@ -2800,7 +2582,6 @@
|
|
|
2800
2582
|
});
|
|
2801
2583
|
selectCell(nextSelectedCellPosition);
|
|
2802
2584
|
}
|
|
2803
|
-
|
|
2804
2585
|
function getDraggedOverCellIdx(currentRowIdx) {
|
|
2805
2586
|
if (draggedOverRowIdx === undefined) return;
|
|
2806
2587
|
const {
|
|
@@ -2809,25 +2590,10 @@
|
|
|
2809
2590
|
const isDraggedOver = rowIdx < draggedOverRowIdx ? rowIdx < currentRowIdx && currentRowIdx <= draggedOverRowIdx : rowIdx > currentRowIdx && currentRowIdx >= draggedOverRowIdx;
|
|
2810
2591
|
return isDraggedOver ? selectedPosition.idx : undefined;
|
|
2811
2592
|
}
|
|
2812
|
-
|
|
2813
|
-
function getLayoutCssVars() {
|
|
2814
|
-
if (flexWidthViewportColumns.length === 0) return layoutCssVars;
|
|
2815
|
-
const newTemplateColumns = [...templateColumns];
|
|
2816
|
-
|
|
2817
|
-
for (const column of flexWidthViewportColumns) {
|
|
2818
|
-
newTemplateColumns[column.idx] = column.width;
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
return { ...layoutCssVars,
|
|
2822
|
-
gridTemplateColumns: newTemplateColumns.join(' ')
|
|
2823
|
-
};
|
|
2824
|
-
}
|
|
2825
|
-
|
|
2826
2593
|
function getDragHandle(rowIdx) {
|
|
2827
2594
|
if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'EDIT' || hasGroups || onFill == null) {
|
|
2828
2595
|
return;
|
|
2829
2596
|
}
|
|
2830
|
-
|
|
2831
2597
|
return /*#__PURE__*/o(DragHandle, {
|
|
2832
2598
|
rows: rawRows,
|
|
2833
2599
|
columns: columns,
|
|
@@ -2840,7 +2606,6 @@
|
|
|
2840
2606
|
setDraggedOverRowIdx: setDraggedOverRowIdx
|
|
2841
2607
|
});
|
|
2842
2608
|
}
|
|
2843
|
-
|
|
2844
2609
|
function getCellEditor(rowIdx) {
|
|
2845
2610
|
if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'SELECT') return;
|
|
2846
2611
|
const {
|
|
@@ -2852,8 +2617,8 @@
|
|
|
2852
2617
|
type: 'ROW',
|
|
2853
2618
|
row
|
|
2854
2619
|
});
|
|
2855
|
-
|
|
2856
|
-
|
|
2620
|
+
const closeEditor = shouldFocusCell => {
|
|
2621
|
+
shouldFocusCellRef.current = shouldFocusCell;
|
|
2857
2622
|
setSelectedPosition(({
|
|
2858
2623
|
idx,
|
|
2859
2624
|
rowIdx
|
|
@@ -2863,41 +2628,40 @@
|
|
|
2863
2628
|
mode: 'SELECT'
|
|
2864
2629
|
}));
|
|
2865
2630
|
};
|
|
2866
|
-
|
|
2867
|
-
const onRowChange = (row, commitChanges) => {
|
|
2631
|
+
const onRowChange = (row, commitChanges, shouldFocusCell) => {
|
|
2868
2632
|
if (commitChanges) {
|
|
2869
|
-
|
|
2870
|
-
|
|
2633
|
+
pn(() => {
|
|
2634
|
+
updateRow(column, selectedPosition.rowIdx, row);
|
|
2635
|
+
closeEditor(shouldFocusCell);
|
|
2636
|
+
});
|
|
2871
2637
|
} else {
|
|
2872
|
-
setSelectedPosition(position => ({
|
|
2638
|
+
setSelectedPosition(position => ({
|
|
2639
|
+
...position,
|
|
2873
2640
|
row
|
|
2874
2641
|
}));
|
|
2875
2642
|
}
|
|
2876
2643
|
};
|
|
2877
|
-
|
|
2878
2644
|
if (rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) {
|
|
2879
|
-
closeEditor();
|
|
2645
|
+
closeEditor(false);
|
|
2880
2646
|
}
|
|
2881
|
-
|
|
2882
2647
|
return /*#__PURE__*/o(EditCell, {
|
|
2883
2648
|
column: column,
|
|
2884
2649
|
colSpan: colSpan,
|
|
2885
2650
|
row: row,
|
|
2651
|
+
rowIdx: rowIdx,
|
|
2886
2652
|
onRowChange: onRowChange,
|
|
2887
|
-
closeEditor: closeEditor
|
|
2653
|
+
closeEditor: closeEditor,
|
|
2654
|
+
onKeyDown: onCellKeyDown,
|
|
2655
|
+
navigate: navigate
|
|
2888
2656
|
}, column.key);
|
|
2889
2657
|
}
|
|
2890
|
-
|
|
2891
2658
|
function getRowViewportColumns(rowIdx) {
|
|
2892
2659
|
const selectedColumn = columns[selectedPosition.idx];
|
|
2893
|
-
|
|
2894
2660
|
if (selectedColumn !== undefined && selectedPosition.rowIdx === rowIdx && !viewportColumns.includes(selectedColumn)) {
|
|
2895
2661
|
return selectedPosition.idx > colOverscanEndIdx ? [...viewportColumns, selectedColumn] : [...viewportColumns.slice(0, lastFrozenColumnIndex + 1), selectedColumn, ...viewportColumns.slice(lastFrozenColumnIndex + 1)];
|
|
2896
2662
|
}
|
|
2897
|
-
|
|
2898
2663
|
return viewportColumns;
|
|
2899
2664
|
}
|
|
2900
|
-
|
|
2901
2665
|
function getViewportRows() {
|
|
2902
2666
|
const rowElements = [];
|
|
2903
2667
|
let startRowIndex = 0;
|
|
@@ -2907,13 +2671,11 @@
|
|
|
2907
2671
|
} = selectedPosition;
|
|
2908
2672
|
const startRowIdx = selectedCellIsWithinViewportBounds && selectedRowIdx < rowOverscanStartIdx ? rowOverscanStartIdx - 1 : rowOverscanStartIdx;
|
|
2909
2673
|
const endRowIdx = selectedCellIsWithinViewportBounds && selectedRowIdx > rowOverscanEndIdx ? rowOverscanEndIdx + 1 : rowOverscanEndIdx;
|
|
2910
|
-
|
|
2911
2674
|
for (let viewportRowIdx = startRowIdx; viewportRowIdx <= endRowIdx; viewportRowIdx++) {
|
|
2912
2675
|
const isRowOutsideViewport = viewportRowIdx === rowOverscanStartIdx - 1 || viewportRowIdx === rowOverscanEndIdx + 1;
|
|
2913
2676
|
const rowIdx = isRowOutsideViewport ? selectedRowIdx : viewportRowIdx;
|
|
2914
2677
|
let rowColumns = viewportColumns;
|
|
2915
2678
|
const selectedColumn = columns[selectedIdx];
|
|
2916
|
-
|
|
2917
2679
|
if (selectedColumn !== undefined) {
|
|
2918
2680
|
if (isRowOutsideViewport) {
|
|
2919
2681
|
rowColumns = [selectedColumn];
|
|
@@ -2921,20 +2683,22 @@
|
|
|
2921
2683
|
rowColumns = getRowViewportColumns(rowIdx);
|
|
2922
2684
|
}
|
|
2923
2685
|
}
|
|
2924
|
-
|
|
2925
2686
|
const row = rows[rowIdx];
|
|
2926
|
-
const gridRowStart =
|
|
2927
|
-
|
|
2687
|
+
const gridRowStart = headerAndTopSummaryRowsCount + rowIdx + 1;
|
|
2928
2688
|
if (isGroupRow(row)) {
|
|
2929
2689
|
({
|
|
2930
2690
|
startRowIndex
|
|
2931
2691
|
} = row);
|
|
2932
|
-
|
|
2692
|
+
let isGroupRowSelected = false;
|
|
2693
|
+
if (isSelectable) {
|
|
2694
|
+
assertIsValidKeyGetter(rowKeyGetter);
|
|
2695
|
+
isGroupRowSelected = row.childRows.every(cr => selectedRows.has(rowKeyGetter(cr)));
|
|
2696
|
+
}
|
|
2933
2697
|
rowElements.push( /*#__PURE__*/o(GroupRowRenderer, {
|
|
2934
2698
|
"aria-level": row.level + 1,
|
|
2935
2699
|
"aria-setsize": row.setSize,
|
|
2936
2700
|
"aria-posinset": row.posInSet + 1,
|
|
2937
|
-
"aria-rowindex":
|
|
2701
|
+
"aria-rowindex": headerAndTopSummaryRowsCount + startRowIndex + 1,
|
|
2938
2702
|
"aria-selected": isSelectable ? isGroupRowSelected : undefined,
|
|
2939
2703
|
id: row.id,
|
|
2940
2704
|
groupKey: row.groupKey,
|
|
@@ -2953,27 +2717,25 @@
|
|
|
2953
2717
|
}, row.id));
|
|
2954
2718
|
continue;
|
|
2955
2719
|
}
|
|
2956
|
-
|
|
2957
2720
|
startRowIndex++;
|
|
2958
2721
|
let key;
|
|
2959
2722
|
let isRowSelected = false;
|
|
2960
|
-
|
|
2961
2723
|
if (typeof rowKeyGetter === 'function') {
|
|
2962
2724
|
key = rowKeyGetter(row);
|
|
2963
2725
|
isRowSelected = selectedRows?.has(key) ?? false;
|
|
2964
2726
|
} else {
|
|
2965
2727
|
key = hasGroups ? startRowIndex : rowIdx;
|
|
2966
2728
|
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
'aria-rowindex': headerRowsCount + topSummaryRowsCount + (hasGroups ? startRowIndex : rowIdx) + 1,
|
|
2729
|
+
rowElements.push(renderRow(key, {
|
|
2730
|
+
'aria-rowindex': headerAndTopSummaryRowsCount + (hasGroups ? startRowIndex : rowIdx) + 1,
|
|
2970
2731
|
'aria-selected': isSelectable ? isRowSelected : undefined,
|
|
2971
2732
|
rowIdx,
|
|
2972
2733
|
row,
|
|
2973
2734
|
viewportColumns: rowColumns,
|
|
2974
2735
|
isRowSelected,
|
|
2975
|
-
|
|
2976
|
-
|
|
2736
|
+
onCellClick: onCellClickLatest,
|
|
2737
|
+
onCellDoubleClick: onCellDoubleClickLatest,
|
|
2738
|
+
onCellContextMenu: onCellContextMenuLatest,
|
|
2977
2739
|
rowClass,
|
|
2978
2740
|
gridRowStart,
|
|
2979
2741
|
height: getRowHeight(rowIdx),
|
|
@@ -2983,35 +2745,32 @@
|
|
|
2983
2745
|
setDraggedOverRowIdx: isDragging ? setDraggedOverRowIdx : undefined,
|
|
2984
2746
|
lastFrozenColumnIndex,
|
|
2985
2747
|
onRowChange: handleFormatterRowChangeLatest,
|
|
2986
|
-
selectCell:
|
|
2748
|
+
selectCell: selectCellLatest,
|
|
2987
2749
|
selectedCellDragHandle: getDragHandle(rowIdx),
|
|
2988
2750
|
selectedCellEditor: getCellEditor(rowIdx)
|
|
2989
2751
|
}));
|
|
2990
2752
|
}
|
|
2991
|
-
|
|
2992
2753
|
return rowElements;
|
|
2993
2754
|
}
|
|
2994
|
-
|
|
2995
2755
|
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) {
|
|
2996
|
-
setSelectedPosition(
|
|
2756
|
+
setSelectedPosition({
|
|
2757
|
+
idx: -1,
|
|
2758
|
+
rowIdx: minRowIdx - 1,
|
|
2759
|
+
mode: 'SELECT'
|
|
2760
|
+
});
|
|
2997
2761
|
setDraggedOverRowIdx(undefined);
|
|
2998
2762
|
}
|
|
2999
|
-
|
|
3000
2763
|
let templateRows = `${headerRowHeight}px`;
|
|
3001
|
-
|
|
3002
2764
|
if (topSummaryRowsCount > 0) {
|
|
3003
2765
|
templateRows += ` repeat(${topSummaryRowsCount}, ${summaryRowHeight}px)`;
|
|
3004
2766
|
}
|
|
3005
|
-
|
|
3006
2767
|
if (rows.length > 0) {
|
|
3007
2768
|
templateRows += gridTemplateRows;
|
|
3008
2769
|
}
|
|
3009
|
-
|
|
3010
2770
|
if (bottomSummaryRowsCount > 0) {
|
|
3011
2771
|
templateRows += ` repeat(${bottomSummaryRowsCount}, ${summaryRowHeight}px)`;
|
|
3012
2772
|
}
|
|
3013
|
-
|
|
3014
|
-
const isGroupRowFocused = selectedPosition.idx === -1 && selectedPosition.rowIdx !== -2;
|
|
2773
|
+
const isGroupRowFocused = selectedPosition.idx === -1 && selectedPosition.rowIdx !== minRowIdx - 1;
|
|
3015
2774
|
return /*#__PURE__*/o("div", {
|
|
3016
2775
|
role: hasGroups ? 'treegrid' : 'grid',
|
|
3017
2776
|
"aria-label": ariaLabel,
|
|
@@ -3021,14 +2780,16 @@
|
|
|
3021
2780
|
"aria-colcount": columns.length,
|
|
3022
2781
|
"aria-rowcount": headerRowsCount + rowsCount + summaryRowsCount,
|
|
3023
2782
|
className: clsx(rootClassname, className, isDragging && viewportDraggingClassname),
|
|
3024
|
-
style: {
|
|
3025
|
-
|
|
3026
|
-
|
|
2783
|
+
style: {
|
|
2784
|
+
...style,
|
|
2785
|
+
scrollPaddingInlineStart: selectedPosition.idx > lastFrozenColumnIndex || scrollToPosition?.idx !== undefined ? `${totalFrozenColumnWidth}px` : undefined,
|
|
2786
|
+
scrollPaddingBlock: isRowIdxWithinViewportBounds(selectedPosition.rowIdx) || scrollToPosition?.rowIdx !== undefined ? `${headerRowHeight + topSummaryRowsCount * summaryRowHeight}px ${bottomSummaryRowsCount * summaryRowHeight}px` : undefined,
|
|
2787
|
+
gridTemplateColumns,
|
|
3027
2788
|
gridTemplateRows: templateRows,
|
|
3028
2789
|
'--rdg-header-row-height': `${headerRowHeight}px`,
|
|
3029
2790
|
'--rdg-summary-row-height': `${summaryRowHeight}px`,
|
|
3030
2791
|
'--rdg-sign': isRtl ? -1 : 1,
|
|
3031
|
-
...
|
|
2792
|
+
...layoutCssVars
|
|
3032
2793
|
},
|
|
3033
2794
|
dir: direction,
|
|
3034
2795
|
ref: gridRef,
|
|
@@ -3040,81 +2801,90 @@
|
|
|
3040
2801
|
tabIndex: isGroupRowFocused ? 0 : -1,
|
|
3041
2802
|
className: clsx(focusSinkClassname, isGroupRowFocused && [rowSelected, lastFrozenColumnIndex !== -1 && rowSelectedWithFrozenCell]),
|
|
3042
2803
|
style: {
|
|
3043
|
-
gridRowStart: selectedPosition.rowIdx +
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
|
-
|
|
2804
|
+
gridRowStart: selectedPosition.rowIdx + headerAndTopSummaryRowsCount + 1
|
|
2805
|
+
}
|
|
2806
|
+
}), scrollToPosition !== null && /*#__PURE__*/o(ScrollToCell, {
|
|
2807
|
+
scrollToPosition: scrollToPosition,
|
|
2808
|
+
setScrollToCellPosition: setScrollToPosition,
|
|
2809
|
+
gridElement: gridRef.current
|
|
2810
|
+
}), /*#__PURE__*/o(DataGridDefaultRenderersProvider, {
|
|
3047
2811
|
value: defaultGridComponents,
|
|
3048
|
-
children: [/*#__PURE__*/o(
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
selectCell: selectHeaderCellLatest,
|
|
3058
|
-
shouldFocusGrid: !selectedCellIsWithinSelectionBounds,
|
|
3059
|
-
direction: direction
|
|
3060
|
-
}), rows.length === 0 && noRowsFallback ? noRowsFallback : /*#__PURE__*/o(p$1, {
|
|
3061
|
-
children: [topSummaryRows?.map((row, rowIdx) => {
|
|
3062
|
-
const gridRowStart = headerRowsCount + rowIdx + 1;
|
|
3063
|
-
const summaryRowIdx = rowIdx + minRowIdx + 1;
|
|
3064
|
-
const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;
|
|
3065
|
-
const top = headerRowHeight + summaryRowHeight * rowIdx;
|
|
3066
|
-
return /*#__PURE__*/o(SummaryRow$1, {
|
|
3067
|
-
"aria-rowindex": gridRowStart,
|
|
3068
|
-
rowIdx: rowIdx,
|
|
3069
|
-
gridRowStart: gridRowStart,
|
|
3070
|
-
row: row,
|
|
3071
|
-
top: top,
|
|
3072
|
-
bottom: undefined,
|
|
3073
|
-
lastTopRowIdx: topSummaryRowsCount - 1,
|
|
3074
|
-
viewportColumns: getRowViewportColumns(summaryRowIdx),
|
|
2812
|
+
children: [/*#__PURE__*/o(RowSelectionChangeProvider, {
|
|
2813
|
+
value: selectRowLatest,
|
|
2814
|
+
children: [/*#__PURE__*/o(RowSelectionProvider, {
|
|
2815
|
+
value: allRowsSelected,
|
|
2816
|
+
children: /*#__PURE__*/o(HeaderRow$1, {
|
|
2817
|
+
columns: getRowViewportColumns(-1),
|
|
2818
|
+
onColumnResize: handleColumnResizeLatest,
|
|
2819
|
+
sortColumns: sortColumns,
|
|
2820
|
+
onSortColumnsChange: onSortColumnsChangeLatest,
|
|
3075
2821
|
lastFrozenColumnIndex: lastFrozenColumnIndex,
|
|
3076
|
-
selectedCellIdx:
|
|
3077
|
-
selectCell:
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
2822
|
+
selectedCellIdx: selectedPosition.rowIdx === minRowIdx ? selectedPosition.idx : undefined,
|
|
2823
|
+
selectCell: selectHeaderCellLatest,
|
|
2824
|
+
shouldFocusGrid: !selectedCellIsWithinSelectionBounds,
|
|
2825
|
+
direction: direction
|
|
2826
|
+
})
|
|
2827
|
+
}), rows.length === 0 && noRowsFallback ? noRowsFallback : /*#__PURE__*/o(k$2, {
|
|
2828
|
+
children: [topSummaryRows?.map((row, rowIdx) => {
|
|
2829
|
+
const gridRowStart = headerRowsCount + rowIdx + 1;
|
|
2830
|
+
const summaryRowIdx = rowIdx + minRowIdx + 1;
|
|
2831
|
+
const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;
|
|
2832
|
+
const top = headerRowHeight + summaryRowHeight * rowIdx;
|
|
2833
|
+
return /*#__PURE__*/o(SummaryRow$1, {
|
|
2834
|
+
"aria-rowindex": gridRowStart,
|
|
2835
|
+
rowIdx: summaryRowIdx,
|
|
2836
|
+
gridRowStart: gridRowStart,
|
|
2837
|
+
row: row,
|
|
2838
|
+
top: top,
|
|
2839
|
+
bottom: undefined,
|
|
2840
|
+
viewportColumns: getRowViewportColumns(summaryRowIdx),
|
|
2841
|
+
lastFrozenColumnIndex: lastFrozenColumnIndex,
|
|
2842
|
+
selectedCellIdx: isSummaryRowSelected ? selectedPosition.idx : undefined,
|
|
2843
|
+
isTop: true,
|
|
2844
|
+
showBorder: rowIdx === topSummaryRowsCount - 1,
|
|
2845
|
+
selectCell: selectCellLatest
|
|
2846
|
+
}, rowIdx);
|
|
2847
|
+
}), getViewportRows(), bottomSummaryRows?.map((row, rowIdx) => {
|
|
2848
|
+
const gridRowStart = headerAndTopSummaryRowsCount + rows.length + rowIdx + 1;
|
|
2849
|
+
const summaryRowIdx = rows.length + rowIdx;
|
|
2850
|
+
const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;
|
|
2851
|
+
const top = clientHeight > totalRowHeight ? gridHeight - summaryRowHeight * (bottomSummaryRows.length - rowIdx) : undefined;
|
|
2852
|
+
const bottom = top === undefined ? summaryRowHeight * (bottomSummaryRows.length - 1 - rowIdx) : undefined;
|
|
2853
|
+
return /*#__PURE__*/o(SummaryRow$1, {
|
|
2854
|
+
"aria-rowindex": headerAndTopSummaryRowsCount + rowsCount + rowIdx + 1,
|
|
2855
|
+
rowIdx: summaryRowIdx,
|
|
2856
|
+
gridRowStart: gridRowStart,
|
|
2857
|
+
row: row,
|
|
2858
|
+
top: top,
|
|
2859
|
+
bottom: bottom,
|
|
2860
|
+
viewportColumns: getRowViewportColumns(summaryRowIdx),
|
|
2861
|
+
lastFrozenColumnIndex: lastFrozenColumnIndex,
|
|
2862
|
+
selectedCellIdx: isSummaryRowSelected ? selectedPosition.idx : undefined,
|
|
2863
|
+
isTop: false,
|
|
2864
|
+
showBorder: rowIdx === 0,
|
|
2865
|
+
selectCell: selectCellLatest
|
|
2866
|
+
}, rowIdx);
|
|
2867
|
+
})]
|
|
3101
2868
|
})]
|
|
3102
2869
|
}), renderMeasuringCells(viewportColumns)]
|
|
3103
2870
|
})]
|
|
3104
2871
|
});
|
|
3105
2872
|
}
|
|
3106
|
-
|
|
2873
|
+
let getCellToScrollExpression;
|
|
2874
|
+
function getCellToScroll(gridEl) {
|
|
2875
|
+
getCellToScrollExpression ??= document.createExpression('div[@role="row"]/div[@tabindex="0"]');
|
|
2876
|
+
return getCellToScrollExpression.evaluate(gridEl, 8).singleNodeValue;
|
|
2877
|
+
}
|
|
3107
2878
|
function isSamePosition(p1, p2) {
|
|
3108
2879
|
return p1.idx === p2.idx && p1.rowIdx === p2.rowIdx;
|
|
3109
2880
|
}
|
|
3110
|
-
|
|
3111
|
-
const DataGrid$1 = /*#__PURE__*/N(DataGrid);
|
|
2881
|
+
const DataGrid$1 = /*#__PURE__*/k(DataGrid);
|
|
3112
2882
|
|
|
3113
2883
|
function useData(widget) {
|
|
3114
2884
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3115
|
-
var columns = F(function () { return widget.columns(); }, [widget, widget.dataChecksum()]);
|
|
2885
|
+
var columns = F$1(function () { return widget.columns(); }, [widget, widget.dataChecksum()]);
|
|
3116
2886
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3117
|
-
var data = F(function () { return widget.data(); }, [widget, widget.dataChecksum()]);
|
|
2887
|
+
var data = F$1(function () { return widget.data(); }, [widget, widget.dataChecksum()]);
|
|
3118
2888
|
return [columns, data];
|
|
3119
2889
|
}
|
|
3120
2890
|
|
|
@@ -3132,9 +2902,9 @@
|
|
|
3132
2902
|
}
|
|
3133
2903
|
var EmptyRowsRenderer = function (_a) {
|
|
3134
2904
|
var message = _a.message;
|
|
3135
|
-
return
|
|
2905
|
+
return y$1("div", { style: { textAlign: "center", gridColumn: "1/-1" } },
|
|
3136
2906
|
message,
|
|
3137
|
-
|
|
2907
|
+
y$1("span", null, "--- * --- * ---"));
|
|
3138
2908
|
};
|
|
3139
2909
|
var ReactTable = function (_a) {
|
|
3140
2910
|
var table = _a.table, sort = _a.sort;
|
|
@@ -3143,12 +2913,12 @@
|
|
|
3143
2913
|
var columnTypes = table.columnTypes();
|
|
3144
2914
|
var columnPatterns = table.columnPatterns();
|
|
3145
2915
|
var columnFormats = table.columnFormats();
|
|
3146
|
-
var _c =
|
|
3147
|
-
var _d =
|
|
3148
|
-
var _e =
|
|
3149
|
-
var _f =
|
|
2916
|
+
var _c = h([]), listColumns = _c[0], setListColumns = _c[1];
|
|
2917
|
+
var _d = h(), sortColumn = _d[0], setSortColumn = _d[1];
|
|
2918
|
+
var _e = h([]), rows = _e[0], setRows = _e[1];
|
|
2919
|
+
var _f = h(new Set()), selectedRows = _f[0], setSelectedRows = _f[1];
|
|
3150
2920
|
// Columns ---
|
|
3151
|
-
|
|
2921
|
+
p(function () {
|
|
3152
2922
|
setListColumns(__spreadArray(__spreadArray([], multiSelect ? [SelectColumn] : [], true), columns.map(function (column) {
|
|
3153
2923
|
var _a;
|
|
3154
2924
|
var type = (_a = columnTypes[column]) !== null && _a !== void 0 ? _a : "string";
|
|
@@ -3162,7 +2932,7 @@
|
|
|
3162
2932
|
break;
|
|
3163
2933
|
case "number":
|
|
3164
2934
|
formatter = function (props) {
|
|
3165
|
-
return
|
|
2935
|
+
return y$1("div", { style: { textAlign: "right" } }, props.row[props.column.key]);
|
|
3166
2936
|
};
|
|
3167
2937
|
// eslint-disable-next-line no-fallthrough
|
|
3168
2938
|
default:
|
|
@@ -3174,7 +2944,7 @@
|
|
|
3174
2944
|
resizable: true,
|
|
3175
2945
|
sortable: true,
|
|
3176
2946
|
minWidth: 80,
|
|
3177
|
-
|
|
2947
|
+
renderCell: formatter,
|
|
3178
2948
|
__hpcc_pattern: __hpcc_pattern,
|
|
3179
2949
|
__hpcc_format: __hpcc_format
|
|
3180
2950
|
};
|
|
@@ -3193,11 +2963,11 @@
|
|
|
3193
2963
|
var onSelectedRowsChange = T$1(function (selectedRows) {
|
|
3194
2964
|
setSelectedRows(selectedRows);
|
|
3195
2965
|
}, []);
|
|
3196
|
-
var
|
|
2966
|
+
var onCellClick = T$1(function (row, column) {
|
|
3197
2967
|
table.onRowClickCallback(row, column.key);
|
|
3198
2968
|
}, [table]);
|
|
3199
2969
|
// Rows ---
|
|
3200
|
-
|
|
2970
|
+
p(function () {
|
|
3201
2971
|
var items = data.map(function (row, index) {
|
|
3202
2972
|
var retVal = {
|
|
3203
2973
|
key: index
|
|
@@ -3222,7 +2992,7 @@
|
|
|
3222
2992
|
}
|
|
3223
2993
|
setRows(items);
|
|
3224
2994
|
}, [listColumns, data, sort]);
|
|
3225
|
-
return
|
|
2995
|
+
return y$1(DataGrid$1, { columns: listColumns, headerRowHeight: 24, rows: rows, rowKeyGetter: rowKeyGetter, rowHeight: 20, renderers: { noRowsFallback: y$1(EmptyRowsRenderer, { message: table.noDataMessage() }) }, className: table.darkMode() ? "rdg-dark" : "rdg-light", sortColumns: sortColumn ? [sortColumn] : [], onSortColumnsChange: onSortColumnsChange, selectedRows: selectedRows, onSelectedRowsChange: multiSelect ? onSelectedRowsChange : undefined, onCellClick: multiSelect ? undefined : onCellClick, "aria-describedby": "", "aria-label": "", "aria-labelledby": "", style: { height: "100%" } });
|
|
3226
2996
|
};
|
|
3227
2997
|
|
|
3228
2998
|
function styleInject(css, ref) {
|
|
@@ -3301,10 +3071,10 @@
|
|
|
3301
3071
|
_super.prototype.update.call(this, domNode, element);
|
|
3302
3072
|
this._div.style("width", this.width() + "px");
|
|
3303
3073
|
this._div.style("height", this.height() + "px");
|
|
3304
|
-
|
|
3074
|
+
G(y$1(ReactTable, { table: this }), this._div.node());
|
|
3305
3075
|
};
|
|
3306
3076
|
Table.prototype.exit = function (domNode, element) {
|
|
3307
|
-
|
|
3077
|
+
hn(this._div.node());
|
|
3308
3078
|
this._div.remove();
|
|
3309
3079
|
_super.prototype.exit.call(this, domNode, element);
|
|
3310
3080
|
};
|