@pathscale/ui 0.0.97 → 0.0.99
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/dist/components/streaming-table/StreamingTable.d.ts +9 -0
- package/dist/components/streaming-table/createRowStore.d.ts +7 -0
- package/dist/components/streaming-table/createStreamingTableStore.d.ts +10 -0
- package/dist/components/streaming-table/index.d.ts +3 -0
- package/dist/components/streaming-table/types.d.ts +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +130 -6
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Table from "../table/Table";
|
|
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;
|
|
9
|
+
export default StreamingTable;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RowStore } from "./createRowStore";
|
|
2
|
+
export interface StreamingTableStore<T> {
|
|
3
|
+
rows: () => RowStore<T>[];
|
|
4
|
+
loadInitial: (rows: T[], getId: (row: T) => string) => void;
|
|
5
|
+
upsertRow: (row: T, getId: (row: T) => string) => void;
|
|
6
|
+
upsertRows: (rows: T[], getId: (row: T) => string) => void;
|
|
7
|
+
updateRow: (id: string, patch: Partial<T>) => void;
|
|
8
|
+
removeRow: (id: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createStreamingTableStore<T>(): StreamingTableStore<T>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
export interface StreamingColumnDef<T> {
|
|
3
|
+
/** Header text or JSX element */
|
|
4
|
+
header: JSX.Element | string;
|
|
5
|
+
/** For simple field access */
|
|
6
|
+
accessorKey?: keyof T & string;
|
|
7
|
+
/** For computed access */
|
|
8
|
+
accessorFn?: (row: T) => any;
|
|
9
|
+
/** Custom cell renderer */
|
|
10
|
+
cell?: (ctx: {
|
|
11
|
+
row: {
|
|
12
|
+
original: T;
|
|
13
|
+
};
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
/** Extra config (sorting, filters, etc.) */
|
|
16
|
+
meta?: Record<string, any>;
|
|
17
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,9 @@ export { default as Swap } from "./components/swap";
|
|
|
75
75
|
export { default as Table, EnhancedTable } from "./components/table";
|
|
76
76
|
export type { TableProps } from "./components/table";
|
|
77
77
|
export type { EnhancedTableProps } from "./components/table/EnhancedTable";
|
|
78
|
+
export { StreamingTable } from "./components/streaming-table";
|
|
79
|
+
export type { StreamingTableProps } from "./components/streaming-table";
|
|
80
|
+
export type { StreamingColumnDef } from "./components/streaming-table";
|
|
78
81
|
export { default as Tabs } from "./components/tabs";
|
|
79
82
|
export type { RadioTabProps, TabProps, TabsProps } from "./components/tabs";
|
|
80
83
|
export { default as Textarea } from "./components/textarea";
|
package/dist/index.js
CHANGED
|
@@ -11386,6 +11386,7 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11386
11386
|
return pageCount > 1 || totalRows > pageSize;
|
|
11387
11387
|
});
|
|
11388
11388
|
const headerGroups = ()=>table.getHeaderGroups();
|
|
11389
|
+
const visibleColumnCount = ()=>headerGroups()[0]?.headers.length ?? 0;
|
|
11389
11390
|
const FilterIconTrigger = (props)=>(()=>{
|
|
11390
11391
|
var _el$ = EnhancedTable_tmpl$();
|
|
11391
11392
|
_el$.$$click = (e)=>{
|
|
@@ -11433,7 +11434,7 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11433
11434
|
}
|
|
11434
11435
|
});
|
|
11435
11436
|
};
|
|
11436
|
-
|
|
11437
|
+
table.getAllLeafColumns().length, local.enableRowSelection, local.expandable;
|
|
11437
11438
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
|
|
11438
11439
|
get ["class"] () {
|
|
11439
11440
|
return dist_clsx(tableProps.class, "table-auto");
|
|
@@ -11557,7 +11558,9 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11557
11558
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!local.loading)() ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
|
|
11558
11559
|
get children () {
|
|
11559
11560
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
|
|
11560
|
-
colSpan
|
|
11561
|
+
get colSpan () {
|
|
11562
|
+
return visibleColumnCount();
|
|
11563
|
+
},
|
|
11561
11564
|
class: "text-center py-6",
|
|
11562
11565
|
get children () {
|
|
11563
11566
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!local.renderLoading)() ? local.renderLoading() : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(loading_Loading, {
|
|
@@ -11571,7 +11574,9 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11571
11574
|
}) : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!(0 === tableRows().length && local.renderEmpty))() ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
|
|
11572
11575
|
get children () {
|
|
11573
11576
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
|
|
11574
|
-
colSpan
|
|
11577
|
+
get colSpan () {
|
|
11578
|
+
return visibleColumnCount();
|
|
11579
|
+
},
|
|
11575
11580
|
class: "text-center py-4",
|
|
11576
11581
|
get children () {
|
|
11577
11582
|
return local.renderEmpty();
|
|
@@ -11651,7 +11656,7 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11651
11656
|
get children () {
|
|
11652
11657
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
|
|
11653
11658
|
get colSpan () {
|
|
11654
|
-
return
|
|
11659
|
+
return visibleColumnCount();
|
|
11655
11660
|
},
|
|
11656
11661
|
get children () {
|
|
11657
11662
|
return local.expandable?.expandedRowRender({
|
|
@@ -11678,7 +11683,9 @@ function EnhancedTable_EnhancedTable(props) {
|
|
|
11678
11683
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
|
|
11679
11684
|
get children () {
|
|
11680
11685
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
|
|
11681
|
-
colSpan
|
|
11686
|
+
get colSpan () {
|
|
11687
|
+
return visibleColumnCount();
|
|
11688
|
+
},
|
|
11682
11689
|
get children () {
|
|
11683
11690
|
var _el$5 = EnhancedTable_tmpl$3(), _el$6 = _el$5.firstChild, _el$8 = (_el$6.firstChild, _el$6.nextSibling), _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$11 = _el$0.nextSibling, _el$12 = (_el$11.nextSibling, _el$9.nextSibling);
|
|
11684
11691
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(dropdown_Dropdown, {
|
|
@@ -11910,6 +11917,123 @@ const EnhancedTable = EnhancedTable_EnhancedTable;
|
|
|
11910
11917
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
|
|
11911
11918
|
"click"
|
|
11912
11919
|
]);
|
|
11920
|
+
function createRowStore(id, initial) {
|
|
11921
|
+
const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(initial);
|
|
11922
|
+
return {
|
|
11923
|
+
id,
|
|
11924
|
+
data,
|
|
11925
|
+
patch: (partial)=>{
|
|
11926
|
+
setData((prev)=>({
|
|
11927
|
+
...prev,
|
|
11928
|
+
...partial
|
|
11929
|
+
}));
|
|
11930
|
+
},
|
|
11931
|
+
replace: (newData)=>{
|
|
11932
|
+
setData(()=>newData);
|
|
11933
|
+
}
|
|
11934
|
+
};
|
|
11935
|
+
}
|
|
11936
|
+
function createStreamingTableStore() {
|
|
11937
|
+
const [rowStores, setRowStores] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)([]);
|
|
11938
|
+
function loadInitial(rows, getId) {
|
|
11939
|
+
const stores = rows.map((r)=>createRowStore(getId(r), r));
|
|
11940
|
+
setRowStores(stores);
|
|
11941
|
+
}
|
|
11942
|
+
function upsertRow(row, getId) {
|
|
11943
|
+
const id = getId(row);
|
|
11944
|
+
const stores = rowStores();
|
|
11945
|
+
const existing = stores.find((s)=>s.id === id);
|
|
11946
|
+
if (existing) return void existing.replace(row);
|
|
11947
|
+
setRowStores([
|
|
11948
|
+
...stores,
|
|
11949
|
+
createRowStore(id, row)
|
|
11950
|
+
]);
|
|
11951
|
+
}
|
|
11952
|
+
function upsertRows(rows, getId) {
|
|
11953
|
+
rows.forEach((row)=>upsertRow(row, getId));
|
|
11954
|
+
}
|
|
11955
|
+
function updateRow(id, patch) {
|
|
11956
|
+
const stores = rowStores();
|
|
11957
|
+
const existing = stores.find((s)=>s.id === id);
|
|
11958
|
+
if (existing) existing.patch(patch);
|
|
11959
|
+
}
|
|
11960
|
+
function removeRow(id) {
|
|
11961
|
+
const stores = rowStores().filter((s)=>s.id !== id);
|
|
11962
|
+
setRowStores(stores);
|
|
11963
|
+
}
|
|
11964
|
+
return {
|
|
11965
|
+
rows: rowStores,
|
|
11966
|
+
loadInitial,
|
|
11967
|
+
upsertRow,
|
|
11968
|
+
upsertRows,
|
|
11969
|
+
updateRow,
|
|
11970
|
+
removeRow
|
|
11971
|
+
};
|
|
11972
|
+
}
|
|
11973
|
+
function StreamingTable_StreamingTable(props) {
|
|
11974
|
+
const [local, tableProps] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
11975
|
+
"data",
|
|
11976
|
+
"columns",
|
|
11977
|
+
"getRowId"
|
|
11978
|
+
]);
|
|
11979
|
+
const getId = local.getRowId ?? ((row)=>row.id);
|
|
11980
|
+
const store = createStreamingTableStore();
|
|
11981
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
|
|
11982
|
+
store.loadInitial(local.data, getId);
|
|
11983
|
+
});
|
|
11984
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
|
|
11985
|
+
get children () {
|
|
11986
|
+
return [
|
|
11987
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Head, {
|
|
11988
|
+
get children () {
|
|
11989
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
|
|
11990
|
+
get children () {
|
|
11991
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
11992
|
+
get each () {
|
|
11993
|
+
return local.columns;
|
|
11994
|
+
},
|
|
11995
|
+
children: (col)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.HeadCell, {
|
|
11996
|
+
get children () {
|
|
11997
|
+
return col.header;
|
|
11998
|
+
}
|
|
11999
|
+
})
|
|
12000
|
+
});
|
|
12001
|
+
}
|
|
12002
|
+
});
|
|
12003
|
+
}
|
|
12004
|
+
}),
|
|
12005
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Body, {
|
|
12006
|
+
get children () {
|
|
12007
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
12008
|
+
get each () {
|
|
12009
|
+
return store.rows();
|
|
12010
|
+
},
|
|
12011
|
+
children: (rowStore)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
|
|
12012
|
+
get children () {
|
|
12013
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
12014
|
+
get each () {
|
|
12015
|
+
return local.columns;
|
|
12016
|
+
},
|
|
12017
|
+
children: (col)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
|
|
12018
|
+
get children () {
|
|
12019
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.cell)() ? col.cell({
|
|
12020
|
+
row: {
|
|
12021
|
+
original: rowStore.data()
|
|
12022
|
+
}
|
|
12023
|
+
}) : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.accessorKey)() ? rowStore.data()[col.accessorKey] : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.accessorFn)() ? col.accessorFn(rowStore.data()) : "";
|
|
12024
|
+
}
|
|
12025
|
+
})
|
|
12026
|
+
});
|
|
12027
|
+
}
|
|
12028
|
+
})
|
|
12029
|
+
});
|
|
12030
|
+
}
|
|
12031
|
+
})
|
|
12032
|
+
];
|
|
12033
|
+
}
|
|
12034
|
+
}));
|
|
12035
|
+
}
|
|
12036
|
+
const StreamingTable = StreamingTable_StreamingTable;
|
|
11913
12037
|
var Tab_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<a role=tab>");
|
|
11914
12038
|
const Tab = (props)=>{
|
|
11915
12039
|
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
@@ -12502,4 +12626,4 @@ const WindowMockup = (props)=>{
|
|
|
12502
12626
|
})();
|
|
12503
12627
|
};
|
|
12504
12628
|
const windowmockup_WindowMockup = WindowMockup;
|
|
12505
|
-
export { accordion_Accordion as Accordion, alert_Alert as Alert, artboard_Artboard as Artboard, avatar as Avatar, background_Background as Background, Badge, bottom_sheet_BottomSheet as BottomSheet, Breadcrumbs, breadcrumbs_BreadcrumbsItem as BreadcrumbsItem, browsermockup_BrowserMockup as BrowserMockup, button_Button as Button, Calendar, card_Card as Card, carousel_Carousel as Carousel, chatbubble_ChatBubble as ChatBubble, checkbox_Checkbox as Checkbox, codemockup_CodeMockup as CodeMockup, CodeMockupLine, collapse_Collapse as Collapse, CollapseContent, CollapseDetails, CollapseTitle, connectionstatus_ConnectionStatus as ConnectionStatus, CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, EnhancedTable, FileInput, flex_Flex as Flex, footer_Footer as Footer, form_Form as Form, Grid, hero_Hero as Hero, icon_Icon as Icon, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, link_Link as Link, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, navbar_Navbar as Navbar, pagination_Pagination as Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, range_Range as Range, Rating, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, showcase_section_ShowcaseSection as ShowcaseSection, sidenav_Sidenav as Sidenav, sidenav_SidenavButton as SidenavButton, sidenav_SidenavGroup as SidenavGroup, sidenav_SidenavItem as SidenavItem, sidenav_SidenavLink as SidenavLink, sidenav_SidenavMenu as SidenavMenu, skeleton_Skeleton as Skeleton, Stack, stat_card_StatCard as StatCard, stats_Stats as Stats, status_Status as Status, steps as Steps, Summary, SvgBackground, Swap, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, windowmockup_WindowMockup as WindowMockup, connectionstatus_ConnectionStatus as default, toastStore, useDesktop, useFormValidation };
|
|
12629
|
+
export { accordion_Accordion as Accordion, alert_Alert as Alert, artboard_Artboard as Artboard, avatar as Avatar, background_Background as Background, Badge, bottom_sheet_BottomSheet as BottomSheet, Breadcrumbs, breadcrumbs_BreadcrumbsItem as BreadcrumbsItem, browsermockup_BrowserMockup as BrowserMockup, button_Button as Button, Calendar, card_Card as Card, carousel_Carousel as Carousel, chatbubble_ChatBubble as ChatBubble, checkbox_Checkbox as Checkbox, codemockup_CodeMockup as CodeMockup, CodeMockupLine, collapse_Collapse as Collapse, CollapseContent, CollapseDetails, CollapseTitle, connectionstatus_ConnectionStatus as ConnectionStatus, CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, EnhancedTable, FileInput, flex_Flex as Flex, footer_Footer as Footer, form_Form as Form, Grid, hero_Hero as Hero, icon_Icon as Icon, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, link_Link as Link, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, navbar_Navbar as Navbar, pagination_Pagination as Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, range_Range as Range, Rating, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, showcase_section_ShowcaseSection as ShowcaseSection, sidenav_Sidenav as Sidenav, sidenav_SidenavButton as SidenavButton, sidenav_SidenavGroup as SidenavGroup, sidenav_SidenavItem as SidenavItem, sidenav_SidenavLink as SidenavLink, sidenav_SidenavMenu as SidenavMenu, skeleton_Skeleton as Skeleton, Stack, stat_card_StatCard as StatCard, stats_Stats as Stats, status_Status as Status, steps as Steps, StreamingTable, Summary, SvgBackground, Swap, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, windowmockup_WindowMockup as WindowMockup, connectionstatus_ConnectionStatus as default, toastStore, useDesktop, useFormValidation };
|