@hpcc-js/dgrid2 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.1.1";
9
- var BUILD_VERSION = "2.103.1";
8
+ var PKG_VERSION = "2.3.0";
9
+ var BUILD_VERSION = "2.104.0";
10
10
 
11
11
  /*! *****************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -39,6 +39,17 @@
39
39
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
40
  }
41
41
 
42
+ var __assign = function() {
43
+ __assign = Object.assign || function __assign(t) {
44
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
45
+ s = arguments[i];
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47
+ }
48
+ return t;
49
+ };
50
+ return __assign.apply(this, arguments);
51
+ };
52
+
42
53
  function __decorate(decorators, target, key, desc) {
43
54
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44
55
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -60,11 +71,11 @@
60
71
  return to.concat(ar || Array.prototype.slice.call(from));
61
72
  }
62
73
 
63
- var n,l$1,u$1,t$1,o$2,r$1,f$1,e$2={},c$1=[],s$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a$1(n,l){for(var u in l)n[u]=l[u];return n}function h$1(n){var l=n.parentNode;l&&l.removeChild(n);}function v$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y$1(l,f,t,o,null)}function y$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function d$1(n){return n.children}function _$1(n,l){this.props=n,this.context=l;}function k$1(n,l){if(null==l)return n.__?k$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?k$1(n):null}function b$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 b$1(n)}}function m$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$2.__r++||r$1!==l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$2)(g$2);}function g$2(){for(var n;g$2.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=a$1({},t)).__v=t.__v+1,j$2(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?k$1(t):o,t.__h),z$1(u,t),t.__e!=o&&b$1(t)));});}function w$2(n,l,u,i,t,o,r,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c$1,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y$1(null,_,null,null,_):Array.isArray(_)?y$1(d$1,{children:_},null,null,null):_.__b>0?y$1(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null;}j$2(n,_,p=p||e$2,t,o,r,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x$2(_,s,n):s=P$1(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k$1(p));}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k$1(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M$1(g[h],g[++h],g[++h]);}function x$2(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?x$2(i,l,u):P$1(u,i,i,t,i.__e,l));return l}function A$2(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){A$2(n,l);}):l.push(n)),l}function P$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$1(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s$1.test(l)?u:u+"px";}function H$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$1:I$1,o):n.removeEventListener(l,o?T$1:I$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function I$1(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$1(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$2(n,u,i,t,o,r,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _$1(m,x),h.constructor=P,h.render=O$1),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a$1({},h.__s)),a$1(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k);});}h.context=x,h.props=m,h.state=h.__s,(s=l$1.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a$1(a$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d$1&&null==s.key?s.props.children:s,w$2(n,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$1(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L$1(l,u,i,t,o,r,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(o=!0),null!=r)for(;_<r.length;_++)if((s=r[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||e$2).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(_=u.props.children,w$2(l,Array.isArray(_)?_:[_],u,i,t,o&&"foreignObject"!==d,r,f,r?r[0]:i.__k&&k$1(i,0),c),null!=r)for(_=r.length;_--;)null!=r[_]&&h$1(r[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==l.value||"progress"===d&&!_||"option"===d&&_!==y.value)&&H$1(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H$1(l,"checked",_,y.checked,!1));}return l}function M$1(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$1(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||h$1(n.__e),n.__e=n.__d=void 0;}function O$1(n,l,u){return this.constructor(n,u)}function S$1(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j$2(i,u=(!o&&t||i).__k=v$1(d$1,null,[u]),r||e$2,e$2,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),z$1(f,u);}function D$1(n,l){var u={__c:l="__cC"+f$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=c$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,_$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a$1({},this.state),"function"==typeof n&&(n=n(a$1({},u),this.props)),n&&a$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m$1(this));},_$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m$1(this));},_$1.prototype.render=d$1,t$1=[],o$2="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g$2.__r=0,f$1=0;
74
+ var n,l$1,u$1,t$1,o$2,r$1,f$1,e$2={},c$1=[],s$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a$1(n,l){for(var u in l)n[u]=l[u];return n}function h$1(n){var l=n.parentNode;l&&l.removeChild(n);}function v$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y$1(l,f,t,o,null)}function y$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function d$1(n){return n.children}function _$1(n,l){this.props=n,this.context=l;}function k$1(n,l){if(null==l)return n.__?k$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?k$1(n):null}function b$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 b$1(n)}}function m$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$2.__r++||r$1!==l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$2)(g$2);}function g$2(){for(var n;g$2.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=a$1({},t)).__v=t.__v+1,j$2(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?k$1(t):o,t.__h),z$1(u,t),t.__e!=o&&b$1(t)));});}function w$2(n,l,u,i,t,o,r,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c$1,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y$1(null,_,null,null,_):Array.isArray(_)?y$1(d$1,{children:_},null,null,null):_.__b>0?y$1(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null;}j$2(n,_,p=p||e$2,t,o,r,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x$2(_,s,n):s=P$1(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k$1(p));}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k$1(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M$1(g[h],g[++h],g[++h]);}function x$2(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?x$2(i,l,u):P$1(u,i,i,t,i.__e,l));return l}function A$2(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){A$2(n,l);}):l.push(n)),l}function P$1(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$1(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$1(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s$1.test(l)?u:u+"px";}function H$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$1:I,o):n.removeEventListener(l,o?T$1:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$1(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$2(n,u,i,t,o,r,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _$1(m,x),h.constructor=P,h.render=O$1),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a$1({},h.__s)),a$1(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k);});}h.context=x,h.props=m,h.state=h.__s,(s=l$1.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a$1(a$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d$1&&null==s.key?s.props.children:s,w$2(n,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$1(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L$1(l,u,i,t,o,r,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(o=!0),null!=r)for(;_<r.length;_++)if((s=r[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||e$2).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$1(l,p,y,o,c),v)u.__k=[];else if(_=u.props.children,w$2(l,Array.isArray(_)?_:[_],u,i,t,o&&"foreignObject"!==d,r,f,r?r[0]:i.__k&&k$1(i,0),c),null!=r)for(_=r.length;_--;)null!=r[_]&&h$1(r[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==l.value||"progress"===d&&!_||"option"===d&&_!==y.value)&&H$1(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H$1(l,"checked",_,y.checked,!1));}return l}function M$1(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$1(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||h$1(n.__e),n.__e=n.__d=void 0;}function O$1(n,l,u){return this.constructor(n,u)}function S$1(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j$2(i,u=(!o&&t||i).__k=v$1(d$1,null,[u]),r||e$2,e$2,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),z$1(f,u);}function D(n,l){var u={__c:l="__cC"+f$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=c$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,_$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a$1({},this.state),"function"==typeof n&&(n=n(a$1({},u),this.props)),n&&a$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m$1(this));},_$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m$1(this));},_$1.prototype.render=d$1,t$1=[],o$2="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g$2.__r=0,f$1=0;
64
75
 
65
76
  var t,u,r,o$1=0,i=[],c=l$1.__b,f=l$1.__r,e$1=l$1.diffed,a=l$1.__c,v=l$1.unmount;function l(t,r){l$1.__h&&l$1.__h(u,t,o$1||r),o$1=0;var i=u.__H||(u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function m(n){return o$1=1,p(w$1,n)}function p(n,r,o){var i=l(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w$1(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function y(r,o){var i=l(t++,3);!l$1.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__H.__h.push(i));}function d(r,o){var i=l(t++,4);!l$1.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__h.push(i));}function h(n){return o$1=5,_(function(){return {current:n}},[])}function s(n,t,u){o$1=6,d(function(){return "function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==u?u:u.concat(n));}function _(n,u){var r=l(t++,7);return k(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function A$1(n,t){return o$1=8,_(function(){return n},t)}function F(n){var r=u.context[n.__c],o=l(t++,9);return o.c=n,r?(null==o.__&&(o.__=!0,r.sub(u)),r.props.value):n.__}function x$1(){for(var t;t=i.shift();)if(t.__P)try{t.__H.__h.forEach(g$1),t.__H.__h.forEach(j$1),t.__H.__h=[];}catch(u){t.__H.__h=[],l$1.__e(u,t.__v);}}l$1.__b=function(n){u=null,c&&c(n);},l$1.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g$1),r.__h.forEach(j$1),r.__h=[]);},l$1.diffed=function(t){e$1&&e$1(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i.push(o)&&r===l$1.requestAnimationFrame||((r=l$1.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x$1)),u=null;},l$1.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g$1),t.__h=t.__h.filter(function(n){return !n.__||j$1(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],l$1.__e(r,t.__v);}}),a&&a(t,u);},l$1.unmount=function(t){v&&v(t);var u,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{g$1(n);}catch(n){u=n;}}),u&&l$1.__e(u,r.__v));};var b="function"==typeof requestAnimationFrame;function g$1(n){var t=u,r=n.__c;"function"==typeof r&&(n.__c=void 0,r()),u=t;}function j$1(n){var t=u;n.__c=n.__(),u=t;}function k(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w$1(n,t){return "function"==typeof t?t(n):t}
66
77
 
67
- function C(n,t){for(var e in t)n[e]=t[e];return n}function S(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 g(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return !r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:S(this.props,n)}function r(t){return this.shouldComponentUpdate=e,v$1(n,t)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(E.prototype=new _$1).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return S(this.props,n)||S(this.state,t)};var w=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w&&w(n);};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function x(n){function t(t){var e=C({},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 A=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);A(n,t,e,r);};var O=l$1.unmount;function L(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function M(){this.u=null,this.o=null;}l$1.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O&&O(n);},(L.prototype=new _$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.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L.prototype.componentWillUnmount=function(){this.t=[];},L.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=C({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&v$1(d$1,null,n.fallback);return u&&(u.__h=null),[v$1(d$1,null,t.__e?null:n.children),u]};var T=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 D(n){return this.getChildContext=function(){return n.context},n.children}function I(n){var t=this,e=n.i;t.componentWillUnmount=function(){S$1(null,t.l),t.l=null,t.i=null;},t.i&&t.i!==e&&t.componentWillUnmount(),n.__v?(t.l||(t.i=e,t.l={nodeType:1,parentNode:e,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n);},insertBefore:function(n,e){this.childNodes.push(n),t.i.appendChild(n);},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n);}}),S$1(v$1(D,{context:t.context},n.__v),t.l)):t.l&&t.componentWillUnmount();}function W(n,t){return v$1(I,{__v:n,i:t})}(M.prototype=new _$1).__e=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),T(t,n,r)):u();};e?e(o):o();}},M.prototype.render=function(n){this.u=null,this.o=new Map;var t=A$2(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){T(n,e,t);});};var P="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,V=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,j="undefined"!=typeof document,z=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function B(n,t,e){return null==t.__k&&(t.textContent=""),S$1(n,t),"function"==typeof e&&e(),n?n.__c:null}_$1.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(_$1.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H=l$1.event;function Z(){}function Y(){return this.cancelBubble}function q(){return this.defaultPrevented}l$1.event=function(n){return H&&(n=H(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=q,n.nativeEvent=n};var J={configurable:!0,get:function(){return this.class}},K=l$1.vnode;l$1.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){var u=-1===t.indexOf("-");for(var o in r={},e){var i=e[o];j&&"children"===o&&"noscript"===t||"value"===o&&"defaultValue"in e&&null==i||("defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===i?i="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!z(e.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():u&&V.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===i&&(i=void 0),r[o]=i);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r,e.class!=e.className&&(J.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",J));}n.$$typeof=P,K&&K(n);};var Q=l$1.__r;l$1.__r=function(n){Q&&Q(n);};function un(n){return !!n.__k&&(S$1(null,n),!0)}
78
+ function C(n,t){for(var e in t)n[e]=t[e];return n}function S(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 g(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return !r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:S(this.props,n)}function r(t){return this.shouldComponentUpdate=e,v$1(n,t)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(E.prototype=new _$1).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return S(this.props,n)||S(this.state,t)};var w=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w&&w(n);};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function x(n){function t(t){var e=C({},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 A=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);A(n,t,e,r);};var O=l$1.unmount;function L(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function M(){this.u=null,this.o=null;}l$1.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O&&O(n);},(L.prototype=new _$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.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L.prototype.componentWillUnmount=function(){this.t=[];},L.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=C({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&v$1(d$1,null,n.fallback);return u&&(u.__h=null),[v$1(d$1,null,t.__e?null:n.children),u]};var T=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];}};(M.prototype=new _$1).__e=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),T(t,n,r)):u();};e?e(o):o();}},M.prototype.render=function(n){this.u=null,this.o=new Map;var t=A$2(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){T(n,e,t);});};var P="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,V=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,j="undefined"!=typeof document,z=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function B(n,t,e){return null==t.__k&&(t.textContent=""),S$1(n,t),"function"==typeof e&&e(),n?n.__c:null}_$1.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(_$1.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H=l$1.event;function Z(){}function Y(){return this.cancelBubble}function q(){return this.defaultPrevented}l$1.event=function(n){return H&&(n=H(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=q,n.nativeEvent=n};var J={configurable:!0,get:function(){return this.class}},K=l$1.vnode;l$1.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){var u=-1===t.indexOf("-");for(var o in r={},e){var i=e[o];j&&"children"===o&&"noscript"===t||"value"===o&&"defaultValue"in e&&null==i||("defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===i?i="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!z(e.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():u&&V.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===i&&(i=void 0),r[o]=i);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r,e.class!=e.className&&(J.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",J));}n.$$typeof=P,K&&K(n);};var Q=l$1.__r;l$1.__r=function(n){Q&&Q(n);};function un(n){return !!n.__k&&(S$1(null,n),!0)}
68
79
 
69
80
  function toVal(mix) {
70
81
  var k, y, str='';
@@ -136,104 +147,113 @@
136
147
  }
137
148
  }
138
149
 
139
- 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)}";
140
- styleInject$1(css_248z$b);
150
+ var css_248z$f = ".c1wupbe700-beta12{background-color:inherit;border-block-end:1px solid var(--rdg-border-color);border-inline-end:1px solid var(--rdg-border-color);contain:strict;contain:size layout style paint;grid-row-start:var(--rdg-grid-row-start);outline:none;overflow:hidden;overflow:clip;padding-block:0;padding-inline:8px;text-overflow:ellipsis;white-space:nowrap}.c1wupbe700-beta12[aria-selected=true]{outline:2px solid var(--rdg-selection-color);outline-offset:-2px}.cd0kgiy700-beta12 .c1wupbe700-beta12{contain:content}.c1730fa4700-beta12{position:sticky;z-index:1}.c9dpaye700-beta12{box-shadow:calc(2px*var(--rdg-sign)) 0 5px -2px hsla(0,0%,53%,.3)}";
151
+ styleInject$1(css_248z$f,{"insertAt":"top"});
141
152
 
142
- const cell = "c1wupbe700-canary49";
153
+ const cell = "c1wupbe700-beta12";
143
154
  const cellClassname = `rdg-cell ${cell}`;
144
- const cellFrozen = "cd0kgiy700-canary49";
155
+ const cellAutoResizeClassname = "cd0kgiy700-beta12";
156
+ const cellFrozen = "c1730fa4700-beta12";
145
157
  const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
146
- const cellFrozenLast = "c1730fa4700-canary49";
158
+ const cellFrozenLast = "c9dpaye700-beta12";
147
159
  const cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;
148
160
 
149
- 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}";
150
- styleInject$1(css_248z$a);
161
+ var css_248z$e = ".r104f42s700-beta12{--rdg-color:#000;--rdg-border-color:#ddd;--rdg-summary-border-color:#aaa;--rdg-background-color:#fff;--rdg-header-background-color:#f9f9f9;--rdg-row-hover-background-color:#f5f5f5;--rdg-row-selected-background-color:#dbecfa;--row-selected-hover-background-color:#c9e3f8;--rdg-checkbox-color:#005194;--rdg-checkbox-focus-color:#61b8ff;--rdg-checkbox-disabled-border-color:#ccc;--rdg-checkbox-disabled-background-color:#ddd;--rdg-selection-color:#66afe9;--rdg-font-size:14px;content-visibility:auto;background-color:var(--rdg-background-color);block-size:350px;border:1px solid var(--rdg-border-color);box-sizing:border-box;color:var(--rdg-color);color-scheme:var(--rdg-color-scheme,light dark);contain:strict;contain:size layout style paint;display:grid;font-size:var(--rdg-font-size);overflow:auto;user-select:none}@supports not (contain:strict){.r104f42s700-beta12{position:relative;z-index:0}}.r104f42s700-beta12 *,.r104f42s700-beta12 :after,.r104f42s700-beta12 :before{box-sizing:inherit}.r104f42s700-beta12:before{content:\"\";grid-column:1/-1;grid-row:1/-1}.r104f42s700-beta12.rdg-dark{--rdg-color-scheme:dark;--rdg-color:#ddd;--rdg-border-color:#444;--rdg-summary-border-color:#555;--rdg-background-color:#212121;--rdg-header-background-color:#1b1b1b;--rdg-row-hover-background-color:#171717;--rdg-row-selected-background-color:#1a73bc;--row-selected-hover-background-color:#1768ab;--rdg-checkbox-color:#94cfff;--rdg-checkbox-focus-color:#c7e6ff;--rdg-checkbox-disabled-border-color:#000;--rdg-checkbox-disabled-background-color:#333}.r104f42s700-beta12.rdg-light{--rdg-color-scheme:light}@media (prefers-color-scheme:dark){.r104f42s700-beta12:not(.rdg-light){--rdg-color:#ddd;--rdg-border-color:#444;--rdg-summary-border-color:#555;--rdg-background-color:#212121;--rdg-header-background-color:#1b1b1b;--rdg-row-hover-background-color:#171717;--rdg-row-selected-background-color:#1a73bc;--row-selected-hover-background-color:#1768ab;--rdg-checkbox-color:#94cfff;--rdg-checkbox-focus-color:#c7e6ff;--rdg-checkbox-disabled-border-color:#000;--rdg-checkbox-disabled-background-color:#333}}.v7ly7s700-beta12.r1otpg64700-beta12{cursor:move}.fc4f4zb700-beta12{grid-column:1/-1;pointer-events:none;z-index:4}";
162
+ styleInject$1(css_248z$e,{"insertAt":"top"});
151
163
 
152
- const root = "r104f42s700-canary49";
164
+ const root = "r104f42s700-beta12";
153
165
  const rootClassname = `rdg ${root}`;
154
- const focusSink = "f7ly7s700-canary49";
155
- const focusSinkClassname = `rdg-focus-sink ${focusSink}`;
156
- const viewportDragging = "vc4f4zb700-canary49";
166
+ const viewportDragging = "v7ly7s700-beta12";
157
167
  const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
168
+ const focusSinkClassname = "fc4f4zb700-beta12";
158
169
 
159
- 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)}";
160
- styleInject$1(css_248z$9);
170
+ var css_248z$d = ".r1otpg64700-beta12{background-color:var(--rdg-background-color);display:contents;line-height:var(--rdg-row-height)}.r1otpg64700-beta12:hover{background-color:var(--rdg-row-hover-background-color)}.r1otpg64700-beta12[aria-selected=true]{background-color:var(--rdg-row-selected-background-color)}.r1otpg64700-beta12[aria-selected=true]:hover{background-color:var(--row-selected-hover-background-color)}.rel5gk2700-beta12{outline:2px solid var(--rdg-selection-color);outline-offset:-2px}.r1qymf1z700-beta12:before{border-inline-start:2px solid var(--rdg-selection-color);content:\"\";display:inline-block;height:100%;inset-inline-start:0;position:sticky}";
171
+ styleInject$1(css_248z$d,{"insertAt":"top"});
161
172
 
162
- const groupRow = "g1cvx5us700-canary49";
163
- const groupRowClassname = `rdg-group-row ${groupRow}`;
164
- const groupRowSelected = "g1j2w62i700-canary49";
165
- const groupRowSelectedClassname = `rdg-group-row-selected ${groupRowSelected}`;
173
+ const row = "r1otpg64700-beta12";
174
+ const rowClassname = `rdg-row ${row}`;
175
+ const rowSelected = "rel5gk2700-beta12";
176
+ const rowSelectedClassname = `rdg-row-selected`;
177
+ const rowSelectedWithFrozenCell = "r1qymf1z700-beta12";
166
178
 
167
- 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}";
168
- styleInject$1(css_248z$8);
179
+ var css_248z$c = ".cd9l4jz700-beta12{align-items:center;cursor:pointer;display:flex;inset:0;justify-content:center;margin-inline-end:1px;position:absolute}.c1noyk41700-beta12{all:unset}.cdwjxv8700-beta12{background-color:var(--rdg-background-color);block-size:20px;border:2px solid var(--rdg-border-color);content:\"\";inline-size:20px}.c1noyk41700-beta12:checked+.cdwjxv8700-beta12{background-color:var(--rdg-checkbox-color);outline:4px solid var(--rdg-background-color);outline-offset:-6px}.c1noyk41700-beta12:focus+.cdwjxv8700-beta12{border-color:var(--rdg-checkbox-focus-color)}.cca4mwn700-beta12{cursor:default}.cca4mwn700-beta12 .cdwjxv8700-beta12{background-color:var(--rdg-checkbox-disabled-background-color);border-color:var(--rdg-checkbox-disabled-border-color)}";
180
+ styleInject$1(css_248z$c,{"insertAt":"top"});
169
181
 
170
- const headerRow = "h1fquj5h700-canary49";
171
- const headerRowClassname = `rdg-header-row ${headerRow}`;
182
+ const checkboxLabel = "cd9l4jz700-beta12";
183
+ const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
184
+ const checkboxInput = "c1noyk41700-beta12";
185
+ const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
186
+ const checkbox = "cdwjxv8700-beta12";
187
+ const checkboxClassname = `rdg-checkbox ${checkbox}`;
188
+ const checkboxLabelDisabled = "cca4mwn700-beta12";
189
+ const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
190
+ const CheckboxFormatter = /*#__PURE__*/x(function CheckboxFormatter({
191
+ onChange,
192
+ ...props
193
+ }, ref) {
194
+ function handleChange(e) {
195
+ onChange(e.target.checked, e.nativeEvent.shiftKey);
196
+ }
172
197
 
173
- 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)}";
174
- styleInject$1(css_248z$7);
198
+ return /*#__PURE__*/e("label", {
199
+ className: clsx(checkboxLabelClassname, props.disabled && checkboxLabelDisabledClassname),
200
+ children: [/*#__PURE__*/e("input", {
201
+ type: "checkbox",
202
+ ref: ref,
203
+ ...props,
204
+ className: checkboxInputClassname,
205
+ onChange: handleChange
206
+ }), /*#__PURE__*/e("div", {
207
+ className: checkboxClassname
208
+ })]
209
+ });
210
+ });
175
211
 
