reifyui 0.1.0 → 0.3.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/README.md +7 -3
- package/dist/index.cjs +581 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +53 -0
- package/dist/index.js +590 -172
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/dialog.css +145 -0
- package/styles/tasks.css +59 -0
package/dist/index.js
CHANGED
|
@@ -854,6 +854,420 @@ function PaneResizer(props) {
|
|
|
854
854
|
);
|
|
855
855
|
}
|
|
856
856
|
|
|
857
|
+
// src/components/TaskList.jsx
|
|
858
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useMemo, useRef as useRef3, useState as useState3 } from "react";
|
|
859
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
860
|
+
var STATUS_GROUPS = {
|
|
861
|
+
all: () => true,
|
|
862
|
+
working: (s) => ["running", "starting", "queued", "in_progress"].includes(s),
|
|
863
|
+
done: (s) => ["done", "completed"].includes(s),
|
|
864
|
+
failed: (s) => ["failed", "cancelled", "incomplete", "error"].includes(s)
|
|
865
|
+
};
|
|
866
|
+
function taskStatusGroup(status) {
|
|
867
|
+
const s = String(status || "").toLowerCase();
|
|
868
|
+
for (const k of ["working", "done", "failed"]) if (STATUS_GROUPS[k](s)) return k;
|
|
869
|
+
return "idle";
|
|
870
|
+
}
|
|
871
|
+
function relTime(ts) {
|
|
872
|
+
const n = Number(ts) || 0;
|
|
873
|
+
if (!n) return "";
|
|
874
|
+
const ms = n > 1e12 ? n : n * 1e3;
|
|
875
|
+
const d = Math.max(0, Date.now() - ms) / 1e3;
|
|
876
|
+
if (d < 60) return "just now";
|
|
877
|
+
if (d < 3600) return `${Math.floor(d / 60)}m ago`;
|
|
878
|
+
if (d < 86400) return `${Math.floor(d / 3600)}h ago`;
|
|
879
|
+
return `${Math.floor(d / 86400)}d ago`;
|
|
880
|
+
}
|
|
881
|
+
function TaskList({
|
|
882
|
+
fetchPage,
|
|
883
|
+
selected,
|
|
884
|
+
onSelect,
|
|
885
|
+
onNew,
|
|
886
|
+
onDelete,
|
|
887
|
+
header,
|
|
888
|
+
renderMeta,
|
|
889
|
+
refreshNonce = 0,
|
|
890
|
+
emptyLabel = "No tasks yet",
|
|
891
|
+
newLabel = "New task",
|
|
892
|
+
idKey = "id",
|
|
893
|
+
titleKey = "title",
|
|
894
|
+
statusKey = "status",
|
|
895
|
+
timeKey = "updated_at"
|
|
896
|
+
}) {
|
|
897
|
+
const [head, setHead] = useState3(null);
|
|
898
|
+
const [tail, setTail] = useState3([]);
|
|
899
|
+
const [cursor, setCursor] = useState3("");
|
|
900
|
+
const [loadingMore, setLoadingMore] = useState3(false);
|
|
901
|
+
const [q, setQ] = useState3("");
|
|
902
|
+
const [statusFilter, setStatusFilter] = useState3("all");
|
|
903
|
+
const alive = useRef3(true);
|
|
904
|
+
useEffect3(() => () => {
|
|
905
|
+
alive.current = false;
|
|
906
|
+
}, []);
|
|
907
|
+
useEffect3(() => {
|
|
908
|
+
let ok = true;
|
|
909
|
+
Promise.resolve(fetchPage("")).then((r) => {
|
|
910
|
+
if (!ok) return;
|
|
911
|
+
setHead(Array.isArray(r?.items) ? r.items : []);
|
|
912
|
+
setCursor(r?.cursor || "");
|
|
913
|
+
}).catch(() => {
|
|
914
|
+
if (ok) setHead((p) => p ?? []);
|
|
915
|
+
});
|
|
916
|
+
return () => {
|
|
917
|
+
ok = false;
|
|
918
|
+
};
|
|
919
|
+
}, [fetchPage, refreshNonce]);
|
|
920
|
+
const loadMore = useCallback2(() => {
|
|
921
|
+
if (!cursor || loadingMore) return;
|
|
922
|
+
setLoadingMore(true);
|
|
923
|
+
Promise.resolve(fetchPage(cursor)).then((r) => {
|
|
924
|
+
if (!alive.current) return;
|
|
925
|
+
if (Array.isArray(r?.items)) setTail((t) => [...t, ...r.items]);
|
|
926
|
+
setCursor(r?.cursor || "");
|
|
927
|
+
}).catch(() => {
|
|
928
|
+
}).finally(() => {
|
|
929
|
+
if (alive.current) setLoadingMore(false);
|
|
930
|
+
});
|
|
931
|
+
}, [cursor, loadingMore, fetchPage]);
|
|
932
|
+
const items = useMemo(() => {
|
|
933
|
+
const h = head || [];
|
|
934
|
+
const seen = new Set(h.map((x) => x?.[idKey]));
|
|
935
|
+
return [...h, ...tail.filter((t) => !seen.has(t?.[idKey]))];
|
|
936
|
+
}, [head, tail, idKey]);
|
|
937
|
+
const shown = useMemo(() => {
|
|
938
|
+
const needle = q.trim().toLowerCase();
|
|
939
|
+
const pass = STATUS_GROUPS[statusFilter] || STATUS_GROUPS.all;
|
|
940
|
+
return items.filter((it) => {
|
|
941
|
+
if (!pass(String(it?.[statusKey] || "").toLowerCase())) return false;
|
|
942
|
+
if (!needle) return true;
|
|
943
|
+
return String(it?.[titleKey] || "").toLowerCase().includes(needle);
|
|
944
|
+
});
|
|
945
|
+
}, [items, q, statusFilter, statusKey, titleKey]);
|
|
946
|
+
const onScroll = (e) => {
|
|
947
|
+
const el = e.currentTarget;
|
|
948
|
+
if (el.scrollTop + el.clientHeight > el.scrollHeight - 140) loadMore();
|
|
949
|
+
};
|
|
950
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rui-tasks", children: [
|
|
951
|
+
header ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-header", children: header }) : null,
|
|
952
|
+
onNew ? /* @__PURE__ */ jsxs6("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
|
|
953
|
+
"+ ",
|
|
954
|
+
newLabel
|
|
955
|
+
] }) : null,
|
|
956
|
+
/* @__PURE__ */ jsxs6("div", { className: "rui-tasks-filters", children: [
|
|
957
|
+
/* @__PURE__ */ jsx7(
|
|
958
|
+
"input",
|
|
959
|
+
{
|
|
960
|
+
className: "rui-tasks-search",
|
|
961
|
+
value: q,
|
|
962
|
+
placeholder: "Filter tasks\u2026",
|
|
963
|
+
onChange: (e) => setQ(e.target.value),
|
|
964
|
+
"aria-label": "Filter tasks"
|
|
965
|
+
}
|
|
966
|
+
),
|
|
967
|
+
/* @__PURE__ */ jsxs6(
|
|
968
|
+
"select",
|
|
969
|
+
{
|
|
970
|
+
className: "rui-tasks-status",
|
|
971
|
+
value: statusFilter,
|
|
972
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
973
|
+
"aria-label": "Filter by status",
|
|
974
|
+
children: [
|
|
975
|
+
/* @__PURE__ */ jsx7("option", { value: "all", children: "All" }),
|
|
976
|
+
/* @__PURE__ */ jsx7("option", { value: "working", children: "Working" }),
|
|
977
|
+
/* @__PURE__ */ jsx7("option", { value: "done", children: "Done" }),
|
|
978
|
+
/* @__PURE__ */ jsx7("option", { value: "failed", children: "Failed" })
|
|
979
|
+
]
|
|
980
|
+
}
|
|
981
|
+
)
|
|
982
|
+
] }),
|
|
983
|
+
/* @__PURE__ */ jsxs6("div", { className: "rui-tasks-list", onScroll, children: [
|
|
984
|
+
head === null ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
|
|
985
|
+
const id = it?.[idKey];
|
|
986
|
+
const group = taskStatusGroup(it?.[statusKey]);
|
|
987
|
+
return /* @__PURE__ */ jsxs6(
|
|
988
|
+
"div",
|
|
989
|
+
{
|
|
990
|
+
className: `rui-task${id === selected ? " is-selected" : ""}`,
|
|
991
|
+
onClick: () => onSelect?.(id),
|
|
992
|
+
role: "button",
|
|
993
|
+
tabIndex: 0,
|
|
994
|
+
onKeyDown: (e) => {
|
|
995
|
+
if (e.key === "Enter" || e.key === " ") onSelect?.(id);
|
|
996
|
+
},
|
|
997
|
+
children: [
|
|
998
|
+
/* @__PURE__ */ jsxs6("div", { className: "rui-task-main", children: [
|
|
999
|
+
/* @__PURE__ */ jsx7("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
|
|
1000
|
+
/* @__PURE__ */ jsx7("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1001
|
+
/* @__PURE__ */ jsx7("span", { className: `rui-task-dot is-${group}` }),
|
|
1002
|
+
/* @__PURE__ */ jsx7("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
|
|
1003
|
+
it?.[timeKey] ? /* @__PURE__ */ jsx7("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
|
|
1004
|
+
] }) })
|
|
1005
|
+
] }),
|
|
1006
|
+
onDelete ? /* @__PURE__ */ jsx7(
|
|
1007
|
+
"button",
|
|
1008
|
+
{
|
|
1009
|
+
type: "button",
|
|
1010
|
+
className: "rui-task-del",
|
|
1011
|
+
"aria-label": "Delete task",
|
|
1012
|
+
onClick: (e) => {
|
|
1013
|
+
e.stopPropagation();
|
|
1014
|
+
onDelete(it);
|
|
1015
|
+
},
|
|
1016
|
+
children: "\xD7"
|
|
1017
|
+
}
|
|
1018
|
+
) : null
|
|
1019
|
+
]
|
|
1020
|
+
},
|
|
1021
|
+
id
|
|
1022
|
+
);
|
|
1023
|
+
}),
|
|
1024
|
+
loadingMore ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
|
|
1025
|
+
] })
|
|
1026
|
+
] });
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// src/components/Dialog.jsx
|
|
1030
|
+
import {
|
|
1031
|
+
createContext,
|
|
1032
|
+
useCallback as useCallback3,
|
|
1033
|
+
useContext,
|
|
1034
|
+
useEffect as useEffect4,
|
|
1035
|
+
useId,
|
|
1036
|
+
useMemo as useMemo2,
|
|
1037
|
+
useRef as useRef4,
|
|
1038
|
+
useState as useState4
|
|
1039
|
+
} from "react";
|
|
1040
|
+
import { createPortal } from "react-dom";
|
|
1041
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1042
|
+
var DialogCtx = createContext(null);
|
|
1043
|
+
var LABELS = {
|
|
1044
|
+
en: { confirm: "Confirm", cancel: "Cancel", ok: "OK", create: "Create", required: "Please enter a value" },
|
|
1045
|
+
zh: { confirm: "\u786E\u8BA4", cancel: "\u53D6\u6D88", ok: "\u597D\u7684", create: "\u521B\u5EFA", required: "\u8BF7\u8F93\u5165\u5185\u5BB9" }
|
|
1046
|
+
};
|
|
1047
|
+
var _idSeq = 0;
|
|
1048
|
+
function DialogHost({ children, locale = "en", labels }) {
|
|
1049
|
+
const [stack, setStack] = useState4([]);
|
|
1050
|
+
const t = useMemo2(
|
|
1051
|
+
() => ({ ...LABELS[locale] || LABELS.en, ...labels || {} }),
|
|
1052
|
+
[locale, labels]
|
|
1053
|
+
);
|
|
1054
|
+
const open = useCallback3((spec) => new Promise((resolve) => {
|
|
1055
|
+
setStack((s) => [...s, { id: `dlg_${++_idSeq}`, spec, resolve }]);
|
|
1056
|
+
}), []);
|
|
1057
|
+
const close = useCallback3((id, value) => {
|
|
1058
|
+
setStack((s) => {
|
|
1059
|
+
const target = s.find((d) => d.id === id);
|
|
1060
|
+
if (target) target.resolve(value);
|
|
1061
|
+
return s.filter((d) => d.id !== id);
|
|
1062
|
+
});
|
|
1063
|
+
}, []);
|
|
1064
|
+
const ctx = useMemo2(() => ({
|
|
1065
|
+
confirm: (opts) => open({ kind: "confirm", ...opts }),
|
|
1066
|
+
prompt: (opts) => open({ kind: "prompt", ...opts }),
|
|
1067
|
+
alert: (opts) => open({ kind: "alert", ...opts }),
|
|
1068
|
+
create: (opts) => open({ kind: "create", ...opts }),
|
|
1069
|
+
labels: t
|
|
1070
|
+
}), [open, t]);
|
|
1071
|
+
return /* @__PURE__ */ jsxs7(DialogCtx.Provider, { value: ctx, children: [
|
|
1072
|
+
children,
|
|
1073
|
+
stack.length > 0 && typeof document !== "undefined" && createPortal(
|
|
1074
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-root", role: "presentation", children: stack.map((d, i) => /* @__PURE__ */ jsx8(DialogShell, { dialog: d, isTop: i === stack.length - 1, onClose: close, t }, d.id)) }),
|
|
1075
|
+
document.body
|
|
1076
|
+
)
|
|
1077
|
+
] });
|
|
1078
|
+
}
|
|
1079
|
+
function useDialog() {
|
|
1080
|
+
const ctx = useContext(DialogCtx);
|
|
1081
|
+
if (!ctx) throw new Error("useDialog() called outside <DialogHost>");
|
|
1082
|
+
return ctx;
|
|
1083
|
+
}
|
|
1084
|
+
var cancelValue = (kind) => kind === "prompt" || kind === "create" ? null : false;
|
|
1085
|
+
function DialogShell({ dialog, isTop, onClose, t }) {
|
|
1086
|
+
const { id, spec } = dialog;
|
|
1087
|
+
const ref = useRef4(null);
|
|
1088
|
+
const titleId = useId();
|
|
1089
|
+
useEffect4(() => {
|
|
1090
|
+
if (!isTop) return void 0;
|
|
1091
|
+
const onKey = (e) => {
|
|
1092
|
+
if (e.key !== "Escape") return;
|
|
1093
|
+
e.preventDefault();
|
|
1094
|
+
onClose(id, cancelValue(spec.kind));
|
|
1095
|
+
};
|
|
1096
|
+
document.addEventListener("keydown", onKey);
|
|
1097
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
1098
|
+
}, [id, isTop, onClose, spec.kind]);
|
|
1099
|
+
useEffect4(() => {
|
|
1100
|
+
if (!isTop || !ref.current) return;
|
|
1101
|
+
const el = ref.current.querySelector("input, textarea") || ref.current.querySelector(".rui-dlg-primary") || ref.current.querySelector("button");
|
|
1102
|
+
el?.focus();
|
|
1103
|
+
}, [isTop]);
|
|
1104
|
+
const onBackdrop = (e) => {
|
|
1105
|
+
if (e.target === e.currentTarget && isTop) onClose(id, cancelValue(spec.kind));
|
|
1106
|
+
};
|
|
1107
|
+
const done = (v) => onClose(id, v);
|
|
1108
|
+
return /* @__PURE__ */ jsx8("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs7(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
ref,
|
|
1112
|
+
role: "dialog",
|
|
1113
|
+
"aria-modal": "true",
|
|
1114
|
+
"aria-labelledby": spec.title ? titleId : void 0,
|
|
1115
|
+
className: `rui-dlg-card${spec.kind === "create" ? " is-wide" : ""}`,
|
|
1116
|
+
children: [
|
|
1117
|
+
spec.kind === "alert" && /* @__PURE__ */ jsx8(AlertBody, { spec, onClose: done, t, titleId }),
|
|
1118
|
+
spec.kind === "confirm" && /* @__PURE__ */ jsx8(ConfirmBody, { spec, onClose: done, t, titleId }),
|
|
1119
|
+
spec.kind === "prompt" && /* @__PURE__ */ jsx8(PromptBody, { spec, onClose: done, t, titleId }),
|
|
1120
|
+
spec.kind === "create" && /* @__PURE__ */ jsx8(CreateBody, { spec, onClose: done, t, titleId })
|
|
1121
|
+
]
|
|
1122
|
+
}
|
|
1123
|
+
) });
|
|
1124
|
+
}
|
|
1125
|
+
function Header({ title, variant, titleId }) {
|
|
1126
|
+
if (!title) return null;
|
|
1127
|
+
return /* @__PURE__ */ jsx8("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx8("div", { className: "rui-dlg-title", id: titleId, children: title }) });
|
|
1128
|
+
}
|
|
1129
|
+
var Footer = ({ children }) => /* @__PURE__ */ jsx8("div", { className: "rui-dlg-f", children });
|
|
1130
|
+
function AlertBody({ spec, onClose, t, titleId }) {
|
|
1131
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1132
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1133
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1134
|
+
/* @__PURE__ */ jsx8(Footer, { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
|
|
1135
|
+
] });
|
|
1136
|
+
}
|
|
1137
|
+
function ConfirmBody({ spec, onClose, t, titleId }) {
|
|
1138
|
+
const destructive = !!spec.destructive;
|
|
1139
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1140
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
|
|
1141
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1142
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1143
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
|
|
1144
|
+
/* @__PURE__ */ jsx8(
|
|
1145
|
+
"button",
|
|
1146
|
+
{
|
|
1147
|
+
type: "button",
|
|
1148
|
+
className: `rui-dlg-btn rui-dlg-primary${destructive ? " is-destructive" : ""}`,
|
|
1149
|
+
onClick: () => onClose(true),
|
|
1150
|
+
children: spec.confirmLabel || t.confirm
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
] });
|
|
1155
|
+
}
|
|
1156
|
+
function PromptBody({ spec, onClose, t, titleId }) {
|
|
1157
|
+
const [value, setValue] = useState4(spec.defaultValue ?? "");
|
|
1158
|
+
const [err, setErr] = useState4(null);
|
|
1159
|
+
const inputId = useId();
|
|
1160
|
+
const Field = spec.multiline ? "textarea" : "input";
|
|
1161
|
+
const submit = () => {
|
|
1162
|
+
const invalid = spec.validate?.(value);
|
|
1163
|
+
if (invalid) {
|
|
1164
|
+
setErr(String(invalid));
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1168
|
+
setErr(t.required);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
onClose(String(value));
|
|
1172
|
+
};
|
|
1173
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1174
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1175
|
+
/* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
|
|
1176
|
+
spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null,
|
|
1177
|
+
spec.label ? /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
|
|
1178
|
+
/* @__PURE__ */ jsx8(
|
|
1179
|
+
Field,
|
|
1180
|
+
{
|
|
1181
|
+
id: inputId,
|
|
1182
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1183
|
+
type: spec.multiline ? void 0 : spec.inputType || "text",
|
|
1184
|
+
rows: spec.multiline ? spec.rows || 4 : void 0,
|
|
1185
|
+
value,
|
|
1186
|
+
placeholder: spec.placeholder || "",
|
|
1187
|
+
onChange: (e) => {
|
|
1188
|
+
setValue(e.target.value);
|
|
1189
|
+
if (err) setErr(null);
|
|
1190
|
+
},
|
|
1191
|
+
onKeyDown: (e) => {
|
|
1192
|
+
if (e.key === "Enter" && !e.shiftKey && !spec.multiline) {
|
|
1193
|
+
e.preventDefault();
|
|
1194
|
+
submit();
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
autoComplete: "off",
|
|
1198
|
+
spellCheck: "false"
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null,
|
|
1202
|
+
!err && spec.help ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-help", children: spec.help }) : null
|
|
1203
|
+
] }),
|
|
1204
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1205
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1206
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
|
|
1207
|
+
] })
|
|
1208
|
+
] });
|
|
1209
|
+
}
|
|
1210
|
+
function CreateBody({ spec, onClose, t, titleId }) {
|
|
1211
|
+
const types = spec.types || [];
|
|
1212
|
+
const [kind, setKind] = useState4(spec.defaultKind || types[0]?.kind || "");
|
|
1213
|
+
const [value, setValue] = useState4(spec.defaultValue ?? "");
|
|
1214
|
+
const [err, setErr] = useState4(null);
|
|
1215
|
+
const inputId = useId();
|
|
1216
|
+
const sel = types.find((x) => x.kind === kind) || types[0] || {};
|
|
1217
|
+
const submit = () => {
|
|
1218
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1219
|
+
setErr(t.required);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
onClose({ kind, name: String(value).trim() });
|
|
1223
|
+
};
|
|
1224
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, titleId }),
|
|
1226
|
+
/* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
|
|
1227
|
+
types.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs7(
|
|
1228
|
+
"button",
|
|
1229
|
+
{
|
|
1230
|
+
type: "button",
|
|
1231
|
+
className: `rui-dlg-type${ty.kind === kind ? " is-on" : ""}`,
|
|
1232
|
+
onClick: () => setKind(ty.kind),
|
|
1233
|
+
children: [
|
|
1234
|
+
ty.icon ? /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
|
|
1235
|
+
/* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-lbl", children: ty.label })
|
|
1236
|
+
]
|
|
1237
|
+
},
|
|
1238
|
+
ty.kind
|
|
1239
|
+
)) }) : null,
|
|
1240
|
+
/* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
|
|
1241
|
+
/* @__PURE__ */ jsx8(
|
|
1242
|
+
"input",
|
|
1243
|
+
{
|
|
1244
|
+
id: inputId,
|
|
1245
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1246
|
+
value,
|
|
1247
|
+
placeholder: spec.placeholder || "Untitled",
|
|
1248
|
+
onChange: (e) => {
|
|
1249
|
+
setValue(e.target.value);
|
|
1250
|
+
if (err) setErr(null);
|
|
1251
|
+
},
|
|
1252
|
+
onKeyDown: (e) => {
|
|
1253
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1254
|
+
e.preventDefault();
|
|
1255
|
+
submit();
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
autoComplete: "off",
|
|
1259
|
+
spellCheck: "false"
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null
|
|
1263
|
+
] }),
|
|
1264
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1265
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1266
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
|
|
1267
|
+
] })
|
|
1268
|
+
] });
|
|
1269
|
+
}
|
|
1270
|
+
|
|
857
1271
|
// src/auth/client.js
|
|
858
1272
|
var _cfg = {
|
|
859
1273
|
engine: "",
|
|
@@ -1003,18 +1417,18 @@ async function fetchBalance() {
|
|
|
1003
1417
|
}
|
|
1004
1418
|
|
|
1005
1419
|
// src/auth/AuthForm.jsx
|
|
1006
|
-
import { useState as
|
|
1420
|
+
import { useState as useState6 } from "react";
|
|
1007
1421
|
|
|
1008
1422
|
// src/auth/GoogleButton.jsx
|
|
1009
|
-
import { useEffect as
|
|
1010
|
-
import { Fragment as
|
|
1423
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
1424
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1011
1425
|
var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
|
|
1012
1426
|
function GoogleButton({ onCredential, onError }) {
|
|
1013
|
-
const ref =
|
|
1014
|
-
const [failed, setFailed] =
|
|
1015
|
-
const cb =
|
|
1427
|
+
const ref = useRef5(null);
|
|
1428
|
+
const [failed, setFailed] = useState5(false);
|
|
1429
|
+
const cb = useRef5({ onCredential, onError });
|
|
1016
1430
|
cb.current = { onCredential, onError };
|
|
1017
|
-
|
|
1431
|
+
useEffect5(() => {
|
|
1018
1432
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
1019
1433
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
1020
1434
|
let done = false;
|
|
@@ -1065,24 +1479,24 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
1065
1479
|
};
|
|
1066
1480
|
}, []);
|
|
1067
1481
|
if (!CLIENT_ID || failed) return null;
|
|
1068
|
-
return /* @__PURE__ */
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1483
|
+
/* @__PURE__ */ jsx9("div", { className: "auth-or", children: /* @__PURE__ */ jsx9("span", { children: "or" }) }),
|
|
1484
|
+
/* @__PURE__ */ jsx9("div", { ref, className: "auth-gwrap" })
|
|
1071
1485
|
] });
|
|
1072
1486
|
}
|
|
1073
1487
|
var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
1074
1488
|
|
|
1075
1489
|
// src/auth/AuthForm.jsx
|
|
1076
|
-
import { Fragment as
|
|
1490
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1077
1491
|
function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
1078
|
-
const [mode, setMode] =
|
|
1079
|
-
const [email, setEmail] =
|
|
1080
|
-
const [password, setPassword] =
|
|
1081
|
-
const [name, setName] =
|
|
1082
|
-
const [err, setErr] =
|
|
1083
|
-
const [busy, setBusy] =
|
|
1084
|
-
const [choices, setChoices] =
|
|
1085
|
-
const [resetSent, setResetSent] =
|
|
1492
|
+
const [mode, setMode] = useState6("signin");
|
|
1493
|
+
const [email, setEmail] = useState6("");
|
|
1494
|
+
const [password, setPassword] = useState6("");
|
|
1495
|
+
const [name, setName] = useState6("");
|
|
1496
|
+
const [err, setErr] = useState6("");
|
|
1497
|
+
const [busy, setBusy] = useState6(false);
|
|
1498
|
+
const [choices, setChoices] = useState6(null);
|
|
1499
|
+
const [resetSent, setResetSent] = useState6(false);
|
|
1086
1500
|
async function enter(orgId) {
|
|
1087
1501
|
const session = await switchOrg(orgId);
|
|
1088
1502
|
onDone(session);
|
|
@@ -1123,10 +1537,10 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1123
1537
|
}
|
|
1124
1538
|
}
|
|
1125
1539
|
if (choices) {
|
|
1126
|
-
return /* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1540
|
+
return /* @__PURE__ */ jsxs9("div", { children: [
|
|
1541
|
+
/* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
|
|
1542
|
+
/* @__PURE__ */ jsx10("h1", { children: "Choose workspace" }),
|
|
1543
|
+
/* @__PURE__ */ jsx10("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx10(
|
|
1130
1544
|
"button",
|
|
1131
1545
|
{
|
|
1132
1546
|
type: "button",
|
|
@@ -1144,20 +1558,20 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1144
1558
|
},
|
|
1145
1559
|
o.id
|
|
1146
1560
|
)) }),
|
|
1147
|
-
err && /* @__PURE__ */
|
|
1561
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err })
|
|
1148
1562
|
] });
|
|
1149
1563
|
}
|
|
1150
|
-
return /* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
mode === "forgot" ? resetSent ? /* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsxs9("form", { onSubmit: submit, children: [
|
|
1565
|
+
/* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
|
|
1566
|
+
/* @__PURE__ */ jsx10("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
1567
|
+
/* @__PURE__ */ jsx10("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
|
|
1568
|
+
mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1569
|
+
/* @__PURE__ */ jsxs9("div", { className: "auth-note", children: [
|
|
1156
1570
|
"If an account exists for ",
|
|
1157
|
-
/* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ jsx10("b", { children: email.trim() }),
|
|
1158
1572
|
", a password reset link is on its way. It is valid for 1 hour."
|
|
1159
1573
|
] }),
|
|
1160
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsx10(
|
|
1161
1575
|
"button",
|
|
1162
1576
|
{
|
|
1163
1577
|
type: "button",
|
|
@@ -1171,36 +1585,36 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1171
1585
|
children: "Back to sign in"
|
|
1172
1586
|
}
|
|
1173
1587
|
)
|
|
1174
|
-
] }) : /* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1588
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1589
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1590
|
+
/* @__PURE__ */ jsx10("label", { children: "Email" }),
|
|
1591
|
+
/* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1178
1592
|
] }),
|
|
1179
|
-
err && /* @__PURE__ */
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */
|
|
1593
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
|
|
1594
|
+
/* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
1595
|
+
/* @__PURE__ */ jsx10("p", { className: "auth-switch", children: /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
|
|
1182
1596
|
setErr("");
|
|
1183
1597
|
setMode("signin");
|
|
1184
1598
|
}, children: "Back to sign in" }) })
|
|
1185
|
-
] }) : /* @__PURE__ */
|
|
1186
|
-
mode === "register" && /* @__PURE__ */
|
|
1187
|
-
/* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1599
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1600
|
+
mode === "register" && /* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1601
|
+
/* @__PURE__ */ jsx10("label", { children: "Name" }),
|
|
1602
|
+
/* @__PURE__ */ jsx10("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
|
|
1189
1603
|
] }),
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1604
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1605
|
+
/* @__PURE__ */ jsx10("label", { children: "Email" }),
|
|
1606
|
+
/* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1193
1607
|
] }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
mode === "signin" && /* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1609
|
+
/* @__PURE__ */ jsxs9("div", { className: "field-row", children: [
|
|
1610
|
+
/* @__PURE__ */ jsx10("label", { children: "Password" }),
|
|
1611
|
+
mode === "signin" && /* @__PURE__ */ jsx10("button", { type: "button", className: "link-sm", onClick: () => {
|
|
1198
1612
|
setErr("");
|
|
1199
1613
|
setResetSent(false);
|
|
1200
1614
|
setMode("forgot");
|
|
1201
1615
|
}, children: "Forgot password?" })
|
|
1202
1616
|
] }),
|
|
1203
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx10(
|
|
1204
1618
|
"input",
|
|
1205
1619
|
{
|
|
1206
1620
|
className: "input",
|
|
@@ -1213,13 +1627,13 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1213
1627
|
}
|
|
1214
1628
|
)
|
|
1215
1629
|
] }),
|
|
1216
|
-
err && /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
GOOGLE_ENABLED && /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1630
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
|
|
1631
|
+
/* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
|
|
1632
|
+
GOOGLE_ENABLED && /* @__PURE__ */ jsx10(GoogleButton, { onCredential: onGoogle, onError: setErr }),
|
|
1633
|
+
/* @__PURE__ */ jsxs9("p", { className: "auth-switch", children: [
|
|
1220
1634
|
mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
|
|
1221
1635
|
" ",
|
|
1222
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
|
|
1223
1637
|
setErr("");
|
|
1224
1638
|
setMode(mode === "register" ? "signin" : "register");
|
|
1225
1639
|
}, children: mode === "register" ? "Sign in" : "Create one" })
|
|
@@ -1229,9 +1643,9 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1229
1643
|
}
|
|
1230
1644
|
|
|
1231
1645
|
// src/sheet/SheetGrid.jsx
|
|
1232
|
-
import { useEffect as
|
|
1233
|
-
import { createPortal } from "react-dom";
|
|
1234
|
-
import { Fragment as
|
|
1646
|
+
import { useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
|
|
1647
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
1648
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1235
1649
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
1236
1650
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1237
1651
|
var TYPE_LABEL = {
|
|
@@ -1255,7 +1669,7 @@ var COMPUTE_KINDS = [
|
|
|
1255
1669
|
var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
|
|
1256
1670
|
var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
|
|
1257
1671
|
function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
|
|
1258
|
-
|
|
1672
|
+
useEffect6(() => {
|
|
1259
1673
|
if (!onClose) return void 0;
|
|
1260
1674
|
const close = () => onClose();
|
|
1261
1675
|
window.addEventListener("scroll", close, true);
|
|
@@ -1269,8 +1683,8 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
|
|
|
1269
1683
|
const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));
|
|
1270
1684
|
let top = anchor.bottom + 6;
|
|
1271
1685
|
if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
|
|
1272
|
-
return
|
|
1273
|
-
/* @__PURE__ */
|
|
1686
|
+
return createPortal2(
|
|
1687
|
+
/* @__PURE__ */ jsx11("div", { className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
|
|
1274
1688
|
document.body
|
|
1275
1689
|
);
|
|
1276
1690
|
}
|
|
@@ -1290,8 +1704,8 @@ function pillColor(label, options) {
|
|
|
1290
1704
|
return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
|
|
1291
1705
|
}
|
|
1292
1706
|
function RefImage({ refVal, fetchBlobUrl }) {
|
|
1293
|
-
const [src, setSrc] =
|
|
1294
|
-
|
|
1707
|
+
const [src, setSrc] = useState7(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
|
|
1708
|
+
useEffect6(() => {
|
|
1295
1709
|
let dead = false;
|
|
1296
1710
|
let obj = null;
|
|
1297
1711
|
if (!src && refVal.url && fetchBlobUrl) {
|
|
@@ -1307,16 +1721,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
|
|
|
1307
1721
|
if (obj) URL.revokeObjectURL(obj);
|
|
1308
1722
|
};
|
|
1309
1723
|
}, [refVal.url]);
|
|
1310
|
-
if (!src) return /* @__PURE__ */
|
|
1724
|
+
if (!src) return /* @__PURE__ */ jsxs10("span", { className: "shg-refchip", children: [
|
|
1311
1725
|
RESOURCE_ICON.image,
|
|
1312
1726
|
" ",
|
|
1313
1727
|
refVal.name || "image"
|
|
1314
1728
|
] });
|
|
1315
|
-
return /* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ jsx11("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
|
|
1316
1730
|
}
|
|
1317
1731
|
function ResourceChip({ refVal, onOpen }) {
|
|
1318
1732
|
const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
|
|
1319
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsxs10(
|
|
1320
1734
|
"button",
|
|
1321
1735
|
{
|
|
1322
1736
|
className: "shg-refchip shg-refchip-btn",
|
|
@@ -1326,54 +1740,54 @@ function ResourceChip({ refVal, onOpen }) {
|
|
|
1326
1740
|
onOpen && onOpen(refVal);
|
|
1327
1741
|
},
|
|
1328
1742
|
children: [
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1743
|
+
/* @__PURE__ */ jsx11("span", { className: "shg-refchip-ic", children: icon }),
|
|
1744
|
+
/* @__PURE__ */ jsx11("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
|
|
1331
1745
|
]
|
|
1332
1746
|
}
|
|
1333
1747
|
);
|
|
1334
1748
|
}
|
|
1335
1749
|
function StatusDot({ status }) {
|
|
1336
1750
|
if (!status || status === "empty") return null;
|
|
1337
|
-
return /* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsx11("span", { className: `shg-dot shg-dot-${status}`, title: status });
|
|
1338
1752
|
}
|
|
1339
1753
|
function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
|
|
1340
1754
|
const v = cell?.value;
|
|
1341
|
-
if (v === void 0 || v === null || v === "") return /* @__PURE__ */
|
|
1755
|
+
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt" });
|
|
1342
1756
|
if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
|
|
1343
|
-
if (v.kind === "image") return /* @__PURE__ */
|
|
1344
|
-
return /* @__PURE__ */
|
|
1757
|
+
if (v.kind === "image") return /* @__PURE__ */ jsx11(RefImage, { refVal: v, fetchBlobUrl });
|
|
1758
|
+
return /* @__PURE__ */ jsx11(ResourceChip, { refVal: v, onOpen: onOpenResource });
|
|
1345
1759
|
}
|
|
1346
1760
|
switch (col.type) {
|
|
1347
1761
|
case "select":
|
|
1348
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
|
|
1349
1763
|
case "tags": {
|
|
1350
1764
|
const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
1351
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
|
|
1352
1766
|
}
|
|
1353
1767
|
case "checkbox":
|
|
1354
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
|
|
1355
1769
|
case "url": {
|
|
1356
1770
|
const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
|
|
1357
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsx11("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
|
|
1358
1772
|
}
|
|
1359
1773
|
case "number":
|
|
1360
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt shg-num", children: String(v) });
|
|
1361
1775
|
default:
|
|
1362
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
|
|
1363
1777
|
}
|
|
1364
1778
|
}
|
|
1365
1779
|
function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false, fetchBlobUrl, onOpenResource, peerMarks, onActiveCell }) {
|
|
1366
1780
|
const columns = sheet?.columns || [];
|
|
1367
1781
|
const rows = sheet?.rows || [];
|
|
1368
1782
|
const cells = sheet?.cells || {};
|
|
1369
|
-
const [editing, setEditing] =
|
|
1370
|
-
const [draft, setDraft] =
|
|
1371
|
-
const [menuCol, setMenuCol] =
|
|
1372
|
-
const [sizeDraft, setSizeDraft] =
|
|
1373
|
-
const [dnd, setDnd] =
|
|
1374
|
-
const [dropAt, setDropAt] =
|
|
1375
|
-
const inputRef =
|
|
1376
|
-
const dragRef =
|
|
1783
|
+
const [editing, setEditing] = useState7(null);
|
|
1784
|
+
const [draft, setDraft] = useState7("");
|
|
1785
|
+
const [menuCol, setMenuCol] = useState7(null);
|
|
1786
|
+
const [sizeDraft, setSizeDraft] = useState7({});
|
|
1787
|
+
const [dnd, setDnd] = useState7(null);
|
|
1788
|
+
const [dropAt, setDropAt] = useState7(null);
|
|
1789
|
+
const inputRef = useRef6(null);
|
|
1790
|
+
const dragRef = useRef6(null);
|
|
1377
1791
|
const startResize = (e, kind, id, start) => {
|
|
1378
1792
|
if (readOnly) return;
|
|
1379
1793
|
e.preventDefault();
|
|
@@ -1468,7 +1882,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1468
1882
|
const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
|
|
1469
1883
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
1470
1884
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
1471
|
-
|
|
1885
|
+
useEffect6(() => {
|
|
1472
1886
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
1473
1887
|
}, [editing]);
|
|
1474
1888
|
const mutate = (fn) => {
|
|
@@ -1535,7 +1949,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1535
1949
|
if (col.type === "resource") {
|
|
1536
1950
|
const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
|
|
1537
1951
|
const set = (k, v) => setDraft({ ...d, [k]: v });
|
|
1538
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ jsx11(
|
|
1539
1953
|
PopPortal,
|
|
1540
1954
|
{
|
|
1541
1955
|
anchor: editing.rect,
|
|
@@ -1543,17 +1957,17 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1543
1957
|
estHeight: 230,
|
|
1544
1958
|
className: "shg-select-pop shg-ref-pop",
|
|
1545
1959
|
onClose: () => setEditing(null),
|
|
1546
|
-
children: /* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1960
|
+
children: /* @__PURE__ */ jsxs10("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
1961
|
+
/* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: k }, k)) }),
|
|
1962
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
|
|
1963
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
|
|
1964
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
|
|
1965
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
|
|
1966
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-pop-clear", onClick: () => {
|
|
1553
1967
|
setCell(editing.rowId, editing.colId, null);
|
|
1554
1968
|
setEditing(null);
|
|
1555
1969
|
}, children: "Clear" }),
|
|
1556
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: () => {
|
|
1557
1971
|
setCell(editing.rowId, editing.colId, d);
|
|
1558
1972
|
setEditing(null);
|
|
1559
1973
|
}, children: "Set" })
|
|
@@ -1564,7 +1978,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1564
1978
|
}
|
|
1565
1979
|
if (col.type === "select") {
|
|
1566
1980
|
const opts = normOptions(col.options);
|
|
1567
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ jsxs10(
|
|
1568
1982
|
PopPortal,
|
|
1569
1983
|
{
|
|
1570
1984
|
anchor: editing.rect,
|
|
@@ -1573,8 +1987,8 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1573
1987
|
className: "shg-select-pop",
|
|
1574
1988
|
onClose: () => setEditing(null),
|
|
1575
1989
|
children: [
|
|
1576
|
-
opts.length === 0 && /* @__PURE__ */
|
|
1577
|
-
opts.map((o) => /* @__PURE__ */
|
|
1990
|
+
opts.length === 0 && /* @__PURE__ */ jsx11("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
|
|
1991
|
+
opts.map((o) => /* @__PURE__ */ jsx11(
|
|
1578
1992
|
"button",
|
|
1579
1993
|
{
|
|
1580
1994
|
className: "shg-pill shg-pill-btn",
|
|
@@ -1588,7 +2002,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1588
2002
|
},
|
|
1589
2003
|
o.label
|
|
1590
2004
|
)),
|
|
1591
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ jsx11(
|
|
1592
2006
|
"button",
|
|
1593
2007
|
{
|
|
1594
2008
|
className: "shg-pop-clear",
|
|
@@ -1605,7 +2019,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1605
2019
|
);
|
|
1606
2020
|
}
|
|
1607
2021
|
const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
|
|
1608
|
-
return /* @__PURE__ */
|
|
2022
|
+
return /* @__PURE__ */ jsx11(
|
|
1609
2023
|
"input",
|
|
1610
2024
|
{
|
|
1611
2025
|
ref: inputRef,
|
|
@@ -1622,18 +2036,18 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1622
2036
|
}
|
|
1623
2037
|
);
|
|
1624
2038
|
};
|
|
1625
|
-
return /* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
columns.map((col) => /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx11("div", { className: "shg", children: /* @__PURE__ */ jsx11("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs10("table", { className: "shg-table", children: [
|
|
2040
|
+
/* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
|
|
2041
|
+
/* @__PURE__ */ jsx11("th", { className: "shg-corner", style: numStyle }),
|
|
2042
|
+
columns.map((col) => /* @__PURE__ */ jsxs10(
|
|
1629
2043
|
"th",
|
|
1630
2044
|
{
|
|
1631
2045
|
className: "shg-col" + (col.type === "compute" ? " shg-col-compute" : "") + dndClass("col", col.id),
|
|
1632
2046
|
style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
|
|
1633
2047
|
...dndProps("col", col.id),
|
|
1634
2048
|
children: [
|
|
1635
|
-
!readOnly && /* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
2049
|
+
!readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
|
|
2050
|
+
/* @__PURE__ */ jsx11("div", { className: "shg-col-h", children: /* @__PURE__ */ jsx11(
|
|
1637
2051
|
ColumnHeader,
|
|
1638
2052
|
{
|
|
1639
2053
|
col,
|
|
@@ -1656,10 +2070,10 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1656
2070
|
},
|
|
1657
2071
|
col.id
|
|
1658
2072
|
)),
|
|
1659
|
-
!readOnly && /* @__PURE__ */
|
|
2073
|
+
!readOnly && /* @__PURE__ */ jsx11("th", { className: "shg-add-col", children: /* @__PURE__ */ jsx11("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
|
|
1660
2074
|
] }) }),
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
rows.map((row, ri) => /* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ jsxs10("tbody", { children: [
|
|
2076
|
+
rows.map((row, ri) => /* @__PURE__ */ jsxs10(
|
|
1663
2077
|
"tr",
|
|
1664
2078
|
{
|
|
1665
2079
|
style: {
|
|
@@ -1667,7 +2081,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1667
2081
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
1668
2082
|
},
|
|
1669
2083
|
children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsxs10(
|
|
1671
2085
|
"td",
|
|
1672
2086
|
{
|
|
1673
2087
|
className: "shg-rownum" + dndClass("row", row.id),
|
|
@@ -1675,9 +2089,9 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1675
2089
|
title: "Drag to reorder",
|
|
1676
2090
|
...dndProps("row", row.id),
|
|
1677
2091
|
children: [
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
!readOnly && /* @__PURE__ */
|
|
1680
|
-
!readOnly && /* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ jsx11("span", { children: ri + 1 }),
|
|
2093
|
+
!readOnly && /* @__PURE__ */ jsx11("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
|
|
2094
|
+
!readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
|
|
1681
2095
|
]
|
|
1682
2096
|
}
|
|
1683
2097
|
),
|
|
@@ -1685,7 +2099,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1685
2099
|
const c = cells[cellKey(row.id, col.id)] || {};
|
|
1686
2100
|
const isEditing = editing && editing.rowId === row.id && editing.colId === col.id;
|
|
1687
2101
|
const peer = peerMarks && peerMarks[cellKey(row.id, col.id)];
|
|
1688
|
-
return /* @__PURE__ */
|
|
2102
|
+
return /* @__PURE__ */ jsxs10(
|
|
1689
2103
|
"td",
|
|
1690
2104
|
{
|
|
1691
2105
|
className: "shg-cell" + (col.type === "compute" ? " shg-cell-compute" : "") + (c.status && col.type === "compute" ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
@@ -1695,16 +2109,16 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1695
2109
|
},
|
|
1696
2110
|
title: c.error || "",
|
|
1697
2111
|
children: [
|
|
1698
|
-
peer && /* @__PURE__ */
|
|
1699
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */
|
|
2112
|
+
peer && /* @__PURE__ */ jsx11("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
2113
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ jsxs10(
|
|
1700
2114
|
"div",
|
|
1701
2115
|
{
|
|
1702
2116
|
className: "shg-val",
|
|
1703
2117
|
style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
|
|
1704
2118
|
children: [
|
|
1705
|
-
col.type === "compute" && /* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */
|
|
2119
|
+
col.type === "compute" && /* @__PURE__ */ jsx11(StatusDot, { status: c.status }),
|
|
2120
|
+
/* @__PURE__ */ jsx11(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
2121
|
+
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ jsx11(
|
|
1708
2122
|
"button",
|
|
1709
2123
|
{
|
|
1710
2124
|
className: "shg-runcell",
|
|
@@ -1724,25 +2138,25 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1724
2138
|
col.id
|
|
1725
2139
|
);
|
|
1726
2140
|
}),
|
|
1727
|
-
!readOnly && /* @__PURE__ */
|
|
2141
|
+
!readOnly && /* @__PURE__ */ jsx11("td", { className: "shg-pad" })
|
|
1728
2142
|
]
|
|
1729
2143
|
},
|
|
1730
2144
|
row.id
|
|
1731
2145
|
)),
|
|
1732
|
-
!readOnly && /* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
2146
|
+
!readOnly && /* @__PURE__ */ jsxs10("tr", { className: "shg-ghost-row", onClick: addRow, children: [
|
|
2147
|
+
/* @__PURE__ */ jsx11("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
|
|
2148
|
+
/* @__PURE__ */ jsx11("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
|
|
1735
2149
|
] })
|
|
1736
2150
|
] })
|
|
1737
2151
|
] }) }) });
|
|
1738
2152
|
}
|
|
1739
2153
|
function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, onCloseMenu, onRename, onConfigure, onDelete, onRun }) {
|
|
1740
|
-
const [editing, setEditing] =
|
|
1741
|
-
const [name, setName] =
|
|
1742
|
-
|
|
1743
|
-
return /* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
editing && !readOnly ? /* @__PURE__ */
|
|
2154
|
+
const [editing, setEditing] = useState7(false);
|
|
2155
|
+
const [name, setName] = useState7(col.name);
|
|
2156
|
+
useEffect6(() => setName(col.name), [col.name]);
|
|
2157
|
+
return /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr", children: [
|
|
2158
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-main", children: [
|
|
2159
|
+
editing && !readOnly ? /* @__PURE__ */ jsx11(
|
|
1746
2160
|
"input",
|
|
1747
2161
|
{
|
|
1748
2162
|
className: "shg-colname-input",
|
|
@@ -1757,17 +2171,17 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1757
2171
|
if (e.key === "Enter") e.target.blur();
|
|
1758
2172
|
}
|
|
1759
2173
|
}
|
|
1760
|
-
) : /* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */
|
|
2174
|
+
) : /* @__PURE__ */ jsx11("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
|
|
2175
|
+
/* @__PURE__ */ jsxs10("span", { className: "shg-coltype" + (col.type === "compute" ? " compute" : ""), children: [
|
|
1762
2176
|
TYPE_LABEL[col.type] || col.type,
|
|
1763
2177
|
col.type === "compute" && col.compute?.kind ? ` \xB7 ${col.compute.kind}` : ""
|
|
1764
2178
|
] })
|
|
1765
2179
|
] }),
|
|
1766
|
-
!readOnly && /* @__PURE__ */
|
|
1767
|
-
onRun && /* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
2180
|
+
!readOnly && /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-tools", children: [
|
|
2181
|
+
onRun && /* @__PURE__ */ jsx11("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
|
|
2182
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
|
|
1769
2183
|
] }),
|
|
1770
|
-
menuOpen && !readOnly && /* @__PURE__ */
|
|
2184
|
+
menuOpen && !readOnly && /* @__PURE__ */ jsx11(
|
|
1771
2185
|
ColumnMenu,
|
|
1772
2186
|
{
|
|
1773
2187
|
col,
|
|
@@ -1784,19 +2198,19 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1784
2198
|
] });
|
|
1785
2199
|
}
|
|
1786
2200
|
function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
1787
|
-
const [type, setType] =
|
|
1788
|
-
const [optText, setOptText] =
|
|
2201
|
+
const [type, setType] = useState7(col.type || "text");
|
|
2202
|
+
const [optText, setOptText] = useState7(
|
|
1789
2203
|
normOptions(col.options).map((o) => o.label).join("\n")
|
|
1790
2204
|
);
|
|
1791
2205
|
const comp = col.compute || {};
|
|
1792
|
-
const [kind, setKind] =
|
|
1793
|
-
const [prompt, setPrompt] =
|
|
1794
|
-
const [harnessId, setHarnessId] =
|
|
1795
|
-
const [wfSlug, setWfSlug] =
|
|
1796
|
-
const [outKey, setOutKey] =
|
|
1797
|
-
const [deps, setDeps] =
|
|
1798
|
-
const ref =
|
|
1799
|
-
|
|
2206
|
+
const [kind, setKind] = useState7(comp.kind || "prompt");
|
|
2207
|
+
const [prompt, setPrompt] = useState7(comp.prompt || "");
|
|
2208
|
+
const [harnessId, setHarnessId] = useState7(comp.harness_id || "");
|
|
2209
|
+
const [wfSlug, setWfSlug] = useState7(comp.workflow_slug || "");
|
|
2210
|
+
const [outKey, setOutKey] = useState7(comp.output_key || "");
|
|
2211
|
+
const [deps, setDeps] = useState7(new Set(comp.deps || []));
|
|
2212
|
+
const ref = useRef6(null);
|
|
2213
|
+
useEffect6(() => {
|
|
1800
2214
|
const onDown = (e) => {
|
|
1801
2215
|
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
1802
2216
|
};
|
|
@@ -1830,17 +2244,17 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1830
2244
|
}
|
|
1831
2245
|
onApply(patch);
|
|
1832
2246
|
};
|
|
1833
|
-
return /* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ jsx11(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ jsxs10("div", { ref, onClick: (e) => e.stopPropagation(), children: [
|
|
2248
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1835
2249
|
"Type",
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
MANUAL_TYPES.map((t) => /* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsxs10("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: [
|
|
2251
|
+
MANUAL_TYPES.map((t) => /* @__PURE__ */ jsx11("option", { value: t, children: TYPE_LABEL[t] }, t)),
|
|
2252
|
+
/* @__PURE__ */ jsx11("option", { value: "compute", children: "Computed" })
|
|
1839
2253
|
] })
|
|
1840
2254
|
] }),
|
|
1841
|
-
(type === "select" || type === "tags") && /* @__PURE__ */
|
|
2255
|
+
(type === "select" || type === "tags") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1842
2256
|
"Options (one per line)",
|
|
1843
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx11(
|
|
1844
2258
|
"textarea",
|
|
1845
2259
|
{
|
|
1846
2260
|
className: "shg-menu-input",
|
|
@@ -1851,15 +2265,15 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1851
2265
|
}
|
|
1852
2266
|
)
|
|
1853
2267
|
] }),
|
|
1854
|
-
type === "compute" && /* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
2268
|
+
type === "compute" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2269
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1856
2270
|
"Runs",
|
|
1857
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k.kind, children: k.label }, k.kind)) })
|
|
1858
2272
|
] }),
|
|
1859
|
-
(kind === "prompt" || kind === "harness") && /* @__PURE__ */
|
|
2273
|
+
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1860
2274
|
"Prompt \u2014 reference columns as ",
|
|
1861
2275
|
"{{Name}}",
|
|
1862
|
-
/* @__PURE__ */
|
|
2276
|
+
/* @__PURE__ */ jsx11(
|
|
1863
2277
|
"textarea",
|
|
1864
2278
|
{
|
|
1865
2279
|
className: "shg-menu-input",
|
|
@@ -1870,32 +2284,32 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1870
2284
|
}
|
|
1871
2285
|
)
|
|
1872
2286
|
] }),
|
|
1873
|
-
kind === "harness" && /* @__PURE__ */
|
|
2287
|
+
kind === "harness" && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1874
2288
|
"Agent id",
|
|
1875
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
|
|
1876
2290
|
] }),
|
|
1877
|
-
kind === "workflow" && /* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
2291
|
+
kind === "workflow" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2292
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1879
2293
|
"Workflow id",
|
|
1880
|
-
/* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
|
|
1881
2295
|
] }),
|
|
1882
|
-
/* @__PURE__ */
|
|
2296
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
1883
2297
|
"Output key (optional)",
|
|
1884
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
|
|
1885
2299
|
] })
|
|
1886
2300
|
] }),
|
|
1887
|
-
others.length > 0 && /* @__PURE__ */
|
|
2301
|
+
others.length > 0 && /* @__PURE__ */ jsxs10("div", { className: "shg-menu-lbl", children: [
|
|
1888
2302
|
"Reads columns",
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */
|
|
2303
|
+
/* @__PURE__ */ jsx11("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ jsxs10("label", { className: "shg-menu-dep", children: [
|
|
2304
|
+
/* @__PURE__ */ jsx11("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
|
|
1891
2305
|
" ",
|
|
1892
2306
|
c.name
|
|
1893
2307
|
] }, c.id)) })
|
|
1894
2308
|
] })
|
|
1895
2309
|
] }),
|
|
1896
|
-
/* @__PURE__ */
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
|
|
2311
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
|
|
2312
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
|
|
1899
2313
|
] })
|
|
1900
2314
|
] }) });
|
|
1901
2315
|
}
|
|
@@ -1934,6 +2348,7 @@ export {
|
|
|
1934
2348
|
CodeBlock,
|
|
1935
2349
|
Composer,
|
|
1936
2350
|
DEFAULT_STATUS_LABELS,
|
|
2351
|
+
DialogHost,
|
|
1937
2352
|
GOOGLE_ENABLED,
|
|
1938
2353
|
GoogleButton,
|
|
1939
2354
|
IcCheck,
|
|
@@ -1953,6 +2368,7 @@ export {
|
|
|
1953
2368
|
SESSION_EVENT,
|
|
1954
2369
|
SheetGrid,
|
|
1955
2370
|
Svg,
|
|
2371
|
+
TaskList,
|
|
1956
2372
|
ToolGroup,
|
|
1957
2373
|
ToolRow,
|
|
1958
2374
|
UserTurn,
|
|
@@ -1984,7 +2400,9 @@ export {
|
|
|
1984
2400
|
sheetToDelimited,
|
|
1985
2401
|
summarizeSteps,
|
|
1986
2402
|
switchOrg,
|
|
2403
|
+
taskStatusGroup,
|
|
1987
2404
|
toolMeta,
|
|
2405
|
+
useDialog,
|
|
1988
2406
|
useResizablePane,
|
|
1989
2407
|
withReasoning,
|
|
1990
2408
|
withResult,
|