@grucloud/bau-ui 0.301.0 → 0.302.0
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/accordion/accordion.js +36 -63
- package/alert/alert.js +14 -24
- package/alertStack/README.md +89 -0
- package/alertStack/alertStack.js +98 -28
- package/animate/animate.js +2 -0
- package/autocomplete/autocomplete.js +130 -164
- package/avatar/avatar.js +20 -25
- package/breadcrumbs/breadcrumbs.js +34 -30
- package/button/button.js +27 -41
- package/buttonGroup/buttonGroup.js +20 -27
- package/calendar/calendar.js +6 -12
- package/carousel/carousel.js +64 -47
- package/checkbox/checkbox.js +10 -13
- package/chip/chip.js +9 -0
- package/collapsible/collapsible.js +73 -47
- package/collapsible/index.d.ts +12 -1
- package/constants.d.ts +1 -0
- package/constants.js +4 -0
- package/divider/divider.js +1 -0
- package/drawer/drawer.js +48 -1
- package/drillDownMenu/drillDownMenu.js +90 -67
- package/dropdownMenu/dropdownMenu.js +29 -122
- package/fileInput/fileInput.js +4 -0
- package/globalStyle/globalStyle.js +75 -30
- package/input/input.js +35 -44
- package/inputSearch/inputSearch.js +26 -31
- package/lazy/lazy.js +8 -5
- package/linearProgress/linearProgress.js +12 -24
- package/list/list.js +2 -1
- package/loadingButton/loadingButton.js +29 -22
- package/modal/modal.js +38 -41
- package/multiSelect/multiSelect.js +84 -171
- package/package.json +13 -5
- package/paginationNavigation/paginationNavigation.js +8 -13
- package/popover/popover.js +5 -2
- package/radioButton/radioButton.js +10 -23
- package/radioButtonGroup/radioButtonGroup.js +15 -24
- package/resizable/resizable.js +74 -70
- package/select/select.js +84 -160
- package/selectNative/selectNative.js +2 -0
- package/slider/slider.js +6 -12
- package/spinner/spinner.js +37 -53
- package/stepper/stepper.js +23 -35
- package/switch/switch.js +28 -45
- package/tableOfContent/tableOfContent.js +55 -84
- package/tablePagination/tablePagination.js +39 -69
- package/tabs/tabs.js +95 -59
- package/textareaAutosize/textareaAutosize.js +13 -16
- package/themeSwitch/themeSwitch.js +27 -41
- package/toggle/index.d.ts +8 -1
- package/toggle/toggle.js +17 -9
- package/toggleGroup/toggleGroup.js +23 -28
- package/tooltip/tooltip.js +79 -94
- package/treeView/treeView.js +57 -25
- package/utils/control.js +20 -0
- package/utils/popupList.js +137 -0
- package/utils/urlChange.js +32 -0
- package/vite.config.js +48 -0
package/stepper/stepper.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Colors } from "../constants.js";
|
|
4
|
-
|
|
5
|
-
const colorsToCss = () => Colors.map((color) => ``).join("\n");
|
|
1
|
+
import { onUrlChange } from "../utils/urlChange.js";
|
|
6
2
|
|
|
7
3
|
export const NextUrl = (context, stepperName) => (nextStep, state) => {
|
|
8
4
|
const search = new URLSearchParams(context.window.location.search);
|
|
@@ -40,7 +36,8 @@ export default function (context, options = {}) {
|
|
|
40
36
|
color: inherit;
|
|
41
37
|
font-weight: var(--font-weight-semibold);
|
|
42
38
|
transition: all var(--transition-slow) ease-in-out;
|
|
43
|
-
|
|
39
|
+
/* The one of the variant: the text color goes with it */
|
|
40
|
+
background-color: inherit;
|
|
44
41
|
overflow: hidden;
|
|
45
42
|
& .step-number {
|
|
46
43
|
background-color: var(--color-primary);
|
|
@@ -79,7 +76,10 @@ export default function (context, options = {}) {
|
|
|
79
76
|
transform: none;
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
|
|
79
|
+
/* On the color of solid, the gray of the steps to come is not read */
|
|
80
|
+
&.solid > ul > .not-completed .step-label {
|
|
81
|
+
color: inherit;
|
|
82
|
+
}
|
|
83
83
|
&.stepper > section > .content {
|
|
84
84
|
visibility: hidden;
|
|
85
85
|
display: none;
|
|
@@ -91,35 +91,21 @@ export default function (context, options = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
`;
|
|
93
93
|
|
|
94
|
-
return function Stepper(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
...props
|
|
104
|
-
},
|
|
105
|
-
children,
|
|
106
|
-
] = toPropsAndChildren(args);
|
|
94
|
+
return function Stepper({
|
|
95
|
+
color,
|
|
96
|
+
variant = "plain",
|
|
97
|
+
size,
|
|
98
|
+
stepperDefs,
|
|
99
|
+
stepperName,
|
|
100
|
+
activeStepIndex = bau.state(0),
|
|
101
|
+
...props
|
|
102
|
+
}) {
|
|
107
103
|
const stepperState = bau.state(
|
|
108
104
|
stepperDefs.map((stepper, index) => ({ ...stepper, index }))
|
|
109
105
|
);
|
|
110
106
|
|
|
111
107
|
const stepsCreatedState = bau.state([]);
|
|
112
108
|
|
|
113
|
-
window.history.pushState = new Proxy(window.history.pushState, {
|
|
114
|
-
apply: (target, thisArg, argArray) => {
|
|
115
|
-
target.apply(thisArg, argArray);
|
|
116
|
-
const url = argArray[2] ?? "";
|
|
117
|
-
if (["?", "#"].includes(url[0])) {
|
|
118
|
-
hashchange();
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
|
|
123
109
|
const stepperCurrentState = bau.derive(
|
|
124
110
|
() => stepperState.val[activeStepIndex.val]
|
|
125
111
|
);
|
|
@@ -128,6 +114,9 @@ export default function (context, options = {}) {
|
|
|
128
114
|
const { Header, disabled, name, index } = stepper;
|
|
129
115
|
return li(
|
|
130
116
|
{
|
|
117
|
+
// The current step, for the screen readers
|
|
118
|
+
"aria-current": () =>
|
|
119
|
+
stepperCurrentState.val.name == name ? "step" : "false",
|
|
131
120
|
class: () => [
|
|
132
121
|
stepperCurrentState.val.name == name && "active",
|
|
133
122
|
activeStepIndex.val < index && "not-completed",
|
|
@@ -160,15 +149,14 @@ export default function (context, options = {}) {
|
|
|
160
149
|
};
|
|
161
150
|
|
|
162
151
|
hashchange();
|
|
152
|
+
let removeUrlListener;
|
|
163
153
|
|
|
164
154
|
return div(
|
|
165
155
|
{
|
|
166
|
-
bauMounted: (
|
|
167
|
-
window
|
|
168
|
-
},
|
|
169
|
-
bauUnmounted: () => {
|
|
170
|
-
window.removeEventListener("popstate", hashchange);
|
|
156
|
+
bauMounted: () => {
|
|
157
|
+
removeUrlListener = onUrlChange(window, hashchange);
|
|
171
158
|
},
|
|
159
|
+
bauUnmounted: () => removeUrlListener?.(),
|
|
172
160
|
class: [
|
|
173
161
|
"stepper",
|
|
174
162
|
variant,
|
package/switch/switch.js
CHANGED
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const colorsToCss = () =>
|
|
5
|
-
Colors.map(
|
|
6
|
-
(color) =>
|
|
7
|
-
`
|
|
8
|
-
&.switch.plain.${color} {
|
|
9
|
-
&::after {
|
|
10
|
-
background-color: var(--color-emphasis-400);
|
|
11
|
-
}
|
|
12
|
-
&:checked::after {
|
|
13
|
-
background-color: var(--color-${color});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
&.switch.outline.${color} {
|
|
17
|
-
&::after {
|
|
18
|
-
background-color: var(--color-emphasis-400);
|
|
19
|
-
}
|
|
20
|
-
&:checked::after {
|
|
21
|
-
background-color: var(--color-${color});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
&.switch.soft.${color} {
|
|
25
|
-
&::after {
|
|
26
|
-
background-color: var(--color-emphasis-400);
|
|
27
|
-
}
|
|
28
|
-
&:checked::after {
|
|
29
|
-
background-color: var(--color-${color});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
&.switch.solid.${color} {
|
|
33
|
-
background-color: var(--color-emphasis-800);
|
|
34
|
-
&::after {
|
|
35
|
-
background-color: var(--color-emphasis-400);
|
|
36
|
-
}
|
|
37
|
-
&:checked {
|
|
38
|
-
background-color: var(--color-${color}) ;
|
|
39
|
-
}
|
|
40
|
-
&:checked::after {
|
|
41
|
-
background-color: var(--color-emphasis-400);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
).join("\n");
|
|
2
|
+
import { ofColor } from "../constants.js";
|
|
46
3
|
|
|
47
4
|
export default function (context, options = {}) {
|
|
48
5
|
const { bau, css } = context;
|
|
@@ -71,6 +28,10 @@ export default function (context, options = {}) {
|
|
|
71
28
|
content: "";
|
|
72
29
|
transform: translate(0%, -50%);
|
|
73
30
|
}
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: 2px solid var(--color-primary);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
74
35
|
&:hover {
|
|
75
36
|
filter: brightness(var(--brightness-hover));
|
|
76
37
|
}
|
|
@@ -104,7 +65,28 @@ export default function (context, options = {}) {
|
|
|
104
65
|
width: 1.5rem;
|
|
105
66
|
height: 1.5rem;
|
|
106
67
|
}
|
|
107
|
-
${
|
|
68
|
+
&.switch:is(.plain, .outline, .soft)${ofColor} {
|
|
69
|
+
&::after {
|
|
70
|
+
background-color: var(--color-emphasis-500);
|
|
71
|
+
}
|
|
72
|
+
/* Light enough on the dark background */
|
|
73
|
+
&:checked::after {
|
|
74
|
+
background-color: var(--accent-text);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
&.switch.solid${ofColor} {
|
|
78
|
+
background-color: var(--color-emphasis-800);
|
|
79
|
+
&::after {
|
|
80
|
+
background-color: var(--color-emphasis-400);
|
|
81
|
+
}
|
|
82
|
+
&:checked {
|
|
83
|
+
background-color: var(--accent);
|
|
84
|
+
}
|
|
85
|
+
/* Light on the color of the track */
|
|
86
|
+
&:checked::after {
|
|
87
|
+
background-color: var(--color-content-inverse);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
108
90
|
`;
|
|
109
91
|
|
|
110
92
|
return function Switch(...args) {
|
|
@@ -119,6 +101,7 @@ export default function (context, options = {}) {
|
|
|
119
101
|
] = toPropsAndChildren(args);
|
|
120
102
|
return input(
|
|
121
103
|
{
|
|
104
|
+
role: "switch",
|
|
122
105
|
...props,
|
|
123
106
|
class: [
|
|
124
107
|
"switch",
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
-
|
|
3
1
|
export default function (context, options = {}) {
|
|
4
2
|
const { bau, css, window } = context;
|
|
5
3
|
const { nav, ul, li, a } = bau.tags;
|
|
6
4
|
const { headerSelector = "h2,h3" } = options;
|
|
7
5
|
const activeHeadingId = bau.state("no");
|
|
8
6
|
|
|
9
|
-
const debounce = (callback, wait) => {
|
|
10
|
-
let timeoutId = null;
|
|
11
|
-
return (...args) => {
|
|
12
|
-
window.clearTimeout(timeoutId);
|
|
13
|
-
timeoutId = window.setTimeout(() => callback(...args), wait);
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
7
|
const className = css`
|
|
18
8
|
grid-area: toc;
|
|
19
9
|
position: sticky;
|
|
@@ -58,90 +48,75 @@ export default function (context, options = {}) {
|
|
|
58
48
|
}
|
|
59
49
|
`;
|
|
60
50
|
|
|
61
|
-
const TocItem = ({ value, id, children
|
|
51
|
+
const TocItem = ({ value, id, children }) => {
|
|
52
|
+
const active = () => activeHeadingId.val == id;
|
|
62
53
|
const link = a({
|
|
63
|
-
class: () => (
|
|
64
|
-
href: `#${id}`,
|
|
54
|
+
class: () => [active() && "active"],
|
|
55
|
+
href: `#${encodeURIComponent(id)}`,
|
|
56
|
+
// The section read
|
|
57
|
+
"aria-current": () => (active() ? "location" : "false"),
|
|
65
58
|
});
|
|
66
59
|
link.innerHTML = value;
|
|
67
60
|
return li(
|
|
68
|
-
{ class: () => (
|
|
61
|
+
{ class: () => [active() && "active"] },
|
|
69
62
|
link,
|
|
70
63
|
children.length > 0 && ul(children.map(TocItem))
|
|
71
64
|
);
|
|
72
65
|
};
|
|
73
66
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
let parents = [parentNode];
|
|
84
|
-
[...headings].forEach((heading) => {
|
|
85
|
-
const level = headerLevel(heading);
|
|
86
|
-
heading.setAttribute("id", heading.textContent);
|
|
87
|
-
//TODO
|
|
88
|
-
if (heading.innerHTML.includes("<button")) {
|
|
89
|
-
return;
|
|
67
|
+
// The headings in a tree: each one under the last heading of a higher
|
|
68
|
+
// level before it
|
|
69
|
+
const createToc = (contentEl) => {
|
|
70
|
+
const root = { level: 0, children: [] };
|
|
71
|
+
const parents = [root];
|
|
72
|
+
for (const heading of contentEl.querySelectorAll(headerSelector)) {
|
|
73
|
+
// The id of the heading, else its text: the target of the link
|
|
74
|
+
if (!heading.id) {
|
|
75
|
+
heading.id = heading.textContent;
|
|
90
76
|
}
|
|
91
|
-
|
|
77
|
+
//TODO
|
|
78
|
+
if (heading.innerHTML.includes("<button")) continue;
|
|
79
|
+
const node = {
|
|
80
|
+
level: Number(heading.tagName[1]),
|
|
92
81
|
value: heading.innerHTML,
|
|
93
|
-
id: heading.id
|
|
82
|
+
id: heading.id,
|
|
94
83
|
children: [],
|
|
95
84
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
parentNode = nodeCurrent;
|
|
102
|
-
nodeCurrent.children.push(newNode);
|
|
103
|
-
nodeCurrent = newNode;
|
|
104
|
-
} else if (levelCurrent > level) {
|
|
105
|
-
parentNode = parents[level - 1];
|
|
106
|
-
parents = parents.slice(0, level - 1);
|
|
107
|
-
parentNode.children.push(newNode);
|
|
108
|
-
nodeCurrent = newNode;
|
|
109
|
-
}
|
|
110
|
-
levelCurrent = level;
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return tree;
|
|
85
|
+
while (parents.at(-1).level >= node.level) parents.pop();
|
|
86
|
+
parents.at(-1).children.push(node);
|
|
87
|
+
parents.push(node);
|
|
88
|
+
}
|
|
89
|
+
return root.children;
|
|
114
90
|
};
|
|
115
91
|
|
|
116
|
-
return function TableOfContent(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
92
|
+
return function TableOfContent({
|
|
93
|
+
size = options.size ?? "md",
|
|
94
|
+
variant = options.variant ?? "plain",
|
|
95
|
+
color = options.color ?? "neutral",
|
|
96
|
+
contentEl,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
// The first heading not scrolled out at the top, once the scroll
|
|
100
|
+
// pauses
|
|
101
|
+
let timeoutId;
|
|
102
|
+
const onscroll = () => {
|
|
103
|
+
clearTimeout(timeoutId);
|
|
104
|
+
timeoutId = setTimeout(() => {
|
|
105
|
+
const activeHeading = [
|
|
106
|
+
...contentEl.querySelectorAll(headerSelector),
|
|
107
|
+
].find((heading) => {
|
|
108
|
+
const { top, height } = heading.getBoundingClientRect();
|
|
109
|
+
return top + height > 60;
|
|
110
|
+
});
|
|
111
|
+
if (activeHeading) {
|
|
112
|
+
activeHeadingId.val = activeHeading.id;
|
|
136
113
|
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
activeHeadingId.val = activeHeading?.id;
|
|
140
|
-
}
|
|
141
|
-
}, 100);
|
|
114
|
+
}, 100);
|
|
115
|
+
};
|
|
142
116
|
|
|
143
117
|
return nav(
|
|
144
118
|
{
|
|
119
|
+
"aria-label": "Table of contents",
|
|
145
120
|
...props,
|
|
146
121
|
class: [
|
|
147
122
|
"tableOfContent",
|
|
@@ -149,17 +124,13 @@ export default function (context, options = {}) {
|
|
|
149
124
|
variant,
|
|
150
125
|
color,
|
|
151
126
|
className,
|
|
152
|
-
options
|
|
153
|
-
props
|
|
127
|
+
options.class,
|
|
128
|
+
props.class,
|
|
154
129
|
],
|
|
155
|
-
bauMounted: (
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
bauUnmounted: (/*{ element }*/) => {
|
|
159
|
-
window.removeEventListener("scroll", handleScroll);
|
|
160
|
-
},
|
|
130
|
+
bauMounted: () => window.addEventListener("scroll", onscroll),
|
|
131
|
+
bauUnmounted: () => window.removeEventListener("scroll", onscroll),
|
|
161
132
|
},
|
|
162
|
-
|
|
133
|
+
ul(createToc(contentEl).map(TocItem))
|
|
163
134
|
);
|
|
164
135
|
};
|
|
165
136
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
1
|
import button from "../button/button.js";
|
|
3
2
|
import buttonGroup from "../buttonGroup/buttonGroup.js";
|
|
4
3
|
|
|
@@ -26,83 +25,45 @@ export default function (context, options = {}) {
|
|
|
26
25
|
}
|
|
27
26
|
`;
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
Button({ "aria-label": label, title: label, ...props }, icon);
|
|
31
|
-
|
|
28
|
+
// The rows shown, and of how many when the total is known
|
|
32
29
|
const PagesNumbers = ({ count, totalCount, page, rowsPerPage }) =>
|
|
33
|
-
div(
|
|
34
|
-
{ class: "pages-numbers" },
|
|
35
|
-
Number(page - 1) * Number(rowsPerPage) + (count > 0 ? 1 : 0),
|
|
36
|
-
"-",
|
|
37
|
-
Math.min(page * rowsPerPage, totalCount),
|
|
38
|
-
" of ",
|
|
39
|
-
totalCount
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const PagesNumbersNoTotal = ({ count, page, rowsPerPage }) =>
|
|
43
30
|
div(
|
|
44
31
|
{ class: "pages-numbers" },
|
|
45
32
|
(page - 1) * rowsPerPage + (count > 0 ? 1 : 0),
|
|
46
33
|
"-",
|
|
47
|
-
|
|
34
|
+
totalCount > 0
|
|
35
|
+
? [Math.min(page * rowsPerPage, totalCount), " of ", totalCount]
|
|
36
|
+
: page * rowsPerPage
|
|
48
37
|
);
|
|
49
38
|
|
|
50
39
|
const isFirstPage = (page) => page <= 1;
|
|
51
40
|
const isLastPage = (page, count, rowsPerPage) =>
|
|
52
41
|
page >= Math.ceil(count / rowsPerPage);
|
|
53
42
|
|
|
54
|
-
return function TablePagination(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
...props
|
|
71
|
-
},
|
|
72
|
-
] = toPropsAndChildren(args);
|
|
43
|
+
return function TablePagination({
|
|
44
|
+
size = options.size ?? "md",
|
|
45
|
+
variant = options.variant ?? "outline",
|
|
46
|
+
color = options.color ?? "neutral",
|
|
47
|
+
count = 0,
|
|
48
|
+
totalCount = 0,
|
|
49
|
+
page = 1,
|
|
50
|
+
rowsPerPage = 50,
|
|
51
|
+
onPageChange,
|
|
52
|
+
isLoading = false,
|
|
53
|
+
disableFirst = () => isFirstPage(page),
|
|
54
|
+
disablePrevious = () => isFirstPage(page),
|
|
55
|
+
disableNext = () => isLastPage(page, totalCount, rowsPerPage),
|
|
56
|
+
disableLast = () => isLastPage(page, totalCount, rowsPerPage),
|
|
57
|
+
...props
|
|
58
|
+
}) {
|
|
73
59
|
const maxPages = Math.max(0, Math.ceil(totalCount / rowsPerPage));
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
const onclickPrevious = onPageChange({ page: page - 1 });
|
|
77
|
-
const onclickNext = onPageChange({ page: page + 1 });
|
|
78
|
-
const onclickLast = onPageChange({
|
|
79
|
-
page: maxPages,
|
|
80
|
-
});
|
|
61
|
+
// Its label, icon, the page it goes to, disabled or not
|
|
81
62
|
const actions = [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
disabled: disableFirst(),
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: "Previous",
|
|
90
|
-
icon: "\u27E8",
|
|
91
|
-
onclick: onclickPrevious,
|
|
92
|
-
disabled: disablePrevious(),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
label: "Next",
|
|
96
|
-
icon: "\u27E9",
|
|
97
|
-
onclick: onclickNext,
|
|
98
|
-
disabled: disableNext(),
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: "Last",
|
|
102
|
-
icon: "\u27EB",
|
|
103
|
-
onclick: onclickLast,
|
|
104
|
-
disabled: disableLast(),
|
|
105
|
-
},
|
|
63
|
+
["First", "\u27EA", 1, disableFirst()],
|
|
64
|
+
["Previous", "\u27E8", page - 1, disablePrevious()],
|
|
65
|
+
["Next", "\u27E9", page + 1, disableNext()],
|
|
66
|
+
["Last", "\u27EB", maxPages, disableLast()],
|
|
106
67
|
];
|
|
107
68
|
|
|
108
69
|
return div(
|
|
@@ -117,13 +78,22 @@ export default function (context, options = {}) {
|
|
|
117
78
|
],
|
|
118
79
|
},
|
|
119
80
|
Spinner({ class: "spinner", visibility: isLoading, size: "md" }),
|
|
120
|
-
totalCount
|
|
121
|
-
? PagesNumbers({ count, totalCount, page, maxPages, rowsPerPage })
|
|
122
|
-
: PagesNumbersNoTotal({ count, page, maxPages, rowsPerPage }),
|
|
123
|
-
|
|
81
|
+
PagesNumbers({ count, totalCount, page, rowsPerPage }),
|
|
124
82
|
ButtonGroup(
|
|
125
83
|
{ variant, color },
|
|
126
|
-
actions.map((
|
|
84
|
+
actions.map(([label, icon, page, disabled]) =>
|
|
85
|
+
Button(
|
|
86
|
+
{
|
|
87
|
+
"aria-label": label,
|
|
88
|
+
title: label,
|
|
89
|
+
onclick: onPageChange({ page }),
|
|
90
|
+
disabled,
|
|
91
|
+
variant,
|
|
92
|
+
color,
|
|
93
|
+
},
|
|
94
|
+
icon
|
|
95
|
+
)
|
|
96
|
+
)
|
|
127
97
|
)
|
|
128
98
|
);
|
|
129
99
|
};
|