@pathscale/ui 1.1.12 → 1.1.13
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/glass-panel/GlassPanel.js +3 -5
- package/dist/components/pagination/Pagination.css +121 -0
- package/dist/components/pagination/Pagination.d.ts +8 -2
- package/dist/components/pagination/Pagination.js +113 -7
- package/dist/components/streaming-table/StreamingTable.js +39 -92
- package/dist/components/table/EnhancedTable.d.ts +1 -1
- package/dist/components/table/EnhancedTable.js +68 -51
- package/dist/components/table/{table.css → Table.css} +106 -9
- package/dist/components/table/Table.d.ts +51 -7
- package/dist/components/table/Table.js +220 -28
- package/dist/components/table/index.d.ts +2 -1
- package/dist/components/table/index.js +14 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -2
|
@@ -2,7 +2,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
|
|
5
|
-
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<button type=button class="flex w-full items-center justify-between gap-2 px-4 py-3 text-sm font-medium cursor-pointer select-none transition-colors duration-150 text-base-content/50 hover:text-base-content/80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"><span class="flex items-center gap-2"></span><svg fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=1.5><path stroke-linecap=round stroke-linejoin=round d="M19 9l-7 7-7-7">'), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><div><div>");
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<button type=button class="flex w-full items-center justify-between gap-2 px-4 py-3 text-sm font-medium cursor-pointer select-none transition-colors duration-150 text-base-content/50 hover:text-base-content/80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"><span class="flex items-center gap-2"></span><svg fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=1.5><path stroke-linecap=round stroke-linejoin=round d="M19 9l-7 7-7-7">'), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><div><div class=overflow-hidden>");
|
|
6
6
|
const BLUR_MAP = {
|
|
7
7
|
none: "",
|
|
8
8
|
sm: "backdrop-blur-sm",
|
|
@@ -126,17 +126,15 @@ const GlassPanel = (props)=>{
|
|
|
126
126
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$5, "id", contentId);
|
|
127
127
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, ()=>local.children);
|
|
128
128
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
129
|
-
var _v$3 = `grid transition-[grid-template-rows,opacity] duration-200 ease-in-out
|
|
129
|
+
var _v$3 = `grid transition-[grid-template-rows,opacity] duration-200 ease-in-out overflow-hidden ${local.collapsible && !isOpen() ? "" : contentClasses()}`, _v$4 = !local.collapsible || isOpen() ? "1fr" : "0fr", _v$5 = !local.collapsible || isOpen() ? "1" : "0";
|
|
130
130
|
_v$3 !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$5, _p$.e = _v$3);
|
|
131
131
|
_v$4 !== _p$.t && (null != (_p$.t = _v$4) ? _el$5.style.setProperty("grid-template-rows", _v$4) : _el$5.style.removeProperty("grid-template-rows"));
|
|
132
132
|
_v$5 !== _p$.a && (null != (_p$.a = _v$5) ? _el$5.style.setProperty("opacity", _v$5) : _el$5.style.removeProperty("opacity"));
|
|
133
|
-
_v$6 !== _p$.o && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$6, _p$.o = _v$6);
|
|
134
133
|
return _p$;
|
|
135
134
|
}, {
|
|
136
135
|
e: void 0,
|
|
137
136
|
t: void 0,
|
|
138
|
-
a: void 0
|
|
139
|
-
o: void 0
|
|
137
|
+
a: void 0
|
|
140
138
|
});
|
|
141
139
|
return _el$;
|
|
142
140
|
})();
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.pagination {
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
gap: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (min-width: 640px) {
|
|
12
|
+
.pagination {
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pagination__summary {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 0.5rem;
|
|
21
|
+
align-self: flex-start;
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
opacity: 0.7;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (min-width: 640px) {
|
|
27
|
+
.pagination__summary {
|
|
28
|
+
align-self: center;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.pagination__content {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 0.25rem;
|
|
36
|
+
align-self: flex-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (min-width: 640px) {
|
|
40
|
+
.pagination__content {
|
|
41
|
+
align-self: center;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pagination__item {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pagination__link {
|
|
50
|
+
position: relative;
|
|
51
|
+
isolation: isolate;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
height: 2.25rem;
|
|
54
|
+
width: 2.25rem;
|
|
55
|
+
transform-origin: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
border-radius: 9999px;
|
|
59
|
+
border: 0;
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
color: var(--color-base-content);
|
|
62
|
+
font-size: 0.875rem;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
outline: none;
|
|
66
|
+
user-select: none;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
transition:
|
|
69
|
+
transform 250ms var(--ease-smooth, cubic-bezier(0.22, 1, 0.36, 1)),
|
|
70
|
+
background-color 100ms ease-out,
|
|
71
|
+
box-shadow 100ms ease-out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pagination__link:focus-visible,
|
|
75
|
+
.pagination__link[data-focus-visible="true"] {
|
|
76
|
+
outline: none;
|
|
77
|
+
box-shadow: 0 0 0 2px var(--color-focus, var(--color-accent));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pagination__link:disabled,
|
|
81
|
+
.pagination__link[aria-disabled="true"] {
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (hover: hover) {
|
|
87
|
+
.pagination__link:hover:not(:disabled),
|
|
88
|
+
.pagination__link[data-hovered="true"]:not(:disabled) {
|
|
89
|
+
background-color: var(--color-base-200);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pagination__link:active:not(:disabled),
|
|
94
|
+
.pagination__link[data-pressed="true"]:not(:disabled) {
|
|
95
|
+
background-color: var(--color-base-300);
|
|
96
|
+
transform: scale(0.97);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pagination__link[data-active="true"] {
|
|
100
|
+
background-color: var(--color-base-300);
|
|
101
|
+
color: var(--color-base-content);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.pagination__ellipsis {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
height: 2.25rem;
|
|
107
|
+
width: 2.25rem;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
opacity: 0.65;
|
|
112
|
+
user-select: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.pagination__link--nav {
|
|
116
|
+
width: auto;
|
|
117
|
+
gap: 0.375rem;
|
|
118
|
+
padding-inline: 0.625rem;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import "./Pagination.css";
|
|
1
2
|
import { type JSX } from "solid-js";
|
|
2
|
-
import {
|
|
3
|
-
export type PaginationProps =
|
|
3
|
+
import type { IComponentBaseProps } from "../types";
|
|
4
|
+
export type PaginationProps = Omit<JSX.HTMLAttributes<HTMLElement>, "onChange"> & IComponentBaseProps & {
|
|
5
|
+
page: number;
|
|
6
|
+
total: number;
|
|
7
|
+
onChange: (page: number) => void;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
};
|
|
4
10
|
declare const Pagination: (props: PaginationProps) => JSX.Element;
|
|
5
11
|
export default Pagination;
|
|
@@ -1,17 +1,123 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web";
|
|
2
|
+
import "./Pagination.css";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
4
|
-
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)(`<nav><div class=pagination__summary data-slot=pagination-summary>Page <!> of </div><ul class=pagination__content data-slot=pagination-content><li class=pagination__item data-slot=pagination-item><button type=button class="pagination__link pagination__link--nav"data-slot=pagination-previous aria-label="Go to previous page"><span aria-hidden=true>\u{2039}</span><span>Previous</span></button></li><li class=pagination__item data-slot=pagination-item><button type=button class="pagination__link pagination__link--nav"data-slot=pagination-next aria-label="Go to next page"><span>Next</span><span aria-hidden=true>\u{203A}`), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<li class=pagination__item data-slot=pagination-item>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<button type=button class=pagination__link data-slot=pagination-link>"), _tmpl$4 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)(`<span class=pagination__ellipsis data-slot=pagination-ellipsis aria-hidden=true>\u{2026}`);
|
|
6
|
+
const clampPage = (page, total)=>{
|
|
7
|
+
if (!Number.isFinite(page)) return 1;
|
|
8
|
+
return Math.min(Math.max(1, Math.floor(page)), total);
|
|
9
|
+
};
|
|
10
|
+
const getPaginationTokens = (page, total)=>{
|
|
11
|
+
if (total <= 0) return [];
|
|
12
|
+
if (total <= 7) return Array.from({
|
|
13
|
+
length: total
|
|
14
|
+
}, (_, index)=>index + 1);
|
|
15
|
+
if (page <= 4) return [
|
|
16
|
+
1,
|
|
17
|
+
2,
|
|
18
|
+
3,
|
|
19
|
+
4,
|
|
20
|
+
5,
|
|
21
|
+
"ellipsis-right",
|
|
22
|
+
total
|
|
23
|
+
];
|
|
24
|
+
if (page >= total - 3) return [
|
|
25
|
+
1,
|
|
26
|
+
"ellipsis-left",
|
|
27
|
+
total - 4,
|
|
28
|
+
total - 3,
|
|
29
|
+
total - 2,
|
|
30
|
+
total - 1,
|
|
31
|
+
total
|
|
32
|
+
];
|
|
33
|
+
return [
|
|
34
|
+
1,
|
|
35
|
+
"ellipsis-left",
|
|
36
|
+
page - 1,
|
|
37
|
+
page,
|
|
38
|
+
page + 1,
|
|
39
|
+
"ellipsis-right",
|
|
40
|
+
total
|
|
41
|
+
];
|
|
42
|
+
};
|
|
5
43
|
const Pagination = (props)=>{
|
|
6
44
|
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
7
45
|
"class",
|
|
8
|
-
"className"
|
|
46
|
+
"className",
|
|
47
|
+
"dataTheme",
|
|
48
|
+
"page",
|
|
49
|
+
"total",
|
|
50
|
+
"onChange",
|
|
51
|
+
"isDisabled"
|
|
9
52
|
]);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
53
|
+
const safeTotal = ()=>Math.max(1, Math.floor(local.total || 0));
|
|
54
|
+
const currentPage = ()=>clampPage(local.page, safeTotal());
|
|
55
|
+
const tokens = ()=>getPaginationTokens(currentPage(), safeTotal());
|
|
56
|
+
const disabled = ()=>Boolean(local.isDisabled);
|
|
57
|
+
const handleChange = (nextPage)=>{
|
|
58
|
+
if (disabled()) return;
|
|
59
|
+
const bounded = clampPage(nextPage, safeTotal());
|
|
60
|
+
if (bounded === currentPage()) return;
|
|
61
|
+
local.onChange(bounded);
|
|
62
|
+
};
|
|
63
|
+
return (()=>{
|
|
64
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$5 = _el$3.nextSibling, _el$6 = (_el$5.nextSibling, _el$2.nextSibling), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$0 = _el$9.firstChild;
|
|
65
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
66
|
+
"aria-label": "pagination",
|
|
67
|
+
role: "navigation",
|
|
68
|
+
get ["class"] () {
|
|
69
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("pagination", local.class, local.className);
|
|
70
|
+
},
|
|
71
|
+
get ["data-theme"] () {
|
|
72
|
+
return local.dataTheme;
|
|
73
|
+
},
|
|
74
|
+
"data-slot": "pagination"
|
|
75
|
+
}), false, true);
|
|
76
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, currentPage, _el$5);
|
|
77
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, safeTotal, null);
|
|
78
|
+
_el$8.$$click = ()=>handleChange(currentPage() - 1);
|
|
79
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
80
|
+
get each () {
|
|
81
|
+
return tokens();
|
|
82
|
+
},
|
|
83
|
+
children: (token)=>(()=>{
|
|
84
|
+
var _el$1 = _tmpl$2();
|
|
85
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$1, "number" == typeof token ? (()=>{
|
|
86
|
+
var _el$10 = _tmpl$3();
|
|
87
|
+
_el$10.$$click = ()=>handleChange(token);
|
|
88
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-label", `Go to page ${token}`);
|
|
89
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$10, token);
|
|
90
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
91
|
+
var _v$3 = token === currentPage() ? "true" : void 0, _v$4 = token === currentPage() ? "page" : void 0, _v$5 = disabled();
|
|
92
|
+
_v$3 !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "data-active", _p$.e = _v$3);
|
|
93
|
+
_v$4 !== _p$.t && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-current", _p$.t = _v$4);
|
|
94
|
+
_v$5 !== _p$.a && (_el$10.disabled = _p$.a = _v$5);
|
|
95
|
+
return _p$;
|
|
96
|
+
}, {
|
|
97
|
+
e: void 0,
|
|
98
|
+
t: void 0,
|
|
99
|
+
a: void 0
|
|
100
|
+
});
|
|
101
|
+
return _el$10;
|
|
102
|
+
})() : _tmpl$4());
|
|
103
|
+
return _el$1;
|
|
104
|
+
})()
|
|
105
|
+
}), _el$9);
|
|
106
|
+
_el$0.$$click = ()=>handleChange(currentPage() + 1);
|
|
107
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
108
|
+
var _v$ = disabled() || currentPage() <= 1, _v$2 = disabled() || currentPage() >= safeTotal();
|
|
109
|
+
_v$ !== _p$.e && (_el$8.disabled = _p$.e = _v$);
|
|
110
|
+
_v$2 !== _p$.t && (_el$0.disabled = _p$.t = _v$2);
|
|
111
|
+
return _p$;
|
|
112
|
+
}, {
|
|
113
|
+
e: void 0,
|
|
114
|
+
t: void 0
|
|
115
|
+
});
|
|
116
|
+
return _el$;
|
|
117
|
+
})();
|
|
15
118
|
};
|
|
16
119
|
const pagination_Pagination = Pagination;
|
|
120
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
|
|
121
|
+
"click"
|
|
122
|
+
]);
|
|
17
123
|
export { pagination_Pagination as default };
|
|
@@ -2,11 +2,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__ from "../table/index.js";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__ from "../button/index.js";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__ from "../icon/index.js";
|
|
7
6
|
import * as __WEBPACK_EXTERNAL_MODULE__pagination_index_js_4cbbf7e7__ from "../pagination/index.js";
|
|
8
7
|
import * as __WEBPACK_EXTERNAL_MODULE__createStreamingTableStore_js_f1f78960__ from "./createStreamingTableStore.js";
|
|
9
|
-
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)(
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div class=mt-4>"), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><span>");
|
|
10
9
|
const StreamingTable = (props)=>{
|
|
11
10
|
const [local, tableProps] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
12
11
|
"data",
|
|
@@ -88,18 +87,18 @@ const StreamingTable = (props)=>{
|
|
|
88
87
|
});
|
|
89
88
|
});
|
|
90
89
|
const getColumnId = (col, index)=>col.id ?? col.accessorKey ?? `column-${index}`;
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
const sortDescriptor = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
|
|
91
|
+
const sorting = sortingState();
|
|
92
|
+
if (!sorting.columnId || !sorting.direction) return;
|
|
93
|
+
return {
|
|
94
|
+
column: sorting.columnId,
|
|
95
|
+
direction: "asc" === sorting.direction ? "ascending" : "descending"
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
const handleSortChange = (descriptor)=>{
|
|
100
99
|
setSortingState({
|
|
101
|
-
columnId:
|
|
102
|
-
direction:
|
|
100
|
+
columnId: descriptor.column,
|
|
101
|
+
direction: "ascending" === descriptor.direction ? "asc" : "desc"
|
|
103
102
|
});
|
|
104
103
|
};
|
|
105
104
|
const getSortValue = (row, col)=>{
|
|
@@ -140,17 +139,15 @@ const StreamingTable = (props)=>{
|
|
|
140
139
|
});
|
|
141
140
|
return sorted;
|
|
142
141
|
});
|
|
143
|
-
const renderSortIndicator = (
|
|
144
|
-
if (!local.enableSorting
|
|
145
|
-
|
|
146
|
-
const sorting = sortingState();
|
|
147
|
-
if (sorting.columnId !== columnId || !sorting.direction) return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
|
|
142
|
+
const renderSortIndicator = (sortDirection)=>{
|
|
143
|
+
if (!local.enableSorting) return null;
|
|
144
|
+
if (!sortDirection) return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
|
|
148
145
|
name: "icon-[mdi-light--unfold-more-horizontal]",
|
|
149
146
|
width: 16,
|
|
150
147
|
height: 16,
|
|
151
148
|
class: "opacity-30"
|
|
152
149
|
});
|
|
153
|
-
return "
|
|
150
|
+
return "ascending" === sortDirection ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__icon_index_js_1f7a158c__["default"], {
|
|
154
151
|
name: "icon-[mdi-light--chevron-up]",
|
|
155
152
|
width: 16,
|
|
156
153
|
height: 16
|
|
@@ -186,22 +183,6 @@ const StreamingTable = (props)=>{
|
|
|
186
183
|
const maxPage = totalPages() - 1;
|
|
187
184
|
if (page >= 0 && page <= maxPage) setCurrentPage(page);
|
|
188
185
|
};
|
|
189
|
-
const nextPage = ()=>goToPage(currentPage() + 1);
|
|
190
|
-
const prevPage = ()=>goToPage(currentPage() - 1);
|
|
191
|
-
const visiblePageNumbers = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
|
|
192
|
-
const total = totalPages();
|
|
193
|
-
const current = currentPage();
|
|
194
|
-
const pages = [];
|
|
195
|
-
if (total <= 5) for(let i = 0; i < total; i++)pages.push(i);
|
|
196
|
-
else {
|
|
197
|
-
let start = Math.max(0, current - 2);
|
|
198
|
-
let end = Math.min(total - 1, current + 2);
|
|
199
|
-
if (current < 2) end = Math.min(total - 1, 4);
|
|
200
|
-
else if (current > total - 3) start = Math.max(0, total - 5);
|
|
201
|
-
for(let i = start; i <= end; i++)pages.push(i);
|
|
202
|
-
}
|
|
203
|
-
return pages;
|
|
204
|
-
});
|
|
205
186
|
return (()=>{
|
|
206
187
|
var _el$ = _tmpl$2();
|
|
207
188
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"], (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
|
|
@@ -209,6 +190,10 @@ const StreamingTable = (props)=>{
|
|
|
209
190
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].ScrollContainer, {
|
|
210
191
|
get children () {
|
|
211
192
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Content, {
|
|
193
|
+
get sortDescriptor () {
|
|
194
|
+
return sortDescriptor();
|
|
195
|
+
},
|
|
196
|
+
onSortChange: handleSortChange,
|
|
212
197
|
get children () {
|
|
213
198
|
return [
|
|
214
199
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Header, {
|
|
@@ -220,16 +205,18 @@ const StreamingTable = (props)=>{
|
|
|
220
205
|
return local.columns;
|
|
221
206
|
},
|
|
222
207
|
children: (col, index)=>{
|
|
208
|
+
const columnId = getColumnId(col, index());
|
|
223
209
|
const isSortable = local.enableSorting && false !== col.enableSorting;
|
|
224
210
|
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__table_index_js_3c329fbb__["default"].Column, {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
211
|
+
id: columnId,
|
|
212
|
+
allowsSorting: isSortable,
|
|
213
|
+
children: ({ sortDirection })=>(()=>{
|
|
214
|
+
var _el$3 = _tmpl$3(), _el$4 = _el$3.firstChild;
|
|
215
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$3, isSortable ? "flex items-center gap-2 cursor-pointer select-none" : "");
|
|
216
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, ()=>col.header);
|
|
217
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>renderSortIndicator(isSortable ? sortDirection : void 0), null);
|
|
218
|
+
return _el$3;
|
|
219
|
+
})()
|
|
233
220
|
});
|
|
234
221
|
}
|
|
235
222
|
});
|
|
@@ -296,53 +283,16 @@ const StreamingTable = (props)=>{
|
|
|
296
283
|
return enablePagination && totalPages() > 0;
|
|
297
284
|
},
|
|
298
285
|
get children () {
|
|
299
|
-
var _el$2 = _tmpl$()
|
|
300
|
-
_el$6.nextSibling;
|
|
286
|
+
var _el$2 = _tmpl$();
|
|
301
287
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__pagination_index_js_4cbbf7e7__["default"], {
|
|
302
|
-
get
|
|
303
|
-
return
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
size: "sm",
|
|
311
|
-
variant: "ghost",
|
|
312
|
-
children: "\xAB"
|
|
313
|
-
}),
|
|
314
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
315
|
-
get each () {
|
|
316
|
-
return visiblePageNumbers();
|
|
317
|
-
},
|
|
318
|
-
children: (pageNum)=>{
|
|
319
|
-
const isActive = ()=>pageNum === currentPage();
|
|
320
|
-
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__["default"], {
|
|
321
|
-
class: "join-item",
|
|
322
|
-
onClick: ()=>goToPage(pageNum),
|
|
323
|
-
size: "sm",
|
|
324
|
-
get variant () {
|
|
325
|
-
return isActive() ? "primary" : "ghost";
|
|
326
|
-
},
|
|
327
|
-
children: pageNum + 1
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}),
|
|
331
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE__button_index_js_557db1f7__["default"], {
|
|
332
|
-
class: "join-item",
|
|
333
|
-
onClick: nextPage,
|
|
334
|
-
get isDisabled () {
|
|
335
|
-
return currentPage() === totalPages() - 1;
|
|
336
|
-
},
|
|
337
|
-
size: "sm",
|
|
338
|
-
variant: "ghost",
|
|
339
|
-
children: "\xBB"
|
|
340
|
-
})
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
}), _el$3);
|
|
344
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>currentPage() + 1, _el$6);
|
|
345
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, totalPages, null);
|
|
288
|
+
get page () {
|
|
289
|
+
return currentPage() + 1;
|
|
290
|
+
},
|
|
291
|
+
get total () {
|
|
292
|
+
return totalPages();
|
|
293
|
+
},
|
|
294
|
+
onChange: (page)=>goToPage(page - 1)
|
|
295
|
+
}));
|
|
346
296
|
return _el$2;
|
|
347
297
|
}
|
|
348
298
|
}), null);
|
|
@@ -351,7 +301,4 @@ const StreamingTable = (props)=>{
|
|
|
351
301
|
})();
|
|
352
302
|
};
|
|
353
303
|
const streaming_table_StreamingTable = StreamingTable;
|
|
354
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
|
|
355
|
-
"click"
|
|
356
|
-
]);
|
|
357
304
|
export { streaming_table_StreamingTable as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./Table.css";
|
|
2
2
|
import { type Accessor, type JSX } from "solid-js";
|
|
3
3
|
import { type ColumnDef, type SortingState, type ColumnFiltersState, type PaginationState, type OnChangeFn, type ExpandedState } from "@tanstack/solid-table";
|
|
4
4
|
import { type TableRootProps } from "./Table";
|