universe-code 0.0.91 → 0.0.92
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/uiux/table/index.js +42 -36
- package/package.json +1 -1
package/dist/uiux/table/index.js
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
class UniverseDataTable {
|
|
2
|
+
constructor({
|
|
3
|
+
container,
|
|
4
|
+
apiData = [],
|
|
5
|
+
columns = [],
|
|
6
|
+
pagination = {},
|
|
7
|
+
jumpToPage = "",
|
|
8
|
+
shouldEnableJumpToPage = false,
|
|
9
|
+
handleJumpToPage = () => { },
|
|
10
|
+
handleKeyPress = () => { },
|
|
11
|
+
handlePageChange = () => { },
|
|
12
|
+
shouldShowPagination = true,
|
|
13
|
+
}) {
|
|
14
|
+
if (!container) throw new Error("UniverseDataTable: container is required");
|
|
15
|
+
if (typeof document !== "undefined") {
|
|
16
|
+
this.injectStyles();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.container = container;
|
|
20
|
+
this.apiData = apiData;
|
|
21
|
+
this.columns = columns;
|
|
22
|
+
this.pagination = pagination;
|
|
23
|
+
|
|
24
|
+
this.jumpToPage = jumpToPage;
|
|
25
|
+
this.shouldEnableJumpToPage = shouldEnableJumpToPage;
|
|
26
|
+
this.handleJumpToPage = handleJumpToPage;
|
|
27
|
+
this.handleKeyPress = handleKeyPress;
|
|
28
|
+
this.handlePageChange = handlePageChange;
|
|
29
|
+
|
|
30
|
+
this.shouldShowPagination = shouldShowPagination;
|
|
31
|
+
|
|
32
|
+
this.render();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
injectStyles() {
|
|
36
|
+
if (document.getElementById("udt-style")) return;
|
|
37
|
+
|
|
38
|
+
const style = document.createElement("style");
|
|
39
|
+
style.id = "udt-style";
|
|
40
|
+
style.textContent = `
|
|
4
41
|
/* Container & Table */
|
|
5
42
|
.udt-container {
|
|
6
43
|
background-color: #fff;
|
|
@@ -179,39 +216,8 @@ style.textContent = `
|
|
|
179
216
|
}
|
|
180
217
|
}
|
|
181
218
|
`;
|
|
182
|
-
document.head.appendChild(style);
|
|
183
|
-
|
|
184
|
-
// UniverseDataTable Class
|
|
185
|
-
class UniverseDataTable {
|
|
186
|
-
constructor({
|
|
187
|
-
container,
|
|
188
|
-
apiData = [],
|
|
189
|
-
columns = [],
|
|
190
|
-
pagination = {},
|
|
191
|
-
jumpToPage = "",
|
|
192
|
-
shouldEnableJumpToPage = false,
|
|
193
|
-
handleJumpToPage = () => { },
|
|
194
|
-
handleKeyPress = () => { },
|
|
195
|
-
handlePageChange = () => { },
|
|
196
|
-
shouldShowPagination = true,
|
|
197
|
-
}) {
|
|
198
|
-
if (!container) throw new Error("UniverseDataTable: container is required");
|
|
199
|
-
|
|
200
|
-
this.container = container;
|
|
201
|
-
this.apiData = apiData;
|
|
202
|
-
this.columns = columns;
|
|
203
|
-
this.pagination = pagination;
|
|
204
|
-
|
|
205
|
-
this.jumpToPage = jumpToPage;
|
|
206
|
-
this.shouldEnableJumpToPage = shouldEnableJumpToPage;
|
|
207
|
-
this.handleJumpToPage = handleJumpToPage;
|
|
208
|
-
this.handleKeyPress = handleKeyPress;
|
|
209
|
-
this.handlePageChange = handlePageChange;
|
|
210
|
-
|
|
211
|
-
this.shouldShowPagination = shouldShowPagination;
|
|
212
|
-
|
|
213
|
-
this.render();
|
|
214
|
-
}
|
|
219
|
+
document.head.appendChild(style);
|
|
220
|
+
}
|
|
215
221
|
|
|
216
222
|
th(label) {
|
|
217
223
|
return `<th class="udt-th">${label}</th>`;
|