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