@upstash/react-redis-browser 0.2.14-rc.4 → 0.2.14-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +17 -5
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +384 -86
- package/dist/index.mjs +690 -392
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect22, useMemo as useMemo12, useRef as useRef11 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/dark-mode-context.tsx
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
@@ -3167,7 +3167,7 @@ var portalRoot = root;
|
|
|
3167
3167
|
var portalWrapper = wrapper;
|
|
3168
3168
|
|
|
3169
3169
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
3170
|
-
import { useState as
|
|
3170
|
+
import { useEffect as useEffect19, useState as useState25 } from "react";
|
|
3171
3171
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
3172
3172
|
|
|
3173
3173
|
// src/components/ui/segmented.tsx
|
|
@@ -3177,14 +3177,16 @@ var Segmented = ({
|
|
|
3177
3177
|
value,
|
|
3178
3178
|
onChange,
|
|
3179
3179
|
className,
|
|
3180
|
-
buttonClassName
|
|
3180
|
+
buttonClassName,
|
|
3181
|
+
selectedClassName,
|
|
3182
|
+
unselectedClassName
|
|
3181
3183
|
}) => {
|
|
3182
3184
|
return /* @__PURE__ */ jsx5("div", { className: cn("flex w-fit gap-[2px] rounded-lg bg-zinc-200 p-[2px] text-sm", className), children: options.map((option) => /* @__PURE__ */ jsx5(
|
|
3183
3185
|
"button",
|
|
3184
3186
|
{
|
|
3185
3187
|
className: cn(
|
|
3186
3188
|
"h-7 rounded-md px-3 transition-all",
|
|
3187
|
-
value === option.key ? "bg-white text-zinc-950" : "text-zinc-700",
|
|
3189
|
+
value === option.key ? selectedClassName ?? "bg-white text-zinc-950" : unselectedClassName ?? "text-zinc-700",
|
|
3188
3190
|
buttonClassName
|
|
3189
3191
|
),
|
|
3190
3192
|
onClick: () => {
|
|
@@ -7021,7 +7023,13 @@ var DataDisplay = () => {
|
|
|
7021
7023
|
|
|
7022
7024
|
// src/components/databrowser/components/header/index.tsx
|
|
7023
7025
|
import { useState as useState14 } from "react";
|
|
7024
|
-
import {
|
|
7026
|
+
import {
|
|
7027
|
+
IconChevronDown as IconChevronDown2,
|
|
7028
|
+
IconCircleCheck,
|
|
7029
|
+
IconCirclePlus,
|
|
7030
|
+
IconPlus as IconPlus3,
|
|
7031
|
+
IconSearch as IconSearch2
|
|
7032
|
+
} from "@tabler/icons-react";
|
|
7025
7033
|
|
|
7026
7034
|
// src/components/common/reload-button.tsx
|
|
7027
7035
|
import { useState as useState11 } from "react";
|
|
@@ -7320,10 +7328,14 @@ function DataTypeSelector() {
|
|
|
7320
7328
|
},
|
|
7321
7329
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
7322
7330
|
children: [
|
|
7323
|
-
/* @__PURE__ */ jsx51(SelectTrigger, { className: "!w-auto select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx51(SelectValue, {}) }),
|
|
7324
|
-
/* @__PURE__ */ jsx51(SelectContent, { children: /* @__PURE__ */ jsx51(SelectGroup, { children:
|
|
7325
|
-
|
|
7326
|
-
|
|
7331
|
+
/* @__PURE__ */ jsx51(SelectTrigger, { className: "!w-auto shrink-0 select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx51(SelectValue, {}) }),
|
|
7332
|
+
/* @__PURE__ */ jsx51(SelectContent, { children: /* @__PURE__ */ jsx51(SelectGroup, { children: (() => {
|
|
7333
|
+
const entries = [
|
|
7334
|
+
[ALL_TYPES_KEY, "All Types"],
|
|
7335
|
+
...Object.entries(DATA_TYPE_NAMES)
|
|
7336
|
+
];
|
|
7337
|
+
return entries.map(([key, value]) => /* @__PURE__ */ jsx51(SelectItem, { value: key, children: value }, key));
|
|
7338
|
+
})() }) })
|
|
7327
7339
|
]
|
|
7328
7340
|
}
|
|
7329
7341
|
);
|
|
@@ -7331,11 +7343,11 @@ function DataTypeSelector() {
|
|
|
7331
7343
|
|
|
7332
7344
|
// src/components/databrowser/components/header/index.tsx
|
|
7333
7345
|
import { Fragment as Fragment9, jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7334
|
-
var Header = ({
|
|
7346
|
+
var Header = ({ tabType }) => {
|
|
7335
7347
|
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
7336
7348
|
return /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between gap-1.5", children: [
|
|
7337
7349
|
/* @__PURE__ */ jsxs31("div", { className: "flex grow items-center gap-1.5", children: [
|
|
7338
|
-
|
|
7350
|
+
tabType === "all" && /* @__PURE__ */ jsx52(
|
|
7339
7351
|
Segmented,
|
|
7340
7352
|
{
|
|
7341
7353
|
options: [
|
|
@@ -7354,7 +7366,10 @@ var Header = ({ hideSearchTab = false }) => {
|
|
|
7354
7366
|
value: isValuesSearchSelected ? "values" : "keys",
|
|
7355
7367
|
onChange: (value) => {
|
|
7356
7368
|
setIsValuesSearchSelected(value === "values");
|
|
7357
|
-
}
|
|
7369
|
+
},
|
|
7370
|
+
className: "bg-emerald-800",
|
|
7371
|
+
unselectedClassName: "text-emerald-100",
|
|
7372
|
+
selectedClassName: "bg-emerald-50 text-emerald-800"
|
|
7358
7373
|
}
|
|
7359
7374
|
),
|
|
7360
7375
|
isValuesSearchSelected ? /* @__PURE__ */ jsx52(IndexSelector, {}) : /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
@@ -7364,7 +7379,7 @@ var Header = ({ hideSearchTab = false }) => {
|
|
|
7364
7379
|
] }),
|
|
7365
7380
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1.5", children: [
|
|
7366
7381
|
/* @__PURE__ */ jsx52(RefreshButton, {}),
|
|
7367
|
-
/* @__PURE__ */ jsx52(AddKeyModal, {})
|
|
7382
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx52(AddIndexButton, {}) : /* @__PURE__ */ jsx52(AddKeyModal, {})
|
|
7368
7383
|
] })
|
|
7369
7384
|
] });
|
|
7370
7385
|
};
|
|
@@ -7394,7 +7409,7 @@ var IndexSelector = () => {
|
|
|
7394
7409
|
},
|
|
7395
7410
|
modal: false,
|
|
7396
7411
|
children: [
|
|
7397
|
-
/* @__PURE__ */ jsx52(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs31("button", { className: "flex min-w-[140px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-
|
|
7412
|
+
/* @__PURE__ */ jsx52(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs31("button", { className: "flex min-w-[140px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
|
|
7398
7413
|
/* @__PURE__ */ jsx52("span", { className: "truncate", children: index || "Select an index" }),
|
|
7399
7414
|
/* @__PURE__ */ jsx52(IconChevronDown2, { className: "size-4 shrink-0 opacity-50" })
|
|
7400
7415
|
] }) }),
|
|
@@ -7494,6 +7509,24 @@ var CreateIndexButton = () => {
|
|
|
7494
7509
|
/* @__PURE__ */ jsx52(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
7495
7510
|
] });
|
|
7496
7511
|
};
|
|
7512
|
+
var AddIndexButton = () => {
|
|
7513
|
+
const [open, setOpen] = useState14(false);
|
|
7514
|
+
return /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
7515
|
+
/* @__PURE__ */ jsx52(SimpleTooltip, { content: "Add index", children: /* @__PURE__ */ jsxs31(
|
|
7516
|
+
Button,
|
|
7517
|
+
{
|
|
7518
|
+
variant: "primary",
|
|
7519
|
+
onClick: () => setOpen(true),
|
|
7520
|
+
className: "flex h-8 items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
7521
|
+
children: [
|
|
7522
|
+
/* @__PURE__ */ jsx52(IconPlus3, { className: "size-5" }),
|
|
7523
|
+
"Index"
|
|
7524
|
+
]
|
|
7525
|
+
}
|
|
7526
|
+
) }),
|
|
7527
|
+
/* @__PURE__ */ jsx52(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
7528
|
+
] });
|
|
7529
|
+
};
|
|
7497
7530
|
var RefreshButton = () => {
|
|
7498
7531
|
const { query } = useKeys();
|
|
7499
7532
|
return /* @__PURE__ */ jsx52(
|
|
@@ -8172,89 +8205,339 @@ var QueryBuilder = () => {
|
|
|
8172
8205
|
};
|
|
8173
8206
|
|
|
8174
8207
|
// src/components/databrowser/components/search-empty-state.tsx
|
|
8208
|
+
import { useState as useState16 } from "react";
|
|
8175
8209
|
import { IconCode, IconDatabase, IconDownload, IconSearch as IconSearch3 } from "@tabler/icons-react";
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8210
|
+
|
|
8211
|
+
// src/components/databrowser/components/import-sample-dataset-modal.tsx
|
|
8212
|
+
import { useEffect as useEffect15, useState as useState15 } from "react";
|
|
8213
|
+
import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8214
|
+
var INDEX_NAME = "users-index";
|
|
8215
|
+
var USER_COUNT = 100;
|
|
8216
|
+
var firstNames = [
|
|
8217
|
+
"Emma",
|
|
8218
|
+
"Liam",
|
|
8219
|
+
"Olivia",
|
|
8220
|
+
"Noah",
|
|
8221
|
+
"Ava",
|
|
8222
|
+
"Ethan",
|
|
8223
|
+
"Sophia",
|
|
8224
|
+
"Mason",
|
|
8225
|
+
"Isabella",
|
|
8226
|
+
"William",
|
|
8227
|
+
"Mia",
|
|
8228
|
+
"James",
|
|
8229
|
+
"Charlotte",
|
|
8230
|
+
"Benjamin",
|
|
8231
|
+
"Amelia",
|
|
8232
|
+
"Lucas",
|
|
8233
|
+
"Harper",
|
|
8234
|
+
"Henry",
|
|
8235
|
+
"Evelyn",
|
|
8236
|
+
"Alexander",
|
|
8237
|
+
"Abigail",
|
|
8238
|
+
"Michael",
|
|
8239
|
+
"Emily",
|
|
8240
|
+
"Daniel",
|
|
8241
|
+
"Elizabeth",
|
|
8242
|
+
"Matthew",
|
|
8243
|
+
"Sofia",
|
|
8244
|
+
"Jackson",
|
|
8245
|
+
"Avery",
|
|
8246
|
+
"Sebastian",
|
|
8247
|
+
"Ella",
|
|
8248
|
+
"David",
|
|
8249
|
+
"Scarlett",
|
|
8250
|
+
"Joseph",
|
|
8251
|
+
"Grace",
|
|
8252
|
+
"Samuel",
|
|
8253
|
+
"Chloe",
|
|
8254
|
+
"Owen",
|
|
8255
|
+
"Victoria",
|
|
8256
|
+
"John",
|
|
8257
|
+
"Riley",
|
|
8258
|
+
"Luke",
|
|
8259
|
+
"Aria",
|
|
8260
|
+
"Gabriel",
|
|
8261
|
+
"Lily",
|
|
8262
|
+
"Anthony",
|
|
8263
|
+
"Hannah",
|
|
8264
|
+
"Dylan",
|
|
8265
|
+
"Zoey",
|
|
8266
|
+
"Andrew"
|
|
8267
|
+
];
|
|
8268
|
+
var lastNames = [
|
|
8269
|
+
"Smith",
|
|
8270
|
+
"Johnson",
|
|
8271
|
+
"Williams",
|
|
8272
|
+
"Brown",
|
|
8273
|
+
"Jones",
|
|
8274
|
+
"Garcia",
|
|
8275
|
+
"Miller",
|
|
8276
|
+
"Davis",
|
|
8277
|
+
"Rodriguez",
|
|
8278
|
+
"Martinez",
|
|
8279
|
+
"Hernandez",
|
|
8280
|
+
"Lopez",
|
|
8281
|
+
"Gonzalez",
|
|
8282
|
+
"Wilson",
|
|
8283
|
+
"Anderson",
|
|
8284
|
+
"Thomas",
|
|
8285
|
+
"Taylor",
|
|
8286
|
+
"Moore",
|
|
8287
|
+
"Jackson",
|
|
8288
|
+
"Martin",
|
|
8289
|
+
"Lee",
|
|
8290
|
+
"Perez",
|
|
8291
|
+
"Thompson",
|
|
8292
|
+
"White",
|
|
8293
|
+
"Harris",
|
|
8294
|
+
"Sanchez",
|
|
8295
|
+
"Clark",
|
|
8296
|
+
"Ramirez",
|
|
8297
|
+
"Lewis",
|
|
8298
|
+
"Robinson"
|
|
8299
|
+
];
|
|
8300
|
+
var emailDomains = [
|
|
8301
|
+
"gmail.com",
|
|
8302
|
+
"yahoo.com",
|
|
8303
|
+
"outlook.com",
|
|
8304
|
+
"hotmail.com",
|
|
8305
|
+
"proton.me",
|
|
8306
|
+
"icloud.com",
|
|
8307
|
+
"mail.com"
|
|
8308
|
+
];
|
|
8309
|
+
var areaCodes = ["212", "310", "415", "305", "312", "206", "404", "617", "702", "503"];
|
|
8310
|
+
function randomElement(arr) {
|
|
8311
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
8312
|
+
}
|
|
8313
|
+
function randomInt(min, max) {
|
|
8314
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
8315
|
+
}
|
|
8316
|
+
function randomPhone() {
|
|
8317
|
+
return `${randomElement(areaCodes)}${randomInt(100, 999)}${randomInt(1e3, 9999)}`;
|
|
8318
|
+
}
|
|
8319
|
+
function generateUser(id) {
|
|
8320
|
+
const firstName = randomElement(firstNames);
|
|
8321
|
+
const lastName = randomElement(lastNames);
|
|
8322
|
+
const name = `${firstName} ${lastName}`;
|
|
8323
|
+
const age = randomInt(18, 65);
|
|
8324
|
+
const isStudent = age < 25 ? Math.random() > 0.3 : Math.random() > 0.8;
|
|
8325
|
+
const isEmployed = Math.random() > 0.3;
|
|
8326
|
+
const gender = Math.random() > 0.5 ? "M" : "F";
|
|
8327
|
+
const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}${id}@${randomElement(emailDomains)}`;
|
|
8328
|
+
const phone = randomPhone();
|
|
8329
|
+
return {
|
|
8330
|
+
name,
|
|
8331
|
+
age,
|
|
8332
|
+
isStudent,
|
|
8333
|
+
isEmployed,
|
|
8334
|
+
gender,
|
|
8335
|
+
contact: {
|
|
8336
|
+
email,
|
|
8337
|
+
phone
|
|
8338
|
+
}
|
|
8339
|
+
};
|
|
8340
|
+
}
|
|
8341
|
+
var ImportSampleDatasetModal = ({
|
|
8342
|
+
open,
|
|
8343
|
+
onOpenChange
|
|
8344
|
+
}) => {
|
|
8345
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
8346
|
+
const { setValuesSearchIndex } = useTab();
|
|
8347
|
+
const [status, setStatus] = useState15();
|
|
8348
|
+
const [progress, setProgress] = useState15(0);
|
|
8349
|
+
const [error, setError] = useState15();
|
|
8350
|
+
useEffect15(() => {
|
|
8351
|
+
if (!open) return;
|
|
8352
|
+
setProgress(0);
|
|
8353
|
+
setStatus(void 0);
|
|
8354
|
+
setError(void 0);
|
|
8355
|
+
}, [open]);
|
|
8356
|
+
const handleImport = async () => {
|
|
8357
|
+
try {
|
|
8358
|
+
setStatus("Creating index...");
|
|
8359
|
+
setProgress(10);
|
|
8360
|
+
const index = redis.search.index({ name: INDEX_NAME });
|
|
8361
|
+
try {
|
|
8362
|
+
if (await index.describe()) {
|
|
8363
|
+
await index.drop();
|
|
8216
8364
|
}
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8365
|
+
} catch {
|
|
8366
|
+
}
|
|
8367
|
+
await redis.search.createIndex({
|
|
8368
|
+
dataType: "string",
|
|
8369
|
+
prefix: "user:",
|
|
8370
|
+
name: INDEX_NAME,
|
|
8371
|
+
schema: {
|
|
8372
|
+
name: { type: "TEXT" },
|
|
8373
|
+
age: { type: "F64" },
|
|
8374
|
+
isStudent: { type: "BOOL" },
|
|
8375
|
+
isEmployed: { type: "BOOL" },
|
|
8376
|
+
gender: { type: "TEXT" },
|
|
8377
|
+
"contact.email": { type: "TEXT" },
|
|
8378
|
+
"contact.phone": { type: "TEXT" }
|
|
8379
|
+
}
|
|
8380
|
+
});
|
|
8381
|
+
setStatus("Creating user data...");
|
|
8382
|
+
setProgress(30);
|
|
8383
|
+
const userData = {};
|
|
8384
|
+
for (let i = 1; i <= USER_COUNT; i++) {
|
|
8385
|
+
const user = generateUser(i);
|
|
8386
|
+
const key = `user:${user.name.toLowerCase().replace(" ", "-")}-${i}`;
|
|
8387
|
+
userData[key] = JSON.stringify(user);
|
|
8388
|
+
}
|
|
8389
|
+
setProgress(50);
|
|
8390
|
+
await redis.mset(userData);
|
|
8391
|
+
setStatus("Waiting for indexing...");
|
|
8392
|
+
setProgress(70);
|
|
8393
|
+
await redis.search.index({ name: INDEX_NAME }).waitIndexing();
|
|
8394
|
+
setStatus("Done!");
|
|
8395
|
+
setProgress(100);
|
|
8396
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8397
|
+
queryClient.invalidateQueries({
|
|
8398
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY]
|
|
8399
|
+
});
|
|
8400
|
+
setValuesSearchIndex(INDEX_NAME);
|
|
8401
|
+
onOpenChange(false);
|
|
8402
|
+
} catch (catchedError) {
|
|
8403
|
+
setError(catchedError instanceof Error ? catchedError : new Error(String(catchedError)));
|
|
8404
|
+
setStatus(void 0);
|
|
8405
|
+
}
|
|
8406
|
+
};
|
|
8407
|
+
const isRunning = status !== void 0;
|
|
8408
|
+
return /* @__PURE__ */ jsx56(
|
|
8409
|
+
Dialog,
|
|
8410
|
+
{
|
|
8411
|
+
open,
|
|
8412
|
+
onOpenChange: (isOpen) => {
|
|
8413
|
+
if (!isRunning) onOpenChange(isOpen);
|
|
8414
|
+
},
|
|
8415
|
+
children: /* @__PURE__ */ jsxs32(
|
|
8416
|
+
DialogContent,
|
|
8225
8417
|
{
|
|
8226
|
-
|
|
8418
|
+
onInteractOutside: (e) => {
|
|
8419
|
+
if (isRunning) e.preventDefault();
|
|
8420
|
+
},
|
|
8421
|
+
onEscapeKeyDown: (e) => {
|
|
8422
|
+
if (isRunning) e.preventDefault();
|
|
8227
8423
|
},
|
|
8228
|
-
|
|
8229
|
-
|
|
8424
|
+
children: [
|
|
8425
|
+
/* @__PURE__ */ jsxs32(DialogHeader, { children: [
|
|
8426
|
+
/* @__PURE__ */ jsx56(DialogTitle, { children: "Import Sample Dataset" }),
|
|
8427
|
+
!isRunning && !error && /* @__PURE__ */ jsxs32(DialogDescription, { children: [
|
|
8428
|
+
"This will create a ",
|
|
8429
|
+
/* @__PURE__ */ jsx56("strong", { children: "users-index" }),
|
|
8430
|
+
" with 100 sample user records.",
|
|
8431
|
+
/* @__PURE__ */ jsx56("br", {}),
|
|
8432
|
+
/* @__PURE__ */ jsx56("br", {}),
|
|
8433
|
+
"Each user has name, age, gender, student/employment status, and contact information."
|
|
8434
|
+
] })
|
|
8435
|
+
] }),
|
|
8436
|
+
isRunning && /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
8437
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm text-zinc-500", children: status }),
|
|
8438
|
+
/* @__PURE__ */ jsx56(Progress, { value: progress })
|
|
8439
|
+
] }),
|
|
8440
|
+
error && /* @__PURE__ */ jsx56("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
8441
|
+
/* @__PURE__ */ jsxs32(DialogFooter, { children: [
|
|
8442
|
+
!isRunning && !error && /* @__PURE__ */ jsxs32(Fragment10, { children: [
|
|
8443
|
+
/* @__PURE__ */ jsx56(Button, { onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
8444
|
+
/* @__PURE__ */ jsx56(Button, { variant: "primary", onClick: handleImport, children: "Import" })
|
|
8445
|
+
] }),
|
|
8446
|
+
error && /* @__PURE__ */ jsx56(Button, { onClick: () => onOpenChange(false), children: "Close" })
|
|
8447
|
+
] })
|
|
8448
|
+
]
|
|
8230
8449
|
}
|
|
8231
8450
|
)
|
|
8232
|
-
|
|
8451
|
+
}
|
|
8452
|
+
);
|
|
8453
|
+
};
|
|
8454
|
+
|
|
8455
|
+
// src/components/databrowser/components/search-empty-state.tsx
|
|
8456
|
+
import { jsx as jsx57, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8457
|
+
var SearchEmptyState = () => {
|
|
8458
|
+
const [importModalOpen, setImportModalOpen] = useState16(false);
|
|
8459
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-1 justify-center", children: [
|
|
8460
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex gap-8 rounded-xl border border-zinc-200 bg-gradient-to-b from-zinc-50 to-white p-8", children: [
|
|
8461
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex-1", children: [
|
|
8462
|
+
/* @__PURE__ */ jsx57("h2", { className: "mb-2 text-lg font-semibold text-zinc-900", children: "Redis Search" }),
|
|
8463
|
+
/* @__PURE__ */ jsx57("p", { className: "mb-6 max-w-md text-sm leading-relaxed text-zinc-600", children: "Redis Search allows you to create indexes on your existing keys and perform fast, full-text searches across your data." }),
|
|
8464
|
+
/* @__PURE__ */ jsxs33("div", { className: "space-y-3", children: [
|
|
8465
|
+
/* @__PURE__ */ jsx57("h3", { className: "text-xs font-medium uppercase tracking-wider text-zinc-400", children: "How it works" }),
|
|
8466
|
+
/* @__PURE__ */ jsxs33("div", { className: "space-y-2.5", children: [
|
|
8467
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-start gap-3", children: [
|
|
8468
|
+
/* @__PURE__ */ jsx57("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx57(IconDatabase, { size: 16 }) }),
|
|
8469
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
8470
|
+
/* @__PURE__ */ jsx57("h4", { className: "text-sm font-medium text-zinc-900", children: "Store your data" }),
|
|
8471
|
+
/* @__PURE__ */ jsx57("p", { className: "text-sm text-zinc-500", children: "Add documents as JSON, Hash, or String keys (string content must be valid JSON)." })
|
|
8472
|
+
] })
|
|
8473
|
+
] }),
|
|
8474
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-start gap-3", children: [
|
|
8475
|
+
/* @__PURE__ */ jsx57("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx57(IconCode, { size: 16 }) }),
|
|
8476
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
8477
|
+
/* @__PURE__ */ jsx57("h4", { className: "text-sm font-medium text-zinc-900", children: "Create an index" }),
|
|
8478
|
+
/* @__PURE__ */ jsx57("p", { className: "text-sm text-zinc-500", children: "Define a search index specifying which fields to search on." })
|
|
8479
|
+
] })
|
|
8480
|
+
] }),
|
|
8481
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-start gap-3", children: [
|
|
8482
|
+
/* @__PURE__ */ jsx57("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx57(IconSearch3, { size: 16 }) }),
|
|
8483
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
8484
|
+
/* @__PURE__ */ jsx57("h4", { className: "text-sm font-medium text-zinc-900", children: "Search your data" }),
|
|
8485
|
+
/* @__PURE__ */ jsx57("p", { className: "text-sm text-zinc-500", children: "Query with filters, full-text search, and sorted results." })
|
|
8486
|
+
] })
|
|
8487
|
+
] })
|
|
8488
|
+
] })
|
|
8489
|
+
] }),
|
|
8490
|
+
/* @__PURE__ */ jsx57(
|
|
8491
|
+
"a",
|
|
8492
|
+
{
|
|
8493
|
+
href: "https://upstash-search.mintlify.app/redis/search/introduction",
|
|
8494
|
+
target: "_blank",
|
|
8495
|
+
rel: "noopener noreferrer",
|
|
8496
|
+
className: "mt-5 inline-block text-sm text-emerald-600 underline-offset-2 hover:underline",
|
|
8497
|
+
children: "Learn more \u2192"
|
|
8498
|
+
}
|
|
8499
|
+
)
|
|
8500
|
+
] }),
|
|
8501
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex w-72 flex-col items-center justify-center rounded-lg border border-dashed border-zinc-300 bg-white p-6", children: [
|
|
8502
|
+
/* @__PURE__ */ jsx57("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-zinc-100 text-zinc-500", children: /* @__PURE__ */ jsx57(IconDownload, { size: 24 }) }),
|
|
8503
|
+
/* @__PURE__ */ jsx57("h3", { className: "mb-1 text-sm font-medium text-zinc-900", children: "Get started quickly" }),
|
|
8504
|
+
/* @__PURE__ */ jsx57("p", { className: "mb-4 text-center text-xs text-zinc-500", children: "Import a sample dataset to try out Redis Search" }),
|
|
8505
|
+
/* @__PURE__ */ jsx57(
|
|
8506
|
+
"button",
|
|
8507
|
+
{
|
|
8508
|
+
onClick: () => setImportModalOpen(true),
|
|
8509
|
+
className: "rounded-lg bg-zinc-900 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-zinc-800",
|
|
8510
|
+
children: "Import a sample dataset"
|
|
8511
|
+
}
|
|
8512
|
+
)
|
|
8513
|
+
] })
|
|
8514
|
+
] }),
|
|
8515
|
+
/* @__PURE__ */ jsx57(ImportSampleDatasetModal, { open: importModalOpen, onOpenChange: setImportModalOpen })
|
|
8233
8516
|
] });
|
|
8234
8517
|
};
|
|
8235
8518
|
|
|
8236
8519
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
8237
|
-
import { jsx as
|
|
8520
|
+
import { jsx as jsx58, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8238
8521
|
var Empty = () => {
|
|
8239
|
-
return /* @__PURE__ */
|
|
8240
|
-
/* @__PURE__ */
|
|
8241
|
-
/* @__PURE__ */
|
|
8522
|
+
return /* @__PURE__ */ jsx58("div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ jsxs34("div", { className: "space-y-5", children: [
|
|
8523
|
+
/* @__PURE__ */ jsx58("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
8524
|
+
/* @__PURE__ */ jsx58("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
8242
8525
|
] }) });
|
|
8243
8526
|
};
|
|
8244
8527
|
|
|
8245
8528
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
8246
|
-
import { Fragment as
|
|
8529
|
+
import { Fragment as Fragment12, useRef as useRef5 } from "react";
|
|
8247
8530
|
import { IconChevronRight as IconChevronRight3 } from "@tabler/icons-react";
|
|
8248
8531
|
|
|
8249
8532
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
8250
|
-
import { useState as
|
|
8533
|
+
import { useState as useState17 } from "react";
|
|
8251
8534
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
8252
8535
|
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink2, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
8253
|
-
import { Fragment as
|
|
8536
|
+
import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8254
8537
|
var SidebarContextMenu = ({ children }) => {
|
|
8255
8538
|
const { mutate: deleteKey } = useDeleteKey();
|
|
8256
|
-
const [isAlertOpen, setAlertOpen] =
|
|
8257
|
-
const [contextKeys, setContextKeys] =
|
|
8539
|
+
const [isAlertOpen, setAlertOpen] = useState17(false);
|
|
8540
|
+
const [contextKeys, setContextKeys] = useState17([]);
|
|
8258
8541
|
const {
|
|
8259
8542
|
addTab,
|
|
8260
8543
|
setSelectedKey: setSelectedKeyGlobal,
|
|
@@ -8262,8 +8545,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8262
8545
|
setSearch
|
|
8263
8546
|
} = useDatabrowserStore();
|
|
8264
8547
|
const { search: currentSearch, selectedKeys } = useTab();
|
|
8265
|
-
return /* @__PURE__ */
|
|
8266
|
-
/* @__PURE__ */
|
|
8548
|
+
return /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
8549
|
+
/* @__PURE__ */ jsx59(
|
|
8267
8550
|
DeleteKeyModal,
|
|
8268
8551
|
{
|
|
8269
8552
|
deletionType: "key",
|
|
@@ -8279,8 +8562,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8279
8562
|
}
|
|
8280
8563
|
}
|
|
8281
8564
|
),
|
|
8282
|
-
/* @__PURE__ */
|
|
8283
|
-
/* @__PURE__ */
|
|
8565
|
+
/* @__PURE__ */ jsxs35(ContextMenu, { modal: false, children: [
|
|
8566
|
+
/* @__PURE__ */ jsx59(
|
|
8284
8567
|
ContextMenuTrigger,
|
|
8285
8568
|
{
|
|
8286
8569
|
onContextMenu: (e) => {
|
|
@@ -8300,8 +8583,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8300
8583
|
children
|
|
8301
8584
|
}
|
|
8302
8585
|
),
|
|
8303
|
-
/* @__PURE__ */
|
|
8304
|
-
/* @__PURE__ */
|
|
8586
|
+
/* @__PURE__ */ jsxs35(ContextMenuContent, { children: [
|
|
8587
|
+
/* @__PURE__ */ jsxs35(
|
|
8305
8588
|
ContextMenuItem,
|
|
8306
8589
|
{
|
|
8307
8590
|
onClick: () => {
|
|
@@ -8313,12 +8596,12 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8313
8596
|
className: "gap-2",
|
|
8314
8597
|
disabled: contextKeys.length !== 1,
|
|
8315
8598
|
children: [
|
|
8316
|
-
/* @__PURE__ */
|
|
8599
|
+
/* @__PURE__ */ jsx59(IconCopy3, { size: 16 }),
|
|
8317
8600
|
"Copy key"
|
|
8318
8601
|
]
|
|
8319
8602
|
}
|
|
8320
8603
|
),
|
|
8321
|
-
/* @__PURE__ */
|
|
8604
|
+
/* @__PURE__ */ jsxs35(
|
|
8322
8605
|
ContextMenuItem,
|
|
8323
8606
|
{
|
|
8324
8607
|
onClick: () => {
|
|
@@ -8330,14 +8613,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8330
8613
|
className: "gap-2",
|
|
8331
8614
|
disabled: contextKeys.length !== 1,
|
|
8332
8615
|
children: [
|
|
8333
|
-
/* @__PURE__ */
|
|
8616
|
+
/* @__PURE__ */ jsx59(IconExternalLink2, { size: 16 }),
|
|
8334
8617
|
"Open in new tab"
|
|
8335
8618
|
]
|
|
8336
8619
|
}
|
|
8337
8620
|
),
|
|
8338
|
-
/* @__PURE__ */
|
|
8339
|
-
/* @__PURE__ */
|
|
8340
|
-
/* @__PURE__ */
|
|
8621
|
+
/* @__PURE__ */ jsx59(ContextMenuSeparator3, {}),
|
|
8622
|
+
/* @__PURE__ */ jsxs35(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
8623
|
+
/* @__PURE__ */ jsx59(IconTrash3, { size: 16 }),
|
|
8341
8624
|
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
8342
8625
|
] })
|
|
8343
8626
|
] })
|
|
@@ -8346,14 +8629,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
8346
8629
|
};
|
|
8347
8630
|
|
|
8348
8631
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
8349
|
-
import { Fragment as
|
|
8632
|
+
import { Fragment as Fragment13, jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8350
8633
|
var KeysList = () => {
|
|
8351
8634
|
const { keys } = useKeys();
|
|
8352
8635
|
const lastClickedIndexRef = useRef5(null);
|
|
8353
|
-
return /* @__PURE__ */
|
|
8354
|
-
/* @__PURE__ */
|
|
8355
|
-
keys.map((data, i) => /* @__PURE__ */
|
|
8356
|
-
/* @__PURE__ */
|
|
8636
|
+
return /* @__PURE__ */ jsx60(SidebarContextMenu, { children: /* @__PURE__ */ jsxs36(Fragment13, { children: [
|
|
8637
|
+
/* @__PURE__ */ jsx60("div", { className: "h-px" }),
|
|
8638
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
8639
|
+
/* @__PURE__ */ jsx60(
|
|
8357
8640
|
KeyItem,
|
|
8358
8641
|
{
|
|
8359
8642
|
index: i,
|
|
@@ -8362,7 +8645,7 @@ var KeysList = () => {
|
|
|
8362
8645
|
lastClickedIndexRef
|
|
8363
8646
|
}
|
|
8364
8647
|
),
|
|
8365
|
-
i !== keys.length - 1 && /* @__PURE__ */
|
|
8648
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx60("div", { className: "-z-10 mx-[13px] h-px bg-zinc-200 dark:bg-zinc-200" })
|
|
8366
8649
|
] }, data[0]))
|
|
8367
8650
|
] }) });
|
|
8368
8651
|
};
|
|
@@ -8404,7 +8687,7 @@ var KeyItem = ({
|
|
|
8404
8687
|
lastClickedIndexRef.current = index;
|
|
8405
8688
|
}
|
|
8406
8689
|
};
|
|
8407
|
-
return /* @__PURE__ */
|
|
8690
|
+
return /* @__PURE__ */ jsxs36(
|
|
8408
8691
|
"button",
|
|
8409
8692
|
{
|
|
8410
8693
|
"data-key": dataKey,
|
|
@@ -8416,44 +8699,44 @@ var KeyItem = ({
|
|
|
8416
8699
|
),
|
|
8417
8700
|
onClick: handleClick,
|
|
8418
8701
|
children: [
|
|
8419
|
-
/* @__PURE__ */
|
|
8420
|
-
/* @__PURE__ */
|
|
8421
|
-
score !== void 0 && /* @__PURE__ */
|
|
8422
|
-
isKeySelected && /* @__PURE__ */
|
|
8702
|
+
/* @__PURE__ */ jsx60(TypeTag, { variant: dataType, type: "icon" }),
|
|
8703
|
+
/* @__PURE__ */ jsx60("p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
8704
|
+
score !== void 0 && /* @__PURE__ */ jsx60("span", { className: "shrink-0 text-xs text-zinc-400", children: score.toFixed(2) }),
|
|
8705
|
+
isKeySelected && /* @__PURE__ */ jsx60(IconChevronRight3, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
8423
8706
|
]
|
|
8424
8707
|
}
|
|
8425
8708
|
);
|
|
8426
8709
|
};
|
|
8427
8710
|
|
|
8428
8711
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
8429
|
-
import { jsx as
|
|
8712
|
+
import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8430
8713
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
8431
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
8432
|
-
/* @__PURE__ */
|
|
8433
|
-
/* @__PURE__ */
|
|
8714
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx61("div", { className: "block h-full w-full rounded-lg bg-zinc-100 p-1 pr-3 transition-all", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ jsxs37("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
8715
|
+
/* @__PURE__ */ jsx61(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
8716
|
+
/* @__PURE__ */ jsx61(Skeleton, { className: "h-4 grow rounded" })
|
|
8434
8717
|
] }, idx)) });
|
|
8435
8718
|
|
|
8436
8719
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
8437
|
-
import { jsx as
|
|
8720
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
8438
8721
|
function Sidebar() {
|
|
8439
8722
|
const { keys, query } = useKeys();
|
|
8440
|
-
return /* @__PURE__ */
|
|
8723
|
+
return /* @__PURE__ */ jsx62("div", { className: "flex h-full flex-col gap-2", children: query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx62(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
8441
8724
|
// Infinite scroll already has a loader at the bottom
|
|
8442
|
-
/* @__PURE__ */
|
|
8725
|
+
/* @__PURE__ */ jsx62(
|
|
8443
8726
|
InfiniteScroll,
|
|
8444
8727
|
{
|
|
8445
8728
|
query,
|
|
8446
8729
|
disableRoundedInherit: true,
|
|
8447
8730
|
className: "min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4",
|
|
8448
8731
|
scrollBarClassName: "py-5",
|
|
8449
|
-
children: /* @__PURE__ */
|
|
8732
|
+
children: /* @__PURE__ */ jsx62(KeysList, {})
|
|
8450
8733
|
}
|
|
8451
8734
|
)
|
|
8452
|
-
) : /* @__PURE__ */
|
|
8735
|
+
) : /* @__PURE__ */ jsx62(Empty, {}) });
|
|
8453
8736
|
}
|
|
8454
8737
|
|
|
8455
8738
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
8456
|
-
import { useCallback as useCallback4, useEffect as
|
|
8739
|
+
import { useCallback as useCallback4, useEffect as useEffect18, useRef as useRef8, useState as useState24 } from "react";
|
|
8457
8740
|
|
|
8458
8741
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
8459
8742
|
import { createContext as createContext6, useCallback as useCallback2, useContext as useContext6, useMemo as useMemo10 } from "react";
|
|
@@ -8795,7 +9078,7 @@ var createInitialQueryState = () => ({
|
|
|
8795
9078
|
});
|
|
8796
9079
|
|
|
8797
9080
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
8798
|
-
import { jsx as
|
|
9081
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
8799
9082
|
var QueryBuilderUIContext = createContext6(null);
|
|
8800
9083
|
var QueryBuilderUIProvider = ({
|
|
8801
9084
|
children,
|
|
@@ -8851,7 +9134,7 @@ var QueryBuilderUIProvider = ({
|
|
|
8851
9134
|
}),
|
|
8852
9135
|
[fieldInfos, updateNode, deleteNode, addChildToGroup, moveNode]
|
|
8853
9136
|
);
|
|
8854
|
-
return /* @__PURE__ */
|
|
9137
|
+
return /* @__PURE__ */ jsx63(QueryBuilderUIContext.Provider, { value, children });
|
|
8855
9138
|
};
|
|
8856
9139
|
var useQueryBuilderUI = () => {
|
|
8857
9140
|
const context = useContext6(QueryBuilderUIContext);
|
|
@@ -8929,16 +9212,16 @@ var moveNodeInTree = (root2, nodeId, newParentId, newIndex) => {
|
|
|
8929
9212
|
};
|
|
8930
9213
|
|
|
8931
9214
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
8932
|
-
import { useState as
|
|
8933
|
-
import { IconGripVertical as IconGripVertical3, IconPlus as
|
|
9215
|
+
import { useState as useState22 } from "react";
|
|
9216
|
+
import { IconGripVertical as IconGripVertical3, IconPlus as IconPlus4, IconX as IconX4 } from "@tabler/icons-react";
|
|
8934
9217
|
|
|
8935
9218
|
// src/components/databrowser/components/ui-query-builder/condition-common.tsx
|
|
8936
|
-
import { useState as
|
|
9219
|
+
import { useState as useState19 } from "react";
|
|
8937
9220
|
import { IconDots } from "@tabler/icons-react";
|
|
8938
9221
|
|
|
8939
9222
|
// src/components/databrowser/components/ui-query-builder/dynamic-width-input.tsx
|
|
8940
|
-
import { useLayoutEffect, useRef as useRef6, useState as
|
|
8941
|
-
import { jsx as
|
|
9223
|
+
import { useLayoutEffect, useRef as useRef6, useState as useState18 } from "react";
|
|
9224
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
8942
9225
|
var measureContext = null;
|
|
8943
9226
|
var getTextWidth = (text, font) => {
|
|
8944
9227
|
if (!measureContext) {
|
|
@@ -8961,7 +9244,7 @@ var DynamicWidthInput = ({
|
|
|
8961
9244
|
placeholder
|
|
8962
9245
|
}) => {
|
|
8963
9246
|
const inputRef = useRef6(null);
|
|
8964
|
-
const [width, setWidth] =
|
|
9247
|
+
const [width, setWidth] = useState18(minWidth);
|
|
8965
9248
|
useLayoutEffect(() => {
|
|
8966
9249
|
if (inputRef.current) {
|
|
8967
9250
|
const computedStyle = window.getComputedStyle(inputRef.current);
|
|
@@ -8970,7 +9253,7 @@ var DynamicWidthInput = ({
|
|
|
8970
9253
|
setWidth(Math.max(Math.ceil(textWidth), minWidth));
|
|
8971
9254
|
}
|
|
8972
9255
|
}, [value, minWidth, placeholder]);
|
|
8973
|
-
return /* @__PURE__ */
|
|
9256
|
+
return /* @__PURE__ */ jsx64(
|
|
8974
9257
|
"input",
|
|
8975
9258
|
{
|
|
8976
9259
|
ref: inputRef,
|
|
@@ -8987,14 +9270,14 @@ var DynamicWidthInput = ({
|
|
|
8987
9270
|
};
|
|
8988
9271
|
|
|
8989
9272
|
// src/components/databrowser/components/ui-query-builder/condition-common.tsx
|
|
8990
|
-
import { jsx as
|
|
9273
|
+
import { jsx as jsx65, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8991
9274
|
var BoostBadge = ({
|
|
8992
9275
|
node,
|
|
8993
9276
|
static: isStatic
|
|
8994
9277
|
}) => {
|
|
8995
9278
|
const { updateNode } = useQueryBuilderUI();
|
|
8996
|
-
const [localValue, setLocalValue] =
|
|
8997
|
-
const [isFocused, setIsFocused] =
|
|
9279
|
+
const [localValue, setLocalValue] = useState19(String(node.boost ?? 0));
|
|
9280
|
+
const [isFocused, setIsFocused] = useState19(false);
|
|
8998
9281
|
const boostStr = String(node.boost ?? 0);
|
|
8999
9282
|
if (!isFocused && localValue !== boostStr) {
|
|
9000
9283
|
setLocalValue(boostStr);
|
|
@@ -9016,9 +9299,9 @@ var BoostBadge = ({
|
|
|
9016
9299
|
const isNegative = (node.boost ?? 0) < 0;
|
|
9017
9300
|
const labelBg = isNegative ? "bg-red-50" : "bg-purple-50";
|
|
9018
9301
|
const textColor = isNegative ? "text-red-800" : "text-purple-800";
|
|
9019
|
-
return /* @__PURE__ */
|
|
9020
|
-
/* @__PURE__ */
|
|
9021
|
-
isStatic ? /* @__PURE__ */
|
|
9302
|
+
return /* @__PURE__ */ jsxs38("span", { className: "relative flex h-[26px] items-center overflow-hidden rounded-md border border-zinc-300 text-sm font-medium", children: [
|
|
9303
|
+
/* @__PURE__ */ jsx65("span", { className: `flex h-full items-center px-2 ${labelBg} ${textColor}`, children: isNegative ? "Demote" : "Boost" }),
|
|
9304
|
+
isStatic ? /* @__PURE__ */ jsx65("span", { className: `px-2 ${textColor}`, children: node.boost }) : /* @__PURE__ */ jsx65("span", { className: "flex h-full items-center bg-white px-2", children: /* @__PURE__ */ jsx65(
|
|
9022
9305
|
DynamicWidthInput,
|
|
9023
9306
|
{
|
|
9024
9307
|
value: localValue,
|
|
@@ -9031,32 +9314,32 @@ var BoostBadge = ({
|
|
|
9031
9314
|
) })
|
|
9032
9315
|
] });
|
|
9033
9316
|
};
|
|
9034
|
-
var NotBadge = () => /* @__PURE__ */
|
|
9317
|
+
var NotBadge = () => /* @__PURE__ */ jsx65("span", { className: "flex h-[26px] items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium text-amber-800", children: "Not" });
|
|
9035
9318
|
var NodeActionsMenu = ({ node }) => {
|
|
9036
9319
|
const { updateNode } = useQueryBuilderUI();
|
|
9037
|
-
const [open, setOpen] =
|
|
9320
|
+
const [open, setOpen] = useState19(false);
|
|
9038
9321
|
const handleToggleBoost = () => {
|
|
9039
9322
|
updateNode(node.id, { boost: node.boost ? void 0 : 2 });
|
|
9040
9323
|
};
|
|
9041
9324
|
const handleToggleNot = () => {
|
|
9042
9325
|
updateNode(node.id, { not: !node.not });
|
|
9043
9326
|
};
|
|
9044
|
-
return /* @__PURE__ */
|
|
9045
|
-
/* @__PURE__ */
|
|
9327
|
+
return /* @__PURE__ */ jsxs38(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
9328
|
+
/* @__PURE__ */ jsx65(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx65(
|
|
9046
9329
|
"button",
|
|
9047
9330
|
{
|
|
9048
9331
|
type: "button",
|
|
9049
9332
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700",
|
|
9050
|
-
children: /* @__PURE__ */
|
|
9333
|
+
children: /* @__PURE__ */ jsx65(IconDots, { size: 16 })
|
|
9051
9334
|
}
|
|
9052
9335
|
) }),
|
|
9053
|
-
/* @__PURE__ */
|
|
9054
|
-
/* @__PURE__ */
|
|
9055
|
-
/* @__PURE__ */
|
|
9336
|
+
/* @__PURE__ */ jsxs38(DropdownMenuContent, { align: "end", children: [
|
|
9337
|
+
/* @__PURE__ */ jsx65(DropdownMenuItem, { onClick: handleToggleBoost, children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
|
|
9338
|
+
/* @__PURE__ */ jsx65(
|
|
9056
9339
|
"div",
|
|
9057
9340
|
{
|
|
9058
9341
|
className: `h-4 w-8 rounded-full transition-colors ${node.boost === void 0 ? "bg-zinc-200" : "bg-emerald-500"}`,
|
|
9059
|
-
children: /* @__PURE__ */
|
|
9342
|
+
children: /* @__PURE__ */ jsx65(
|
|
9060
9343
|
"div",
|
|
9061
9344
|
{
|
|
9062
9345
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.boost === void 0 ? "translate-x-0" : "translate-x-4"}`
|
|
@@ -9064,14 +9347,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
9064
9347
|
)
|
|
9065
9348
|
}
|
|
9066
9349
|
),
|
|
9067
|
-
/* @__PURE__ */
|
|
9350
|
+
/* @__PURE__ */ jsx65("span", { children: "Boost" })
|
|
9068
9351
|
] }) }),
|
|
9069
|
-
/* @__PURE__ */
|
|
9070
|
-
/* @__PURE__ */
|
|
9352
|
+
/* @__PURE__ */ jsx65(DropdownMenuItem, { onClick: handleToggleNot, children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
|
|
9353
|
+
/* @__PURE__ */ jsx65(
|
|
9071
9354
|
"div",
|
|
9072
9355
|
{
|
|
9073
9356
|
className: `h-4 w-8 rounded-full transition-colors ${node.not ? "bg-emerald-500" : "bg-zinc-200"}`,
|
|
9074
|
-
children: /* @__PURE__ */
|
|
9357
|
+
children: /* @__PURE__ */ jsx65(
|
|
9075
9358
|
"div",
|
|
9076
9359
|
{
|
|
9077
9360
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.not ? "translate-x-4" : "translate-x-0"}`
|
|
@@ -9079,14 +9362,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
9079
9362
|
)
|
|
9080
9363
|
}
|
|
9081
9364
|
),
|
|
9082
|
-
/* @__PURE__ */
|
|
9365
|
+
/* @__PURE__ */ jsx65("span", { children: "Not" })
|
|
9083
9366
|
] }) })
|
|
9084
9367
|
] })
|
|
9085
9368
|
] });
|
|
9086
9369
|
};
|
|
9087
9370
|
|
|
9088
9371
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
9089
|
-
import { useState as
|
|
9372
|
+
import { useState as useState21 } from "react";
|
|
9090
9373
|
import {
|
|
9091
9374
|
DndContext,
|
|
9092
9375
|
PointerSensor,
|
|
@@ -9100,9 +9383,9 @@ import { DragOverlay as DndKitDragOverlay } from "@dnd-kit/core";
|
|
|
9100
9383
|
import { IconGripVertical as IconGripVertical2 } from "@tabler/icons-react";
|
|
9101
9384
|
|
|
9102
9385
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
9103
|
-
import { useEffect as
|
|
9386
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
9104
9387
|
import { IconGripVertical, IconX as IconX3 } from "@tabler/icons-react";
|
|
9105
|
-
import { Fragment as
|
|
9388
|
+
import { Fragment as Fragment14, jsx as jsx66, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9106
9389
|
var formatValueForDisplay = (value) => {
|
|
9107
9390
|
if (Array.isArray(value)) {
|
|
9108
9391
|
return value.join(", ");
|
|
@@ -9120,8 +9403,8 @@ var QueryCondition = ({
|
|
|
9120
9403
|
const { fieldInfos, updateNode, deleteNode } = useQueryBuilderUI();
|
|
9121
9404
|
const { condition } = node;
|
|
9122
9405
|
const fieldNames = fieldInfos.map((f) => f.name);
|
|
9123
|
-
const [localValue, setLocalValue] =
|
|
9124
|
-
const [isValueFocused, setIsValueFocused] =
|
|
9406
|
+
const [localValue, setLocalValue] = useState20(() => formatValueForDisplay(condition.value));
|
|
9407
|
+
const [isValueFocused, setIsValueFocused] = useState20(false);
|
|
9125
9408
|
const formattedConditionValue = formatValueForDisplay(condition.value);
|
|
9126
9409
|
if (!isValueFocused && localValue !== formattedConditionValue) {
|
|
9127
9410
|
setLocalValue(formattedConditionValue);
|
|
@@ -9153,7 +9436,7 @@ var QueryCondition = ({
|
|
|
9153
9436
|
return void 0;
|
|
9154
9437
|
};
|
|
9155
9438
|
const valueTypeError = getValueTypeError();
|
|
9156
|
-
|
|
9439
|
+
useEffect16(() => {
|
|
9157
9440
|
if (currentFieldType === "boolean") {
|
|
9158
9441
|
if (condition.value === "true") {
|
|
9159
9442
|
updateNode(node.id, {
|
|
@@ -9293,8 +9576,8 @@ var QueryCondition = ({
|
|
|
9293
9576
|
condition: { ...condition, ...updates }
|
|
9294
9577
|
});
|
|
9295
9578
|
};
|
|
9296
|
-
const [localSlop, setLocalSlop] =
|
|
9297
|
-
const [isSlopFocused, setIsSlopFocused] =
|
|
9579
|
+
const [localSlop, setLocalSlop] = useState20(String(condition.phraseSlop ?? 1));
|
|
9580
|
+
const [isSlopFocused, setIsSlopFocused] = useState20(false);
|
|
9298
9581
|
const slopStr = String(condition.phraseSlop ?? 1);
|
|
9299
9582
|
if (!isSlopFocused && localSlop !== slopStr) {
|
|
9300
9583
|
setLocalSlop(slopStr);
|
|
@@ -9323,48 +9606,48 @@ var QueryCondition = ({
|
|
|
9323
9606
|
const filteredOperators = OPERATOR_OPTIONS.filter((op) => allowedOperators.includes(op.value));
|
|
9324
9607
|
const isInvalidOperator = !isUnknownField && currentFieldType !== "unknown" && !allowedOperators.includes(condition.operator);
|
|
9325
9608
|
const operatorError = isInvalidOperator ? `"${condition.operator}" is not valid for ${currentFieldType} fields` : void 0;
|
|
9326
|
-
return /* @__PURE__ */
|
|
9327
|
-
/* @__PURE__ */
|
|
9609
|
+
return /* @__PURE__ */ jsxs39("div", { className: "group/condition flex items-center gap-1 px-1", children: [
|
|
9610
|
+
/* @__PURE__ */ jsx66(
|
|
9328
9611
|
"div",
|
|
9329
9612
|
{
|
|
9330
9613
|
ref: dragHandleProps?.ref,
|
|
9331
9614
|
className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
|
|
9332
9615
|
...dragHandleProps?.attributes,
|
|
9333
9616
|
...dragHandleProps?.listeners,
|
|
9334
|
-
children: /* @__PURE__ */
|
|
9617
|
+
children: /* @__PURE__ */ jsx66(IconGripVertical, { size: 16 })
|
|
9335
9618
|
}
|
|
9336
9619
|
),
|
|
9337
|
-
/* @__PURE__ */
|
|
9338
|
-
/* @__PURE__ */
|
|
9339
|
-
/* @__PURE__ */
|
|
9620
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex", children: [
|
|
9621
|
+
/* @__PURE__ */ jsxs39(Select, { value: condition.field, onValueChange: handleFieldChange, children: [
|
|
9622
|
+
/* @__PURE__ */ jsx66(
|
|
9340
9623
|
SimpleTooltip,
|
|
9341
9624
|
{
|
|
9342
9625
|
content: isUnknownField ? "This field is not defined in the schema" : void 0,
|
|
9343
9626
|
variant: "error",
|
|
9344
|
-
children: /* @__PURE__ */
|
|
9627
|
+
children: /* @__PURE__ */ jsx66(
|
|
9345
9628
|
SelectTrigger,
|
|
9346
9629
|
{
|
|
9347
9630
|
className: `h-[26px] w-32 gap-3 rounded-none rounded-l-md border-r-0 border-zinc-200 bg-white px-2 text-sm font-normal ${isUnknownField ? "text-red-500" : ""}`,
|
|
9348
|
-
children: /* @__PURE__ */
|
|
9631
|
+
children: /* @__PURE__ */ jsx66(SelectValue, { placeholder: "Select field" })
|
|
9349
9632
|
}
|
|
9350
9633
|
)
|
|
9351
9634
|
}
|
|
9352
9635
|
),
|
|
9353
|
-
/* @__PURE__ */
|
|
9354
|
-
isUnknownField && /* @__PURE__ */
|
|
9355
|
-
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */
|
|
9636
|
+
/* @__PURE__ */ jsxs39(SelectContent, { children: [
|
|
9637
|
+
isUnknownField && /* @__PURE__ */ jsx66(SelectItem, { value: condition.field, className: "text-red-500", children: condition.field }, condition.field),
|
|
9638
|
+
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */ jsx66(SelectItem, { value: field, children: field }, field)) : !isUnknownField && /* @__PURE__ */ jsx66("div", { className: "px-2 py-1.5 text-sm text-zinc-500", children: "No fields available" })
|
|
9356
9639
|
] })
|
|
9357
9640
|
] }),
|
|
9358
|
-
/* @__PURE__ */
|
|
9359
|
-
/* @__PURE__ */
|
|
9641
|
+
/* @__PURE__ */ jsxs39(Select, { value: condition.operator, onValueChange: handleOperatorChange, children: [
|
|
9642
|
+
/* @__PURE__ */ jsx66(SimpleTooltip, { content: operatorError || valueTypeError, variant: "error", children: /* @__PURE__ */ jsx66(
|
|
9360
9643
|
SelectTrigger,
|
|
9361
9644
|
{
|
|
9362
9645
|
className: `h-[26px] w-24 gap-3 rounded-none border-r-0 border-zinc-200 px-2 text-sm font-normal ${operatorError || valueTypeError ? "text-red-500" : ""}`,
|
|
9363
|
-
children: /* @__PURE__ */
|
|
9646
|
+
children: /* @__PURE__ */ jsx66(SelectValue, {})
|
|
9364
9647
|
}
|
|
9365
9648
|
) }),
|
|
9366
|
-
/* @__PURE__ */
|
|
9367
|
-
isInvalidOperator && /* @__PURE__ */
|
|
9649
|
+
/* @__PURE__ */ jsxs39(SelectContent, { children: [
|
|
9650
|
+
isInvalidOperator && /* @__PURE__ */ jsx66(
|
|
9368
9651
|
SelectItem,
|
|
9369
9652
|
{
|
|
9370
9653
|
value: condition.operator,
|
|
@@ -9373,12 +9656,12 @@ var QueryCondition = ({
|
|
|
9373
9656
|
},
|
|
9374
9657
|
condition.operator
|
|
9375
9658
|
),
|
|
9376
|
-
filteredOperators.map((op) => /* @__PURE__ */
|
|
9659
|
+
filteredOperators.map((op) => /* @__PURE__ */ jsx66(SelectItem, { value: op.value, children: op.label }, op.value))
|
|
9377
9660
|
] })
|
|
9378
9661
|
] }),
|
|
9379
|
-
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */
|
|
9380
|
-
/* @__PURE__ */
|
|
9381
|
-
/* @__PURE__ */
|
|
9662
|
+
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */ jsxs39("div", { className: "flex h-[26px] items-center gap-2 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm", children: [
|
|
9663
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1", children: [
|
|
9664
|
+
/* @__PURE__ */ jsx66(
|
|
9382
9665
|
"input",
|
|
9383
9666
|
{
|
|
9384
9667
|
type: "checkbox",
|
|
@@ -9394,10 +9677,10 @@ var QueryCondition = ({
|
|
|
9394
9677
|
className: "h-3 w-3"
|
|
9395
9678
|
}
|
|
9396
9679
|
),
|
|
9397
|
-
/* @__PURE__ */
|
|
9680
|
+
/* @__PURE__ */ jsx66("span", { children: "true" })
|
|
9398
9681
|
] }),
|
|
9399
|
-
/* @__PURE__ */
|
|
9400
|
-
/* @__PURE__ */
|
|
9682
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1", children: [
|
|
9683
|
+
/* @__PURE__ */ jsx66(
|
|
9401
9684
|
"input",
|
|
9402
9685
|
{
|
|
9403
9686
|
type: "checkbox",
|
|
@@ -9413,9 +9696,9 @@ var QueryCondition = ({
|
|
|
9413
9696
|
className: "h-3 w-3"
|
|
9414
9697
|
}
|
|
9415
9698
|
),
|
|
9416
|
-
/* @__PURE__ */
|
|
9699
|
+
/* @__PURE__ */ jsx66("span", { children: "false" })
|
|
9417
9700
|
] })
|
|
9418
|
-
] }) : currentFieldType === "boolean" ? /* @__PURE__ */
|
|
9701
|
+
] }) : currentFieldType === "boolean" ? /* @__PURE__ */ jsxs39(
|
|
9419
9702
|
Select,
|
|
9420
9703
|
{
|
|
9421
9704
|
value: condition.value === true || condition.value === "true" ? "true" : condition.value === false || condition.value === "false" ? "false" : "true",
|
|
@@ -9427,14 +9710,14 @@ var QueryCondition = ({
|
|
|
9427
9710
|
});
|
|
9428
9711
|
},
|
|
9429
9712
|
children: [
|
|
9430
|
-
/* @__PURE__ */
|
|
9431
|
-
/* @__PURE__ */
|
|
9432
|
-
/* @__PURE__ */
|
|
9433
|
-
/* @__PURE__ */
|
|
9713
|
+
/* @__PURE__ */ jsx66(SelectTrigger, { className: "h-[26px] w-20 gap-3 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx66(SelectValue, {}) }),
|
|
9714
|
+
/* @__PURE__ */ jsxs39(SelectContent, { children: [
|
|
9715
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "true", children: "true" }),
|
|
9716
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "false", children: "false" })
|
|
9434
9717
|
] })
|
|
9435
9718
|
]
|
|
9436
9719
|
}
|
|
9437
|
-
) : /* @__PURE__ */
|
|
9720
|
+
) : /* @__PURE__ */ jsx66(
|
|
9438
9721
|
"input",
|
|
9439
9722
|
{
|
|
9440
9723
|
type: "text",
|
|
@@ -9447,30 +9730,30 @@ var QueryCondition = ({
|
|
|
9447
9730
|
}
|
|
9448
9731
|
)
|
|
9449
9732
|
] }),
|
|
9450
|
-
condition.operator === "fuzzy" && /* @__PURE__ */
|
|
9733
|
+
condition.operator === "fuzzy" && /* @__PURE__ */ jsxs39(
|
|
9451
9734
|
Select,
|
|
9452
9735
|
{
|
|
9453
9736
|
value: String(condition.fuzzyDistance || 1),
|
|
9454
9737
|
onValueChange: handleFuzzyDistanceChange,
|
|
9455
9738
|
children: [
|
|
9456
|
-
/* @__PURE__ */
|
|
9457
|
-
/* @__PURE__ */
|
|
9458
|
-
/* @__PURE__ */
|
|
9459
|
-
/* @__PURE__ */
|
|
9739
|
+
/* @__PURE__ */ jsx66(SelectTrigger, { className: "h-[26px] w-16 gap-3 border-zinc-200 bg-white px-2 text-sm", children: /* @__PURE__ */ jsx66(SelectValue, {}) }),
|
|
9740
|
+
/* @__PURE__ */ jsxs39(SelectContent, { children: [
|
|
9741
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "1", children: "1" }),
|
|
9742
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "2", children: "2" })
|
|
9460
9743
|
] })
|
|
9461
9744
|
]
|
|
9462
9745
|
}
|
|
9463
9746
|
),
|
|
9464
|
-
condition.operator === "phrase" && /* @__PURE__ */
|
|
9465
|
-
/* @__PURE__ */
|
|
9466
|
-
/* @__PURE__ */
|
|
9467
|
-
/* @__PURE__ */
|
|
9468
|
-
/* @__PURE__ */
|
|
9469
|
-
/* @__PURE__ */
|
|
9470
|
-
/* @__PURE__ */
|
|
9747
|
+
condition.operator === "phrase" && /* @__PURE__ */ jsxs39(Fragment14, { children: [
|
|
9748
|
+
/* @__PURE__ */ jsxs39(Select, { value: phraseMode, onValueChange: handlePhraseModeChange, children: [
|
|
9749
|
+
/* @__PURE__ */ jsx66(SelectTrigger, { className: "h-[26px] w-20 gap-3 border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx66(SelectValue, {}) }),
|
|
9750
|
+
/* @__PURE__ */ jsxs39(SelectContent, { children: [
|
|
9751
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "exact", children: "exact" }),
|
|
9752
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "slop", children: "slop" }),
|
|
9753
|
+
/* @__PURE__ */ jsx66(SelectItem, { value: "prefix", children: "prefix" })
|
|
9471
9754
|
] })
|
|
9472
9755
|
] }),
|
|
9473
|
-
phraseMode === "slop" && /* @__PURE__ */
|
|
9756
|
+
phraseMode === "slop" && /* @__PURE__ */ jsx66(
|
|
9474
9757
|
"input",
|
|
9475
9758
|
{
|
|
9476
9759
|
type: "number",
|
|
@@ -9483,20 +9766,20 @@ var QueryCondition = ({
|
|
|
9483
9766
|
}
|
|
9484
9767
|
)
|
|
9485
9768
|
] }),
|
|
9486
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
9487
|
-
/* @__PURE__ */
|
|
9769
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx66(BoostBadge, { node }),
|
|
9770
|
+
/* @__PURE__ */ jsxs39(
|
|
9488
9771
|
"div",
|
|
9489
9772
|
{
|
|
9490
9773
|
className: `flex items-center gap-1 transition-all duration-100 ${isDragging ? "opacity-0" : "-translate-x-[2px] opacity-0 group-hover/condition:translate-x-0 group-hover/condition:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100"}`,
|
|
9491
9774
|
children: [
|
|
9492
|
-
/* @__PURE__ */
|
|
9493
|
-
/* @__PURE__ */
|
|
9775
|
+
/* @__PURE__ */ jsx66(NodeActionsMenu, { node }),
|
|
9776
|
+
/* @__PURE__ */ jsx66(
|
|
9494
9777
|
"button",
|
|
9495
9778
|
{
|
|
9496
9779
|
type: "button",
|
|
9497
9780
|
onClick: handleDelete,
|
|
9498
9781
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500",
|
|
9499
|
-
children: /* @__PURE__ */
|
|
9782
|
+
children: /* @__PURE__ */ jsx66(IconX3, { size: 16 })
|
|
9500
9783
|
}
|
|
9501
9784
|
)
|
|
9502
9785
|
]
|
|
@@ -9506,12 +9789,12 @@ var QueryCondition = ({
|
|
|
9506
9789
|
};
|
|
9507
9790
|
|
|
9508
9791
|
// src/components/databrowser/components/ui-query-builder/drag-overlay.tsx
|
|
9509
|
-
import { jsx as
|
|
9792
|
+
import { jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9510
9793
|
var QueryDragOverlay = ({
|
|
9511
9794
|
activeNode,
|
|
9512
9795
|
onDropAnimationComplete
|
|
9513
9796
|
}) => {
|
|
9514
|
-
return /* @__PURE__ */
|
|
9797
|
+
return /* @__PURE__ */ jsx67(
|
|
9515
9798
|
DndKitDragOverlay,
|
|
9516
9799
|
{
|
|
9517
9800
|
dropAnimation: {
|
|
@@ -9524,16 +9807,16 @@ var QueryDragOverlay = ({
|
|
|
9524
9807
|
};
|
|
9525
9808
|
}
|
|
9526
9809
|
},
|
|
9527
|
-
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */
|
|
9528
|
-
/* @__PURE__ */
|
|
9529
|
-
/* @__PURE__ */
|
|
9530
|
-
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */
|
|
9531
|
-
/* @__PURE__ */
|
|
9532
|
-
/* @__PURE__ */
|
|
9533
|
-
/* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9535
|
-
/* @__PURE__ */
|
|
9536
|
-
/* @__PURE__ */
|
|
9810
|
+
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */ jsxs40("div", { className: "relative -mt-1", children: [
|
|
9811
|
+
/* @__PURE__ */ jsx67("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
9812
|
+
/* @__PURE__ */ jsx67("div", { className: "relative", children: /* @__PURE__ */ jsx67(QueryCondition, { node: activeNode, isDragging: true }) })
|
|
9813
|
+
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */ jsxs40("div", { className: "relative", children: [
|
|
9814
|
+
/* @__PURE__ */ jsx67("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
9815
|
+
/* @__PURE__ */ jsxs40("div", { className: "relative flex items-center gap-1", children: [
|
|
9816
|
+
/* @__PURE__ */ jsx67("div", { className: "flex cursor-grab items-center text-zinc-400", children: /* @__PURE__ */ jsx67(IconGripVertical2, { size: 16 }) }),
|
|
9817
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex h-[26px] w-16 items-center justify-between rounded-md border border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700", children: [
|
|
9818
|
+
/* @__PURE__ */ jsx67("span", { children: activeNode.groupOperator === "and" ? "And" : "Or" }),
|
|
9819
|
+
/* @__PURE__ */ jsx67(
|
|
9537
9820
|
"svg",
|
|
9538
9821
|
{
|
|
9539
9822
|
className: "text-zinc-400",
|
|
@@ -9542,7 +9825,7 @@ var QueryDragOverlay = ({
|
|
|
9542
9825
|
viewBox: "0 0 16 16",
|
|
9543
9826
|
fill: "none",
|
|
9544
9827
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9545
|
-
children: /* @__PURE__ */
|
|
9828
|
+
children: /* @__PURE__ */ jsx67(
|
|
9546
9829
|
"path",
|
|
9547
9830
|
{
|
|
9548
9831
|
d: "M4 6L8 10L12 6",
|
|
@@ -9556,8 +9839,8 @@ var QueryDragOverlay = ({
|
|
|
9556
9839
|
}
|
|
9557
9840
|
)
|
|
9558
9841
|
] }),
|
|
9559
|
-
activeNode.boost !== void 0 && /* @__PURE__ */
|
|
9560
|
-
activeNode.not && /* @__PURE__ */
|
|
9842
|
+
activeNode.boost !== void 0 && /* @__PURE__ */ jsx67(BoostBadge, { node: activeNode, static: true }),
|
|
9843
|
+
activeNode.not && /* @__PURE__ */ jsx67(NotBadge, {})
|
|
9561
9844
|
] })
|
|
9562
9845
|
] }) : null
|
|
9563
9846
|
}
|
|
@@ -9565,7 +9848,7 @@ var QueryDragOverlay = ({
|
|
|
9565
9848
|
};
|
|
9566
9849
|
|
|
9567
9850
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
9568
|
-
import { jsx as
|
|
9851
|
+
import { jsx as jsx68, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9569
9852
|
var QueryDndProvider = ({
|
|
9570
9853
|
children,
|
|
9571
9854
|
rootNode,
|
|
@@ -9573,7 +9856,7 @@ var QueryDndProvider = ({
|
|
|
9573
9856
|
setDroppingId
|
|
9574
9857
|
}) => {
|
|
9575
9858
|
const { moveNode } = useQueryBuilderUI();
|
|
9576
|
-
const [activeId, setActiveId] =
|
|
9859
|
+
const [activeId, setActiveId] = useState21(null);
|
|
9577
9860
|
const sensors = useSensors(
|
|
9578
9861
|
useSensor(PointerSensor, {
|
|
9579
9862
|
activationConstraint: {
|
|
@@ -9637,7 +9920,7 @@ var QueryDndProvider = ({
|
|
|
9637
9920
|
moveNode(activeIdStr, targetGroupId, adjustedIndex);
|
|
9638
9921
|
};
|
|
9639
9922
|
const activeNode = activeId ? findNodeById(rootNode, String(activeId)) : null;
|
|
9640
|
-
return /* @__PURE__ */
|
|
9923
|
+
return /* @__PURE__ */ jsxs41(
|
|
9641
9924
|
DndContext,
|
|
9642
9925
|
{
|
|
9643
9926
|
sensors,
|
|
@@ -9647,7 +9930,7 @@ var QueryDndProvider = ({
|
|
|
9647
9930
|
onDragEnd: handleDragEnd,
|
|
9648
9931
|
children: [
|
|
9649
9932
|
children,
|
|
9650
|
-
/* @__PURE__ */
|
|
9933
|
+
/* @__PURE__ */ jsx68(
|
|
9651
9934
|
QueryDragOverlay,
|
|
9652
9935
|
{
|
|
9653
9936
|
activeNode,
|
|
@@ -9684,7 +9967,7 @@ var findParentGroup = (root2, targetId) => {
|
|
|
9684
9967
|
|
|
9685
9968
|
// src/components/databrowser/components/ui-query-builder/draggable-item.tsx
|
|
9686
9969
|
import { useDraggable } from "@dnd-kit/core";
|
|
9687
|
-
import { jsx as
|
|
9970
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
9688
9971
|
var DraggableItem = ({
|
|
9689
9972
|
id,
|
|
9690
9973
|
children,
|
|
@@ -9695,7 +9978,7 @@ var DraggableItem = ({
|
|
|
9695
9978
|
});
|
|
9696
9979
|
const isDropAnimating = droppingId === id;
|
|
9697
9980
|
const childElement = children;
|
|
9698
|
-
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */
|
|
9981
|
+
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */ jsx69(
|
|
9699
9982
|
childElement.type,
|
|
9700
9983
|
{
|
|
9701
9984
|
...childElement.props,
|
|
@@ -9706,7 +9989,7 @@ var DraggableItem = ({
|
|
|
9706
9989
|
}
|
|
9707
9990
|
}
|
|
9708
9991
|
) : children;
|
|
9709
|
-
return /* @__PURE__ */
|
|
9992
|
+
return /* @__PURE__ */ jsx69(
|
|
9710
9993
|
"div",
|
|
9711
9994
|
{
|
|
9712
9995
|
ref: setNodeRef,
|
|
@@ -9718,10 +10001,10 @@ var DraggableItem = ({
|
|
|
9718
10001
|
|
|
9719
10002
|
// src/components/databrowser/components/ui-query-builder/drop-zone.tsx
|
|
9720
10003
|
import { useDroppable } from "@dnd-kit/core";
|
|
9721
|
-
import { jsx as
|
|
10004
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
9722
10005
|
var DropIndicator = ({ id, isOver }) => {
|
|
9723
10006
|
const { setNodeRef } = useDroppable({ id });
|
|
9724
|
-
return /* @__PURE__ */
|
|
10007
|
+
return /* @__PURE__ */ jsx70("div", { ref: setNodeRef, className: `relative flex h-2 items-center`, children: /* @__PURE__ */ jsx70(
|
|
9725
10008
|
"div",
|
|
9726
10009
|
{
|
|
9727
10010
|
className: cn(
|
|
@@ -9733,7 +10016,7 @@ var DropIndicator = ({ id, isOver }) => {
|
|
|
9733
10016
|
};
|
|
9734
10017
|
var EmptyGroupDropZone = ({ groupId, isOver }) => {
|
|
9735
10018
|
const { setNodeRef } = useDroppable({ id: `drop-${groupId}-end` });
|
|
9736
|
-
return /* @__PURE__ */
|
|
10019
|
+
return /* @__PURE__ */ jsx70(
|
|
9737
10020
|
"div",
|
|
9738
10021
|
{
|
|
9739
10022
|
ref: setNodeRef,
|
|
@@ -9744,22 +10027,22 @@ var EmptyGroupDropZone = ({ groupId, isOver }) => {
|
|
|
9744
10027
|
};
|
|
9745
10028
|
|
|
9746
10029
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
9747
|
-
import { Fragment as
|
|
10030
|
+
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9748
10031
|
var ChildRow = ({
|
|
9749
10032
|
groupId,
|
|
9750
10033
|
child,
|
|
9751
10034
|
depth,
|
|
9752
10035
|
activeOverId,
|
|
9753
10036
|
droppingId
|
|
9754
|
-
}) => /* @__PURE__ */
|
|
9755
|
-
/* @__PURE__ */
|
|
10037
|
+
}) => /* @__PURE__ */ jsxs42("div", { children: [
|
|
10038
|
+
/* @__PURE__ */ jsx71(
|
|
9756
10039
|
DropIndicator,
|
|
9757
10040
|
{
|
|
9758
10041
|
id: `drop-${groupId}-${child.id}`,
|
|
9759
10042
|
isOver: activeOverId === `drop-${groupId}-${child.id}`
|
|
9760
10043
|
}
|
|
9761
10044
|
),
|
|
9762
|
-
/* @__PURE__ */
|
|
10045
|
+
/* @__PURE__ */ jsx71(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx71(QueryCondition, { node: child }) : /* @__PURE__ */ jsx71(
|
|
9763
10046
|
InnerGroup,
|
|
9764
10047
|
{
|
|
9765
10048
|
node: child,
|
|
@@ -9792,62 +10075,62 @@ var InnerGroup = ({
|
|
|
9792
10075
|
const handleDeleteGroup = () => {
|
|
9793
10076
|
deleteNode(node.id);
|
|
9794
10077
|
};
|
|
9795
|
-
return /* @__PURE__ */
|
|
9796
|
-
/* @__PURE__ */
|
|
9797
|
-
!isRoot && /* @__PURE__ */
|
|
10078
|
+
return /* @__PURE__ */ jsxs42("div", { children: [
|
|
10079
|
+
/* @__PURE__ */ jsxs42("div", { className: "group/group flex items-center gap-1 px-1", children: [
|
|
10080
|
+
!isRoot && /* @__PURE__ */ jsx71(
|
|
9798
10081
|
"div",
|
|
9799
10082
|
{
|
|
9800
10083
|
ref: dragHandleProps?.ref,
|
|
9801
10084
|
className: "flex cursor-grab items-center px-1 text-zinc-400",
|
|
9802
10085
|
...dragHandleProps?.attributes,
|
|
9803
10086
|
...dragHandleProps?.listeners,
|
|
9804
|
-
children: /* @__PURE__ */
|
|
10087
|
+
children: /* @__PURE__ */ jsx71(IconGripVertical3, { size: 16 })
|
|
9805
10088
|
}
|
|
9806
10089
|
),
|
|
9807
|
-
/* @__PURE__ */
|
|
9808
|
-
/* @__PURE__ */
|
|
9809
|
-
/* @__PURE__ */
|
|
9810
|
-
/* @__PURE__ */
|
|
9811
|
-
/* @__PURE__ */
|
|
10090
|
+
/* @__PURE__ */ jsxs42(Select, { value: node.groupOperator, onValueChange: handleOperatorChange, children: [
|
|
10091
|
+
/* @__PURE__ */ jsx71(SelectTrigger, { className: "h-[26px] w-16 gap-3 rounded-md border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700 [&>svg]:text-zinc-400", children: /* @__PURE__ */ jsx71(SelectValue, {}) }),
|
|
10092
|
+
/* @__PURE__ */ jsxs42(SelectContent, { children: [
|
|
10093
|
+
/* @__PURE__ */ jsx71(SelectItem, { value: "and", children: "And" }),
|
|
10094
|
+
/* @__PURE__ */ jsx71(SelectItem, { value: "or", children: "Or" })
|
|
9812
10095
|
] })
|
|
9813
10096
|
] }),
|
|
9814
|
-
/* @__PURE__ */
|
|
9815
|
-
/* @__PURE__ */
|
|
10097
|
+
/* @__PURE__ */ jsxs42(DropdownMenu, { children: [
|
|
10098
|
+
/* @__PURE__ */ jsx71(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx71(
|
|
9816
10099
|
"button",
|
|
9817
10100
|
{
|
|
9818
10101
|
type: "button",
|
|
9819
10102
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700",
|
|
9820
|
-
children: /* @__PURE__ */
|
|
10103
|
+
children: /* @__PURE__ */ jsx71(IconPlus4, { size: 16 })
|
|
9821
10104
|
}
|
|
9822
10105
|
) }),
|
|
9823
|
-
/* @__PURE__ */
|
|
9824
|
-
/* @__PURE__ */
|
|
9825
|
-
/* @__PURE__ */
|
|
10106
|
+
/* @__PURE__ */ jsxs42(DropdownMenuContent, { align: "start", children: [
|
|
10107
|
+
/* @__PURE__ */ jsx71(DropdownMenuItem, { onClick: handleAddCondition, children: "Add Condition" }),
|
|
10108
|
+
/* @__PURE__ */ jsx71(DropdownMenuItem, { onClick: handleAddGroup, children: "Add Group" })
|
|
9826
10109
|
] })
|
|
9827
10110
|
] }),
|
|
9828
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
9829
|
-
!isRoot && /* @__PURE__ */
|
|
10111
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx71(BoostBadge, { node }),
|
|
10112
|
+
!isRoot && /* @__PURE__ */ jsxs42(
|
|
9830
10113
|
"div",
|
|
9831
10114
|
{
|
|
9832
10115
|
className: `flex -translate-x-[2px] items-center gap-1 opacity-0 transition-all duration-100 group-hover/group:translate-x-0 group-hover/group:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100`,
|
|
9833
10116
|
children: [
|
|
9834
|
-
/* @__PURE__ */
|
|
9835
|
-
/* @__PURE__ */
|
|
10117
|
+
/* @__PURE__ */ jsx71(NodeActionsMenu, { node }),
|
|
10118
|
+
/* @__PURE__ */ jsx71(
|
|
9836
10119
|
"button",
|
|
9837
10120
|
{
|
|
9838
10121
|
type: "button",
|
|
9839
10122
|
onClick: handleDeleteGroup,
|
|
9840
10123
|
className: `flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500`,
|
|
9841
|
-
children: /* @__PURE__ */
|
|
10124
|
+
children: /* @__PURE__ */ jsx71(IconX4, { size: 16 })
|
|
9842
10125
|
}
|
|
9843
10126
|
)
|
|
9844
10127
|
]
|
|
9845
10128
|
}
|
|
9846
10129
|
)
|
|
9847
10130
|
] }),
|
|
9848
|
-
/* @__PURE__ */
|
|
10131
|
+
/* @__PURE__ */ jsx71("div", { className: `min-h-[20px] ${isRoot ? "" : "ml-[15px] border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ jsx71(EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-end` }) : /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
9849
10132
|
node.children.map(
|
|
9850
|
-
(child) => !child.not && /* @__PURE__ */
|
|
10133
|
+
(child) => !child.not && /* @__PURE__ */ jsx71(
|
|
9851
10134
|
ChildRow,
|
|
9852
10135
|
{
|
|
9853
10136
|
groupId: node.id,
|
|
@@ -9859,15 +10142,15 @@ var InnerGroup = ({
|
|
|
9859
10142
|
child.id
|
|
9860
10143
|
)
|
|
9861
10144
|
),
|
|
9862
|
-
node.children.some((child) => child.not) && /* @__PURE__ */
|
|
9863
|
-
/* @__PURE__ */
|
|
9864
|
-
/* @__PURE__ */
|
|
10145
|
+
node.children.some((child) => child.not) && /* @__PURE__ */ jsxs42(Tooltip, { delayDuration: 200, children: [
|
|
10146
|
+
/* @__PURE__ */ jsx71(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx71("div", { className: "ml-2 mt-2 flex h-[26px] w-fit cursor-default select-none items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium capitalize text-amber-800", children: "Must Not" }) }),
|
|
10147
|
+
/* @__PURE__ */ jsx71(TooltipContent, { side: "right", className: "max-w-xs", children: /* @__PURE__ */ jsxs42("p", { children: [
|
|
9865
10148
|
"Keys matching any of the conditions below are excluded from the results.",
|
|
9866
10149
|
" ",
|
|
9867
|
-
/* @__PURE__ */
|
|
10150
|
+
/* @__PURE__ */ jsx71(
|
|
9868
10151
|
"a",
|
|
9869
10152
|
{
|
|
9870
|
-
href: "https://upstash.
|
|
10153
|
+
href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/must-not",
|
|
9871
10154
|
target: "_blank",
|
|
9872
10155
|
rel: "noopener noreferrer",
|
|
9873
10156
|
className: "underline",
|
|
@@ -9877,7 +10160,7 @@ var InnerGroup = ({
|
|
|
9877
10160
|
] }) })
|
|
9878
10161
|
] }),
|
|
9879
10162
|
node.children.map(
|
|
9880
|
-
(child) => child.not && /* @__PURE__ */
|
|
10163
|
+
(child) => child.not && /* @__PURE__ */ jsx71(
|
|
9881
10164
|
ChildRow,
|
|
9882
10165
|
{
|
|
9883
10166
|
groupId: node.id,
|
|
@@ -9889,7 +10172,7 @@ var InnerGroup = ({
|
|
|
9889
10172
|
child.id
|
|
9890
10173
|
)
|
|
9891
10174
|
),
|
|
9892
|
-
/* @__PURE__ */
|
|
10175
|
+
/* @__PURE__ */ jsx71(
|
|
9893
10176
|
DropIndicator,
|
|
9894
10177
|
{
|
|
9895
10178
|
id: `drop-${node.id}-end`,
|
|
@@ -9900,11 +10183,11 @@ var InnerGroup = ({
|
|
|
9900
10183
|
] });
|
|
9901
10184
|
};
|
|
9902
10185
|
var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
9903
|
-
const [activeOverId, setActiveOverId] =
|
|
9904
|
-
const [droppingId, setDroppingId] =
|
|
10186
|
+
const [activeOverId, setActiveOverId] = useState22(null);
|
|
10187
|
+
const [droppingId, setDroppingId] = useState22(null);
|
|
9905
10188
|
if (node.type !== "group") return;
|
|
9906
10189
|
if (!isRoot) {
|
|
9907
|
-
return /* @__PURE__ */
|
|
10190
|
+
return /* @__PURE__ */ jsx71(
|
|
9908
10191
|
InnerGroup,
|
|
9909
10192
|
{
|
|
9910
10193
|
node,
|
|
@@ -9915,13 +10198,13 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
9915
10198
|
}
|
|
9916
10199
|
);
|
|
9917
10200
|
}
|
|
9918
|
-
return /* @__PURE__ */
|
|
10201
|
+
return /* @__PURE__ */ jsx71(
|
|
9919
10202
|
QueryDndProvider,
|
|
9920
10203
|
{
|
|
9921
10204
|
rootNode: node,
|
|
9922
10205
|
setActiveOverId,
|
|
9923
10206
|
setDroppingId,
|
|
9924
|
-
children: /* @__PURE__ */
|
|
10207
|
+
children: /* @__PURE__ */ jsx71(
|
|
9925
10208
|
InnerGroup,
|
|
9926
10209
|
{
|
|
9927
10210
|
node,
|
|
@@ -9936,7 +10219,7 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
9936
10219
|
};
|
|
9937
10220
|
|
|
9938
10221
|
// src/components/databrowser/components/ui-query-builder/use-query-state-sync.ts
|
|
9939
|
-
import { useCallback as useCallback3, useEffect as
|
|
10222
|
+
import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef7, useState as useState23 } from "react";
|
|
9940
10223
|
|
|
9941
10224
|
// src/components/databrowser/components/ui-query-builder/query-stringify.ts
|
|
9942
10225
|
var jsonToJsLiteral = (json) => {
|
|
@@ -10061,12 +10344,12 @@ var stringifyQueryState = (state) => {
|
|
|
10061
10344
|
// src/components/databrowser/components/ui-query-builder/use-query-state-sync.ts
|
|
10062
10345
|
var useQueryStateSync = () => {
|
|
10063
10346
|
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
10064
|
-
const [queryState, setQueryStateInternal] =
|
|
10347
|
+
const [queryState, setQueryStateInternal] = useState23(() => {
|
|
10065
10348
|
return parseQueryString(valuesSearch.query) ?? createInitialQueryState();
|
|
10066
10349
|
});
|
|
10067
10350
|
const lastSyncedQuery = useRef7(valuesSearch.query);
|
|
10068
10351
|
const isOurUpdate = useRef7(false);
|
|
10069
|
-
|
|
10352
|
+
useEffect17(() => {
|
|
10070
10353
|
if (isOurUpdate.current) {
|
|
10071
10354
|
isOurUpdate.current = false;
|
|
10072
10355
|
lastSyncedQuery.current = valuesSearch.query;
|
|
@@ -10100,22 +10383,22 @@ var useQueryStateSync = () => {
|
|
|
10100
10383
|
};
|
|
10101
10384
|
|
|
10102
10385
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
10103
|
-
import { jsx as
|
|
10386
|
+
import { jsx as jsx72, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10104
10387
|
var UIQueryBuilder = () => {
|
|
10105
10388
|
const { valuesSearch } = useTab();
|
|
10106
10389
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
10107
10390
|
const { queryState, setQueryState } = useQueryStateSync();
|
|
10108
10391
|
const fieldInfos = indexDetails?.schema ? extractFieldInfo(indexDetails.schema) : [];
|
|
10109
10392
|
const hasNormalized = useRef8(false);
|
|
10110
|
-
|
|
10393
|
+
useEffect18(() => {
|
|
10111
10394
|
if (hasNormalized.current || fieldInfos.length === 0) return;
|
|
10112
10395
|
hasNormalized.current = true;
|
|
10113
10396
|
setQueryState((state) => normalizeQueryState(state, fieldInfos));
|
|
10114
10397
|
}, [fieldInfos, setQueryState]);
|
|
10115
10398
|
const scrollAreaRef = useRef8(null);
|
|
10116
10399
|
const viewportRef = useRef8(null);
|
|
10117
|
-
const [hasTopShadow, setHasTopShadow] =
|
|
10118
|
-
const [hasBottomShadow, setHasBottomShadow] =
|
|
10400
|
+
const [hasTopShadow, setHasTopShadow] = useState24(false);
|
|
10401
|
+
const [hasBottomShadow, setHasBottomShadow] = useState24(false);
|
|
10119
10402
|
const recomputeShadows = useCallback4(() => {
|
|
10120
10403
|
const el = viewportRef.current;
|
|
10121
10404
|
if (!el) return;
|
|
@@ -10123,7 +10406,7 @@ var UIQueryBuilder = () => {
|
|
|
10123
10406
|
setHasTopShadow(scrollTop > 0);
|
|
10124
10407
|
setHasBottomShadow(scrollTop + clientHeight < scrollHeight - 1);
|
|
10125
10408
|
}, []);
|
|
10126
|
-
|
|
10409
|
+
useEffect18(() => {
|
|
10127
10410
|
viewportRef.current = scrollAreaRef.current?.querySelector(
|
|
10128
10411
|
"[data-radix-scroll-area-viewport]"
|
|
10129
10412
|
);
|
|
@@ -10134,27 +10417,27 @@ var UIQueryBuilder = () => {
|
|
|
10134
10417
|
obs.observe(el);
|
|
10135
10418
|
return () => obs.disconnect();
|
|
10136
10419
|
}, [recomputeShadows]);
|
|
10137
|
-
return /* @__PURE__ */
|
|
10138
|
-
/* @__PURE__ */
|
|
10420
|
+
return /* @__PURE__ */ jsx72(QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ jsxs43("div", { className: "relative h-full rounded-lg bg-zinc-50", children: [
|
|
10421
|
+
/* @__PURE__ */ jsx72(
|
|
10139
10422
|
"div",
|
|
10140
10423
|
{
|
|
10141
10424
|
className: `scroll-shadow-top pointer-events-none absolute left-0 top-0 z-10 h-6 w-full rounded-t-lg transition-opacity duration-200 ${hasTopShadow ? "opacity-100" : "opacity-0"}`
|
|
10142
10425
|
}
|
|
10143
10426
|
),
|
|
10144
|
-
/* @__PURE__ */
|
|
10427
|
+
/* @__PURE__ */ jsx72(
|
|
10145
10428
|
"div",
|
|
10146
10429
|
{
|
|
10147
10430
|
className: `scroll-shadow-bottom pointer-events-none absolute bottom-0 left-0 z-10 h-6 w-full rounded-b-lg transition-opacity duration-200 ${hasBottomShadow ? "opacity-100" : "opacity-0"}`
|
|
10148
10431
|
}
|
|
10149
10432
|
),
|
|
10150
|
-
/* @__PURE__ */
|
|
10433
|
+
/* @__PURE__ */ jsx72(
|
|
10151
10434
|
ScrollArea,
|
|
10152
10435
|
{
|
|
10153
10436
|
ref: scrollAreaRef,
|
|
10154
10437
|
onScroll: recomputeShadows,
|
|
10155
10438
|
className: "h-full",
|
|
10156
10439
|
scrollBarClassName: "py-1",
|
|
10157
|
-
children: /* @__PURE__ */
|
|
10440
|
+
children: /* @__PURE__ */ jsx72("div", { className: "p-4", children: /* @__PURE__ */ jsx72(QueryGroup, { node: queryState.root, isRoot: true, depth: 0 }) })
|
|
10158
10441
|
}
|
|
10159
10442
|
)
|
|
10160
10443
|
] }) });
|
|
@@ -10227,13 +10510,12 @@ var extractFieldInfo = (schema) => {
|
|
|
10227
10510
|
};
|
|
10228
10511
|
|
|
10229
10512
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
10230
|
-
import { jsx as
|
|
10513
|
+
import { jsx as jsx73, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10231
10514
|
var PREFIX = "const query: Query = ";
|
|
10232
|
-
var
|
|
10515
|
+
var QueryBuilderContent = () => {
|
|
10233
10516
|
const { valuesSearch } = useTab();
|
|
10234
|
-
const
|
|
10235
|
-
const [
|
|
10236
|
-
const [switchError, setSwitchError] = useState23(null);
|
|
10517
|
+
const [mode, setMode] = useState25("builder");
|
|
10518
|
+
const [switchError, setSwitchError] = useState25(null);
|
|
10237
10519
|
const handleModeChange = (value) => {
|
|
10238
10520
|
const newMode = value;
|
|
10239
10521
|
if (newMode === "builder") {
|
|
@@ -10249,16 +10531,9 @@ var SearchContent = () => {
|
|
|
10249
10531
|
}
|
|
10250
10532
|
setMode(newMode);
|
|
10251
10533
|
};
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
const hasIndexes = indexes && indexes.length > 0;
|
|
10256
|
-
if (!hasIndexes) {
|
|
10257
|
-
return /* @__PURE__ */ jsx72(SearchEmptyState, {});
|
|
10258
|
-
}
|
|
10259
|
-
return /* @__PURE__ */ jsxs43("div", { children: [
|
|
10260
|
-
/* @__PURE__ */ jsxs43("div", { className: "relative h-[300px] max-h-[600px] min-h-[150px] resize-y overflow-hidden", children: [
|
|
10261
|
-
/* @__PURE__ */ jsx72("div", { className: "absolute right-4 top-4 z-10", children: /* @__PURE__ */ jsx72(
|
|
10534
|
+
return /* @__PURE__ */ jsxs44("div", { children: [
|
|
10535
|
+
/* @__PURE__ */ jsxs44("div", { className: "relative h-[200px] max-h-[40vh] min-h-[150px] resize-y overflow-hidden", children: [
|
|
10536
|
+
/* @__PURE__ */ jsx73("div", { className: "absolute right-4 top-4 z-10", children: /* @__PURE__ */ jsx73(
|
|
10262
10537
|
Segmented,
|
|
10263
10538
|
{
|
|
10264
10539
|
options: [
|
|
@@ -10270,17 +10545,40 @@ var SearchContent = () => {
|
|
|
10270
10545
|
buttonClassName: "h-6"
|
|
10271
10546
|
}
|
|
10272
10547
|
) }),
|
|
10273
|
-
mode === "builder" ? /* @__PURE__ */
|
|
10548
|
+
mode === "builder" ? /* @__PURE__ */ jsx73(UIQueryBuilder, {}) : /* @__PURE__ */ jsx73(QueryBuilder, {})
|
|
10274
10549
|
] }),
|
|
10275
|
-
switchError && /* @__PURE__ */
|
|
10550
|
+
switchError && /* @__PURE__ */ jsx73("p", { className: "mt-3 text-sm text-red-500", children: switchError })
|
|
10276
10551
|
] });
|
|
10277
10552
|
};
|
|
10553
|
+
var SearchContent = () => {
|
|
10554
|
+
const { valuesSearch, setValuesSearchIndex } = useTab();
|
|
10555
|
+
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
10556
|
+
useEffect19(() => {
|
|
10557
|
+
if (!indexes || isLoading) return;
|
|
10558
|
+
if (valuesSearch.index && !indexes.includes(valuesSearch.index)) setValuesSearchIndex("");
|
|
10559
|
+
}, [indexes, valuesSearch.index, isLoading, setValuesSearchIndex]);
|
|
10560
|
+
if (isLoading) {
|
|
10561
|
+
return null;
|
|
10562
|
+
}
|
|
10563
|
+
const hasIndexes = indexes && indexes.length > 0;
|
|
10564
|
+
if (!hasIndexes) return /* @__PURE__ */ jsx73(SearchEmptyState, {});
|
|
10565
|
+
return /* @__PURE__ */ jsx73(QueryBuilderContent, {});
|
|
10566
|
+
};
|
|
10278
10567
|
var DatabrowserInstance = ({
|
|
10279
10568
|
hidden,
|
|
10280
|
-
|
|
10569
|
+
tabType
|
|
10281
10570
|
}) => {
|
|
10282
|
-
const { isValuesSearchSelected } = useTab();
|
|
10283
|
-
|
|
10571
|
+
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
10572
|
+
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
10573
|
+
useEffect19(() => {
|
|
10574
|
+
if (tabType === "keys" && isValuesSearchSelected) {
|
|
10575
|
+
setIsValuesSearchSelected(false);
|
|
10576
|
+
} else if (tabType === "search" && !isValuesSearchSelected) {
|
|
10577
|
+
setIsValuesSearchSelected(true);
|
|
10578
|
+
}
|
|
10579
|
+
}, [tabType, isValuesSearchSelected, setIsValuesSearchSelected]);
|
|
10580
|
+
const showEmptyState = isValuesSearchSelected && !isLoading && (!indexes || indexes.length === 0);
|
|
10581
|
+
return /* @__PURE__ */ jsx73(KeysProvider, { children: /* @__PURE__ */ jsxs44(
|
|
10284
10582
|
"div",
|
|
10285
10583
|
{
|
|
10286
10584
|
className: cn(
|
|
@@ -10288,36 +10586,36 @@ var DatabrowserInstance = ({
|
|
|
10288
10586
|
hidden && "hidden"
|
|
10289
10587
|
),
|
|
10290
10588
|
children: [
|
|
10291
|
-
/* @__PURE__ */
|
|
10292
|
-
/* @__PURE__ */
|
|
10293
|
-
isValuesSearchSelected && /* @__PURE__ */
|
|
10294
|
-
/* @__PURE__ */
|
|
10589
|
+
/* @__PURE__ */ jsxs44("div", { className: "space-y-3 py-5", children: [
|
|
10590
|
+
/* @__PURE__ */ jsx73(Header, { tabType }),
|
|
10591
|
+
isValuesSearchSelected && !showEmptyState && /* @__PURE__ */ jsx73(SearchContent, {}),
|
|
10592
|
+
/* @__PURE__ */ jsx73(HeaderError, {})
|
|
10295
10593
|
] }),
|
|
10296
|
-
/* @__PURE__ */
|
|
10594
|
+
showEmptyState ? /* @__PURE__ */ jsx73(SearchEmptyState, {}) : /* @__PURE__ */ jsxs44(
|
|
10297
10595
|
PanelGroup,
|
|
10298
10596
|
{
|
|
10299
10597
|
autoSaveId: "persistence",
|
|
10300
10598
|
direction: "horizontal",
|
|
10301
10599
|
className: "h-full w-full text-sm antialiased",
|
|
10302
10600
|
children: [
|
|
10303
|
-
/* @__PURE__ */
|
|
10304
|
-
/* @__PURE__ */
|
|
10305
|
-
/* @__PURE__ */
|
|
10306
|
-
/* @__PURE__ */
|
|
10307
|
-
/* @__PURE__ */
|
|
10601
|
+
/* @__PURE__ */ jsx73(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx73(Sidebar, {}) }),
|
|
10602
|
+
/* @__PURE__ */ jsxs44(PanelResizeHandle, { className: "group mx-[2px] flex h-full flex-col items-center justify-center gap-1 rounded-md px-[8px] transition-colors hover:bg-zinc-300/10", children: [
|
|
10603
|
+
/* @__PURE__ */ jsx73("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
10604
|
+
/* @__PURE__ */ jsx73("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
10605
|
+
/* @__PURE__ */ jsx73("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" })
|
|
10308
10606
|
] }),
|
|
10309
|
-
/* @__PURE__ */
|
|
10607
|
+
/* @__PURE__ */ jsx73(Panel, { minSize: 40, children: /* @__PURE__ */ jsx73(DataDisplay, {}) })
|
|
10310
10608
|
]
|
|
10311
10609
|
}
|
|
10312
10610
|
),
|
|
10313
|
-
/* @__PURE__ */
|
|
10611
|
+
/* @__PURE__ */ jsx73(Toaster, {})
|
|
10314
10612
|
]
|
|
10315
10613
|
}
|
|
10316
10614
|
) });
|
|
10317
10615
|
};
|
|
10318
10616
|
|
|
10319
10617
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
10320
|
-
import { useCallback as useCallback6, useEffect as
|
|
10618
|
+
import { useCallback as useCallback6, useEffect as useEffect21, useMemo as useMemo11, useRef as useRef10, useState as useState27 } from "react";
|
|
10321
10619
|
import {
|
|
10322
10620
|
closestCenter,
|
|
10323
10621
|
DndContext as DndContext2,
|
|
@@ -10329,14 +10627,14 @@ import {
|
|
|
10329
10627
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
10330
10628
|
import { horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
10331
10629
|
import { CSS } from "@dnd-kit/utilities";
|
|
10332
|
-
import { IconChevronDown as IconChevronDown3, IconPlus as
|
|
10630
|
+
import { IconChevronDown as IconChevronDown3, IconPlus as IconPlus5, IconWindowMaximize } from "@tabler/icons-react";
|
|
10333
10631
|
|
|
10334
10632
|
// src/components/ui/command.tsx
|
|
10335
10633
|
import * as React15 from "react";
|
|
10336
10634
|
import { IconSearch as IconSearch4 } from "@tabler/icons-react";
|
|
10337
10635
|
import { Command as CommandPrimitive } from "cmdk";
|
|
10338
|
-
import { jsx as
|
|
10339
|
-
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10636
|
+
import { jsx as jsx74, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10637
|
+
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx74(
|
|
10340
10638
|
CommandPrimitive,
|
|
10341
10639
|
{
|
|
10342
10640
|
ref,
|
|
@@ -10348,9 +10646,9 @@ var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
10348
10646
|
}
|
|
10349
10647
|
));
|
|
10350
10648
|
Command.displayName = CommandPrimitive.displayName;
|
|
10351
|
-
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10352
|
-
/* @__PURE__ */
|
|
10353
|
-
/* @__PURE__ */
|
|
10649
|
+
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs45("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
10650
|
+
/* @__PURE__ */ jsx74(IconSearch4, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
10651
|
+
/* @__PURE__ */ jsx74(
|
|
10354
10652
|
CommandPrimitive.Input,
|
|
10355
10653
|
{
|
|
10356
10654
|
ref,
|
|
@@ -10363,7 +10661,7 @@ var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
10363
10661
|
)
|
|
10364
10662
|
] }));
|
|
10365
10663
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
10366
|
-
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10664
|
+
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx74(
|
|
10367
10665
|
CommandPrimitive.List,
|
|
10368
10666
|
{
|
|
10369
10667
|
ref,
|
|
@@ -10372,9 +10670,9 @@ var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
10372
10670
|
}
|
|
10373
10671
|
));
|
|
10374
10672
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
10375
|
-
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */
|
|
10673
|
+
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ jsx74(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
10376
10674
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
10377
|
-
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10675
|
+
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx74(
|
|
10378
10676
|
CommandPrimitive.Group,
|
|
10379
10677
|
{
|
|
10380
10678
|
ref,
|
|
@@ -10386,7 +10684,7 @@ var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
10386
10684
|
}
|
|
10387
10685
|
));
|
|
10388
10686
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
10389
|
-
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10687
|
+
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx74(
|
|
10390
10688
|
CommandPrimitive.Separator,
|
|
10391
10689
|
{
|
|
10392
10690
|
ref,
|
|
@@ -10395,7 +10693,7 @@ var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
10395
10693
|
}
|
|
10396
10694
|
));
|
|
10397
10695
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
10398
|
-
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
10696
|
+
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx74(
|
|
10399
10697
|
CommandPrimitive.Item,
|
|
10400
10698
|
{
|
|
10401
10699
|
ref,
|
|
@@ -10408,7 +10706,7 @@ var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
10408
10706
|
));
|
|
10409
10707
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
10410
10708
|
var CommandShortcut = ({ className, ...props }) => {
|
|
10411
|
-
return /* @__PURE__ */
|
|
10709
|
+
return /* @__PURE__ */ jsx74("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
10412
10710
|
};
|
|
10413
10711
|
CommandShortcut.displayName = "CommandShortcut";
|
|
10414
10712
|
|
|
@@ -10423,9 +10721,9 @@ import {
|
|
|
10423
10721
|
} from "@tabler/icons-react";
|
|
10424
10722
|
|
|
10425
10723
|
// src/hooks/use-overflow.ts
|
|
10426
|
-
import { useCallback as useCallback5, useEffect as
|
|
10724
|
+
import { useCallback as useCallback5, useEffect as useEffect20, useRef as useRef9, useState as useState26 } from "react";
|
|
10427
10725
|
var useOverflow = () => {
|
|
10428
|
-
const [isOverflow, setIsOverflow] =
|
|
10726
|
+
const [isOverflow, setIsOverflow] = useState26(false);
|
|
10429
10727
|
const observerRef = useRef9(null);
|
|
10430
10728
|
const ref = useCallback5((node) => {
|
|
10431
10729
|
if (observerRef.current) {
|
|
@@ -10440,7 +10738,7 @@ var useOverflow = () => {
|
|
|
10440
10738
|
});
|
|
10441
10739
|
observerRef.current.observe(node);
|
|
10442
10740
|
}, []);
|
|
10443
|
-
|
|
10741
|
+
useEffect20(() => {
|
|
10444
10742
|
return () => {
|
|
10445
10743
|
observerRef.current?.disconnect();
|
|
10446
10744
|
};
|
|
@@ -10449,16 +10747,16 @@ var useOverflow = () => {
|
|
|
10449
10747
|
};
|
|
10450
10748
|
|
|
10451
10749
|
// src/components/databrowser/components/tab-type-icon.tsx
|
|
10452
|
-
import { jsx as
|
|
10750
|
+
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
10453
10751
|
function TabTypeIcon({ selectedKey }) {
|
|
10454
10752
|
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
10455
|
-
if (isLoading) return /* @__PURE__ */
|
|
10753
|
+
if (isLoading) return /* @__PURE__ */ jsx75(Skeleton, { className: "h-5 w-5 rounded" });
|
|
10456
10754
|
if (!keyType || keyType === "none") return;
|
|
10457
|
-
return /* @__PURE__ */
|
|
10755
|
+
return /* @__PURE__ */ jsx75(TypeTag, { variant: keyType, type: "icon" });
|
|
10458
10756
|
}
|
|
10459
10757
|
|
|
10460
10758
|
// src/components/databrowser/components/tab.tsx
|
|
10461
|
-
import { jsx as
|
|
10759
|
+
import { jsx as jsx76, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10462
10760
|
var Tab = ({ id, isList }) => {
|
|
10463
10761
|
const { active, search, selectedKey, valuesSearch, pinned, isValuesSearchSelected } = useTab();
|
|
10464
10762
|
const {
|
|
@@ -10474,8 +10772,8 @@ var Tab = ({ id, isList }) => {
|
|
|
10474
10772
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
10475
10773
|
const { ref, isOverflow } = useOverflow();
|
|
10476
10774
|
const label = isValuesSearchSelected ? valuesSearch.index : search.key || selectedKey;
|
|
10477
|
-
const iconNode = isValuesSearchSelected ? /* @__PURE__ */
|
|
10478
|
-
const tabNode = /* @__PURE__ */
|
|
10775
|
+
const iconNode = isValuesSearchSelected ? /* @__PURE__ */ jsx76("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-emerald-200 text-emerald-800", children: /* @__PURE__ */ jsx76(IconSearch5, { size: 14 }) }) : search.key ? /* @__PURE__ */ jsx76("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-zinc-100 text-zinc-600", children: /* @__PURE__ */ jsx76(IconSearch5, { size: 14 }) }) : selectedKey ? /* @__PURE__ */ jsx76(TabTypeIcon, { selectedKey }) : void 0;
|
|
10776
|
+
const tabNode = /* @__PURE__ */ jsxs46(
|
|
10479
10777
|
"div",
|
|
10480
10778
|
{
|
|
10481
10779
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
@@ -10486,8 +10784,8 @@ var Tab = ({ id, isList }) => {
|
|
|
10486
10784
|
!isList && (active ? "bg-white text-zinc-950" : "bg-zinc-200 text-zinc-600 hover:bg-zinc-100")
|
|
10487
10785
|
),
|
|
10488
10786
|
children: [
|
|
10489
|
-
/* @__PURE__ */
|
|
10490
|
-
/* @__PURE__ */
|
|
10787
|
+
/* @__PURE__ */ jsx76("div", { className: cn(!active && "transition-colors"), children: iconNode }),
|
|
10788
|
+
/* @__PURE__ */ jsx76(
|
|
10491
10789
|
"span",
|
|
10492
10790
|
{
|
|
10493
10791
|
ref,
|
|
@@ -10495,8 +10793,8 @@ var Tab = ({ id, isList }) => {
|
|
|
10495
10793
|
children: label || "New Tab"
|
|
10496
10794
|
}
|
|
10497
10795
|
),
|
|
10498
|
-
pinned && /* @__PURE__ */
|
|
10499
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
10796
|
+
pinned && /* @__PURE__ */ jsx76(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
10797
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx76(
|
|
10500
10798
|
"button",
|
|
10501
10799
|
{
|
|
10502
10800
|
onClick: (e) => {
|
|
@@ -10504,46 +10802,46 @@ var Tab = ({ id, isList }) => {
|
|
|
10504
10802
|
removeTab(id);
|
|
10505
10803
|
},
|
|
10506
10804
|
className: "p-[2px] text-zinc-400 transition-colors hover:text-zinc-500",
|
|
10507
|
-
children: /* @__PURE__ */
|
|
10805
|
+
children: /* @__PURE__ */ jsx76(IconX5, { size: 16 })
|
|
10508
10806
|
}
|
|
10509
10807
|
)
|
|
10510
10808
|
]
|
|
10511
10809
|
}
|
|
10512
10810
|
);
|
|
10513
|
-
return /* @__PURE__ */
|
|
10514
|
-
/* @__PURE__ */
|
|
10515
|
-
/* @__PURE__ */
|
|
10811
|
+
return /* @__PURE__ */ jsxs46(ContextMenu, { children: [
|
|
10812
|
+
/* @__PURE__ */ jsx76(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx76(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
10813
|
+
/* @__PURE__ */ jsxs46(
|
|
10516
10814
|
ContextMenuContent,
|
|
10517
10815
|
{
|
|
10518
10816
|
onClick: (e) => {
|
|
10519
10817
|
e.stopPropagation();
|
|
10520
10818
|
},
|
|
10521
10819
|
children: [
|
|
10522
|
-
/* @__PURE__ */
|
|
10523
|
-
/* @__PURE__ */
|
|
10820
|
+
/* @__PURE__ */ jsxs46(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
10821
|
+
/* @__PURE__ */ jsx76(IconPin, { size: 16 }),
|
|
10524
10822
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
10525
10823
|
] }),
|
|
10526
|
-
/* @__PURE__ */
|
|
10527
|
-
/* @__PURE__ */
|
|
10824
|
+
/* @__PURE__ */ jsxs46(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
10825
|
+
/* @__PURE__ */ jsx76(IconCopyPlus, { size: 16 }),
|
|
10528
10826
|
"Duplicate Tab"
|
|
10529
10827
|
] }),
|
|
10530
|
-
/* @__PURE__ */
|
|
10531
|
-
/* @__PURE__ */
|
|
10532
|
-
/* @__PURE__ */
|
|
10828
|
+
/* @__PURE__ */ jsx76(ContextMenuSeparator, {}),
|
|
10829
|
+
/* @__PURE__ */ jsxs46(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
10830
|
+
/* @__PURE__ */ jsx76(IconX5, { size: 16 }),
|
|
10533
10831
|
"Close Tab"
|
|
10534
10832
|
] }),
|
|
10535
|
-
/* @__PURE__ */
|
|
10536
|
-
/* @__PURE__ */
|
|
10833
|
+
/* @__PURE__ */ jsxs46(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
10834
|
+
/* @__PURE__ */ jsx76(IconSquareX, { size: 16 }),
|
|
10537
10835
|
"Close Other Tabs"
|
|
10538
10836
|
] }),
|
|
10539
|
-
/* @__PURE__ */
|
|
10837
|
+
/* @__PURE__ */ jsxs46(
|
|
10540
10838
|
ContextMenuItem,
|
|
10541
10839
|
{
|
|
10542
10840
|
onSelect: () => closeAllButPinned(),
|
|
10543
10841
|
className: "gap-2",
|
|
10544
10842
|
disabled: !hasPinnedTabs,
|
|
10545
10843
|
children: [
|
|
10546
|
-
/* @__PURE__ */
|
|
10844
|
+
/* @__PURE__ */ jsx76(IconArrowsMinimize, { size: 16 }),
|
|
10547
10845
|
"Close All But Pinned"
|
|
10548
10846
|
]
|
|
10549
10847
|
}
|
|
@@ -10555,9 +10853,9 @@ var Tab = ({ id, isList }) => {
|
|
|
10555
10853
|
};
|
|
10556
10854
|
|
|
10557
10855
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
10558
|
-
import { jsx as
|
|
10856
|
+
import { jsx as jsx77, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10559
10857
|
var SortableTab = ({ id }) => {
|
|
10560
|
-
const [originalWidth, setOriginalWidth] =
|
|
10858
|
+
const [originalWidth, setOriginalWidth] = useState27(null);
|
|
10561
10859
|
const textRef = useRef10(null);
|
|
10562
10860
|
const { tabs } = useDatabrowserStore();
|
|
10563
10861
|
const tabData = tabs.find(([tabId]) => tabId === id)?.[1];
|
|
@@ -10582,7 +10880,7 @@ var SortableTab = ({ id }) => {
|
|
|
10582
10880
|
}
|
|
10583
10881
|
setNodeRef(element);
|
|
10584
10882
|
};
|
|
10585
|
-
|
|
10883
|
+
useEffect21(() => {
|
|
10586
10884
|
if (textRef.current && isDragging) {
|
|
10587
10885
|
const originalMaxWidth = textRef.current.style.maxWidth;
|
|
10588
10886
|
const originalWhiteSpace = textRef.current.style.whiteSpace;
|
|
@@ -10602,7 +10900,7 @@ var SortableTab = ({ id }) => {
|
|
|
10602
10900
|
};
|
|
10603
10901
|
}
|
|
10604
10902
|
}, [isDragging]);
|
|
10605
|
-
|
|
10903
|
+
useEffect21(() => {
|
|
10606
10904
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10607
10905
|
if (entries[0]) {
|
|
10608
10906
|
setOriginalWidth(entries[0].contentRect.width);
|
|
@@ -10623,7 +10921,7 @@ var SortableTab = ({ id }) => {
|
|
|
10623
10921
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
10624
10922
|
} : {}
|
|
10625
10923
|
};
|
|
10626
|
-
return /* @__PURE__ */
|
|
10924
|
+
return /* @__PURE__ */ jsx77(
|
|
10627
10925
|
"div",
|
|
10628
10926
|
{
|
|
10629
10927
|
ref: measureRef,
|
|
@@ -10631,7 +10929,7 @@ var SortableTab = ({ id }) => {
|
|
|
10631
10929
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
10632
10930
|
...attributes,
|
|
10633
10931
|
...isPinned ? {} : listeners2,
|
|
10634
|
-
children: /* @__PURE__ */
|
|
10932
|
+
children: /* @__PURE__ */ jsx77(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx77(Tab, { id }) })
|
|
10635
10933
|
}
|
|
10636
10934
|
);
|
|
10637
10935
|
};
|
|
@@ -10645,10 +10943,10 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10645
10943
|
});
|
|
10646
10944
|
}, [tabs]);
|
|
10647
10945
|
const scrollRef = useRef10(null);
|
|
10648
|
-
const [hasLeftShadow, setHasLeftShadow] =
|
|
10649
|
-
const [hasRightShadow, setHasRightShadow] =
|
|
10650
|
-
const [isOverflow, setIsOverflow] =
|
|
10651
|
-
|
|
10946
|
+
const [hasLeftShadow, setHasLeftShadow] = useState27(false);
|
|
10947
|
+
const [hasRightShadow, setHasRightShadow] = useState27(false);
|
|
10948
|
+
const [isOverflow, setIsOverflow] = useState27(false);
|
|
10949
|
+
useEffect21(() => {
|
|
10652
10950
|
const el = scrollRef.current;
|
|
10653
10951
|
if (!el) return;
|
|
10654
10952
|
const onWheel = (event) => {
|
|
@@ -10678,7 +10976,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10678
10976
|
setHasRightShadow(scrollLeft + clientWidth < scrollWidth - 1);
|
|
10679
10977
|
setIsOverflow(scrollWidth > clientWidth + 1);
|
|
10680
10978
|
}, []);
|
|
10681
|
-
|
|
10979
|
+
useEffect21(() => {
|
|
10682
10980
|
recomputeShadows();
|
|
10683
10981
|
const el = scrollRef.current;
|
|
10684
10982
|
if (!el) return;
|
|
@@ -10706,28 +11004,28 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10706
11004
|
reorderTabs(oldIndex, newIndex);
|
|
10707
11005
|
}
|
|
10708
11006
|
};
|
|
10709
|
-
return /* @__PURE__ */
|
|
10710
|
-
/* @__PURE__ */
|
|
10711
|
-
/* @__PURE__ */
|
|
11007
|
+
return /* @__PURE__ */ jsx77("div", { className: "relative shrink-0 overflow-hidden rounded-t-lg bg-zinc-300", children: /* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-1", children: [
|
|
11008
|
+
/* @__PURE__ */ jsxs47("div", { className: "relative min-w-0 flex-1", children: [
|
|
11009
|
+
/* @__PURE__ */ jsx77(
|
|
10712
11010
|
"div",
|
|
10713
11011
|
{
|
|
10714
11012
|
className: `tabs-shadow-left pointer-events-none absolute left-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasLeftShadow ? "opacity-100" : "opacity-0"}`
|
|
10715
11013
|
}
|
|
10716
11014
|
),
|
|
10717
|
-
/* @__PURE__ */
|
|
11015
|
+
/* @__PURE__ */ jsx77(
|
|
10718
11016
|
"div",
|
|
10719
11017
|
{
|
|
10720
11018
|
className: `tabs-shadow-right pointer-events-none absolute right-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasRightShadow ? "opacity-100" : "opacity-0"}`
|
|
10721
11019
|
}
|
|
10722
11020
|
),
|
|
10723
|
-
/* @__PURE__ */
|
|
11021
|
+
/* @__PURE__ */ jsxs47(
|
|
10724
11022
|
"div",
|
|
10725
11023
|
{
|
|
10726
11024
|
ref: scrollRef,
|
|
10727
11025
|
onScroll: recomputeShadows,
|
|
10728
11026
|
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [&::-webkit-scrollbar]:hidden",
|
|
10729
11027
|
children: [
|
|
10730
|
-
/* @__PURE__ */
|
|
11028
|
+
/* @__PURE__ */ jsx77(
|
|
10731
11029
|
DndContext2,
|
|
10732
11030
|
{
|
|
10733
11031
|
sensors,
|
|
@@ -10739,25 +11037,25 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10739
11037
|
strategy: MeasuringStrategy.Always
|
|
10740
11038
|
}
|
|
10741
11039
|
},
|
|
10742
|
-
children: /* @__PURE__ */
|
|
11040
|
+
children: /* @__PURE__ */ jsx77(
|
|
10743
11041
|
SortableContext,
|
|
10744
11042
|
{
|
|
10745
11043
|
items: sortedTabs.map(([id]) => id),
|
|
10746
11044
|
strategy: horizontalListSortingStrategy,
|
|
10747
|
-
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */
|
|
11045
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx77(SortableTab, { id }, id))
|
|
10748
11046
|
}
|
|
10749
11047
|
)
|
|
10750
11048
|
}
|
|
10751
11049
|
),
|
|
10752
|
-
!isOverflow && /* @__PURE__ */
|
|
11050
|
+
!isOverflow && /* @__PURE__ */ jsx77("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx77(AddTabButton, {}) })
|
|
10753
11051
|
]
|
|
10754
11052
|
}
|
|
10755
11053
|
)
|
|
10756
11054
|
] }),
|
|
10757
|
-
/* @__PURE__ */
|
|
10758
|
-
isOverflow && /* @__PURE__ */
|
|
10759
|
-
tabs.length > 1 && /* @__PURE__ */
|
|
10760
|
-
onFullScreenClick && /* @__PURE__ */
|
|
11055
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-1 pl-1", children: [
|
|
11056
|
+
isOverflow && /* @__PURE__ */ jsx77(AddTabButton, {}),
|
|
11057
|
+
tabs.length > 1 && /* @__PURE__ */ jsx77(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
11058
|
+
onFullScreenClick && /* @__PURE__ */ jsx77(
|
|
10761
11059
|
Button,
|
|
10762
11060
|
{
|
|
10763
11061
|
"aria-label": "Toggle fullscreen",
|
|
@@ -10765,7 +11063,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10765
11063
|
size: "icon-sm",
|
|
10766
11064
|
onClick: onFullScreenClick,
|
|
10767
11065
|
className: "flex-shrink-0 bg-white text-zinc-500 dark:bg-zinc-100",
|
|
10768
|
-
children: /* @__PURE__ */
|
|
11066
|
+
children: /* @__PURE__ */ jsx77(IconWindowMaximize, { size: 16 })
|
|
10769
11067
|
}
|
|
10770
11068
|
)
|
|
10771
11069
|
] })
|
|
@@ -10783,7 +11081,7 @@ function AddTabButton() {
|
|
|
10783
11081
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
10784
11082
|
}, 20);
|
|
10785
11083
|
};
|
|
10786
|
-
return /* @__PURE__ */
|
|
11084
|
+
return /* @__PURE__ */ jsx77(
|
|
10787
11085
|
Button,
|
|
10788
11086
|
{
|
|
10789
11087
|
"aria-label": "Add new tab",
|
|
@@ -10791,7 +11089,7 @@ function AddTabButton() {
|
|
|
10791
11089
|
size: "icon-sm",
|
|
10792
11090
|
onClick: handleAddTab,
|
|
10793
11091
|
className: "flex-shrink-0 bg-zinc-200 ",
|
|
10794
|
-
children: /* @__PURE__ */
|
|
11092
|
+
children: /* @__PURE__ */ jsx77(IconPlus5, { className: "text-zinc-600", size: 16 })
|
|
10795
11093
|
}
|
|
10796
11094
|
);
|
|
10797
11095
|
}
|
|
@@ -10799,7 +11097,7 @@ function TabsListButton({
|
|
|
10799
11097
|
tabs,
|
|
10800
11098
|
onSelectTab
|
|
10801
11099
|
}) {
|
|
10802
|
-
const [open, setOpen] =
|
|
11100
|
+
const [open, setOpen] = useState27(false);
|
|
10803
11101
|
const sorted = useMemo11(() => {
|
|
10804
11102
|
return [...tabs].sort(([, a], [, b]) => {
|
|
10805
11103
|
if (a.pinned && !b.pinned) return -1;
|
|
@@ -10817,8 +11115,8 @@ function TabsListButton({
|
|
|
10817
11115
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
10818
11116
|
}, 20);
|
|
10819
11117
|
};
|
|
10820
|
-
return /* @__PURE__ */
|
|
10821
|
-
/* @__PURE__ */
|
|
11118
|
+
return /* @__PURE__ */ jsxs47(Popover, { open, onOpenChange: setOpen, children: [
|
|
11119
|
+
/* @__PURE__ */ jsx77(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs47(
|
|
10822
11120
|
Button,
|
|
10823
11121
|
{
|
|
10824
11122
|
variant: "secondary",
|
|
@@ -10826,14 +11124,14 @@ function TabsListButton({
|
|
|
10826
11124
|
className: "gap-1 bg-white px-2",
|
|
10827
11125
|
"aria-label": "Search in tabs",
|
|
10828
11126
|
children: [
|
|
10829
|
-
/* @__PURE__ */
|
|
10830
|
-
/* @__PURE__ */
|
|
11127
|
+
/* @__PURE__ */ jsx77("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
11128
|
+
/* @__PURE__ */ jsx77(IconChevronDown3, { className: "text-zinc-500", size: 16 })
|
|
10831
11129
|
]
|
|
10832
11130
|
}
|
|
10833
11131
|
) }),
|
|
10834
|
-
/* @__PURE__ */
|
|
10835
|
-
/* @__PURE__ */
|
|
10836
|
-
/* @__PURE__ */
|
|
11132
|
+
/* @__PURE__ */ jsx77(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx77(Command, { children: /* @__PURE__ */ jsxs47(CommandList, { children: [
|
|
11133
|
+
/* @__PURE__ */ jsx77(CommandEmpty, { children: "No tabs" }),
|
|
11134
|
+
/* @__PURE__ */ jsx77(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx77(
|
|
10837
11135
|
CommandItem,
|
|
10838
11136
|
{
|
|
10839
11137
|
style: {
|
|
@@ -10843,7 +11141,7 @@ function TabsListButton({
|
|
|
10843
11141
|
onSelect: () => {
|
|
10844
11142
|
handleSelectTab(item.id);
|
|
10845
11143
|
},
|
|
10846
|
-
children: /* @__PURE__ */
|
|
11144
|
+
children: /* @__PURE__ */ jsx77(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx77(Tab, { id: _id, isList: true }) })
|
|
10847
11145
|
},
|
|
10848
11146
|
item.id
|
|
10849
11147
|
)) })
|
|
@@ -10852,12 +11150,12 @@ function TabsListButton({
|
|
|
10852
11150
|
}
|
|
10853
11151
|
|
|
10854
11152
|
// src/components/databrowser/index.tsx
|
|
10855
|
-
import { jsx as
|
|
11153
|
+
import { jsx as jsx78, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
10856
11154
|
var RedisBrowser = ({
|
|
10857
11155
|
url,
|
|
10858
11156
|
token,
|
|
10859
11157
|
hideTabs,
|
|
10860
|
-
|
|
11158
|
+
tabType = "all",
|
|
10861
11159
|
storage,
|
|
10862
11160
|
disableTelemetry,
|
|
10863
11161
|
onFullScreenClick,
|
|
@@ -10865,14 +11163,14 @@ var RedisBrowser = ({
|
|
|
10865
11163
|
}) => {
|
|
10866
11164
|
const credentials = useMemo12(() => ({ token, url }), [token, url]);
|
|
10867
11165
|
const rootRef = useRef11(null);
|
|
10868
|
-
|
|
11166
|
+
useEffect22(() => {
|
|
10869
11167
|
queryClient.resetQueries();
|
|
10870
11168
|
}, [credentials.url]);
|
|
10871
|
-
return /* @__PURE__ */
|
|
11169
|
+
return /* @__PURE__ */ jsx78(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx78(RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ jsx78(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx78(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx78(TooltipProvider, { children: /* @__PURE__ */ jsx78(
|
|
10872
11170
|
RedisBrowserRoot,
|
|
10873
11171
|
{
|
|
10874
11172
|
hideTabs,
|
|
10875
|
-
|
|
11173
|
+
tabType,
|
|
10876
11174
|
rootRef,
|
|
10877
11175
|
onFullScreenClick
|
|
10878
11176
|
}
|
|
@@ -10880,39 +11178,39 @@ var RedisBrowser = ({
|
|
|
10880
11178
|
};
|
|
10881
11179
|
var RedisBrowserRoot = ({
|
|
10882
11180
|
hideTabs,
|
|
10883
|
-
|
|
11181
|
+
tabType,
|
|
10884
11182
|
rootRef,
|
|
10885
11183
|
onFullScreenClick
|
|
10886
11184
|
}) => {
|
|
10887
11185
|
const theme = useTheme();
|
|
10888
|
-
|
|
11186
|
+
useEffect22(() => {
|
|
10889
11187
|
portalWrapper.classList.add("text-zinc-700");
|
|
10890
11188
|
portalWrapper.classList.toggle("dark", theme === "dark");
|
|
10891
11189
|
}, [theme]);
|
|
10892
11190
|
return (
|
|
10893
11191
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
10894
|
-
/* @__PURE__ */
|
|
11192
|
+
/* @__PURE__ */ jsx78(
|
|
10895
11193
|
"div",
|
|
10896
11194
|
{
|
|
10897
11195
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
10898
11196
|
style: { height: "100%" },
|
|
10899
11197
|
ref: rootRef,
|
|
10900
|
-
children: /* @__PURE__ */
|
|
10901
|
-
!hideTabs && /* @__PURE__ */
|
|
10902
|
-
/* @__PURE__ */
|
|
11198
|
+
children: /* @__PURE__ */ jsxs48("div", { className: "flex h-full flex-col overflow-hidden rounded-[14px] border-[4px] border-zinc-300 text-zinc-700", children: [
|
|
11199
|
+
!hideTabs && /* @__PURE__ */ jsx78(DatabrowserTabs, { onFullScreenClick }),
|
|
11200
|
+
/* @__PURE__ */ jsx78(DatabrowserInstances, { tabType })
|
|
10903
11201
|
] })
|
|
10904
11202
|
}
|
|
10905
11203
|
)
|
|
10906
11204
|
);
|
|
10907
11205
|
};
|
|
10908
|
-
var DatabrowserInstances = ({
|
|
11206
|
+
var DatabrowserInstances = ({ tabType }) => {
|
|
10909
11207
|
const { tabs, selectedTab, selectTab, addTab } = useDatabrowserStore();
|
|
10910
|
-
|
|
11208
|
+
useEffect22(() => {
|
|
10911
11209
|
if (tabs.length === 0) addTab();
|
|
10912
11210
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
10913
11211
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
10914
11212
|
if (!selectedTab) return;
|
|
10915
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
11213
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx78(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx78(DatabrowserInstance, { hidden: id !== selectedTab, tabType }) }, id));
|
|
10916
11214
|
};
|
|
10917
11215
|
export {
|
|
10918
11216
|
RedisBrowser
|