176
- const row = "r1otpg64700-canary49";
177
- const rowClassname = `rdg-row ${row}`;
178
- const summaryRow = "sel5gk2700-canary49";
179
- const summaryRowClassname = `rdg-summary-row ${summaryRow}`;
212
+ const useLayoutEffect = typeof window === 'undefined' ? y : d;
180
213
 
181
- function useFocusRef(isCellSelected) {
214
+ function useFocusRef(isSelected) {
182
215
  const ref = h(null);
183
- d(() => {
216
+ useLayoutEffect(() => {
184
217
  var _ref$current;
185
218
 
186
- if (!isCellSelected) return;
219
+ if (!isSelected) return;
187
220
  (_ref$current = ref.current) == null ? void 0 : _ref$current.focus({
188
221
  preventScroll: true
189
222
  });
190
- }, [isCellSelected]);
191
- return ref;
223
+ }, [isSelected]);
224
+ return {
225
+ ref,
226
+ tabIndex: isSelected ? 0 : -1
227
+ };
192
228
  }
193
229
 
194
- 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)}";
195
- styleInject$1(css_248z$6);
230
+ const DataGridDefaultComponentsContext = /*#__PURE__*/D(undefined);
231
+ const DataGridDefaultComponentsProvider = DataGridDefaultComponentsContext.Provider;
232
+ function useDefaultComponents() {
233
+ return F(DataGridDefaultComponentsContext);
234
+ }
196
235
 
197
- const checkboxLabel = "c1w6d5eo700-canary49";
198
- const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
199
- const checkboxInput = "c1h7iz8d700-canary49";
200
- const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
201
- const checkbox = "cc79ydj700-canary49";
202
- const checkboxClassname = `rdg-checkbox ${checkbox}`;
203
- const checkboxLabelDisabled = "c1e5jt0b700-canary49";
204
- const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
205
236
  function SelectCellFormatter({
206
237
  value,
207
- tabIndex,
208
238
  isCellSelected,
209
239
  disabled,
210
- onClick,
211
240
  onChange,
212
241
  'aria-label': ariaLabel,
213
242
  'aria-labelledby': ariaLabelledBy
214
243
  }) {
215
- const inputRef = useFocusRef(isCellSelected);
216
-
217
- function handleChange(e) {
218
- onChange(e.target.checked, e.nativeEvent.shiftKey);
219
- }
220
-
221
- return /*#__PURE__*/e("label", {
222
- className: clsx(checkboxLabelClassname, disabled && checkboxLabelDisabledClassname),
223
- children: [/*#__PURE__*/e("input", {
224
- "aria-label": ariaLabel,
225
- "aria-labelledby": ariaLabelledBy,
226
- tabIndex: tabIndex,
227
- ref: inputRef,
228
- type: "checkbox",
229
- className: checkboxInputClassname,
230
- disabled: disabled,
231
- checked: value,
232
- onChange: handleChange,
233
- onClick: onClick
234
- }), /*#__PURE__*/e("div", {
235
- className: checkboxClassname
236
- })]
244
+ const {
245
+ ref,
246
+ tabIndex
247
+ } = useFocusRef(isCellSelected);
248
+ const Formatter = useDefaultComponents().checkboxFormatter;
249
+ return /*#__PURE__*/e(Formatter, {
250
+ "aria-label": ariaLabel,
251
+ "aria-labelledby": ariaLabelledBy,
252
+ ref: ref,
253
+ tabIndex: tabIndex,
254
+ disabled: disabled,
255
+ checked: value,
256
+ onChange: onChange
237
257
  });
238
258
  }
239
259
 
@@ -247,12 +267,12 @@
247
267
  }
248
268
  }
249
269
 
250
- 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}";
251
- styleInject$1(css_248z$5);
270
+ var css_248z$b = ".gch972y700-beta12{outline:none}.cz2qf0d700-beta12{stroke:currentColor;stroke-width:1.5px;fill:transparent;margin-inline-start:4px;vertical-align:middle}.cz2qf0d700-beta12>path{transition:d .1s}";
271
+ styleInject$1(css_248z$b,{"insertAt":"top"});
252
272
 
253
- const groupCellContent = "gch972y700-canary49";
273
+ const groupCellContent = "gch972y700-beta12";
254
274
  const groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;
255
- const caret = "cz2qf0d700-canary49";
275
+ const caret = "cz2qf0d700-beta12";
256
276
  const caretClassname = `rdg-caret ${caret}`;
