react-resource-ui 0.1.3 → 0.1.4-dev.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/dist/index.cjs +9 -6
- package/dist/index.js +9 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -212,16 +212,16 @@ function DataTable(props) {
|
|
|
212
212
|
const offsetY = props.offsetY ?? 0;
|
|
213
213
|
const totalHeight = props.totalHeight ?? 0;
|
|
214
214
|
const itemHeight = 50;
|
|
215
|
-
const
|
|
215
|
+
const columns = data[0] ? Object.keys(data[0]) : [];
|
|
216
216
|
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Loading..." });
|
|
217
217
|
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: error.message });
|
|
218
218
|
if ((props.totalItems ?? data.length) === 0)
|
|
219
219
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No Data to create Table" });
|
|
220
220
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { children: [
|
|
221
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children:
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: columns.map((val) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: val }, val)) }) }),
|
|
222
222
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
|
|
223
|
-
virtualization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: { height: offsetY }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
224
|
-
data.map((val, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children:
|
|
223
|
+
virtualization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: { height: offsetY }, children: columns.map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {}, key)) }),
|
|
224
|
+
data.map((val, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: columns.map((key) => {
|
|
225
225
|
const value = val[key];
|
|
226
226
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "cell", children: value != null ? value.toString() : "-" }) }, key);
|
|
227
227
|
}) }, index)),
|
|
@@ -229,9 +229,12 @@ function DataTable(props) {
|
|
|
229
229
|
"tr",
|
|
230
230
|
{
|
|
231
231
|
style: {
|
|
232
|
-
height:
|
|
232
|
+
height: Math.max(
|
|
233
|
+
0,
|
|
234
|
+
totalHeight - offsetY - data.length * itemHeight
|
|
235
|
+
)
|
|
233
236
|
},
|
|
234
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
237
|
+
children: columns.map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {}, key))
|
|
235
238
|
}
|
|
236
239
|
)
|
|
237
240
|
] })
|
package/dist/index.js
CHANGED
|
@@ -185,16 +185,16 @@ function DataTable(props) {
|
|
|
185
185
|
const offsetY = props.offsetY ?? 0;
|
|
186
186
|
const totalHeight = props.totalHeight ?? 0;
|
|
187
187
|
const itemHeight = 50;
|
|
188
|
-
const
|
|
188
|
+
const columns = data[0] ? Object.keys(data[0]) : [];
|
|
189
189
|
if (loading) return /* @__PURE__ */ jsx("div", { children: "Loading..." });
|
|
190
190
|
if (error) return /* @__PURE__ */ jsx("div", { children: error.message });
|
|
191
191
|
if ((props.totalItems ?? data.length) === 0)
|
|
192
192
|
return /* @__PURE__ */ jsx("p", { children: "No Data to create Table" });
|
|
193
193
|
const content = /* @__PURE__ */ jsxs("table", { children: [
|
|
194
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children:
|
|
194
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((val) => /* @__PURE__ */ jsx("th", { children: val }, val)) }) }),
|
|
195
195
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
196
|
-
virtualization && /* @__PURE__ */ jsx("tr", { style: { height: offsetY }, children: /* @__PURE__ */ jsx("td", {
|
|
197
|
-
data.map((val, index) => /* @__PURE__ */ jsx("tr", { children:
|
|
196
|
+
virtualization && /* @__PURE__ */ jsx("tr", { style: { height: offsetY }, children: columns.map((key) => /* @__PURE__ */ jsx("td", {}, key)) }),
|
|
197
|
+
data.map((val, index) => /* @__PURE__ */ jsx("tr", { children: columns.map((key) => {
|
|
198
198
|
const value = val[key];
|
|
199
199
|
return /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("div", { className: "cell", children: value != null ? value.toString() : "-" }) }, key);
|
|
200
200
|
}) }, index)),
|
|
@@ -202,9 +202,12 @@ function DataTable(props) {
|
|
|
202
202
|
"tr",
|
|
203
203
|
{
|
|
204
204
|
style: {
|
|
205
|
-
height:
|
|
205
|
+
height: Math.max(
|
|
206
|
+
0,
|
|
207
|
+
totalHeight - offsetY - data.length * itemHeight
|
|
208
|
+
)
|
|
206
209
|
},
|
|
207
|
-
children: /* @__PURE__ */ jsx("td", {
|
|
210
|
+
children: columns.map((key) => /* @__PURE__ */ jsx("td", {}, key))
|
|
208
211
|
}
|
|
209
212
|
)
|
|
210
213
|
] })
|
package/package.json
CHANGED