1 line
186 KiB
Plaintext
1 line
186 KiB
Plaintext
{"version":3,"file":"gridjs.mjs","sources":["../src/types.ts","../node_modules/preact/dist/preact.module.js","../src/pipeline/processor.ts","../src/util/id.ts","../src/base.ts","../src/view/htmlElement.tsx","../src/util/html.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/util/log.ts","../src/plugin.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","// 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","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","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","/**\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 { 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","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","ProcessorType","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","y","current","p","d","this","context","_","indexOf","k","base","b","push","g","__r","debounceRendering","setTimeout","sort","some","__P","j","__n","ownerSVGElement","z","w","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","unmount","componentWillUnmount","P","firstChild","Math","random","toString","getDerivedStateFromError","setState","componentDidCatch","forceUpdate","Base","id","_id","generateUUID","HTMLElement","parentElement","content","html","Cell","super","update","cast","outerHTML","Row","cells","_cells","cell","index","toArray","map","static","Tabular","rows","_rows","_length","len","row","fromCells","oneDtoTwoD","callbacks","init","listeners","on","listener","off","eventName","filter","emit","args","deepEqual","obj1","obj2","hasOwnProperty","keys1","Object","keys","keys2","EventEmitter","_props","setProps","process","validateProps","Function","_process","result","updatedProps","_extends","GlobalSearchFilter","PipelineProcessor","Filter","keyword","String","trim","columns","ignoreHiddenColumns","tabular","selector","rowIndex","cellIndex","hidden","element","className","reduce","prev","cur","classNames","ServerGlobalSearchFilter","ServerFilter","options","updates","url","body","__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","useTranslator","config","useConfig","translator","SearchKeyword","payload","store","useSelector","useStore","setCurrent","useState","getState","useEffect","subscribe","updated","Search","_config$className","processor","setProcessor","undefined","dispatch","server","header","actions","pipeline","register","unregister","debouncedOnInput","useCallback","func","waitFor","timeout","resolve","target","HTMLInputElement","debounce","debounceTimeout","classJoin","onInput","defaultValue","PaginationLimit","isNaN","Number","limit","Error","Limit","ServerPaginationLimit","ServerLimit","Pagination","summary","nextButton","prevButton","buttonsCount","resetPageOnUpdate","useRef","currentPage","setCurrentPage","total","setTotal","onUpdate","updatedProcessor","ceil","setPage","Fragment","role","paginationSummary","title","min","tabIndex","disabled","onClick","paginationButton","paginationButtonPrev","maxCount","floor","pagePivot","from","paginationButtonCurrent","renderPages","paginationButtonNext","width","containerWidth","parseInt","px","ShadowTable","shadowTable","tableRef","cloneNode","position","zIndex","visibility","nodeElement","camelCase","str","words","word","charAt","toUpperCase","PluginPosition","log","format","throwException","msg","console","warn","info","plugins","get","find","add","plugin","remove","splice","list","order","PluginRenderer","pluginId","component","_columns","visibleColumns","adjustWidth","tempRef","container","autoWidth","clientWidth","widths","tableElement","querySelector","tableClassName","tableStyle","tableLayout","padding","margin","border","outline","obj","querySelectorAll","getAttribute","minWidth","getShadowTableWidths","column","Header","tabularFormat","concat","setSort","sortConfig","cols","setResizable","resizable","setID","logger","populatePlugins","pluginManager","isValidElement","typedColumn","fromColumns","fromHTMLTable","ths","th","nextRow","col","leafColumns","Storage","MemoryStorage","set","async","ServerStorage","handler","response","handle","ok","json","status","statusText","opts","fetch","then","bind","res","StorageUtils","storage","tableElementToArray","display","arr","parsedRow","Node","TEXT_NODE","DOMParser","parseFromString","documentElement","textContent","decode","Pipeline","steps","_steps","cache","Map","lastProcessorIndexUpdated","step","clearCache","priority","findProcessorIndexByID","processorPropsUpdated","addProcessorByPriority","afterRegistered","tryRegister","subSteps","proc","newSubStep","first","second","getSortedProcessorTypes","getStepsByType","processorID","findIndex","setLastProcessorIndex","processorIndex","StorageExtractor","Extractor","Transformer","arrayResponse","fromArray","ServerInitiator","Initiator","entries","serverStorageOptions","acc","StorageResponseToArrayTransformer","castData","pad","storageResponse","PipelineUtils","ArrayToTabularTransformer","Store","initialState","isDispatching","getListeners","reducer","prevState","lis","Consumer","Provider","createContext","Config","assign","defaultConfig","partialConfig","fromPartialConfig","Init","PluginManager","height","processingThrottleMs","multiColumn","createFromConfig","Footer","TD","colSpan","td","messageCell","eventEmitter","formatter","tr","messageRow","getColumn","MessageRow","TR","TBody","tbody","Loading","headerLength","Rendered","notfound","NativeSort","condition","direction","Sort","compare","cellA","cellB","compareWrapper","cmp","sortedRows","sorted","multi","_state$sort","reset","count","SortToggle","SortColumn","ServerSort","setDirection","processorType","getSortProcessor","processors","currentColumn","_props$direction","getSortClassName","preventDefault","stopPropagation","shiftKey","throttle","fn","wait","lastTime","Date","now","execute","elapsed","timeoutId","Resize","moveFn","getPageX","MouseEvent","pageX","changedTouches","start","offsetStart","thRef","move","end","thElement","onMouseDown","onTouchStart","TH","setStyle","fixedHeader","offsetTop","top","isSortable","SortActions","onKeyDown","which","rowSpan","getCustomAttributes","THead","thead","totalRows","columnIndex","calculateRowColSpans","depth","maximumDepth","remainingRows","renderColumn","renderRow","renderRows","SetStatusToRendered","SetHeader","Table","table","HeaderContainer","isActive","setIsActive","headerRef","FooterContainer","footerRef","footer","processPipeline","Loaded","Grid","instance","updateConfig","Container","forceRender","destroy"],"mappings":"wOAiECA,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,ECgBfC,EDhBiBC,EAAE,CAAE,EAACC,EAAE,GAAGC,EAAE,oEAAoE,SAASC,EAAEX,EAAEC,GAAG,IAAI,IAAIC,KAAKD,EAAED,EAAEE,GAAGD,EAAEC,GAAG,OAAOF,CAAC,CAAC,SAASY,EAAEZ,GAAG,IAAIC,EAAED,EAAEa,WAAWZ,GAAGA,EAAEa,YAAYd,EAAE,CAAC,SAASe,EAAEd,EAAEC,EAAEC,GAAG,IAAIC,EAAEC,EAAEC,EAAEE,EAAE,CAAE,EAAC,IAAIF,KAAKJ,EAAE,OAAOI,EAAEF,EAAEF,EAAEI,GAAG,OAAOA,EAAED,EAAEH,EAAEI,GAAGE,EAAEF,GAAGJ,EAAEI,GAAG,GAAGU,UAAUC,OAAO,IAAIT,EAAEU,SAASF,UAAUC,OAAO,EAAEjB,EAAEmB,KAAKH,UAAU,GAAGb,GAAG,mBAAmBF,GAAG,MAAMA,EAAEmB,aAAa,IAAId,KAAKL,EAAEmB,kBAAa,IAASZ,EAAEF,KAAKE,EAAEF,GAAGL,EAAEmB,aAAad,IAAI,OAAOe,EAAEpB,EAAEO,EAAEJ,EAAEC,EAAE,KAAK,CAAC,SAASgB,EAAErB,EAAEG,EAAEC,EAAEC,EAAEC,GAAG,IAAIE,EAAE,CAACc,KAAKtB,EAAEuB,MAAMpB,EAAEqB,IAAIpB,EAAEqB,IAAIpB,EAAEqB,IAAI,KAAKC,GAAG,KAAKC,IAAI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