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