react-hrnet-table-gandrica 1.0.0 → 1.0.2
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,14 +1,12 @@
|
|
|
1
1
|
import { Provider as e, useDispatch as t, useSelector as n } from "react-redux";
|
|
2
2
|
import { configureStore as r, createSlice as i } from "@reduxjs/toolkit";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
8
|
-
}), c = (e, t) => t ? e.filter((e) => Object.values(e).map((e) => e.toString().toLowerCase()).some((e) => e.includes(t.toLowerCase()))) : e, l = (e, t) => t?.key ? [...e].sort((e, n) => {
|
|
3
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import { useState as c } from "react";
|
|
5
|
+
//#region src/utils/utils.js
|
|
6
|
+
var l = (e, t) => t ? e.filter((e) => Object.values(e).map((e) => e.toString().toLowerCase()).some((e) => e.includes(t.toLowerCase()))) : e, u = (e, t) => t?.key ? [...e].sort((e, n) => {
|
|
9
7
|
let r = e[t.key], i = n[t.key];
|
|
10
8
|
return r < i ? t.direction === "asc" ? -1 : 1 : r > i ? t.direction === "asc" ? 1 : -1 : 0;
|
|
11
|
-
}) : e,
|
|
9
|
+
}) : e, d = (e, t, n) => {
|
|
12
10
|
if (!Array.isArray(e)) return [];
|
|
13
11
|
let r = Math.max(0, (t - 1) * n), i = Math.min(r + n, e.length), a = e.slice(r, i);
|
|
14
12
|
return console.log(r, i), {
|
|
@@ -16,7 +14,7 @@ var o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
16
14
|
startIndex: r,
|
|
17
15
|
endIndex: i
|
|
18
16
|
};
|
|
19
|
-
},
|
|
17
|
+
}, f = i({
|
|
20
18
|
name: "table",
|
|
21
19
|
initialState: {
|
|
22
20
|
searchResult: "",
|
|
@@ -29,231 +27,55 @@ var o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
29
27
|
},
|
|
30
28
|
reducers: {
|
|
31
29
|
setList: (e, t) => {
|
|
32
|
-
e.initialList = t.payload.list, e.tableHeaders = t.payload.tableHeaders, e.currentList = e.initialList, e.listSliced =
|
|
30
|
+
e.initialList = t.payload.list, e.tableHeaders = t.payload.tableHeaders, e.currentList = e.initialList, e.listSliced = d(e.currentList, e.currentPage, e.entriesPerPage), e.listToDisplay = e.listSliced.slice;
|
|
33
31
|
},
|
|
34
32
|
setSearchResult: (e, t) => {
|
|
35
|
-
e.searchResult = t.payload, e.currentPage = 1, e.currentList =
|
|
33
|
+
e.searchResult = t.payload, e.currentPage = 1, e.currentList = l(e.initialList, t.payload), e.listSliced = d(e.currentList, e.currentPage, e.entriesPerPage), e.listToDisplay = e.listSliced.slice;
|
|
36
34
|
},
|
|
37
35
|
setCurrentPage: (e, t) => {
|
|
38
|
-
e.currentPage = t.payload, e.listSliced =
|
|
36
|
+
e.currentPage = t.payload, e.listSliced = d(e.currentList, e.currentPage, e.entriesPerPage), e.listToDisplay = e.listSliced.slice;
|
|
39
37
|
},
|
|
40
38
|
setEntriesPerPage: (e, t) => {
|
|
41
|
-
e.searchResult = "", e.currentPage = 1, e.entriesPerPage = t.payload, e.listSliced =
|
|
39
|
+
e.searchResult = "", e.currentPage = 1, e.entriesPerPage = t.payload, e.listSliced = d(e.currentList, e.currentPage, e.entriesPerPage), e.listToDisplay = e.listSliced.slice;
|
|
42
40
|
},
|
|
43
41
|
setSortConfig: (e, t) => {
|
|
44
|
-
e.sortConfig = t.payload, e.listToDisplay =
|
|
42
|
+
e.sortConfig = t.payload, e.listToDisplay = u(e.listToDisplay, t.payload);
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
|
-
}), { setList:
|
|
48
|
-
|
|
49
|
-
console.log("State updated:",
|
|
45
|
+
}), { setList: p, setSearchResult: m, setCurrentPage: h, setEntriesPerPage: g, setSortConfig: _ } = f.actions, v = f.reducer, y = r({ reducer: { table: v } });
|
|
46
|
+
y.subscribe(() => {
|
|
47
|
+
console.log("State updated:", y.getState());
|
|
50
48
|
});
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
56
|
-
else r = n;
|
|
57
|
-
return n = r.ref, {
|
|
58
|
-
$$typeof: t,
|
|
59
|
-
type: e,
|
|
60
|
-
key: i,
|
|
61
|
-
ref: n === void 0 ? null : n,
|
|
62
|
-
props: r
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
66
|
-
})), x = /* @__PURE__ */ o(((e) => {
|
|
67
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
68
|
-
function t(e) {
|
|
69
|
-
if (e == null) return null;
|
|
70
|
-
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
71
|
-
if (typeof e == "string") return e;
|
|
72
|
-
switch (e) {
|
|
73
|
-
case v: return "Fragment";
|
|
74
|
-
case b: return "Profiler";
|
|
75
|
-
case y: return "StrictMode";
|
|
76
|
-
case w: return "Suspense";
|
|
77
|
-
case T: return "SuspenseList";
|
|
78
|
-
case O: return "Activity";
|
|
79
|
-
}
|
|
80
|
-
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
81
|
-
case _: return "Portal";
|
|
82
|
-
case S: return e.displayName || "Context";
|
|
83
|
-
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
84
|
-
case C:
|
|
85
|
-
var n = e.render;
|
|
86
|
-
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
87
|
-
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
88
|
-
case D:
|
|
89
|
-
n = e._payload, e = e._init;
|
|
90
|
-
try {
|
|
91
|
-
return t(e(n));
|
|
92
|
-
} catch {}
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
function n(e) {
|
|
97
|
-
return "" + e;
|
|
98
|
-
}
|
|
99
|
-
function r(e) {
|
|
100
|
-
try {
|
|
101
|
-
n(e);
|
|
102
|
-
var t = !1;
|
|
103
|
-
} catch {
|
|
104
|
-
t = !0;
|
|
105
|
-
}
|
|
106
|
-
if (t) {
|
|
107
|
-
t = console;
|
|
108
|
-
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
109
|
-
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function i(e) {
|
|
113
|
-
if (e === v) return "<>";
|
|
114
|
-
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
115
|
-
try {
|
|
116
|
-
var n = t(e);
|
|
117
|
-
return n ? "<" + n + ">" : "<...>";
|
|
118
|
-
} catch {
|
|
119
|
-
return "<...>";
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function a() {
|
|
123
|
-
var e = A.A;
|
|
124
|
-
return e === null ? null : e.getOwner();
|
|
125
|
-
}
|
|
126
|
-
function o() {
|
|
127
|
-
return Error("react-stack-top-frame");
|
|
128
|
-
}
|
|
129
|
-
function c(e) {
|
|
130
|
-
if (j.call(e, "key")) {
|
|
131
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
|
-
if (t && t.isReactWarning) return !1;
|
|
133
|
-
}
|
|
134
|
-
return e.key !== void 0;
|
|
135
|
-
}
|
|
136
|
-
function l(e, t) {
|
|
137
|
-
function n() {
|
|
138
|
-
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
139
|
-
}
|
|
140
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
141
|
-
get: n,
|
|
142
|
-
configurable: !0
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function u() {
|
|
146
|
-
var e = t(this.type);
|
|
147
|
-
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
148
|
-
}
|
|
149
|
-
function d(e, t, n, r, i, a) {
|
|
150
|
-
var o = n.ref;
|
|
151
|
-
return e = {
|
|
152
|
-
$$typeof: g,
|
|
153
|
-
type: e,
|
|
154
|
-
key: t,
|
|
155
|
-
props: n,
|
|
156
|
-
_owner: r
|
|
157
|
-
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
158
|
-
enumerable: !1,
|
|
159
|
-
value: null
|
|
160
|
-
}) : Object.defineProperty(e, "ref", {
|
|
161
|
-
enumerable: !1,
|
|
162
|
-
get: u
|
|
163
|
-
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
|
-
configurable: !1,
|
|
165
|
-
enumerable: !1,
|
|
166
|
-
writable: !0,
|
|
167
|
-
value: 0
|
|
168
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
169
|
-
configurable: !1,
|
|
170
|
-
enumerable: !1,
|
|
171
|
-
writable: !0,
|
|
172
|
-
value: null
|
|
173
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
174
|
-
configurable: !1,
|
|
175
|
-
enumerable: !1,
|
|
176
|
-
writable: !0,
|
|
177
|
-
value: i
|
|
178
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
179
|
-
configurable: !1,
|
|
180
|
-
enumerable: !1,
|
|
181
|
-
writable: !0,
|
|
182
|
-
value: a
|
|
183
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
|
-
}
|
|
185
|
-
function f(e, n, i, o, s, u) {
|
|
186
|
-
var f = n.children;
|
|
187
|
-
if (f !== void 0) {
|
|
188
|
-
if (o) {
|
|
189
|
-
if (M(f)) {
|
|
190
|
-
for (o = 0; o < f.length; o++) p(f[o]);
|
|
191
|
-
Object.freeze && Object.freeze(f);
|
|
192
|
-
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
193
|
-
} else p(f);
|
|
194
|
-
}
|
|
195
|
-
if (j.call(n, "key")) {
|
|
196
|
-
f = t(e);
|
|
197
|
-
var m = Object.keys(n).filter(function(e) {
|
|
198
|
-
return e !== "key";
|
|
199
|
-
});
|
|
200
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
201
|
-
}
|
|
202
|
-
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
203
|
-
else i = n;
|
|
204
|
-
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), s, u);
|
|
205
|
-
}
|
|
206
|
-
function p(e) {
|
|
207
|
-
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
208
|
-
}
|
|
209
|
-
function m(e) {
|
|
210
|
-
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
211
|
-
}
|
|
212
|
-
var h = s("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
213
|
-
return null;
|
|
214
|
-
};
|
|
215
|
-
h = { react_stack_bottom_frame: function(e) {
|
|
216
|
-
return e();
|
|
217
|
-
} };
|
|
218
|
-
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
|
|
219
|
-
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
220
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
221
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
222
|
-
}, e.jsxs = function(e, t, n) {
|
|
223
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
224
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
225
|
-
};
|
|
226
|
-
})();
|
|
227
|
-
})), S = (/* @__PURE__ */ o(((e, t) => {
|
|
228
|
-
t.exports = process.env.NODE_ENV === "production" ? b() : x();
|
|
229
|
-
})))();
|
|
230
|
-
function C() {
|
|
49
|
+
var b = { entriesControl: "_entriesControl_h5mt7_2" };
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/components/entries/Entries.jsx
|
|
52
|
+
function x() {
|
|
231
53
|
let e = t(), r = n((e) => e.table.entriesPerPage) || 10;
|
|
232
|
-
return /* @__PURE__ */ (
|
|
233
|
-
className:
|
|
234
|
-
children: /* @__PURE__ */ (
|
|
54
|
+
return /* @__PURE__ */ o("div", {
|
|
55
|
+
className: b.entriesControl,
|
|
56
|
+
children: /* @__PURE__ */ s("label", { children: [
|
|
235
57
|
"Show",
|
|
236
|
-
/* @__PURE__ */ (
|
|
58
|
+
/* @__PURE__ */ s("select", {
|
|
237
59
|
name: "table-entries",
|
|
238
60
|
id: "table-entries",
|
|
239
61
|
value: r,
|
|
240
62
|
onChange: (t) => {
|
|
241
|
-
e(
|
|
63
|
+
e(g(Number(t.target.value)));
|
|
242
64
|
},
|
|
243
65
|
children: [
|
|
244
|
-
/* @__PURE__ */ (
|
|
66
|
+
/* @__PURE__ */ o("option", {
|
|
245
67
|
value: "10",
|
|
246
68
|
children: "10"
|
|
247
69
|
}),
|
|
248
|
-
/* @__PURE__ */ (
|
|
70
|
+
/* @__PURE__ */ o("option", {
|
|
249
71
|
value: "25",
|
|
250
72
|
children: "25"
|
|
251
73
|
}),
|
|
252
|
-
/* @__PURE__ */ (
|
|
74
|
+
/* @__PURE__ */ o("option", {
|
|
253
75
|
value: "50",
|
|
254
76
|
children: "50"
|
|
255
77
|
}),
|
|
256
|
-
/* @__PURE__ */ (
|
|
78
|
+
/* @__PURE__ */ o("option", {
|
|
257
79
|
value: "100",
|
|
258
80
|
children: "100"
|
|
259
81
|
})
|
|
@@ -265,52 +87,52 @@ function C() {
|
|
|
265
87
|
}
|
|
266
88
|
//#endregion
|
|
267
89
|
//#region src/components/searchBar/SearchBar.jsx
|
|
268
|
-
function
|
|
269
|
-
let [e, n] =
|
|
270
|
-
return /* @__PURE__ */ (
|
|
90
|
+
function S() {
|
|
91
|
+
let [e, n] = c(""), r = t();
|
|
92
|
+
return /* @__PURE__ */ s("label", { children: [
|
|
271
93
|
"Search:",
|
|
272
94
|
" ",
|
|
273
|
-
/* @__PURE__ */ (
|
|
95
|
+
/* @__PURE__ */ o("input", {
|
|
274
96
|
type: "search",
|
|
275
97
|
value: e,
|
|
276
98
|
onChange: (e) => {
|
|
277
|
-
n(e.target.value), r(
|
|
99
|
+
n(e.target.value), r(m(e.target.value));
|
|
278
100
|
},
|
|
279
101
|
"aria-controls": "employee-table"
|
|
280
102
|
})
|
|
281
103
|
] });
|
|
282
104
|
}
|
|
283
|
-
var
|
|
105
|
+
var C = {
|
|
284
106
|
cellHeader: "_cellHeader_mvi5q_1",
|
|
285
107
|
sortIcon: "_sortIcon_mvi5q_5",
|
|
286
108
|
sortArrows: "_sortArrows_mvi5q_15"
|
|
287
109
|
};
|
|
288
110
|
//#endregion
|
|
289
111
|
//#region src/components/tableCellHeader/TableCellHeader.jsx
|
|
290
|
-
function
|
|
291
|
-
let r = t(), i = n((e) => e.table.sortConfig), a = Object.keys(e)[0],
|
|
112
|
+
function w({ header: e }) {
|
|
113
|
+
let r = t(), i = n((e) => e.table.sortConfig), a = Object.keys(e)[0], c = e[a], l = () => {
|
|
292
114
|
let e = "asc";
|
|
293
|
-
i?.key === a && (e = i.direction === "asc" ? "desc" : "asc"), r(
|
|
115
|
+
i?.key === a && (e = i.direction === "asc" ? "desc" : "asc"), r(_({
|
|
294
116
|
key: a,
|
|
295
117
|
direction: e
|
|
296
118
|
}));
|
|
297
|
-
},
|
|
298
|
-
return /* @__PURE__ */ (
|
|
299
|
-
className:
|
|
300
|
-
onClick:
|
|
301
|
-
children: [/* @__PURE__ */ (
|
|
302
|
-
className:
|
|
303
|
-
children: [/* @__PURE__ */ (
|
|
304
|
-
className:
|
|
119
|
+
}, u = i?.key === a, d = u && i.direction === "asc", f = u && i.direction === "desc";
|
|
120
|
+
return /* @__PURE__ */ s("th", {
|
|
121
|
+
className: C.cellHeader,
|
|
122
|
+
onClick: l,
|
|
123
|
+
children: [/* @__PURE__ */ o("span", { children: c }), /* @__PURE__ */ s("span", {
|
|
124
|
+
className: C.sortIcon,
|
|
125
|
+
children: [/* @__PURE__ */ o("span", {
|
|
126
|
+
className: C.sortArrows,
|
|
305
127
|
style: {
|
|
306
|
-
opacity:
|
|
128
|
+
opacity: d ? 1 : .3,
|
|
307
129
|
color: "#6366f1"
|
|
308
130
|
},
|
|
309
131
|
children: "▲"
|
|
310
|
-
}), /* @__PURE__ */ (
|
|
311
|
-
className:
|
|
132
|
+
}), /* @__PURE__ */ o("span", {
|
|
133
|
+
className: C.sortArrows,
|
|
312
134
|
style: {
|
|
313
|
-
opacity:
|
|
135
|
+
opacity: f ? 1 : .3,
|
|
314
136
|
color: "#6366f1"
|
|
315
137
|
},
|
|
316
138
|
children: "▼"
|
|
@@ -320,40 +142,40 @@ function E({ header: e }) {
|
|
|
320
142
|
}
|
|
321
143
|
//#endregion
|
|
322
144
|
//#region src/components/tableListHeader/TableListHeader.jsx
|
|
323
|
-
function
|
|
145
|
+
function T() {
|
|
324
146
|
let e = n((e) => e.table.tableHeaders);
|
|
325
|
-
return /* @__PURE__ */ (
|
|
147
|
+
return /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: e.map((e, t) => /* @__PURE__ */ o(w, { header: e }, t)) }) });
|
|
326
148
|
}
|
|
327
149
|
//#endregion
|
|
328
150
|
//#region src/components/tableListBody/TableListBody.jsx
|
|
329
|
-
function
|
|
151
|
+
function E() {
|
|
330
152
|
let e = n((e) => e.table.listToDisplay);
|
|
331
|
-
return /* @__PURE__ */ (
|
|
332
|
-
/* @__PURE__ */ (
|
|
333
|
-
/* @__PURE__ */ (
|
|
334
|
-
/* @__PURE__ */ (
|
|
335
|
-
/* @__PURE__ */ (
|
|
336
|
-
/* @__PURE__ */ (
|
|
337
|
-
/* @__PURE__ */ (
|
|
338
|
-
/* @__PURE__ */ (
|
|
339
|
-
/* @__PURE__ */ (
|
|
340
|
-
/* @__PURE__ */ (
|
|
153
|
+
return /* @__PURE__ */ o("tbody", { children: e.map((e, t) => /* @__PURE__ */ s("tr", { children: [
|
|
154
|
+
/* @__PURE__ */ o("td", { children: e.firstName }),
|
|
155
|
+
/* @__PURE__ */ o("td", { children: e.lastName }),
|
|
156
|
+
/* @__PURE__ */ o("td", { children: e.startDate }),
|
|
157
|
+
/* @__PURE__ */ o("td", { children: e.department }),
|
|
158
|
+
/* @__PURE__ */ o("td", { children: e.birthDate }),
|
|
159
|
+
/* @__PURE__ */ o("td", { children: e.street }),
|
|
160
|
+
/* @__PURE__ */ o("td", { children: e.city }),
|
|
161
|
+
/* @__PURE__ */ o("td", { children: e.state }),
|
|
162
|
+
/* @__PURE__ */ o("td", { children: e.zipCode })
|
|
341
163
|
] }, t)) });
|
|
342
164
|
}
|
|
343
|
-
var
|
|
165
|
+
var D = { table: "_table_gudt1_1" };
|
|
344
166
|
//#endregion
|
|
345
167
|
//#region src/components/tableList/TableList.jsx
|
|
346
|
-
function
|
|
347
|
-
return /* @__PURE__ */ (
|
|
348
|
-
className:
|
|
349
|
-
children: [/* @__PURE__ */ (
|
|
168
|
+
function O() {
|
|
169
|
+
return /* @__PURE__ */ s("table", {
|
|
170
|
+
className: D.table,
|
|
171
|
+
children: [/* @__PURE__ */ o(T, {}), /* @__PURE__ */ o(E, {})]
|
|
350
172
|
});
|
|
351
173
|
}
|
|
352
174
|
//#endregion
|
|
353
175
|
//#region src/components/entriesDisplay/EntriesDisplay.jsx
|
|
354
|
-
function
|
|
176
|
+
function k() {
|
|
355
177
|
let e = n((e) => e.table), t = e.listSliced.startIndex + 1, r = e.listSliced.endIndex, i = e.currentList.length;
|
|
356
|
-
return /* @__PURE__ */ (
|
|
178
|
+
return /* @__PURE__ */ s("p", { children: [
|
|
357
179
|
"Showing ",
|
|
358
180
|
t,
|
|
359
181
|
" to ",
|
|
@@ -363,59 +185,59 @@ function j() {
|
|
|
363
185
|
" entries."
|
|
364
186
|
] });
|
|
365
187
|
}
|
|
366
|
-
var
|
|
188
|
+
var A = { pagination: "_pagination_1kyfl_1" };
|
|
367
189
|
//#endregion
|
|
368
190
|
//#region src/components/pagination/Pagination.jsx
|
|
369
|
-
function
|
|
370
|
-
let e = t(), r = n((e) => e.table), i = r.currentPage, a = r.listSliced.endIndex,
|
|
371
|
-
return /* @__PURE__ */ (
|
|
372
|
-
className:
|
|
191
|
+
function j() {
|
|
192
|
+
let e = t(), r = n((e) => e.table), i = r.currentPage, a = r.listSliced.endIndex, c = r.currentList.length;
|
|
193
|
+
return /* @__PURE__ */ s("div", {
|
|
194
|
+
className: A.pagination,
|
|
373
195
|
children: [
|
|
374
|
-
/* @__PURE__ */ (
|
|
196
|
+
/* @__PURE__ */ o("button", {
|
|
375
197
|
onClick: () => {
|
|
376
|
-
i !== 1 && e(
|
|
198
|
+
i !== 1 && e(h(i - 1));
|
|
377
199
|
},
|
|
378
200
|
children: "Previous"
|
|
379
201
|
}),
|
|
380
|
-
/* @__PURE__ */ (
|
|
381
|
-
/* @__PURE__ */ (
|
|
202
|
+
/* @__PURE__ */ o("span", { children: i }),
|
|
203
|
+
/* @__PURE__ */ o("button", {
|
|
382
204
|
onClick: () => {
|
|
383
|
-
console.log(i), a !==
|
|
205
|
+
console.log(i), a !== c && e(h(i + 1));
|
|
384
206
|
},
|
|
385
207
|
children: "Next"
|
|
386
208
|
})
|
|
387
209
|
]
|
|
388
210
|
});
|
|
389
211
|
}
|
|
390
|
-
var
|
|
212
|
+
var M = {
|
|
391
213
|
tableHeader: "_tableHeader_jg9ws_1",
|
|
392
214
|
tableFooter: "_tableFooter_jg9ws_2"
|
|
393
215
|
};
|
|
394
216
|
//#endregion
|
|
395
217
|
//#region src/components/tableCore/TableCore.jsx
|
|
396
|
-
function
|
|
397
|
-
return t()(
|
|
218
|
+
function N({ list: e, tableHeaders: n }) {
|
|
219
|
+
return t()(p({
|
|
398
220
|
list: e,
|
|
399
221
|
tableHeaders: n
|
|
400
|
-
})), /* @__PURE__ */ (
|
|
401
|
-
/* @__PURE__ */ (
|
|
402
|
-
className:
|
|
403
|
-
children: [/* @__PURE__ */ (
|
|
222
|
+
})), /* @__PURE__ */ s(a, { children: [
|
|
223
|
+
/* @__PURE__ */ s("div", {
|
|
224
|
+
className: M.tableHeader,
|
|
225
|
+
children: [/* @__PURE__ */ o(x, {}), /* @__PURE__ */ o(S, {})]
|
|
404
226
|
}),
|
|
405
|
-
/* @__PURE__ */ (
|
|
406
|
-
/* @__PURE__ */ (
|
|
407
|
-
className:
|
|
408
|
-
children: [/* @__PURE__ */ (
|
|
227
|
+
/* @__PURE__ */ o(O, {}),
|
|
228
|
+
/* @__PURE__ */ s("div", {
|
|
229
|
+
className: M.tableFooter,
|
|
230
|
+
children: [/* @__PURE__ */ o(k, {}), /* @__PURE__ */ o(j, {})]
|
|
409
231
|
})
|
|
410
232
|
] });
|
|
411
233
|
}
|
|
412
234
|
//#endregion
|
|
413
235
|
//#region src/Table.jsx
|
|
414
|
-
function
|
|
415
|
-
return /* @__PURE__ */ (
|
|
416
|
-
store:
|
|
417
|
-
children: /* @__PURE__ */ (
|
|
236
|
+
function P(t) {
|
|
237
|
+
return /* @__PURE__ */ o(e, {
|
|
238
|
+
store: y,
|
|
239
|
+
children: /* @__PURE__ */ o(N, { ...t })
|
|
418
240
|
});
|
|
419
241
|
}
|
|
420
242
|
//#endregion
|
|
421
|
-
export {
|
|
243
|
+
export { P as Table };
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react-redux"),require("@reduxjs/toolkit"),require("react")):typeof define==`function`&&define.amd?define([`exports`,`react-redux`,`@reduxjs/toolkit`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactHrnetTable={},e.ReactRedux,e.ReduxToolkit,e.React))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var
|
|
2
|
-
let props = %s;
|
|
3
|
-
<%s {...props} />
|
|
4
|
-
React keys must be passed directly to JSX without using spread:
|
|
5
|
-
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),y=i(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?_():v()}))();function b(){let e=(0,t.useDispatch)(),n=(0,t.useSelector)(e=>e.table.entriesPerPage)||10;return(0,y.jsx)(`div`,{className:g.entriesControl,children:(0,y.jsxs)(`label`,{children:[`Show`,(0,y.jsxs)(`select`,{name:`table-entries`,id:`table-entries`,value:n,onChange:t=>{e(f(Number(t.target.value)))},children:[(0,y.jsx)(`option`,{value:`10`,children:`10`}),(0,y.jsx)(`option`,{value:`25`,children:`25`}),(0,y.jsx)(`option`,{value:`50`,children:`50`}),(0,y.jsx)(`option`,{value:`100`,children:`100`})]}),`entries`]})})}function x(){let[e,n]=(0,r.useState)(``),i=(0,t.useDispatch)();return(0,y.jsxs)(`label`,{children:[`Search:`,` `,(0,y.jsx)(`input`,{type:`search`,value:e,onChange:e=>{n(e.target.value),i(u(e.target.value))},"aria-controls":`employee-table`})]})}var S={cellHeader:`_cellHeader_mvi5q_1`,sortIcon:`_sortIcon_mvi5q_5`,sortArrows:`_sortArrows_mvi5q_15`};function C({header:e}){let n=(0,t.useDispatch)(),r=(0,t.useSelector)(e=>e.table.sortConfig),i=Object.keys(e)[0],a=e[i],o=()=>{let e=`asc`;r?.key===i&&(e=r.direction===`asc`?`desc`:`asc`),n(p({key:i,direction:e}))},s=r?.key===i,c=s&&r.direction===`asc`,l=s&&r.direction===`desc`;return(0,y.jsxs)(`th`,{className:S.cellHeader,onClick:o,children:[(0,y.jsx)(`span`,{children:a}),(0,y.jsxs)(`span`,{className:S.sortIcon,children:[(0,y.jsx)(`span`,{className:S.sortArrows,style:{opacity:c?1:.3,color:`#6366f1`},children:`▲`}),(0,y.jsx)(`span`,{className:S.sortArrows,style:{opacity:l?1:.3,color:`#6366f1`},children:`▼`})]})]})}function w(){let e=(0,t.useSelector)(e=>e.table.tableHeaders);return(0,y.jsx)(`thead`,{children:(0,y.jsx)(`tr`,{children:e.map((e,t)=>(0,y.jsx)(C,{header:e},t))})})}function T(){let e=(0,t.useSelector)(e=>e.table.listToDisplay);return(0,y.jsx)(`tbody`,{children:e.map((e,t)=>(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`td`,{children:e.firstName}),(0,y.jsx)(`td`,{children:e.lastName}),(0,y.jsx)(`td`,{children:e.startDate}),(0,y.jsx)(`td`,{children:e.department}),(0,y.jsx)(`td`,{children:e.birthDate}),(0,y.jsx)(`td`,{children:e.street}),(0,y.jsx)(`td`,{children:e.city}),(0,y.jsx)(`td`,{children:e.state}),(0,y.jsx)(`td`,{children:e.zipCode})]},t))})}var E={table:`_table_gudt1_1`};function D(){return(0,y.jsxs)(`table`,{className:E.table,children:[(0,y.jsx)(w,{}),(0,y.jsx)(T,{})]})}function O(){let e=(0,t.useSelector)(e=>e.table),n=e.listSliced.startIndex+1,r=e.listSliced.endIndex,i=e.currentList.length;return(0,y.jsxs)(`p`,{children:[`Showing `,n,` to `,r,` of `,i,` entries.`]})}var k={pagination:`_pagination_1kyfl_1`};function A(){let e=(0,t.useDispatch)(),n=(0,t.useSelector)(e=>e.table),r=n.currentPage,i=n.listSliced.endIndex,a=n.currentList.length;return(0,y.jsxs)(`div`,{className:k.pagination,children:[(0,y.jsx)(`button`,{onClick:()=>{r!==1&&e(d(r-1))},children:`Previous`}),(0,y.jsx)(`span`,{children:r}),(0,y.jsx)(`button`,{onClick:()=>{console.log(r),i!==a&&e(d(r+1))},children:`Next`})]})}var j={tableHeader:`_tableHeader_jg9ws_1`,tableFooter:`_tableFooter_jg9ws_2`};function M({list:e,tableHeaders:n}){return(0,t.useDispatch)()(l({list:e,tableHeaders:n})),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:j.tableHeader,children:[(0,y.jsx)(b,{}),(0,y.jsx)(x,{})]}),(0,y.jsx)(D,{}),(0,y.jsxs)(`div`,{className:j.tableFooter,children:[(0,y.jsx)(O,{}),(0,y.jsx)(A,{})]})]})}function N(e){return(0,y.jsx)(t.Provider,{store:h,children:(0,y.jsx)(M,{...e})})}e.Table=N});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react-redux"),require("@reduxjs/toolkit"),require("react/jsx-runtime"),require("react")):typeof define==`function`&&define.amd?define([`exports`,`react-redux`,`@reduxjs/toolkit`,`react/jsx-runtime`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactHrnetTable={},e.ReactRedux,e.ReduxToolkit,e.react_jsx_runtime,e.React))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=(e,t)=>t?e.filter(e=>Object.values(e).map(e=>e.toString().toLowerCase()).some(e=>e.includes(t.toLowerCase()))):e,o=(e,t)=>t?.key?[...e].sort((e,n)=>{let r=e[t.key],i=n[t.key];return r<i?t.direction===`asc`?-1:1:r>i?t.direction===`asc`?1:-1:0}):e,s=(e,t,n)=>{if(!Array.isArray(e))return[];let r=Math.max(0,(t-1)*n),i=Math.min(r+n,e.length),a=e.slice(r,i);return console.log(r,i),{slice:a,startIndex:r,endIndex:i}},c=(0,n.createSlice)({name:`table`,initialState:{searchResult:``,currentPage:1,entriesPerPage:10,sortConfig:{key:null,direction:`asc`}},reducers:{setList:(e,t)=>{e.initialList=t.payload.list,e.tableHeaders=t.payload.tableHeaders,e.currentList=e.initialList,e.listSliced=s(e.currentList,e.currentPage,e.entriesPerPage),e.listToDisplay=e.listSliced.slice},setSearchResult:(e,t)=>{e.searchResult=t.payload,e.currentPage=1,e.currentList=a(e.initialList,t.payload),e.listSliced=s(e.currentList,e.currentPage,e.entriesPerPage),e.listToDisplay=e.listSliced.slice},setCurrentPage:(e,t)=>{e.currentPage=t.payload,e.listSliced=s(e.currentList,e.currentPage,e.entriesPerPage),e.listToDisplay=e.listSliced.slice},setEntriesPerPage:(e,t)=>{e.searchResult=``,e.currentPage=1,e.entriesPerPage=t.payload,e.listSliced=s(e.currentList,e.currentPage,e.entriesPerPage),e.listToDisplay=e.listSliced.slice},setSortConfig:(e,t)=>{e.sortConfig=t.payload,e.listToDisplay=o(e.listToDisplay,t.payload)}}}),{setList:l,setSearchResult:u,setCurrentPage:d,setEntriesPerPage:f,setSortConfig:p}=c.actions,m=c.reducer,h=(0,n.configureStore)({reducer:{table:m}});h.subscribe(()=>{console.log(`State updated:`,h.getState())});var g={entriesControl:`_entriesControl_h5mt7_2`};function _(){let e=(0,t.useDispatch)(),n=(0,t.useSelector)(e=>e.table.entriesPerPage)||10;return(0,r.jsx)(`div`,{className:g.entriesControl,children:(0,r.jsxs)(`label`,{children:[`Show`,(0,r.jsxs)(`select`,{name:`table-entries`,id:`table-entries`,value:n,onChange:t=>{e(f(Number(t.target.value)))},children:[(0,r.jsx)(`option`,{value:`10`,children:`10`}),(0,r.jsx)(`option`,{value:`25`,children:`25`}),(0,r.jsx)(`option`,{value:`50`,children:`50`}),(0,r.jsx)(`option`,{value:`100`,children:`100`})]}),`entries`]})})}function v(){let[e,n]=(0,i.useState)(``),a=(0,t.useDispatch)();return(0,r.jsxs)(`label`,{children:[`Search:`,` `,(0,r.jsx)(`input`,{type:`search`,value:e,onChange:e=>{n(e.target.value),a(u(e.target.value))},"aria-controls":`employee-table`})]})}var y={cellHeader:`_cellHeader_mvi5q_1`,sortIcon:`_sortIcon_mvi5q_5`,sortArrows:`_sortArrows_mvi5q_15`};function b({header:e}){let n=(0,t.useDispatch)(),i=(0,t.useSelector)(e=>e.table.sortConfig),a=Object.keys(e)[0],o=e[a],s=()=>{let e=`asc`;i?.key===a&&(e=i.direction===`asc`?`desc`:`asc`),n(p({key:a,direction:e}))},c=i?.key===a,l=c&&i.direction===`asc`,u=c&&i.direction===`desc`;return(0,r.jsxs)(`th`,{className:y.cellHeader,onClick:s,children:[(0,r.jsx)(`span`,{children:o}),(0,r.jsxs)(`span`,{className:y.sortIcon,children:[(0,r.jsx)(`span`,{className:y.sortArrows,style:{opacity:l?1:.3,color:`#6366f1`},children:`▲`}),(0,r.jsx)(`span`,{className:y.sortArrows,style:{opacity:u?1:.3,color:`#6366f1`},children:`▼`})]})]})}function x(){let e=(0,t.useSelector)(e=>e.table.tableHeaders);return(0,r.jsx)(`thead`,{children:(0,r.jsx)(`tr`,{children:e.map((e,t)=>(0,r.jsx)(b,{header:e},t))})})}function S(){let e=(0,t.useSelector)(e=>e.table.listToDisplay);return(0,r.jsx)(`tbody`,{children:e.map((e,t)=>(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`td`,{children:e.firstName}),(0,r.jsx)(`td`,{children:e.lastName}),(0,r.jsx)(`td`,{children:e.startDate}),(0,r.jsx)(`td`,{children:e.department}),(0,r.jsx)(`td`,{children:e.birthDate}),(0,r.jsx)(`td`,{children:e.street}),(0,r.jsx)(`td`,{children:e.city}),(0,r.jsx)(`td`,{children:e.state}),(0,r.jsx)(`td`,{children:e.zipCode})]},t))})}var C={table:`_table_gudt1_1`};function w(){return(0,r.jsxs)(`table`,{className:C.table,children:[(0,r.jsx)(x,{}),(0,r.jsx)(S,{})]})}function T(){let e=(0,t.useSelector)(e=>e.table),n=e.listSliced.startIndex+1,i=e.listSliced.endIndex,a=e.currentList.length;return(0,r.jsxs)(`p`,{children:[`Showing `,n,` to `,i,` of `,a,` entries.`]})}var E={pagination:`_pagination_1kyfl_1`};function D(){let e=(0,t.useDispatch)(),n=(0,t.useSelector)(e=>e.table),i=n.currentPage,a=n.listSliced.endIndex,o=n.currentList.length;return(0,r.jsxs)(`div`,{className:E.pagination,children:[(0,r.jsx)(`button`,{onClick:()=>{i!==1&&e(d(i-1))},children:`Previous`}),(0,r.jsx)(`span`,{children:i}),(0,r.jsx)(`button`,{onClick:()=>{console.log(i),a!==o&&e(d(i+1))},children:`Next`})]})}var O={tableHeader:`_tableHeader_jg9ws_1`,tableFooter:`_tableFooter_jg9ws_2`};function k({list:e,tableHeaders:n}){return(0,t.useDispatch)()(l({list:e,tableHeaders:n})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`div`,{className:O.tableHeader,children:[(0,r.jsx)(_,{}),(0,r.jsx)(v,{})]}),(0,r.jsx)(w,{}),(0,r.jsxs)(`div`,{className:O.tableFooter,children:[(0,r.jsx)(T,{}),(0,r.jsx)(D,{})]})]})}function A(e){return(0,r.jsx)(t.Provider,{store:h,children:(0,r.jsx)(k,{...e})})}e.Table=A});
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-hrnet-table-gandrica",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/react-hrnet-table.umd.js",
|
|
7
7
|
"module": "dist/react-hrnet-table.es.js",
|
|
8
|
-
"style": "dist/
|
|
8
|
+
"style": "dist/react-hrnet-table-gandrica.css",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/react-hrnet-table.es.js",
|
|
12
12
|
"require": "./dist/react-hrnet-table.umd.js"
|
|
13
13
|
},
|
|
14
|
-
"./style.css": "./dist/
|
|
14
|
+
"./style.css": "./dist/react-hrnet-table-gandrica.css"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|