@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +5 -5
  2. package/dist/module.d.mts +17 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +4 -0
  5. package/dist/runtime/components/MongocampAccount.vue +12 -14
  6. package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
  7. package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
  8. package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
  9. package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
  10. package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
  11. package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
  12. package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
  13. package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
  14. package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
  15. package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
  16. package/dist/runtime/components/MongocampChart.vue +1 -1
  17. package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
  18. package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
  19. package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
  20. package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
  21. package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
  22. package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
  23. package/dist/runtime/components/MongocampCollectionData.vue +97 -87
  24. package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
  25. package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
  26. package/dist/runtime/components/MongocampCollections.vue +24 -33
  27. package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
  28. package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
  29. package/dist/runtime/components/MongocampDashboard.vue +5 -3
  30. package/dist/runtime/components/MongocampDatabases.vue +14 -8
  31. package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
  32. package/dist/runtime/components/MongocampDocumentView.vue +12 -9
  33. package/dist/runtime/components/MongocampEmptyState.vue +4 -1
  34. package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
  35. package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
  36. package/dist/runtime/components/MongocampExportAll.vue +19 -7
  37. package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
  38. package/dist/runtime/components/MongocampFilePreview.vue +7 -6
  39. package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
  40. package/dist/runtime/components/MongocampGrantList.vue +6 -2
  41. package/dist/runtime/components/MongocampImport.vue +32 -28
  42. package/dist/runtime/components/MongocampIndexes.vue +21 -19
  43. package/dist/runtime/components/MongocampJobs.vue +20 -20
  44. package/dist/runtime/components/MongocampLogin.vue +2 -1
  45. package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
  46. package/dist/runtime/components/MongocampQueryBar.vue +33 -32
  47. package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
  48. package/dist/runtime/components/MongocampRoles.vue +28 -32
  49. package/dist/runtime/components/MongocampServerInfo.vue +17 -25
  50. package/dist/runtime/components/MongocampServerOverview.vue +16 -12
  51. package/dist/runtime/components/MongocampServerStatus.vue +9 -3
  52. package/dist/runtime/components/MongocampSettings.vue +15 -11
  53. package/dist/runtime/components/MongocampUserAccess.vue +11 -6
  54. package/dist/runtime/components/MongocampUsers.vue +32 -35
  55. package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
  56. package/dist/runtime/components/MongocampVersion.vue +20 -11
  57. package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
  58. package/dist/runtime/composables/useMongocampAdmin.js +6 -5
  59. package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
  60. package/dist/runtime/composables/useMongocampAggregation.js +17 -5
  61. package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
  62. package/dist/runtime/composables/useMongocampBucket.js +7 -6
  63. package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
  64. package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
  65. package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
  66. package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
  67. package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
  68. package/dist/runtime/composables/useMongocampError.d.ts +1 -1
  69. package/dist/runtime/composables/useMongocampError.js +4 -1
  70. package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
  71. package/dist/runtime/composables/useMongocampExportAll.js +4 -1
  72. package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
  73. package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
  74. package/dist/runtime/composables/useMongocampJobs.js +3 -2
  75. package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
  76. package/dist/runtime/composables/useMongocampQuery.js +45 -48
  77. package/dist/runtime/composables/useMongocampSchema.js +2 -0
  78. package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
  79. package/dist/runtime/composables/useMongocampUi.js +7 -0
  80. package/dist/runtime/locales/de.json +12 -4
  81. package/dist/runtime/locales/en.json +12 -4
  82. package/dist/runtime/plugin.js +8 -0
  83. package/dist/runtime/publicUtils.d.ts +1 -0
  84. package/dist/runtime/publicUtils.js +1 -0
  85. package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
  86. package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
  87. package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
  88. package/dist/runtime/utils/aggregationPipeline.js +2 -3
  89. package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
  90. package/dist/runtime/utils/caseInsensitive.js +8 -0
  91. package/dist/runtime/utils/collectionStats.d.ts +4 -1
  92. package/dist/runtime/utils/collectionStats.js +2 -2
  93. package/dist/runtime/utils/compactSession.d.ts +13 -0
  94. package/dist/runtime/utils/compactSession.js +12 -0
  95. package/dist/runtime/utils/configRows.d.ts +3 -3
  96. package/dist/runtime/utils/cursorPaging.d.ts +16 -0
  97. package/dist/runtime/utils/cursorPaging.js +17 -0
  98. package/dist/runtime/utils/documentCompare.js +2 -3
  99. package/dist/runtime/utils/documentPaths.d.ts +5 -5
  100. package/dist/runtime/utils/documentPaths.js +9 -2
  101. package/dist/runtime/utils/documentTree.js +3 -0
  102. package/dist/runtime/utils/fileFilter.d.ts +7 -0
  103. package/dist/runtime/utils/fileFilter.js +11 -0
  104. package/dist/runtime/utils/filterBuilder.d.ts +1 -1
  105. package/dist/runtime/utils/filterBuilder.js +5 -11
  106. package/dist/runtime/utils/filterSuggestions.js +1 -1
  107. package/dist/runtime/utils/indexForm.d.ts +7 -0
  108. package/dist/runtime/utils/indexForm.js +9 -0
  109. package/dist/runtime/utils/pagedFetch.d.ts +13 -0
  110. package/dist/runtime/utils/pagedFetch.js +44 -0
  111. package/dist/runtime/utils/queryState.d.ts +5 -0
  112. package/dist/runtime/utils/queryState.js +3 -2
  113. package/dist/runtime/utils/relaxedValues.d.ts +17 -0
  114. package/dist/runtime/utils/relaxedValues.js +51 -0
  115. package/dist/runtime/utils/requestLimits.d.ts +1 -1
  116. package/dist/runtime/utils/requestLimits.js +1 -1
  117. package/dist/runtime/utils/savedQueries.d.ts +2 -0
  118. package/dist/runtime/utils/savedQueries.js +1 -0
  119. package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
  120. package/dist/runtime/utils/schemaAnalysis.js +2 -2
  121. package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
  122. package/dist/runtime/utils/sensitiveFields.js +63 -0
  123. package/dist/runtime/utils/serverError.d.ts +7 -0
  124. package/dist/runtime/utils/serverError.js +11 -0
  125. package/dist/runtime/utils/serverStatus.d.ts +2 -2
  126. package/dist/runtime/utils/uiTheme.d.ts +65 -0
  127. package/dist/runtime/utils/uiTheme.js +47 -0
  128. package/package.json +22 -16
  129. package/dist/runtime/utils/luceneExpression.d.ts +0 -15
  130. package/dist/runtime/utils/luceneExpression.js +0 -74