257
277
  function ToggleGroupFormatter({
258
278
  groupKey,
@@ -260,7 +280,10 @@
260
280
  isCellSelected,
261
281
  toggleGroup
262
282
  }) {
263
- const cellRef = useFocusRef(isCellSelected);
283
+ const {
284
+ ref,
285
+ tabIndex
286
+ } = useFocusRef(isCellSelected);
264
287
 
265
288
  function handleKeyDown({
266
289
  key
@@ -272,15 +295,16 @@
272
295
 
273
296
  const d = isExpanded ? 'M1 1 L 7 7 L 13 1' : 'M1 7 L 7 1 L 13 7';
274
297
  return /*#__PURE__*/e("span", {
275
- ref: cellRef,
298
+ ref: ref,
276
299
  className: groupCellContentClassname,
277
- tabIndex: -1,
300
+ tabIndex: tabIndex,
278
301
  onKeyDown: handleKeyDown,
279
302
  children: [groupKey, /*#__PURE__*/e("svg", {
280
303
  viewBox: "0 0 14 8",
281
304
  width: "14",
282
305
  height: "8",
283
306
  className: caretClassname,
307
+ "aria-hidden": true,
284
308
  children: /*#__PURE__*/e("path", {
285
309
  d: d
286
310
  })
@@ -288,6 +312,78 @@
288
312
  });
289
313
  }
290
314
 
315
+ const RowSelectionContext = /*#__PURE__*/D(undefined);
316
+ const RowSelectionProvider = RowSelectionContext.Provider;
317
+ const RowSelectionChangeContext = /*#__PURE__*/D(undefined);
318
+ const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;
319
+ function useRowSelection() {
320
+ const rowSelectionContext = F(RowSelectionContext);
321
+ const rowSelectionChangeContext = F(RowSelectionChangeContext);
322
+
323
+ if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {
324
+ throw new Error('useRowSelection must be used within DataGrid cells');
325
+ }
326
+
327
+ return [rowSelectionContext, rowSelectionChangeContext];
328
+ }
329
+
330
+ const SELECT_COLUMN_KEY = 'select-row';
331
+
332
+ function SelectFormatter(props) {
333
+ const [isRowSelected, onRowSelectionChange] = useRowSelection();
334
+ return /*#__PURE__*/e(SelectCellFormatter, {
335
+ "aria-label": "Select",
336
+ isCellSelected: props.isCellSelected,
337
+ value: isRowSelected,
338
+ onChange: (checked, isShiftClick) => {
339
+ onRowSelectionChange({
340
+ row: props.row,
341
+ checked,
342
+ isShiftClick
343
+ });
344
+ }
345
+ });
346
+ }
347
+
348
+ function SelectGroupFormatter(props) {
349
+ const [isRowSelected, onRowSelectionChange] = useRowSelection();
350
+ return /*#__PURE__*/e(SelectCellFormatter, {
351
+ "aria-label": "Select Group",
352
+ isCellSelected: props.isCellSelected,
353
+ value: isRowSelected,
354
+ onChange: checked => {
355
+ onRowSelectionChange({
356
+ row: props.row,
357
+ checked,
358
+ isShiftClick: false
359
+ });
360
+ }
361
+ });
362
+ }
363
+
364
+ const SelectColumn = {
365
+ key: SELECT_COLUMN_KEY,
366
+ name: '',
367
+ width: 35,
368
+ minWidth: 35,
369
+ maxWidth: 35,
370
+ resizable: false,
371
+ sortable: false,
372
+ frozen: true,
373
+
374
+ headerRenderer(props) {
375
+ return /*#__PURE__*/e(SelectCellFormatter, {
376
+ "aria-label": "Select All",
377
+ isCellSelected: props.isCellSelected,
378
+ value: props.allRowsSelected,
379
+ onChange: props.onAllRowsSelectionChange
380
+ });
381
+ },
382
+
383
+ formatter: SelectFormatter,
384
+ groupFormatter: SelectGroupFormatter
385
+ };
386
+
291
387
  function getColSpan(column, lastFrozenColumnIndex, args) {
292
388
  const colSpan = typeof column.colSpan === 'function' ? column.colSpan(args) : 1;
293
389
 
@@ -298,10 +394,6 @@
298
394
  return undefined;
299
395
  }
300
396
 
301
- function stopPropagation(event) {
302
- event.stopPropagation();
303
- }
304
-
305
397
  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']);
306
398
  function isCtrlKeyHeldDown(e) {
307
399
  return (e.ctrlKey || e.metaKey) && e.key !== 'Control';
@@ -333,100 +425,134 @@
333
425
  function isCellEditable(column, row) {
334
426
  return column.editor != null && !column.rowGroup && (typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false;
335
427
  }
428
+ function getSelectedCellColSpan({
429
+ rows,
430
+ summaryRows,
431
+ rowIdx,
432
+ lastFrozenColumnIndex,
433
+ column,
434
+ isGroupRow
435
+ }) {
436
+ if (rowIdx === -1) {
437
+ return getColSpan(column, lastFrozenColumnIndex, {
438
+ type: 'HEADER'
439
+ });
440
+ }
441
+
442
+ if (rowIdx >= 0 && rowIdx < rows.length) {
443
+ const row = rows[rowIdx];
444
+
445
+ if (!isGroupRow(row)) {
446
+ return getColSpan(column, lastFrozenColumnIndex, {
447
+ type: 'ROW',
448
+ row
449
+ });
450
+ }
451
+
452
+ return undefined;
453
+ }
454
+
455
+ if (summaryRows) {
456
+ return getColSpan(column, lastFrozenColumnIndex, {
457
+ type: 'SUMMARY',
458
+ row: summaryRows[rowIdx - rows.length]
459
+ });
460
+ }
461
+
462
+ return undefined;
463
+ }
336
464
  function getNextSelectedCellPosition({
337
465
  cellNavigationMode,
338
466
  columns,
339
467
  colSpanColumns,
340
468
  rows,
341
- currentPosition,
469
+ summaryRows,
470
+ minRowIdx,
471
+ maxRowIdx,
472
+ currentPosition: {
473
+ idx: currentIdx
474
+ },
342
475
  nextPosition,
343
476
  lastFrozenColumnIndex,
344
477
  isCellWithinBounds,
345
478
  isGroupRow
346
479
  }) {
347
- const rowsCount = rows.length;
348
- let position = nextPosition;
480
+ let {
481
+ idx: nextIdx,
482
+ rowIdx: nextRowIdx
483
+ } = nextPosition;
349
484
 
350
485
  const setColSpan = moveRight => {
351
- const row = rows[position.rowIdx];
352
-
353
- if (!isGroupRow(row)) {
354
- const posIdx = position.idx;
486
+ if (nextRowIdx >= 0 && nextRowIdx < rows.length) {
487
+ const row = rows[nextRowIdx];
488
+ if (isGroupRow(row)) return;
489
+ }
355
490
 
356
- for (const column of colSpanColumns) {
357
- const colIdx = column.idx;
358
- if (colIdx > posIdx) break;
359
- const colSpan = getColSpan(column, lastFrozenColumnIndex, {
360
- type: 'ROW',
361
- row
362
- });
491
+ for (const column of colSpanColumns) {
492
+ const colIdx = column.idx;
493
+ if (colIdx > nextIdx) break;
494
+ const colSpan = getSelectedCellColSpan({
495
+ rows,
496
+ summaryRows,
497
+ rowIdx: nextRowIdx,
498
+ lastFrozenColumnIndex,
499
+ column,
500
+ isGroupRow
501
+ });
363
502
 
364
- if (colSpan && posIdx > colIdx && posIdx < colSpan + colIdx) {
365
- position.idx = colIdx + (moveRight ? colSpan : 0);
366
- break;
367
- }
503
+ if (colSpan && nextIdx > colIdx && nextIdx < colSpan + colIdx) {
504
+ nextIdx = colIdx + (moveRight ? colSpan : 0);
505
+ break;
368
506
  }
369
507
  }
370
508
  };
371
509
 
372
- if (isCellWithinBounds(position)) {
373
- setColSpan(position.idx - currentPosition.idx > 0);
510
+ if (isCellWithinBounds(nextPosition)) {
511
+ setColSpan(nextIdx - currentIdx > 0);
374
512
  }
375
513
 
376
514
  if (cellNavigationMode !== 'NONE') {
377
- const {
378
- idx,
379
- rowIdx
380
- } = nextPosition;
381
515
  const columnsCount = columns.length;
382
- const isAfterLastColumn = idx === columnsCount;
383
- const isBeforeFirstColumn = idx === -1;
516
+ const isAfterLastColumn = nextIdx === columnsCount;
517
+ const isBeforeFirstColumn = nextIdx === -1;
384
518
 
385
519
  if (isAfterLastColumn) {
386
520
  if (cellNavigationMode === 'CHANGE_ROW') {
387
- const isLastRow = rowIdx === rowsCount - 1;
521
+ const isLastRow = nextRowIdx === maxRowIdx;
388
522
 
389
523
  if (!isLastRow) {
390
- position = {
391
- idx: 0,
392
- rowIdx: rowIdx + 1
393
- };
524
+ nextIdx = 0;
525
+ nextRowIdx += 1;
394
526
  }
395
527
  } else {
396
- position = {
397
- rowIdx,
398
- idx: 0
399
- };
528
+ nextIdx = 0;
400
529
  }
401
-
402
- setColSpan(true);
403
530
  } else if (isBeforeFirstColumn) {
404
531
  if (cellNavigationMode === 'CHANGE_ROW') {
405
- const isFirstRow = rowIdx === 0;
532
+ const isFirstRow = nextRowIdx === minRowIdx;
406
533
 
407
534
  if (!isFirstRow) {
408
- position = {
409
- rowIdx: rowIdx - 1,
410
- idx: columnsCount - 1
411
- };
535
+ nextRowIdx -= 1;
536
+ nextIdx = columnsCount - 1;
412
537
  }
413
538
  } else {
414
- position = {
415
- rowIdx,
416
- idx: columnsCount - 1
417
- };
539
+ nextIdx = columnsCount - 1;
418
540
  }
419
- }
420
541
 
421
- setColSpan(false);
542
+ setColSpan(false);
543
+ }
422
544
  }
423
545
 
424
- return position;
546
+ return {
547
+ idx: nextIdx,
548
+ rowIdx: nextRowIdx
549
+ };
425
550
  }
426
551
  function canExitGrid({
427
552
  cellNavigationMode,
428
- columns,
429
- rowsCount,
553
+ maxColIdx,
554
+ minRowIdx,
555
+ maxRowIdx,
430
556
  selectedPosition: {
431
557
  rowIdx,
432
558
  idx
@@ -434,98 +560,65 @@
434
560
  shiftKey
435
561
  }) {
436
562
  if (cellNavigationMode === 'NONE' || cellNavigationMode === 'CHANGE_ROW') {
437
- const atLastCellInRow = idx === columns.length - 1;
563
+ const atLastCellInRow = idx === maxColIdx;
438
564
  const atFirstCellInRow = idx === 0;
439
- const atLastRow = rowIdx === rowsCount - 1;
440
- const atFirstRow = rowIdx === 0;
565
+ const atLastRow = rowIdx === maxRowIdx;
566
+ const atFirstRow = rowIdx === minRowIdx;
441
567
  return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;
442
568
  }
443
569
 
444
570
  return false;
445
571
  }
446
572
 
447
- const {
448
- min,
449
- max,
450
- floor,
451
- ceil,
452
- sign
453
- } = Math;
454
- function assertIsValidKeyGetter(keyGetter) {
455
- if (typeof keyGetter !== 'function') {
456
- throw new Error('Please specify the rowKeyGetter prop to use selection');
573
+ function getRowStyle(rowIdx, height) {
574
+ if (height !== undefined) {
575
+ return {
576
+ '--rdg-grid-row-start': rowIdx,
577
+ '--rdg-row-height': `${height}px`
578
+ };
457
579
  }
580
+
581
+ return {
582
+ '--rdg-grid-row-start': rowIdx
583
+ };
458
584
  }
459
585
  function getCellStyle(column, colSpan) {
460
586
  return {
461
587
  gridColumnStart: column.idx + 1,
462
588
  gridColumnEnd: colSpan !== undefined ? `span ${colSpan}` : undefined,
463
- left: column.frozen ? `var(--frozen-left-${column.key})` : undefined
589
+ insetInlineStart: column.frozen ? `var(--rdg-frozen-left-${column.idx})` : undefined
464
590
  };
465
591
  }
466
592
  function getCellClassname(column, ...extraClasses) {
467
593
  return clsx(cellClassname, ...extraClasses, column.frozen && cellFrozenClassname, column.isLastFrozenColumn && cellFrozenLastClassname);
468
594
  }
469
595
 
470
- const SELECT_COLUMN_KEY = 'select-row';
471
-
472
- function SelectFormatter(props) {
473
- const [isRowSelected, onRowSelectionChange] = useRowSelection();
474
- return /*#__PURE__*/e(SelectCellFormatter, {
475
- "aria-label": "Select",
476
- tabIndex: -1,
477
- isCellSelected: props.isCellSelected,
478
- value: isRowSelected,
479
- onClick: stopPropagation,
480
- onChange: (checked, isShiftClick) => {
481
- onRowSelectionChange({
482
- rowIdx: props.rowIdx,
483
- checked,
484
- isShiftClick
485
- });
486
- }
487
- });
488
- }
489
-
490
- function SelectGroupFormatter(props) {
491
- const [isRowSelected, onRowSelectionChange] = useRowSelection();
492
- return /*#__PURE__*/e(SelectCellFormatter, {
493
- "aria-label": "Select Group",
494
- tabIndex: -1,
495
- isCellSelected: props.isCellSelected,
496
- value: isRowSelected,
497
- onChange: checked => {
498
- onRowSelectionChange({
499
- checked,
500
- isShiftClick: false,
501
- rowIdx: props.rowIdx
502
- });
503
- },
504
- onClick: stopPropagation
505
- });
596
+ const {
597
+ min,
598
+ max,
599
+ round,
600
+ floor,
601
+ sign,
602
+ abs,
603
+ ceil
604
+ } = Math;
605
+ function assertIsValidKeyGetter(keyGetter) {
606
+ if (typeof keyGetter !== 'function') {
607
+ throw new Error('Please specify the rowKeyGetter prop to use selection');
608
+ }
506
609
  }
610
+ function clampColumnWidth(width, {
611
+ minWidth,
612
+ maxWidth
613
+ }) {
614
+ width = max(width, minWidth);
507
615
 
508
- const SelectColumn = {
509
- key: SELECT_COLUMN_KEY,
510
- name: '',
511
- width: 35,
512
- maxWidth: 35,
513
- resizable: false,
514
- sortable: false,
515
- frozen: true,
516
-
517
- headerRenderer(props) {
518
- return /*#__PURE__*/e(SelectCellFormatter, {
519
- "aria-label": "Select All",
520
- isCellSelected: false,
521
- value: props.allRowsSelected,
522
- onChange: props.onAllRowsSelectionChange
523
- });
524
- },
616
+ if (typeof maxWidth === 'number' && maxWidth > minWidth) {
617
+ return min(width, maxWidth);
618
+ }
525
619
 
526
- formatter: SelectFormatter,
527
- groupFormatter: SelectGroupFormatter
528
- };
620
+ return width;
621
+ }
529
622
 
530
623
  function useCalculatedColumns({
531
624
  rawColumns,
@@ -538,7 +631,9 @@
538
631
  }) {
539
632
  var _defaultColumnOptions, _defaultColumnOptions2, _defaultColumnOptions3, _defaultColumnOptions4;
540
633
 
541
- const minColumnWidth = (_defaultColumnOptions = defaultColumnOptions == null ? void 0 : defaultColumnOptions.minWidth) != null ? _defaultColumnOptions : 80;
634
+ const defaultWidth = defaultColumnOptions == null ? void 0 : defaultColumnOptions.width;
635
+ const defaultMinWidth = (_defaultColumnOptions = defaultColumnOptions == null ? void 0 : defaultColumnOptions.minWidth) != null ? _defaultColumnOptions : 80;
636
+ const defaultMaxWidth = defaultColumnOptions == null ? void 0 : defaultColumnOptions.maxWidth;
542
637
  const defaultFormatter = (_defaultColumnOptions2 = defaultColumnOptions == null ? void 0 : defaultColumnOptions.formatter) != null ? _defaultColumnOptions2 : ValueFormatter;
543
638
  const defaultSortable = (_defaultColumnOptions3 = defaultColumnOptions == null ? void 0 : defaultColumnOptions.sortable) != null ? _defaultColumnOptions3 : false;
544
639
  const defaultResizable = (_defaultColumnOptions4 = defaultColumnOptions == null ? void 0 : defaultColumnOptions.resizable) != null ? _defaultColumnOptions4 : false;
@@ -551,7 +646,7 @@
551
646
  const groupBy = [];
552
647
  let lastFrozenColumnIndex = -1;
553
648
  const columns = rawColumns.map(rawColumn => {
554
- var _rawGroupBy$includes, _rawColumn$sortable, _rawColumn$resizable, _rawColumn$formatter;
649
+ var _rawGroupBy$includes, _rawColumn$width, _rawColumn$minWidth, _rawColumn$maxWidth, _rawColumn$sortable, _rawColumn$resizable, _rawColumn$formatter;
555
650
 
556
651
  const rowGroup = (_rawGroupBy$includes = rawGroupBy == null ? void 0 : rawGroupBy.includes(rawColumn.key)) != null ? _rawGroupBy$includes : false;
557
652
  const frozen = rowGroup || rawColumn.frozen || false;
@@ -560,6 +655,9 @@
560
655
  frozen,
561
656
  isLastFrozenColumn: false,
562
657
  rowGroup,
658
+ width: (_rawColumn$width = rawColumn.width) != null ? _rawColumn$width : defaultWidth,
659
+ minWidth: (_rawColumn$minWidth = rawColumn.minWidth) != null ? _rawColumn$minWidth : defaultMinWidth,
660
+ maxWidth: (_rawColumn$maxWidth = rawColumn.maxWidth) != null ? _rawColumn$maxWidth : defaultMaxWidth,
563
661
  sortable: (_rawColumn$sortable = rawColumn.sortable) != null ? _rawColumn$sortable : defaultSortable,
564
662
  resizable: (_rawColumn$resizable = rawColumn.resizable) != null ? _rawColumn$resizable : defaultResizable,
565
663
  formatter: (_rawColumn$formatter = rawColumn.formatter) != null ? _rawColumn$formatter : defaultFormatter
@@ -628,16 +726,14 @@
628
726
  lastFrozenColumnIndex,
629
727
  groupBy
630
728
  };
631
- }, [rawColumns, defaultFormatter, defaultResizable, defaultSortable, rawGroupBy]);
729
+ }, [rawColumns, defaultWidth, defaultMinWidth, defaultMaxWidth, defaultFormatter, defaultResizable, defaultSortable, rawGroupBy]);
632
730
  const {
633
731
  layoutCssVars,
634
- totalColumnWidth,
635
732
  totalFrozenColumnWidth,
636
733
  columnMetrics
637
734
  } = _(() => {
638
735
  const columnMetrics = new Map();
639
736
  let left = 0;
640
- let totalColumnWidth = 0;
641
737
  let totalFrozenColumnWidth = 0;
642
738
  let templateColumns = '';
643
739
  let allocatedWidth = 0;
@@ -649,7 +745,7 @@
649
745
  if (width === undefined) {
650
746
  unassignedColumnsCount++;
651
747
  } else {
652
- width = clampColumnWidth(width, column, minColumnWidth);
748
+ width = clampColumnWidth(width, column);
653
749
  allocatedWidth += width;
654
750
  columnMetrics.set(column, {
655
751
  width,
@@ -658,9 +754,6 @@
658
754
  }
659
755
  }
660
756
 
661
- const unallocatedWidth = viewportWidth - allocatedWidth;
662
- const unallocatedColumnWidth = unallocatedWidth / unassignedColumnsCount;
663
-
664
757
  for (const column of columns) {
665
758
  let width;
666
759
 
@@ -671,14 +764,17 @@
671
764
  width
672
765
  } = columnMetric);
673
766
  } else {
674
- width = clampColumnWidth(unallocatedColumnWidth, column, minColumnWidth);
767
+ const unallocatedWidth = viewportWidth - allocatedWidth;
768
+ const unallocatedColumnWidth = round(unallocatedWidth / unassignedColumnsCount);
769
+ width = clampColumnWidth(unallocatedColumnWidth, column);
770
+ allocatedWidth += width;
771
+ unassignedColumnsCount--;
675
772
  columnMetrics.set(column, {
676
773
  width,
677
774
  left
678
775
  });
679
776
  }
680
777
 
681
- totalColumnWidth += width;
682
778
  left += width;
683
779
  templateColumns += `${width}px `;
684
780
  }
@@ -689,21 +785,20 @@
689
785
  }
690
786
 
691
787
  const layoutCssVars = {
692
- '--template-columns': templateColumns
788
+ gridTemplateColumns: templateColumns
693
789
  };
694
790
 
695
791
  for (let i = 0; i <= lastFrozenColumnIndex; i++) {
696
792
  const column = columns[i];
697
- layoutCssVars[`--frozen-left-${column.key}`] = `${columnMetrics.get(column).left}px`;
793
+ layoutCssVars[`--rdg-frozen-left-${column.idx}`] = `${columnMetrics.get(column).left}px`;
698
794
  }
699
795
 
700
796
  return {
701
797
  layoutCssVars,
702
- totalColumnWidth,
703
798
  totalFrozenColumnWidth,
704
799
  columnMetrics
705
800
  };
706
- }, [columnWidths, columns, viewportWidth, minColumnWidth, lastFrozenColumnIndex]);
801
+ }, [columnWidths, columns, viewportWidth, lastFrozenColumnIndex]);
707
802
  const [colOverscanStartIdx, colOverscanEndIdx] = _(() => {
708
803
  if (!enableVirtualization) {
709
804
  return [0, columns.length - 1];
@@ -759,7 +854,6 @@
759
854
  colOverscanEndIdx,
760
855
  layoutCssVars,
761
856
  columnMetrics,
762
- totalColumnWidth,
763
857
  lastFrozenColumnIndex,
764
858
  totalFrozenColumnWidth,
765
859
  groupBy
@@ -785,42 +879,44 @@
785
879
  return undefined;
786
880
  }
787
881
 
788
- function clampColumnWidth(width, {
789
- minWidth,
790
- maxWidth
791
- }, minColumnWidth) {
792
- width = max(width, minWidth != null ? minWidth : minColumnWidth);
793
-
794
- if (typeof maxWidth === 'number') {
795
- return min(width, maxWidth);
796
- }
797
-
798
- return width;
799
- }
800
-
801
882
  function useGridDimensions() {
802
883
  const gridRef = h(null);
803
- const [gridWidth, setGridWidth] = m(1);
804
- const [gridHeight, setGridHeight] = m(1);
805
- d(() => {
884
+ const [inlineSize, setInlineSize] = m(1);
885
+ const [blockSize, setBlockSize] = m(1);
886
+ useLayoutEffect(() => {
806
887
  const {
807
888
  ResizeObserver
808
889
  } = window;
809
890
  if (ResizeObserver == null) return;
810
- const resizeObserver = new ResizeObserver(() => {
811
- const {
812
- clientWidth,
813
- clientHeight
814
- } = gridRef.current;
815
- setGridWidth(clientWidth - (devicePixelRatio % 0.5 === 0 ? 0 : 1));
816
- setGridHeight(clientHeight);
891
+ const {
892
+ clientWidth,
893
+ clientHeight,
894
+ offsetWidth,
895
+ offsetHeight
896
+ } = gridRef.current;
897
+ const {
898
+ width,
899
+ height
900
+ } = gridRef.current.getBoundingClientRect();
901
+ const initialWidth = width - offsetWidth + clientWidth;
902
+ const initialHeight = height - offsetHeight + clientHeight;
903
+ setInlineSize(handleDevicePixelRatio(initialWidth));
904
+ setBlockSize(initialHeight);
905
+ const resizeObserver = new ResizeObserver(entries => {
906
+ const size = entries[0].contentBoxSize[0];
907
+ setInlineSize(handleDevicePixelRatio(size.inlineSize));
908
+ setBlockSize(size.blockSize);
817
909
  });
818
910
  resizeObserver.observe(gridRef.current);
819
911
  return () => {
820
912
  resizeObserver.disconnect();
821
913
  };
822
914
  }, []);
823
- return [gridRef, gridWidth, gridHeight];
915
+ return [gridRef, inlineSize, blockSize];
916
+ }
917
+
918
+ function handleDevicePixelRatio(size) {
919
+ return size - (devicePixelRatio === 1 ? 0 : ceil(devicePixelRatio));
824
920
  }
825
921
 
826
922
  function useLatestFunc(fn) {
@@ -833,19 +929,32 @@
833
929
  }, []);
834
930
  }
835
931
 
836
- const RowSelectionContext = /*#__PURE__*/D$1(undefined);
837
- const RowSelectionProvider = RowSelectionContext.Provider;
838
- const RowSelectionChangeContext = /*#__PURE__*/D$1(undefined);
839
- const RowSelectionChangeProvider = RowSelectionChangeContext.Provider;
840
- function useRowSelection() {
841
- const rowSelectionContext = F(RowSelectionContext);
842
- const rowSelectionChangeContext = F(RowSelectionChangeContext);
932
+ function useRovingCellRef(isSelected) {
933
+ const [isChildFocused, setIsChildFocused] = m(false);
843
934
 
844
- if (rowSelectionContext === undefined || rowSelectionChangeContext === undefined) {
845
- throw new Error('useRowSelection must be used within DataGrid cells');
935
+ if (isChildFocused && !isSelected) {
936
+ setIsChildFocused(false);
846
937
  }
847
938
 
848
- return [rowSelectionContext, rowSelectionChangeContext];
939
+ const ref = A$1(cell => {
940
+ if (cell === null || cell.contains(document.activeElement)) return;
941
+ cell.focus({
942
+ preventScroll: true
943
+ });
944
+ }, []);
945
+
946
+ function onFocus(event) {
947
+ if (event.target !== event.currentTarget) {
948
+ setIsChildFocused(true);
949
+ }
950
+ }
951
+
952
+ const isFocused = isSelected && !isChildFocused;
953
+ return {
954
+ ref: isSelected ? ref : undefined,
955
+ tabIndex: isFocused ? 0 : -1,
956
+ onFocus: isSelected ? onFocus : undefined
957
+ };
849
958
  }
850
959
 
851
960
  function useViewportColumns({
@@ -922,8 +1031,6 @@
922
1031
  }, [startIdx, colOverscanEndIdx, columns]);
923
1032
  }
924
1033
 
925
- const RENDER_BATCH_SIZE = 8;
926
-
927
1034
  function isReadonlyArray(arr) {
928
1035
  return Array.isArray(arr);
929
1036
  }
@@ -1010,6 +1117,7 @@
1010
1117
  }, [expandedGroupIds, groupedRows, rawRows]);
1011
1118
  const {
1012
1119
  totalRowHeight,
1120
+ gridTemplateRows,
1013
1121
  getRowTop,
1014
1122
  getRowHeight,
1015
1123
  findRowIdx
@@ -1017,6 +1125,7 @@
1017
1125
  if (typeof rowHeight === 'number') {
1018
1126
  return {
1019
1127
  totalRowHeight: rowHeight * rows.length,
1128
+ gridTemplateRows: ` repeat(${rows.length}, ${rowHeight}px)`,
1020
1129
  getRowTop: rowIdx => rowIdx * rowHeight,
1021
1130
  getRowHeight: () => rowHeight,
1022
1131
  findRowIdx: offset => floor(offset / rowHeight)
@@ -1024,6 +1133,7 @@
1024
1133
  }
1025
1134
 
1026
1135
  let totalRowHeight = 0;
1136
+ let gridTemplateRows = ' ';
1027
1137
  const rowPositions = rows.map(row => {
1028
1138
  const currentRowHeight = isGroupRow(row) ? rowHeight({
1029
1139
  type: 'GROUP',
@@ -1036,6 +1146,7 @@
1036
1146
  top: totalRowHeight,
1037
1147
  height: currentRowHeight
1038
1148
  };
1149
+ gridTemplateRows += `${currentRowHeight}px `;
1039
1150
  totalRowHeight += currentRowHeight;
1040
1151
  return position;
1041
1152
  });
@@ -1046,6 +1157,7 @@
1046
1157
 
1047
1158
  return {
1048
1159
  totalRowHeight,
1160
+ gridTemplateRows,
1049
1161
  getRowTop: rowIdx => rowPositions[validateRowIdx(rowIdx)].top,
1050
1162
  getRowHeight: rowIdx => rowPositions[validateRowIdx(rowIdx)].height,
1051
1163
 
@@ -1072,32 +1184,24 @@
1072
1184
 
1073
1185
  };
1074
1186
  }, [isGroupRow, rowHeight, rows]);
1187
+ let rowOverscanStartIdx = 0;
1188
+ let rowOverscanEndIdx = rows.length - 1;
1075
1189
 
1076
- if (!enableVirtualization) {
1077
- return {
1078
- rowOverscanStartIdx: 0,
1079
- rowOverscanEndIdx: rows.length - 1,
1080
- rows,
1081
- rowsCount,
1082
- totalRowHeight,
1083
- isGroupRow,
1084
- getRowTop,
1085
- getRowHeight,
1086
- findRowIdx
1087
- };
1190
+ if (enableVirtualization) {
1191
+ const overscanThreshold = 4;
1192
+ const rowVisibleStartIdx = findRowIdx(scrollTop);
1193
+ const rowVisibleEndIdx = findRowIdx(scrollTop + clientHeight);
1194
+ rowOverscanStartIdx = max(0, rowVisibleStartIdx - overscanThreshold);
1195
+ rowOverscanEndIdx = min(rows.length - 1, rowVisibleEndIdx + overscanThreshold);
1088
1196
  }
1089
1197
 
1090
- const overscanThreshold = 4;
1091
- const rowVisibleStartIdx = findRowIdx(scrollTop);
1092
- const rowVisibleEndIdx = min(rows.length - 1, findRowIdx(scrollTop + clientHeight));
1093
- const rowOverscanStartIdx = max(0, floor((rowVisibleStartIdx - overscanThreshold) / RENDER_BATCH_SIZE) * RENDER_BATCH_SIZE);
1094
- const rowOverscanEndIdx = min(rows.length - 1, ceil((rowVisibleEndIdx + overscanThreshold) / RENDER_BATCH_SIZE) * RENDER_BATCH_SIZE);
1095
1198
  return {
1096
1199
  rowOverscanStartIdx,
1097
1200
  rowOverscanEndIdx,
1098
1201
  rows,
1099
1202
  rowsCount,
1100
1203
  totalRowHeight,
1204
+ gridTemplateRows,
1101
1205
  isGroupRow,
1102
1206
  getRowTop,
1103
1207
  getRowHeight,
@@ -1105,53 +1209,107 @@
1105
1209
  };
1106
1210
  }
1107
1211
 
1108
- var css_248z$4 = ".h13yq3r8700-canary49{cursor:pointer;display:flex}.ht6rdyl700-canary49{flex-grow:1;overflow:hidden;overflow:clip;text-overflow:ellipsis}";
1109
- styleInject$1(css_248z$4);
1212
+ var css_248z$a = ".h1tr5c9i700-beta12{cursor:pointer;display:flex}.h1tr5c9i700-beta12:focus{outline:none}.h19r0msv700-beta12{flex-grow:1;overflow:hidden;overflow:clip;text-overflow:ellipsis}";
1213
+ styleInject$1(css_248z$a,{"insertAt":"top"});
1110
1214
 
1111
- const headerSortCell = "h13yq3r8700-canary49";
1215
+ const headerSortCell = "h1tr5c9i700-beta12";
1112
1216
  const headerSortCellClassname = `rdg-header-sort-cell ${headerSortCell}`;
1113
- const headerSortName = "ht6rdyl700-canary49";
1217
+ const headerSortName = "h19r0msv700-beta12";
1114
1218
  const headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;
1219
+ function HeaderRenderer({
1220
+ column,
1221
+ sortDirection,
1222
+ priority,
1223
+ onSort,
1224
+ isCellSelected
1225
+ }) {
1226
+ if (!column.sortable) return /*#__PURE__*/e(d$1, {
1227
+ children: column.name
1228
+ });
1229
+ return /*#__PURE__*/e(SortableHeaderCell, {
1230
+ onSort: onSort,
1231
+ sortDirection: sortDirection,
1232
+ priority: priority,
1233
+ isCellSelected: isCellSelected,
1234
+ children: column.name
1235
+ });
1236
+ }
1237
+
1115
1238
  function SortableHeaderCell({
1116
1239
  onSort,
1117
1240
  sortDirection,
1118
1241
  priority,
1119
- children
1242
+ children,
1243
+ isCellSelected
1120
1244
  }) {
1121
- let sortText = '';
1245
+ const SortIcon = useDefaultComponents().sortIcon;
1246
+ const {
1247
+ ref,
1248
+ tabIndex
1249
+ } = useFocusRef(isCellSelected);
1250
+
1251
+ function handleKeyDown(event) {
1252
+ if (event.key === ' ' || event.key === 'Enter') {
1253
+ event.preventDefault();
1254
+ onSort(event.ctrlKey || event.metaKey);
1255
+ }
1256
+ }
1122
1257
 
1123
- if (sortDirection === 'ASC') {
1124
- sortText = '\u25B2';
1125
- } else if (sortDirection === 'DESC') {
1126
- sortText = '\u25BC';
1258
+ function handleClick(event) {
1259
+ onSort(event.ctrlKey || event.metaKey);
1127
1260
  }
1128
1261
 
1129
1262
  return /*#__PURE__*/e("span", {
1263
+ ref: ref,
1264
+ tabIndex: tabIndex,
1130
1265
  className: headerSortCellClassname,
1131
- onClick: e => onSort(e.ctrlKey),
1266
+ onClick: handleClick,
1267
+ onKeyDown: handleKeyDown,
1132
1268
  children: [/*#__PURE__*/e("span", {
1133
1269
  className: headerSortNameClassname,
1134
1270
  children: children
1135
1271
  }), /*#__PURE__*/e("span", {
1136
- children: [sortText, priority]
1272
+ children: [/*#__PURE__*/e(SortIcon, {
1273
+ sortDirection: sortDirection
1274
+ }), priority]
1137
1275
  })]
1138
1276
  });
1139
1277
  }
1140
1278
 
1141
- var css_248z$3 = ".celq7o9700-canary49:after{content:\"\";cursor:col-resize;position:absolute;top:0;right:0;bottom:0;width:10px}";
1142
- styleInject$1(css_248z$3);
1279
+ var css_248z$9 = ".celq7o9700-beta12{touch-action:none}.celq7o9700-beta12:after{content:\"\";cursor:col-resize;inline-size:10px;inset-block-end:0;inset-block-start:0;inset-inline-end:0;position:absolute}";
1280
+ styleInject$1(css_248z$9,{"insertAt":"top"});
1143
1281
 
1144
- const cellResizable = "celq7o9700-canary49";
1282
+ const cellResizable = "celq7o9700-beta12";
1145
1283
  const cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;
1146
1284
  function HeaderCell({
1147
1285
  column,
1148
1286
  colSpan,
1149
- onResize,
1287
+ isCellSelected,
1288
+ onColumnResize,
1150
1289
  allRowsSelected,
1151
1290
  onAllRowsSelectionChange,
1152
1291
  sortColumns,
1153
- onSortColumnsChange
1292
+ onSortColumnsChange,
1293
+ selectCell,
1294
+ shouldFocusGrid,
1295
+ direction
1154
1296
  }) {
1297
+ var _column$headerRendere, _column$maxWidth;
1298
+
1299
+ const isRtl = direction === 'rtl';
1300
+ const {
1301
+ ref,
1302
+ tabIndex,
1303
+ onFocus
1304
+ } = useRovingCellRef(isCellSelected);
1305
+ const sortIndex = sortColumns == null ? void 0 : sortColumns.findIndex(sort => sort.columnKey === column.key);
1306
+ const sortColumn = sortIndex !== undefined && sortIndex > -1 ? sortColumns[sortIndex] : undefined;
1307
+ const sortDirection = sortColumn == null ? void 0 : sortColumn.direction;
1308
+ const priority = sortColumn !== undefined && sortColumns.length > 1 ? sortIndex + 1 : undefined;
1309
+ const ariaSort = sortDirection && !priority ? sortDirection === 'ASC' ? 'ascending' : 'descending' : undefined;
1310
+ const className = getCellClassname(column, column.headerCellClass, column.resizable && cellResizableClassname);
1311
+ const HeaderRenderer$1 = (_column$headerRendere = column.headerRenderer) != null ? _column$headerRendere : HeaderRenderer;
1312
+
1155
1313
  function onPointerDown(event) {
1156
1314
  if (event.pointerType === 'mouse' && event.buttons !== 1) {
1157
1315
  return;
@@ -1162,47 +1320,38 @@
1162
1320
  pointerId
1163
1321
  } = event;
1164
1322
  const {
1165
- right
1323
+ right,
1324
+ left
1166
1325
  } = currentTarget.getBoundingClientRect();
1167
- const offset = right - event.clientX;
1326
+ const offset = isRtl ? event.clientX - left : right - event.clientX;
1168
1327
 
1169
1328
  if (offset > 11) {
1170
1329
  return;
1171
1330
  }
1172
1331
 
1173
1332
  function onPointerMove(event) {
1174
- if (event.pointerId !== pointerId) return;
1175
-
1176
- if (event.pointerType === 'mouse' && event.buttons !== 1) {
1177
- onPointerUp(event);
1178
- return;
1179
- }
1180
-
1181
- const width = event.clientX + offset - currentTarget.getBoundingClientRect().left;
1333
+ const {
1334
+ right,
1335
+ left
1336
+ } = currentTarget.getBoundingClientRect();
1337
+ const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left;
1182
1338
 
1183
1339
  if (width > 0) {
1184
- onResize(column, width);
1340
+ onColumnResize(column, clampColumnWidth(width, column));
1185
1341
  }
1186
1342
  }
1187
1343
 
1188
- function onPointerUp(event) {
1189
- if (event.pointerId !== pointerId) return;
1190
- window.removeEventListener('pointermove', onPointerMove);
1191
- window.removeEventListener('pointerup', onPointerUp);
1344
+ function onLostPointerCapture() {
1345
+ currentTarget.removeEventListener('pointermove', onPointerMove);
1346
+ currentTarget.removeEventListener('lostpointercapture', onLostPointerCapture);
1192
1347
  }
1193
1348
 
1194
- event.preventDefault();
1195
- window.addEventListener('pointermove', onPointerMove);
1196
- window.addEventListener('pointerup', onPointerUp);
1349
+ currentTarget.setPointerCapture(pointerId);
1350
+ currentTarget.addEventListener('pointermove', onPointerMove);
1351
+ currentTarget.addEventListener('lostpointercapture', onLostPointerCapture);
1197
1352
  }
1198
1353
 
1199
- const sortIndex = sortColumns == null ? void 0 : sortColumns.findIndex(sort => sort.columnKey === column.key);
1200
- const sortColumn = sortIndex !== undefined && sortIndex > -1 ? sortColumns[sortIndex] : undefined;
1201
- const sortDirection = sortColumn == null ? void 0 : sortColumn.direction;
1202
- const priority = sortColumn !== undefined && sortColumns.length > 1 ? sortIndex + 1 : undefined;
1203
- const ariaSort = sortDirection && !priority ? sortDirection === 'ASC' ? 'ascending' : 'descending' : undefined;
1204
-
1205
- const onSort = ctrlClick => {
1354
+ function onSort(ctrlClick) {
1206
1355
  if (onSortColumnsChange == null) return;
1207
1356
  const {
1208
1357
  sortDescendingFirst
@@ -1238,62 +1387,82 @@
1238
1387
  onSortColumnsChange(nextSortColumn ? [nextSortColumn] : []);
1239
1388
  }
1240
1389
  }
1241
- };
1390
+ }
1242
1391
 
1243
- function getCell() {
1244
- if (column.headerRenderer) {
1245
- return /*#__PURE__*/e(column.headerRenderer, {
1246
- column: column,
1247
- sortDirection: sortDirection,
1248
- priority: priority,
1249
- onSort: onSort,
1250
- allRowsSelected: allRowsSelected,
1251
- onAllRowsSelectionChange: onAllRowsSelectionChange
1252
- });
1253
- }
1392
+ function onClick() {
1393
+ selectCell(column.idx);
1394
+ }
1254
1395
 
1255
- if (column.sortable) {
1256
- return /*#__PURE__*/e(SortableHeaderCell, {
1257
- onSort: onSort,
1258
- sortDirection: sortDirection,
1259
- priority: priority,
1260
- children: column.name
1261
- });
1396
+ function onDoubleClick(event) {
1397
+ const {
1398
+ right,
1399
+ left
1400
+ } = event.currentTarget.getBoundingClientRect();
1401
+ const offset = isRtl ? event.clientX - left : right - event.clientX;
1402
+
1403
+ if (offset > 11) {
1404
+ return;
1262
1405
  }
1263
1406
 
1264
- return column.name;
1407
+ onColumnResize(column, 'auto');
1408
+ }
1409
+
1410
+ function handleFocus(event) {
1411
+ onFocus == null ? void 0 : onFocus(event);
1412
+
1413
+ if (shouldFocusGrid) {
1414
+ selectCell(0);
1415
+ }
1265
1416
  }
1266
1417
 
1267
- const className = getCellClassname(column, column.headerCellClass, column.resizable && cellResizableClassname);
1268
1418
  return /*#__PURE__*/e("div", {
1269
1419
  role: "columnheader",
1270
1420
  "aria-colindex": column.idx + 1,
1421
+ "aria-selected": isCellSelected,
1271
1422
  "aria-sort": ariaSort,
1272
1423
  "aria-colspan": colSpan,
1424
+ ref: ref,
1425
+ tabIndex: shouldFocusGrid ? 0 : tabIndex,
1273
1426
  className: className,
1274
- style: getCellStyle(column, colSpan),
1427
+ style: { ...getCellStyle(column, colSpan),
1428
+ minWidth: column.minWidth,
1429
+ maxWidth: (_column$maxWidth = column.maxWidth) != null ? _column$maxWidth : undefined
1430
+ },
1431
+ onFocus: handleFocus,
1432
+ onClick: onClick,
1433
+ onDoubleClick: column.resizable ? onDoubleClick : undefined,
1275
1434
  onPointerDown: column.resizable ? onPointerDown : undefined,
1276
- children: getCell()
1435
+ children: /*#__PURE__*/e(HeaderRenderer$1, {
1436
+ column: column,
1437
+ sortDirection: sortDirection,
1438
+ priority: priority,
1439
+ onSort: onSort,
1440
+ allRowsSelected: allRowsSelected,
1441
+ onAllRowsSelectionChange: onAllRowsSelectionChange,
1442
+ isCellSelected: isCellSelected
1443
+ })
1277
1444
  });
1278
1445
  }
1279
1446
 
1447
+ var css_248z$8 = ".h197vzie700-beta12{background-color:var(--rdg-header-background-color);display:contents;font-weight:700;line-height:var(--rdg-header-row-height)}.h197vzie700-beta12>.c1wupbe700-beta12{inset-block-start:0;position:sticky;z-index:2}.h197vzie700-beta12>.c1730fa4700-beta12{z-index:3}";
1448
+ styleInject$1(css_248z$8,{"insertAt":"top"});
1449
+
1450
+ const headerRow = "h197vzie700-beta12";
1451
+ const headerRowClassname = `rdg-header-row ${headerRow}`;
1452
+
1280
1453
  function HeaderRow({
1281
1454
  columns,
1282
- rows,
1283
- rowKeyGetter,
1284
- onSelectedRowsChange,
1285
1455
  allRowsSelected,
1456
+ onAllRowsSelectionChange,
1286
1457
  onColumnResize,
1287
1458
  sortColumns,
1288
1459
  onSortColumnsChange,
1289
- lastFrozenColumnIndex
1460
+ lastFrozenColumnIndex,
1461
+ selectedCellIdx,
1462
+ selectCell,
1463
+ shouldFocusGrid,
1464
+ direction
1290
1465
  }) {
1291
- const handleAllRowsSelectionChange = A$1(checked => {
1292
- if (!onSelectedRowsChange) return;
1293
- assertIsValidKeyGetter(rowKeyGetter);
1294
- const newSelectedRows = new Set(checked ? rows.map(rowKeyGetter) : undefined);
1295
- onSelectedRowsChange(newSelectedRows);
1296
- }, [onSelectedRowsChange, rows, rowKeyGetter]);
1297
1466
  const cells = [];
1298
1467
 
1299
1468
  for (let index = 0; index < columns.length; index++) {
@@ -1309,84 +1478,79 @@
1309
1478
  cells.push( /*#__PURE__*/e(HeaderCell, {
1310
1479
  column: column,
1311
1480
  colSpan: colSpan,
1312
- onResize: onColumnResize,
1481
+ isCellSelected: selectedCellIdx === column.idx,
1482
+ onColumnResize: onColumnResize,
1313
1483
  allRowsSelected: allRowsSelected,
1314
- onAllRowsSelectionChange: handleAllRowsSelectionChange,
1484
+ onAllRowsSelectionChange: onAllRowsSelectionChange,
1315
1485
  onSortColumnsChange: onSortColumnsChange,
1316
- sortColumns: sortColumns
1486
+ sortColumns: sortColumns,
1487
+ selectCell: selectCell,
1488
+ shouldFocusGrid: shouldFocusGrid && index === 0,
1489
+ direction: direction
1317
1490
  }, column.key));
1318
1491
  }
1319
1492
 
1320
1493
  return /*#__PURE__*/e("div", {
1321
1494
  role: "row",
1322
1495
  "aria-rowindex": 1,
1323
- className: headerRowClassname,
1496
+ className: clsx(headerRowClassname, selectedCellIdx === -1 && rowSelectedClassname),
1497
+ style: getRowStyle(1),
1324
1498
  children: cells
1325
1499
  });
1326
1500
  }
1327
1501
 
1328
1502
  const HeaderRow$1 = /*#__PURE__*/g(HeaderRow);
1329
1503
 
1330
- 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)}";
1331
- styleInject$1(css_248z$2);
1504
+ var css_248z$7 = ".c1bmg16t700-beta12,.ccpfvsn700-beta12{background-color:#ccf}.c1bmg16t700-beta12.ccpfvsn700-beta12{background-color:#99f}";
1505
+ styleInject$1(css_248z$7,{"insertAt":"top"});
1332
1506
 
1333
- const cellCopied = "ccpfvsn700-canary49";
1507
+ const cellCopied = "ccpfvsn700-beta12";
1334
1508
  const cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;
1335
- const cellDraggedOver = "c1bmg16t700-canary49";
1509
+ const cellDraggedOver = "c1bmg16t700-beta12";
1336
1510
  const cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;
1337
- const cellDragHandle = "c12t67zz700-canary49";
1338
- const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
1339
1511
 
1340
1512
  function Cell({
1341
- className,
1342
1513
  column,
1343
1514
  colSpan,
1344
1515
  isCellSelected,
1345
1516
  isCopied,
1346
1517
  isDraggedOver,
1347
1518
  row,
1348
- rowIdx,
1349
- dragHandleProps,
1519
+ dragHandle,
1350
1520
  onRowClick,
1351
- onClick,
1352
- onDoubleClick,
1353
- onContextMenu,
1521
+ onRowDoubleClick,
1354
1522
  onRowChange,
1355
1523
  selectCell,
1356
1524
  ...props
1357
- }, ref) {
1525
+ }) {
1526
+ const {
1527
+ ref,
1528
+ tabIndex,
1529
+ onFocus
1530
+ } = useRovingCellRef(isCellSelected);
1358
1531
  const {
1359
1532
  cellClass
1360
1533
  } = column;
1361
- className = getCellClassname(column, typeof cellClass === 'function' ? cellClass(row) : cellClass, className, isCopied && cellCopiedClassname, isDraggedOver && cellDraggedOverClassname);
1534
+ const className = getCellClassname(column, typeof cellClass === 'function' ? cellClass(row) : cellClass, isCopied && cellCopiedClassname, isDraggedOver && cellDraggedOverClassname);
1362
1535
 
1363
1536
  function selectCellWrapper(openEditor) {
1364
- selectCell({
1365
- idx: column.idx,
1366
- rowIdx
1367
- }, openEditor);
1537
+ selectCell(row, column, openEditor);
1368
1538
  }
1369
1539
 
1370
- function handleClick(event) {
1540
+ function handleClick() {
1371
1541
  var _column$editorOptions;
1372
1542
 
1373
1543
  selectCellWrapper((_column$editorOptions = column.editorOptions) == null ? void 0 : _column$editorOptions.editOnClick);
1374
- onRowClick == null ? void 0 : onRowClick(rowIdx, row, column);
1375
- onClick == null ? void 0 : onClick(event);
1544
+ onRowClick == null ? void 0 : onRowClick(row, column);
1376
1545
  }
1377
1546
 
1378
- function handleContextMenu(event) {
1547
+ function handleContextMenu() {
1379
1548
  selectCellWrapper();
1380
- onContextMenu == null ? void 0 : onContextMenu(event);
1381
1549
  }
1382
1550
 
1383
- function handleDoubleClick(event) {
1551
+ function handleDoubleClick() {
1384
1552
  selectCellWrapper(true);
1385
- onDoubleClick == null ? void 0 : onDoubleClick(event);
1386
- }
1387
-
1388
- function handleRowChange(newRow) {
1389
- onRowChange(rowIdx, newRow);
1553
+ onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, column);
1390
1554
  }
1391
1555
 
1392
1556
  return /*#__PURE__*/e("div", {
@@ -1396,135 +1560,67 @@
1396
1560
  "aria-colspan": colSpan,
1397
1561
  "aria-readonly": !isCellEditable(column, row) || undefined,
1398
1562
  ref: ref,
1563
+ tabIndex: tabIndex,
1399
1564
  className: className,
1400
1565
  style: getCellStyle(column, colSpan),
1401
1566
  onClick: handleClick,
1402
1567
  onDoubleClick: handleDoubleClick,
1403
1568
  onContextMenu: handleContextMenu,
1569
+ onFocus: onFocus,
1404
1570
  ...props,
1405
1571
  children: !column.rowGroup && /*#__PURE__*/e(d$1, {
1406
1572
  children: [/*#__PURE__*/e(column.formatter, {
1407
1573
  column: column,
1408
- rowIdx: rowIdx,
1409
1574
  row: row,
1410
1575
  isCellSelected: isCellSelected,
1411
- onRowChange: handleRowChange
1412
- }), dragHandleProps && /*#__PURE__*/e("div", {
1413
- className: cellDragHandleClassname,
1414
- ...dragHandleProps
1415
- })]
1576
+ onRowChange: onRowChange
1577
+ }), dragHandle]
1416
1578
  })
1417
1579
  });
1418
1580
  }
1419
1581
 
1420
- const Cell$1 = /*#__PURE__*/g( /*#__PURE__*/x(Cell));
1421
-
1422
- var css_248z$1 = ".c1tngyp1700-canary49{padding:0}";
1423
- styleInject$1(css_248z$1);
1424
-
1425
- const cellEditing = "c1tngyp1700-canary49";
1426
- const cellEditingClassname = `rdg-editor-container ${cellEditing}`;
1427
- function EditCell({
1428
- column,
1429
- colSpan,
1430
- row,
1431
- rowIdx,
1432
- onRowChange,
1433
- onClose,
1434
- onKeyDown,
1435
- editorPortalTarget
1436
- }) {
1437
- const frameRequestRef = h();
1438
- const commitOnOutsideMouseDown = useLatestFunc(() => {
1439
- onRowChange(row, true);
1440
- });
1441
-
1442
- function cancelFrameRequest() {
1443
- cancelAnimationFrame(frameRequestRef.current);
1444
- }
1445
-
1446
- y(() => {
1447
- function onWindowCaptureMouseDown() {
1448
- frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);
1449
- }
1450
-
1451
- addEventListener('mousedown', onWindowCaptureMouseDown, {
1452
- capture: true
1453
- });
1454
- return () => {
1455
- removeEventListener('mousedown', onWindowCaptureMouseDown, {
1456
- capture: true
1457
- });
1458
- cancelFrameRequest();
1459
- };
1460
- }, [commitOnOutsideMouseDown]);
1461
- const {
1462
- cellClass
1463
- } = column;
1464
- const className = getCellClassname(column, cellEditingClassname, typeof cellClass === 'function' ? cellClass(row) : cellClass);
1465
- let content;
1466
-
1467
- if (column.editor != null) {
1468
- var _column$editorOptions;
1469
-
1470
- content = /*#__PURE__*/e(column.editor, {
1471
- column: column,
1472
- row: row,
1473
- rowIdx: rowIdx,
1474
- onRowChange: onRowChange,
1475
- onClose: onClose,
1476
- editorPortalTarget: editorPortalTarget
1477
- });
1478
-
1479
- if ((_column$editorOptions = column.editorOptions) != null && _column$editorOptions.createPortal) {
1480
- content = /*#__PURE__*/W(content, editorPortalTarget);
1481
- }
1482
- }
1483
-
1484
- return /*#__PURE__*/e("div", {
1485
- role: "gridcell",
1486
- "aria-colindex": column.idx + 1,
1487
- "aria-selected": true,
1488
- className: className,
1489
- style: getCellStyle(column, colSpan),
1490
- onKeyDown: onKeyDown,
1491
- onMouseDownCapture: cancelFrameRequest,
1492
- children: content
1493
- });
1494
- }
1582
+ const Cell$1 = /*#__PURE__*/g(Cell);
1495
1583
 
1496
1584
  function Row({
1497
- cellRenderer,
1498
1585
  className,
1499
1586
  rowIdx,
1587
+ gridRowStart,
1588
+ height,
1589
+ selectedCellIdx,
1500
1590
  isRowSelected,
1501
1591
  copiedCellIdx,
1502
1592
  draggedOverCellIdx,
1503
1593
  lastFrozenColumnIndex,
1504
1594
  row,
1505
1595
  viewportColumns,
1506
- selectedCellProps,
1596
+ selectedCellEditor,
1597
+ selectedCellDragHandle,
1507
1598
  onRowClick,
1599
+ onRowDoubleClick,
1508
1600
  rowClass,
1509
1601
  setDraggedOverRowIdx,
1510
1602
  onMouseEnter,
1511
- top,
1512
- height,
1513
1603
  onRowChange,
1514
1604
  selectCell,
1515
1605
  ...props
1516
1606
  }, ref) {
1607
+ const handleRowChange = useLatestFunc(newRow => {
1608
+ onRowChange(rowIdx, newRow);
1609
+ });
1610
+
1517
1611
  function handleDragEnter(event) {
1518
1612
  setDraggedOverRowIdx == null ? void 0 : setDraggedOverRowIdx(rowIdx);
1519
1613
  onMouseEnter == null ? void 0 : onMouseEnter(event);
1520
1614
  }
1521
1615
 
1522
- 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);
1523
- const CellRenderer = cellRenderer != null ? cellRenderer : Cell$1;
1616
+ className = clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, rowClass == null ? void 0 : rowClass(row), className, selectedCellIdx === -1 && rowSelectedClassname);
1524
1617
  const cells = [];
1525
1618
 
1526
1619
  for (let index = 0; index < viewportColumns.length; index++) {
1527
1620
  const column = viewportColumns[index];
1621
+ const {
1622
+ idx
1623
+ } = column;
1528
1624
  const colSpan = getColSpan(column, lastFrozenColumnIndex, {
1529
1625
  type: 'ROW',
1530
1626
  row
@@ -1534,34 +1630,25 @@
1534
1630
  index += colSpan - 1;
1535
1631
  }
1536
1632
 
1537
- const isCellSelected = (selectedCellProps == null ? void 0 : selectedCellProps.idx) === column.idx;
1633
+ const isCellSelected = selectedCellIdx === idx;
1538
1634
 
1539
- if ((selectedCellProps == null ? void 0 : selectedCellProps.mode) === 'EDIT' && isCellSelected) {
1540
- cells.push( /*#__PURE__*/e(EditCell, {
1541
- rowIdx: rowIdx,
1635
+ if (isCellSelected && selectedCellEditor) {
1636
+ cells.push(selectedCellEditor);
1637
+ } else {
1638
+ cells.push( /*#__PURE__*/e(Cell$1, {
1542
1639
  column: column,
1543
1640
  colSpan: colSpan,
1544
- onKeyDown: selectedCellProps.onKeyDown,
1545
- ...selectedCellProps.editorProps
1641
+ row: row,
1642
+ isCopied: copiedCellIdx === idx,
1643
+ isDraggedOver: draggedOverCellIdx === idx,
1644
+ isCellSelected: isCellSelected,
1645
+ dragHandle: isCellSelected ? selectedCellDragHandle : undefined,
1646
+ onRowClick: onRowClick,
1647
+ onRowDoubleClick: onRowDoubleClick,
1648
+ onRowChange: handleRowChange,
1649
+ selectCell: selectCell
1546
1650
  }, column.key));
1547
- continue;
1548
1651
  }
1549
-
1550
- cells.push( /*#__PURE__*/e(CellRenderer, {
1551
- rowIdx: rowIdx,
1552
- column: column,
1553
- colSpan: colSpan,
1554
- row: row,
1555
- isCopied: copiedCellIdx === column.idx,
1556
- isDraggedOver: draggedOverCellIdx === column.idx,
1557
- isCellSelected: isCellSelected,
1558
- dragHandleProps: isCellSelected ? selectedCellProps.dragHandleProps : undefined,
1559
- onFocus: isCellSelected ? selectedCellProps.onFocus : undefined,
1560
- onKeyDown: isCellSelected ? selectedCellProps.onKeyDown : undefined,
1561
- onRowClick: onRowClick,
1562
- onRowChange: onRowChange,
1563
- selectCell: selectCell
1564
- }, column.key));
1565
1652
  }
1566
1653
 
1567
1654
  return /*#__PURE__*/e(RowSelectionProvider, {
@@ -1571,10 +1658,7 @@
1571
1658
  ref: ref,
1572
1659
  className: className,
1573
1660
  onMouseEnter: handleDragEnter,
1574
- style: {
1575
- top,
1576
- '--row-height': `${height}px`
1577
- },
1661
+ style: getRowStyle(gridRowStart, height),
1578
1662
  ...props,
1579
1663
  children: cells
1580
1664
  })
@@ -1585,15 +1669,21 @@
1585
1669
 
1586
1670
  function GroupCell({
1587
1671
  id,
1588
- rowIdx,
1589
1672
  groupKey,
1590
1673
  childRows,
1591
1674
  isExpanded,
1592
1675
  isCellSelected,
1593
1676
  column,
1677
+ row,
1594
1678
  groupColumnIndex,
1595
1679
  toggleGroup: toggleGroupWrapper
1596
1680
  }) {
1681
+ const {
1682
+ ref,
1683
+ tabIndex,
1684
+ onFocus
1685
+ } = useRovingCellRef(isCellSelected);
1686
+
1597
1687
  function toggleGroup() {
1598
1688
  toggleGroupWrapper(id);
1599
1689
  }
@@ -1602,16 +1692,20 @@
1602
1692
  return /*#__PURE__*/e("div", {
1603
1693
  role: "gridcell",
1604
1694
  "aria-colindex": column.idx + 1,
1695
+ "aria-selected": isCellSelected,
1696
+ ref: ref,
1697
+ tabIndex: tabIndex,
1605
1698
  className: getCellClassname(column),
1606
1699
  style: { ...getCellStyle(column),
1607
1700
  cursor: isLevelMatching ? 'pointer' : 'default'
1608
1701
  },
1609
1702
  onClick: isLevelMatching ? toggleGroup : undefined,
1703
+ onFocus: onFocus,
1610
1704
  children: (!column.rowGroup || groupColumnIndex === column.idx) && column.groupFormatter && /*#__PURE__*/e(column.groupFormatter, {
1611
- rowIdx: rowIdx,
1612
1705
  groupKey: groupKey,
1613
1706
  childRows: childRows,
1614
1707
  column: column,
1708
+ row: row,
1615
1709
  isExpanded: isExpanded,
1616
1710
  isCellSelected: isCellSelected,
1617
1711
  toggleGroup: toggleGroup
@@ -1621,29 +1715,33 @@
1621
1715
 
1622
1716
  const GroupCell$1 = /*#__PURE__*/g(GroupCell);
1623
1717
 
1718
+ var css_248z$6 = ".gyxx7e9700-beta12:not([aria-selected=true]){background-color:var(--rdg-header-background-color)}.gyxx7e9700-beta12>.c1wupbe700-beta12:not(:last-child):not(.c9dpaye700-beta12){border-inline-end:none}";
1719
+ styleInject$1(css_248z$6,{"insertAt":"top"});
1720
+
1721
+ const groupRow = "gyxx7e9700-beta12";
1722
+ const groupRowClassname = `rdg-group-row ${groupRow}`;
1723
+
1624
1724
  function GroupedRow({
1625
1725
  id,
1626
1726
  groupKey,
1627
1727
  viewportColumns,
1628
1728
  childRows,
1629
1729
  rowIdx,
1630
- top,
1730
+ row,
1731
+ gridRowStart,
1631
1732
  height,
1632
1733
  level,
1633
1734
  isExpanded,
1634
1735
  selectedCellIdx,
1635
1736
  isRowSelected,
1636
- selectCell,
1737
+ selectGroup,
1637
1738
  toggleGroup,
1638
1739
  ...props
1639
1740
  }) {
1640
1741
  const idx = viewportColumns[0].key === SELECT_COLUMN_KEY ? level + 1 : level;
1641
1742
 
1642
- function selectGroup() {
1643
- selectCell({
1644
- rowIdx,
1645
- idx: -1
1646
- });
1743
+ function handleSelectGroup() {
1744
+ selectGroup(rowIdx);
1647
1745
  }
1648
1746
 
1649
1747
  return /*#__PURE__*/e(RowSelectionProvider, {
@@ -1652,21 +1750,18 @@
1652
1750
  role: "row",
1653
1751
  "aria-level": level,
1654
1752
  "aria-expanded": isExpanded,
1655
- className: clsx(rowClassname, groupRowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, selectedCellIdx === -1 && groupRowSelectedClassname),
1656
- onClick: selectGroup,
1657
- style: {
1658
- top,
1659
- '--row-height': `${height}px`
1660
- },
1753
+ className: clsx(rowClassname, groupRowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, selectedCellIdx === -1 && rowSelectedClassname),
1754
+ onClick: handleSelectGroup,
1755
+ style: getRowStyle(gridRowStart, height),
1661
1756
  ...props,
1662
1757
  children: viewportColumns.map(column => /*#__PURE__*/e(GroupCell$1, {
1663
1758
  id: id,
1664
- rowIdx: rowIdx,
1665
1759
  groupKey: groupKey,
1666
1760
  childRows: childRows,
1667
1761
  isExpanded: isExpanded,
1668
1762
  isCellSelected: selectedCellIdx === column.idx,
1669
1763
  column: column,
1764
+ row: row,
1670
1765
  groupColumnIndex: idx,
1671
1766
  toggleGroup: toggleGroup
1672
1767
  }, column.key))
@@ -1676,37 +1771,71 @@
1676
1771
 
1677
1772
  const GroupRowRenderer = /*#__PURE__*/g(GroupedRow);
1678
1773
 
1774
+ var css_248z$5 = ".s1n3hxke700-beta12{inset-block-end:var(--rdg-summary-row-bottom);inset-block-start:var(--rdg-summary-row-top)}";
1775
+ styleInject$1(css_248z$5,{"insertAt":"top"});
1776
+
1777
+ const summaryCellClassname = "s1n3hxke700-beta12";
1778
+
1679
1779
  function SummaryCell({
1680
1780
  column,
1681
1781
  colSpan,
1682
- row
1782
+ row,
1783
+ isCellSelected,
1784
+ selectCell
1683
1785
  }) {
1786
+ const {
1787
+ ref,
1788
+ tabIndex,
1789
+ onFocus
1790
+ } = useRovingCellRef(isCellSelected);
1684
1791
  const {
1685
1792
  summaryFormatter: SummaryFormatter,
1686
1793
  summaryCellClass
1687
1794
  } = column;
1688
- const className = getCellClassname(column, typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass);
1795
+ const className = getCellClassname(column, summaryCellClassname, typeof summaryCellClass === 'function' ? summaryCellClass(row) : summaryCellClass);
1796
+
1797
+ function onClick() {
1798
+ selectCell(row, column);
1799
+ }
1800
+
1689
1801
  return /*#__PURE__*/e("div", {
1690
1802
  role: "gridcell",
1691
1803
  "aria-colindex": column.idx + 1,
1692
1804
  "aria-colspan": colSpan,
1805
+ "aria-selected": isCellSelected,
1806
+ ref: ref,
1807
+ tabIndex: tabIndex,
1693
1808
  className: className,
1694
1809
  style: getCellStyle(column, colSpan),
1810
+ onClick: onClick,
1811
+ onFocus: onFocus,
1695
1812
  children: SummaryFormatter && /*#__PURE__*/e(SummaryFormatter, {
1696
1813
  column: column,
1697
- row: row
1814
+ row: row,
1815
+ isCellSelected: isCellSelected
1698
1816
  })
1699
1817
  });
1700
1818
  }
1701
1819
 
1702
1820
  const SummaryCell$1 = /*#__PURE__*/g(SummaryCell);
1703
1821
 
1822
+ var css_248z$4 = ".snfqesz700-beta12.r1otpg64700-beta12{line-height:var(--rdg-summary-row-height)}.snfqesz700-beta12.r1otpg64700-beta12>.c1wupbe700-beta12{position:sticky}.s1jijrjz700-beta12>.c1wupbe700-beta12{border-block-start:2px solid var(--rdg-summary-border-color)}";
1823
+ styleInject$1(css_248z$4,{"insertAt":"top"});
1824
+
1825
+ const summaryRow = "snfqesz700-beta12";
1826
+ const summaryRowBorderClassname = "s1jijrjz700-beta12";
1827
+ const summaryRowClassname = `rdg-summary-row ${summaryRow}`;
1828
+
1704
1829
  function SummaryRow({
1705
1830
  rowIdx,
1831
+ gridRowStart,
1706
1832
  row,
1707
1833
  viewportColumns,
1834
+ top,
1708
1835
  bottom,
1709
1836
  lastFrozenColumnIndex,
1837
+ selectedCellIdx,
1838
+ selectCell,
1710
1839
  'aria-rowindex': ariaRowIndex
1711
1840
  }) {
1712
1841
  const cells = [];
@@ -1722,19 +1851,23 @@
1722
1851
  index += colSpan - 1;
1723
1852
  }
1724
1853
 
1854
+ const isCellSelected = selectedCellIdx === column.idx;
1725
1855
  cells.push( /*#__PURE__*/e(SummaryCell$1, {
1726
1856
  column: column,
1727
1857
  colSpan: colSpan,
1728
- row: row
1858
+ row: row,
1859
+ isCellSelected: isCellSelected,
1860
+ selectCell: selectCell
1729
1861
  }, column.key));
1730
1862
  }
1731
1863
 
1732
1864
  return /*#__PURE__*/e("div", {
1733
1865
  role: "row",
1734
1866
  "aria-rowindex": ariaRowIndex,
1735
- className: `${rowClassname} rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'} ${summaryRowClassname}`,
1736
- style: {
1737
- bottom
1867
+ className: clsx(rowClassname, `rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, summaryRowClassname, rowIdx === 0 && summaryRowBorderClassname, selectedCellIdx === -1 && rowSelectedClassname),
1868
+ style: { ...getRowStyle(gridRowStart),
1869
+ '--rdg-summary-row-top': top !== undefined ? `${top}px` : undefined,
1870
+ '--rdg-summary-row-bottom': bottom !== undefined ? `${bottom}px` : undefined
1738
1871
  },
1739
1872
  children: cells
1740
1873
  });
@@ -1742,15 +1875,224 @@
1742
1875
 
1743
1876
  const SummaryRow$1 = /*#__PURE__*/g(SummaryRow);
1744
1877
 
1745
- var _globalThis$document;
1746
- const body = (_globalThis$document = globalThis.document) == null ? void 0 : _globalThis$document.body;
1747
- const initialPosition = {
1748
- idx: -1,
1749
- rowIdx: -1,
1750
- mode: 'SELECT'
1751
- };
1878
+ var css_248z$3 = ".c1tngyp1700-beta12.rdg-cell{padding:0}";
1879
+ styleInject$1(css_248z$3,{"insertAt":"top"});
1752
1880
 
1753
- function DataGrid({
1881
+ const cellEditing = "c1tngyp1700-beta12";
1882
+ function EditCell({
1883
+ column,
1884
+ colSpan,
1885
+ row,
1886
+ onRowChange,
1887
+ closeEditor,
1888
+ scrollToCell
1889
+ }) {
1890
+ var _column$editorOptions, _column$editorOptions4, _column$editorOptions5;
1891
+
1892
+ const frameRequestRef = h();
1893
+ const commitOnOutsideClick = ((_column$editorOptions = column.editorOptions) == null ? void 0 : _column$editorOptions.commitOnOutsideClick) !== false;
1894
+ const commitOnOutsideMouseDown = useLatestFunc(() => {
1895
+ onClose(true);
1896
+ });
1897
+ y(() => {
1898
+ if (!commitOnOutsideClick) return;
1899
+
1900
+ function onWindowCaptureMouseDown() {
1901
+ frameRequestRef.current = requestAnimationFrame(commitOnOutsideMouseDown);
1902
+ }
1903
+
1904
+ addEventListener('mousedown', onWindowCaptureMouseDown, {
1905
+ capture: true
1906
+ });
1907
+ return () => {
1908
+ removeEventListener('mousedown', onWindowCaptureMouseDown, {
1909
+ capture: true
1910
+ });
1911
+ cancelFrameRequest();
1912
+ };
1913
+ }, [commitOnOutsideClick, commitOnOutsideMouseDown]);
1914
+
1915
+ function cancelFrameRequest() {
1916
+ cancelAnimationFrame(frameRequestRef.current);
1917
+ }
1918
+
1919
+ function onKeyDown(event) {
1920
+ if (event.key === 'Escape') {
1921
+ event.stopPropagation();
1922
+ onClose();
1923
+ } else if (event.key === 'Enter') {
1924
+ event.stopPropagation();
1925
+ onClose(true);
1926
+ scrollToCell();
1927
+ } else {
1928
+ var _column$editorOptions2, _column$editorOptions3;
1929
+
1930
+ const onNavigation = (_column$editorOptions2 = (_column$editorOptions3 = column.editorOptions) == null ? void 0 : _column$editorOptions3.onNavigation) != null ? _column$editorOptions2 : onEditorNavigation;
1931
+
1932
+ if (!onNavigation(event)) {
1933
+ event.stopPropagation();
1934
+ }
1935
+ }
1936
+ }
1937
+
1938
+ function onClose(commitChanges) {
1939
+ if (commitChanges) {
1940
+ onRowChange(row, true);
1941
+ } else {
1942
+ closeEditor();
1943
+ }
1944
+ }
1945
+
1946
+ const {
1947
+ cellClass
1948
+ } = column;
1949
+ const className = getCellClassname(column, 'rdg-editor-container', typeof cellClass === 'function' ? cellClass(row) : cellClass, !((_column$editorOptions4 = column.editorOptions) != null && _column$editorOptions4.renderFormatter) && cellEditing);
1950
+ return /*#__PURE__*/e("div", {
1951
+ role: "gridcell",
1952
+ "aria-colindex": column.idx + 1,
1953
+ "aria-colspan": colSpan,
1954
+ "aria-selected": true,
1955
+ className: className,
1956
+ style: getCellStyle(column, colSpan),
1957
+ onKeyDown: onKeyDown,
1958
+ onMouseDownCapture: commitOnOutsideClick ? cancelFrameRequest : undefined,
1959
+ children: column.editor != null && /*#__PURE__*/e(d$1, {
1960
+ children: [/*#__PURE__*/e(column.editor, {
1961
+ column: column,
1962
+ row: row,
1963
+ onRowChange: onRowChange,
1964
+ onClose: onClose
1965
+ }), ((_column$editorOptions5 = column.editorOptions) == null ? void 0 : _column$editorOptions5.renderFormatter) && /*#__PURE__*/e(column.formatter, {
1966
+ column: column,
1967
+ row: row,
1968
+ isCellSelected: true,
1969
+ onRowChange: onRowChange
1970
+ })]
1971
+ })
1972
+ });
1973
+ }
1974
+
1975
+ var css_248z$2 = ".cadd3bp700-beta12{background-color:var(--rdg-selection-color);block-size:8px;cursor:move;inline-size:8px;inset-block-end:0;inset-inline-end:0;position:absolute}.cadd3bp700-beta12:hover{background-color:var(--rdg-background-color);block-size:16px;border:2px solid var(--rdg-selection-color);inline-size:16px}";
1976
+ styleInject$1(css_248z$2,{"insertAt":"top"});
1977
+
1978
+ const cellDragHandle = "cadd3bp700-beta12";
1979
+ const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
1980
+ function DragHandle({
1981
+ rows,
1982
+ columns,
1983
+ selectedPosition,
1984
+ latestDraggedOverRowIdx,
1985
+ isCellEditable,
1986
+ onRowsChange,
1987
+ onFill,
1988
+ setDragging,
1989
+ setDraggedOverRowIdx
1990
+ }) {
1991
+ function handleMouseDown(event) {
1992
+ if (event.buttons !== 1) return;
1993
+ setDragging(true);
1994
+ window.addEventListener('mouseover', onMouseOver);
1995
+ window.addEventListener('mouseup', onMouseUp);
1996
+
1997
+ function onMouseOver(event) {
1998
+ if (event.buttons !== 1) onMouseUp();
1999
+ }
2000
+
2001
+ function onMouseUp() {
2002
+ window.removeEventListener('mouseover', onMouseOver);
2003
+ window.removeEventListener('mouseup', onMouseUp);
2004
+ setDragging(false);
2005
+ handleDragEnd();
2006
+ }
2007
+ }
2008
+
2009
+ function handleDragEnd() {
2010
+ const overRowIdx = latestDraggedOverRowIdx.current;
2011
+ if (overRowIdx === undefined) return;
2012
+ const {
2013
+ rowIdx
2014
+ } = selectedPosition;
2015
+ const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;
2016
+ const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;
2017
+ updateRows(startRowIndex, endRowIndex);
2018
+ setDraggedOverRowIdx(undefined);
2019
+ }
2020
+
2021
+ function handleDoubleClick(event) {
2022
+ event.stopPropagation();
2023
+ updateRows(selectedPosition.rowIdx + 1, rows.length);
2024
+ }
2025
+
2026
+ function updateRows(startRowIdx, endRowIdx) {
2027
+ const {
2028
+ idx,
2029
+ rowIdx
2030
+ } = selectedPosition;
2031
+ const column = columns[idx];
2032
+ const sourceRow = rows[rowIdx];
2033
+ const updatedRows = [...rows];
2034
+ const indexes = [];
2035
+
2036
+ for (let i = startRowIdx; i < endRowIdx; i++) {
2037
+ if (isCellEditable({
2038
+ rowIdx: i,
2039
+ idx
2040
+ })) {
2041
+ const updatedRow = onFill({
2042
+ columnKey: column.key,
2043
+ sourceRow,
2044
+ targetRow: rows[i]
2045
+ });
2046
+
2047
+ if (updatedRow !== rows[i]) {
2048
+ updatedRows[i] = updatedRow;
2049
+ indexes.push(i);
2050
+ }
2051
+ }
2052
+ }
2053
+
2054
+ if (indexes.length > 0) {
2055
+ onRowsChange == null ? void 0 : onRowsChange(updatedRows, {
2056
+ indexes,
2057
+ column
2058
+ });
2059
+ }
2060
+ }
2061
+
2062
+ return /*#__PURE__*/e("div", {
2063
+ className: cellDragHandleClassname,
2064
+ onMouseDown: handleMouseDown,
2065
+ onDoubleClick: handleDoubleClick
2066
+ });
2067
+ }
2068
+
2069
+ var css_248z$1 = ".a888944700-beta12{fill:currentColor}.a888944700-beta12>path{transition:d .1s}";
2070
+ styleInject$1(css_248z$1,{"insertAt":"top"});
2071
+
2072
+ const arrow = "a888944700-beta12";
2073
+ const arrowClassname = `rdg-sort-arrow ${arrow}`;
2074
+ function SortIcon({
2075
+ sortDirection
2076
+ }) {
2077
+ return sortDirection !== undefined ? /*#__PURE__*/e("svg", {
2078
+ viewBox: "0 0 12 8",
2079
+ width: "12",
2080
+ height: "8",
2081
+ className: arrowClassname,
2082
+ "aria-hidden": true,
2083
+ children: /*#__PURE__*/e("path", {
2084
+ d: sortDirection === 'ASC' ? 'M0 8 6 0 12 8' : 'M0 0 6 8 12 0'
2085
+ })
2086
+ }) : null;
2087
+ }
2088
+
2089
+ const initialPosition = {
2090
+ idx: -1,
2091
+ rowIdx: -2,
2092
+ mode: 'SELECT'
2093
+ };
2094
+
2095
+ function DataGrid({
1754
2096
  columns: rawColumns,
1755
2097
  rows: rawRows,
1756
2098
  summaryRows,
@@ -1768,33 +2110,38 @@
1768
2110
  rowGrouper,
1769
2111
  expandedGroupIds,
1770
2112
  onExpandedGroupIdsChange,
1771
- rowRenderer,
1772
- emptyRowsRenderer: EmptyRowsRenderer,
1773
2113
  onRowClick,
2114
+ onRowDoubleClick,
1774
2115
  onScroll,
1775
2116
  onColumnResize,
1776
- onSelectedCellChange,
1777
2117
  onFill,
2118
+ onCopy,
1778
2119
  onPaste,
1779
2120
  cellNavigationMode: rawCellNavigationMode,
1780
2121
  enableVirtualization,
1781
- editorPortalTarget: rawEditorPortalTarget,
2122
+ components,
1782
2123
  className,
1783
2124
  style,
1784
2125
  rowClass,
2126
+ direction,
1785
2127
  'aria-label': ariaLabel,
1786
2128
  'aria-labelledby': ariaLabelledBy,
1787
- 'aria-describedby': ariaDescribedBy
2129
+ 'aria-describedby': ariaDescribedBy,
2130
+ 'data-testid': testId
1788
2131
  }, ref) {
1789
- var _rowHeight, _enableVirtualization, _summaryRows$length;
2132
+ var _rowHeight, _ref, _components$rowRender, _ref2, _components$sortIcon, _ref3, _components$checkboxF, _components$noRowsFal, _enableVirtualization, _direction, _summaryRows$length;
1790
2133
 
2134
+ const defaultComponents = useDefaultComponents();
1791
2135
  (_rowHeight = rowHeight) != null ? _rowHeight : rowHeight = 35;
1792
2136
  const headerRowHeight = rawHeaderRowHeight != null ? rawHeaderRowHeight : typeof rowHeight === 'number' ? rowHeight : 35;
1793
2137
  const summaryRowHeight = rawSummaryRowHeight != null ? rawSummaryRowHeight : typeof rowHeight === 'number' ? rowHeight : 35;
1794
- const RowRenderer = rowRenderer != null ? rowRenderer : Row$1;
2138
+ const RowRenderer = (_ref = (_components$rowRender = components == null ? void 0 : components.rowRenderer) != null ? _components$rowRender : defaultComponents == null ? void 0 : defaultComponents.rowRenderer) != null ? _ref : Row$1;
2139
+ const sortIcon = (_ref2 = (_components$sortIcon = components == null ? void 0 : components.sortIcon) != null ? _components$sortIcon : defaultComponents == null ? void 0 : defaultComponents.sortIcon) != null ? _ref2 : SortIcon;
2140
+ const checkboxFormatter = (_ref3 = (_components$checkboxF = components == null ? void 0 : components.checkboxFormatter) != null ? _components$checkboxF : defaultComponents == null ? void 0 : defaultComponents.checkboxFormatter) != null ? _ref3 : CheckboxFormatter;
2141
+ const noRowsFallback = (_components$noRowsFal = components == null ? void 0 : components.noRowsFallback) != null ? _components$noRowsFal : defaultComponents == null ? void 0 : defaultComponents.noRowsFallback;
1795
2142
  const cellNavigationMode = rawCellNavigationMode != null ? rawCellNavigationMode : 'NONE';
1796
2143
  (_enableVirtualization = enableVirtualization) != null ? _enableVirtualization : enableVirtualization = true;
1797
- const editorPortalTarget = rawEditorPortalTarget != null ? rawEditorPortalTarget : body;
2144
+ (_direction = direction) != null ? _direction : direction = 'ltr';
1798
2145
  const [scrollTop, setScrollTop] = m(0);
1799
2146
  const [scrollLeft, setScrollLeft] = m(0);
1800
2147
  const [columnWidths, setColumnWidths] = m(() => new Map());
@@ -1802,20 +2149,24 @@
1802
2149
  const [copiedCell, setCopiedCell] = m(null);
1803
2150
  const [isDragging, setDragging] = m(false);
1804
2151
  const [draggedOverRowIdx, setOverRowIdx] = m(undefined);
1805
- const focusSinkRef = h(null);
2152
+ const [autoResizeColumn, setAutoResizeColumn] = m(null);
1806
2153
  const prevSelectedPosition = h(selectedPosition);
1807
2154
  const latestDraggedOverRowIdx = h(draggedOverRowIdx);
1808
2155
  const lastSelectedRowIdx = h(-1);
1809
- const isCellFocusable = h(false);
1810
- const selectRowWrapper = useLatestFunc(selectRow);
1811
- const selectCellWrapper = useLatestFunc(selectCell);
1812
- const toggleGroupWrapper = useLatestFunc(toggleGroup);
1813
- const handleFormatterRowChangeWrapper = useLatestFunc(updateRow);
2156
+ const rowRef = h(null);
1814
2157
  const [gridRef, gridWidth, gridHeight] = useGridDimensions();
1815
2158
  const headerRowsCount = 1;
1816
2159
  const summaryRowsCount = (_summaryRows$length = summaryRows == null ? void 0 : summaryRows.length) != null ? _summaryRows$length : 0;
1817
2160
  const clientHeight = gridHeight - headerRowHeight - summaryRowsCount * summaryRowHeight;
1818
2161
  const isSelectable = selectedRows != null && onSelectedRowsChange != null;
2162
+ const isHeaderRowSelected = selectedPosition.rowIdx === -1;
2163
+ const isRtl = direction === 'rtl';
2164
+ const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
2165
+ const rightKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
2166
+ const defaultGridComponents = _(() => ({
2167
+ sortIcon,
2168
+ checkboxFormatter
2169
+ }), [sortIcon, checkboxFormatter]);
1819
2170
  const allRowsSelected = _(() => {
1820
2171
  const {
1821
2172
  length
@@ -1829,7 +2180,6 @@
1829
2180
  colOverscanEndIdx,
1830
2181
  layoutCssVars,
1831
2182
  columnMetrics,
1832
- totalColumnWidth,
1833
2183
  lastFrozenColumnIndex,
1834
2184
  totalFrozenColumnWidth,
1835
2185
  groupBy
@@ -1848,6 +2198,7 @@
1848
2198
  rows,
1849
2199
  rowsCount,
1850
2200
  totalRowHeight,
2201
+ gridTemplateRows,
1851
2202
  isGroupRow,
1852
2203
  getRowTop,
1853
2204
  getRowHeight,
@@ -1876,24 +2227,70 @@
1876
2227
  });
1877
2228
  const hasGroups = groupBy.length > 0 && typeof rowGrouper === 'function';
1878
2229
  const minColIdx = hasGroups ? -1 : 0;
1879
- const enableCellDragAndDrop = hasGroups ? false : onFill != null;
1880
- d(() => {
1881
- if (selectedPosition === prevSelectedPosition.current || selectedPosition.mode === 'EDIT' || !isCellWithinBounds(selectedPosition)) {
2230
+ const maxColIdx = columns.length - 1;
2231
+ const minRowIdx = -1;
2232
+ const maxRowIdx = headerRowsCount + rows.length + summaryRowsCount - 2;
2233
+ const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);
2234
+ const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);
2235
+ const selectRowLatest = useLatestFunc(selectRow);
2236
+ const selectAllRowsLatest = useLatestFunc(selectAllRows);
2237
+ const handleFormatterRowChangeLatest = useLatestFunc(updateRow);
2238
+ const selectViewportCellLatest = useLatestFunc((row, column, enableEditor) => {
2239
+ const rowIdx = rows.indexOf(row);
2240
+ selectCell({
2241
+ rowIdx,
2242
+ idx: column.idx
2243
+ }, enableEditor);
2244
+ });
2245
+ const selectGroupLatest = useLatestFunc(rowIdx => {
2246
+ selectCell({
2247
+ rowIdx,
2248
+ idx: -1
2249
+ });
2250
+ });
2251
+ const selectHeaderCellLatest = useLatestFunc(idx => {
2252
+ selectCell({
2253
+ rowIdx: -1,
2254
+ idx
2255
+ });
2256
+ });
2257
+ const selectSummaryCellLatest = useLatestFunc((summaryRow, column) => {
2258
+ const rowIdx = summaryRows.indexOf(summaryRow) + headerRowsCount + rows.length - 1;
2259
+ selectCell({
2260
+ rowIdx,
2261
+ idx: column.idx
2262
+ });
2263
+ });
2264
+ const toggleGroupLatest = useLatestFunc(toggleGroup);
2265
+ useLayoutEffect(() => {
2266
+ if (!selectedCellIsWithinSelectionBounds || isSamePosition(selectedPosition, prevSelectedPosition.current)) {
2267
+ prevSelectedPosition.current = selectedPosition;
1882
2268
  return;
1883
2269
  }
1884
2270
 
1885
2271
  prevSelectedPosition.current = selectedPosition;
1886
2272
  scrollToCell(selectedPosition);
1887
2273
 
1888
- if (isCellFocusable.current) {
1889
- isCellFocusable.current = false;
1890
- return;
2274
+ if (selectedPosition.idx === -1) {
2275
+ rowRef.current.focus({
2276
+ preventScroll: true
2277
+ });
1891
2278
  }
1892
-
1893
- focusSinkRef.current.focus({
1894
- preventScroll: true
1895
- });
1896
2279
  });
2280
+ useLayoutEffect(() => {
2281
+ if (autoResizeColumn === null) return;
2282
+ const columnElement = gridRef.current.querySelector(`[aria-colindex="${autoResizeColumn.idx + 1}"]`);
2283
+ const {
2284
+ width
2285
+ } = columnElement.getBoundingClientRect();
2286
+ setColumnWidths(columnWidths => {
2287
+ const newColumnWidths = new Map(columnWidths);
2288
+ newColumnWidths.set(autoResizeColumn.key, width);
2289
+ return newColumnWidths;
2290
+ });
2291
+ setAutoResizeColumn(null);
2292
+ onColumnResize == null ? void 0 : onColumnResize(autoResizeColumn.idx, width);
2293
+ }, [autoResizeColumn, gridRef, onColumnResize]);
1897
2294
  s(ref, () => ({
1898
2295
  element: gridRef.current,
1899
2296
 
@@ -1917,6 +2314,11 @@
1917
2314
  selectCell
1918
2315
  }));
1919
2316
  const handleColumnResize = A$1((column, width) => {
2317
+ if (width === 'auto') {
2318
+ setAutoResizeColumn(column);
2319
+ return;
2320
+ }
2321
+
1920
2322
  setColumnWidths(columnWidths => {
1921
2323
  const newColumnWidths = new Map(columnWidths);
1922
2324
  newColumnWidths.set(column.key, width);
@@ -1930,14 +2332,13 @@
1930
2332
  }, []);
1931
2333
 
1932
2334
  function selectRow({
1933
- rowIdx,
2335
+ row,
1934
2336
  checked,
1935
2337
  isShiftClick
1936
2338
  }) {
1937
2339
  if (!onSelectedRowsChange) return;
1938
2340
  assertIsValidKeyGetter(rowKeyGetter);
1939
2341
  const newSelectedRows = new Set(selectedRows);
1940
- const row = rows[rowIdx];
1941
2342
 
1942
2343
  if (isGroupRow(row)) {
1943
2344
  for (const childRow of row.childRows) {
@@ -1959,6 +2360,7 @@
1959
2360
  if (checked) {
1960
2361
  newSelectedRows.add(rowKey);
1961
2362
  const previousRowIdx = lastSelectedRowIdx.current;
2363
+ const rowIdx = rows.indexOf(row);
1962
2364
  lastSelectedRowIdx.current = rowIdx;
1963
2365
 
1964
2366
  if (isShiftClick && previousRowIdx !== -1 && previousRowIdx !== rowIdx) {
@@ -1978,6 +2380,24 @@
1978
2380
  onSelectedRowsChange(newSelectedRows);
1979
2381
  }
1980
2382
 
2383
+ function selectAllRows(checked) {
2384
+ if (!onSelectedRowsChange) return;
2385
+ assertIsValidKeyGetter(rowKeyGetter);
2386
+ const newSelectedRows = new Set(selectedRows);
2387
+
2388
+ for (const row of rawRows) {
2389
+ const rowKey = rowKeyGetter(row);
2390
+
2391
+ if (checked) {
2392
+ newSelectedRows.add(rowKey);
2393
+ } else {
2394
+ newSelectedRows.delete(rowKey);
2395
+ }
2396
+ }
2397
+
2398
+ onSelectedRowsChange(newSelectedRows);
2399
+ }
2400
+
1981
2401
  function toggleGroup(expandedGroupId) {
1982
2402
  if (!onExpandedGroupIdsChange) return;
1983
2403
  const newExpandedGroupIds = new Set(expandedGroupIds);
@@ -1991,30 +2411,20 @@
1991
2411
  onExpandedGroupIdsChange(newExpandedGroupIds);
1992
2412
  }
1993
2413
 
1994
- function onGridFocus() {
1995
- if (!isCellWithinBounds(selectedPosition)) {
1996
- const initialPosition = {
1997
- idx: 0,
1998
- rowIdx: 0,
1999
- mode: 'SELECT'
2000
- };
2001
-
2002
- if (isCellWithinBounds(initialPosition)) {
2003
- setSelectedPosition(initialPosition);
2004
- }
2005
- } else {
2006
- scrollToCell(selectedPosition);
2007
- }
2008
- }
2009
-
2010
2414
  function handleKeyDown(event) {
2415
+ if (!(event.target instanceof Element)) return;
2416
+ const isCellEvent = event.target.closest('.rdg-cell') !== null;
2417
+ const isRowEvent = hasGroups && event.target === rowRef.current;
2418
+ if (!isCellEvent && !isRowEvent) return;
2011
2419
  const {
2012
2420
  key,
2013
2421
  keyCode
2014
2422
  } = event;
2015
- const row = rows[selectedPosition.rowIdx];
2423
+ const {
2424
+ rowIdx
2425
+ } = selectedPosition;
2016
2426
 
2017
- if (onPaste && isCtrlKeyHeldDown(event) && isCellWithinBounds(selectedPosition) && !isGroupRow(row) && selectedPosition.idx !== -1 && selectedPosition.mode === 'SELECT') {
2427
+ if (selectedCellIsWithinViewportBounds && (onPaste != null || onCopy != null) && isCtrlKeyHeldDown(event) && !isGroupRow(rows[rowIdx]) && selectedPosition.mode === 'SELECT') {
2018
2428
  const cKey = 67;
2019
2429
  const vKey = 86;
2020
2430
 
@@ -2029,16 +2439,19 @@
2029
2439
  }
2030
2440
  }
2031
2441
 
2032
- if (isCellWithinBounds(selectedPosition) && isGroupRow(row) && selectedPosition.idx === -1 && (key === 'ArrowLeft' && row.isExpanded || key === 'ArrowRight' && !row.isExpanded)) {
2033
- event.preventDefault();
2034
- toggleGroup(row.id);
2035
- return;
2442
+ if (isRowIdxWithinViewportBounds(rowIdx)) {
2443
+ const row = rows[rowIdx];
2444
+
2445
+ if (isGroupRow(row) && selectedPosition.idx === -1 && (key === leftKey && row.isExpanded || key === rightKey && !row.isExpanded)) {
2446
+ event.preventDefault();
2447
+ toggleGroup(row.id);
2448
+ return;
2449
+ }
2036
2450
  }
2037
2451
 
2038
2452
  switch (event.key) {
2039
2453
  case 'Escape':
2040
2454
  setCopiedCell(null);
2041
- closeEditor();
2042
2455
  return;
2043
2456
 
2044
2457
  case 'ArrowUp':
@@ -2059,17 +2472,13 @@
2059
2472
  }
2060
2473
  }
2061
2474
 
2062
- function handleFocus() {
2063
- isCellFocusable.current = true;
2064
- }
2065
-
2066
2475
  function handleScroll(event) {
2067
2476
  const {
2068
2477
  scrollTop,
2069
2478
  scrollLeft
2070
2479
  } = event.currentTarget;
2071
2480
  setScrollTop(scrollTop);
2072
- setScrollLeft(scrollLeft);
2481
+ setScrollLeft(abs(scrollLeft));
2073
2482
  onScroll == null ? void 0 : onScroll(event);
2074
2483
  }
2075
2484
 
@@ -2079,24 +2488,19 @@
2079
2488
 
2080
2489
  function updateRow(rowIdx, row) {
2081
2490
  if (typeof onRowsChange !== 'function') return;
2082
- if (row === rawRows[rowIdx]) return;
2491
+ const rawRowIdx = getRawRowIdx(rowIdx);
2492
+ if (row === rawRows[rawRowIdx]) return;
2083
2493
  const updatedRows = [...rawRows];
2084
- updatedRows[rowIdx] = row;
2494
+ updatedRows[rawRowIdx] = row;
2085
2495
  onRowsChange(updatedRows, {
2086
- indexes: [rowIdx],
2496
+ indexes: [rawRowIdx],
2087
2497
  column: columns[selectedPosition.idx]
2088
2498
  });
2089
2499
  }
2090
2500
 
2091
2501
  function commitEditorChanges() {
2092
- var _columns$selectedPosi;
2093
-
2094
- if (((_columns$selectedPosi = columns[selectedPosition.idx]) == null ? void 0 : _columns$selectedPosi.editor) == null || selectedPosition.mode === 'SELECT' || selectedPosition.row === selectedPosition.originalRow) {
2095
- return;
2096
- }
2097
-
2098
- const rowIdx = getRawRowIdx(selectedPosition.rowIdx);
2099
- updateRow(rowIdx, selectedPosition.row);
2502
+ if (selectedPosition.mode !== 'EDIT') return;
2503
+ updateRow(selectedPosition.rowIdx, selectedPosition.row);
2100
2504
  }
2101
2505
 
2102
2506
  function handleCopy() {
@@ -2104,23 +2508,28 @@
2104
2508
  idx,
2105
2509
  rowIdx
2106
2510
  } = selectedPosition;
2511
+ const sourceRow = rawRows[getRawRowIdx(rowIdx)];
2512
+ const sourceColumnKey = columns[idx].key;
2107
2513
  setCopiedCell({
2108
- row: rawRows[getRawRowIdx(rowIdx)],
2109
- columnKey: columns[idx].key
2514
+ row: sourceRow,
2515
+ columnKey: sourceColumnKey
2516
+ });
2517
+ onCopy == null ? void 0 : onCopy({
2518
+ sourceRow,
2519
+ sourceColumnKey
2110
2520
  });
2111
2521
  }
2112
2522
 
2113
2523
  function handlePaste() {
2524
+ if (!onPaste || !onRowsChange || copiedCell === null || !isCellEditable(selectedPosition)) {
2525
+ return;
2526
+ }
2527
+
2114
2528
  const {
2115
2529
  idx,
2116
2530
  rowIdx
2117
2531
  } = selectedPosition;
2118
2532
  const targetRow = rawRows[getRawRowIdx(rowIdx)];
2119
-
2120
- if (!onPaste || !onRowsChange || copiedCell === null || !isCellEditable(selectedPosition)) {
2121
- return;
2122
- }
2123
-
2124
2533
  const updatedTargetRow = onPaste({
2125
2534
  sourceRow: copiedCell.row,
2126
2535
  sourceColumnKey: copiedCell.columnKey,
@@ -2133,23 +2542,27 @@
2133
2542
  function handleCellInput(event) {
2134
2543
  var _column$editorOptions;
2135
2544
 
2136
- if (!isCellWithinBounds(selectedPosition)) return;
2545
+ if (!selectedCellIsWithinViewportBounds) return;
2137
2546
  const row = rows[selectedPosition.rowIdx];
2138
2547
  if (isGroupRow(row)) return;
2139
2548
  const {
2140
- key
2549
+ key,
2550
+ shiftKey
2141
2551
  } = event;
2142
- const column = columns[selectedPosition.idx];
2143
-
2144
- if (selectedPosition.mode === 'EDIT') {
2145
- if (key === 'Enter') {
2146
- commitEditorChanges();
2147
- closeEditor();
2148
- }
2149
2552
 
2553
+ if (isSelectable && shiftKey && key === ' ') {
2554
+ assertIsValidKeyGetter(rowKeyGetter);
2555
+ const rowKey = rowKeyGetter(row);
2556
+ selectRow({
2557
+ row,
2558
+ checked: !selectedRows.has(rowKey),
2559
+ isShiftClick: false
2560
+ });
2561
+ event.preventDefault();
2150
2562
  return;
2151
2563
  }
2152
2564
 
2565
+ const column = columns[selectedPosition.idx];
2153
2566
  (_column$editorOptions = column.editorOptions) == null ? void 0 : _column$editorOptions.onCellKeyDown == null ? void 0 : _column$editorOptions.onCellKeyDown(event);
2154
2567
  if (event.isDefaultPrevented()) return;
2155
2568
 
@@ -2160,7 +2573,6 @@
2160
2573
  }) => ({
2161
2574
  idx,
2162
2575
  rowIdx,
2163
- key,
2164
2576
  mode: 'EDIT',
2165
2577
  row,
2166
2578
  originalRow: row
@@ -2168,128 +2580,30 @@
2168
2580
  }
2169
2581
  }
2170
2582
 
2171
- function handleDragEnd() {
2172
- const overRowIdx = latestDraggedOverRowIdx.current;
2173
- if (overRowIdx === undefined || !onFill || !onRowsChange) return;
2174
- const {
2175
- idx,
2176
- rowIdx
2177
- } = selectedPosition;
2178
- const sourceRow = rawRows[rowIdx];
2179
- const startRowIndex = rowIdx < overRowIdx ? rowIdx + 1 : overRowIdx;
2180
- const endRowIndex = rowIdx < overRowIdx ? overRowIdx + 1 : rowIdx;
2181
- const targetRows = rawRows.slice(startRowIndex, endRowIndex);
2182
- const column = columns[idx];
2183
- const updatedTargetRows = onFill({
2184
- columnKey: column.key,
2185
- sourceRow,
2186
- targetRows
2187
- });
2188
- const updatedRows = [...rawRows];
2189
- const indexes = [];
2190
-
2191
- for (let i = startRowIndex; i < endRowIndex; i++) {
2192
- const targetRowIdx = i - startRowIndex;
2193
-
2194
- if (updatedRows[i] !== updatedTargetRows[targetRowIdx]) {
2195
- updatedRows[i] = updatedTargetRows[targetRowIdx];
2196
- indexes.push(i);
2197
- }
2198
- }
2199
-
2200
- if (indexes.length > 0) {
2201
- onRowsChange(updatedRows, {
2202
- indexes,
2203
- column
2204
- });
2205
- }
2206
-
2207
- setDraggedOverRowIdx(undefined);
2583
+ function isColIdxWithinSelectionBounds(idx) {
2584
+ return idx >= minColIdx && idx <= maxColIdx;
2208
2585
  }
2209
2586
 
2210
- function handleMouseDown(event) {
2211
- if (event.buttons !== 1) return;
2212
- setDragging(true);
2213
- window.addEventListener('mouseover', onMouseOver);
2214
- window.addEventListener('mouseup', onMouseUp);
2215
-
2216
- function onMouseOver(event) {
2217
- if (event.buttons !== 1) onMouseUp();
2218
- }
2219
-
2220
- function onMouseUp() {
2221
- window.removeEventListener('mouseover', onMouseOver);
2222
- window.removeEventListener('mouseup', onMouseUp);
2223
- setDragging(false);
2224
- handleDragEnd();
2225
- }
2587
+ function isRowIdxWithinViewportBounds(rowIdx) {
2588
+ return rowIdx >= 0 && rowIdx < rows.length;
2226
2589
  }
2227
2590
 
2228
- function handleDoubleClick(event) {
2229
- event.stopPropagation();
2230
- if (!onFill || !onRowsChange) return;
2231
- const {
2232
- idx,
2233
- rowIdx
2234
- } = selectedPosition;
2235
- const sourceRow = rawRows[rowIdx];
2236
- const targetRows = rawRows.slice(rowIdx + 1);
2237
- const column = columns[idx];
2238
- const updatedTargetRows = onFill({
2239
- columnKey: column.key,
2240
- sourceRow,
2241
- targetRows
2242
- });
2243
- const updatedRows = [...rawRows];
2244
- const indexes = [];
2245
-
2246
- for (let i = rowIdx + 1; i < updatedRows.length; i++) {
2247
- const targetRowIdx = i - rowIdx - 1;
2248
-
2249
- if (updatedRows[i] !== updatedTargetRows[targetRowIdx]) {
2250
- updatedRows[i] = updatedTargetRows[targetRowIdx];
2251
- indexes.push(i);
2252
- }
2253
- }
2254
-
2255
- if (indexes.length > 0) {
2256
- onRowsChange(updatedRows, {
2257
- indexes,
2258
- column
2259
- });
2260
- }
2261
- }
2262
-
2263
- function handleEditorRowChange(row, commitChanges) {
2264
- if (selectedPosition.mode === 'SELECT') return;
2265
-
2266
- if (commitChanges) {
2267
- updateRow(getRawRowIdx(selectedPosition.rowIdx), row);
2268
- closeEditor();
2269
- } else {
2270
- setSelectedPosition(position => ({ ...position,
2271
- row
2272
- }));
2273
- }
2274
- }
2275
-
2276
- function handleOnClose(commitChanges) {
2277
- if (commitChanges) {
2278
- commitEditorChanges();
2279
- }
2280
-
2281
- closeEditor();
2591
+ function isCellWithinSelectionBounds({
2592
+ idx,
2593
+ rowIdx
2594
+ }) {
2595
+ return rowIdx >= minRowIdx && rowIdx <= maxRowIdx && isColIdxWithinSelectionBounds(idx);
2282
2596
  }
2283
2597
 
2284
- function isCellWithinBounds({
2598
+ function isCellWithinViewportBounds({
2285
2599
  idx,
2286
2600
  rowIdx
2287
2601
  }) {
2288
- return rowIdx >= 0 && rowIdx < rows.length && idx >= minColIdx && idx < columns.length;
2602
+ return isRowIdxWithinViewportBounds(rowIdx) && isColIdxWithinSelectionBounds(idx);
2289
2603
  }
2290
2604
 
2291
2605
  function isCellEditable(position) {
2292
- return isCellWithinBounds(position) && isSelectedCellEditable({
2606
+ return isCellWithinViewportBounds(position) && isSelectedCellEditable({
2293
2607
  columns,
2294
2608
  rows,
2295
2609
  selectedPosition: position,
@@ -2298,37 +2612,23 @@
2298
2612
  }
2299
2613
 
2300
2614
  function selectCell(position, enableEditor) {
2301
- if (!isCellWithinBounds(position)) return;
2615
+ if (!isCellWithinSelectionBounds(position)) return;
2302
2616
  commitEditorChanges();
2303
2617
 
2304
2618
  if (enableEditor && isCellEditable(position)) {
2305
2619
  const row = rows[position.rowIdx];
2306
2620
  setSelectedPosition({ ...position,
2307
2621
  mode: 'EDIT',
2308
- key: null,
2309
2622
  row,
2310
2623
  originalRow: row
2311
2624
  });
2625
+ } else if (isSamePosition(selectedPosition, position)) {
2626
+ scrollToCell(position);
2312
2627
  } else {
2313
2628
  setSelectedPosition({ ...position,
2314
2629
  mode: 'SELECT'
2315
2630
  });
2316
2631
  }
2317
-
2318
- onSelectedCellChange == null ? void 0 : onSelectedCellChange({ ...position
2319
- });
2320
- }
2321
-
2322
- function closeEditor() {
2323
- if (selectedPosition.mode === 'SELECT') return;
2324
- setSelectedPosition(({
2325
- idx,
2326
- rowIdx
2327
- }) => ({
2328
- idx,
2329
- rowIdx,
2330
- mode: 'SELECT'
2331
- }));
2332
2632
  }
2333
2633
 
2334
2634
  function scrollToCell({
@@ -2344,7 +2644,7 @@
2344
2644
  var _rowIdx;
2345
2645
 
2346
2646
  (_rowIdx = rowIdx) != null ? _rowIdx : rowIdx = selectedPosition.rowIdx;
2347
- if (!isCellWithinBounds({
2647
+ if (!isCellWithinSelectionBounds({
2348
2648
  rowIdx,
2349
2649
  idx
2350
2650
  })) return;
@@ -2357,34 +2657,35 @@
2357
2657
  width
2358
2658
  } = columnMetrics.get(column);
2359
2659
  let right = left + width;
2360
- const row = rows[rowIdx];
2361
-
2362
- if (!isGroupRow(row)) {
2363
- const colSpan = getColSpan(column, lastFrozenColumnIndex, {
2364
- type: 'ROW',
2365
- row
2366
- });
2660
+ const colSpan = getSelectedCellColSpan({
2661
+ rows,
2662
+ summaryRows,
2663
+ rowIdx,
2664
+ lastFrozenColumnIndex,
2665
+ column,
2666
+ isGroupRow
2667
+ });
2367
2668
 
2368
- if (colSpan !== undefined) {
2369
- const {
2370
- left,
2371
- width
2372
- } = columnMetrics.get(columns[column.idx + colSpan - 1]);
2373
- right = left + width;
2374
- }
2669
+ if (colSpan !== undefined) {
2670
+ const {
2671
+ left,
2672
+ width
2673
+ } = columnMetrics.get(columns[column.idx + colSpan - 1]);
2674
+ right = left + width;
2375
2675
  }
2376
2676
 
2377
2677
  const isCellAtLeftBoundary = left < scrollLeft + totalFrozenColumnWidth;
2378
2678
  const isCellAtRightBoundary = right > clientWidth + scrollLeft;
2679
+ const sign = isRtl ? -1 : 1;
2379
2680
 
2380
2681
  if (isCellAtLeftBoundary) {
2381
- current.scrollLeft = left - totalFrozenColumnWidth;
2682
+ current.scrollLeft = (left - totalFrozenColumnWidth) * sign;
2382
2683
  } else if (isCellAtRightBoundary) {
2383
- current.scrollLeft = right - clientWidth;
2684
+ current.scrollLeft = (right - clientWidth) * sign;
2384
2685
  }
2385
2686
  }
2386
2687
 
2387
- if (typeof rowIdx === 'number') {
2688
+ if (typeof rowIdx === 'number' && isRowIdxWithinViewportBounds(rowIdx)) {
2388
2689
  const rowTop = getRowTop(rowIdx);
2389
2690
  const rowHeight = getRowHeight(rowIdx);
2390
2691
 
@@ -2402,9 +2703,9 @@
2402
2703
  rowIdx
2403
2704
  } = selectedPosition;
2404
2705
  const row = rows[rowIdx];
2405
- const isRowSelected = isCellWithinBounds(selectedPosition) && idx === -1;
2706
+ const isRowSelected = selectedCellIsWithinSelectionBounds && idx === -1;
2406
2707
 
2407
- if (key === 'ArrowLeft' && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) {
2708
+ if (key === leftKey && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) {
2408
2709
  let parentRowIdx = -1;
2409
2710
 
2410
2711
  for (let i = selectedPosition.rowIdx - 1; i >= 0; i--) {
@@ -2437,29 +2738,19 @@
2437
2738
  rowIdx: rowIdx + 1
2438
2739
  };
2439
2740
 
2440
- case 'ArrowLeft':
2741
+ case leftKey:
2441
2742
  return {
2442
2743
  idx: idx - 1,
2443
2744
  rowIdx
2444
2745
  };
2445
2746
 
2446
- case 'ArrowRight':
2747
+ case rightKey:
2447
2748
  return {
2448
2749
  idx: idx + 1,
2449
2750
  rowIdx
2450
2751
  };
2451
2752
 
2452
2753
  case 'Tab':
2453
- if (selectedPosition.idx === -1 && selectedPosition.rowIdx === -1) {
2454
- return shiftKey ? {
2455
- idx: columns.length - 1,
2456
- rowIdx: rows.length - 1
2457
- } : {
2458
- idx: 0,
2459
- rowIdx: 0
2460
- };
2461
- }
2462
-
2463
2754
  return {
2464
2755
  idx: idx + (shiftKey ? -1 : 1),
2465
2756
  rowIdx
@@ -2470,12 +2761,9 @@
2470
2761
  idx,
2471
2762
  rowIdx: 0
2472
2763
  };
2473
- return ctrlKey ? {
2474
- idx: 0,
2475
- rowIdx: 0
2476
- } : {
2764
+ return {
2477
2765
  idx: 0,
2478
- rowIdx
2766
+ rowIdx: ctrlKey ? minRowIdx : rowIdx
2479
2767
  };
2480
2768
 
2481
2769
  case 'End':
@@ -2483,16 +2771,14 @@
2483
2771
  idx,
2484
2772
  rowIdx: rows.length - 1
2485
2773
  };
2486
- return ctrlKey ? {
2487
- idx: columns.length - 1,
2488
- rowIdx: rows.length - 1
2489
- } : {
2490
- idx: columns.length - 1,
2491
- rowIdx
2774
+ return {
2775
+ idx: maxColIdx,
2776
+ rowIdx: ctrlKey ? maxRowIdx : rowIdx
2492
2777
  };
2493
2778
 
2494
2779
  case 'PageUp':
2495
2780
  {
2781
+ if (selectedPosition.rowIdx === minRowIdx) return selectedPosition;
2496
2782
  const nextRowY = getRowTop(rowIdx) + getRowHeight(rowIdx) - clientHeight;
2497
2783
  return {
2498
2784
  idx,
@@ -2502,6 +2788,7 @@
2502
2788
 
2503
2789
  case 'PageDown':
2504
2790
  {
2791
+ if (selectedPosition.rowIdx >= rows.length) return selectedPosition;
2505
2792
  const nextRowY = getRowTop(rowIdx) + clientHeight;
2506
2793
  return {
2507
2794
  idx,
@@ -2515,13 +2802,6 @@
2515
2802
  }
2516
2803
 
2517
2804
  function navigate(event) {
2518
- if (selectedPosition.mode === 'EDIT') {
2519
- var _columns$selectedPosi2, _columns$selectedPosi3;
2520
-
2521
- const onNavigation = (_columns$selectedPosi2 = (_columns$selectedPosi3 = columns[selectedPosition.idx].editorOptions) == null ? void 0 : _columns$selectedPosi3.onNavigation) != null ? _columns$selectedPosi2 : onEditorNavigation;
2522
- if (!onNavigation(event)) return;
2523
- }
2524
-
2525
2805
  const {
2526
2806
  key,
2527
2807
  shiftKey
@@ -2532,8 +2812,9 @@
2532
2812
  if (canExitGrid({
2533
2813
  shiftKey,
2534
2814
  cellNavigationMode,
2535
- columns,
2536
- rowsCount: rows.length,
2815
+ maxColIdx,
2816
+ minRowIdx,
2817
+ maxRowIdx,
2537
2818
  selectedPosition
2538
2819
  })) {
2539
2820
  commitEditorChanges();
@@ -2545,18 +2826,23 @@
2545
2826
 
2546
2827
  event.preventDefault();
2547
2828
  const ctrlKey = isCtrlKeyHeldDown(event);
2548
- const nextPosition = getNextSelectedCellPosition({
2829
+ const nextPosition = getNextPosition(key, ctrlKey, shiftKey);
2830
+ if (isSamePosition(selectedPosition, nextPosition)) return;
2831
+ const nextSelectedCellPosition = getNextSelectedCellPosition({
2549
2832
  columns,
2550
2833
  colSpanColumns,
2551
2834
  rows,
2835
+ summaryRows,
2836
+ minRowIdx,
2837
+ maxRowIdx,
2552
2838
  lastFrozenColumnIndex,
2553
2839
  cellNavigationMode: mode,
2554
2840
  currentPosition: selectedPosition,
2555
- nextPosition: getNextPosition(key, ctrlKey, shiftKey),
2556
- isCellWithinBounds,
2841
+ nextPosition,
2842
+ isCellWithinBounds: isCellWithinSelectionBounds,
2557
2843
  isGroupRow
2558
2844
  });
2559
- selectCell(nextPosition);
2845
+ selectCell(nextSelectedCellPosition);
2560
2846
  }
2561
2847
 
2562
2848
  function getDraggedOverCellIdx(currentRowIdx) {
@@ -2568,48 +2854,128 @@
2568
2854
  return isDraggedOver ? selectedPosition.idx : undefined;
2569
2855
  }
2570
2856
 
2571
- function getSelectedCellProps(rowIdx) {
2572
- if (selectedPosition.rowIdx !== rowIdx) return;
2857
+ function getLayoutCssVars() {
2858
+ if (autoResizeColumn === null) return layoutCssVars;
2859
+ const {
2860
+ gridTemplateColumns
2861
+ } = layoutCssVars;
2862
+ const newSizes = gridTemplateColumns.split(' ');
2863
+ newSizes[autoResizeColumn.idx] = 'max-content';
2864
+ return { ...layoutCssVars,
2865
+ gridTemplateColumns: newSizes.join(' ')
2866
+ };
2867
+ }
2573
2868
 
2574
- if (selectedPosition.mode === 'EDIT') {
2575
- return {
2576
- mode: 'EDIT',
2577
- idx: selectedPosition.idx,
2578
- onKeyDown: handleKeyDown,
2579
- editorProps: {
2580
- editorPortalTarget,
2581
- row: selectedPosition.row,
2582
- onRowChange: handleEditorRowChange,
2583
- onClose: handleOnClose
2584
- }
2585
- };
2869
+ function getDragHandle(rowIdx) {
2870
+ if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'EDIT' || hasGroups || onFill == null) {
2871
+ return;
2586
2872
  }
2587
2873
 
2588
- return {
2589
- mode: 'SELECT',
2590
- idx: selectedPosition.idx,
2591
- onFocus: handleFocus,
2592
- onKeyDown: handleKeyDown,
2593
- dragHandleProps: enableCellDragAndDrop && isCellEditable(selectedPosition) ? {
2594
- onMouseDown: handleMouseDown,
2595
- onDoubleClick: handleDoubleClick
2596
- } : undefined
2874
+ return /*#__PURE__*/e(DragHandle, {
2875
+ rows: rawRows,
2876
+ columns: columns,
2877
+ selectedPosition: selectedPosition,
2878
+ isCellEditable: isCellEditable,
2879
+ latestDraggedOverRowIdx: latestDraggedOverRowIdx,
2880
+ onRowsChange: onRowsChange,
2881
+ onFill: onFill,
2882
+ setDragging: setDragging,
2883
+ setDraggedOverRowIdx: setDraggedOverRowIdx
2884
+ });
2885
+ }
2886
+
2887
+ function getCellEditor(rowIdx) {
2888
+ if (selectedPosition.rowIdx !== rowIdx || selectedPosition.mode === 'SELECT') return;
2889
+ const {
2890
+ idx,
2891
+ row
2892
+ } = selectedPosition;
2893
+ const column = columns[idx];
2894
+ const colSpan = getColSpan(column, lastFrozenColumnIndex, {
2895
+ type: 'ROW',
2896
+ row
2897
+ });
2898
+
2899
+ const closeEditor = () => {
2900
+ setSelectedPosition(({
2901
+ idx,
2902
+ rowIdx
2903
+ }) => ({
2904
+ idx,
2905
+ rowIdx,
2906
+ mode: 'SELECT'
2907
+ }));
2597
2908
  };
2909
+
2910
+ const onRowChange = (row, commitChanges) => {
2911
+ if (commitChanges) {
2912
+ updateRow(selectedPosition.rowIdx, row);
2913
+ closeEditor();
2914
+ } else {
2915
+ setSelectedPosition(position => ({ ...position,
2916
+ row
2917
+ }));
2918
+ }
2919
+ };
2920
+
2921
+ if (rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) {
2922
+ closeEditor();
2923
+ }
2924
+
2925
+ return /*#__PURE__*/e(EditCell, {
2926
+ column: column,
2927
+ colSpan: colSpan,
2928
+ row: row,
2929
+ onRowChange: onRowChange,
2930
+ closeEditor: closeEditor,
2931
+ scrollToCell: () => {
2932
+ scrollToCell(selectedPosition);
2933
+ }
2934
+ }, column.key);
2935
+ }
2936
+
2937
+ function getRowViewportColumns(rowIdx) {
2938
+ const selectedColumn = columns[selectedPosition.idx];
2939
+
2940
+ if (selectedColumn !== undefined && selectedPosition.rowIdx === rowIdx && !viewportColumns.includes(selectedColumn)) {
2941
+ return selectedPosition.idx > colOverscanEndIdx ? [...viewportColumns, selectedColumn] : [...viewportColumns.slice(0, lastFrozenColumnIndex + 1), selectedColumn, ...viewportColumns.slice(lastFrozenColumnIndex + 1)];
2942
+ }
2943
+
2944
+ return viewportColumns;
2598
2945
  }
2599
2946
 
2600
2947
  function getViewportRows() {
2601
2948
  const rowElements = [];
2602
2949
  let startRowIndex = 0;
2950
+ const {
2951
+ idx: selectedIdx,
2952
+ rowIdx: selectedRowIdx
2953
+ } = selectedPosition;
2954
+ const startRowIdx = selectedCellIsWithinViewportBounds && selectedRowIdx < rowOverscanStartIdx ? rowOverscanStartIdx - 1 : rowOverscanStartIdx;
2955
+ const endRowIdx = selectedCellIsWithinViewportBounds && selectedRowIdx > rowOverscanEndIdx ? rowOverscanEndIdx + 1 : rowOverscanEndIdx;
2956
+
2957
+ for (let viewportRowIdx = startRowIdx; viewportRowIdx <= endRowIdx; viewportRowIdx++) {
2958
+ const isRowOutsideViewport = viewportRowIdx === rowOverscanStartIdx - 1 || viewportRowIdx === rowOverscanEndIdx + 1;
2959
+ const rowIdx = isRowOutsideViewport ? selectedRowIdx : viewportRowIdx;
2960
+ let rowColumns = viewportColumns;
2961
+ const selectedColumn = columns[selectedIdx];
2962
+
2963
+ if (selectedColumn !== undefined) {
2964
+ if (isRowOutsideViewport) {
2965
+ rowColumns = [selectedColumn];
2966
+ } else {
2967
+ rowColumns = getRowViewportColumns(rowIdx);
2968
+ }
2969
+ }
2603
2970
 
2604
- for (let rowIdx = rowOverscanStartIdx; rowIdx <= rowOverscanEndIdx; rowIdx++) {
2605
2971
  const row = rows[rowIdx];
2606
- const top = getRowTop(rowIdx) + headerRowHeight;
2972
+ const gridRowStart = headerRowsCount + rowIdx + 1;
2607
2973
 
2608
2974
  if (isGroupRow(row)) {
2609
2975
  ({
2610
2976
  startRowIndex
2611
2977
  } = row);
2612
- const isGroupRowSelected = isSelectable && row.childRows.every(cr => selectedRows == null ? void 0 : selectedRows.has(rowKeyGetter(cr)));
2978
+ const isGroupRowSelected = isSelectable && row.childRows.every(cr => selectedRows.has(rowKeyGetter(cr)));
2613
2979
  rowElements.push( /*#__PURE__*/e(GroupRowRenderer, {
2614
2980
  "aria-level": row.level + 1,
2615
2981
  "aria-setsize": row.setSize,
@@ -2618,19 +2984,18 @@
2618
2984
  "aria-selected": isSelectable ? isGroupRowSelected : undefined,
2619
2985
  id: row.id,
2620
2986
  groupKey: row.groupKey,
2621
- viewportColumns: viewportColumns,
2987
+ viewportColumns: rowColumns,
2622
2988
  childRows: row.childRows,
2623
2989
  rowIdx: rowIdx,
2624
- top: top,
2990
+ row: row,
2991
+ gridRowStart: gridRowStart,
2625
2992
  height: getRowHeight(rowIdx),
2626
2993
  level: row.level,
2627
2994
  isExpanded: row.isExpanded,
2628
- selectedCellIdx: selectedPosition.rowIdx === rowIdx ? selectedPosition.idx : undefined,
2995
+ selectedCellIdx: selectedRowIdx === rowIdx ? selectedIdx : undefined,
2629
2996
  isRowSelected: isGroupRowSelected,
2630
- onFocus: selectedPosition.rowIdx === rowIdx ? handleFocus : undefined,
2631
- onKeyDown: selectedPosition.rowIdx === rowIdx ? handleKeyDown : undefined,
2632
- selectCell: selectCellWrapper,
2633
- toggleGroup: toggleGroupWrapper
2997
+ selectGroup: selectGroupLatest,
2998
+ toggleGroup: toggleGroupLatest
2634
2999
  }, row.id));
2635
3000
  continue;
2636
3001
  }
@@ -2653,34 +3018,44 @@
2653
3018
  "aria-selected": isSelectable ? isRowSelected : undefined,
2654
3019
  rowIdx: rowIdx,
2655
3020
  row: row,
2656
- viewportColumns: viewportColumns,
3021
+ viewportColumns: rowColumns,
2657
3022
  isRowSelected: isRowSelected,
2658
3023
  onRowClick: onRowClick,
3024
+ onRowDoubleClick: onRowDoubleClick,
2659
3025
  rowClass: rowClass,
2660
- top: top,
3026
+ gridRowStart: gridRowStart,
2661
3027
  height: getRowHeight(rowIdx),
2662
3028
  copiedCellIdx: copiedCell !== null && copiedCell.row === row ? columns.findIndex(c => c.key === copiedCell.columnKey) : undefined,
3029
+ selectedCellIdx: selectedRowIdx === rowIdx ? selectedIdx : undefined,
2663
3030
  draggedOverCellIdx: getDraggedOverCellIdx(rowIdx),
2664
3031
  setDraggedOverRowIdx: isDragging ? setDraggedOverRowIdx : undefined,
2665
3032
  lastFrozenColumnIndex: lastFrozenColumnIndex,
2666
- selectedCellProps: getSelectedCellProps(rowIdx),
2667
- onRowChange: handleFormatterRowChangeWrapper,
2668
- selectCell: selectCellWrapper
3033
+ onRowChange: handleFormatterRowChangeLatest,
3034
+ selectCell: selectViewportCellLatest,
3035
+ selectedCellDragHandle: getDragHandle(rowIdx),
3036
+ selectedCellEditor: getCellEditor(rowIdx)
2669
3037
  }, key));
2670
3038
  }
2671
3039
 
2672
3040
  return rowElements;
2673
3041
  }
2674
3042
 
2675
- if (selectedPosition.idx >= columns.length || selectedPosition.rowIdx >= rows.length) {
3043
+ if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) {
2676
3044
  setSelectedPosition(initialPosition);
2677
3045
  setDraggedOverRowIdx(undefined);
2678
3046
  }
2679
3047
 
2680
- if (selectedPosition.mode === 'EDIT' && rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) {
2681
- closeEditor();
3048
+ let templateRows = `${headerRowHeight}px`;
3049
+
3050
+ if (rows.length > 0) {
3051
+ templateRows += gridTemplateRows;
3052
+ }
3053
+
3054
+ if (summaryRowsCount > 0) {
3055
+ templateRows += ` repeat(${summaryRowsCount}, ${summaryRowHeight}px)`;
2682
3056
  }
2683
3057
 
3058
+ const isGroupRowFocused = selectedPosition.idx === -1 && selectedPosition.rowIdx !== -2;
2684
3059
  return /*#__PURE__*/e("div", {
2685
3060
  role: hasGroups ? 'treegrid' : 'grid',
2686
3061
  "aria-label": ariaLabel,
@@ -2689,88 +3064,86 @@
2689
3064
  "aria-multiselectable": isSelectable ? true : undefined,
2690
3065
  "aria-colcount": columns.length,
2691
3066
  "aria-rowcount": headerRowsCount + rowsCount + summaryRowsCount,
2692
- className: clsx(rootClassname, className, isDragging && viewportDraggingClassname),
3067
+ className: clsx(rootClassname, className, isDragging && viewportDraggingClassname, autoResizeColumn !== null && cellAutoResizeClassname),
2693
3068
  style: { ...style,
2694
- '--header-row-height': `${headerRowHeight}px`,
2695
- '--row-width': `${totalColumnWidth}px`,
2696
- '--summary-row-height': `${summaryRowHeight}px`,
2697
- ...layoutCssVars
3069
+ gridTemplateRows: templateRows,
3070
+ '--rdg-header-row-height': `${headerRowHeight}px`,
3071
+ '--rdg-summary-row-height': `${summaryRowHeight}px`,
3072
+ '--rdg-sign': isRtl ? -1 : 1,
3073
+ ...getLayoutCssVars()
2698
3074
  },
3075
+ dir: direction,
2699
3076
  ref: gridRef,
2700
3077
  onScroll: handleScroll,
2701
- children: [/*#__PURE__*/e(HeaderRow$1, {
2702
- rowKeyGetter: rowKeyGetter,
2703
- rows: rawRows,
2704
- columns: viewportColumns,
2705
- onColumnResize: handleColumnResize,
2706
- allRowsSelected: allRowsSelected,
2707
- onSelectedRowsChange: onSelectedRowsChange,
2708
- sortColumns: sortColumns,
2709
- onSortColumnsChange: onSortColumnsChange,
2710
- lastFrozenColumnIndex: lastFrozenColumnIndex
2711
- }), rows.length === 0 && EmptyRowsRenderer ? /*#__PURE__*/e(EmptyRowsRenderer, {}) : /*#__PURE__*/e(d$1, {
2712
- children: [/*#__PURE__*/e("div", {
2713
- ref: focusSinkRef,
2714
- tabIndex: 0,
2715
- className: focusSinkClassname,
2716
- onKeyDown: handleKeyDown,
2717
- onFocus: onGridFocus
2718
- }), /*#__PURE__*/e("div", {
2719
- style: {
2720
- height: max(totalRowHeight, clientHeight)
2721
- }
2722
- }), /*#__PURE__*/e(RowSelectionChangeProvider, {
2723
- value: selectRowWrapper,
2724
- children: getViewportRows()
2725
- }), summaryRows == null ? void 0 : summaryRows.map((row, rowIdx) => /*#__PURE__*/e(SummaryRow$1, {
2726
- "aria-rowindex": headerRowsCount + rowsCount + rowIdx + 1,
2727
- rowIdx: rowIdx,
2728
- row: row,
2729
- bottom: summaryRowHeight * (summaryRows.length - 1 - rowIdx),
2730
- viewportColumns: viewportColumns,
2731
- lastFrozenColumnIndex: lastFrozenColumnIndex
2732
- }, rowIdx))]
3078
+ onKeyDown: handleKeyDown,
3079
+ "data-testid": testId,
3080
+ children: [hasGroups && /*#__PURE__*/e("div", {
3081
+ ref: rowRef,
3082
+ tabIndex: isGroupRowFocused ? 0 : -1,
3083
+ className: clsx(focusSinkClassname, isGroupRowFocused && [rowSelected, lastFrozenColumnIndex !== -1 && rowSelectedWithFrozenCell]),
3084
+ style: {
3085
+ gridRowStart: selectedPosition.rowIdx + 2
3086
+ },
3087
+ onKeyDown: handleKeyDown
3088
+ }), /*#__PURE__*/e(DataGridDefaultComponentsProvider, {
3089
+ value: defaultGridComponents,
3090
+ children: [/*#__PURE__*/e(HeaderRow$1, {
3091
+ columns: getRowViewportColumns(-1),
3092
+ onColumnResize: handleColumnResize,
3093
+ allRowsSelected: allRowsSelected,
3094
+ onAllRowsSelectionChange: selectAllRowsLatest,
3095
+ sortColumns: sortColumns,
3096
+ onSortColumnsChange: onSortColumnsChange,
3097
+ lastFrozenColumnIndex: lastFrozenColumnIndex,
3098
+ selectedCellIdx: isHeaderRowSelected ? selectedPosition.idx : undefined,
3099
+ selectCell: selectHeaderCellLatest,
3100
+ shouldFocusGrid: !selectedCellIsWithinSelectionBounds,
3101
+ direction: direction
3102
+ }), rows.length === 0 && noRowsFallback ? noRowsFallback : /*#__PURE__*/e(d$1, {
3103
+ children: [/*#__PURE__*/e(RowSelectionChangeProvider, {
3104
+ value: selectRowLatest,
3105
+ children: getViewportRows()
3106
+ }), summaryRows == null ? void 0 : summaryRows.map((row, rowIdx) => {
3107
+ const gridRowStart = headerRowsCount + rows.length + rowIdx + 1;
3108
+ const summaryRowIdx = headerRowsCount + rows.length + rowIdx - 1;
3109
+ const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;
3110
+ const top = clientHeight > totalRowHeight ? gridHeight - summaryRowHeight * (summaryRows.length - rowIdx) : undefined;
3111
+ const bottom = top === undefined ? summaryRowHeight * (summaryRows.length - 1 - rowIdx) : undefined;
3112
+ return /*#__PURE__*/e(SummaryRow$1, {
3113
+ "aria-rowindex": headerRowsCount + rowsCount + rowIdx + 1,
3114
+ rowIdx: rowIdx,
3115
+ gridRowStart: gridRowStart,
3116
+ row: row,
3117
+ top: top,
3118
+ bottom: bottom,
3119
+ viewportColumns: getRowViewportColumns(summaryRowIdx),
3120
+ lastFrozenColumnIndex: lastFrozenColumnIndex,
3121
+ selectedCellIdx: isSummaryRowSelected ? selectedPosition.idx : undefined,
3122
+ selectCell: selectSummaryCellLatest
3123
+ }, rowIdx);
3124
+ })]
3125
+ })]
2733
3126
  })]
2734
3127
  });
2735
3128
  }
2736
3129
 
2737
- const DataGrid$1 = /*#__PURE__*/x(DataGrid);
2738
-
2739
- 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}";
2740
- styleInject$1(css_248z$c);
2741
-
2742
- var DataGrid$2 = DataGrid$1;
2743
-
2744
- function styleInject(css, ref) {
2745
- if ( ref === void 0 ) ref = {};
2746
- var insertAt = ref.insertAt;
2747
-
2748
- if (!css || typeof document === 'undefined') { return; }
3130
+ function isSamePosition(p1, p2) {
3131
+ return p1.idx === p2.idx && p1.rowIdx === p2.rowIdx;
3132
+ }
2749
3133
 
2750
- var head = document.head || document.getElementsByTagName('head')[0];
2751
- var style = document.createElement('style');
2752
- style.type = 'text/css';
3134
+ const DataGrid$1 = /*#__PURE__*/x(DataGrid);
2753
3135
 
2754
- if (insertAt === 'top') {
2755
- if (head.firstChild) {
2756
- head.insertBefore(style, head.firstChild);
2757
- } else {
2758
- head.appendChild(style);
2759
- }
2760
- } else {
2761
- head.appendChild(style);
2762
- }
3136
+ var css_248z$g = ".t16y9g8l700-beta12{appearance:none;background-color:var(--rdg-background-color);block-size:100%;border:2px solid #ccc;box-sizing:border-box;color:var(--rdg-color);font-family:inherit;font-size:var(--rdg-font-size);inline-size:100%;padding-block:0;padding-inline:6px;vertical-align:top}.t16y9g8l700-beta12:focus{border-color:var(--rdg-selection-color);outline:none}.t16y9g8l700-beta12::placeholder{color:#999;opacity:1}";
3137
+ styleInject$1(css_248z$g,{"insertAt":"top"});
2763
3138
 
2764
- if (style.styleSheet) {
2765
- style.styleSheet.cssText = css;
2766
- } else {
2767
- style.appendChild(document.createTextNode(css));
2768
- }
3139
+ function useData(widget) {
3140
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3141
+ var columns = _(function () { return widget.columns(); }, [widget, widget.dataChecksum()]);
3142
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3143
+ var data = _(function () { return widget.data(); }, [widget, widget.dataChecksum()]);
3144
+ return [columns, data];
2769
3145
  }
2770
3146
 
2771
- var css_248z = ".dgrid2_Table .rdg{font-family:monospace,Courier New,Courier}.dgrid2_Table .rdg-checkbox-label .rdg-checkbox{block-size:16px;border-width:2px;box-shadow:inset 0 0 0 3px var(--rdg-background-color);inline-size:16px}";
2772
- styleInject(css_248z);
2773
-
2774
3147
  function copyAndSort(items, attribute, descending) {
2775
3148
  var key = attribute;
2776
3149
  return __spreadArray([], items, true).sort(function (a, b) {
@@ -2783,76 +3156,167 @@
2783
3156
  return 0;
2784
3157
  });
2785
3158
  }
3159
+ var EmptyRowsRenderer = function (_a) {
3160
+ var message = _a.message;
3161
+ return v$1("div", { style: { textAlign: "center", gridColumn: "1/-1" } },
3162
+ message,
3163
+ v$1("span", null, "--- * --- * ---"));
3164
+ };
2786
3165
  var ReactTable = function (_a) {
2787
- var columns = _a.columns, data = _a.data, onRowClickCallback = _a.onRowClickCallback, sort = _a.sort, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, _c = _a.multiSelect, multiSelect = _c === void 0 ? false : _c;
2788
- var _d = m([]), listColumns = _d[0], setListColumns = _d[1];
2789
- var _e = m(), sortColumn = _e[0], setSortColumn = _e[1];
2790
- var _f = m([]), items = _f[0], setItems = _f[1];
2791
- var _g = m(function () { return new Set(); }), selectedRows = _g[0], setSelectedRows = _g[1];
3166
+ var table = _a.table, sort = _a.sort;
3167
+ var _b = useData(table), columns = _b[0], data = _b[1];
3168
+ var multiSelect = table.multiSelect();
3169
+ var columnTypes = table.columnTypes();
3170
+ var columnPatterns = table.columnPatterns();
3171
+ var columnFormats = table.columnFormats();
3172
+ var _c = m([]), listColumns = _c[0], setListColumns = _c[1];
3173
+ var _d = m(), sortColumn = _d[0], setSortColumn = _d[1];
3174
+ var _e = m([]), rows = _e[0], setRows = _e[1];
3175
+ var _f = m(new Set()), selectedRows = _f[0], setSelectedRows = _f[1];
2792
3176
  // Columns ---
2793
3177
  y(function () {
2794
- setListColumns(__spreadArray(__spreadArray([], multiSelect ? [SelectColumn] : [], true), columns.map(function (column) { return ({
2795
- key: column,
2796
- name: column,
2797
- resizable: true,
2798
- sortable: true,
2799
- minWidth: 80,
2800
- }); }), true));
2801
- }, [columns, multiSelect]);
3178
+ setListColumns(__spreadArray(__spreadArray([], multiSelect ? [SelectColumn] : [], true), columns.map(function (column) {
3179
+ var _a;
3180
+ var type = (_a = columnTypes[column]) !== null && _a !== void 0 ? _a : "string";
3181
+ var formatter;
3182
+ var __hpcc_pattern;
3183
+ var __hpcc_format;
3184
+ switch (type) {
3185
+ case "time":
3186
+ __hpcc_pattern = columnPatterns[column] !== undefined ? common.timeParse(columnPatterns[column]) : undefined;
3187
+ __hpcc_format = columnFormats[column] !== undefined ? common.timeFormat(columnFormats[column]) : undefined;
3188
+ break;
3189
+ case "number":
3190
+ formatter = function (props) {
3191
+ return v$1("div", { style: { textAlign: "right" } }, props.row[props.column.key]);
3192
+ };
3193
+ // eslint-disable-next-line no-fallthrough
3194
+ default:
3195
+ __hpcc_format = columnFormats[column] !== undefined ? common.format(columnFormats[column]) : undefined;
3196
+ }
3197
+ return {
3198
+ key: column,
3199
+ name: column,
3200
+ resizable: true,
3201
+ sortable: true,
3202
+ minWidth: 80,
3203
+ formatter: formatter,
3204
+ __hpcc_pattern: __hpcc_pattern,
3205
+ __hpcc_format: __hpcc_format
3206
+ };
3207
+ }), true));
3208
+ }, [columnFormats, columnPatterns, columnTypes, columns, multiSelect]);
2802
3209
  var onSortColumnsChange = A$1(function (sortColumns) {
2803
3210
  var futureSortColumn = sortColumns.slice(-1)[0];
2804
3211
  var sorted = futureSortColumn !== undefined;
2805
3212
  var isSortedDescending = (futureSortColumn === null || futureSortColumn === void 0 ? void 0 : futureSortColumn.direction) === "DESC";
2806
3213
  setSortColumn(futureSortColumn);
2807
- setItems(copyAndSort(items, sorted ? futureSortColumn.columnKey : "key", sorted ? isSortedDescending : false));
2808
- }, [items]);
3214
+ setRows(copyAndSort(rows, sorted ? futureSortColumn.columnKey : "key", sorted ? isSortedDescending : false));
3215
+ }, [rows]);
2809
3216
  var rowKeyGetter = A$1(function (row) {
2810
3217
  return row.key;
2811
3218
  }, []);
2812
3219
  var onSelectedRowsChange = A$1(function (selectedRows) {
2813
3220
  setSelectedRows(selectedRows);
2814
- onRowClickCallback(items.filter(function (row) { return selectedRows.has(rowKeyGetter(row)); }));
2815
- }, [items, onRowClickCallback, rowKeyGetter]);
3221
+ }, []);
2816
3222
  var onRowClick = A$1(function (row, column) {
2817
- onRowClickCallback(items.filter(function (item) { return rowKeyGetter(item) === rowKeyGetter(row); }));
2818
- }, [items, onRowClickCallback, rowKeyGetter]);
3223
+ table.onRowClickCallback(row, column.key);
3224
+ }, [table]);
2819
3225
  // Rows ---
2820
3226
  y(function () {
2821
3227
  var items = data.map(function (row, index) {
2822
3228
  var retVal = {
2823
3229
  key: index
2824
3230
  };
2825
- columns.forEach(function (column, index) {
2826
- retVal[column] = row[index];
3231
+ listColumns.forEach(function (column, index) {
3232
+ var val = row[index];
3233
+ if (column.__hpcc_pattern && column.__hpcc_format) {
3234
+ val = column.__hpcc_format(column.__hpcc_pattern(val));
3235
+ }
3236
+ else if (column.__hpcc_pattern) {
3237
+ val = column.__hpcc_pattern(val).toString();
3238
+ }
3239
+ else if (column.__hpcc_format) {
3240
+ val = column.__hpcc_format(val);
3241
+ }
3242
+ retVal[column.key] = val;
2827
3243
  });
2828
3244
  return retVal;
2829
3245
  });
2830
3246
  if (sort === null || sort === void 0 ? void 0 : sort.attribute) {
2831
3247
  items = copyAndSort(items, sort.attribute, sort.descending);
2832
3248
  }
2833
- setItems(items);
2834
- }, [columns, data, sort]);
2835
- return v$1(DataGrid$2, { columns: listColumns, headerRowHeight: 24, rows: items, rowKeyGetter: rowKeyGetter, rowHeight: 20, className: darkMode ? "rdg-dark" : "rdg-light", sortColumns: sortColumn ? [sortColumn] : [], onSortColumnsChange: onSortColumnsChange, selectedRows: selectedRows, onSelectedRowsChange: multiSelect ? onSelectedRowsChange : undefined, onRowClick: multiSelect ? undefined : onRowClick, "aria-describedby": "", "aria-label": "", "aria-labelledby": "", style: { height: "100%" } });
3249
+ setRows(items);
3250
+ }, [listColumns, data, sort]);
3251
+ return v$1(DataGrid$1, { columns: listColumns, headerRowHeight: 24, rows: rows, rowKeyGetter: rowKeyGetter, rowHeight: 20, components: { noRowsFallback: v$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 : onRowClick, "aria-describedby": "", "aria-label": "", "aria-labelledby": "", style: { height: "100%" } });
2836
3252
  };
3253
+
3254
+ function styleInject(css, ref) {
3255
+ if ( ref === void 0 ) ref = {};
3256
+ var insertAt = ref.insertAt;
3257
+
3258
+ if (!css || typeof document === 'undefined') { return; }
3259
+
3260
+ var head = document.head || document.getElementsByTagName('head')[0];
3261
+ var style = document.createElement('style');
3262
+ style.type = 'text/css';
3263
+
3264
+ if (insertAt === 'top') {
3265
+ if (head.firstChild) {
3266
+ head.insertBefore(style, head.firstChild);
3267
+ } else {
3268
+ head.appendChild(style);
3269
+ }
3270
+ } else {
3271
+ head.appendChild(style);
3272
+ }
3273
+
3274
+ if (style.styleSheet) {
3275
+ style.styleSheet.cssText = css;
3276
+ } else {
3277
+ style.appendChild(document.createTextNode(css));
3278
+ }
3279
+ }
3280
+
3281
+ var css_248z = ".dgrid2_Table .rdg{font-family:monospace,Courier New,Courier}.dgrid2_Table .rdg-checkbox-label .rdg-checkbox{block-size:16px;border-width:2px;box-shadow:inset 0 0 0 3px var(--rdg-background-color);inline-size:16px}";
3282
+ styleInject(css_248z);
3283
+
2837
3284
  var Table = /** @class */ (function (_super) {
2838
3285
  __extends(Table, _super);
2839
3286
  function Table() {
2840
3287
  return _super.call(this) || this;
2841
3288
  }
2842
- Table.prototype.renderTable = function () {
2843
- var _this = this;
2844
- return v$1(ReactTable, { columns: this.columns(), data: this.data(), darkMode: this.darkMode(), onRowClickCallback: function (row, column) {
2845
- var _a;
2846
- if (column === void 0) { column = ""; }
2847
- if (_this._prevRow && JSON.stringify(_this._prevRow) !== JSON.stringify(row)) {
2848
- _this.click(_this._prevRow, (_a = _this._prevColumn) !== null && _a !== void 0 ? _a : "", false);
2849
- }
2850
- if (row) {
2851
- _this.click(row, column, true);
2852
- }
2853
- _this._prevRow = row;
2854
- _this._prevColumn = column;
2855
- } });
3289
+ Table.prototype.columnType = function (column, type) {
3290
+ var _a;
3291
+ if (arguments.length === 1)
3292
+ return this.columnTypes()[column];
3293
+ this.columnTypes(__assign(__assign({}, this.columnTypes()), (_a = {}, _a[column] = type, _a)));
3294
+ return this;
3295
+ };
3296
+ Table.prototype.columnPattern = function (column, pattern) {
3297
+ var _a;
3298
+ if (arguments.length === 1)
3299
+ return this.columnPatterns()[column];
3300
+ this.columnPatterns(__assign(__assign({}, this.columnPatterns()), (_a = {}, _a[column] = pattern, _a)));
3301
+ return this;
3302
+ };
3303
+ Table.prototype.columnFormat = function (column, format) {
3304
+ var _a;
3305
+ if (arguments.length === 1)
3306
+ return this.columnFormats()[column];
3307
+ this.columnFormats(__assign(__assign({}, this.columnFormats()), (_a = {}, _a[column] = format, _a)));
3308
+ return this;
3309
+ };
3310
+ Table.prototype.onRowClickCallback = function (row, column) {
3311
+ var _a;
3312
+ if (this._prevRow && JSON.stringify(this._prevRow) !== JSON.stringify(row)) {
3313
+ this.click(this._prevRow, (_a = this._prevColumn) !== null && _a !== void 0 ? _a : "", false);
3314
+ }
3315
+ if (row) {
3316
+ this.click(row, column, true);
3317
+ }
3318
+ this._prevRow = row;
3319
+ this._prevColumn = column;
2856
3320
  };
2857
3321
  Table.prototype.enter = function (domNode, element) {
2858
3322
  _super.prototype.enter.call(this, domNode, element);
@@ -2863,7 +3327,7 @@
2863
3327
  _super.prototype.update.call(this, domNode, element);
2864
3328
  this._div.style("width", this.width() + "px");
2865
3329
  this._div.style("height", this.height() + "px");
2866
- B(this.renderTable(), this._div.node());
3330
+ B(v$1(ReactTable, { table: this }), this._div.node());
2867
3331
  };
2868
3332
  Table.prototype.exit = function (domNode, element) {
2869
3333
  un(this._div.node());
@@ -2873,6 +3337,10 @@
2873
3337
  // Events ---
2874
3338
  Table.prototype.click = function (row, col, sel) {
2875
3339
  };
3340
+ __decorate([
3341
+ common.publish("...empty...", "string", "No Data Message"),
3342
+ __metadata("design:type", Function)
3343
+ ], Table.prototype, "noDataMessage", void 0);
2876
3344
  __decorate([
2877
3345
  common.publish(false, "boolean", "Dark Mode"),
2878
3346
  __metadata("design:type", Function)
@@ -2881,6 +3349,18 @@
2881
3349
  common.publish(false, "boolean", "Multiple Selection"),
2882
3350
  __metadata("design:type", Function)
2883
3351
  ], Table.prototype, "multiSelect", void 0);
3352
+ __decorate([
3353
+ common.publish({}, "object", "Column Types (\"boolean\" | \"number\" | \"string\" | \"time\""),
3354
+ __metadata("design:type", Function)
3355
+ ], Table.prototype, "columnTypes", void 0);
3356
+ __decorate([
3357
+ common.publish({}, "object", "Column Patterns"),
3358
+ __metadata("design:type", Function)
3359
+ ], Table.prototype, "columnPatterns", void 0);
3360
+ __decorate([
3361
+ common.publish({}, "object", "Column Formats"),
3362
+ __metadata("design:type", Function)
3363
+ ], Table.prototype, "columnFormats", void 0);
2884
3364
  return Table;
2885
3365
  }(common.HTMLWidget));
2886
3366
  Table.prototype._class += " dgrid2_Table";