@simple-table/react 3.0.2 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,4 +33,4 @@ npm install @simple-table/react
33
33
 
34
34
  ## License
35
35
 
36
- Dual licensed — MIT for individuals & startups, proprietary Pro tier for revenue-generating companies. See [LICENSE](LICENSE) and [EULA.txt](../../EULA.txt) for details.
36
+ Dual licensed — MIT for zero-revenue individuals and startups; Pro and Enterprise (commercial EULA) for revenue-generating companies. See [LICENSE](LICENSE), [EULA.txt](../../EULA.txt), and [pricing](https://www.simple-table.com/pricing).
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("simple-table-core"),n=require("react-dom"),o=require("react-dom/client"),c=require("react-dom/server");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function i({node:r}){const n=t.useRef(null);return t.useLayoutEffect(()=>{const e=n.current;if(e)return e.appendChild(r),()=>{r.parentNode===e&&e.removeChild(r)}},[r]),e.jsx("span",{ref:n,style:{display:"contents"}})}function a(t){if(null!=t)return"string"==typeof t?t:t instanceof Node?e.jsx(i,{node:t}):void 0}function d(e,t){queueMicrotask(()=>{n.flushSync(()=>{e.render(t)})})}function l(t){return r=>{const n=document.createElement("div");return d(o.createRoot(n),e.jsx(t,Object.assign({},r))),n}}function f(t){return r=>{const n=document.createElement("div"),c=o.createRoot(n),s=Object.assign(Object.assign({},r),{searchSection:r.searchSection?a(r.searchSection):null,listSection:a(r.listSection),resetSection:r.resetSection?a(r.resetSection):null});return d(c,e.jsx(t,Object.assign({},s))),n}}function p(t){const r=document.createElement("div");return r.innerHTML=c.renderToStaticMarkup(e.jsx(e.Fragment,{children:t})),function(e){const t=Array.from(e.childNodes).filter(e=>e.nodeType!==Node.TEXT_NODE||null!=e.textContent&&""!==e.textContent.trim());return 1===t.length&&t[0]instanceof HTMLElement?(e.removeChild(t[0]),t[0]):e}(r)}function m(t){return c.renderToStaticMarkup(e.jsx(e.Fragment,{children:t}))}function b(e){return"function"==typeof e}function R(t){const{cellRenderer:r,headerRenderer:n,children:c,nestedTable:s}=t,i=u(t,["cellRenderer","headerRenderer","children","nestedTable"]),a=Object.assign({},i);var f;if(r&&(a.cellRenderer=(f=r,t=>{const r=document.createElement("div");return r.style.display="contents",d(o.createRoot(r),e.jsx(f,Object.assign({},t))),r})),n&&(a.headerRenderer=l(n)),c&&(a.children=c.map(R)),s){const e=Object.assign(Object.assign({},s),{rows:[]});a.nestedTable=y(e)}return a}function y(t){const{defaultHeaders:r,rows:n,footerRenderer:c,emptyStateRenderer:s,errorStateRenderer:i,loadingStateRenderer:y,tableEmptyStateRenderer:j,headerDropdown:g,columnEditorConfig:S,icons:O}=t,v=u(t,["defaultHeaders","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),h=Object.assign(Object.assign({},v),{rows:n,defaultHeaders:r.map(R)});if(void 0!==c&&(h.footerRenderer=l(c)),void 0!==s)if(b(s))h.emptyStateRenderer=l(s);else{const e=s;h.emptyStateRenderer=()=>p(e)}if(void 0!==i)if(b(i))h.errorStateRenderer=l(i);else{const e=i;h.errorStateRenderer=()=>p(e)}if(void 0!==y)if(b(y))h.loadingStateRenderer=l(y);else{const e=y;h.loadingStateRenderer=()=>p(e)}return void 0!==j&&(h.tableEmptyStateRenderer=null===j?null:p(j)),void 0!==g&&(h.headerDropdown=l(g)),void 0!==S&&(h.columnEditorConfig=function(t){const{rowRenderer:r,customRenderer:n}=t,c=u(t,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},c),r?{rowRenderer:(s=r,t=>{const r=document.createElement("div"),n=o.createRoot(r),c=Object.assign(Object.assign({},t),{components:(u=t.components,{expandIcon:a(u.expandIcon),checkbox:a(u.checkbox),dragIcon:a(u.dragIcon),labelContent:a(u.labelContent),pinIcon:a(u.pinIcon)})});var u;return d(n,e.jsx(s,Object.assign({},c))),r})}:{}),n?{customRenderer:f(n)}:{});var s}(S)),void 0!==O&&(h.icons=function(e){const t={};for(const[r,n]of Object.entries(e))null!=n&&(t[r]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGElement?n:m(n));return t}(O)),h}"function"==typeof SuppressedError&&SuppressedError;const j=s(t).default.forwardRef(function(n,o){const c=t.useRef(null),s=t.useRef(null),i=t.useRef(void 0),a=t.useRef(null),d=n;return t.useLayoutEffect(()=>{if(!c.current)return;let e=!1;return queueMicrotask(()=>{if(e||!c.current)return;const t=new r.SimpleTableVanilla(c.current,y(d));if(t.mount(),s.current=t,o){const e=t.getAPI();"function"==typeof o?o(e):o.current=e}}),()=>{e=!0;const t=s.current;t&&(t.destroy(),s.current=null,i.current=void 0,a.current=null,o&&"function"!=typeof o&&(o.current=null))}},[]),t.useLayoutEffect(()=>{const e=s.current;if(!e)return;if(null!==a.current&&!function(e,t){const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const n of r)if(e[n]!==t[n])return!0;return!1}(a.current,d))return;a.current=d;const t=y(d);queueMicrotask(()=>{if(s.current!==e)return;if(i.current!==d.defaultHeaders)return i.current=d.defaultHeaders,void e.update(t);const r=u(t,["defaultHeaders"]);e.update(r)})},[d]),e.jsx("div",{ref:c})});j.displayName="SimpleTable",Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return r.asRows}}),exports.SimpleTable=j,exports.defaultHeaderFromCore=function(e){return e},exports.defaultHeadersFromCore=function(e){return e},exports.mapToReactHeaderObjects=function(e){return e};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("simple-table-core"),r=require("react-dom"),o=require("react-dom/client"),c=require("react-dom/server");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function i(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function u({node:t}){const r=n.useRef(null);return n.useLayoutEffect(()=>{const e=r.current;if(e)return e.appendChild(t),()=>{t.parentNode===e&&e.removeChild(t)}},[t]),e.jsx("span",{ref:r,style:{display:"contents"}})}function a(n){if(null!=n)return"string"==typeof n?n:n instanceof Node?e.jsx(u,{node:n}):void 0}function d(e,n){queueMicrotask(()=>{r.flushSync(()=>{e.render(n)})})}function l(n){return t=>{const r=document.createElement("div");return d(o.createRoot(r),e.jsx(n,Object.assign({},t))),r}}function f(n){return t=>{const r=document.createElement("div"),c=o.createRoot(r),s=Object.assign(Object.assign({},t),{searchSection:t.searchSection?a(t.searchSection):null,listSection:a(t.listSection),resetSection:t.resetSection?a(t.resetSection):null});return d(c,e.jsx(n,Object.assign({},s))),r}}function p(n){const t=document.createElement("div");return t.innerHTML=c.renderToStaticMarkup(e.jsx(e.Fragment,{children:n})),function(e){const n=Array.from(e.childNodes).filter(e=>e.nodeType!==Node.TEXT_NODE||null!=e.textContent&&""!==e.textContent.trim());return 1===n.length&&n[0]instanceof HTMLElement?(e.removeChild(n[0]),n[0]):e}(t)}function m(n){return c.renderToStaticMarkup(e.jsx(e.Fragment,{children:n}))}function b(e){return"function"==typeof e}function g(n){const{cellRenderer:t,headerRenderer:r,children:c,nestedTable:s}=n,u=i(n,["cellRenderer","headerRenderer","children","nestedTable"]),a=Object.assign({},u);var f;if(t&&(a.cellRenderer=(f=t,n=>{const t=document.createElement("div");return t.style.display="contents",d(o.createRoot(t),e.jsx(f,Object.assign({},n))),t})),r&&(a.headerRenderer=l(r)),c&&(a.children=c.map(g)),s){const e=Object.assign(Object.assign({},s),{rows:[]});a.nestedTable=R(e)}return a}function R(n){const{defaultHeaders:t,rows:r,footerRenderer:c,emptyStateRenderer:s,errorStateRenderer:u,loadingStateRenderer:R,tableEmptyStateRenderer:j,headerDropdown:y,columnEditorConfig:O,icons:S,onColumnOrderChange:h,onColumnWidthChange:v,onHeaderEdit:C,onColumnSelect:E}=n,x=i(n,["defaultHeaders","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons","onColumnOrderChange","onColumnWidthChange","onHeaderEdit","onColumnSelect"]),w=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},x),{rows:r,defaultHeaders:t.map(g)}),h?{onColumnOrderChange:e=>h(e)}:{}),v?{onColumnWidthChange:e=>v(e)}:{}),C?{onHeaderEdit:(e,n)=>C(e,n)}:{}),E?{onColumnSelect:e=>E(e)}:{});if(void 0!==c&&(w.footerRenderer=l(c)),void 0!==s)if(b(s))w.emptyStateRenderer=l(s);else{const e=s;w.emptyStateRenderer=()=>p(e)}if(void 0!==u)if(b(u))w.errorStateRenderer=l(u);else{const e=u;w.errorStateRenderer=()=>p(e)}if(void 0!==R)if(b(R))w.loadingStateRenderer=l(R);else{const e=R;w.loadingStateRenderer=()=>p(e)}return void 0!==j&&(w.tableEmptyStateRenderer=null===j?null:p(j)),void 0!==y&&(w.headerDropdown=l(y)),void 0!==O&&(w.columnEditorConfig=function(n){const{rowRenderer:t,customRenderer:r}=n,c=i(n,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},c),t?{rowRenderer:(s=t,n=>{const t=document.createElement("div"),r=o.createRoot(t),c=Object.assign(Object.assign({},n),{components:(i=n.components,{expandIcon:a(i.expandIcon),checkbox:a(i.checkbox),dragIcon:a(i.dragIcon),labelContent:a(i.labelContent),pinIcon:a(i.pinIcon)})});var i;return d(r,e.jsx(s,Object.assign({},c))),t})}:{}),r?{customRenderer:f(r)}:{});var s}(O)),void 0!==S&&(w.icons=function(e){const n={};for(const[t,r]of Object.entries(e))null!=r&&(n[t]="string"==typeof r||r instanceof HTMLElement||r instanceof SVGElement?r:m(r));return n}(S)),w}"function"==typeof SuppressedError&&SuppressedError;const j=s(n).default.forwardRef(function(r,o){const c=n.useRef(null),s=n.useRef(null),u=n.useRef(void 0),a=n.useRef(null),d=r;return n.useLayoutEffect(()=>{if(!c.current)return;let e=!1;return queueMicrotask(()=>{if(e||!c.current)return;const n=new t.SimpleTableVanilla(c.current,R(d));if(n.mount(),s.current=n,o){const e=n.getAPI();"function"==typeof o?o(e):o.current=e}}),()=>{e=!0;const n=s.current;n&&(n.destroy(),s.current=null,u.current=void 0,a.current=null,o&&"function"!=typeof o&&(o.current=null))}},[]),n.useLayoutEffect(()=>{const e=s.current;if(!e)return;if(null!==a.current&&!function(e,n){const t=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of t)if(e[r]!==n[r])return!0;return!1}(a.current,d))return;a.current=d;const n=R(d);queueMicrotask(()=>{if(s.current!==e)return;if(u.current!==d.defaultHeaders)return u.current=d.defaultHeaders,void e.update(n);const t=i(n,["defaultHeaders"]);e.update(t)})},[d]),e.jsx("div",{ref:c})});j.displayName="SimpleTable",Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return t.asRows}}),exports.SimpleTable=j;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as r}from"react/jsx-runtime";import n,{useRef as t,useLayoutEffect as o}from"react";import{SimpleTableVanilla as c}from"simple-table-core";export{asRows}from"simple-table-core";import{flushSync as i}from"react-dom";import{createRoot as s}from"react-dom/client";import{renderToStaticMarkup as d}from"react-dom/server";function u(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}function a({node:r}){const n=t(null);return o(()=>{const e=n.current;if(e)return e.appendChild(r),()=>{r.parentNode===e&&e.removeChild(r)}},[r]),e("span",{ref:n,style:{display:"contents"}})}function l(r){if(null!=r)return"string"==typeof r?r:r instanceof Node?e(a,{node:r}):void 0}function f(e,r){queueMicrotask(()=>{i(()=>{e.render(r)})})}function m(r){return n=>{const t=document.createElement("div");return f(s(t),e(r,Object.assign({},n))),t}}function p(r){return n=>{const t=document.createElement("div"),o=s(t),c=Object.assign(Object.assign({},n),{searchSection:n.searchSection?l(n.searchSection):null,listSection:l(n.listSection),resetSection:n.resetSection?l(n.resetSection):null});return f(o,e(r,Object.assign({},c))),t}}function b(n){const t=document.createElement("div");return t.innerHTML=d(e(r,{children:n})),function(e){const r=Array.from(e.childNodes).filter(e=>e.nodeType!==Node.TEXT_NODE||null!=e.textContent&&""!==e.textContent.trim());return 1===r.length&&r[0]instanceof HTMLElement?(e.removeChild(r[0]),r[0]):e}(t)}function g(n){return d(e(r,{children:n}))}function y(e){return"function"==typeof e}function R(r){const{cellRenderer:n,headerRenderer:t,children:o,nestedTable:c}=r,i=u(r,["cellRenderer","headerRenderer","children","nestedTable"]),d=Object.assign({},i);var a;if(n&&(d.cellRenderer=(a=n,r=>{const n=document.createElement("div");return n.style.display="contents",f(s(n),e(a,Object.assign({},r))),n})),t&&(d.headerRenderer=m(t)),o&&(d.children=o.map(R)),c){const e=Object.assign(Object.assign({},c),{rows:[]});d.nestedTable=S(e)}return d}function S(r){const{defaultHeaders:n,rows:t,footerRenderer:o,emptyStateRenderer:c,errorStateRenderer:i,loadingStateRenderer:d,tableEmptyStateRenderer:a,headerDropdown:S,columnEditorConfig:O,icons:v}=r,j=u(r,["defaultHeaders","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),h=Object.assign(Object.assign({},j),{rows:t,defaultHeaders:n.map(R)});if(void 0!==o&&(h.footerRenderer=m(o)),void 0!==c)if(y(c))h.emptyStateRenderer=m(c);else{const e=c;h.emptyStateRenderer=()=>b(e)}if(void 0!==i)if(y(i))h.errorStateRenderer=m(i);else{const e=i;h.errorStateRenderer=()=>b(e)}if(void 0!==d)if(y(d))h.loadingStateRenderer=m(d);else{const e=d;h.loadingStateRenderer=()=>b(e)}return void 0!==a&&(h.tableEmptyStateRenderer=null===a?null:b(a)),void 0!==S&&(h.headerDropdown=m(S)),void 0!==O&&(h.columnEditorConfig=function(r){const{rowRenderer:n,customRenderer:t}=r,o=u(r,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},o),n?{rowRenderer:(c=n,r=>{const n=document.createElement("div"),t=s(n),o=Object.assign(Object.assign({},r),{components:(i=r.components,{expandIcon:l(i.expandIcon),checkbox:l(i.checkbox),dragIcon:l(i.dragIcon),labelContent:l(i.labelContent),pinIcon:l(i.pinIcon)})});var i;return f(t,e(c,Object.assign({},o))),n})}:{}),t?{customRenderer:p(t)}:{});var c}(O)),void 0!==v&&(h.icons=function(e){const r={};for(const[n,t]of Object.entries(e))null!=t&&(r[n]="string"==typeof t||t instanceof HTMLElement||t instanceof SVGElement?t:g(t));return r}(v)),h}"function"==typeof SuppressedError&&SuppressedError;const O=n.forwardRef(function(r,n){const i=t(null),s=t(null),d=t(void 0),a=t(null),l=r;return o(()=>{if(!i.current)return;let e=!1;return queueMicrotask(()=>{if(e||!i.current)return;const r=new c(i.current,S(l));if(r.mount(),s.current=r,n){const e=r.getAPI();"function"==typeof n?n(e):n.current=e}}),()=>{e=!0;const r=s.current;r&&(r.destroy(),s.current=null,d.current=void 0,a.current=null,n&&"function"!=typeof n&&(n.current=null))}},[]),o(()=>{const e=s.current;if(!e)return;if(null!==a.current&&!function(e,r){const n=new Set([...Object.keys(e),...Object.keys(r)]);for(const t of n)if(e[t]!==r[t])return!0;return!1}(a.current,l))return;a.current=l;const r=S(l);queueMicrotask(()=>{if(s.current!==e)return;if(d.current!==l.defaultHeaders)return d.current=l.defaultHeaders,void e.update(r);const n=u(r,["defaultHeaders"]);e.update(n)})},[l]),e("div",{ref:i})});function v(e){return e}function j(e){return e}function h(e){return e}O.displayName="SimpleTable";export{O as SimpleTable,v as defaultHeaderFromCore,j as defaultHeadersFromCore,h as mapToReactHeaderObjects};
1
+ import{jsx as e,Fragment as n}from"react/jsx-runtime";import r,{useRef as t,useLayoutEffect as o}from"react";import{SimpleTableVanilla as c}from"simple-table-core";export{asRows}from"simple-table-core";import{flushSync as i}from"react-dom";import{createRoot as s}from"react-dom/client";import{renderToStaticMarkup as d}from"react-dom/server";function a(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}function u({node:n}){const r=t(null);return o(()=>{const e=r.current;if(e)return e.appendChild(n),()=>{n.parentNode===e&&e.removeChild(n)}},[n]),e("span",{ref:r,style:{display:"contents"}})}function l(n){if(null!=n)return"string"==typeof n?n:n instanceof Node?e(u,{node:n}):void 0}function f(e,n){queueMicrotask(()=>{i(()=>{e.render(n)})})}function m(n){return r=>{const t=document.createElement("div");return f(s(t),e(n,Object.assign({},r))),t}}function p(n){return r=>{const t=document.createElement("div"),o=s(t),c=Object.assign(Object.assign({},r),{searchSection:r.searchSection?l(r.searchSection):null,listSection:l(r.listSection),resetSection:r.resetSection?l(r.resetSection):null});return f(o,e(n,Object.assign({},c))),t}}function b(r){const t=document.createElement("div");return t.innerHTML=d(e(n,{children:r})),function(e){const n=Array.from(e.childNodes).filter(e=>e.nodeType!==Node.TEXT_NODE||null!=e.textContent&&""!==e.textContent.trim());return 1===n.length&&n[0]instanceof HTMLElement?(e.removeChild(n[0]),n[0]):e}(t)}function g(r){return d(e(n,{children:r}))}function O(e){return"function"==typeof e}function S(n){const{cellRenderer:r,headerRenderer:t,children:o,nestedTable:c}=n,i=a(n,["cellRenderer","headerRenderer","children","nestedTable"]),d=Object.assign({},i);var u;if(r&&(d.cellRenderer=(u=r,n=>{const r=document.createElement("div");return r.style.display="contents",f(s(r),e(u,Object.assign({},n))),r})),t&&(d.headerRenderer=m(t)),o&&(d.children=o.map(S)),c){const e=Object.assign(Object.assign({},c),{rows:[]});d.nestedTable=h(e)}return d}function h(n){const{defaultHeaders:r,rows:t,footerRenderer:o,emptyStateRenderer:c,errorStateRenderer:i,loadingStateRenderer:d,tableEmptyStateRenderer:u,headerDropdown:h,columnEditorConfig:y,icons:R,onColumnOrderChange:j,onColumnWidthChange:v,onHeaderEdit:C,onColumnSelect:E}=n,w=a(n,["defaultHeaders","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons","onColumnOrderChange","onColumnWidthChange","onHeaderEdit","onColumnSelect"]),H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},w),{rows:t,defaultHeaders:r.map(S)}),j?{onColumnOrderChange:e=>j(e)}:{}),v?{onColumnWidthChange:e=>v(e)}:{}),C?{onHeaderEdit:(e,n)=>C(e,n)}:{}),E?{onColumnSelect:e=>E(e)}:{});if(void 0!==o&&(H.footerRenderer=m(o)),void 0!==c)if(O(c))H.emptyStateRenderer=m(c);else{const e=c;H.emptyStateRenderer=()=>b(e)}if(void 0!==i)if(O(i))H.errorStateRenderer=m(i);else{const e=i;H.errorStateRenderer=()=>b(e)}if(void 0!==d)if(O(d))H.loadingStateRenderer=m(d);else{const e=d;H.loadingStateRenderer=()=>b(e)}return void 0!==u&&(H.tableEmptyStateRenderer=null===u?null:b(u)),void 0!==h&&(H.headerDropdown=m(h)),void 0!==y&&(H.columnEditorConfig=function(n){const{rowRenderer:r,customRenderer:t}=n,o=a(n,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},o),r?{rowRenderer:(c=r,n=>{const r=document.createElement("div"),t=s(r),o=Object.assign(Object.assign({},n),{components:(i=n.components,{expandIcon:l(i.expandIcon),checkbox:l(i.checkbox),dragIcon:l(i.dragIcon),labelContent:l(i.labelContent),pinIcon:l(i.pinIcon)})});var i;return f(t,e(c,Object.assign({},o))),r})}:{}),t?{customRenderer:p(t)}:{});var c}(y)),void 0!==R&&(H.icons=function(e){const n={};for(const[r,t]of Object.entries(e))null!=t&&(n[r]="string"==typeof t||t instanceof HTMLElement||t instanceof SVGElement?t:g(t));return n}(R)),H}"function"==typeof SuppressedError&&SuppressedError;const y=r.forwardRef(function(n,r){const i=t(null),s=t(null),d=t(void 0),u=t(null),l=n;return o(()=>{if(!i.current)return;let e=!1;return queueMicrotask(()=>{if(e||!i.current)return;const n=new c(i.current,h(l));if(n.mount(),s.current=n,r){const e=n.getAPI();"function"==typeof r?r(e):r.current=e}}),()=>{e=!0;const n=s.current;n&&(n.destroy(),s.current=null,d.current=void 0,u.current=null,r&&"function"!=typeof r&&(r.current=null))}},[]),o(()=>{const e=s.current;if(!e)return;if(null!==u.current&&!function(e,n){const r=new Set([...Object.keys(e),...Object.keys(n)]);for(const t of r)if(e[t]!==n[t])return!0;return!1}(u.current,l))return;u.current=l;const n=h(l);queueMicrotask(()=>{if(s.current!==e)return;if(d.current!==l.defaultHeaders)return d.current=l.defaultHeaders,void e.update(n);const r=a(n,["defaultHeaders"]);e.update(r)})},[l]),e("div",{ref:i})});y.displayName="SimpleTable";export{y as SimpleTable};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -92,6 +92,13 @@ export declare class RenderOrchestrator {
92
92
  private lastRowsRef;
93
93
  private flattenedRowsCache;
94
94
  private lastProcessedResult;
95
+ /** Fingerprint for skipping pagination + height-map work on vertical scroll frames. */
96
+ private processRowsScrollReuseKey;
97
+ private processRowsScrollReuseBase;
98
+ /** Last painted virtual row range on scroll-raf; when unchanged, DOM work is redundant (native scroll moves content). */
99
+ private lastScrollRafPaintedRange;
100
+ /** Reuse normalized headers across scroll frames when layout inputs are unchanged. */
101
+ private scrollRafHeadersMemo;
95
102
  constructor();
96
103
  getCachedFlattenResult(): FlattenRowsResult | null;
97
104
  getLastProcessedResult(): ProcessRowsResult | null;
@@ -19,10 +19,13 @@ export declare class ScrollManager {
19
19
  private subscribers;
20
20
  private lastScrollTop;
21
21
  private scrollTimeoutId;
22
+ /** Coalesce scroll-driven subscriber notifications to one rAF (avoids sync storms + reflow). */
23
+ private notifySubscribersRafId;
22
24
  constructor(config: ScrollManagerConfig);
23
25
  updateConfig(config: Partial<ScrollManagerConfig>): void;
24
26
  subscribe(callback: StateChangeCallback): () => void;
25
27
  private notifySubscribers;
28
+ private scheduleNotifySubscribersFromScroll;
26
29
  handleScroll(scrollTop: number, scrollLeft: number, containerHeight: number, contentHeight: number): void;
27
30
  setScrolling(isScrolling: boolean): void;
28
31
  getState(): ScrollManagerState;
@@ -34,3 +34,22 @@ export interface ProcessRowsResult {
34
34
  heightMap: CumulativeHeightMap | undefined;
35
35
  }
36
36
  export declare function processRows(config: ProcessRowsConfig): ProcessRowsResult;
37
+ /** Layout inputs that do not depend on scroll position (reuse across scroll-raf frames). */
38
+ export interface ProcessRowsScrollReuseBase {
39
+ currentTableRows: TableRow[];
40
+ paginatedHeightOffsets: HeightOffsets | undefined;
41
+ heightMap: CumulativeHeightMap | undefined;
42
+ }
43
+ /**
44
+ * Recomputes only viewport-dependent fields when pagination, height map, and row list
45
+ * are unchanged (vertical scroll only). Avoids re-running applyPagination and
46
+ * buildCumulativeHeightMap on every scroll frame.
47
+ */
48
+ export declare function recomputeProcessRowsViewport(base: ProcessRowsScrollReuseBase, config: {
49
+ contentHeight: number | undefined;
50
+ rowHeight: number;
51
+ scrollTop: number;
52
+ scrollDirection?: "up" | "down" | "none";
53
+ enableStickyParents: boolean;
54
+ rowGrouping?: Accessor[];
55
+ }): ProcessRowsResult;
@@ -1,5 +1,4 @@
1
1
  export { default as SimpleTable } from "./SimpleTable";
2
2
  export { asRows } from "simple-table-core";
3
- export { defaultHeaderFromCore, defaultHeadersFromCore, mapToReactHeaderObjects, } from "./defaultHeadersFromCore";
4
3
  export type { SimpleTableReactProps, TableInstance, ReactHeaderObject, ReactColumnEditorConfig, ReactIconsConfig, ReactIconElement, ReactCellRenderer, ReactHeaderRenderer, ReactFooterRenderer, ReactHeaderDropdown, ReactColumnEditorRowRenderer, ReactColumnEditorCustomRenderer, ReactLoadingStateRenderer, ReactErrorStateRenderer, ReactEmptyStateRenderer, HeaderRendererComponents, HeaderRendererProps, ColumnEditorRowRendererComponents, ColumnEditorRowRendererProps, FooterRendererProps, HeaderDropdownProps, } from "./types";
5
- export type { Accessor, AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, DragHandlerProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, GetRowId, GetRowIdParams, HeaderDropdown, HeaderObject, HeaderRenderer, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, OnRowGroupExpandProps, OnSortProps, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRowProps, Theme, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, } from "simple-table-core";
4
+ export type { Accessor, AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, DragHandlerProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, GetRowId, GetRowIdParams, HeaderDropdown, HeaderRenderer, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, OnRowGroupExpandProps, OnSortProps, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRowProps, Theme, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, } from "simple-table-core";
@@ -62,10 +62,8 @@ export interface ReactColumnEditorConfig extends Omit<ColumnEditorConfig, "rowRe
62
62
  customRenderer?: ReactColumnEditorCustomRenderer;
63
63
  }
64
64
  /**
65
- * Column definition for `defaultHeaders`: same column metadata as core `HeaderObject`, but
66
- * `cellRenderer` / `headerRenderer` / `children` / `nestedTable` are React-only. For column
67
- * defs authored against core types, import `defaultHeadersFromCore`, `defaultHeaderFromCore`, or
68
- * `mapToReactHeaderObjects` (after spreading core columns and adding React renderers).
65
+ * Column definition for `defaultHeaders`: same column metadata as core columns, but
66
+ * `cellRenderer` / `headerRenderer` / `children` / `nestedTable` are React-only.
69
67
  */
70
68
  export interface ReactHeaderObject extends Omit<HeaderObject, "cellRenderer" | "headerRenderer" | "children" | "nestedTable"> {
71
69
  cellRenderer?: ReactCellRenderer;
@@ -74,8 +72,12 @@ export interface ReactHeaderObject extends Omit<HeaderObject, "cellRenderer" | "
74
72
  /** Nested grid: React table props minus row data and inherited state renderers. */
75
73
  nestedTable?: Omit<SimpleTableReactProps, "rows" | "loadingStateRenderer" | "errorStateRenderer" | "emptyStateRenderer" | "tableEmptyStateRenderer">;
76
74
  }
77
- export interface SimpleTableReactProps extends Omit<SimpleTableProps, "defaultHeaders" | "footerRenderer" | "emptyStateRenderer" | "errorStateRenderer" | "loadingStateRenderer" | "tableEmptyStateRenderer" | "headerDropdown" | "columnEditorConfig" | "icons" | "rows"> {
78
- defaultHeaders: ReactHeaderObject[];
75
+ export interface SimpleTableReactProps extends Omit<SimpleTableProps, "defaultHeaders" | "footerRenderer" | "emptyStateRenderer" | "errorStateRenderer" | "loadingStateRenderer" | "tableEmptyStateRenderer" | "headerDropdown" | "columnEditorConfig" | "icons" | "rows" | "onColumnOrderChange" | "onColumnWidthChange" | "onHeaderEdit" | "onColumnSelect"> {
76
+ defaultHeaders: ReadonlyArray<ReactHeaderObject>;
77
+ onColumnOrderChange?: (newHeaders: ReactHeaderObject[]) => void;
78
+ onColumnWidthChange?: (headers: ReactHeaderObject[]) => void;
79
+ onHeaderEdit?: (header: ReactHeaderObject, newLabel: string) => void;
80
+ onColumnSelect?: (header: ReactHeaderObject) => void;
79
81
  /** Row data: any object rows (domain models) or core `Row[]`; cast to vanilla `Row[]` inside the adapter. */
80
82
  rows: ReadonlyArray<Row> | ReadonlyArray<object>;
81
83
  footerRenderer?: ReactFooterRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-table/react",
3
- "version": "3.0.2",
3
+ "version": "3.0.5",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/types/react/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "react-dom": ">=18.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "simple-table-core": "3.0.2"
32
+ "simple-table-core": "3.0.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@rollup/plugin-alias": "^4.0.4",
@@ -1,12 +0,0 @@
1
- import type { HeaderObject } from "simple-table-core";
2
- import type { ReactHeaderObject } from "./types";
3
- /** Single column from a core/shared config, typed for React `defaultHeaders`. */
4
- export declare function defaultHeaderFromCore(header: HeaderObject): ReactHeaderObject;
5
- /** Column tree from `simple-table-core` or shared configs, typed for React `defaultHeaders`. */
6
- export declare function defaultHeadersFromCore(headers: readonly HeaderObject[]): ReactHeaderObject[];
7
- /**
8
- * Use after mapping over {@link HeaderObject} and spreading into `{ ...h, cellRenderer }` (or
9
- * `headerRenderer`). TypeScript keeps vanilla renderer types on the spread; this asserts the
10
- * React-only column shape for `defaultHeaders`.
11
- */
12
- export declare function mapToReactHeaderObjects(columns: readonly object[]): ReactHeaderObject[];