@simple-table/react 3.0.0-beta.11 → 3.0.0-beta.12
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 +36 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react/src/SimpleTable.d.ts +4 -1
- package/dist/cjs/react/src/utils/wrapReactRenderer.d.ts +3 -2
- package/dist/index.es.js +1 -1
- package/dist/react/src/SimpleTable.d.ts +4 -1
- package/dist/react/src/utils/wrapReactRenderer.d.ts +3 -2
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Simple Table for React
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@simple-table/react)
|
|
4
|
+
[](https://www.npmjs.com/package/@simple-table/react)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
React adapter for [Simple Table](https://www.simple-table.com/) — a lightweight, high-performance data grid with full React component support for all renderers.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @simple-table/react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Peer dependencies:** `react >=18.0.0`, `react-dom >=18.0.0`
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Use React components for cell renderers, header renderers, footer renderers, and more
|
|
20
|
+
- Access the full imperative `TableAPI` via a ref for sorting, filtering, pagination, export, and more
|
|
21
|
+
- All types exported directly — no need to install `simple-table-core` separately
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- **Quick Start**: [simple-table.com/docs/quick-start](https://www.simple-table.com/docs/quick-start)
|
|
26
|
+
- **Full Documentation**: [simple-table.com/docs/installation](https://www.simple-table.com/docs/installation)
|
|
27
|
+
- **Examples**: [simple-table.com/examples/crm](https://www.simple-table.com/examples/crm)
|
|
28
|
+
|
|
29
|
+
## Community & Support
|
|
30
|
+
|
|
31
|
+
- **Discord**: [Join us on Discord](https://discord.gg/RvKHCfg3PC)
|
|
32
|
+
- **GitHub**: [Report bugs or suggest features](https://github.com/petera2c/simple-table/issues)
|
|
33
|
+
|
|
34
|
+
## License
|
|
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.
|
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");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("simple-table-core"),n=require("react-dom/server");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function i(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function d(r){return t=>{const o=document.createElement("div");return o.innerHTML=n.renderToStaticMarkup(e.jsx(r,Object.assign({},t))),o}}function a(r){const t=document.createElement("div");return t.innerHTML=n.renderToStaticMarkup(e.jsx(e.Fragment,{children:r})),t}function c(r){return n.renderToStaticMarkup(e.jsx(e.Fragment,{children:r}))}function u(e){return"function"==typeof e}function l(e){const{cellRenderer:r,headerRenderer:t,children:n,nestedTable:o}=e,a=i(e,["cellRenderer","headerRenderer","children","nestedTable"]),c=Object.assign({},a);if(r&&(c.cellRenderer=d(r)),t&&(c.headerRenderer=d(t)),n&&(c.children=n.map(l)),o){const e=Object.assign(Object.assign({},o),{rows:[]});c.nestedTable=s(e)}return c}function s(e){const{defaultHeaders:r,footerRenderer:t,emptyStateRenderer:n,errorStateRenderer:o,loadingStateRenderer:s,tableEmptyStateRenderer:f,headerDropdown:p,columnEditorConfig:m,icons:R}=e,b=i(e,["defaultHeaders","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),S=Object.assign(Object.assign({},b),{defaultHeaders:r.map(l)});if(void 0!==t&&(S.footerRenderer=d(t)),void 0!==n)if(u(n))S.emptyStateRenderer=d(n);else{const e=n;S.emptyStateRenderer=()=>a(e)}if(void 0!==o)if(u(o))S.errorStateRenderer=d(o);else{const e=o;S.errorStateRenderer=()=>a(e)}if(void 0!==s)if(u(s))S.loadingStateRenderer=d(s);else{const e=s;S.loadingStateRenderer=()=>a(e)}return void 0!==f&&(S.tableEmptyStateRenderer=null===f?null:a(f)),void 0!==p&&(S.headerDropdown=d(p)),void 0!==m&&(S.columnEditorConfig=function(e){const{rowRenderer:r}=e,t=i(e,["rowRenderer"]);return Object.assign(Object.assign({},t),r?{rowRenderer:d(r)}:{})}(m)),void 0!==R&&(S.icons=function(e){const r={};for(const[t,n]of Object.entries(e))null!=n&&(r[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGElement?n:c(n));return r}(R)),S}"function"==typeof SuppressedError&&SuppressedError;const f=o(r).default.forwardRef(function(n,o){const i=r.useRef(null),d=r.useRef(null),a=n;return r.useEffect(()=>{if(!i.current)return;const e=new t.SimpleTableVanilla(i.current,s(a));if(e.mount(),d.current=e,o){const r=e.getAPI();"function"==typeof o?o(r):o.current=r}return()=>{e.destroy(),d.current=null,o&&"function"!=typeof o&&(o.current=null)}},[]),r.useEffect(()=>{var e;null===(e=d.current)||void 0===e||e.update(s(a))}),e.jsx("div",{ref:i})});f.displayName="SimpleTable",exports.SimpleTable=f;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TableAPI } from "simple-table-core";
|
|
3
|
+
import type { SimpleTableReactProps } from "./types";
|
|
1
4
|
/**
|
|
2
5
|
* SimpleTable — React adapter for simple-table-core.
|
|
3
6
|
*
|
|
@@ -20,5 +23,5 @@
|
|
|
20
23
|
* footerRenderer={MyFooter}
|
|
21
24
|
* />
|
|
22
25
|
*/
|
|
23
|
-
declare const SimpleTable:
|
|
26
|
+
declare const SimpleTable: React.ForwardRefExoticComponent<SimpleTableReactProps & React.RefAttributes<TableAPI>>;
|
|
24
27
|
export default SimpleTable;
|
|
@@ -3,8 +3,9 @@ import React from "react";
|
|
|
3
3
|
* Wraps a React component into a function that returns an HTMLElement, matching
|
|
4
4
|
* the vanilla renderer contract expected by simple-table-core.
|
|
5
5
|
*
|
|
6
|
-
* Uses
|
|
7
|
-
*
|
|
6
|
+
* Uses renderToStaticMarkup for synchronous rendering that is safe to call from
|
|
7
|
+
* any context (including inside useEffect) without triggering React 18's
|
|
8
|
+
* "flushSync was called from inside a lifecycle method" warning.
|
|
8
9
|
*/
|
|
9
10
|
export declare function wrapReactRenderer<P extends object>(Component: React.ComponentType<P>): (props: P) => HTMLElement;
|
|
10
11
|
/**
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";
|
|
1
|
+
import{jsx as e,Fragment as r}from"react/jsx-runtime";import n,{useRef as t,useEffect as o}from"react";import{SimpleTableVanilla as d}from"simple-table-core";import{renderToStaticMarkup as i}from"react-dom/server";function c(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(r){return n=>{const t=document.createElement("div");return t.innerHTML=i(e(r,Object.assign({},n))),t}}function l(n){const t=document.createElement("div");return t.innerHTML=i(e(r,{children:n})),t}function s(n){return i(e(r,{children:n}))}function u(e){return"function"==typeof e}function f(e){const{cellRenderer:r,headerRenderer:n,children:t,nestedTable:o}=e,d=c(e,["cellRenderer","headerRenderer","children","nestedTable"]),i=Object.assign({},d);if(r&&(i.cellRenderer=a(r)),n&&(i.headerRenderer=a(n)),t&&(i.children=t.map(f)),o){const e=Object.assign(Object.assign({},o),{rows:[]});i.nestedTable=p(e)}return i}function p(e){const{defaultHeaders:r,footerRenderer:n,emptyStateRenderer:t,errorStateRenderer:o,loadingStateRenderer:d,tableEmptyStateRenderer:i,headerDropdown:p,columnEditorConfig:m,icons:R}=e,b=c(e,["defaultHeaders","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),y=Object.assign(Object.assign({},b),{defaultHeaders:r.map(f)});if(void 0!==n&&(y.footerRenderer=a(n)),void 0!==t)if(u(t))y.emptyStateRenderer=a(t);else{const e=t;y.emptyStateRenderer=()=>l(e)}if(void 0!==o)if(u(o))y.errorStateRenderer=a(o);else{const e=o;y.errorStateRenderer=()=>l(e)}if(void 0!==d)if(u(d))y.loadingStateRenderer=a(d);else{const e=d;y.loadingStateRenderer=()=>l(e)}return void 0!==i&&(y.tableEmptyStateRenderer=null===i?null:l(i)),void 0!==p&&(y.headerDropdown=a(p)),void 0!==m&&(y.columnEditorConfig=function(e){const{rowRenderer:r}=e,n=c(e,["rowRenderer"]);return Object.assign(Object.assign({},n),r?{rowRenderer:a(r)}:{})}(m)),void 0!==R&&(y.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:s(t));return r}(R)),y}"function"==typeof SuppressedError&&SuppressedError;const m=n.forwardRef(function(r,n){const i=t(null),c=t(null),a=r;return o(()=>{if(!i.current)return;const e=new d(i.current,p(a));if(e.mount(),c.current=e,n){const r=e.getAPI();"function"==typeof n?n(r):n.current=r}return()=>{e.destroy(),c.current=null,n&&"function"!=typeof n&&(n.current=null)}},[]),o(()=>{var e;null===(e=c.current)||void 0===e||e.update(p(a))}),e("div",{ref:i})});m.displayName="SimpleTable";export{m as SimpleTable};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TableAPI } from "simple-table-core";
|
|
3
|
+
import type { SimpleTableReactProps } from "./types";
|
|
1
4
|
/**
|
|
2
5
|
* SimpleTable — React adapter for simple-table-core.
|
|
3
6
|
*
|
|
@@ -20,5 +23,5 @@
|
|
|
20
23
|
* footerRenderer={MyFooter}
|
|
21
24
|
* />
|
|
22
25
|
*/
|
|
23
|
-
declare const SimpleTable:
|
|
26
|
+
declare const SimpleTable: React.ForwardRefExoticComponent<SimpleTableReactProps & React.RefAttributes<TableAPI>>;
|
|
24
27
|
export default SimpleTable;
|
|
@@ -3,8 +3,9 @@ import React from "react";
|
|
|
3
3
|
* Wraps a React component into a function that returns an HTMLElement, matching
|
|
4
4
|
* the vanilla renderer contract expected by simple-table-core.
|
|
5
5
|
*
|
|
6
|
-
* Uses
|
|
7
|
-
*
|
|
6
|
+
* Uses renderToStaticMarkup for synchronous rendering that is safe to call from
|
|
7
|
+
* any context (including inside useEffect) without triggering React 18's
|
|
8
|
+
* "flushSync was called from inside a lifecycle method" warning.
|
|
8
9
|
*/
|
|
9
10
|
export declare function wrapReactRenderer<P extends object>(Component: React.ComponentType<P>): (props: P) => HTMLElement;
|
|
10
11
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-table/react",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.12",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"react-dom": ">=18.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"simple-table-core": "3.0.0-beta.
|
|
28
|
+
"simple-table-core": "3.0.0-beta.12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rollup/plugin-alias": "^4.0.4",
|