@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
@@ -3,12 +3,14 @@ import { computed, ref, watch } from "vue";
3
3
  import { useI18n, useToast } from "#imports";
4
4
  import { allContainerPaths, buildDocumentTree, defaultExpanded, nodeDisplay, visibleNodes } from "../utils/documentTree";
5
5
  import { valueToJson } from "../utils/exportDocuments";
6
+ import { useMongocampUi } from "../composables/useMongocampUi";
6
7
  const props = defineProps({
7
8
  document: { type: null, required: true }
8
9
  });
9
10
  const emit = defineEmits(["copy"]);
10
11
  const mode = defineModel("mode", { type: String, ...{ default: "tree" } });
11
12
  const { t } = useI18n();
13
+ const ui = useMongocampUi();
12
14
  const toast = useToast();
13
15
  const tree = computed(() => buildDocumentTree(props.document ?? {}));
14
16
  const expanded = ref(/* @__PURE__ */ new Set());
@@ -30,7 +32,12 @@ const BADGE_COLORS = {
30
32
  objectId: "info",
31
33
  date: "info",
32
34
  array: "primary",
33
- object: "secondary"
35
+ object: "secondary",
36
+ binary: "neutral",
37
+ regex: "neutral",
38
+ timestamp: "info",
39
+ minKey: "neutral",
40
+ maxKey: "neutral"
34
41
  };
