@elaraai/e3-ui-components 1.0.58 → 1.0.60

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.js CHANGED
@@ -64032,12 +64032,11 @@ function pageRows(type, decoded, offset) {
64032
64032
  }
64033
64033
  if (type.type === "Dict") {
64034
64034
  const { key: keyType, value: valueType } = type.value;
64035
- const printKey = printFor(keyType);
64036
64035
  const stringKeys = keyType.type === "String";
64037
64036
  return Array.from(decoded.entries()).map(([k2, v3], i) => ({
64038
64037
  node: ValueTree.materialize(valueType, v3),
64039
64038
  step: stringKeys ? variant("key", k2) : variant("index", BigInt(offset + i)),
64040
- label: stringKeys ? k2 : printKey(k2)
64039
+ label: stringKeys ? k2 : ValueTree.keyLabel(keyType, k2)
64041
64040
  }));
64042
64041
  }
64043
64042
  const elemType = type.value;
@@ -64058,7 +64057,8 @@ const PagedDatasetPreview = memo(function PagedDatasetPreview2({
64058
64057
  hash: hash2,
64059
64058
  sizeBytes,
64060
64059
  requestOptions,
64061
- onDownload
64060
+ onDownload,
64061
+ onNotIndexed
64062
64062
  }) {
64063
64063
  const queryClient = useQueryClient();
64064
64064
  const [pages, setPages] = useState(/* @__PURE__ */ new Map());
@@ -64101,12 +64101,15 @@ const PagedDatasetPreview = memo(function PagedDatasetPreview2({
64101
64101
  setPages((prev2) => new Map(prev2).set(pageIdx, rows));
64102
64102
  }).catch((err) => {
64103
64103
  pagingDebug(`p${pageIdx} FAILED:`, err);
64104
+ if (err instanceof ApiError && err.code === "dataset_not_indexed") {
64105
+ onNotIndexed == null ? void 0 : onNotIndexed();
64106
+ }
64104
64107
  setError(err instanceof Error ? err : new Error(String(err)));
64105
64108
  }).finally(() => {
64106
64109
  inflightRef.current.delete(pageIdx);
64107
64110
  setLoadingCount((n2) => n2 - 1);
64108
64111
  });
64109
- }, [queryClient, apiUrl, repo, workspace, path2, hash2, requestOptions, type]);
64112
+ }, [queryClient, apiUrl, repo, workspace, path2, hash2, requestOptions, type, onNotIndexed]);
64110
64113
  useEffect(() => {
64111
64114
  if (totals === null && error3 === null) loadPage(0);
64112
64115
  }, [totals, error3, loadPage]);
@@ -64203,7 +64206,11 @@ const DatasetPreview = memo(function DatasetPreview2({
64203
64206
  const hasValue = (status == null ? void 0 : status.refType) === "value" && status.hash !== null;
64204
64207
  const sizeBytes = (status == null ? void 0 : status.sizeBytes) ?? 0;
64205
64208
  const isOversized = hasValue && sizeBytes > sizeLimit;
64206
- const shouldFetch = hasValue && !isOversized;
64209
+ const type = status == null ? void 0 : status.type;
64210
+ const [notIndexedHash, setNotIndexedHash] = useState(null);
64211
+ const pageable = hasValue && type !== void 0 && (type.type === "Array" || type.type === "Set" || type.type === "Dict");
64212
+ const usePaged = pageable && (!editable || isOversized) && workspace != null && path2 != null && (status == null ? void 0 : status.hash) != null && status.hash !== notIndexedHash;
64213
+ const shouldFetch = hasValue && !isOversized && !usePaged;
64207
64214
  const valueQuery = useDatasetValue(apiUrl, repo, workspace, path2, {
64208
64215
  ...requestOptions != null && { requestOptions },
64209
64216
  type: status == null ? void 0 : status.type,
@@ -64217,7 +64224,6 @@ const DatasetPreview = memo(function DatasetPreview2({
64217
64224
  const download = useDatasetDownload(apiUrl, repo, workspace, path2, requestOptions);
64218
64225
  const setMutation = useDatasetSet(apiUrl, repo, workspace, requestOptions);
64219
64226
  const queryClient = useQueryClient();
64220
- const type = status == null ? void 0 : status.type;
64221
64227
  const decoded = (_a2 = valueQuery.data) == null ? void 0 : _a2.decoded;
64222
64228
  const write = useCallback(async (next2) => {
64223
64229
  if (workspace == null || path2 == null || type === void 0) return;
@@ -64244,24 +64250,25 @@ const DatasetPreview = memo(function DatasetPreview2({
64244
64250
  }
64245
64251
  if (!status) return /* @__PURE__ */ jsx$1(StatusDisplay, { variant: "info", title: "No status" });
64246
64252
  if (!hasValue) return /* @__PURE__ */ jsx$1(StatusDisplay, { variant: "info", title: "No data available", message: "Waiting for a value to be set" });
64253
+ if (usePaged && type !== void 0 && workspace != null && path2 != null && status.hash != null) {
64254
+ const pagedHash = status.hash;
64255
+ return /* @__PURE__ */ jsx$1(
64256
+ PagedDatasetPreview,
64257
+ {
64258
+ apiUrl,
64259
+ repo,
64260
+ workspace,
64261
+ path: path2,
64262
+ type,
64263
+ hash: pagedHash,
64264
+ sizeBytes,
64265
+ ...requestOptions != null && { requestOptions },
64266
+ onDownload: download,
64267
+ onNotIndexed: () => setNotIndexedHash(pagedHash)
64268
+ }
64269
+ );
64270
+ }
64247
64271
  if (isOversized) {
64248
- const pageable = type !== void 0 && (type.type === "Array" || type.type === "Set" || type.type === "Dict");
64249
- if (pageable && workspace != null && path2 != null && status.hash != null) {
64250
- return /* @__PURE__ */ jsx$1(
64251
- PagedDatasetPreview,
64252
- {
64253
- apiUrl,
64254
- repo,
64255
- workspace,
64256
- path: path2,
64257
- type,
64258
- hash: status.hash,
64259
- sizeBytes,
64260
- ...requestOptions != null && { requestOptions },
64261
- onDownload: download
64262
- }
64263
- );
64264
- }
64265
64272
  return /* @__PURE__ */ jsxs(Flex, { height: "100%", direction: "column", align: "center", justify: "center", layerStyle: "banner.stale", borderRadius: "0", gap: 3, p: 6, children: [
64266
64273
  /* @__PURE__ */ jsx$1(Text, { fontSize: "lg", color: "fg.warning", fontWeight: "bold", children: "Value too large to display" }),
64267
64274
  /* @__PURE__ */ jsxs(Text, { color: "fg.muted", fontSize: "sm", children: [