@@ -28,6 +28,12 @@ import MongocampQueryBar from "./MongocampQueryBar.vue";
28
28
  import MongocampExportAll from "./MongocampExportAll.vue";
29
29
  import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
30
30
  import { isFilterTooLong } from "../utils/requestLimits";
31
+ import { idOf, isStringWrapper, isTextValue, leafWrapperText } from "../utils/relaxedValues";
32
+ import { caseInsensitiveFlag } from "../utils/caseInsensitive";
33
+ import { ignoringNotFound, isNotFound } from "../utils/serverError";
34
+ import { cursorFor, emptyCursorMemory, rememberNext, stableSort } from "../utils/cursorPaging";
35
+ import { sensitiveFieldsOf, withoutSensitiveFields } from "../utils/sensitiveFields";
36
+ import { useMongocampUi } from "../composables/useMongocampUi";
31
37
  const props = defineProps({
32
38
  collectionName: { type: String, required: true },
33
39
  infoPath: { type: String, required: false },
@@ -42,6 +48,7 @@ const props = defineProps({
42
48
  });
43
49
  const emit = defineEmits(["changed"]);
44
50
  const { t } = useI18n();
51
+ const ui = useMongocampUi();
45
52
  const paths = useMongocampPaths();
46
53
  const { documentApi } = useMongocampClientApi();
47
54
  const { pagination, total } = useMongocampCollection();
@@ -60,7 +67,8 @@ const { createIndexForField } = useMongocampIndex();
60
67
  const { isManager } = useMongocampRoles();
61
68
  const { canWrite, load: loadPermissions } = useMongocampPermissions();
62
69
  watch(() => props.collectionName, (name) => loadPermissions(name), { immediate: true });
63
- const writable = computed(() => canWrite(props.collectionName));
70
+ const hidesSensitiveFields = computed(() => sensitiveFieldsOf(props.collectionName).length > 0);
71
+ const writable = computed(() => canWrite(props.collectionName) && !hidesSensitiveFields.value);
64
72
  const toast = useToast();
65
73
  const fileInputRef = ref(null);
66
74
  function openFilePicker() {
@@ -124,7 +132,7 @@ async function loadTypedRow(row) {
124
132
  const id = getDocId(row);
125
133
  if (!id) return void 0;
126
134
  const res = await documentApi.getDocumentRaw({ collectionName: props.collectionName, documentId: id, extendedJson: "canonical" });
127
- return await readJsonKeepingLongs(res);
135
+ return withoutSensitiveFields(await readJsonKeepingLongs(res), props.collectionName);
128
136
  }
129
137
  async function openEdit(row) {
130
138
  const projected = activeProjection.value.length > 0;
@@ -204,14 +212,15 @@ async function handleSave() {
204
212
  await fetchDocuments();
205
213
  emit("changed");
206
214
  } catch (e) {
207
- editError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
215
+ editError.value = isNotFound(e) ? t("nuxtUiMongocamp.collectionData.documentGone") : e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
208
216
  }
209
217
  }
210
218
  async function handleDelete() {
211
219
  deleteError.value = "";
212
220
  if (!docToDelete.value) return;
213
221
  try {
214
- await documentApi._delete({ collectionName: props.collectionName, documentId: docToDelete.value });
222
+ const documentId = docToDelete.value;
223
+ await ignoringNotFound(() => documentApi._delete({ collectionName: props.collectionName, documentId }));
215
224
  isDeleteModalOpen.value = false;
216
225
  await fetchDocuments();
217
226
  emit("changed");
@@ -230,9 +239,7 @@ function makeActionsColumn() {
230
239
  if (fileId) {
231
240
  buttons.push(withTooltip(t("nuxtUiMongocamp.collectionData.downloadFileTooltip"), h(UButton, {
232
241
  "icon": "i-lucide-download",
233
- "color": "neutral",
234
- "variant": "ghost",
235
- "size": "sm",
242
+ ...ui.value.iconButton,
236
243
  "aria-label": t("nuxtUiMongocamp.collectionData.downloadFileTooltip"),
237
244
  "loading": downloadingFileIds.value.has(fileId),
238
245
  "onClick": () => downloadFile(props.collectionName, fileId)
@@ -241,40 +248,34 @@ function makeActionsColumn() {
241
248
  }
242
249
  buttons.push(withTooltip(t("nuxtUiMongocamp.collectionData.viewDocumentTooltip"), h(UButton, {
243
250
  "icon": "i-lucide-eye",
244
- "color": "neutral",
245
- "variant": "ghost",
246
- "size": "sm",
251
+ ...ui.value.iconButton,
247
252
  "aria-label": t("nuxtUiMongocamp.collectionData.viewDocumentTooltip"),
248
253
  "onClick": () => openView(row.original)
249
254
  })));
250
- if (!writable.value) return h("div", { class: "flex gap-1 justify-end" }, buttons);
255
+ if (!writable.value) return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, buttons);
251
256
  buttons.push(
252
257
  withTooltip(t("nuxtUiMongocamp.collectionData.editDocumentTooltip"), h(UButton, {
253
258
  "icon": "i-lucide-pencil",
254
- "color": "neutral",
255
- "variant": "ghost",
256
- "size": "sm",
259
+ ...ui.value.iconButton,
257
260
  "aria-label": t("nuxtUiMongocamp.collectionData.editDocumentTooltip"),
258
261
  "onClick": () => openEdit(row.original)
259
262
  })),
260
263
  withTooltip(t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"), h(UButton, {
261
264
  "icon": "i-lucide-trash-2",
265
+ ...ui.value.iconButton,
262
266
  "color": "error",
263
- "variant": "ghost",
264
- "size": "sm",
265
267
  "aria-label": t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"),
266
268
  "onClick": () => confirmDelete(row.original)
267
269
  }))
268
270
  );
269
- return h("div", { class: "flex gap-1 justify-end" }, buttons);
271
+ return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, buttons);
270
272
  }
271
273
  };
272
274
  }
273
275
  function sortHeader(column, label) {
274
276
  const isSorted = column.getIsSorted();
275
277
  return h(UButton, {
276
- color: "neutral",
277
- variant: "ghost",
278
+ ...ui.value.sortHeader,
278
279
  label,
279
280
  icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
280
281
  class: "-mx-2.5",
@@ -321,9 +322,7 @@ function columnHeader(column, key) {
321
322
  }, {
322
323
  default: () => h(UButton, {
323
324
  "icon": "i-lucide-list-tree",
324
- "color": "neutral",
325
- "variant": "ghost",
326
- "size": "xs",
325
+ ...ui.value.compactButton,
327
326
  "aria-label": label,
328
327
  "loading": indexing.value.has(key)
329
328
  })
@@ -351,7 +350,8 @@ const queryBar = ref(null);
351
350
  const fieldTypes = useMongocampFieldTypes(() => props.collectionName);
352
351
  const pageFilterFields = ref([]);
353
352
  const filterFields = computed(() => {
354
- const fromServer = fieldTypes.filterFields().filter((f) => operatorsFor(f.type).length > 0);
353
+ const hidden = sensitiveFieldsOf(props.collectionName);
354
+ const fromServer = fieldTypes.filterFields().filter((f) => operatorsFor(f.type).length > 0 && !hidden.includes(f.key));
355
355
  return fromServer.length > 0 ? fromServer : pageFilterFields.value;
356
356
  });
357
357
  const sorting = ref([]);
@@ -392,6 +392,9 @@ function openDetail(value) {
392
392
  detailContent.value = JSON.stringify(value, null, 2);
393
393
  detailOpen.value = true;
394
394
  }
395
+ function insensitiveFor(filter) {
396
+ return caseInsensitiveFlag(filter, query.value.matchCase);
397
+ }
395
398
  function buildLuceneFilter(term) {
396
399
  const trimmed = term.trim();
397
400
  const quick = trimmed && filterableColumns.value.length > 0 ? or(...filterableColumns.value.map((col) => like(col, trimmed))) : "";
@@ -465,6 +468,11 @@ function makeCell(key, type) {
465
468
  if (!Array.isArray(raw)) {
466
469
  const obj = raw;
467
470
  if ("$oid" in obj) return h("span", { class: "font-mono text-xs" }, String(obj.$oid));
471
+ const leafText = leafWrapperText(obj);
472
+ if (leafText !== void 0) {
473
+ const shown = truncateText(leafText);
474
+ return h("span", { class: isStringWrapper(obj) ? void 0 : "font-mono text-xs", title: shown !== leafText ? leafText : void 0 }, shown);
475
+ }
468
476
  const numberKey = Object.keys(obj).find((k) => k === "$numberLong" || k === "$numberDecimal" || k === "$numberInt" || k === "$numberDouble");
469
477
  if (numberKey && Object.keys(obj).length === 1) return h("span", { class: "font-mono text-xs" }, String(obj[numberKey]));
470
478
  if ("$date" in obj) return h("span", toDateDisplay(obj));
@@ -494,9 +502,7 @@ function makeCell(key, type) {
494
502
  const viewLabel = Array.isArray(raw) ? t("nuxtUiMongocamp.collectionData.viewArray") : t("nuxtUiMongocamp.collectionData.viewObject");
495
503
  return withTooltip(viewLabel, h(UButton, {
496
504
  "icon": Array.isArray(raw) ? "i-lucide-list" : "i-lucide-braces",
497
- "color": "neutral",
498
- "variant": "ghost",
499
- "size": "xs",
505
+ ...ui.value.compactButton,
500
506
  "aria-label": viewLabel,
501
507
  "onClick": () => openDetail(raw)
502
508
  }));
@@ -535,8 +541,9 @@ async function collectMatching() {
535
541
  const filter = buildLuceneFilter(filterText.value);
536
542
  counting.value = true;
537
543
  try {
538
- const count = await countDocuments(props.collectionName, filter);
539
- matching.value = { filter, count };
544
+ const insensitive = insensitiveFor(filter);
545
+ const count = await countDocuments(props.collectionName, filter, { filterCaseInsensitive: insensitive });
546
+ matching.value = { filter, count, insensitive };
540
547
  rowSelection.value = {};
541
548
  if (count !== total.value) bulkNote.value = t("nuxtUiMongocamp.bulk.matchingDrift", { counted: count, reported: total.value });
542
549
  } catch (e) {
@@ -577,8 +584,8 @@ async function handleBulkDelete() {
577
584
  bulkError.value = "";
578
585
  try {
579
586
  if (matching.value) {
580
- const { filter, count } = matching.value;
581
- const deleted = await deleteByFilter(props.collectionName, filter);
587
+ const { filter, count, insensitive } = matching.value;
588
+ const deleted = await deleteByFilter(props.collectionName, filter, { filterCaseInsensitive: insensitive });
582
589
  clearMatching();
583
590
  await fetchDocuments();
584
591
  emit("changed");
@@ -588,7 +595,8 @@ async function handleBulkDelete() {
588
595
  const ids = [...bulkIds.value];
589
596
  const { failed } = await runBulkDelete(
590
597
  ids,
591
- (documentId) => documentApi._delete({ collectionName: props.collectionName, documentId }),
598
+ // the one-by-one fallback also runs for ids a short chunk left behind — some may be gone already (404 = deleted)
599
+ (documentId) => ignoringNotFound(() => documentApi._delete({ collectionName: props.collectionName, documentId })),
592
600
  void 0,
593
601
  {
594
602
  // one request per chunk for ids a filter can address; the rest (and any chunk that does not
@@ -631,8 +639,8 @@ async function handleBulkEdit(edit) {
631
639
  const document = { [edit.field]: value };
632
640
  try {
633
641
  if (matching.value) {
634
- const { filter, count } = matching.value;
635
- const { modified } = await updateByFilter(props.collectionName, filter, document);
642
+ const { filter, count, insensitive } = matching.value;
643
+ const { modified } = await updateByFilter(props.collectionName, filter, document, { filterCaseInsensitive: insensitive });
636
644
  clearMatching();
637
645
  await fetchDocuments();
638
646
  emit("changed");
@@ -663,6 +671,7 @@ async function handleBulkEdit(edit) {
663
671
  }
664
672
  const projectableKeys = computed(() => dataColumnKeys.value.filter((k) => k !== "_id"));
665
673
  const activeProjection = computed(() => columns.value.length === 0 ? [] : usableProjection(query.value.projection, projectableKeys.value));
674
+ let cursorMemory = emptyCursorMemory();
666
675
  async function fetchDocuments() {
667
676
  loading.value = true;
668
677
  loadError.value = null;
@@ -670,20 +679,25 @@ async function fetchDocuments() {
670
679
  clearMatching();
671
680
  filterRejected.value = false;
672
681
  const filter = buildLuceneFilter(filterText.value);
682
+ const sort = stableSort(sorting.value.length ? sortingToMongoSort(sorting.value) : void 0);
683
+ const projection = activeProjection.value.length > 0 ? activeProjection.value : void 0;
684
+ const insensitive = insensitiveFor(filter);
685
+ const page = pagination.value.pageIndex;
686
+ const listKey = JSON.stringify([props.collectionName, filter, sort, projection, pagination.value.pageSize, insensitive]);
687
+ const after = cursorFor(cursorMemory, listKey, page);
673
688
  try {
674
689
  const res = await documentApi.searchDocumentsRaw({
675
690
  collectionName: props.collectionName,
691
+ extendedJson: "relaxed",
692
+ filterCaseInsensitive: insensitive,
676
693
  rowsPerPage: pagination.value.pageSize,
677
- page: pagination.value.pageIndex,
678
- searchRequest: {
679
- filter,
680
- sort: sorting.value.length ? sortingToMongoSort(sorting.value) : void 0,
681
- // only the fields asked for are loaded (the server always adds `_id`); never an empty list, which is a 500
682
- projection: activeProjection.value.length > 0 ? activeProjection.value : void 0
683
- }
694
+ // `after` and `page` together are a 400
695
+ ...after !== void 0 ? { after } : { page },
696
+ searchRequest: { filter, sort, projection }
684
697
  });
698
+ cursorMemory = rememberNext(cursorMemory, listKey, page, res.raw.headers.get("x-pagination-next") || void 0);
685
699
  total.value = +(res.raw.headers.get("x-pagination-count-rows") ?? 0);
686
- const rows = await readJsonKeepingLongs(res);
700
+ const rows = (await readJsonKeepingLongs(res)).map((row) => withoutSensitiveFields(row, props.collectionName));
687
701
  documents.value = rows;
688
702
  const firstRow = rows[0];
689
703
  if (columns.value.length === 0 && firstRow) {
@@ -698,7 +712,7 @@ async function fetchDocuments() {
698
712
  header: ({ column }) => columnHeader(column, key),
699
713
  cell: makeCell(key, "string")
700
714
  }));
701
- filterableColumns.value = orderedKeys.filter((k) => k !== "_id" && k !== "metaData" && typeof firstRow[k] === "string");
715
+ filterableColumns.value = orderedKeys.filter((k) => k !== "_id" && k !== "metaData" && isTextValue(firstRow[k]));
702
716
  pageFilterFields.value = schemaFromSamples(rows.map((row) => unwrapExtendedJson(row, { exactLongs: false }))).map((c) => ({ key: c.columnKey, type: c.columnKey === "_id" ? "objectId" : toFilterFieldType(c.columnType) })).filter((f) => operatorsFor(f.type).length > 0);
703
717
  if (!isBucketCollection(props.collectionName) && writable.value) {
704
718
  columns.value.unshift(createSelectColumn(UCheckbox, { selectAll: t("nuxtUiMongocamp.bulk.selectAll"), selectRow: t("nuxtUiMongocamp.bulk.selectRow") }));
@@ -778,7 +792,8 @@ const exportAllOpen = ref(false);
778
792
  const exportMenuItems = computed(() => [
779
793
  { label: t("nuxtUiMongocamp.collectionData.exportJson"), icon: "i-lucide-file-json", onSelect: () => exportPage("json") },
780
794
  { label: t("nuxtUiMongocamp.collectionData.exportCsv"), icon: "i-lucide-file-spreadsheet", onSelect: () => exportPage("csv") },
781
- { label: t("nuxtUiMongocamp.exportAll.menuItem"), icon: "i-lucide-download-cloud", onSelect: () => exportAllOpen.value = true }
795
+ // the server's export file would contain the hidden fields
796
+ ...hidesSensitiveFields.value ? [] : [{ label: t("nuxtUiMongocamp.exportAll.menuItem"), icon: "i-lucide-download-cloud", onSelect: () => exportAllOpen.value = true }]
782
797
  ]);
783
798
  const DISTINCT_SUGGESTION_LIMIT = 100;
784
799
  let distinctCache = /* @__PURE__ */ new Map();
@@ -835,18 +850,21 @@ defineExpose({ refresh: init });
835
850
  </script>
836
851
 
837
852
  <template>
838
- <div class="flex flex-col gap-4">
853
+ <div class="mongocamp-collection-data flex flex-col gap-4">
839
854
  <div class="flex flex-wrap items-center justify-between gap-4">
840
855
  <UInput
841
856
  v-model="filterText"
842
857
  icon="i-lucide-search"
843
858
  :placeholder="t('nuxtUiMongocamp.collectionData.filterPlaceholder')"
844
- size="sm"
859
+ :size="ui.controlSize"
845
860
  class="flex-1 max-w-xs"
846
861
  :disabled="filterableColumns.length === 0"
847
862
  @input="onFilterInput"
848
863
  />
849
- <div class="flex flex-wrap items-center gap-2">
864
+ <div
865
+ data-mongocamp-part="toolbar"
866
+ class="flex flex-wrap items-center gap-2"
867
+ >
850
868
  <span class="text-sm text-muted shrink-0">
851
869
  {{ t("nuxtUiMongocamp.collectionData.documentsCount", { count: total }) }}
852
870
  </span>
@@ -856,9 +874,7 @@ defineExpose({ refresh: init });
856
874
  >
857
875
  <UButton
858
876
  icon="i-lucide-upload"
859
- color="primary"
860
- variant="ghost"
861
- size="sm"
877
+ v-bind="{ ...ui.iconButton, color: 'primary' }"
862
878
  :loading="uploading"
863
879
  :aria-label="t('nuxtUiMongocamp.collectionData.uploadFileTooltip')"
864
880
  @click="openFilePicker"
@@ -870,9 +886,7 @@ defineExpose({ refresh: init });
870
886
  >
871
887
  <UButton
872
888
  icon="i-lucide-plus"
873
- color="primary"
874
- variant="ghost"
875
- size="sm"
889
+ v-bind="{ ...ui.iconButton, color: 'primary' }"
876
890
  :aria-label="t('nuxtUiMongocamp.collectionData.insertDocumentTooltip')"
877
891
  @click="openInsert"
878
892
  />
@@ -894,8 +908,7 @@ defineExpose({ refresh: init });
894
908
  >
895
909
  <UButton
896
910
  icon="i-lucide-refresh-cw"
897
- color="neutral"
898
- variant="ghost"
911
+ v-bind="ui.toolbarButton"
899
912
  :loading="loading"
900
913
  :aria-label="t('nuxtUiMongocamp.collectionData.reloadTooltip')"
901
914
  @click="init"
@@ -922,9 +935,7 @@ defineExpose({ refresh: init });
922
935
  <UDropdownMenu :items="columnMenuItems">
923
936
  <UButton
924
937
  icon="i-lucide-columns-3"
925
- color="neutral"
926
- variant="ghost"
927
- size="sm"
938
+ v-bind="ui.iconButton"
928
939
  :disabled="dataColumnKeys.length === 0"
929
940
  :aria-label="t('nuxtUiMongocamp.collectionData.columnsTooltip')"
930
941
  />
@@ -932,20 +943,16 @@ defineExpose({ refresh: init });
932
943
  <UButton
933
944
  v-if="aggregatePath && !isBucketCollection(collectionName)"
934
945
  icon="i-lucide-sigma"
935
- color="neutral"
936
- variant="ghost"
937
- size="sm"
946
+ v-bind="ui.iconButton"
938
947
  :disabled="chartFilterTooLong"
939
- :to="{ path: `${aggregatePath}/${collectionName}/aggregate`, query: chartFilter ? { filter: chartFilter } : {} }"
948
+ :to="{ path: `${aggregatePath}/${collectionName}/aggregate`, query: chartFilter ? { filter: chartFilter, ...query.matchCase ? { matchCase: 'true' } : {} } : {} }"
940
949
  :aria-label="t('nuxtUiMongocamp.collectionData.aggregateTooltip')"
941
950
  data-test="aggregate-link"
942
951
  />
943
952
  <UButton
944
953
  v-if="!isBucketCollection(collectionName)"
945
954
  icon="i-lucide-chart-column"
946
- color="neutral"
947
- variant="ghost"
948
- size="sm"
955
+ v-bind="ui.iconButton"
949
956
  :disabled="chartFields.length === 0 || documents.length === 0"
950
957
  :aria-label="t('nuxtUiMongocamp.collectionData.chartTooltip')"
951
958
  @click="openChart"
@@ -953,9 +960,7 @@ defineExpose({ refresh: init });
953
960
  <UDropdownMenu :items="exportMenuItems">
954
961
  <UButton
955
962
  icon="i-lucide-download"
956
- color="neutral"
957
- variant="ghost"
958
- size="sm"
963
+ v-bind="ui.iconButton"
959
964
  :disabled="documents.length === 0"
960
965
  :aria-label="t('nuxtUiMongocamp.collectionData.exportTooltip')"
961
966
  />
@@ -963,7 +968,7 @@ defineExpose({ refresh: init });
963
968
  <USelect
964
969
  v-model="pagination.pageSize"
965
970
  :items="pageSizeOptions"
966
- size="sm"
971
+ :size="ui.controlSize"
967
972
  class="w-20"
968
973
  :aria-label="t('nuxtUiMongocamp.collectionData.pageSizeLabel')"
969
974
  @update:model-value="onPageSizeChange"
@@ -986,6 +991,14 @@ defineExpose({ refresh: init });
986
991
  @apply="onQueryApply"
987
992
  />
988
993
 
994
+ <p
995
+ v-if="hidesSensitiveFields"
996
+ class="text-sm text-muted"
997
+ data-test="sensitive-fields-note"
998
+ >
999
+ {{ t("nuxtUiMongocamp.collectionData.sensitiveFieldsNote") }}
1000
+ </p>
1001
+
989
1002
  <MongocampErrorAlert
990
1003
  :error="loadError"
991
1004
  :filter-rejected="filterRejected"
@@ -1013,9 +1026,7 @@ defineExpose({ refresh: init });
1013
1026
  <UButton
1014
1027
  v-if="compareRows.length === 2"
1015
1028
  icon="i-lucide-git-compare"
1016
- color="neutral"
1017
- variant="subtle"
1018
- size="sm"
1029
+ v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
1019
1030
  :label="t('nuxtUiMongocamp.bulk.compareSelected')"
1020
1031
  data-testid="compare-selected"
1021
1032
  @click="openCompare"
@@ -1023,9 +1034,7 @@ defineExpose({ refresh: init });
1023
1034
  <UButton
1024
1035
  v-if="editableFields.length > 0"
1025
1036
  icon="i-lucide-pencil"
1026
- color="neutral"
1027
- variant="subtle"
1028
- size="sm"
1037
+ v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
1029
1038
  :label="t('nuxtUiMongocamp.bulk.editSelected')"
1030
1039
  @click="openBulkEdit"
1031
1040
  />
@@ -1050,6 +1059,7 @@ defineExpose({ refresh: init });
1050
1059
  v-else
1051
1060
  v-model:sorting="sorting"
1052
1061
  v-model:row-selection="rowSelection"
1062
+ data-mongocamp-part="table"
1053
1063
  :column-visibility="effectiveVisibility"
1054
1064
  :get-row-id="rowId"
1055
1065
  :sorting-options="{ manualSorting: true }"
@@ -1066,6 +1076,7 @@ defineExpose({ refresh: init });
1066
1076
  v-model:open="exportAllOpen"
1067
1077
  :collection="collectionName"
1068
1078
  :filter="buildLuceneFilter(filterText)"
1079
+ :match-case="query.matchCase"
1069
1080
  :sort="sortingToMongoSort(sorting)"
1070
1081
  :projection="activeProjection"
1071
1082
  :total="total"
@@ -1074,7 +1085,7 @@ defineExpose({ refresh: init });
1074
1085
  <UModal
1075
1086
  v-model:open="chartOpen"
1076
1087
  :title="t('nuxtUiMongocamp.collectionData.chartTitle')"
1077
- :ui="{ content: 'sm:max-w-3xl' }"
1088
+ :ui="{ content: ui.modal.lg }"
1078
1089
  >
1079
1090
  <template #body>
1080
1091
  <div
@@ -1095,7 +1106,7 @@ defineExpose({ refresh: init });
1095
1106
  <UAlert
1096
1107
  v-if="chartFilterTooLong"
1097
1108
  color="warning"
1098
- variant="subtle"
1109
+ :variant="ui.alert.variant"
1099
1110
  icon="i-lucide-triangle-alert"
1100
1111
  :description="t('nuxtUiMongocamp.collectionData.chartTooLong')"
1101
1112
  data-test="chart-too-long"
@@ -1105,6 +1116,7 @@ defineExpose({ refresh: init });
1105
1116
  :collection-name="collectionName"
1106
1117
  :field="chartField"
1107
1118
  :filter="chartFilter"
1119
+ :match-case="query.matchCase"
1108
1120
  />
1109
1121
  </div>
1110
1122
  </template>
@@ -1113,7 +1125,7 @@ defineExpose({ refresh: init });
1113
1125
  <UModal
1114
1126
  v-model:open="compareOpen"
1115
1127
  :title="t('nuxtUiMongocamp.documentCompare.title')"
1116
- :ui="{ content: 'sm:max-w-5xl' }"
1128
+ :ui="{ content: ui.modal.xl }"
1117
1129
  >
1118
1130
  <template #body>
1119
1131
  <p
@@ -1135,8 +1147,8 @@ defineExpose({ refresh: init });
1135
1147
  <MongocampDocumentCompare
1136
1148
  :left="typedPair?.[0] ?? compareRows[0]"
1137
1149
  :right="typedPair?.[1] ?? compareRows[1]"
1138
- :left-label="String(compareRows[0]._id ?? '')"
1139
- :right-label="String(compareRows[1]._id ?? '')"
1150
+ :left-label="idOf(compareRows[0]._id) ?? ''"
1151
+ :right-label="idOf(compareRows[1]._id) ?? ''"
1140
1152
  />
1141
1153
  </template>
1142
1154
  </template>
@@ -1145,7 +1157,7 @@ defineExpose({ refresh: init });
1145
1157
  <USlideover
1146
1158
  v-model:open="viewOpen"
1147
1159
  :title="t('nuxtUiMongocamp.collectionData.viewDocumentTitle')"
1148
- :ui="{ content: 'sm:max-w-xl' }"
1160
+ :ui="{ content: ui.modal.md }"
1149
1161
  >
1150
1162
  <template #body>
1151
1163
  <MongocampDocumentView :document="viewDoc" />
@@ -1164,7 +1176,7 @@ defineExpose({ refresh: init });
1164
1176
  <UModal
1165
1177
  v-model:open="isEditModalOpen"
1166
1178
  :title="editMode === 'insert' ? t('nuxtUiMongocamp.collectionData.insertDocumentTitle') : t('nuxtUiMongocamp.collectionData.editDocumentTitle')"
1167
- :ui="{ footer: 'justify-end' }"
1179
+ :ui="{ footer: ui.modal.footer }"
1168
1180
  >
1169
1181
  <template #body>
1170
1182
  <FUAutoForm
@@ -1194,8 +1206,7 @@ defineExpose({ refresh: init });
1194
1206
  >
1195
1207
  <UButton
1196
1208
  :label="t('nuxtUiMongocamp.common.cancel')"
1197
- color="neutral"
1198
- variant="ghost"
1209
+ v-bind="ui.dialogCancel"
1199
1210
  @click="isEditModalOpen = false"
1200
1211
  />
1201
1212
  <UButton
@@ -1209,7 +1220,7 @@ defineExpose({ refresh: init });
1209
1220
  <UModal
1210
1221
  v-model:open="isDeleteModalOpen"
1211
1222
  :title="t('nuxtUiMongocamp.collectionData.deleteDocumentTitle')"
1212
- :ui="{ footer: 'justify-end' }"
1223
+ :ui="{ footer: ui.modal.footer }"
1213
1224
  >
1214
1225
  <template #body>
1215
1226
  <p>{{ t("nuxtUiMongocamp.collectionData.confirmDeleteDocument") }}</p>
@@ -1223,13 +1234,12 @@ defineExpose({ refresh: init });
1223
1234
  <template #footer>
1224
1235
  <UButton
1225
1236
  :label="t('nuxtUiMongocamp.common.cancel')"
1226
- color="neutral"
1227
- variant="ghost"
1237
+ v-bind="ui.dialogCancel"
1228
1238
  @click="isDeleteModalOpen = false"
1229
1239
  />
1230
1240
  <UButton
1231
1241
  :label="t('nuxtUiMongocamp.common.delete')"
1232
- color="error"
1242
+ v-bind="ui.dangerAction"
1233
1243
  icon="i-lucide-trash-2"
1234
1244
  @click="handleDelete"
1235
1245
  />