reifyui 0.7.0 → 0.7.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.
- package/dist/index.cjs +64 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FileCard.jsx +20 -26
- package/src/index.js +1 -1
- package/src/sheet/SheetGrid.jsx +32 -2
- package/styles/file.css +13 -14
- package/styles/sheet.css +2 -2
package/dist/index.js
CHANGED
|
@@ -2541,6 +2541,7 @@ function SheetGrid({
|
|
|
2541
2541
|
rows.map((row, ri) => /* @__PURE__ */ jsxs12(
|
|
2542
2542
|
"tr",
|
|
2543
2543
|
{
|
|
2544
|
+
"data-row-id": row.id,
|
|
2544
2545
|
style: {
|
|
2545
2546
|
...rowHeight(row) ? { height: rowHeight(row) } : null,
|
|
2546
2547
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
@@ -2582,6 +2583,7 @@ function SheetGrid({
|
|
|
2582
2583
|
return /* @__PURE__ */ jsxs12(
|
|
2583
2584
|
"td",
|
|
2584
2585
|
{
|
|
2586
|
+
"data-col-id": col.id,
|
|
2585
2587
|
className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
2586
2588
|
style: peer ? { boxShadow: `inset 0 0 0 2px ${peer.color}` } : void 0,
|
|
2587
2589
|
onClick: (e) => {
|
|
@@ -2842,6 +2844,21 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
|
|
|
2842
2844
|
}
|
|
2843
2845
|
);
|
|
2844
2846
|
}
|
|
2847
|
+
function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
|
|
2848
|
+
if (!container) return {};
|
|
2849
|
+
const out = {};
|
|
2850
|
+
const rows = container.querySelectorAll("tr[data-row-id]");
|
|
2851
|
+
for (const tr of rows) {
|
|
2852
|
+
const id = tr.getAttribute("data-row-id");
|
|
2853
|
+
if (rowIds && !rowIds.includes(id)) continue;
|
|
2854
|
+
let tallest = 0;
|
|
2855
|
+
for (const cell of tr.querySelectorAll("td[data-col-id] .shg-val")) {
|
|
2856
|
+
tallest = Math.max(tallest, cell.scrollHeight);
|
|
2857
|
+
}
|
|
2858
|
+
if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
|
|
2859
|
+
}
|
|
2860
|
+
return out;
|
|
2861
|
+
}
|
|
2845
2862
|
function defaultCellText(cell) {
|
|
2846
2863
|
const v = cell?.value;
|
|
2847
2864
|
if (v == null) return "";
|
|
@@ -2909,7 +2926,6 @@ function FileTypeIcon({ name, size = 36 }) {
|
|
|
2909
2926
|
}
|
|
2910
2927
|
|
|
2911
2928
|
// src/components/FileCard.jsx
|
|
2912
|
-
import { Fragment as Fragment9 } from "react";
|
|
2913
2929
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2914
2930
|
function subtitle(name, origin, bytes) {
|
|
2915
2931
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
@@ -2923,15 +2939,7 @@ function bytesLabel2(n) {
|
|
|
2923
2939
|
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
2924
2940
|
return `${(n / 1048576).toFixed(1)} MB`;
|
|
2925
2941
|
}
|
|
2926
|
-
function FileCard({
|
|
2927
|
-
name,
|
|
2928
|
-
origin,
|
|
2929
|
-
bytes,
|
|
2930
|
-
onPreview,
|
|
2931
|
-
onDownload,
|
|
2932
|
-
compact = false,
|
|
2933
|
-
className = ""
|
|
2934
|
-
}) {
|
|
2942
|
+
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, className = "" }) {
|
|
2935
2943
|
const open = onPreview ? (e) => {
|
|
2936
2944
|
e.stopPropagation();
|
|
2937
2945
|
onPreview();
|
|
@@ -2939,7 +2947,7 @@ function FileCard({
|
|
|
2939
2947
|
return /* @__PURE__ */ jsxs13(
|
|
2940
2948
|
"div",
|
|
2941
2949
|
{
|
|
2942
|
-
className: "uic-filecard" + (
|
|
2950
|
+
className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
2943
2951
|
onClick: open,
|
|
2944
2952
|
role: open ? "button" : void 0,
|
|
2945
2953
|
tabIndex: open ? 0 : void 0,
|
|
@@ -2951,38 +2959,26 @@ function FileCard({
|
|
|
2951
2959
|
} : void 0,
|
|
2952
2960
|
title: name,
|
|
2953
2961
|
children: [
|
|
2954
|
-
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size:
|
|
2962
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: 32 }) }),
|
|
2955
2963
|
/* @__PURE__ */ jsxs13("span", { className: "uic-filecard-meta", children: [
|
|
2956
2964
|
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-name", children: name }),
|
|
2957
|
-
|
|
2965
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
2958
2966
|
] }),
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
onPreview && /* @__PURE__ */ jsx15(
|
|
2975
|
-
"button",
|
|
2976
|
-
{
|
|
2977
|
-
type: "button",
|
|
2978
|
-
className: "uic-filecard-btn",
|
|
2979
|
-
"aria-label": `Preview ${name}`,
|
|
2980
|
-
title: "Preview",
|
|
2981
|
-
onClick: open,
|
|
2982
|
-
children: /* @__PURE__ */ jsx15(IcEye, {})
|
|
2983
|
-
}
|
|
2984
|
-
)
|
|
2985
|
-
] })
|
|
2967
|
+
onDownload && /* @__PURE__ */ jsx15(
|
|
2968
|
+
"button",
|
|
2969
|
+
{
|
|
2970
|
+
type: "button",
|
|
2971
|
+
className: "uic-filecard-dl",
|
|
2972
|
+
"aria-label": `Download ${name}`,
|
|
2973
|
+
title: "Download",
|
|
2974
|
+
onClick: (e) => {
|
|
2975
|
+
e.stopPropagation();
|
|
2976
|
+
onDownload();
|
|
2977
|
+
},
|
|
2978
|
+
children: /* @__PURE__ */ jsx15(IcDownload, { size: 18 })
|
|
2979
|
+
}
|
|
2980
|
+
),
|
|
2981
|
+
onPreview && /* @__PURE__ */ jsx15("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
|
|
2986
2982
|
]
|
|
2987
2983
|
}
|
|
2988
2984
|
);
|
|
@@ -3640,6 +3636,7 @@ export {
|
|
|
3640
3636
|
createResponsesDispatcher,
|
|
3641
3637
|
extOf,
|
|
3642
3638
|
fetchBalance,
|
|
3639
|
+
fitRowHeights,
|
|
3643
3640
|
getSession,
|
|
3644
3641
|
getToken,
|
|
3645
3642
|
googleSignIn,
|