1 | {"version":3,"file":"gridjs.umd.js","sources":["../src/types.ts","../node_modules/preact/dist/preact.module.js","../src/util/id.ts","../src/base.ts","../src/view/htmlElement.tsx","../src/util/html.ts","../src/pipeline/processor.ts","../src/cell.ts","../src/row.ts","../src/tabular.ts","../src/util/array.ts","../src/util/eventEmitter.ts","../src/util/deepEqual.ts","../src/pipeline/filter/globalSearch.ts","../src/operator/search.ts","../src/util/className.ts","../src/pipeline/filter/serverGlobalSearch.ts","../node_modules/preact/hooks/dist/hooks.module.js","../src/hooks/useConfig.ts","../src/i18n/en_US.ts","../src/i18n/language.ts","../src/view/plugin/search/actions.ts","../src/hooks/useStore.ts","../src/hooks/useSelector.ts","../src/view/plugin/search/search.tsx","../src/util/debounce.ts","../src/pipeline/limit/pagination.ts","../src/pipeline/limit/serverPagination.ts","../src/view/plugin/pagination.tsx","../src/util/width.ts","../src/view/table/shadow.tsx","../src/util/string.ts","../src/plugin.ts","../src/util/log.ts","../src/header.ts","../src/storage/storage.ts","../src/storage/memory.ts","../src/storage/server.ts","../src/storage/storageUtils.ts","../src/pipeline/pipeline.ts","../src/pipeline/extractor/storage.ts","../src/pipeline/transformer/arrayToTabular.ts","../src/pipeline/initiator/server.ts","../src/pipeline/transformer/storageResponseToArray.ts","../src/pipeline/pipelineUtils.ts","../src/state/store.ts","../src/config.ts","../src/view/table/td.tsx","../src/view/table/tr.tsx","../src/view/table/messageRow.tsx","../src/view/table/tbody.tsx","../src/pipeline/sort/native.ts","../src/view/plugin/sort/actions.ts","../src/pipeline/sort/server.ts","../src/view/plugin/sort/sort.tsx","../src/util/throttle.ts","../src/view/plugin/resize/resize.tsx","../src/view/table/th.tsx","../src/view/table/thead.tsx","../src/util/table.ts","../src/view/actions.ts","../src/view/table/table.tsx","../src/view/headerContainer.tsx","../src/view/footerContainer.tsx","../src/view/container.tsx","../src/grid.ts"],"sourcesContent":["import { ComponentChild } from 'preact';\nimport Row from './row';\nimport { SortConfig } from './view/plugin/sort/sort';\nimport { JSXInternal } from 'preact/src/jsx';\nimport { Plugin } from './plugin';\n\nexport type OneDArray<T> = T[];\nexport type TwoDArray<T> = T[][];\n\n/**\n * Table cell types\n */\nexport type TCell = number | string | boolean | ComponentChild | HTMLElement;\n// Array of Arrays\nexport type TDataArrayRow = OneDArray<TCell>;\nexport type TDataArray = OneDArray<TDataArrayRow>;\n// Array of Objects\nexport type TDataObjectRow = { [key: string]: TCell };\nexport type TDataObject = OneDArray<TDataObjectRow>;\n// (Array of Arrays) and (Array of Objects)\nexport type TData = TDataArray | TDataObject;\n\n// Table header cell type\nexport interface TColumn {\n id?: string;\n // default data for all columns\n data?: ((row: TDataArrayRow | TDataObjectRow) => TCell) | TCell;\n // column label\n name?: string | ComponentChild;\n plugin?: Plugin<any>;\n // column width\n width?: string;\n minWidth?: string;\n sort?: SortConfig;\n columns?: OneDArray<TColumn>;\n resizable?: boolean;\n hidden?: boolean;\n formatter?: (cell: TCell, row: Row, column: TColumn) => ComponentChild;\n // HTML attributes to be added to all cells and header of this column\n attributes?:\n | ((\n // this is null when `attributes` is called for a th\n cell: TCell | null,\n row: Row | null,\n column: TColumn,\n ) => JSXInternal.HTMLAttributes<HTMLTableCellElement>)\n | JSXInternal.HTMLAttributes<HTMLTableCellElement>;\n}\n\n// Comparator function for the sorting plugin\nexport type Comparator<T> = (a: T, b: T) => number;\n\nexport interface TColumnSort {\n index: number;\n // 1 ascending, -1 descending\n direction?: 1 | -1;\n}\n\n// container status\nexport enum Status {\n Init,\n Loading,\n Loaded,\n Rendered,\n Error,\n}\n\nexport type CSSDeclaration = {\n [key: string]: string | number;\n};\n","var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n)}function h(l,u,i){var t,o,r,f={};for(r in u)\"key\"==r?t=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v(l,f,t,o,null)}function v(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function y(){return{current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function b(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||setTimeout)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z(u,t),t.__e!=o&&k(t)))})}function w(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||\"boolean\"==typeof k?null:\"string\"==typeof k||\"number\"==typeof k||\"bigint\"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(p,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null}j(n,k,d=d||f,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),\"function\"==typeof k.type&&k.__k===d.__k?k.__d=s=m(k,s,n):s=A(n,k,d,x,b,s),\"function\"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d))}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h])}function m(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l=\"function\"==typeof i.type?m(i,l,u):A(u,i,i,t,i.__e,l));return l}function x(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(Array.isArray(n)?n.some(function(n){x(n,l)}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)\"children\"===o||\"key\"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&\"function\"!=typeof l[o]||\"children\"===o||\"key\"===o||\"value\"===o||\"checked\"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){\"-\"===l[0]?n.setProperty(l,u):n[l]=null==u?\"\":\"number\"!=typeof u||c.test(l)?u:u+\"px\"}function H(n,l,u,i,t){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof i&&(n.style.cssText=i=\"\"),i)for(l in i)u&&l in u||$(n.style,l,\"\");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/Capture$/,\"\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if(\"dangerouslySetInnerHTML\"!==l){if(t)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&-1==l.indexOf(\"-\")?n.removeAttribute(l):n.setAttribute(l,u))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);try{n:if(\"function\"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:(\"prototype\"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k)})}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l.__r,$=0,\"prototype\"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[]}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p&&null==a.key?a.props.children:a,w(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l.diffed)&&a(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if(\"svg\"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&\"setAttribute\"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),h=(y=i.props||f).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||\"\"))}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w(l,Array.isArray(k)?k:[k],u,i,t,o&&\"foreignObject\"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a(r[k]);c||(\"value\"in p&&void 0!==(k=p.value)&&(k!==l.value||\"progress\"===d&&!k||\"option\"===d&&k!==y.value)&&H(l,\"value\",k,y.value,!1),\"checked\"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,\"checked\",k,y.checked,!1))}return l}function M(n,u,i){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null,n.__c=void 0}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||\"function\"!=typeof n.type);i||null==n.__e||a(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l.__&&l.__(u,i),r=(o=\"function\"==typeof t)?null:t&&t.__k||i.__k,e=[],j(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f,f,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z(e,u)}function S(n,l){P(n,l,S)}function q(l,u,i){var t,o,r,f=s({},l.props);for(r in u)\"key\"==r?t=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),v(l.type,f,t||l.key,o||l.ref,null)}function B(n,l){var u={__c:l=\"__cC\"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),\"function\"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b(this))},d.prototype.render=p,t=[],g.__r=0,r=0;export{d as Component,p as Fragment,q as cloneElement,B as createContext,h as createElement,y as createRef,h,S as hydrate,i as isValidElement,l as options,P as render,x as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","export type ID = string;\n\nexport function generateUUID(): ID {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n","import { generateUUID, ID } from './util/id';\n\nclass Base {\n private readonly _id: ID;\n\n constructor(id?: ID) {\n this._id = id || generateUUID();\n }\n\n get id(): ID {\n return this._id;\n }\n}\n\nexport default Base;\n","import { h } from 'preact';\n\nexport interface HTMLContentProps {\n content: string;\n parentElement?: string;\n}\n\nexport function HTMLElement(props: HTMLContentProps) {\n return h(props.parentElement || 'span', {\n dangerouslySetInnerHTML: { __html: props.content },\n });\n}\n","import { h, VNode } from 'preact';\nimport { HTMLElement } from '../view/htmlElement';\n\nexport function decode(content: string): string {\n const value = new DOMParser().parseFromString(content, 'text/html');\n return value.documentElement.textContent;\n}\n\nexport function html(content: string, parentElement?: string): VNode {\n return h(HTMLElement, { content: content, parentElement: parentElement });\n}\n","// The order of enum items define the processing order of the processor type\n// e.g. Extractor = 0 will be processed before Transformer = 1\nimport { generateUUID, ID } from '../util/id';\nimport { EventEmitter } from '../util/eventEmitter';\nimport { deepEqual } from '../util/deepEqual';\n\nexport enum ProcessorType {\n Initiator,\n ServerFilter,\n ServerSort,\n ServerLimit,\n Extractor,\n Transformer,\n Filter,\n Sort,\n Limit,\n}\n\ninterface PipelineProcessorEvents {\n propsUpdated: <T, P>(processor: PipelineProcessor<T, P>) => void;\n beforeProcess: (...args) => void;\n afterProcess: (...args) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface PipelineProcessorProps {}\n\nexport abstract class PipelineProcessor<\n T,\n P extends Partial<PipelineProcessorProps>,\n> extends EventEmitter<PipelineProcessorEvents> {\n public readonly id: ID;\n private _props: P;\n\n abstract get type(): ProcessorType;\n protected abstract _process(...args): T | Promise<T>;\n protected validateProps?(...args): void;\n\n constructor(props?: Partial<P>) {\n super();\n\n this._props = {} as P;\n this.id = generateUUID();\n\n if (props) this.setProps(props);\n }\n\n /**\n * process is used to call beforeProcess and afterProcess callbacks\n * This function is just a wrapper that calls _process()\n *\n * @param args\n */\n process(...args): T | Promise<T> {\n if (this.validateProps instanceof Function) {\n this.validateProps(...args);\n }\n\n this.emit('beforeProcess', ...args);\n const result = this._process(...args);\n this.emit('afterProcess', ...args);\n return result;\n }\n\n setProps(props: Partial<P>): this {\n const updatedProps = {\n ...this._props,\n ...props,\n };\n\n if (!deepEqual(updatedProps, this._props)) {\n this._props = updatedProps;\n this.emit('propsUpdated', this);\n }\n\n return this;\n }\n\n get props(): P {\n return this._props;\n }\n}\n","import Base from './base';\nimport { TCell } from './types';\nimport { html } from './util/html';\nimport { ComponentChild } from 'preact';\n\nclass Cell extends Base {\n // because a Cell is a subset of TCell type\n public data: number | string | boolean | ComponentChild;\n\n constructor(data: TCell) {\n super();\n\n this.update(data);\n }\n\n private cast(data: TCell): number | string | boolean | ComponentChild {\n if (data instanceof HTMLElement) {\n return html(data.outerHTML);\n }\n\n return data;\n }\n\n /**\n * Updates the Cell's data\n *\n * @param data\n */\n public update(data: TCell): Cell {\n this.data = this.cast(data);\n return this;\n }\n}\n\nexport default Cell;\n","import Cell from './cell';\nimport Base from './base';\nimport { TCell } from './types';\n\nclass Row extends Base {\n private _cells: Cell[];\n\n constructor(cells?: Cell[]) {\n super();\n\n this.cells = cells || [];\n }\n\n public cell(index: number): Cell {\n return this._cells[index];\n }\n\n public get cells(): Cell[] {\n return this._cells;\n }\n\n public set cells(cells: Cell[]) {\n this._cells = cells;\n }\n\n public toArray(): TCell[] {\n return this.cells.map((cell) => cell.data);\n }\n\n /**\n * Creates a new Row from an array of Cell(s)\n * This method generates a new ID for the Row and all nested elements\n *\n * @param cells\n * @returns Row\n */\n static fromCells(cells: Cell[]): Row {\n return new Row(cells.map((cell) => new Cell(cell.data)));\n }\n\n get length(): number {\n return this.cells.length;\n }\n}\n\nexport default Row;\n","import Base from './base';\nimport Row from './row';\nimport Cell from './cell';\nimport { OneDArray, TCell, TwoDArray } from './types';\nimport { oneDtoTwoD } from './util/array';\n\nclass Tabular extends Base {\n private _rows: Row[];\n private _length: number;\n\n constructor(rows?: Row[] | Row) {\n super();\n\n if (rows instanceof Array) {\n this.rows = rows;\n } else if (rows instanceof Row) {\n this.rows = [rows];\n } else {\n this.rows = [];\n }\n }\n\n get rows(): Row[] {\n return this._rows;\n }\n\n set rows(rows: Row[]) {\n this._rows = rows;\n }\n\n get length(): number {\n return this._length || this.rows.length;\n }\n\n // we want to sent the length when storage is ServerStorage\n set length(len: number) {\n this._length = len;\n }\n\n public toArray(): TCell[][] {\n return this.rows.map((row) => row.toArray());\n }\n\n /**\n * Creates a new Tabular from an array of Row(s)\n * This method generates a new ID for the Tabular and all nested elements\n *\n * @param rows\n * @returns Tabular\n */\n static fromRows(rows: Row[]): Tabular {\n return new Tabular(rows.map((row) => Row.fromCells(row.cells)));\n }\n\n /**\n * Creates a new Tabular from a 2D array\n * This method generates a new ID for the Tabular and all nested elements\n *\n * @param data\n * @returns Tabular\n */\n static fromArray<T extends TCell>(\n data: OneDArray<T> | TwoDArray<T>,\n ): Tabular {\n data = oneDtoTwoD(data);\n\n return new Tabular(\n data.map((row) => new Row(row.map((cell) => new Cell(cell)))),\n );\n }\n}\n\nexport default Tabular;\n","import { OneDArray, TwoDArray } from '../types';\n\nexport function oneDtoTwoD<T>(data: OneDArray<T> | TwoDArray<T>): TwoDArray<T> {\n if (data[0] && !(data[0] instanceof Array)) {\n return [data] as TwoDArray<T>;\n }\n\n return data as TwoDArray<T>;\n}\n\nexport function flatten<T>(arrays: TwoDArray<T>): OneDArray<T> {\n return arrays.reduce((prev, x) => prev.concat(x), []);\n}\n","type EventArgs<T> = [T] extends [(...args: infer U) => any]\n ? U\n : [T] extends [void]\n ? []\n : [T];\n\n/**\n * Example:\n *\n * export interface BaseEvents<P, S> {\n * SET_STATE: (component: BaseComponent<P, S>, state: S) => void;\n * }\n */\n\nexport interface EventEmitter<EventTypes> {\n addListener<EventName extends keyof EventTypes>(\n event: EventName,\n listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n ): EventEmitter<EventTypes>;\n\n on<EventName extends keyof EventTypes>(\n event: EventName,\n listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n ): EventEmitter<EventTypes>;\n\n off<EventName extends keyof EventTypes>(\n event: EventName,\n listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n ): EventEmitter<EventTypes>;\n\n emit<EventName extends keyof EventTypes>(\n event: EventName,\n ...args: EventArgs<EventTypes[EventName]>\n ): boolean;\n}\n\nexport class EventEmitter<EventTypes> {\n private callbacks: { [event: string]: ((...args) => void)[] };\n\n // because we are using EventEmitter as a mixin and the\n // constructor won't be called by the applyMixins function\n // see src/base.ts and src/util/applyMixin.ts\n private init(event?: string): void {\n if (!this.callbacks) {\n this.callbacks = {};\n }\n\n if (event && !this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n }\n\n listeners(): { [event: string]: ((...args) => void)[] } {\n return this.callbacks;\n }\n\n on<EventName extends keyof EventTypes>(\n event: EventName,\n listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n ): EventEmitter<EventTypes> {\n this.init(event as string);\n this.callbacks[event as string].push(listener);\n return this;\n }\n\n off<EventName extends keyof EventTypes>(\n event: EventName,\n listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n ): EventEmitter<EventTypes> {\n const eventName = event as string;\n\n this.init();\n\n if (!this.callbacks[eventName] || this.callbacks[eventName].length === 0) {\n // there is no callbacks with this key\n return this;\n }\n\n this.callbacks[eventName] = this.callbacks[eventName].filter(\n (value) => value != listener,\n );\n\n return this;\n }\n\n emit<EventName extends keyof EventTypes>(\n event: EventName,\n ...args: EventArgs<EventTypes[EventName]>\n ): boolean {\n const eventName = event as string;\n\n this.init(eventName);\n\n if (this.callbacks[eventName].length > 0) {\n this.callbacks[eventName].forEach((value) => value(...args));\n return true;\n }\n\n return false;\n }\n}\n","/**\n * Returns true if both objects are equal\n * @param a left object\n * @param b right object\n * @returns\n */\nexport function deepEqual<A, B>(obj1: A, obj2: B) {\n // If objects are not the same type, return false\n if (typeof obj1 !== typeof obj2) {\n return false;\n }\n // If objects are both null or undefined, return true\n if (obj1 === null && obj2 === null) {\n return true;\n }\n // If objects are both primitive types, compare them directly\n if (typeof obj1 !== 'object') {\n // eslint-disable-next-line\n // @ts-ignore\n return obj1 === obj2;\n }\n // If objects are arrays, compare their elements recursively\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n if (obj1.length !== obj2.length) {\n return false;\n }\n for (let i = 0; i < obj1.length; i++) {\n if (!deepEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n // If objects are VNodes, compare their props only\n if (\n // eslint-disable-next-line no-prototype-builtins\n obj1.hasOwnProperty('constructor') &&\n // eslint-disable-next-line no-prototype-builtins\n obj2.hasOwnProperty('constructor') &&\n // eslint-disable-next-line no-prototype-builtins\n obj1.hasOwnProperty('props') &&\n // eslint-disable-next-line no-prototype-builtins\n obj2.hasOwnProperty('props') &&\n // eslint-disable-next-line no-prototype-builtins\n obj1.hasOwnProperty('key') &&\n // eslint-disable-next-line no-prototype-builtins\n obj2.hasOwnProperty('key') &&\n // eslint-disable-next-line no-prototype-builtins\n obj1.hasOwnProperty('ref') &&\n // eslint-disable-next-line no-prototype-builtins\n obj2.hasOwnProperty('ref') &&\n // eslint-disable-next-line no-prototype-builtins\n obj1.hasOwnProperty('type') &&\n // eslint-disable-next-line no-prototype-builtins\n obj2.hasOwnProperty('type')\n ) {\n return deepEqual(obj1['props'], obj2['props']);\n }\n // If objects are both objects, compare their properties recursively\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n // eslint-disable-next-line no-prototype-builtins\n if (!obj2.hasOwnProperty(key) || !deepEqual(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n}\n","import search from '../../operator/search';\nimport Tabular from '../../tabular';\nimport {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { OneDArray, TCell, TColumn } from '../../types';\n\ninterface GlobalSearchFilterProps extends PipelineProcessorProps {\n keyword: string;\n columns: OneDArray<TColumn>;\n ignoreHiddenColumns: boolean;\n selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string;\n}\n\nclass GlobalSearchFilter extends PipelineProcessor<\n Tabular,\n GlobalSearchFilterProps\n> {\n get type(): ProcessorType {\n return ProcessorType.Filter;\n }\n\n _process(data: Tabular): Tabular {\n if (this.props.keyword) {\n return search(\n String(this.props.keyword).trim(),\n this.props.columns,\n this.props.ignoreHiddenColumns,\n data,\n this.props.selector,\n );\n }\n\n return data;\n }\n}\n\nexport default GlobalSearchFilter;\n","import Tabular from '../tabular';\nimport { VNode } from 'preact';\nimport { HTMLContentProps } from '../view/htmlElement';\nimport { OneDArray, TCell, TColumn } from '../types';\n\nexport default function (\n keyword: string,\n columns: OneDArray<TColumn>,\n ignoreHiddenColumns: boolean,\n tabular: Tabular,\n selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string,\n): Tabular {\n // escape special regex chars\n keyword = keyword.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n\n return new Tabular(\n tabular.rows.filter((row, rowIndex) =>\n row.cells.some((cell, cellIndex) => {\n if (!cell) {\n return false;\n }\n\n if (ignoreHiddenColumns) {\n if (\n columns &&\n columns[cellIndex] &&\n typeof columns[cellIndex] === 'object'\n ) {\n const typedColumn = columns[cellIndex] as TColumn;\n if (typedColumn.hidden) {\n return false;\n }\n }\n }\n\n let data = '';\n\n if (typeof selector === 'function') {\n data = selector(cell.data, rowIndex, cellIndex);\n } else if (typeof cell.data === 'object') {\n // HTMLContent element\n const element = cell.data as VNode<HTMLContentProps>;\n if (element && element.props && element.props.content) {\n // TODO: we should only search in the content of the element. props.content is the entire HTML element\n data = element.props.content;\n }\n } else {\n // primitive types\n data = String(cell.data);\n }\n\n return new RegExp(keyword, 'gi').test(data);\n }),\n ),\n );\n}\n","import { JSXInternal } from 'preact/src/jsx';\n\nexport function className(...args: string[]): string {\n const prefix = 'gridjs';\n\n return `${prefix}${args.reduce(\n (prev: string, cur: string) => `${prev}-${cur}`,\n '',\n )}`;\n}\n\nexport function classJoin(\n ...classNames: (undefined | string | JSXInternal.SignalLike<string>)[]\n): string {\n return classNames\n .map((x) => (x ? x.toString() : ''))\n .filter((x) => x)\n .reduce((className, prev) => `${className || ''} ${prev}`, '')\n .trim();\n}\n","import {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerGlobalSearchFilterProps extends PipelineProcessorProps {\n keyword?: string;\n url?: (prevUrl: string, keyword: string) => string;\n body?: (prevBody: BodyInit, keyword: string) => BodyInit;\n}\n\nclass ServerGlobalSearchFilter extends PipelineProcessor<\n ServerStorageOptions,\n ServerGlobalSearchFilterProps\n> {\n get type(): ProcessorType {\n return ProcessorType.ServerFilter;\n }\n\n _process(options?: ServerStorageOptions): ServerStorageOptions {\n if (!this.props.keyword) return options;\n\n const updates = {};\n\n if (this.props.url) {\n updates['url'] = this.props.url(options.url, this.props.keyword);\n }\n\n if (this.props.body) {\n updates['body'] = this.props.body(options.body, this.props.keyword);\n }\n\n return {\n ...options,\n ...updates,\n };\n }\n}\n\nexport default ServerGlobalSearchFilter;\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(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,!r.u)){r.u=!0;var f=r.shouldComponentUpdate;r.shouldComponentUpdate=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!f||f.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)&&(!f||f.call(this,n,t,r))}}return o.__N||o.__}function h(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function s(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,s(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=p();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,h as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,s as useLayoutEffect,F as useMemo,y as useReducer,_ as useRef,p as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import { useContext } from 'preact/hooks';\nimport { Config, ConfigContext } from '../config';\n\nexport function useConfig(): Config {\n return useContext(ConfigContext);\n}\n","export default {\n search: {\n placeholder: 'Type a keyword...',\n },\n sort: {\n sortAsc: 'Sort column ascending',\n sortDesc: 'Sort column descending',\n },\n pagination: {\n previous: 'Previous',\n next: 'Next',\n navigate: (page, pages) => `Page ${page} of ${pages}`,\n page: (page) => `Page ${page}`,\n showing: 'Showing',\n of: 'of',\n to: 'to',\n results: 'results',\n },\n loading: 'Loading...',\n noRecordsFound: 'No matching records found',\n error: 'An error happened while fetching the data',\n};\n","import { useConfig } from '../hooks/useConfig';\nimport enUS from './en_US';\ntype MessageFormat = (...args) => string;\ntype Message = string | MessageFormat;\nexport type Language = { [key: string]: Message | Language };\n\nexport class Translator {\n private readonly _language: Language;\n private readonly _defaultLanguage: Language;\n\n constructor(language?: Language) {\n this._language = language;\n this._defaultLanguage = enUS;\n }\n\n /**\n * Tries to split the message with \".\" and find\n * the key in the given language\n *\n * @param message\n * @param lang\n */\n getString(message: string, lang: Language): MessageFormat {\n if (!lang || !message) return null;\n\n const splitted = message.split('.');\n const key = splitted[0];\n\n if (lang[key]) {\n const val = lang[key];\n\n if (typeof val === 'string') {\n return (): string => val;\n } else if (typeof val === 'function') {\n return val;\n } else {\n return this.getString(splitted.slice(1).join('.'), val);\n }\n }\n\n return null;\n }\n\n translate(message: string, ...args): string {\n const translated = this.getString(message, this._language);\n let messageFormat;\n\n if (translated) {\n messageFormat = translated;\n } else {\n messageFormat = this.getString(message, this._defaultLanguage);\n }\n\n if (messageFormat) {\n return messageFormat(...args);\n }\n\n return message;\n }\n}\n\nexport function useTranslator() {\n const config = useConfig();\n\n return function (message: string, ...args): string {\n return config.translator.translate(message, ...args);\n };\n}\n","export const SearchKeyword = (payload) => (state) => {\n return {\n ...state,\n search: {\n keyword: payload,\n },\n };\n};\n","import { useConfig } from './useConfig';\n\nexport function useStore() {\n const config = useConfig();\n return config.store;\n}\n","import { useEffect, useState } from 'preact/hooks';\nimport { useStore } from './useStore';\n\nexport default function useSelector<T>(selector: (state) => T) {\n const store = useStore();\n const [current, setCurrent] = useState(selector(store.getState()));\n\n useEffect(() => {\n const unsubscribe = store.subscribe(() => {\n const updated = selector(store.getState());\n\n if (current !== updated) {\n setCurrent(updated);\n }\n });\n\n return unsubscribe;\n }, []);\n\n return current;\n}\n","import { h, JSX } from 'preact';\nimport GlobalSearchFilter from '../../../pipeline/filter/globalSearch';\nimport { classJoin, className } from '../../../util/className';\nimport ServerGlobalSearchFilter from '../../../pipeline/filter/serverGlobalSearch';\nimport { TCell } from '../../../types';\nimport { useConfig } from '../../../hooks/useConfig';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport { useTranslator } from '../../../i18n/language';\nimport * as actions from './actions';\nimport { useStore } from '../../../hooks/useStore';\nimport useSelector from '../../../hooks/useSelector';\nimport { debounce } from '../../../util/debounce';\n\nexport interface SearchConfig {\n keyword?: string;\n ignoreHiddenColumns?: boolean;\n debounceTimeout?: number;\n selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string;\n server?: {\n url?: (prevUrl: string, keyword: string) => string;\n body?: (prevBody: BodyInit, keyword: string) => BodyInit;\n };\n}\n\nexport function Search() {\n const [processor, setProcessor] = useState<\n GlobalSearchFilter | ServerGlobalSearchFilter\n >(undefined);\n const config = useConfig();\n const props = config.search as SearchConfig;\n const _ = useTranslator();\n const { dispatch } = useStore();\n const state = useSelector((state) => state.search);\n\n useEffect(() => {\n if (!processor) return;\n\n processor.setProps({\n keyword: state?.keyword,\n });\n }, [state, processor]);\n\n useEffect(() => {\n if (props.server) {\n setProcessor(\n new ServerGlobalSearchFilter({\n keyword: props.keyword,\n url: props.server.url,\n body: props.server.body,\n }),\n );\n } else {\n setProcessor(\n new GlobalSearchFilter({\n keyword: props.keyword,\n columns: config.header && config.header.columns,\n ignoreHiddenColumns:\n props.ignoreHiddenColumns ||\n props.ignoreHiddenColumns === undefined,\n selector: props.selector,\n }),\n );\n }\n\n // initial search\n if (props.keyword) dispatch(actions.SearchKeyword(props.keyword));\n }, [props]);\n\n useEffect(() => {\n if (!processor) return undefined;\n\n config.pipeline.register<object, object>(processor);\n\n return () => config.pipeline.unregister<object, object>(processor);\n }, [config, processor]);\n\n const debouncedOnInput = useCallback(\n debounce(\n (event: JSX.TargetedEvent<HTMLInputElement>) => {\n if (event.target instanceof HTMLInputElement) {\n dispatch(actions.SearchKeyword(event.target.value));\n }\n },\n processor instanceof ServerGlobalSearchFilter\n ? props.debounceTimeout || 250\n : 0,\n ),\n [props, processor],\n );\n\n return (\n <div className={className(classJoin('search', config.className?.search))}>\n <input\n type=\"search\"\n placeholder={_('search.placeholder')}\n aria-label={_('search.placeholder')}\n onInput={debouncedOnInput}\n className={classJoin(className('input'), className('search', 'input'))}\n defaultValue={state?.keyword || ''}\n />\n </div>\n );\n}\n","export const debounce = <F extends (...args: any[]) => any>(\n func: F,\n waitFor: number,\n) => {\n let timeout;\n\n return (...args: Parameters<F>): Promise<ReturnType<F>> =>\n new Promise((resolve) => {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => resolve(func(...args)), waitFor);\n });\n};\n","import Tabular from '../../tabular';\nimport {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\n\ninterface PaginationLimitProps extends PipelineProcessorProps {\n page: number;\n limit: number;\n}\n\nclass PaginationLimit extends PipelineProcessor<Tabular, PaginationLimitProps> {\n protected validateProps(): void {\n if (isNaN(Number(this.props.limit)) || isNaN(Number(this.props.page))) {\n throw Error('Invalid parameters passed');\n }\n }\n\n get type(): ProcessorType {\n return ProcessorType.Limit;\n }\n\n protected _process(data: Tabular): Tabular {\n const page = this.props.page;\n const start = page * this.props.limit;\n const end = (page + 1) * this.props.limit;\n\n return new Tabular(data.rows.slice(start, end));\n }\n}\n\nexport default PaginationLimit;\n","import {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerPaginationLimitProps extends PipelineProcessorProps {\n page: number;\n limit: number;\n url?: (prevUrl: string, page: number, limit: number) => string;\n body?: (prevBody: BodyInit, page: number, limit: number) => BodyInit;\n}\n\nclass ServerPaginationLimit extends PipelineProcessor<\n ServerStorageOptions,\n ServerPaginationLimitProps\n> {\n get type(): ProcessorType {\n return ProcessorType.ServerLimit;\n }\n\n _process(options?: ServerStorageOptions): ServerStorageOptions {\n const updates = {};\n\n if (this.props.url) {\n updates['url'] = this.props.url(\n options.url,\n this.props.page,\n this.props.limit,\n );\n }\n\n if (this.props.body) {\n updates['body'] = this.props.body(\n options.body,\n this.props.page,\n this.props.limit,\n );\n }\n\n return {\n ...options,\n ...updates,\n };\n }\n}\n\nexport default ServerPaginationLimit;\n","import { h, Fragment } from 'preact';\nimport PaginationLimit from '../../pipeline/limit/pagination';\nimport { classJoin, className } from '../../util/className';\nimport ServerPaginationLimit from '../../pipeline/limit/serverPagination';\nimport { useConfig } from '../../hooks/useConfig';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useTranslator } from '../../i18n/language';\n\nexport interface PaginationConfig {\n limit?: number;\n page?: number;\n summary?: boolean;\n nextButton?: boolean;\n prevButton?: boolean;\n buttonsCount?: number;\n resetPageOnUpdate?: boolean;\n server?: {\n url?: (prevUrl: string, page: number, limit: number) => string;\n body?: (prevBody: BodyInit, page: number, limit: number) => BodyInit;\n };\n}\n\nexport function Pagination() {\n const config = useConfig();\n const {\n server,\n summary = true,\n nextButton = true,\n prevButton = true,\n buttonsCount = 3,\n limit = 10,\n page = 0,\n resetPageOnUpdate = true,\n } = config.pagination as PaginationConfig;\n\n const processor = useRef<PaginationLimit | ServerPaginationLimit>(null);\n const [currentPage, setCurrentPage] = useState(page);\n const [total, setTotal] = useState(0);\n const _ = useTranslator();\n\n useEffect(() => {\n if (server) {\n processor.current = new ServerPaginationLimit({\n limit: limit,\n page: currentPage,\n url: server.url,\n body: server.body,\n });\n\n config.pipeline.register(processor.current);\n } else {\n processor.current = new PaginationLimit({\n limit: limit,\n page: currentPage,\n });\n\n config.pipeline.register(processor.current);\n }\n\n if (processor.current instanceof ServerPaginationLimit) {\n config.pipeline.on('afterProcess', (tabular) => setTotal(tabular.length));\n } else if (processor.current instanceof PaginationLimit) {\n // Pagination (all Limit processors) is the last step in the pipeline\n // and we assume that at this stage, we have the rows that we care about.\n // Let's grab the rows before processing Pagination and set total number of rows\n processor.current.on('beforeProcess', (tabular) =>\n setTotal(tabular.length),\n );\n }\n\n config.pipeline.on('updated', onUpdate);\n\n // we need to make sure that the state is set\n // to the default props when an error happens\n config.pipeline.on('error', () => {\n setTotal(0);\n setCurrentPage(0);\n });\n\n return () => {\n config.pipeline.unregister<object, object>(processor.current);\n config.pipeline.off('updated', onUpdate);\n };\n }, []);\n\n const onUpdate = (updatedProcessor) => {\n // this is to ensure that the current page is set to 0\n // when a processor is updated for some reason\n if (resetPageOnUpdate && updatedProcessor !== processor.current) {\n setCurrentPage(0);\n\n if (processor.current.props.page !== 0) {\n processor.current.setProps({\n page: 0,\n });\n }\n }\n };\n\n const pages = () => Math.ceil(total / limit);\n\n const setPage = (page: number) => {\n if (page >= pages() || page < 0 || page === currentPage) {\n return null;\n }\n\n setCurrentPage(page);\n\n processor.current.setProps({\n page: page,\n });\n };\n\n const renderPages = () => {\n if (buttonsCount <= 0) {\n return null;\n }\n\n // how many pagination buttons to render?\n const maxCount: number = Math.min(pages(), buttonsCount);\n\n let pagePivot = Math.min(currentPage, Math.floor(maxCount / 2));\n if (currentPage + Math.floor(maxCount / 2) >= pages()) {\n pagePivot = maxCount - (pages() - currentPage);\n }\n\n return (\n <Fragment>\n {pages() > maxCount && currentPage - pagePivot > 0 && (\n <Fragment>\n <button\n tabIndex={0}\n role=\"button\"\n onClick={() => setPage(0)}\n title={_('pagination.firstPage')}\n aria-label={_('pagination.firstPage')}\n className={config.className.paginationButton}\n >\n {_('1')}\n </button>\n <button\n tabIndex={-1}\n className={classJoin(\n className('spread'),\n config.className.paginationButton,\n )}\n >\n ...\n </button>\n </Fragment>\n )}\n\n {Array.from(Array(maxCount).keys())\n .map((i) => currentPage + (i - pagePivot))\n .map((i) => (\n <button\n tabIndex={0}\n role=\"button\"\n onClick={() => setPage(i)}\n className={classJoin(\n currentPage === i\n ? classJoin(\n className('currentPage'),\n config.className.paginationButtonCurrent,\n )\n : null,\n config.className.paginationButton,\n )}\n title={_('pagination.page', i + 1)}\n aria-label={_('pagination.page', i + 1)}\n >\n {_(`${i + 1}`)}\n </button>\n ))}\n\n {pages() > maxCount && pages() > currentPage + pagePivot + 1 && (\n <Fragment>\n <button\n tabIndex={-1}\n className={classJoin(\n className('spread'),\n config.className.paginationButton,\n )}\n >\n ...\n </button>\n <button\n tabIndex={0}\n role=\"button\"\n onClick={() => setPage(pages() - 1)}\n title={_('pagination.page', pages())}\n aria-label={_('pagination.page', pages())}\n className={config.className.paginationButton}\n >\n {_(`${pages()}`)}\n </button>\n </Fragment>\n )}\n </Fragment>\n );\n };\n\n const renderSummary = () => {\n return (\n <Fragment>\n {summary && total > 0 && (\n <div\n role=\"status\"\n aria-live=\"polite\"\n className={classJoin(\n className('summary'),\n config.className.paginationSummary,\n )}\n title={_('pagination.navigate', currentPage + 1, pages())}\n >\n {_('pagination.showing')} <b>{_(`${currentPage * limit + 1}`)}</b>{' '}\n {_('pagination.to')}{' '}\n <b>{_(`${Math.min((currentPage + 1) * limit, total)}`)}</b>{' '}\n {_('pagination.of')} <b>{_(`${total}`)}</b>{' '}\n {_('pagination.results')}\n </div>\n )}\n </Fragment>\n );\n };\n\n return (\n <div\n className={classJoin(\n className('pagination'),\n config.className.pagination,\n )}\n >\n {renderSummary()}\n\n <div className={className('pages')}>\n {prevButton && (\n <button\n tabIndex={0}\n role=\"button\"\n disabled={currentPage === 0}\n onClick={() => setPage(currentPage - 1)}\n title={_('pagination.previous')}\n aria-label={_('pagination.previous')}\n className={classJoin(\n config.className.paginationButton,\n config.className.paginationButtonPrev,\n )}\n >\n {_('pagination.previous')}\n </button>\n )}\n\n {renderPages()}\n\n {nextButton && (\n <button\n tabIndex={0}\n role=\"button\"\n disabled={pages() === currentPage + 1 || pages() === 0}\n onClick={() => setPage(currentPage + 1)}\n title={_('pagination.next')}\n aria-label={_('pagination.next')}\n className={classJoin(\n config.className.paginationButton,\n config.className.paginationButtonNext,\n )}\n >\n {_('pagination.next')}\n </button>\n )}\n </div>\n </div>\n );\n}\n","export function width(width: string | number, containerWidth?: number): number {\n if (typeof width == 'string') {\n if (width.indexOf('%') > -1) {\n return (containerWidth / 100) * parseInt(width, 10);\n } else {\n return parseInt(width, 10);\n }\n }\n\n return width;\n}\n\nexport function px(width: number): string {\n if (!width) return '';\n return `${Math.floor(width)}px`;\n}\n","import { h } from 'preact';\nimport { className } from '../../util/className';\n\n/**\n * ShadowTable renders a hidden table and is used to calculate the column's width\n * when autoWidth option is enabled\n */\nexport function ShadowTable(props: { tableRef: HTMLTableElement }) {\n const shadowTable = props.tableRef.cloneNode(true) as HTMLTableElement;\n\n shadowTable.style.position = 'absolute';\n shadowTable.style.width = '100%';\n shadowTable.style.zIndex = '-2147483640';\n shadowTable.style.visibility = 'hidden';\n\n return (\n <div\n ref={(nodeElement) => {\n nodeElement && nodeElement.appendChild(shadowTable);\n }}\n />\n );\n}\n\nexport function getShadowTableWidths(tempRef: HTMLDivElement): {\n [columnId: string]: { minWidth: number; width: number };\n} {\n const tableElement: HTMLTableElement = tempRef.querySelector(\n 'table',\n ) as HTMLTableElement;\n\n if (!tableElement) {\n return {};\n }\n\n const tableClassName = tableElement.className;\n const tableStyle = tableElement.style.cssText;\n tableElement.className = `${tableClassName} ${className('shadowTable')}`;\n\n tableElement.style.tableLayout = 'auto';\n tableElement.style.width = 'auto';\n tableElement.style.padding = '0';\n tableElement.style.margin = '0';\n tableElement.style.border = 'none';\n tableElement.style.outline = 'none';\n\n let obj = Array.from(\n tableElement.parentNode.querySelectorAll<HTMLElement>('thead th'),\n ).reduce((prev, current) => {\n current.style.width = `${current.clientWidth}px`;\n\n return {\n [current.getAttribute('data-column-id')]: {\n minWidth: current.clientWidth,\n },\n ...prev,\n };\n }, {});\n\n tableElement.className = tableClassName;\n tableElement.style.cssText = tableStyle;\n tableElement.style.tableLayout = 'auto';\n\n obj = Array.from(\n tableElement.parentNode.querySelectorAll<HTMLElement>('thead th'),\n ).reduce((prev, current) => {\n prev[current.getAttribute('data-column-id')]['width'] = current.clientWidth;\n\n return prev;\n }, obj);\n\n return obj;\n}\n","export function camelCase(str: string): string {\n if (!str) return '';\n\n const words = str.split(' ');\n\n // do not convert strings that are already in camelCase format\n if (words.length === 1 && /([a-z][A-Z])+/g.test(str)) {\n return str;\n }\n\n return words\n .map(function (word, index) {\n // if it is the first word, lowercase all the chars\n if (index == 0) {\n return word.toLowerCase();\n }\n\n // if it is not the first word only upper case the first char and lowercase the rest\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n}\n","import { Fragment, FunctionComponent, h } from 'preact';\nimport { useConfig } from './hooks/useConfig';\nimport log from './util/log';\n\nexport enum PluginPosition {\n Header,\n Footer,\n Cell,\n}\n\nexport interface Plugin<T extends FunctionComponent> {\n id: string;\n position: PluginPosition;\n component: T;\n order?: number;\n}\n\nexport class PluginManager {\n private readonly plugins: Plugin<any>[];\n\n constructor() {\n this.plugins = [];\n }\n\n get<T extends FunctionComponent>(id: string): Plugin<T> | undefined {\n return this.plugins.find((p) => p.id === id);\n }\n\n add<T extends FunctionComponent<any>>(plugin: Plugin<T>): this {\n if (!plugin.id) {\n log.error('Plugin ID cannot be empty');\n return this;\n }\n\n if (this.get(plugin.id)) {\n log.error(`Duplicate plugin ID: ${plugin.id}`);\n return this;\n }\n\n this.plugins.push(plugin);\n return this;\n }\n\n remove(id: string): this {\n const plugin = this.get(id);\n\n if (plugin) {\n this.plugins.splice(this.plugins.indexOf(plugin), 1);\n }\n\n return this;\n }\n\n list<T extends FunctionComponent>(position?: PluginPosition): Plugin<T>[] {\n let plugins: Plugin<T>[];\n\n if (position != null || position != undefined) {\n plugins = this.plugins.filter((p) => p.position === position);\n } else {\n plugins = this.plugins;\n }\n\n return plugins.sort((a, b) => (a.order && b.order ? a.order - b.order : 1));\n }\n}\n\nexport function PluginRenderer(props: {\n props?: any;\n // to render a single plugin\n pluginId?: string;\n // to render all plugins in this PluginPosition\n position?: PluginPosition;\n}) {\n const config = useConfig();\n\n if (props.pluginId) {\n // render a single plugin\n const plugin = config.plugin.get(props.pluginId);\n\n if (!plugin) return null;\n\n return h(\n Fragment,\n {},\n h(plugin.component, {\n plugin: plugin,\n ...props.props,\n }),\n );\n } else if (props.position !== undefined) {\n // render using a specific plugin position\n return h(\n Fragment,\n {},\n config.plugin.list(props.position).map((p) => {\n return h(p.component, { plugin: p, ...this.props.props });\n }),\n );\n }\n\n return null;\n}\n","/**\n * Centralized logging lib\n *\n * This class needs some improvements but so far it has been used to have a coherent way to log\n */\nclass Logger {\n private format(message: string, type: string): string {\n return `[Grid.js] [${type.toUpperCase()}]: ${message}`;\n }\n\n error(message: string, throwException = false): void {\n const msg = this.format(message, 'error');\n\n if (throwException) {\n throw Error(msg);\n } else {\n console.error(msg);\n }\n }\n\n warn(message: string): void {\n console.warn(this.format(message, 'warn'));\n }\n\n info(message: string): void {\n console.info(this.format(message, 'info'));\n }\n}\n\nexport default new Logger();\n","import { OneDArray, TColumn, TwoDArray } from './types';\nimport Base from './base';\nimport { Config } from './config';\nimport { px, width } from './util/width';\nimport { getShadowTableWidths, ShadowTable } from './view/table/shadow';\nimport { ComponentChild, h, isValidElement, RefObject, render } from 'preact';\nimport { camelCase } from './util/string';\nimport { flatten } from './util/array';\nimport logger from './util/log';\nimport { PluginManager, PluginPosition } from './plugin';\nimport { GenericSortConfig } from './view/plugin/sort/sort';\n\nclass Header extends Base {\n private _columns: OneDArray<TColumn>;\n\n constructor() {\n super();\n\n this._columns = [];\n }\n\n get columns(): OneDArray<TColumn> {\n return this._columns;\n }\n\n set columns(columns) {\n this._columns = columns;\n }\n\n get visibleColumns(): OneDArray<TColumn> {\n return this._columns.filter((c) => !c.hidden);\n }\n\n /**\n * Tries to automatically adjust the width of columns based on:\n * - Header cell content\n * - Cell content of the first row\n * - Cell content of the last row\n *\n * @param config\n */\n adjustWidth(\n config: Config,\n tableRef: RefObject<HTMLTableElement>,\n tempRef: RefObject<HTMLDivElement>,\n ): this {\n const container: Element = config.container;\n const autoWidth = config.autoWidth;\n\n if (!container) {\n // we can't calculate the width because the container\n // is unknown at this stage\n return this;\n }\n\n // pixels\n const containerWidth = container.clientWidth;\n\n let widths = {};\n\n if (tableRef.current && autoWidth) {\n // let's create a shadow table with the first 10 rows of the data\n // and let the browser to render the table with table-layout: auto\n // no padding, margin or border to get the minimum space required\n // to render columns. Once the table is rendered and widths are known,\n // we unmount the shadow table from the DOM and set the correct width\n render(\n h(ShadowTable, {\n tableRef: tableRef.current,\n }),\n tempRef.current,\n );\n\n widths = getShadowTableWidths(tempRef.current);\n }\n\n for (const column of flatten(Header.tabularFormat(this.columns))) {\n // because we don't want to set the width of parent THs\n if (column.columns && column.columns.length > 0) {\n continue;\n }\n\n if (!column.width && autoWidth) {\n // tries to find the corresponding cell\n // from the ShadowTable and set the correct width\n\n if (column.id in widths) {\n // because a column can be hidden, too\n column.width = px(widths[column.id]['width']);\n column.minWidth = px(widths[column.id]['minWidth']);\n }\n } else {\n // column width is already defined\n // sets the column with based on the width of its container\n column.width = px(width(column.width, containerWidth));\n }\n }\n\n if (tableRef.current && autoWidth) {\n // unmount the shadow table from temp\n render(null, tempRef.current);\n }\n\n return this;\n }\n\n private setSort(\n sortConfig: GenericSortConfig | boolean,\n columns?: OneDArray<TColumn>,\n ): void {\n const cols = columns || this.columns || [];\n\n for (const column of cols) {\n // sorting can only be enabled for columns without any children\n if (column.columns && column.columns.length > 0) {\n column.sort = undefined;\n } else if (column.sort === undefined && sortConfig) {\n column.sort = {};\n } else if (!column.sort) {\n // false, null, etc.\n column.sort = undefined;\n } else if (typeof column.sort === 'object') {\n column.sort = {\n ...column.sort,\n };\n }\n\n if (column.columns) {\n this.setSort(sortConfig, column.columns);\n }\n }\n }\n\n private setResizable(resizable: boolean, columns?: OneDArray<TColumn>): void {\n const cols = columns || this.columns || [];\n\n for (const column of cols) {\n if (column.resizable === undefined) {\n column.resizable = resizable;\n }\n\n if (column.columns) {\n this.setResizable(resizable, column.columns);\n }\n }\n }\n\n private setID(columns?: OneDArray<TColumn>): void {\n const cols = columns || this.columns || [];\n\n for (const column of cols) {\n if (!column.id && typeof column.name === 'string') {\n // let's guess the column ID if it's undefined\n column.id = camelCase(column.name);\n }\n\n if (!column.id) {\n logger.error(\n `Could not find a valid ID for one of the columns. Make sure a valid \"id\" is set for all columns.`,\n );\n }\n\n // nested columns\n if (column.columns) {\n this.setID(column.columns);\n }\n }\n }\n\n private populatePlugins(\n pluginManager: PluginManager,\n columns: OneDArray<TColumn>,\n ): void {\n // populate the cell columns\n for (const column of columns) {\n if (column.plugin !== undefined) {\n pluginManager.add({\n id: column.id,\n ...column.plugin,\n position: PluginPosition.Cell,\n });\n }\n }\n }\n\n static fromColumns(\n columns: OneDArray<TColumn | string | ComponentChild>,\n ): Header {\n const header = new Header();\n\n for (const column of columns) {\n if (typeof column === 'string' || isValidElement(column)) {\n header.columns.push({\n name: column,\n });\n } else if (typeof column === 'object') {\n const typedColumn = column as TColumn;\n\n if (typedColumn.columns) {\n typedColumn.columns = Header.fromColumns(typedColumn.columns).columns;\n }\n\n // because the data for that cell is null\n // if we are trying to render a plugin\n if (typeof typedColumn.plugin === 'object') {\n if (typedColumn.data === undefined) {\n typedColumn.data = null;\n }\n }\n\n // TColumn type\n header.columns.push(column as TColumn);\n }\n }\n\n return header;\n }\n\n static createFromConfig(config: Partial<Config>): Header | null {\n const header = new Header();\n\n // TODO: this part needs some refactoring\n if (config.from) {\n header.columns = Header.fromHTMLTable(config.from).columns;\n } else if (config.columns) {\n header.columns = Header.fromColumns(config.columns).columns;\n } else if (\n config.data &&\n typeof config.data[0] === 'object' &&\n !(config.data[0] instanceof Array)\n ) {\n // if data[0] is an object but not an Array\n // used for when a JSON payload is provided\n header.columns = Object.keys(config.data[0]).map((name) => {\n return { name: name };\n });\n }\n\n if (header.columns.length) {\n header.setID();\n header.setSort(config.sort);\n header.setResizable(config.resizable);\n header.populatePlugins(config.plugin, header.columns);\n return header;\n }\n\n return null;\n }\n\n static fromHTMLTable(element: HTMLElement): Header {\n const header = new Header();\n const thead = element.querySelector('thead');\n const ths = thead.querySelectorAll('th');\n\n for (const th of ths as any) {\n header.columns.push({\n name: th.innerHTML,\n width: th.width,\n });\n }\n\n return header;\n }\n\n /**\n * Converts the tree-like format of Header to a tabular format\n *\n * Example:\n *\n * H1\n * H1-H1\n * H1-H2\n * H2\n * H2-H1\n *\n * becomes:\n * [\n * [H1, H2],\n * [H1-H1, H1-H2, H2-H1]\n * ]\n *\n * @param columns\n */\n static tabularFormat(columns: OneDArray<TColumn>): TwoDArray<TColumn> {\n let result: TwoDArray<TColumn> = [];\n const cols = columns || [];\n let nextRow = [];\n\n if (cols && cols.length) {\n result.push(cols);\n\n for (const col of cols) {\n if (col.columns && col.columns.length) {\n nextRow = nextRow.concat(col.columns);\n }\n }\n\n if (nextRow.length) {\n result = result.concat(this.tabularFormat(nextRow));\n }\n }\n\n return result;\n }\n\n /**\n * Returns an array of leaf columns (last columns in the tree)\n *\n * @param columns\n */\n static leafColumns(columns: OneDArray<TColumn>): OneDArray<TColumn> {\n let result: OneDArray<TColumn> = [];\n const cols = columns || [];\n\n if (cols && cols.length) {\n for (const col of cols) {\n if (!col.columns || col.columns.length === 0) {\n result.push(col);\n }\n\n if (col.columns) {\n result = result.concat(this.leafColumns(col.columns));\n }\n }\n }\n\n return result;\n }\n\n /**\n * Returns the maximum depth of a column tree\n * @param column\n */\n static maximumDepth(column: TColumn): number {\n return this.tabularFormat([column]).length - 1;\n }\n}\n\nexport default Header;\n","/**\n * Base Storage class. All storage implementation must inherit this class\n */\nimport { TData } from '../types';\n\nabstract class Storage<I> {\n /**\n * Returns all rows based on ...args\n * @param args\n */\n abstract get(...args): Promise<StorageResponse>;\n\n /**\n * To set all rows\n *\n * @param data\n */\n set?(data: I | ((...args) => void)): this;\n}\n\nexport interface StorageResponse {\n data: TData;\n total: number;\n}\n\nexport default Storage;\n","import Storage, { StorageResponse } from './storage';\nimport { TData } from '../types';\n\nclass MemoryStorage extends Storage<TData> {\n private data: (() => TData) | (() => Promise<TData>);\n\n constructor(data: TData | (() => TData) | (() => Promise<TData>)) {\n super();\n this.set(data);\n }\n\n public async get(): Promise<StorageResponse> {\n const data = await this.data();\n\n return {\n data: data,\n total: data.length,\n };\n }\n\n public set(data: TData | (() => TData) | (() => Promise<TData>)): this {\n if (data instanceof Array) {\n this.data = (): TData => data;\n } else if (data instanceof Function) {\n this.data = data;\n }\n\n return this;\n }\n}\n\nexport default MemoryStorage;\n","import Storage, { StorageResponse } from './storage';\nimport log from '../util/log';\n\nexport interface ServerStorageOptions extends RequestInit {\n url: string;\n // to format the data and columns\n then?: (data: any) => any[][];\n // to handle the response from the server. `handle` will\n // be called first and then `then` callback will be invoked\n // The purpose of this function is to handle the behaviour\n // of server and either reject and resolve the initial response\n // before calling the `then` function\n handle?: (response: Response) => Promise<any>;\n total?: (data: any) => number;\n // to bypass the current implementation of ServerStorage and process the\n // request manually (e.g. when user wants to connect their own SDK/HTTP Client)\n data?: (opts: ServerStorageOptions) => Promise<StorageResponse>;\n}\n\nclass ServerStorage extends Storage<ServerStorageOptions> {\n private readonly options: ServerStorageOptions;\n\n constructor(options: ServerStorageOptions) {\n super();\n this.options = options;\n }\n\n private handler(response: Response): Promise<any> {\n if (typeof this.options.handle === 'function') {\n return this.options.handle(response);\n }\n\n if (response.ok) {\n return response.json();\n } else {\n log.error(\n `Could not fetch data: ${response.status} - ${response.statusText}`,\n true,\n );\n return null;\n }\n }\n\n public get(options?: ServerStorageOptions): Promise<StorageResponse> {\n // this.options is the initial config object\n // options is the runtime config passed by the pipeline (e.g. search component)\n const opts = {\n ...this.options,\n ...options,\n };\n\n // if `options.data` is provided, the current ServerStorage\n // implementation will be ignored and we let options.data to\n // handle the request. Useful when HTTP client needs to be\n // replaced with something else\n if (typeof opts.data === 'function') {\n return opts.data(opts);\n }\n\n return fetch(opts.url, opts)\n .then(this.handler.bind(this))\n .then((res) => {\n return {\n data: opts.then(res),\n total: typeof opts.total === 'function' ? opts.total(res) : undefined,\n };\n });\n }\n}\n\nexport default ServerStorage;\n","import { Config } from '../config';\nimport MemoryStorage from './memory';\nimport Storage from './storage';\nimport ServerStorage from './server';\nimport log from '../util/log';\nimport { decode, html } from '../util/html';\n\nclass StorageUtils {\n /**\n * Accepts a Config object and tries to guess and return a Storage type\n *\n * @param config\n */\n public static createFromConfig(config: Config): Storage<any> {\n let storage = null;\n // `data` array is provided\n if (config.data) {\n storage = new MemoryStorage(config.data);\n }\n\n if (config.from) {\n storage = new MemoryStorage(this.tableElementToArray(config.from));\n // remove the source table element from the DOM\n config.from.style.display = 'none';\n }\n\n if (config.server) {\n storage = new ServerStorage(config.server);\n }\n\n if (!storage) {\n log.error('Could not determine the storage type', true);\n }\n\n return storage;\n }\n\n /**\n * Accepts a HTML table element and converts it into a 2D array of data\n *\n * TODO: This function can be a step in the pipeline: Convert Table -> Load into a memory storage -> ...\n *\n * @param element\n */\n static tableElementToArray(element: HTMLElement): any[][] {\n const arr = [];\n const tbody = element.querySelector('tbody');\n const rows = tbody.querySelectorAll('tr');\n\n for (const row of rows as any) {\n const cells: HTMLElement[] = row.querySelectorAll('td');\n const parsedRow = [];\n\n for (const cell of cells) {\n // try to capture a TD with single text element first\n if (\n cell.childNodes.length === 1 &&\n cell.childNodes[0].nodeType === Node.TEXT_NODE\n ) {\n parsedRow.push(decode(cell.innerHTML));\n } else {\n parsedRow.push(html(cell.innerHTML));\n }\n }\n\n arr.push(parsedRow);\n }\n\n return arr;\n }\n}\n\nexport default StorageUtils;\n","import { PipelineProcessor, ProcessorType } from './processor';\nimport { ID } from '../util/id';\nimport log from '../util/log';\nimport { EventEmitter } from '../util/eventEmitter';\n\ninterface PipelineEvents<R> {\n /**\n * Generic updated event. Triggers the callback function when the pipeline\n * is updated, including when a new processor is registered, a processor's props\n * get updated, etc.\n */\n updated: <T, P>(processor: PipelineProcessor<T, P>) => void;\n /**\n * Triggers the callback function when a new\n * processor is registered successfully\n */\n afterRegister: () => void;\n /**\n * Triggers the callback when a registered\n * processor's property is updated\n */\n propsUpdated: () => void;\n /**\n * Triggers the callback function when the pipeline\n * is fully processed, before returning the results\n *\n * afterProcess will not be called if there is an\n * error in the pipeline (i.e a step throw an Error)\n */\n afterProcess: (prev: R) => void;\n /**\n * Triggers the callback function when the pipeline\n * fails to process all steps or at least one step\n * throws an Error\n */\n error: <T>(prev: T) => void;\n}\n\nclass Pipeline<R> extends EventEmitter<PipelineEvents<R>> {\n // available steps for this pipeline\n private readonly _steps: Map<\n ProcessorType,\n PipelineProcessor<unknown, unknown>[]\n > = new Map<ProcessorType, PipelineProcessor<unknown, unknown>[]>();\n // used to cache the results of processors using their id field\n private cache: Map<string, unknown> = new Map<string, unknown>();\n // keeps the index of the last updated processor in the registered\n // processors list and will be used to invalidate the cache\n // -1 means all new processors should be processed\n private lastProcessorIndexUpdated = -1;\n\n constructor(steps?: PipelineProcessor<unknown, unknown>[]) {\n super();\n\n if (steps) {\n steps.forEach((step) => this.register(step));\n }\n }\n\n /**\n * Clears the `cache` array\n */\n clearCache(): void {\n this.cache = new Map<string, object>();\n this.lastProcessorIndexUpdated = -1;\n }\n\n /**\n * Registers a new processor\n *\n * @param processor\n * @param priority\n */\n register<T, P>(\n processor: PipelineProcessor<T, P>,\n priority: number = null,\n ): PipelineProcessor<T, P> {\n if (!processor) {\n throw Error('Processor is not defined');\n }\n\n if (processor.type === null) {\n throw Error('Processor type is not defined');\n }\n\n if (this.findProcessorIndexByID(processor.id) > -1) {\n throw Error(`Processor ID ${processor.id} is already defined`);\n }\n\n // binding the propsUpdated callback to the Pipeline\n processor.on('propsUpdated', this.processorPropsUpdated.bind(this));\n\n this.addProcessorByPriority(processor, priority);\n this.afterRegistered(processor);\n\n return processor;\n }\n\n /**\n * Tries to register a new processor\n * @param processor\n * @param priority\n */\n tryRegister<T, P>(\n processor: PipelineProcessor<T, P>,\n priority: number = null,\n ): PipelineProcessor<T, P> | undefined {\n try {\n return this.register(processor, priority);\n } catch (_) {\n // noop\n }\n\n return undefined;\n }\n\n /**\n * Removes a processor from the list\n *\n * @param processor\n */\n unregister<T, P>(processor: PipelineProcessor<T, P>): void {\n if (!processor) return;\n if (this.findProcessorIndexByID(processor.id) === -1) return;\n\n const subSteps = this._steps.get(processor.type);\n\n if (subSteps && subSteps.length) {\n this._steps.set(\n processor.type,\n subSteps.filter((proc) => proc != processor),\n );\n this.emit('updated', processor);\n }\n }\n\n /**\n * Registers a new processor\n *\n * @param processor\n * @param priority\n */\n private addProcessorByPriority<T, P>(\n processor: PipelineProcessor<T, P>,\n priority: number,\n ): void {\n let subSteps = this._steps.get(processor.type);\n\n if (!subSteps) {\n const newSubStep = [];\n this._steps.set(processor.type, newSubStep);\n subSteps = newSubStep;\n }\n\n if (priority === null || priority < 0) {\n subSteps.push(processor);\n } else {\n if (!subSteps[priority]) {\n // slot is empty\n subSteps[priority] = processor;\n } else {\n // slot is NOT empty\n const first = subSteps.slice(0, priority - 1);\n const second = subSteps.slice(priority + 1);\n\n this._steps.set(processor.type, first.concat(processor).concat(second));\n }\n }\n }\n\n /**\n * Flattens the _steps Map and returns a list of steps with their correct priorities\n */\n get steps(): PipelineProcessor<unknown, unknown>[] {\n let steps: PipelineProcessor<unknown, unknown>[] = [];\n\n for (const type of this.getSortedProcessorTypes()) {\n const subSteps = this._steps.get(type);\n\n if (subSteps && subSteps.length) {\n steps = steps.concat(subSteps);\n }\n }\n\n // to remove any undefined elements\n return steps.filter((s) => s);\n }\n\n /**\n * Accepts ProcessType and returns an array of the registered processes\n * with the give type\n *\n * @param type\n */\n getStepsByType(type: ProcessorType): PipelineProcessor<unknown, unknown>[] {\n return this.steps.filter((process) => process.type === type);\n }\n\n /**\n * Returns a list of ProcessorType according to their priority\n */\n private getSortedProcessorTypes(): ProcessorType[] {\n return Object.keys(ProcessorType)\n .filter((key) => !isNaN(Number(key)))\n .map((key) => Number(key));\n }\n\n /**\n * Runs all registered processors based on their correct priority\n * and returns the final output after running all steps\n *\n * @param data\n */\n async process(data?: R): Promise<R> {\n const lastProcessorIndexUpdated = this.lastProcessorIndexUpdated;\n const steps = this.steps;\n\n let prev = data;\n\n try {\n for (const processor of steps) {\n const processorIndex = this.findProcessorIndexByID(processor.id);\n\n if (processorIndex >= lastProcessorIndexUpdated) {\n // we should execute process() here since the last\n // updated processor was before \"processor\".\n // This is to ensure that we always have correct and up to date\n // data from processors and also to skip them when necessary\n prev = (await processor.process(prev)) as R;\n this.cache.set(processor.id, prev);\n } else {\n // cached results already exist\n prev = this.cache.get(processor.id) as R;\n }\n }\n } catch (e) {\n log.error(e);\n // trigger the onError callback\n this.emit('error', prev);\n\n // rethrow\n throw e;\n }\n\n // means the pipeline is up to date\n this.lastProcessorIndexUpdated = steps.length;\n\n // triggers the afterProcess callbacks with the results\n this.emit('afterProcess', prev);\n\n return prev;\n }\n\n /**\n * Returns the registered processor's index in _steps array\n *\n * @param processorID\n */\n private findProcessorIndexByID(processorID: ID): number {\n return this.steps.findIndex((p) => p.id == processorID);\n }\n\n /**\n * Sets the last updates processors index locally\n * This is used to invalid or skip a processor in\n * the process() method\n */\n private setLastProcessorIndex<T, P>(\n processor: PipelineProcessor<T, P>,\n ): void {\n const processorIndex = this.findProcessorIndexByID(processor.id);\n\n if (this.lastProcessorIndexUpdated > processorIndex) {\n this.lastProcessorIndexUpdated = processorIndex;\n }\n }\n\n private processorPropsUpdated(processor): void {\n this.setLastProcessorIndex(processor);\n this.emit('propsUpdated');\n this.emit('updated', processor);\n }\n\n private afterRegistered(processor): void {\n this.setLastProcessorIndex(processor);\n this.emit('afterRegister');\n this.emit('updated', processor);\n }\n}\n\nexport default Pipeline;\n","import Storage, { StorageResponse } from '../../storage/storage';\nimport {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\n\ninterface StorageExtractorProps extends PipelineProcessorProps {\n storage: Storage<any>;\n}\n\nclass StorageExtractor extends PipelineProcessor<\n StorageResponse,\n StorageExtractorProps\n> {\n get type(): ProcessorType {\n return ProcessorType.Extractor;\n }\n\n async _process(opts: any): Promise<StorageResponse> {\n return await this.props.storage.get(opts);\n }\n}\n\nexport default StorageExtractor;\n","import { PipelineProcessor, ProcessorType } from '../processor';\nimport Tabular from '../../tabular';\nimport { ArrayResponse } from './storageResponseToArray';\n\nclass ArrayToTabularTransformer extends PipelineProcessor<\n Tabular,\n Record<string, any>\n> {\n get type(): ProcessorType {\n return ProcessorType.Transformer;\n }\n\n _process(arrayResponse: ArrayResponse): Tabular {\n const tabular = Tabular.fromArray(arrayResponse.data);\n\n // for server-side storage\n tabular.length = arrayResponse.total;\n\n return tabular;\n }\n}\n\nexport default ArrayToTabularTransformer;\n","import {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerInitiatorProps extends PipelineProcessorProps {\n serverStorageOptions: ServerStorageOptions;\n}\n\nclass ServerInitiator extends PipelineProcessor<\n ServerStorageOptions,\n ServerInitiatorProps\n> {\n get type(): ProcessorType {\n return ProcessorType.Initiator;\n }\n\n _process(): ServerStorageOptions {\n return Object.entries(this.props.serverStorageOptions)\n .filter(([_, val]) => typeof val !== 'function')\n .reduce(\n (acc, [k, v]) => ({ ...acc, [k]: v }),\n {},\n ) as ServerStorageOptions;\n }\n}\n\nexport default ServerInitiator;\n","import {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { StorageResponse } from '../../storage/storage';\nimport { TCell, TData, TDataArray, TDataObject, TwoDArray } from '../../types';\nimport Header from '../../header';\nimport logger from '../../util/log';\n\nexport interface ArrayResponse {\n data: TwoDArray<TCell>;\n total: number;\n}\n\ninterface StorageResponseToArrayTransformerProps\n extends PipelineProcessorProps {\n header: Header;\n}\n\nclass StorageResponseToArrayTransformer extends PipelineProcessor<\n ArrayResponse,\n StorageResponseToArrayTransformerProps\n> {\n get type(): ProcessorType {\n return ProcessorType.Transformer;\n }\n\n private castData(data: TData): TwoDArray<TCell> {\n if (!data || !data.length) {\n return [];\n }\n\n if (!this.props.header || !this.props.header.columns) {\n return data as TwoDArray<TCell>;\n }\n\n const columns = Header.leafColumns(this.props.header.columns);\n\n // if it's a 2d array already\n if (data[0] instanceof Array) {\n return (data as TDataArray).map((row) => {\n let pad = 0;\n\n return columns.map((column, i) => {\n // default `data` is provided for this column\n if (column.data !== undefined) {\n pad++;\n\n if (typeof column.data === 'function') {\n return column.data(row);\n } else {\n return column.data;\n }\n }\n\n return row[i - pad];\n });\n });\n }\n\n // if it's an array of objects (but not array of arrays, i.e JSON payload)\n if (typeof data[0] === 'object' && !(data[0] instanceof Array)) {\n return (data as TDataObject).map((row) =>\n columns.map((column, i) => {\n if (column.data !== undefined) {\n if (typeof column.data === 'function') {\n return column.data(row);\n } else {\n return column.data;\n }\n } else if (column.id) {\n return row[column.id];\n } else {\n logger.error(`Could not find the correct cell for column at position ${i}.\n Make sure either 'id' or 'selector' is defined for all columns.`);\n return null;\n }\n }),\n );\n }\n\n return [];\n }\n\n _process(storageResponse: StorageResponse): ArrayResponse {\n return {\n data: this.castData(storageResponse.data),\n total: storageResponse.total,\n };\n }\n}\n\nexport default StorageResponseToArrayTransformer;\n","import { Config } from '../config';\nimport Pipeline from './pipeline';\nimport Tabular from '../tabular';\nimport StorageExtractor from './extractor/storage';\nimport ArrayToTabularTransformer from './transformer/arrayToTabular';\nimport ServerStorage from '../storage/server';\nimport ServerInitiator from './initiator/server';\nimport StorageResponseToArrayTransformer from './transformer/storageResponseToArray';\n\nclass PipelineUtils {\n static createFromConfig(config: Config): Pipeline<Tabular> {\n const pipeline = new Pipeline<Tabular>();\n\n if (config.storage instanceof ServerStorage) {\n pipeline.register(\n new ServerInitiator({\n serverStorageOptions: config.server,\n }),\n );\n }\n\n pipeline.register(new StorageExtractor({ storage: config.storage }));\n pipeline.register(\n new StorageResponseToArrayTransformer({ header: config.header }),\n );\n pipeline.register(new ArrayToTabularTransformer());\n\n return pipeline;\n }\n}\n\nexport default PipelineUtils;\n","export class Store<S = Record<string, unknown>> {\n private state: S;\n private listeners: ((current?: S, prev?: S) => void)[] = [];\n private isDispatching = false;\n\n constructor(initialState: S) {\n this.state = initialState;\n }\n\n getState = () => this.state;\n getListeners = () => this.listeners;\n\n dispatch = (reducer: (state: S) => S) => {\n if (typeof reducer !== 'function')\n throw new Error('Reducer is not a function');\n if (this.isDispatching)\n throw new Error('Reducers may not dispatch actions');\n\n this.isDispatching = true;\n\n const prevState = this.state;\n try {\n this.state = reducer(this.state);\n } finally {\n this.isDispatching = false;\n }\n\n for (const listener of this.listeners) {\n listener(this.state, prevState);\n }\n\n return this.state;\n };\n\n subscribe = (listener: (current?: S, prev?: S) => void): (() => void) => {\n if (typeof listener !== 'function')\n throw new Error('Listener is not a function');\n\n this.listeners = [...this.listeners, listener];\n return () =>\n (this.listeners = this.listeners.filter((lis) => lis !== listener));\n };\n}\n","import { CSSDeclaration, OneDArray, Status, TColumn, TData } from './types';\nimport Storage from './storage/storage';\nimport Pipeline from './pipeline/pipeline';\nimport Tabular from './tabular';\nimport { Search, SearchConfig } from './view/plugin/search/search';\nimport { Pagination, PaginationConfig } from './view/plugin/pagination';\nimport Header from './header';\nimport { ServerStorageOptions } from './storage/server';\nimport { GenericSortConfig } from './view/plugin/sort/sort';\nimport { Language, Translator } from './i18n/language';\nimport { ComponentChild, createContext, createRef, RefObject } from 'preact';\nimport StorageUtils from './storage/storageUtils';\nimport PipelineUtils from './pipeline/pipelineUtils';\nimport { EventEmitter } from './util/eventEmitter';\nimport { GridEvents } from './events';\nimport { PluginManager, PluginPosition, Plugin } from './plugin';\nimport Grid from './grid';\nimport { Store } from './state/store';\n\nexport const ConfigContext = createContext(null);\n\nexport interface Config {\n // a reference to the current Grid.js instance\n instance: Grid;\n store: Store;\n eventEmitter: EventEmitter<GridEvents>;\n plugin: PluginManager;\n /** container element that is used to mount the Grid.js to */\n // TODO: change this to an element reference\n container?: Element;\n /** pointer to the main table element */\n tableRef?: RefObject<HTMLTableElement>;\n data?: TData | (() => TData) | (() => Promise<TData>);\n server?: ServerStorageOptions;\n header?: Header;\n /** to parse a HTML table and load the data */\n from: HTMLElement;\n storage: Storage<any>;\n /** Pipeline process throttle timeout in milliseconds */\n processingThrottleMs: number;\n pipeline: Pipeline<Tabular>;\n /** to automatically calculate the columns width */\n autoWidth: boolean;\n /** sets the width of the container and table */\n width: string;\n /** sets the height of the table */\n height: string;\n pagination: PaginationConfig | boolean;\n sort: GenericSortConfig | boolean;\n translator: Translator;\n /** fixes the table header to the top of the table */\n fixedHeader: boolean;\n /** Resizable columns? */\n resizable: boolean;\n columns: OneDArray<TColumn | string | ComponentChild>;\n search: SearchConfig | boolean;\n language: Language;\n plugins?: Plugin<any>[];\n style?: Partial<{\n table: CSSDeclaration;\n td: CSSDeclaration;\n th: CSSDeclaration;\n container: CSSDeclaration;\n header: CSSDeclaration;\n footer: CSSDeclaration;\n }>;\n className?: Partial<{\n table: string;\n th: string;\n thead: string;\n tbody: string;\n tr: string;\n td: string;\n container: string;\n footer: string;\n header: string;\n search: string;\n sort: string;\n pagination: string;\n paginationSummary: string;\n paginationButton: string;\n paginationButtonNext: string;\n paginationButtonCurrent: string;\n paginationButtonPrev: string;\n loading: string;\n notfound: string;\n error: string;\n }>;\n}\n\nexport class Config {\n public constructor() {\n Object.assign(this, Config.defaultConfig());\n }\n /**\n * Assigns `updatedConfig` keys to the current config file\n *\n * @param partialConfig\n */\n assign(partialConfig: Partial<Config>): Config {\n return Object.assign(this, partialConfig);\n }\n\n /**\n * Updates the config from a partial Config\n *\n * @param partialConfig\n */\n update(partialConfig: Partial<Config>): Config {\n if (!partialConfig) return this;\n\n this.assign(\n Config.fromPartialConfig({\n ...this,\n ...partialConfig,\n }),\n );\n\n return this;\n }\n\n static defaultConfig(): Partial<Config> {\n return {\n store: new Store({\n status: Status.Init,\n header: undefined,\n data: null,\n }),\n plugin: new PluginManager(),\n tableRef: createRef(),\n width: '100%',\n height: 'auto',\n processingThrottleMs: 100,\n autoWidth: true,\n style: {},\n className: {},\n };\n }\n\n static fromPartialConfig(partialConfig: Partial<Config>): Partial<Config> {\n const config = new Config().assign(partialConfig);\n\n // Sort\n if (typeof partialConfig.sort === 'boolean' && partialConfig.sort) {\n config.assign({\n sort: {\n multiColumn: true,\n },\n });\n }\n\n // Header\n config.assign({\n header: Header.createFromConfig(config),\n });\n\n config.assign({\n storage: StorageUtils.createFromConfig(config),\n });\n\n config.assign({\n pipeline: PipelineUtils.createFromConfig(config),\n });\n\n // Translator\n config.assign({\n translator: new Translator(config.language),\n });\n\n // clear existing plugins list to prevent duplicate errors\n config.plugin = new PluginManager();\n\n if (config.search) {\n // Search\n config.plugin.add({\n id: 'search',\n position: PluginPosition.Header,\n component: Search,\n });\n }\n\n if (config.pagination) {\n // Pagination\n config.plugin.add({\n id: 'pagination',\n position: PluginPosition.Footer,\n component: Pagination,\n });\n }\n\n // Additional plugins\n if (config.plugins) {\n config.plugins.forEach((p) => config.plugin.add(p));\n }\n\n return config;\n }\n}\n","import { h, ComponentChild, JSX } from 'preact';\n\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { CSSDeclaration, TColumn } from '../../types';\nimport Row from '../../row';\nimport { JSXInternal } from 'preact/src/jsx';\nimport { PluginRenderer } from '../../plugin';\nimport { useConfig } from '../../hooks/useConfig';\n\nexport function TD(\n props: {\n cell: Cell;\n row?: Row;\n column?: TColumn;\n style?: CSSDeclaration;\n messageCell?: boolean;\n } & Omit<JSX.HTMLAttributes<HTMLTableCellElement>, 'style'>,\n) {\n const config = useConfig();\n\n const content = (): ComponentChild => {\n if (props.column && typeof props.column.formatter === 'function') {\n return props.column.formatter(props.cell.data, props.row, props.column);\n }\n\n if (props.column && props.column.plugin) {\n return (\n <PluginRenderer\n pluginId={props.column.id}\n props={{\n column: props.column,\n cell: props.cell,\n row: props.row,\n }}\n />\n );\n }\n\n return props.cell.data;\n };\n\n const handleClick = (\n e: JSX.TargetedMouseEvent<HTMLTableCellElement>,\n ): void => {\n if (props.messageCell) return;\n\n config.eventEmitter.emit(\n 'cellClick',\n e,\n props.cell,\n props.column,\n props.row,\n );\n };\n\n const getCustomAttributes = (\n column: TColumn | null,\n ): JSXInternal.HTMLAttributes<HTMLTableCellElement> => {\n if (!column) return {};\n\n if (typeof column.attributes === 'function') {\n return column.attributes(props.cell.data, props.row, props.column);\n } else {\n return column.attributes;\n }\n };\n\n return (\n <td\n role={props.role}\n colSpan={props.colSpan}\n data-column-id={props.column && props.column.id}\n className={classJoin(\n className('td'),\n props.className,\n config.className.td,\n )}\n style={{\n ...props.style,\n ...config.style.td,\n }}\n onClick={handleClick}\n {...getCustomAttributes(props.column)}\n >\n {content()}\n </td>\n );\n}\n","import { h, JSX, ComponentChildren } from 'preact';\n\nimport Row from '../../row';\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { TColumn } from '../../types';\nimport { TD } from './td';\nimport Header from '../../header';\nimport { useConfig } from '../../hooks/useConfig';\nimport useSelector from '../../hooks/useSelector';\n\nexport function TR(props: {\n row?: Row;\n messageRow?: boolean;\n children?: ComponentChildren;\n}) {\n const config = useConfig();\n const header = useSelector((state) => state.header);\n\n const getColumn = (cellIndex: number): TColumn => {\n if (header) {\n const cols = Header.leafColumns(header.columns);\n\n if (cols) {\n return cols[cellIndex];\n }\n }\n\n return null;\n };\n\n const handleClick = (\n e: JSX.TargetedMouseEvent<HTMLTableRowElement>,\n ): void => {\n if (props.messageRow) return;\n config.eventEmitter.emit('rowClick', e, props.row);\n };\n\n const getChildren = (): ComponentChildren => {\n if (props.children) {\n return props.children;\n }\n\n return props.row.cells.map((cell: Cell, i) => {\n const column = getColumn(i);\n\n if (column && column.hidden) return null;\n\n return <TD key={cell.id} cell={cell} row={props.row} column={column} />;\n });\n };\n\n return (\n <tr\n className={classJoin(className('tr'), config.className.tr)}\n onClick={handleClick}\n >\n {getChildren()}\n </tr>\n );\n}\n","import { h } from 'preact';\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { TR } from './tr';\nimport { TD } from './td';\n\nexport function MessageRow(props: {\n message: string;\n colSpan?: number;\n className?: string;\n}) {\n return (\n <TR messageRow={true}>\n <TD\n role=\"alert\"\n colSpan={props.colSpan}\n messageCell={true}\n cell={new Cell(props.message)}\n className={classJoin(\n className('message'),\n props.className ? props.className : null,\n )}\n />\n </TR>\n );\n}\n","import { h } from 'preact';\nimport Row from '../../row';\nimport { TR } from './tr';\nimport { classJoin, className } from '../../util/className';\nimport { Status } from '../../types';\nimport { MessageRow } from './messageRow';\nimport { useConfig } from '../../hooks/useConfig';\nimport { useTranslator } from '../../i18n/language';\nimport useSelector from '../../hooks/useSelector';\n\nexport function TBody() {\n const config = useConfig();\n const data = useSelector((state) => state.data);\n const status = useSelector((state) => state.status);\n const header = useSelector((state) => state.header);\n const _ = useTranslator();\n\n const headerLength = () => {\n if (header) {\n return header.visibleColumns.length;\n }\n return 0;\n };\n\n return (\n <tbody className={classJoin(className('tbody'), config.className.tbody)}>\n {data &&\n data.rows.map((row: Row) => {\n return <TR key={row.id} row={row} />;\n })}\n\n {status === Status.Loading && (!data || data.length === 0) && (\n <MessageRow\n message={_('loading')}\n colSpan={headerLength()}\n className={classJoin(className('loading'), config.className.loading)}\n />\n )}\n\n {status === Status.Rendered && data && data.length === 0 && (\n <MessageRow\n message={_('noRecordsFound')}\n colSpan={headerLength()}\n className={classJoin(\n className('notfound'),\n config.className.notfound,\n )}\n />\n )}\n\n {status === Status.Error && (\n <MessageRow\n message={_('error')}\n colSpan={headerLength()}\n className={classJoin(className('error'), config.className.error)}\n />\n )}\n </tbody>\n );\n}\n","import { Comparator, TCell } from '../../types';\nimport Tabular from '../../tabular';\nimport {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport Row from '../../row';\nimport log from '../../util/log';\n\ninterface NativeSortProps extends PipelineProcessorProps {\n columns: {\n index: number;\n // 1 ascending, -1 descending\n direction?: 1 | -1;\n compare?: Comparator<TCell>;\n }[];\n}\n\nclass NativeSort extends PipelineProcessor<Tabular, NativeSortProps> {\n protected validateProps(): void {\n for (const condition of this.props.columns) {\n if (condition.direction === undefined) {\n condition.direction = 1;\n }\n\n if (condition.direction !== 1 && condition.direction !== -1) {\n log.error(`Invalid sort direction ${condition.direction}`);\n }\n }\n }\n\n get type(): ProcessorType {\n return ProcessorType.Sort;\n }\n\n private compare(cellA: TCell, cellB: TCell): number {\n if (cellA > cellB) {\n return 1;\n } else if (cellA < cellB) {\n return -1;\n }\n\n return 0;\n }\n\n private compareWrapper(a: Row, b: Row): number {\n let cmp = 0;\n\n for (const column of this.props.columns) {\n if (cmp === 0) {\n const cellA = a.cells[column.index].data;\n const cellB = b.cells[column.index].data;\n\n if (typeof column.compare === 'function') {\n cmp |= column.compare(cellA, cellB) * column.direction;\n } else {\n cmp |= this.compare(cellA, cellB) * column.direction;\n }\n } else {\n break;\n }\n }\n\n return cmp;\n }\n\n protected _process(data: Tabular): Tabular {\n const sortedRows = [...data.rows];\n sortedRows.sort(this.compareWrapper.bind(this));\n\n const sorted = new Tabular(sortedRows);\n // we have to set the tabular length manually\n // because of the server-side storage\n sorted.length = data.length;\n\n return sorted;\n }\n}\n\nexport default NativeSort;\n","import { Comparator, TCell } from '../../../types';\n\nexport const SortColumn =\n (\n index: number,\n direction: 1 | -1,\n multi?: boolean,\n compare?: Comparator<TCell>,\n ) =>\n (state) => {\n let columns = state.sort?.columns\n ? state.sort.columns.map((x) => {\n return { ...x };\n })\n : [];\n const count = columns.length;\n const column = columns.find((x) => x.index === index);\n const exists = column !== undefined;\n\n let add = false;\n let reset = false;\n let remove = false;\n let update = false;\n\n if (!exists) {\n // the column has not been sorted\n if (count === 0) {\n // the first column to be sorted\n add = true;\n } else if (count > 0 && !multi) {\n // remove the previously sorted column\n // and sort the current column\n add = true;\n reset = true;\n } else if (count > 0 && multi) {\n // multi-sorting\n // sort this column as well\n add = true;\n }\n } else {\n // the column has been sorted before\n if (!multi) {\n // single column sorting\n if (count === 1) {\n update = true;\n } else if (count > 1) {\n // this situation happens when we have already entered\n // multi-sorting mode but then user tries to sort a single column\n reset = true;\n add = true;\n }\n } else {\n // multi sorting\n if (column.direction === -1) {\n // remove the current column from the\n // sorted columns array\n remove = true;\n } else {\n update = true;\n }\n }\n }\n\n if (reset) {\n // resetting the sorted columns\n columns = [];\n }\n\n if (add) {\n columns.push({\n index: index,\n direction: direction,\n compare: compare,\n });\n } else if (update) {\n const index = columns.indexOf(column);\n columns[index].direction = direction;\n } else if (remove) {\n const index = columns.indexOf(column);\n columns.splice(index, 1);\n }\n\n return {\n ...state,\n sort: {\n columns: columns,\n },\n };\n };\n\nexport const SortToggle =\n (index: number, multi: boolean, compare?: Comparator<TCell>) => (state) => {\n const columns = state.sort ? [...state.sort.columns] : [];\n const column = columns.find((x) => x.index === index);\n\n if (!column) {\n return {\n ...state,\n ...SortColumn(index, 1, multi, compare)(state),\n };\n }\n\n return {\n ...state,\n ...SortColumn(\n index,\n column.direction === 1 ? -1 : 1,\n multi,\n compare,\n )(state),\n };\n };\n","import {\n PipelineProcessor,\n PipelineProcessorProps,\n ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\nimport { TColumnSort } from '../../types';\n\ninterface ServerSortProps extends PipelineProcessorProps {\n columns: TColumnSort[];\n url?: (prevUrl: string, columns: TColumnSort[]) => string;\n body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;\n}\n\nclass ServerSort extends PipelineProcessor<\n ServerStorageOptions,\n ServerSortProps\n> {\n get type(): ProcessorType {\n return ProcessorType.ServerSort;\n }\n\n _process(options?: ServerStorageOptions): ServerStorageOptions {\n const updates = {};\n\n if (this.props.url) {\n updates['url'] = this.props.url(options.url, this.props.columns);\n }\n\n if (this.props.body) {\n updates['body'] = this.props.body(options.body, this.props.columns);\n }\n\n return {\n ...options,\n ...updates,\n };\n }\n}\n\nexport default ServerSort;\n","import { h, JSX } from 'preact';\n\nimport { classJoin, className } from '../../../util/className';\nimport { PipelineProcessor, ProcessorType } from '../../../pipeline/processor';\nimport NativeSort from '../../../pipeline/sort/native';\nimport { Comparator, TCell, TColumnSort } from '../../../types';\nimport * as actions from './actions';\nimport ServerSort from '../../../pipeline/sort/server';\nimport { useEffect, useState } from 'preact/hooks';\nimport { useConfig } from '../../../hooks/useConfig';\nimport { useTranslator } from '../../../i18n/language';\nimport useSelector from '../../../hooks/useSelector';\nimport { useStore } from '../../../hooks/useStore';\n\n// column specific config\nexport interface SortConfig {\n compare?: Comparator<TCell>;\n // 1 ascending, -1 descending\n direction?: 1 | -1;\n}\n\n// generic sort config:\n//\n// Config {\n// sort: GenericSortConfig\n// }\n//\nexport interface GenericSortConfig {\n multiColumn?: boolean;\n server?: {\n url?: (prevUrl: string, columns: TColumnSort[]) => string;\n body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;\n };\n}\n\nexport function Sort(\n props: {\n // column index\n index: number;\n } & SortConfig,\n) {\n const config = useConfig();\n const { dispatch } = useStore();\n const _ = useTranslator();\n const [direction, setDirection] = useState(0);\n const sortConfig = config.sort as GenericSortConfig;\n const state = useSelector((state) => state.sort);\n const processorType =\n typeof sortConfig?.server === 'object'\n ? ProcessorType.ServerSort\n : ProcessorType.Sort;\n\n const getSortProcessor = () => {\n const processors = config.pipeline.getStepsByType(processorType);\n if (processors.length) {\n return processors[0];\n }\n return undefined;\n };\n\n const createSortProcessor = () => {\n if (processorType === ProcessorType.ServerSort) {\n return new ServerSort({\n columns: state ? state.columns : [],\n ...sortConfig.server,\n });\n }\n\n return new NativeSort({\n columns: state ? state.columns : [],\n });\n };\n\n const getOrCreateSortProcessor = (): PipelineProcessor<any, any> => {\n const existingSortProcessor = getSortProcessor();\n if (existingSortProcessor) {\n return existingSortProcessor;\n }\n\n return createSortProcessor();\n };\n\n useEffect(() => {\n const processor = getOrCreateSortProcessor();\n config.pipeline.tryRegister(processor);\n\n return () => config.pipeline.unregister(processor);\n }, [config]);\n\n /**\n * Sets the internal state of component\n */\n useEffect(() => {\n if (!state) return;\n\n const currentColumn = state.columns.find((x) => x.index === props.index);\n\n if (!currentColumn) {\n setDirection(0);\n } else {\n // if the direction is not set, initialize the selected\n // column direction with the passed prop (default to ascending)\n if (direction === 0) {\n currentColumn.direction = props.direction ?? 1;\n }\n setDirection(currentColumn.direction);\n }\n }, [state]);\n\n useEffect(() => {\n const processor = getSortProcessor();\n\n if (!processor) return;\n if (!state) return;\n\n processor.setProps({\n columns: state.columns,\n });\n }, [state]);\n\n const changeDirection = (e: JSX.TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // to sort two or more columns at the same time\n dispatch(\n actions.SortToggle(\n props.index,\n e.shiftKey === true && sortConfig.multiColumn,\n props.compare,\n ),\n );\n };\n\n const getSortClassName = (direction: number) => {\n if (direction === 1) {\n return 'asc';\n } else if (direction === -1) {\n return 'desc';\n }\n\n return 'neutral';\n };\n\n return (\n <button\n // because the corresponding <th> has tabIndex=0\n tabIndex={-1}\n aria-label={_(`sort.sort${direction === 1 ? 'Desc' : 'Asc'}`)}\n title={_(`sort.sort${direction === 1 ? 'Desc' : 'Asc'}`)}\n className={classJoin(\n className('sort'),\n className('sort', getSortClassName(direction)),\n config.className.sort,\n )}\n onClick={changeDirection}\n />\n );\n}\n","/**\n * Throttle a given function\n * @param fn Function to be called\n * @param wait Throttle timeout in milliseconds\n * @returns Throttled function\n */\nexport const throttle = (fn: (...args) => void, wait = 100) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n let lastTime = Date.now();\n\n const execute = (...args) => {\n lastTime = Date.now();\n fn(...args);\n };\n\n return (...args) => {\n const currentTime = Date.now();\n const elapsed = currentTime - lastTime;\n\n if (elapsed >= wait) {\n // If enough time has passed since the last call, execute the function immediately\n execute(...args);\n } else {\n // If not enough time has passed, schedule the function call after the remaining delay\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n execute(...args);\n timeoutId = null;\n }, wait - elapsed);\n }\n };\n};\n","import { h, RefObject } from 'preact';\nimport { classJoin, className } from '../../../util/className';\nimport { TColumn } from '../../../types';\nimport { throttle } from '../../../util/throttle';\n\nexport function Resize(props: {\n column: TColumn;\n thRef: RefObject<HTMLTableCellElement>;\n}) {\n let moveFn: (e) => void;\n\n const getPageX = (e: MouseEvent | TouchEvent) => {\n if (e instanceof MouseEvent) {\n return Math.floor(e.pageX);\n } else {\n return Math.floor(e.changedTouches[0].pageX);\n }\n };\n\n const start = (e: MouseEvent | TouchEvent) => {\n e.stopPropagation();\n\n const thElement = props.thRef.current;\n\n const offsetStart = parseInt(thElement.style.width, 10) - getPageX(e);\n\n moveFn = throttle((e) => move(e, offsetStart), 10);\n\n document.addEventListener('mouseup', end);\n document.addEventListener('touchend', end);\n document.addEventListener('mousemove', moveFn);\n document.addEventListener('touchmove', moveFn);\n };\n\n const move = (e: MouseEvent | TouchEvent, offsetStart: number) => {\n e.stopPropagation();\n\n const thElement = props.thRef.current;\n\n if (offsetStart + getPageX(e) >= parseInt(thElement.style.minWidth, 10)) {\n thElement.style.width = `${offsetStart + getPageX(e)}px`;\n }\n };\n\n const end = (e: MouseEvent | TouchEvent) => {\n e.stopPropagation();\n\n document.removeEventListener('mouseup', end);\n document.removeEventListener('mousemove', moveFn);\n document.removeEventListener('touchmove', moveFn);\n document.removeEventListener('touchend', end);\n };\n\n return (\n <div\n className={classJoin(className('th'), className('resizable'))}\n onMouseDown={start}\n onTouchStart={start}\n onClick={(e) => e.stopPropagation()}\n />\n );\n}\n","import { h, ComponentChild, JSX } from 'preact';\n\nimport { classJoin, className } from '../../util/className';\nimport { CSSDeclaration, TColumn } from '../../types';\nimport { GenericSortConfig, Sort } from '../plugin/sort/sort';\nimport { PluginRenderer } from '../../plugin';\nimport { Resize } from '../plugin/resize/resize';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../../hooks/useConfig';\nimport * as SortActions from '../plugin/sort/actions';\nimport { useStore } from '../../hooks/useStore';\n\nexport function TH(\n props: {\n index: number;\n column: TColumn;\n style?: CSSDeclaration;\n } & Omit<JSX.HTMLAttributes<HTMLTableCellElement>, 'style'>,\n) {\n const config = useConfig();\n const thRef = useRef(null);\n const [style, setStyle] = useState({});\n const { dispatch } = useStore();\n\n useEffect(() => {\n // sets the `top` style if the current TH is fixed\n if (config.fixedHeader && thRef.current) {\n const offsetTop = thRef.current.offsetTop;\n\n if (typeof offsetTop === 'number') {\n setStyle({\n top: offsetTop,\n });\n }\n }\n }, [thRef]);\n\n const isSortable = (): boolean => props.column.sort != undefined;\n const isResizable = (): boolean => props.column.resizable;\n const onClick = (\n e:\n | JSX.TargetedMouseEvent<HTMLTableCellElement>\n | JSX.TargetedKeyboardEvent<HTMLTableCellElement>,\n ) => {\n e.stopPropagation();\n\n if (isSortable()) {\n const sortConfig = config.sort as GenericSortConfig;\n\n dispatch(\n SortActions.SortToggle(\n props.index,\n e.shiftKey === true && sortConfig.multiColumn,\n props.column.sort.compare,\n ),\n );\n }\n };\n\n const keyDown = (e: JSX.TargetedKeyboardEvent<HTMLTableCellElement>) => {\n // Enter key\n if (isSortable() && e.which === 13) {\n onClick(e);\n }\n };\n\n const content = (): ComponentChild => {\n if (props.column.name !== undefined) {\n return props.column.name;\n }\n\n if (props.column.plugin !== undefined) {\n return (\n <PluginRenderer\n pluginId={props.column.plugin.id}\n props={{\n column: props.column,\n }}\n />\n );\n }\n\n return null;\n };\n\n const getCustomAttributes = () => {\n const column = props.column;\n\n if (!column) return {};\n\n if (typeof column.attributes === 'function') {\n return column.attributes(null, null, props.column);\n } else {\n return column.attributes;\n }\n };\n\n return (\n <th\n ref={thRef}\n data-column-id={props.column && props.column.id}\n className={classJoin(\n className('th'),\n isSortable() ? className('th', 'sort') : null,\n config.fixedHeader ? className('th', 'fixed') : null,\n config.className.th,\n )}\n onClick={onClick}\n style={{\n ...config.style.th,\n ...{\n minWidth: props.column.minWidth,\n width: props.column.width,\n },\n ...style,\n ...props.style,\n }}\n onKeyDown={keyDown}\n rowSpan={props.rowSpan > 1 ? props.rowSpan : undefined}\n colSpan={props.colSpan > 1 ? props.colSpan : undefined}\n {...getCustomAttributes()}\n {...(isSortable() ? { tabIndex: 0 } : {})}\n >\n <div className={className('th', 'content')}>{content()}</div>\n {isSortable() && <Sort index={props.index} {...props.column.sort} />}\n {isResizable() &&\n props.index < config.header.visibleColumns.length - 1 && (\n <Resize column={props.column} thRef={thRef} />\n )}\n </th>\n );\n}\n","import { h } from 'preact';\nimport { TR } from './tr';\nimport { TH } from './th';\nimport { classJoin, className } from '../../util/className';\nimport Header from '../../header';\nimport { TColumn } from '../../types';\nimport { calculateRowColSpans } from '../../util/table';\nimport { useConfig } from '../../hooks/useConfig';\nimport useSelector from '../../hooks/useSelector';\n\nexport function THead() {\n const config = useConfig();\n const header = useSelector((state) => state.header);\n\n const renderColumn = (\n column: TColumn,\n rowIndex: number,\n columnIndex: number,\n totalRows: number,\n ) => {\n const { rowSpan, colSpan } = calculateRowColSpans(\n column,\n rowIndex,\n totalRows,\n );\n\n return (\n <TH\n column={column}\n index={columnIndex}\n colSpan={colSpan}\n rowSpan={rowSpan}\n />\n );\n };\n\n const renderRow = (row: TColumn[], rowIndex: number, totalRows: number) => {\n // because the only sortable columns are leaf columns (not parents)\n const leafColumns = Header.leafColumns(header.columns);\n\n return (\n <TR>\n {row.map((col) => {\n if (col.hidden) return null;\n\n return renderColumn(\n col,\n rowIndex,\n leafColumns.indexOf(col),\n totalRows,\n );\n })}\n </TR>\n );\n };\n\n const renderRows = () => {\n const rows = Header.tabularFormat(header.columns);\n\n return rows.map((row, rowIndex) => renderRow(row, rowIndex, rows.length));\n };\n\n if (header) {\n return (\n <thead\n key={header.id}\n className={classJoin(className('thead'), config.className.thead)}\n >\n {renderRows()}\n </thead>\n );\n }\n\n return null;\n}\n","import { TColumn } from '../types';\nimport Header from '../header';\n\nexport function calculateRowColSpans(\n column: TColumn,\n rowIndex: number,\n totalRows: number,\n): { rowSpan: number; colSpan: number } {\n const depth = Header.maximumDepth(column);\n const remainingRows = totalRows - rowIndex;\n const rowSpan = Math.floor(remainingRows - depth - depth / remainingRows);\n const colSpan = (column.columns && column.columns.length) || 1;\n\n return {\n rowSpan: rowSpan,\n colSpan: colSpan,\n };\n}\n","import Header from 'src/header';\nimport Tabular from '../tabular';\nimport { Status } from '../types';\n\nexport const SetStatusToRendered = () => (state) => {\n if (state.status === Status.Loaded) {\n return {\n ...state,\n status: Status.Rendered,\n };\n }\n\n return state;\n};\n\nexport const SetLoadingData = () => (state) => {\n return {\n ...state,\n status: Status.Loading,\n };\n};\n\nexport const SetData = (data: Tabular) => (state) => {\n if (!data) return state;\n\n return {\n ...state,\n data: data,\n status: Status.Loaded,\n };\n};\n\nexport const SetDataErrored = () => (state) => {\n return {\n ...state,\n data: null,\n status: Status.Error,\n };\n};\n\nexport const SetHeader = (header: Header) => (state) => {\n return {\n ...state,\n header: header,\n };\n};\n\nexport const SetTableRef = (tableRef) => (state) => {\n return {\n ...state,\n tableRef: tableRef,\n };\n};\n","import { h } from 'preact';\nimport { TBody } from './tbody';\nimport { THead } from './thead';\nimport { classJoin, className } from '../../util/className';\nimport { useConfig } from '../../hooks/useConfig';\nimport { useEffect, useRef } from 'preact/hooks';\nimport * as actions from '../actions';\nimport { useStore } from '../../hooks/useStore';\n\nexport function Table() {\n const config = useConfig();\n const tableRef = useRef(null);\n const { dispatch } = useStore();\n\n useEffect(() => {\n if (tableRef) dispatch(actions.SetTableRef(tableRef));\n }, [tableRef]);\n\n return (\n <table\n ref={tableRef}\n role=\"grid\"\n className={classJoin(className('table'), config.className.table)}\n style={{\n ...config.style.table,\n ...{\n height: config.height,\n },\n }}\n >\n <THead />\n <TBody />\n </table>\n );\n}\n","import { classJoin, className } from '../util/className';\nimport { h } from 'preact';\nimport { PluginPosition, PluginRenderer } from '../plugin';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../hooks/useConfig';\n\nexport function HeaderContainer() {\n const [isActive, setIsActive] = useState(true);\n const headerRef = useRef(null);\n const config = useConfig();\n\n useEffect(() => {\n if (headerRef.current.children.length === 0) {\n setIsActive(false);\n }\n }, [headerRef]);\n\n if (isActive) {\n return (\n <div\n ref={headerRef}\n className={classJoin(className('head'), config.className.header)}\n style={{ ...config.style.header }}\n >\n <PluginRenderer position={PluginPosition.Header} />\n </div>\n );\n }\n\n return null;\n}\n","import { h } from 'preact';\nimport { classJoin, className } from '../util/className';\nimport { PluginPosition, PluginRenderer } from '../plugin';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../hooks/useConfig';\n\nexport function FooterContainer() {\n const footerRef = useRef(null);\n const [isActive, setIsActive] = useState(true);\n const config = useConfig();\n\n useEffect(() => {\n if (footerRef.current.children.length === 0) {\n setIsActive(false);\n }\n }, [footerRef]);\n\n if (isActive) {\n return (\n <div\n ref={footerRef}\n className={classJoin(className('footer'), config.className.footer)}\n style={{ ...config.style.footer }}\n >\n <PluginRenderer position={PluginPosition.Footer} />\n </div>\n );\n }\n\n return null;\n}\n","import { createRef, h } from 'preact';\nimport { classJoin, className } from '../util/className';\nimport { Status } from '../types';\nimport { Table } from './table/table';\nimport { HeaderContainer } from './headerContainer';\nimport { FooterContainer } from './footerContainer';\nimport log from '../util/log';\nimport { useEffect } from 'preact/hooks';\nimport * as actions from './actions';\nimport { useStore } from '../hooks/useStore';\nimport useSelector from '../hooks/useSelector';\nimport { useConfig } from '../hooks/useConfig';\nimport { throttle } from '../util/throttle';\n\nexport function Container() {\n const config = useConfig();\n const { dispatch } = useStore();\n const status = useSelector((state) => state.status);\n const data = useSelector((state) => state.data);\n const tableRef = useSelector((state) => state.tableRef);\n const tempRef = createRef();\n\n const processPipeline = throttle(async () => {\n dispatch(actions.SetLoadingData());\n\n try {\n const data = await config.pipeline.process();\n dispatch(actions.SetData(data));\n\n // TODO: do we need this setTimemout?\n setTimeout(() => {\n dispatch(actions.SetStatusToRendered());\n }, 0);\n } catch (e) {\n log.error(e);\n dispatch(actions.SetDataErrored());\n }\n }, config.processingThrottleMs);\n\n useEffect(() => {\n // set the initial header object\n // we update the header width later when \"data\"\n // is available in the state\n dispatch(actions.SetHeader(config.header));\n\n processPipeline();\n config.pipeline.on('updated', processPipeline);\n\n return () => config.pipeline.off('updated', processPipeline);\n }, []);\n\n useEffect(() => {\n if (config.header && status === Status.Loaded && data?.length) {\n // now that we have the data, let's adjust columns width\n // NOTE: that we only calculate the columns width once\n dispatch(\n actions.SetHeader(config.header.adjustWidth(config, tableRef, tempRef)),\n );\n }\n }, [data, config, tempRef]);\n\n return (\n <div\n role=\"complementary\"\n className={classJoin(\n 'gridjs',\n className('container'),\n status === Status.Loading ? className('loading') : null,\n config.className.container,\n )}\n style={{\n ...config.style.container,\n ...{\n width: config.width,\n },\n }}\n >\n {status === Status.Loading && (\n <div className={className('loading-bar')} />\n )}\n\n <HeaderContainer />\n\n <div className={className('wrapper')} style={{ height: config.height }}>\n <Table />\n </div>\n\n <FooterContainer />\n\n <div ref={tempRef} id=\"gridjs-temp\" className={className('temp')} />\n </div>\n );\n}\n","import { Config } from './config';\nimport { h, render, VNode } from 'preact';\nimport { Container } from './view/container';\nimport log from './util/log';\nimport { EventEmitter } from './util/eventEmitter';\nimport { GridEvents } from './events';\nimport { PluginManager } from './plugin';\nimport { ConfigContext } from './config';\n\nclass Grid extends EventEmitter<GridEvents> {\n public config: Config;\n public plugin: PluginManager;\n\n constructor(config?: Partial<Config>) {\n super();\n this.config = new Config()\n .assign({ instance: this, eventEmitter: this })\n .update(config);\n this.plugin = this.config.plugin;\n }\n\n public updateConfig(config: Partial<Config>): this {\n this.config.update(config);\n return this;\n }\n\n createElement(): VNode {\n return h(ConfigContext.Provider, {\n value: this.config,\n children: h(Container, {}),\n });\n }\n\n /**\n * Uses the existing container and tries to clear the cache\n * and re-render the existing Grid.js instance again. This is\n * useful when a new config is set/updated.\n *\n */\n forceRender(): this {\n if (!this.config || !this.config.container) {\n log.error(\n 'Container is empty. Make sure you call render() before forceRender()',\n true,\n );\n }\n\n this.destroy();\n\n // recreate the Grid instance\n render(this.createElement(), this.config.container);\n\n return this;\n }\n\n /**\n * Deletes the Grid.js instance\n */\n destroy(): void {\n this.config.pipeline.clearCache();\n // TODO: not sure if it's a good idea to render a null element but I couldn't find a better way\n render(null, this.config.container);\n }\n\n /**\n * Mounts the Grid.js instance to the container\n * and renders the instance\n *\n * @param container\n */\n render(container: Element): this {\n if (!container) {\n log.error('Container element cannot be null', true);\n }\n\n if (container.childNodes.length > 0) {\n log.error(\n `The container element ${container} is not empty. Make sure the container is empty and call render() again`,\n );\n return this;\n }\n\n this.config.container = container;\n render(this.createElement(), container);\n\n return this;\n }\n}\n\nexport default Grid;\n"],"names":["Status","n","l","u","i","t","o","r","f","e","c","s","a","parentNode","removeChild","h","arguments","length","children","call","defaultProps","v","type","props","key","ref","__k","__","__b","__e","__d","__c","__h","constructor","__v","vnode","p","d","this","context","_","indexOf","k","base","b","push","g","__r","debounceRendering","setTimeout","sort","some","__P","j","__n","ownerSVGElement","z","w","y","x","C","Array","isArray","m","A","N","M","appendChild","nextSibling","insertBefore","$","setProperty","test","H","style","cssText","replace","toLowerCase","slice","addEventListener","T","I","removeEventListener","removeAttribute","setAttribute","event","contextType","value","__E","prototype","render","O","sub","state","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","L","diffed","localName","nodeType","document","createTextNode","createElementNS","createElement","is","data","childNodes","dangerouslySetInnerHTML","attributes","name","__html","innerHTML","checked","current","unmount","componentWillUnmount","P","firstChild","Math","random","toString","getDerivedStateFromError","setState","componentDidCatch","forceUpdate","Base","id","_id","generateUUID","_createClass","HTMLElement","parentElement","content","html","ProcessorType","_Base","Cell","_this","update","_inheritsLoose","_proto","cast","outerHTML","Row","cells","_cells","cell","index","toArray","map","fromCells","get","set","Tabular","rows","_rows","_length","row","fromRows","fromArray","oneDtoTwoD","len","EventEmitter","callbacks","init","listeners","on","listener","off","eventName","filter","emit","_arguments","apply","deepEqual","obj1","obj2","hasOwnProperty","keys1","Object","keys","keys2","_i","_keys","PipelineProcessor","_EventEmitter","_props","setProps","process","args","validateProps","_process","concat","updatedProps","_extends","GlobalSearchFilter","keyword","String","trim","columns","ignoreHiddenColumns","tabular","selector","rowIndex","cellIndex","hidden","element","Filter","className","prefix","reduce","prev","cur","ServerGlobalSearchFilter","options","updates","url","body","ServerFilter","__H","__V","B","__N","every","F","shift","requestAnimationFrame","clearTimeout","cancelAnimationFrame","useContext","ConfigContext","enUS","search","placeholder","sortAsc","sortDesc","pagination","previous","next","navigate","page","pages","showing","of","to","results","loading","noRecordsFound","error","Translator","language","_language","_defaultLanguage","getString","message","lang","splitted","split","val","join","translate","messageFormat","translated","useTranslator","config","useConfig","_config$translator","translator","payload","store","useSelector","useStore","_useState","useState","getState","setCurrent","useEffect","subscribe","updated","Search","_config$className","undefined","processor","setProcessor","dispatch","server","header","actions","pipeline","register","unregister","func","waitFor","timeout","debouncedOnInput","useCallback","target","HTMLInputElement","debounceTimeout","resolve","classJoin","onInput","defaultValue","PaginationLimit","isNaN","Number","limit","Error","Limit","ServerPaginationLimit","ServerLimit","Pagination","_config$pagination","summary","_config$pagination$su","_config$pagination$ne","nextButton","_config$pagination$pr","prevButton","_config$pagination$bu","buttonsCount","_config$pagination$li","_config$pagination$pa","_config$pagination$re","resetPageOnUpdate","useRef","currentPage","setCurrentPage","total","setTotal","_useState2","onUpdate","updatedProcessor","ceil","setPage","Fragment","role","paginationSummary","title","min","tabIndex","disabled","onClick","paginationButton","paginationButtonPrev","maxCount","pagePivot","floor","from","paginationButtonCurrent","renderPages","paginationButtonNext","width","containerWidth","parseInt","px","ShadowTable","shadowTable","tableRef","cloneNode","position","zIndex","visibility","nodeElement","camelCase","str","words","word","charAt","toUpperCase","PluginPosition","log","Logger","format","throwException","msg","console","warn","info","exports","PluginManager","plugins","find","add","plugin","remove","splice","list","order","PluginRenderer","pluginId","component","Header","_columns","adjustWidth","tempRef","container","autoWidth","clientWidth","widths","getShadowTableWidths","querySelector","tableElement","tableClassName","tableStyle","tableLayout","padding","margin","border","outline","querySelectorAll","getAttribute","minWidth","obj","_step","_iterator","_createForOfIteratorHelperLoose","tabularFormat","done","column","setSort","sortConfig","cols","_step2","setResizable","resizable","_step3","_iterator3","setID","_step4","_iterator4","logger","populatePlugins","pluginManager","_step5","_iterator5","fromColumns","_step6","_iterator6","isValidElement","typedColumn","createFromConfig","fromHTMLTable","_step7","_iterator7","th","result","_step8","_iterator8","col","nextRow","leafColumns","_step9","_iterator9","maximumDepth","Storage","MemoryStorage","_Storage","Promise","reject","ServerStorage","handler","response","handle","ok","json","status","statusText","opts","fetch","then","bind","res","StorageUtils","storage","tableElementToArray","display","arr","parsedRow","_iterator2","Node","TEXT_NODE","DOMParser","parseFromString","documentElement","textContent","pact","_settle","observer","_Pact","onFulfilled","onRejected","callback","_isSettledPact","thenable","Pipeline","steps","_steps","cache","Map","lastProcessorIndexUpdated","step","clearCache","priority","findProcessorIndexByID","processorPropsUpdated","addProcessorByPriority","afterRegistered","tryRegister","subSteps","proc","newSubStep","second","first","getStepsByType","getSortedProcessorTypes","_temp3","_result","_this2","_temp2","array","check","_cycle","processorIndex","_processor$process","_catch","processorID","findIndex","setLastProcessorIndex","StorageExtractor","Extractor","arrayResponse","ArrayToTabularTransformer","Transformer","ServerInitiator","_PipelineProcessor","entries","serverStorageOptions","_ref","acc","_extends2","Initiator","StorageResponseToArrayTransformer","castData","pad","storageResponse","PipelineUtils","initialState","isDispatching","getListeners","reducer","prevState","lis","Consumer","Provider","createContext","Config","assign","defaultConfig","partialConfig","fromPartialConfig","Store","Init","height","processingThrottleMs","multiColumn","Footer","TD","colSpan","td","messageCell","eventEmitter","formatter","TR","tr","messageRow","getColumn","MessageRow","TBody","headerLength","visibleColumns","tbody","Loading","Rendered","notfound","NativeSort","condition","direction","compare","cellA","cellB","compareWrapper","cmp","sortedRows","sorted","Sort","multi","_state$sort","reset","count","_index2","SortToggle","SortColumn","ServerSort","setDirection","processorType","getSortProcessor","processors","currentColumn","_props$direction","getSortClassName","preventDefault","stopPropagation","shiftKey","throttle","fn","wait","timeoutId","lastTime","Date","now","execute","currentTime","elapsed","Resize","getPageX","MouseEvent","pageX","changedTouches","start","offsetStart","thRef","moveFn","move","end","thElement","onMouseDown","onTouchStart","TH","setStyle","fixedHeader","offsetTop","top","isSortable","SortActions","onKeyDown","which","rowSpan","THead","thead","renderRow","totalRows","columnIndex","calculateRowColSpans","depth","remainingRows","_calculateRowColSpans","renderColumn","SetHeader","Table","table","HeaderContainer","isActive","setIsActive","headerRef","FooterContainer","footerRef","footer","Container","processPipeline","Loaded","_temp","Grid","instance","_assertThisInitialized","updateConfig","forceRender","destroy"],"mappings":"knEAiECA,GAND,SAAYA,GACVA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,SAAA,GAAA,WACAA,EAAAA,EAAA,MAAA,GAAA,OACD,CAND,CAAYA,IAAAA,EAMX,CAAA,ICjED,IAAIC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,EAAE,CAAE,EAACC,EAAE,GAAGC,EAAE,oEAAoE,SAASC,EAAEV,EAAEC,GAAG,IAAI,IAAIC,KAAKD,EAAED,EAAEE,GAAGD,EAAEC,GAAG,OAAOF,CAAC,CAAC,SAASW,EAAEX,GAAG,IAAIC,EAAED,EAAEY,WAAWX,GAAGA,EAAEY,YAAYb,EAAE,CAAC,SAASc,EAAEb,EAAEC,EAAEC,GAAG,IAAIC,EAAEC,EAAEC,EAAEC,EAAE,CAAE,EAAC,IAAID,KAAKJ,EAAE,OAAOI,EAAEF,EAAEF,EAAEI,GAAG,OAAOA,EAAED,EAAEH,EAAEI,GAAGC,EAAED,GAAGJ,EAAEI,GAAG,GAAGS,UAAUC,OAAO,IAAIT,EAAEU,SAASF,UAAUC,OAAO,EAAEhB,EAAEkB,K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