35
42
  function toggle(node) {
36
43
  const next = new Set(expanded.value);
@@ -59,7 +66,7 @@ const modeItems = computed(() => [
59
66
  </script>
60
67
 
61
68
  <template>
62
- <div class="flex flex-col gap-3">
69
+ <div class="mongocamp-document-view flex flex-col gap-3">
63
70
  <div class="flex flex-wrap items-center justify-between gap-2">
64
71
  <div
65
72
  class="inline-flex rounded-md border border-default p-0.5"
@@ -83,17 +90,13 @@ const modeItems = computed(() => [
83
90
  v-if="mode === 'tree' && hasContainers"
84
91
  :label="allOpen ? t('nuxtUiMongocamp.documentView.collapseAll') : t('nuxtUiMongocamp.documentView.expandAll')"
85
92
  :icon="allOpen ? 'i-lucide-chevrons-down-up' : 'i-lucide-chevrons-up-down'"
86
- size="xs"
87
- color="neutral"
88
- variant="ghost"
93
+ v-bind="ui.compactButton"
89
94
  @click="toggleAll"
90
95
  />
91
96
  <UButton
92
97
  :label="t('nuxtUiMongocamp.documentView.copyDocument')"
93
98
  icon="i-lucide-copy"
94
- size="xs"
95
- color="neutral"
96
- variant="ghost"
99
+ v-bind="ui.compactButton"
97
100
  :disabled="!document"
98
101
  @click="copy('document', jsonText)"
99
102
  />
@@ -154,7 +157,7 @@ const modeItems = computed(() => [
154
157
  <UBadge
155
158
  :label="node.type"
156
159
  :color="BADGE_COLORS[node.type]"
157
- variant="subtle"
160
+ :variant="ui.badge.variant"
158
161
  size="sm"
159
162
  class="shrink-0"
160
163
  :title="t('nuxtUiMongocamp.documentView.typeLabel', { type: node.type })"
@@ -9,7 +9,10 @@ const { t } = useI18n();
9
9
  </script>
10
10
 
11
11
  <template>
12
- <div class="flex flex-col items-center gap-2 py-8 text-center">
12
+ <div
13
+ data-mongocamp-part="empty"
14
+ class="mongocamp-empty-state flex flex-col items-center gap-2 py-8 text-center"
15
+ >
13
16
  <UIcon
14
17
  :name="icon ?? 'i-lucide-inbox'"
15
18
  class="size-8 text-dimmed"
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, ref, watch } from "vue";
3
3
  import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
4
+ import { useMongocampUi } from "../composables/useMongocampUi";
4
5
  const props = defineProps({
5
6
  error: { type: null, required: true },
6
7
  title: { type: String, required: false },
@@ -9,6 +10,7 @@ const props = defineProps({
9
10
  });
10
11
  const emit = defineEmits(["retry", "clearFilters"]);
11
12
  const { t } = useI18n();
13
+ const ui = useMongocampUi();
12
14
  const { describeError, describeServerError } = useMongocampError();
13
15
  const { invalidateSession } = useMongocampSession();
14
16
  const { loginPath: configuredLoginPath } = useMongocampRoles();
@@ -36,8 +38,10 @@ async function loginAgain() {
36
38
  <template>
37
39
  <UAlert
38
40
  v-if="error"
41
+ class="mongocamp-error-alert"
42
+ data-mongocamp-part="error"
39
43
  color="error"
40
- variant="subtle"
44
+ :variant="ui.alert.variant"
41
45
  icon="i-lucide-circle-alert"
42
46
  :title="filterRejected ? t('nuxtUiMongocamp.errors.filterRejectedTitle') : title ?? t('nuxtUiMongocamp.errors.loadFailedTitle')"
43
47
  :description="description"
@@ -46,24 +50,21 @@ async function loginAgain() {
46
50
  <UButton
47
51
  v-if="filterRejected"
48
52
  :label="t('nuxtUiMongocamp.errors.clearFilters')"
49
- color="error"
50
- variant="subtle"
53
+ v-bind="{ ...ui.alertAction, color: 'error' }"
51
54
  icon="i-lucide-filter-x"
52
55
  @click="emit('clearFilters')"
53
56
  />
54
57
  <UButton
55
58
  v-else-if="sessionGone"
56
59
  :label="t('nuxtUiMongocamp.errors.loginAgain')"
57
- color="error"
58
- variant="subtle"
60
+ v-bind="{ ...ui.alertAction, color: 'error' }"
59
61
  icon="i-lucide-log-in"
60
62
  @click="loginAgain"
61
63
  />
62
64
  <UButton
63
65
  v-else
64
66
  :label="t('nuxtUiMongocamp.common.retry')"
65
- color="error"
66
- variant="subtle"
67
+ v-bind="{ ...ui.alertAction, color: 'error' }"
67
68
  icon="i-lucide-refresh-cw"
68
69
  @click="emit('retry')"
69
70
  />
@@ -1,6 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  collection: string;
3
3
  filter?: string;
4
+ matchCase?: boolean;
4
5
  sort?: string[];
5
6
  projection?: string[];
6
7
  total?: number;
@@ -3,19 +3,24 @@ import { computed, ref, watch } from "vue";
3
3
  import { useI18n, useMongocampError } from "#imports";
4
4
  import { useMongocampExportAll } from "../composables/useMongocampExportAll";
5
5
  import { formatBytes } from "../utils/formatBytes";
6
+ import { useMongocampUi } from "../composables/useMongocampUi";
7
+ import { caseInsensitiveFlag } from "../utils/caseInsensitive";
6
8
  const props = defineProps({
7
9
  collection: { type: String, required: true },
8
10
  filter: { type: String, required: false },
11
+ matchCase: { type: Boolean, required: false },
9
12
  sort: { type: Array, required: false },
10
13
  projection: { type: Array, required: false },
11
14
  total: { type: Number, required: false }
12
15
  });
13
16
  const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
14
17
  const { t } = useI18n();
18
+ const ui = useMongocampUi();
15
19
  const { describeServerError } = useMongocampError();
16
20
  const { exportCollection } = useMongocampExportAll();
17
21
  const step = ref("form");
18
22
  const format = ref("json");
23
+ const exactTypes = ref(false);
19
24
  const progress = ref({ bytes: 0, lines: 0 });
20
25
  const result = ref(null);
21
26
  const cancelled = ref(false);
@@ -49,7 +54,9 @@ async function start() {
49
54
  result.value = await exportCollection({
50
55
  collection: props.collection,
51
56
  format: format.value,
57
+ extendedJson: exactTypes.value ? "canonical" : "relaxed",
52
58
  filter: props.filter,
59
+ filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase),
53
60
  sort: props.sort?.length ? props.sort : void 0,
54
61
  projection: props.projection?.length ? props.projection : void 0,
55
62
  expected: props.total,
@@ -77,7 +84,7 @@ function cancel() {
77
84
  <UModal
78
85
  v-model:open="isOpen"
79
86
  :title="t('nuxtUiMongocamp.exportAll.title')"
80
- :ui="{ footer: 'justify-end' }"
87
+ :ui="{ content: 'mongocamp-export-all', footer: ui.modal.footer }"
81
88
  >
82
89
  <template #body>
83
90
  <div
@@ -104,6 +111,13 @@ function cancel() {
104
111
  :aria-label="t('nuxtUiMongocamp.exportAll.formatLabel')"
105
112
  />
106
113
  </UFormField>
114
+ <UCheckbox
115
+ v-if="format !== 'csv'"
116
+ v-model="exactTypes"
117
+ data-testid="export-exact-types"
118
+ :label="t('nuxtUiMongocamp.exportAll.exactTypes')"
119
+ :description="t('nuxtUiMongocamp.exportAll.exactTypesHint')"
120
+ />
107
121
  <p class="text-xs text-dimmed">
108
122
  {{ t("nuxtUiMongocamp.exportAll.streamNote") }}
109
123
  </p>
@@ -141,7 +155,7 @@ function cancel() {
141
155
  <UAlert
142
156
  v-if="result.incomplete"
143
157
  color="warning"
144
- variant="subtle"
158
+ :variant="ui.alert.variant"
145
159
  icon="i-lucide-circle-alert"
146
160
  :title="t('nuxtUiMongocamp.exportAll.incomplete', { file: result.filename })"
147
161
  data-test="export-incomplete"
@@ -149,7 +163,7 @@ function cancel() {
149
163
  <UAlert
150
164
  v-else
151
165
  color="success"
152
- variant="subtle"
166
+ :variant="ui.alert.variant"
153
167
  icon="i-lucide-circle-check"
154
168
  :title="result.documents === void 0 ? t('nuxtUiMongocamp.exportAll.doneSize', { size: formatBytes(result.bytes), file: result.filename }) : t('nuxtUiMongocamp.exportAll.done', { count: result.documents, file: result.filename }, result.documents)"
155
169
  />
@@ -168,16 +182,14 @@ function cancel() {
168
182
  <template v-else-if="step === 'done'">
169
183
  <UButton
170
184
  :label="t('nuxtUiMongocamp.exportAll.close')"
171
- color="neutral"
172
- variant="ghost"
185
+ v-bind="ui.dialogCancel"
173
186
  @click="isOpen = false"
174
187
  />
175
188
  </template>
176
189
  <template v-else>
177
190
  <UButton
178
191
  :label="t('nuxtUiMongocamp.common.cancel')"
179
- color="neutral"
180
- variant="ghost"
192
+ v-bind="ui.dialogCancel"
181
193
  @click="isOpen = false"
182
194
  />
183
195
  <UButton
@@ -1,6 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  collection: string;
3
3
  filter?: string;
4
+ matchCase?: boolean;
4
5
  sort?: string[];
5
6
  projection?: string[];
6
7
  total?: number;
@@ -5,12 +5,14 @@ import { useMongocampBucket } from "../composables/useMongocampBucket";
5
5
  import { useMongocampError } from "../composables/useMongocampError";
6
6
  import { canPreview, clipText, PREVIEW_LIMITS, prettyJson, previewKind } from "../utils/filePreview";
7
7
  import { formatBytes } from "../utils/formatBytes";
8
+ import { useMongocampUi } from "../composables/useMongocampUi";
8
9
  const props = defineProps({
9
10
  bucketName: { type: String, required: true },
10
11
  file: { type: Object, required: false }
11
12
  });
12
13
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
13
14
  const { t } = useI18n();
15
+ const ui = useMongocampUi();
14
16
  const { fetchFileBlob, downloadFile, downloadingFileIds } = useMongocampBucket();
15
17
  const { describeError } = useMongocampError();
16
18
  const loading = ref(false);
@@ -70,7 +72,7 @@ onBeforeUnmount(() => {
70
72
  v-model:open="open"
71
73
  :title="file?.filename ?? t('nuxtUiMongocamp.filePreview.title')"
72
74
  :description="file ? formatBytes(file.length) : void 0"
73
- :ui="{ content: 'max-w-3xl' }"
75
+ :ui="{ content: 'max-w-3xl mongocamp-file-preview' }"
74
76
  >
75
77
  <template #body>
76
78
  <div
@@ -92,7 +94,7 @@ onBeforeUnmount(() => {
92
94
  <UAlert
93
95
  v-else-if="error"
94
96
  color="error"
95
- variant="subtle"
97
+ :variant="ui.alert.variant"
96
98
  icon="i-lucide-circle-alert"
97
99
  :title="t('nuxtUiMongocamp.filePreview.failed')"
98
100
  :description="error"
@@ -101,7 +103,7 @@ onBeforeUnmount(() => {
101
103
  <UAlert
102
104
  v-else-if="kind === 'other'"
103
105
  color="neutral"
104
- variant="subtle"
106
+ :variant="ui.alert.variant"
105
107
  icon="i-lucide-file"
106
108
  :title="t('nuxtUiMongocamp.filePreview.noPreview')"
107
109
  />
@@ -109,7 +111,7 @@ onBeforeUnmount(() => {
109
111
  <UAlert
110
112
  v-else-if="tooLarge"
111
113
  color="neutral"
112
- variant="subtle"
114
+ :variant="ui.alert.variant"
113
115
  icon="i-lucide-file-warning"
114
116
  :title="t('nuxtUiMongocamp.filePreview.tooLarge', { max: limitLabel })"
115
117
  />
@@ -142,8 +144,7 @@ onBeforeUnmount(() => {
142
144
  <div class="flex justify-end">
143
145
  <UButton
144
146
  icon="i-lucide-download"
145
- color="neutral"
146
- variant="subtle"
147
+ v-bind="ui.secondaryAction"
147
148
  :label="t('nuxtUiMongocamp.filePreview.download')"
148
149
  :loading="downloadingFileIds.has(file.id)"
149
150
  @click="downloadFile(bucketName, file.id)"
@@ -9,6 +9,7 @@ import {
9
9
  valueCountFor
10
10
  } from "../utils/filterBuilder";
11
11
  import { suggestionOptions, wantsSuggestions } from "../utils/filterSuggestions";
12
+ import { useMongocampUi } from "../composables/useMongocampUi";
12
13
  const props = defineProps({
13
14
  fields: { type: Array, required: true },
14
15
  loadDistinct: { type: Function, required: false }
@@ -16,6 +17,7 @@ const props = defineProps({
16
17
  const model = defineModel({ type: Object, ...{ required: true } });
17
18
  const emit = defineEmits(["apply"]);
18
19
  const { t } = useI18n();
20
+ const ui = useMongocampUi();
19
21
  let idCounter = 0;
20
22
  function newId() {
21
23
  return `filter-${Date.now()}-${idCounter++}`;
@@ -92,7 +94,7 @@ function clearAll() {
92
94
  </script>
93
95
 
94
96
  <template>
95
- <div class="flex flex-col gap-3 rounded-md border border-default p-3">
97
+ <div class="mongocamp-filter-builder flex flex-col gap-3 rounded-md border border-default p-3">
96
98
  <p
97
99
  v-if="fields.length === 0"
98
100
  class="text-sm text-dimmed"
@@ -109,7 +111,7 @@ function clearAll() {
109
111
  <USelect
110
112
  :model-value="model.match"
111
113
  :items="matchItems"
112
- size="sm"
114
+ :size="ui.controlSize"
113
115
  class="w-44"
114
116
  :aria-label="t('nuxtUiMongocamp.filterBuilder.matchLabel')"
115
117
  @update:model-value="(value) => setMatch(value)"
@@ -139,7 +141,7 @@ function clearAll() {
139
141
  <USelect
140
142
  :model-value="condition.field"
141
143
  :items="fieldItems"
142
- size="sm"
144
+ :size="ui.controlSize"
143
145
  class="w-44"
144
146
  :aria-label="t('nuxtUiMongocamp.filterBuilder.field')"
145
147
  @update:model-value="(value) => changeField(index, value)"
@@ -147,7 +149,7 @@ function clearAll() {
147
149
  <USelect
148
150
  :model-value="condition.operator"
149
151
  :items="operatorItems(typeOf(condition.field))"
150
- size="sm"
152
+ :size="ui.controlSize"
151
153
  class="w-44"
152
154
  :aria-label="t('nuxtUiMongocamp.filterBuilder.operator')"
153
155
  @update:model-value="(value) => updateCondition(index, { operator: value })"
@@ -159,7 +161,7 @@ function clearAll() {
159
161
  :inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
160
162
  :placeholder="condition.operator === 'oneOf' ? t('nuxtUiMongocamp.filterBuilder.listPlaceholder') : void 0"
161
163
  :list="listId(condition)"
162
- size="sm"
164
+ :size="ui.controlSize"
163
165
  class="w-48"
164
166
  :aria-label="t('nuxtUiMongocamp.filterBuilder.value')"
165
167
  @focus="ensureSuggestions(condition)"
@@ -182,7 +184,7 @@ function clearAll() {
182
184
  :model-value="condition.value2 ?? ''"
183
185
  :type="typeOf(condition.field) === 'date-time' ? 'date' : 'text'"
184
186
  :inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
185
- size="sm"
187
+ :size="ui.controlSize"
186
188
  class="w-48"
187
189
  :aria-label="t('nuxtUiMongocamp.filterBuilder.valueTo')"
188
190
  @update:model-value="(value) => updateCondition(index, { value2: String(value ?? '') })"
@@ -191,9 +193,7 @@ function clearAll() {
191
193
  </template>
192
194
  <UButton
193
195
  icon="i-lucide-x"
194
- color="neutral"
195
- variant="ghost"
196
- size="sm"
196
+ v-bind="ui.iconButton"
197
197
  :aria-label="t('nuxtUiMongocamp.filterBuilder.remove')"
198
198
  @click="removeCondition(index)"
199
199
  />
@@ -217,22 +217,18 @@ function clearAll() {
217
217
  <div class="flex flex-wrap items-center justify-between gap-2">
218
218
  <UButton
219
219
  icon="i-lucide-plus"
220
- color="neutral"
221
- variant="ghost"
222
- size="sm"
220
+ v-bind="ui.iconButton"
223
221
  :label="t('nuxtUiMongocamp.filterBuilder.addCondition')"
224
222
  @click="addCondition"
225
223
  />
226
224
  <div class="flex items-center gap-2">
227
225
  <UButton
228
- color="neutral"
229
- variant="ghost"
230
- size="sm"
226
+ v-bind="ui.iconButton"
231
227
  :label="t('nuxtUiMongocamp.filterBuilder.clearAll')"
232
228
  @click="clearAll"
233
229
  />
234
230
  <UButton
235
- size="sm"
231
+ :size="ui.controlSize"
236
232
  :label="t('nuxtUiMongocamp.filterBuilder.apply')"
237
233
  @click="apply"
238
234
  />
@@ -1,16 +1,18 @@
1
1
  <script setup>
2
2
  import { computed, h, resolveComponent } from "vue";
3
3
  import { useI18n } from "#imports";
4
+ import { useMongocampUi } from "../composables/useMongocampUi";
4
5
  defineProps({
5
6
  grants: { type: Array, required: true }
6
7
  });
7
8
  const { t } = useI18n();
9
+ const ui = useMongocampUi();
8
10
  const UBadge = resolveComponent("UBadge");
9
11
  function flag(value) {
10
12
  return h(UBadge, {
11
13
  label: value ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
12
14
  color: value ? "success" : "neutral",
13
- variant: "subtle"
15
+ variant: ui.value.badge.variant
14
16
  });
15
17
  }
16
18
  const columns = computed(() => [
@@ -18,7 +20,7 @@ const columns = computed(() => [
18
20
  {
19
21
  accessorKey: "grantType",
20
22
  header: t("nuxtUiMongocamp.roleGrants.columnType"),
21
- cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: "subtle" })
23
+ cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: ui.value.badge.variant })
22
24
  },
23
25
  { accessorKey: "read", header: t("nuxtUiMongocamp.roleGrants.columnRead"), cell: ({ row }) => flag(row.original.read) },
24
26
  { accessorKey: "write", header: t("nuxtUiMongocamp.roleGrants.columnWrite"), cell: ({ row }) => flag(row.original.write) },
@@ -28,6 +30,8 @@ const columns = computed(() => [
28
30
 
29
31
  <template>
30
32
  <UTable
33
+ data-mongocamp-part="table"
34
+ class="mongocamp-grant-list"
31
35
  :data="grants"
32
36
  :columns="columns"
33
37
  >