@pathscale/ui 0.0.99 → 0.0.100

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.
@@ -1,9 +1,9 @@
1
- import Table from "../table/Table";
1
+ import type { TableProps } from "../table";
2
2
  import type { StreamingColumnDef } from "./types";
3
- export type StreamingTableProps<T> = {
4
- data: T[];
5
- columns: StreamingColumnDef<T>[];
6
- getRowId?: (row: T) => string;
7
- } & Omit<Parameters<typeof Table>[0], "children">;
8
- export declare function StreamingTable<T>(props: StreamingTableProps<T>): import("solid-js").JSX.Element;
3
+ export type StreamingTableProps<TData> = {
4
+ data: TData[];
5
+ columns: StreamingColumnDef<TData>[];
6
+ getRowId?: (row: TData) => string;
7
+ } & Omit<TableProps, "children">;
8
+ declare const StreamingTable: <TData>(props: StreamingTableProps<TData>) => import("solid-js").JSX.Element;
9
9
  export default StreamingTable;
package/dist/index.js CHANGED
@@ -11970,16 +11970,31 @@ function createStreamingTableStore() {
11970
11970
  removeRow
11971
11971
  };
11972
11972
  }
11973
- function StreamingTable_StreamingTable(props) {
11973
+ const StreamingTable_StreamingTable = (props)=>{
11974
11974
  const [local, tableProps] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
11975
11975
  "data",
11976
11976
  "columns",
11977
11977
  "getRowId"
11978
11978
  ]);
11979
- const getId = local.getRowId ?? ((row)=>row.id);
11980
11979
  const store = createStreamingTableStore();
11981
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
11982
- store.loadInitial(local.data, getId);
11980
+ const resolveId = (row)=>{
11981
+ if (local.getRowId) return local.getRowId(row);
11982
+ const anyRow = row;
11983
+ if (null != anyRow.id) return String(anyRow.id);
11984
+ return JSON.stringify(anyRow);
11985
+ };
11986
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
11987
+ const incoming = local.data ?? [];
11988
+ const idSet = new Set();
11989
+ incoming.forEach((row)=>{
11990
+ const id = resolveId(row);
11991
+ idSet.add(id);
11992
+ store.upsertRow(row, resolveId);
11993
+ });
11994
+ const current = store.rows();
11995
+ current.forEach((r)=>{
11996
+ if (!idSet.has(r.id)) store.removeRow(r.id);
11997
+ });
11983
11998
  });
11984
11999
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
11985
12000
  get children () {
@@ -12032,7 +12047,7 @@ function StreamingTable_StreamingTable(props) {
12032
12047
  ];
12033
12048
  }
12034
12049
  }));
12035
- }
12050
+ };
12036
12051
  const StreamingTable = StreamingTable_StreamingTable;
12037
12052
  var Tab_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<a role=tab>");
12038
12053
  const Tab = (props)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",