reifyui 0.2.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 +2 -0
- package/dist/index.cjs +407 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +35 -0
- package/dist/index.js +416 -172
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/styles/dialog.css +145 -0
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
CodeBlock: () => CodeBlock,
|
|
38
38
|
Composer: () => Composer,
|
|
39
39
|
DEFAULT_STATUS_LABELS: () => DEFAULT_STATUS_LABELS,
|
|
40
|
+
DialogHost: () => DialogHost,
|
|
40
41
|
GOOGLE_ENABLED: () => GOOGLE_ENABLED,
|
|
41
42
|
GoogleButton: () => GoogleButton,
|
|
42
43
|
IcCheck: () => IcCheck,
|
|
@@ -90,6 +91,7 @@ __export(src_exports, {
|
|
|
90
91
|
switchOrg: () => switchOrg,
|
|
91
92
|
taskStatusGroup: () => taskStatusGroup,
|
|
92
93
|
toolMeta: () => toolMeta,
|
|
94
|
+
useDialog: () => useDialog,
|
|
93
95
|
useResizablePane: () => useResizablePane,
|
|
94
96
|
withReasoning: () => withReasoning,
|
|
95
97
|
withResult: () => withResult,
|
|
@@ -1126,6 +1128,239 @@ function TaskList({
|
|
|
1126
1128
|
] });
|
|
1127
1129
|
}
|
|
1128
1130
|
|
|
1131
|
+
// src/components/Dialog.jsx
|
|
1132
|
+
var import_react9 = require("react");
|
|
1133
|
+
var import_react_dom = require("react-dom");
|
|
1134
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1135
|
+
var DialogCtx = (0, import_react9.createContext)(null);
|
|
1136
|
+
var LABELS = {
|
|
1137
|
+
en: { confirm: "Confirm", cancel: "Cancel", ok: "OK", create: "Create", required: "Please enter a value" },
|
|
1138
|
+
zh: { confirm: "\u786E\u8BA4", cancel: "\u53D6\u6D88", ok: "\u597D\u7684", create: "\u521B\u5EFA", required: "\u8BF7\u8F93\u5165\u5185\u5BB9" }
|
|
1139
|
+
};
|
|
1140
|
+
var _idSeq = 0;
|
|
1141
|
+
function DialogHost({ children, locale = "en", labels }) {
|
|
1142
|
+
const [stack, setStack] = (0, import_react9.useState)([]);
|
|
1143
|
+
const t = (0, import_react9.useMemo)(
|
|
1144
|
+
() => ({ ...LABELS[locale] || LABELS.en, ...labels || {} }),
|
|
1145
|
+
[locale, labels]
|
|
1146
|
+
);
|
|
1147
|
+
const open = (0, import_react9.useCallback)((spec) => new Promise((resolve) => {
|
|
1148
|
+
setStack((s) => [...s, { id: `dlg_${++_idSeq}`, spec, resolve }]);
|
|
1149
|
+
}), []);
|
|
1150
|
+
const close = (0, import_react9.useCallback)((id, value) => {
|
|
1151
|
+
setStack((s) => {
|
|
1152
|
+
const target = s.find((d) => d.id === id);
|
|
1153
|
+
if (target) target.resolve(value);
|
|
1154
|
+
return s.filter((d) => d.id !== id);
|
|
1155
|
+
});
|
|
1156
|
+
}, []);
|
|
1157
|
+
const ctx = (0, import_react9.useMemo)(() => ({
|
|
1158
|
+
confirm: (opts) => open({ kind: "confirm", ...opts }),
|
|
1159
|
+
prompt: (opts) => open({ kind: "prompt", ...opts }),
|
|
1160
|
+
alert: (opts) => open({ kind: "alert", ...opts }),
|
|
1161
|
+
create: (opts) => open({ kind: "create", ...opts }),
|
|
1162
|
+
labels: t
|
|
1163
|
+
}), [open, t]);
|
|
1164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DialogCtx.Provider, { value: ctx, children: [
|
|
1165
|
+
children,
|
|
1166
|
+
stack.length > 0 && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-root", role: "presentation", children: stack.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogShell, { dialog: d, isTop: i === stack.length - 1, onClose: close, t }, d.id)) }),
|
|
1168
|
+
document.body
|
|
1169
|
+
)
|
|
1170
|
+
] });
|
|
1171
|
+
}
|
|
1172
|
+
function useDialog() {
|
|
1173
|
+
const ctx = (0, import_react9.useContext)(DialogCtx);
|
|
1174
|
+
if (!ctx) throw new Error("useDialog() called outside <DialogHost>");
|
|
1175
|
+
return ctx;
|
|
1176
|
+
}
|
|
1177
|
+
var cancelValue = (kind) => kind === "prompt" || kind === "create" ? null : false;
|
|
1178
|
+
function DialogShell({ dialog, isTop, onClose, t }) {
|
|
1179
|
+
const { id, spec } = dialog;
|
|
1180
|
+
const ref = (0, import_react9.useRef)(null);
|
|
1181
|
+
const titleId = (0, import_react9.useId)();
|
|
1182
|
+
(0, import_react9.useEffect)(() => {
|
|
1183
|
+
if (!isTop) return void 0;
|
|
1184
|
+
const onKey = (e) => {
|
|
1185
|
+
if (e.key !== "Escape") return;
|
|
1186
|
+
e.preventDefault();
|
|
1187
|
+
onClose(id, cancelValue(spec.kind));
|
|
1188
|
+
};
|
|
1189
|
+
document.addEventListener("keydown", onKey);
|
|
1190
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
1191
|
+
}, [id, isTop, onClose, spec.kind]);
|
|
1192
|
+
(0, import_react9.useEffect)(() => {
|
|
1193
|
+
if (!isTop || !ref.current) return;
|
|
1194
|
+
const el = ref.current.querySelector("input, textarea") || ref.current.querySelector(".rui-dlg-primary") || ref.current.querySelector("button");
|
|
1195
|
+
el?.focus();
|
|
1196
|
+
}, [isTop]);
|
|
1197
|
+
const onBackdrop = (e) => {
|
|
1198
|
+
if (e.target === e.currentTarget && isTop) onClose(id, cancelValue(spec.kind));
|
|
1199
|
+
};
|
|
1200
|
+
const done = (v) => onClose(id, v);
|
|
1201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1202
|
+
"div",
|
|
1203
|
+
{
|
|
1204
|
+
ref,
|
|
1205
|
+
role: "dialog",
|
|
1206
|
+
"aria-modal": "true",
|
|
1207
|
+
"aria-labelledby": spec.title ? titleId : void 0,
|
|
1208
|
+
className: `rui-dlg-card${spec.kind === "create" ? " is-wide" : ""}`,
|
|
1209
|
+
children: [
|
|
1210
|
+
spec.kind === "alert" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AlertBody, { spec, onClose: done, t, titleId }),
|
|
1211
|
+
spec.kind === "confirm" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ConfirmBody, { spec, onClose: done, t, titleId }),
|
|
1212
|
+
spec.kind === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PromptBody, { spec, onClose: done, t, titleId }),
|
|
1213
|
+
spec.kind === "create" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CreateBody, { spec, onClose: done, t, titleId })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
) });
|
|
1217
|
+
}
|
|
1218
|
+
function Header({ title, variant, titleId }) {
|
|
1219
|
+
if (!title) return null;
|
|
1220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-title", id: titleId, children: title }) });
|
|
1221
|
+
}
|
|
1222
|
+
var Footer = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-f", children });
|
|
1223
|
+
function AlertBody({ spec, onClose, t, titleId }) {
|
|
1224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
|
|
1228
|
+
] });
|
|
1229
|
+
}
|
|
1230
|
+
function ConfirmBody({ spec, onClose, t, titleId }) {
|
|
1231
|
+
const destructive = !!spec.destructive;
|
|
1232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1235
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Footer, { children: [
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1238
|
+
"button",
|
|
1239
|
+
{
|
|
1240
|
+
type: "button",
|
|
1241
|
+
className: `rui-dlg-btn rui-dlg-primary${destructive ? " is-destructive" : ""}`,
|
|
1242
|
+
onClick: () => onClose(true),
|
|
1243
|
+
children: spec.confirmLabel || t.confirm
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
] })
|
|
1247
|
+
] });
|
|
1248
|
+
}
|
|
1249
|
+
function PromptBody({ spec, onClose, t, titleId }) {
|
|
1250
|
+
const [value, setValue] = (0, import_react9.useState)(spec.defaultValue ?? "");
|
|
1251
|
+
const [err, setErr] = (0, import_react9.useState)(null);
|
|
1252
|
+
const inputId = (0, import_react9.useId)();
|
|
1253
|
+
const Field = spec.multiline ? "textarea" : "input";
|
|
1254
|
+
const submit = () => {
|
|
1255
|
+
const invalid = spec.validate?.(value);
|
|
1256
|
+
if (invalid) {
|
|
1257
|
+
setErr(String(invalid));
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1261
|
+
setErr(t.required);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
onClose(String(value));
|
|
1265
|
+
};
|
|
1266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rui-dlg-b", children: [
|
|
1269
|
+
spec.message ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-msg", children: spec.message }) : null,
|
|
1270
|
+
spec.label ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1272
|
+
Field,
|
|
1273
|
+
{
|
|
1274
|
+
id: inputId,
|
|
1275
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1276
|
+
type: spec.multiline ? void 0 : spec.inputType || "text",
|
|
1277
|
+
rows: spec.multiline ? spec.rows || 4 : void 0,
|
|
1278
|
+
value,
|
|
1279
|
+
placeholder: spec.placeholder || "",
|
|
1280
|
+
onChange: (e) => {
|
|
1281
|
+
setValue(e.target.value);
|
|
1282
|
+
if (err) setErr(null);
|
|
1283
|
+
},
|
|
1284
|
+
onKeyDown: (e) => {
|
|
1285
|
+
if (e.key === "Enter" && !e.shiftKey && !spec.multiline) {
|
|
1286
|
+
e.preventDefault();
|
|
1287
|
+
submit();
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
autoComplete: "off",
|
|
1291
|
+
spellCheck: "false"
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
err ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-err", children: err }) : null,
|
|
1295
|
+
!err && spec.help ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-help", children: spec.help }) : null
|
|
1296
|
+
] }),
|
|
1297
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Footer, { children: [
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
|
|
1300
|
+
] })
|
|
1301
|
+
] });
|
|
1302
|
+
}
|
|
1303
|
+
function CreateBody({ spec, onClose, t, titleId }) {
|
|
1304
|
+
const types = spec.types || [];
|
|
1305
|
+
const [kind, setKind] = (0, import_react9.useState)(spec.defaultKind || types[0]?.kind || "");
|
|
1306
|
+
const [value, setValue] = (0, import_react9.useState)(spec.defaultValue ?? "");
|
|
1307
|
+
const [err, setErr] = (0, import_react9.useState)(null);
|
|
1308
|
+
const inputId = (0, import_react9.useId)();
|
|
1309
|
+
const sel = types.find((x) => x.kind === kind) || types[0] || {};
|
|
1310
|
+
const submit = () => {
|
|
1311
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1312
|
+
setErr(t.required);
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
onClose({ kind, name: String(value).trim() });
|
|
1316
|
+
};
|
|
1317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Header, { title: spec.title, titleId }),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rui-dlg-b", children: [
|
|
1320
|
+
types.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1321
|
+
"button",
|
|
1322
|
+
{
|
|
1323
|
+
type: "button",
|
|
1324
|
+
className: `rui-dlg-type${ty.kind === kind ? " is-on" : ""}`,
|
|
1325
|
+
onClick: () => setKind(ty.kind),
|
|
1326
|
+
children: [
|
|
1327
|
+
ty.icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rui-dlg-type-lbl", children: ty.label })
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
ty.kind
|
|
1332
|
+
)) }) : null,
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1335
|
+
"input",
|
|
1336
|
+
{
|
|
1337
|
+
id: inputId,
|
|
1338
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1339
|
+
value,
|
|
1340
|
+
placeholder: spec.placeholder || "Untitled",
|
|
1341
|
+
onChange: (e) => {
|
|
1342
|
+
setValue(e.target.value);
|
|
1343
|
+
if (err) setErr(null);
|
|
1344
|
+
},
|
|
1345
|
+
onKeyDown: (e) => {
|
|
1346
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1347
|
+
e.preventDefault();
|
|
1348
|
+
submit();
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
autoComplete: "off",
|
|
1352
|
+
spellCheck: "false"
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1355
|
+
err ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rui-dlg-err", children: err }) : null
|
|
1356
|
+
] }),
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Footer, { children: [
|
|
1358
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
|
|
1360
|
+
] })
|
|
1361
|
+
] });
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1129
1364
|
// src/auth/client.js
|
|
1130
1365
|
var _cfg = {
|
|
1131
1366
|
engine: "",
|
|
@@ -1275,18 +1510,18 @@ async function fetchBalance() {
|
|
|
1275
1510
|
}
|
|
1276
1511
|
|
|
1277
1512
|
// src/auth/AuthForm.jsx
|
|
1278
|
-
var
|
|
1513
|
+
var import_react11 = require("react");
|
|
1279
1514
|
|
|
1280
1515
|
// src/auth/GoogleButton.jsx
|
|
1281
|
-
var
|
|
1282
|
-
var
|
|
1516
|
+
var import_react10 = require("react");
|
|
1517
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1283
1518
|
var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
|
|
1284
1519
|
function GoogleButton({ onCredential, onError }) {
|
|
1285
|
-
const ref = (0,
|
|
1286
|
-
const [failed, setFailed] = (0,
|
|
1287
|
-
const cb = (0,
|
|
1520
|
+
const ref = (0, import_react10.useRef)(null);
|
|
1521
|
+
const [failed, setFailed] = (0, import_react10.useState)(false);
|
|
1522
|
+
const cb = (0, import_react10.useRef)({ onCredential, onError });
|
|
1288
1523
|
cb.current = { onCredential, onError };
|
|
1289
|
-
(0,
|
|
1524
|
+
(0, import_react10.useEffect)(() => {
|
|
1290
1525
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
1291
1526
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
1292
1527
|
let done = false;
|
|
@@ -1337,24 +1572,24 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
1337
1572
|
};
|
|
1338
1573
|
}, []);
|
|
1339
1574
|
if (!CLIENT_ID || failed) return null;
|
|
1340
|
-
return /* @__PURE__ */ (0,
|
|
1341
|
-
/* @__PURE__ */ (0,
|
|
1342
|
-
/* @__PURE__ */ (0,
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "or" }) }),
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref, className: "auth-gwrap" })
|
|
1343
1578
|
] });
|
|
1344
1579
|
}
|
|
1345
1580
|
var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
1346
1581
|
|
|
1347
1582
|
// src/auth/AuthForm.jsx
|
|
1348
|
-
var
|
|
1583
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1349
1584
|
function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
1350
|
-
const [mode, setMode] = (0,
|
|
1351
|
-
const [email, setEmail] = (0,
|
|
1352
|
-
const [password, setPassword] = (0,
|
|
1353
|
-
const [name, setName] = (0,
|
|
1354
|
-
const [err, setErr] = (0,
|
|
1355
|
-
const [busy, setBusy] = (0,
|
|
1356
|
-
const [choices, setChoices] = (0,
|
|
1357
|
-
const [resetSent, setResetSent] = (0,
|
|
1585
|
+
const [mode, setMode] = (0, import_react11.useState)("signin");
|
|
1586
|
+
const [email, setEmail] = (0, import_react11.useState)("");
|
|
1587
|
+
const [password, setPassword] = (0, import_react11.useState)("");
|
|
1588
|
+
const [name, setName] = (0, import_react11.useState)("");
|
|
1589
|
+
const [err, setErr] = (0, import_react11.useState)("");
|
|
1590
|
+
const [busy, setBusy] = (0, import_react11.useState)(false);
|
|
1591
|
+
const [choices, setChoices] = (0, import_react11.useState)(null);
|
|
1592
|
+
const [resetSent, setResetSent] = (0, import_react11.useState)(false);
|
|
1358
1593
|
async function enter(orgId) {
|
|
1359
1594
|
const session = await switchOrg(orgId);
|
|
1360
1595
|
onDone(session);
|
|
@@ -1395,10 +1630,10 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1395
1630
|
}
|
|
1396
1631
|
}
|
|
1397
1632
|
if (choices) {
|
|
1398
|
-
return /* @__PURE__ */ (0,
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1401
|
-
/* @__PURE__ */ (0,
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
1634
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "logo", children: brand }),
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { children: "Choose workspace" }),
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1402
1637
|
"button",
|
|
1403
1638
|
{
|
|
1404
1639
|
type: "button",
|
|
@@ -1416,20 +1651,20 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1416
1651
|
},
|
|
1417
1652
|
o.id
|
|
1418
1653
|
)) }),
|
|
1419
|
-
err && /* @__PURE__ */ (0,
|
|
1654
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "auth-err", children: err })
|
|
1420
1655
|
] });
|
|
1421
1656
|
}
|
|
1422
|
-
return /* @__PURE__ */ (0,
|
|
1423
|
-
/* @__PURE__ */ (0,
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
1426
|
-
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0,
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: submit, children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "logo", children: brand }),
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
|
|
1661
|
+
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "auth-note", children: [
|
|
1428
1663
|
"If an account exists for ",
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: email.trim() }),
|
|
1430
1665
|
", a password reset link is on its way. It is valid for 1 hour."
|
|
1431
1666
|
] }),
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1433
1668
|
"button",
|
|
1434
1669
|
{
|
|
1435
1670
|
type: "button",
|
|
@@ -1443,36 +1678,36 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1443
1678
|
children: "Back to sign in"
|
|
1444
1679
|
}
|
|
1445
1680
|
)
|
|
1446
|
-
] }) : /* @__PURE__ */ (0,
|
|
1447
|
-
/* @__PURE__ */ (0,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1681
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "field", children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { children: "Email" }),
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1450
1685
|
] }),
|
|
1451
|
-
err && /* @__PURE__ */ (0,
|
|
1452
|
-
/* @__PURE__ */ (0,
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1686
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "auth-err", children: err }),
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "auth-switch", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: () => {
|
|
1454
1689
|
setErr("");
|
|
1455
1690
|
setMode("signin");
|
|
1456
1691
|
}, children: "Back to sign in" }) })
|
|
1457
|
-
] }) : /* @__PURE__ */ (0,
|
|
1458
|
-
mode === "register" && /* @__PURE__ */ (0,
|
|
1459
|
-
/* @__PURE__ */ (0,
|
|
1460
|
-
/* @__PURE__ */ (0,
|
|
1692
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1693
|
+
mode === "register" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "field", children: [
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { children: "Name" }),
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
|
|
1461
1696
|
] }),
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1463
|
-
/* @__PURE__ */ (0,
|
|
1464
|
-
/* @__PURE__ */ (0,
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "field", children: [
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { children: "Email" }),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1465
1700
|
] }),
|
|
1466
|
-
/* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1469
|
-
mode === "signin" && /* @__PURE__ */ (0,
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "field", children: [
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "field-row", children: [
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { children: "Password" }),
|
|
1704
|
+
mode === "signin" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "link-sm", onClick: () => {
|
|
1470
1705
|
setErr("");
|
|
1471
1706
|
setResetSent(false);
|
|
1472
1707
|
setMode("forgot");
|
|
1473
1708
|
}, children: "Forgot password?" })
|
|
1474
1709
|
] }),
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1476
1711
|
"input",
|
|
1477
1712
|
{
|
|
1478
1713
|
className: "input",
|
|
@@ -1485,13 +1720,13 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1485
1720
|
}
|
|
1486
1721
|
)
|
|
1487
1722
|
] }),
|
|
1488
|
-
err && /* @__PURE__ */ (0,
|
|
1489
|
-
/* @__PURE__ */ (0,
|
|
1490
|
-
GOOGLE_ENABLED && /* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "auth-err", children: err }),
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
|
|
1725
|
+
GOOGLE_ENABLED && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GoogleButton, { onCredential: onGoogle, onError: setErr }),
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "auth-switch", children: [
|
|
1492
1727
|
mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
|
|
1493
1728
|
" ",
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: () => {
|
|
1495
1730
|
setErr("");
|
|
1496
1731
|
setMode(mode === "register" ? "signin" : "register");
|
|
1497
1732
|
}, children: mode === "register" ? "Sign in" : "Create one" })
|
|
@@ -1501,9 +1736,9 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1501
1736
|
}
|
|
1502
1737
|
|
|
1503
1738
|
// src/sheet/SheetGrid.jsx
|
|
1504
|
-
var
|
|
1505
|
-
var
|
|
1506
|
-
var
|
|
1739
|
+
var import_react12 = require("react");
|
|
1740
|
+
var import_react_dom2 = require("react-dom");
|
|
1741
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1507
1742
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
1508
1743
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1509
1744
|
var TYPE_LABEL = {
|
|
@@ -1527,7 +1762,7 @@ var COMPUTE_KINDS = [
|
|
|
1527
1762
|
var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
|
|
1528
1763
|
var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
|
|
1529
1764
|
function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
|
|
1530
|
-
(0,
|
|
1765
|
+
(0, import_react12.useEffect)(() => {
|
|
1531
1766
|
if (!onClose) return void 0;
|
|
1532
1767
|
const close = () => onClose();
|
|
1533
1768
|
window.addEventListener("scroll", close, true);
|
|
@@ -1541,8 +1776,8 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
|
|
|
1541
1776
|
const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));
|
|
1542
1777
|
let top = anchor.bottom + 6;
|
|
1543
1778
|
if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
|
|
1544
|
-
return (0,
|
|
1545
|
-
/* @__PURE__ */ (0,
|
|
1779
|
+
return (0, import_react_dom2.createPortal)(
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
|
|
1546
1781
|
document.body
|
|
1547
1782
|
);
|
|
1548
1783
|
}
|
|
@@ -1562,8 +1797,8 @@ function pillColor(label, options) {
|
|
|
1562
1797
|
return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
|
|
1563
1798
|
}
|
|
1564
1799
|
function RefImage({ refVal, fetchBlobUrl }) {
|
|
1565
|
-
const [src, setSrc] = (0,
|
|
1566
|
-
(0,
|
|
1800
|
+
const [src, setSrc] = (0, import_react12.useState)(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
|
|
1801
|
+
(0, import_react12.useEffect)(() => {
|
|
1567
1802
|
let dead = false;
|
|
1568
1803
|
let obj = null;
|
|
1569
1804
|
if (!src && refVal.url && fetchBlobUrl) {
|
|
@@ -1579,16 +1814,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
|
|
|
1579
1814
|
if (obj) URL.revokeObjectURL(obj);
|
|
1580
1815
|
};
|
|
1581
1816
|
}, [refVal.url]);
|
|
1582
|
-
if (!src) return /* @__PURE__ */ (0,
|
|
1817
|
+
if (!src) return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "shg-refchip", children: [
|
|
1583
1818
|
RESOURCE_ICON.image,
|
|
1584
1819
|
" ",
|
|
1585
1820
|
refVal.name || "image"
|
|
1586
1821
|
] });
|
|
1587
|
-
return /* @__PURE__ */ (0,
|
|
1822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
|
|
1588
1823
|
}
|
|
1589
1824
|
function ResourceChip({ refVal, onOpen }) {
|
|
1590
1825
|
const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
|
|
1591
|
-
return /* @__PURE__ */ (0,
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1592
1827
|
"button",
|
|
1593
1828
|
{
|
|
1594
1829
|
className: "shg-refchip shg-refchip-btn",
|
|
@@ -1598,54 +1833,54 @@ function ResourceChip({ refVal, onOpen }) {
|
|
|
1598
1833
|
onOpen && onOpen(refVal);
|
|
1599
1834
|
},
|
|
1600
1835
|
children: [
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-refchip-ic", children: icon }),
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
|
|
1603
1838
|
]
|
|
1604
1839
|
}
|
|
1605
1840
|
);
|
|
1606
1841
|
}
|
|
1607
1842
|
function StatusDot({ status }) {
|
|
1608
1843
|
if (!status || status === "empty") return null;
|
|
1609
|
-
return /* @__PURE__ */ (0,
|
|
1844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: `shg-dot shg-dot-${status}`, title: status });
|
|
1610
1845
|
}
|
|
1611
1846
|
function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
|
|
1612
1847
|
const v = cell?.value;
|
|
1613
|
-
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0,
|
|
1848
|
+
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-val-txt" });
|
|
1614
1849
|
if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
|
|
1615
|
-
if (v.kind === "image") return /* @__PURE__ */ (0,
|
|
1616
|
-
return /* @__PURE__ */ (0,
|
|
1850
|
+
if (v.kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RefImage, { refVal: v, fetchBlobUrl });
|
|
1851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ResourceChip, { refVal: v, onOpen: onOpenResource });
|
|
1617
1852
|
}
|
|
1618
1853
|
switch (col.type) {
|
|
1619
1854
|
case "select":
|
|
1620
|
-
return /* @__PURE__ */ (0,
|
|
1855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
|
|
1621
1856
|
case "tags": {
|
|
1622
1857
|
const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
1623
|
-
return /* @__PURE__ */ (0,
|
|
1858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
|
|
1624
1859
|
}
|
|
1625
1860
|
case "checkbox":
|
|
1626
|
-
return /* @__PURE__ */ (0,
|
|
1861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
|
|
1627
1862
|
case "url": {
|
|
1628
1863
|
const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
|
|
1629
|
-
return /* @__PURE__ */ (0,
|
|
1864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
|
|
1630
1865
|
}
|
|
1631
1866
|
case "number":
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-val-txt shg-num", children: String(v) });
|
|
1633
1868
|
default:
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
|
|
1635
1870
|
}
|
|
1636
1871
|
}
|
|
1637
1872
|
function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false, fetchBlobUrl, onOpenResource, peerMarks, onActiveCell }) {
|
|
1638
1873
|
const columns = sheet?.columns || [];
|
|
1639
1874
|
const rows = sheet?.rows || [];
|
|
1640
1875
|
const cells = sheet?.cells || {};
|
|
1641
|
-
const [editing, setEditing] = (0,
|
|
1642
|
-
const [draft, setDraft] = (0,
|
|
1643
|
-
const [menuCol, setMenuCol] = (0,
|
|
1644
|
-
const [sizeDraft, setSizeDraft] = (0,
|
|
1645
|
-
const [dnd, setDnd] = (0,
|
|
1646
|
-
const [dropAt, setDropAt] = (0,
|
|
1647
|
-
const inputRef = (0,
|
|
1648
|
-
const dragRef = (0,
|
|
1876
|
+
const [editing, setEditing] = (0, import_react12.useState)(null);
|
|
1877
|
+
const [draft, setDraft] = (0, import_react12.useState)("");
|
|
1878
|
+
const [menuCol, setMenuCol] = (0, import_react12.useState)(null);
|
|
1879
|
+
const [sizeDraft, setSizeDraft] = (0, import_react12.useState)({});
|
|
1880
|
+
const [dnd, setDnd] = (0, import_react12.useState)(null);
|
|
1881
|
+
const [dropAt, setDropAt] = (0, import_react12.useState)(null);
|
|
1882
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
1883
|
+
const dragRef = (0, import_react12.useRef)(null);
|
|
1649
1884
|
const startResize = (e, kind, id, start) => {
|
|
1650
1885
|
if (readOnly) return;
|
|
1651
1886
|
e.preventDefault();
|
|
@@ -1740,7 +1975,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1740
1975
|
const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
|
|
1741
1976
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
1742
1977
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
1743
|
-
(0,
|
|
1978
|
+
(0, import_react12.useEffect)(() => {
|
|
1744
1979
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
1745
1980
|
}, [editing]);
|
|
1746
1981
|
const mutate = (fn) => {
|
|
@@ -1807,7 +2042,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1807
2042
|
if (col.type === "resource") {
|
|
1808
2043
|
const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
|
|
1809
2044
|
const set = (k, v) => setDraft({ ...d, [k]: v });
|
|
1810
|
-
return /* @__PURE__ */ (0,
|
|
2045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1811
2046
|
PopPortal,
|
|
1812
2047
|
{
|
|
1813
2048
|
anchor: editing.rect,
|
|
@@ -1815,17 +2050,17 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1815
2050
|
estHeight: 230,
|
|
1816
2051
|
className: "shg-select-pop shg-ref-pop",
|
|
1817
2052
|
onClose: () => setEditing(null),
|
|
1818
|
-
children: /* @__PURE__ */ (0,
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1820
|
-
/* @__PURE__ */ (0,
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
2053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
2054
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: k, children: k }, k)) }),
|
|
2055
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-pop-clear", onClick: () => {
|
|
1825
2060
|
setCell(editing.rowId, editing.colId, null);
|
|
1826
2061
|
setEditing(null);
|
|
1827
2062
|
}, children: "Clear" }),
|
|
1828
|
-
/* @__PURE__ */ (0,
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-menu-apply", onClick: () => {
|
|
1829
2064
|
setCell(editing.rowId, editing.colId, d);
|
|
1830
2065
|
setEditing(null);
|
|
1831
2066
|
}, children: "Set" })
|
|
@@ -1836,7 +2071,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1836
2071
|
}
|
|
1837
2072
|
if (col.type === "select") {
|
|
1838
2073
|
const opts = normOptions(col.options);
|
|
1839
|
-
return /* @__PURE__ */ (0,
|
|
2074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1840
2075
|
PopPortal,
|
|
1841
2076
|
{
|
|
1842
2077
|
anchor: editing.rect,
|
|
@@ -1845,8 +2080,8 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1845
2080
|
className: "shg-select-pop",
|
|
1846
2081
|
onClose: () => setEditing(null),
|
|
1847
2082
|
children: [
|
|
1848
|
-
opts.length === 0 && /* @__PURE__ */ (0,
|
|
1849
|
-
opts.map((o) => /* @__PURE__ */ (0,
|
|
2083
|
+
opts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
|
|
2084
|
+
opts.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1850
2085
|
"button",
|
|
1851
2086
|
{
|
|
1852
2087
|
className: "shg-pill shg-pill-btn",
|
|
@@ -1860,7 +2095,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1860
2095
|
},
|
|
1861
2096
|
o.label
|
|
1862
2097
|
)),
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1864
2099
|
"button",
|
|
1865
2100
|
{
|
|
1866
2101
|
className: "shg-pop-clear",
|
|
@@ -1877,7 +2112,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1877
2112
|
);
|
|
1878
2113
|
}
|
|
1879
2114
|
const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
|
|
1880
|
-
return /* @__PURE__ */ (0,
|
|
2115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1881
2116
|
"input",
|
|
1882
2117
|
{
|
|
1883
2118
|
ref: inputRef,
|
|
@@ -1894,18 +2129,18 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1894
2129
|
}
|
|
1895
2130
|
);
|
|
1896
2131
|
};
|
|
1897
|
-
return /* @__PURE__ */ (0,
|
|
1898
|
-
/* @__PURE__ */ (0,
|
|
1899
|
-
/* @__PURE__ */ (0,
|
|
1900
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "shg", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "shg-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { className: "shg-table", children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { children: [
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "shg-corner", style: numStyle }),
|
|
2135
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1901
2136
|
"th",
|
|
1902
2137
|
{
|
|
1903
2138
|
className: "shg-col" + (col.type === "compute" ? " shg-col-compute" : "") + dndClass("col", col.id),
|
|
1904
2139
|
style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
|
|
1905
2140
|
...dndProps("col", col.id),
|
|
1906
2141
|
children: [
|
|
1907
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1908
|
-
/* @__PURE__ */ (0,
|
|
2142
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "shg-col-h", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1909
2144
|
ColumnHeader,
|
|
1910
2145
|
{
|
|
1911
2146
|
col,
|
|
@@ -1928,10 +2163,10 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1928
2163
|
},
|
|
1929
2164
|
col.id
|
|
1930
2165
|
)),
|
|
1931
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2166
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "shg-add-col", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
|
|
1932
2167
|
] }) }),
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
1934
|
-
rows.map((row, ri) => /* @__PURE__ */ (0,
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tbody", { children: [
|
|
2169
|
+
rows.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1935
2170
|
"tr",
|
|
1936
2171
|
{
|
|
1937
2172
|
style: {
|
|
@@ -1939,7 +2174,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1939
2174
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
1940
2175
|
},
|
|
1941
2176
|
children: [
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1943
2178
|
"td",
|
|
1944
2179
|
{
|
|
1945
2180
|
className: "shg-rownum" + dndClass("row", row.id),
|
|
@@ -1947,9 +2182,9 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1947
2182
|
title: "Drag to reorder",
|
|
1948
2183
|
...dndProps("row", row.id),
|
|
1949
2184
|
children: [
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
1951
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1952
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2185
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: ri + 1 }),
|
|
2186
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
|
|
2187
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
|
|
1953
2188
|
]
|
|
1954
2189
|
}
|
|
1955
2190
|
),
|
|
@@ -1957,7 +2192,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1957
2192
|
const c = cells[cellKey(row.id, col.id)] || {};
|
|
1958
2193
|
const isEditing = editing && editing.rowId === row.id && editing.colId === col.id;
|
|
1959
2194
|
const peer = peerMarks && peerMarks[cellKey(row.id, col.id)];
|
|
1960
|
-
return /* @__PURE__ */ (0,
|
|
2195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1961
2196
|
"td",
|
|
1962
2197
|
{
|
|
1963
2198
|
className: "shg-cell" + (col.type === "compute" ? " shg-cell-compute" : "") + (c.status && col.type === "compute" ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
@@ -1967,16 +2202,16 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1967
2202
|
},
|
|
1968
2203
|
title: c.error || "",
|
|
1969
2204
|
children: [
|
|
1970
|
-
peer && /* @__PURE__ */ (0,
|
|
1971
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */ (0,
|
|
2205
|
+
peer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
2206
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1972
2207
|
"div",
|
|
1973
2208
|
{
|
|
1974
2209
|
className: "shg-val",
|
|
1975
2210
|
style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
|
|
1976
2211
|
children: [
|
|
1977
|
-
col.type === "compute" && /* @__PURE__ */ (0,
|
|
1978
|
-
/* @__PURE__ */ (0,
|
|
1979
|
-
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0,
|
|
2212
|
+
col.type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StatusDot, { status: c.status }),
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
2214
|
+
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1980
2215
|
"button",
|
|
1981
2216
|
{
|
|
1982
2217
|
className: "shg-runcell",
|
|
@@ -1996,25 +2231,25 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1996
2231
|
col.id
|
|
1997
2232
|
);
|
|
1998
2233
|
}),
|
|
1999
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2234
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "shg-pad" })
|
|
2000
2235
|
]
|
|
2001
2236
|
},
|
|
2002
2237
|
row.id
|
|
2003
2238
|
)),
|
|
2004
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2006
|
-
/* @__PURE__ */ (0,
|
|
2239
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { className: "shg-ghost-row", onClick: addRow, children: [
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
|
|
2007
2242
|
] })
|
|
2008
2243
|
] })
|
|
2009
2244
|
] }) }) });
|
|
2010
2245
|
}
|
|
2011
2246
|
function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, onCloseMenu, onRename, onConfigure, onDelete, onRun }) {
|
|
2012
|
-
const [editing, setEditing] = (0,
|
|
2013
|
-
const [name, setName] = (0,
|
|
2014
|
-
(0,
|
|
2015
|
-
return /* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
editing && !readOnly ? /* @__PURE__ */ (0,
|
|
2247
|
+
const [editing, setEditing] = (0, import_react12.useState)(false);
|
|
2248
|
+
const [name, setName] = (0, import_react12.useState)(col.name);
|
|
2249
|
+
(0, import_react12.useEffect)(() => setName(col.name), [col.name]);
|
|
2250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-colhdr", children: [
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-colhdr-main", children: [
|
|
2252
|
+
editing && !readOnly ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2018
2253
|
"input",
|
|
2019
2254
|
{
|
|
2020
2255
|
className: "shg-colname-input",
|
|
@@ -2029,17 +2264,17 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
2029
2264
|
if (e.key === "Enter") e.target.blur();
|
|
2030
2265
|
}
|
|
2031
2266
|
}
|
|
2032
|
-
) : /* @__PURE__ */ (0,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2267
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "shg-coltype" + (col.type === "compute" ? " compute" : ""), children: [
|
|
2034
2269
|
TYPE_LABEL[col.type] || col.type,
|
|
2035
2270
|
col.type === "compute" && col.compute?.kind ? ` \xB7 ${col.compute.kind}` : ""
|
|
2036
2271
|
] })
|
|
2037
2272
|
] }),
|
|
2038
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2039
|
-
onRun && /* @__PURE__ */ (0,
|
|
2040
|
-
/* @__PURE__ */ (0,
|
|
2273
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-colhdr-tools", children: [
|
|
2274
|
+
onRun && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
|
|
2275
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
|
|
2041
2276
|
] }),
|
|
2042
|
-
menuOpen && !readOnly && /* @__PURE__ */ (0,
|
|
2277
|
+
menuOpen && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2043
2278
|
ColumnMenu,
|
|
2044
2279
|
{
|
|
2045
2280
|
col,
|
|
@@ -2056,19 +2291,19 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
2056
2291
|
] });
|
|
2057
2292
|
}
|
|
2058
2293
|
function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
2059
|
-
const [type, setType] = (0,
|
|
2060
|
-
const [optText, setOptText] = (0,
|
|
2294
|
+
const [type, setType] = (0, import_react12.useState)(col.type || "text");
|
|
2295
|
+
const [optText, setOptText] = (0, import_react12.useState)(
|
|
2061
2296
|
normOptions(col.options).map((o) => o.label).join("\n")
|
|
2062
2297
|
);
|
|
2063
2298
|
const comp = col.compute || {};
|
|
2064
|
-
const [kind, setKind] = (0,
|
|
2065
|
-
const [prompt, setPrompt] = (0,
|
|
2066
|
-
const [harnessId, setHarnessId] = (0,
|
|
2067
|
-
const [wfSlug, setWfSlug] = (0,
|
|
2068
|
-
const [outKey, setOutKey] = (0,
|
|
2069
|
-
const [deps, setDeps] = (0,
|
|
2070
|
-
const ref = (0,
|
|
2071
|
-
(0,
|
|
2299
|
+
const [kind, setKind] = (0, import_react12.useState)(comp.kind || "prompt");
|
|
2300
|
+
const [prompt, setPrompt] = (0, import_react12.useState)(comp.prompt || "");
|
|
2301
|
+
const [harnessId, setHarnessId] = (0, import_react12.useState)(comp.harness_id || "");
|
|
2302
|
+
const [wfSlug, setWfSlug] = (0, import_react12.useState)(comp.workflow_slug || "");
|
|
2303
|
+
const [outKey, setOutKey] = (0, import_react12.useState)(comp.output_key || "");
|
|
2304
|
+
const [deps, setDeps] = (0, import_react12.useState)(new Set(comp.deps || []));
|
|
2305
|
+
const ref = (0, import_react12.useRef)(null);
|
|
2306
|
+
(0, import_react12.useEffect)(() => {
|
|
2072
2307
|
const onDown = (e) => {
|
|
2073
2308
|
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
2074
2309
|
};
|
|
@@ -2102,17 +2337,17 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2102
2337
|
}
|
|
2103
2338
|
onApply(patch);
|
|
2104
2339
|
};
|
|
2105
|
-
return /* @__PURE__ */ (0,
|
|
2106
|
-
/* @__PURE__ */ (0,
|
|
2340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, onClick: (e) => e.stopPropagation(), children: [
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2107
2342
|
"Type",
|
|
2108
|
-
/* @__PURE__ */ (0,
|
|
2109
|
-
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2110
|
-
/* @__PURE__ */ (0,
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: [
|
|
2344
|
+
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: t, children: TYPE_LABEL[t] }, t)),
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "compute", children: "Computed" })
|
|
2111
2346
|
] })
|
|
2112
2347
|
] }),
|
|
2113
|
-
(type === "select" || type === "tags") && /* @__PURE__ */ (0,
|
|
2348
|
+
(type === "select" || type === "tags") && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2114
2349
|
"Options (one per line)",
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2116
2351
|
"textarea",
|
|
2117
2352
|
{
|
|
2118
2353
|
className: "shg-menu-input",
|
|
@@ -2123,15 +2358,15 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2123
2358
|
}
|
|
2124
2359
|
)
|
|
2125
2360
|
] }),
|
|
2126
|
-
type === "compute" && /* @__PURE__ */ (0,
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2361
|
+
type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2128
2363
|
"Runs",
|
|
2129
|
-
/* @__PURE__ */ (0,
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: k.kind, children: k.label }, k.kind)) })
|
|
2130
2365
|
] }),
|
|
2131
|
-
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0,
|
|
2366
|
+
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2132
2367
|
"Prompt \u2014 reference columns as ",
|
|
2133
2368
|
"{{Name}}",
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2135
2370
|
"textarea",
|
|
2136
2371
|
{
|
|
2137
2372
|
className: "shg-menu-input",
|
|
@@ -2142,32 +2377,32 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2142
2377
|
}
|
|
2143
2378
|
)
|
|
2144
2379
|
] }),
|
|
2145
|
-
kind === "harness" && /* @__PURE__ */ (0,
|
|
2380
|
+
kind === "harness" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2146
2381
|
"Agent id",
|
|
2147
|
-
/* @__PURE__ */ (0,
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
|
|
2148
2383
|
] }),
|
|
2149
|
-
kind === "workflow" && /* @__PURE__ */ (0,
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2384
|
+
kind === "workflow" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2151
2386
|
"Workflow id",
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2387
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
|
|
2153
2388
|
] }),
|
|
2154
|
-
/* @__PURE__ */ (0,
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
2155
2390
|
"Output key (optional)",
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
|
|
2157
2392
|
] })
|
|
2158
2393
|
] }),
|
|
2159
|
-
others.length > 0 && /* @__PURE__ */ (0,
|
|
2394
|
+
others.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-menu-lbl", children: [
|
|
2160
2395
|
"Reads columns",
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2162
|
-
/* @__PURE__ */ (0,
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "shg-menu-dep", children: [
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
|
|
2163
2398
|
" ",
|
|
2164
2399
|
c.name
|
|
2165
2400
|
] }, c.id)) })
|
|
2166
2401
|
] })
|
|
2167
2402
|
] }),
|
|
2168
|
-
/* @__PURE__ */ (0,
|
|
2169
|
-
/* @__PURE__ */ (0,
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2403
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
|
|
2171
2406
|
] })
|
|
2172
2407
|
] }) });
|
|
2173
2408
|
}
|