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