@sfxcode/nuxt-ui-mongocamp 1.3.5 → 1.5.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 (224) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +8 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +6 -0
  5. package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
  6. package/dist/runtime/components/MongocampAggregationBuilder.vue +331 -5
  7. package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
  8. package/dist/runtime/components/MongocampAggregationChart.d.vue.ts +6 -0
  9. package/dist/runtime/components/MongocampAggregationChart.vue +93 -0
  10. package/dist/runtime/components/MongocampAggregationChart.vue.d.ts +6 -0
  11. package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +10 -0
  12. package/dist/runtime/components/MongocampAggregationStagePreview.vue +149 -0
  13. package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +10 -0
  14. package/dist/runtime/components/MongocampBucketFiles.vue +230 -48
  15. package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +9 -0
  16. package/dist/runtime/components/MongocampBulkDelete.vue +94 -25
  17. package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +9 -0
  18. package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +5 -0
  19. package/dist/runtime/components/MongocampBulkEdit.vue +41 -3
  20. package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +5 -0
  21. package/dist/runtime/components/MongocampChart.d.vue.ts +29 -0
  22. package/dist/runtime/components/MongocampChart.vue +129 -0
  23. package/dist/runtime/components/MongocampChart.vue.d.ts +29 -0
  24. package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +17 -0
  25. package/dist/runtime/components/MongocampCollectionCharts.vue +200 -0
  26. package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +17 -0
  27. package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +23 -0
  28. package/dist/runtime/components/MongocampCollectionCopy.vue +206 -0
  29. package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +23 -0
  30. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +6 -0
  31. package/dist/runtime/components/MongocampCollectionData.vue +423 -138
  32. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +6 -0
  33. package/dist/runtime/components/MongocampCollectionInfos.vue +106 -238
  34. package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +22 -0
  35. package/dist/runtime/components/MongocampCollectionRename.vue +116 -0
  36. package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +22 -0
  37. package/dist/runtime/components/MongocampCollections.vue +93 -12
  38. package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +40 -0
  39. package/dist/runtime/components/MongocampCommandPalette.vue +135 -0
  40. package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +40 -0
  41. package/dist/runtime/components/MongocampConfirmByName.vue +2 -2
  42. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -1
  43. package/dist/runtime/components/MongocampDashboard.vue +39 -5
  44. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -1
  45. package/dist/runtime/components/MongocampDatabases.vue +35 -2
  46. package/dist/runtime/components/MongocampDocumentCompare.d.vue.ts +20 -0
  47. package/dist/runtime/components/MongocampDocumentCompare.vue +146 -0
  48. package/dist/runtime/components/MongocampDocumentCompare.vue.d.ts +20 -0
  49. package/dist/runtime/components/MongocampDocumentView.d.vue.ts +22 -0
  50. package/dist/runtime/components/MongocampDocumentView.vue +202 -0
  51. package/dist/runtime/components/MongocampDocumentView.vue.d.ts +22 -0
  52. package/dist/runtime/components/MongocampErrorAlert.vue +12 -4
  53. package/dist/runtime/components/MongocampExportAll.d.vue.ts +18 -0
  54. package/dist/runtime/components/MongocampExportAll.vue +191 -0
  55. package/dist/runtime/components/MongocampExportAll.vue.d.ts +18 -0
  56. package/dist/runtime/components/MongocampFilePreview.d.vue.ts +16 -0
  57. package/dist/runtime/components/MongocampFilePreview.vue +162 -0
  58. package/dist/runtime/components/MongocampFilePreview.vue.d.ts +16 -0
  59. package/dist/runtime/components/MongocampFilterBuilder.vue +11 -0
  60. package/dist/runtime/components/MongocampImport.vue +171 -13
  61. package/dist/runtime/components/MongocampIndexes.d.vue.ts +18 -0
  62. package/dist/runtime/components/MongocampIndexes.vue +496 -0
  63. package/dist/runtime/components/MongocampIndexes.vue.d.ts +18 -0
  64. package/dist/runtime/components/MongocampJobs.d.vue.ts +6 -1
  65. package/dist/runtime/components/MongocampJobs.vue +36 -5
  66. package/dist/runtime/components/MongocampJobs.vue.d.ts +6 -1
  67. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +12 -0
  68. package/dist/runtime/components/MongocampPermissionMatrix.vue +301 -0
  69. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +12 -0
  70. package/dist/runtime/components/MongocampQueryBar.d.vue.ts +26 -0
  71. package/dist/runtime/components/MongocampQueryBar.vue +398 -0
  72. package/dist/runtime/components/MongocampQueryBar.vue.d.ts +26 -0
  73. package/dist/runtime/components/MongocampRoleGrants.vue +18 -5
  74. package/dist/runtime/components/MongocampRoles.vue +16 -5
  75. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +20 -0
  76. package/dist/runtime/components/MongocampServerOverview.vue +420 -0
  77. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +20 -0
  78. package/dist/runtime/components/MongocampSettings.d.vue.ts +28 -1
  79. package/dist/runtime/components/MongocampSettings.vue +83 -10
  80. package/dist/runtime/components/MongocampSettings.vue.d.ts +28 -1
  81. package/dist/runtime/components/MongocampUsers.vue +19 -6
  82. package/dist/runtime/composables/useMongocampAdmin.d.ts +2 -1
  83. package/dist/runtime/composables/useMongocampAdmin.js +6 -1
  84. package/dist/runtime/composables/useMongocampAdminGate.d.ts +12 -0
  85. package/dist/runtime/composables/useMongocampAdminGate.js +12 -0
  86. package/dist/runtime/composables/useMongocampAggregation.d.ts +23 -1
  87. package/dist/runtime/composables/useMongocampAggregation.js +41 -26
  88. package/dist/runtime/composables/useMongocampAutoRefresh.d.ts +26 -0
  89. package/dist/runtime/composables/useMongocampAutoRefresh.js +78 -0
  90. package/dist/runtime/composables/useMongocampBucket.d.ts +13 -1
  91. package/dist/runtime/composables/useMongocampBucket.js +34 -0
  92. package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +15 -0
  93. package/dist/runtime/composables/useMongocampBulkByFilter.js +32 -0
  94. package/dist/runtime/composables/useMongocampClientApi.js +2 -1
  95. package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +45 -0
  96. package/dist/runtime/composables/useMongocampCollectionCopy.js +48 -0
  97. package/dist/runtime/composables/useMongocampCollectionStats.d.ts +10 -0
  98. package/dist/runtime/composables/useMongocampCollectionStats.js +17 -0
  99. package/dist/runtime/composables/useMongocampError.d.ts +2 -1
  100. package/dist/runtime/composables/useMongocampError.js +16 -1
  101. package/dist/runtime/composables/useMongocampExportAll.d.ts +53 -0
  102. package/dist/runtime/composables/useMongocampExportAll.js +57 -0
  103. package/dist/runtime/composables/useMongocampExtendedJson.d.ts +7 -2
  104. package/dist/runtime/composables/useMongocampExtendedJson.js +44 -11
  105. package/dist/runtime/composables/useMongocampFetchAll.d.ts +25 -0
  106. package/dist/runtime/composables/useMongocampFetchAll.js +27 -0
  107. package/dist/runtime/composables/useMongocampFieldTypes.d.ts +24 -0
  108. package/dist/runtime/composables/useMongocampFieldTypes.js +44 -0
  109. package/dist/runtime/composables/useMongocampImport.d.ts +4 -0
  110. package/dist/runtime/composables/useMongocampImport.js +5 -2
  111. package/dist/runtime/composables/useMongocampIndex.d.ts +6 -1
  112. package/dist/runtime/composables/useMongocampIndex.js +7 -1
  113. package/dist/runtime/composables/useMongocampPermissions.d.ts +17 -0
  114. package/dist/runtime/composables/useMongocampPermissions.js +43 -0
  115. package/dist/runtime/composables/useMongocampPersistedState.d.ts +15 -0
  116. package/dist/runtime/composables/useMongocampPersistedState.js +21 -0
  117. package/dist/runtime/composables/useMongocampProxyApi.js +2 -1
  118. package/dist/runtime/composables/useMongocampQuery.d.ts +50 -2
  119. package/dist/runtime/composables/useMongocampQuery.js +72 -1
  120. package/dist/runtime/composables/useMongocampSavedPipelines.d.ts +25 -0
  121. package/dist/runtime/composables/useMongocampSavedPipelines.js +23 -0
  122. package/dist/runtime/composables/useMongocampSavedQueries.d.ts +37 -0
  123. package/dist/runtime/composables/useMongocampSavedQueries.js +50 -0
  124. package/dist/runtime/composables/useMongocampServerOverview.d.ts +35 -0
  125. package/dist/runtime/composables/useMongocampServerOverview.js +51 -0
  126. package/dist/runtime/composables/useMongocampSession.d.ts +2 -0
  127. package/dist/runtime/composables/useMongocampSession.js +16 -2
  128. package/dist/runtime/composables/useMongocampSystem.d.ts +7 -2
  129. package/dist/runtime/composables/useMongocampSystem.js +6 -2
  130. package/dist/runtime/locales/de.json +509 -25
  131. package/dist/runtime/locales/en.json +509 -25
  132. package/dist/runtime/plugin.js +6 -3
  133. package/dist/runtime/utils/aggregationErrors.d.ts +4 -0
  134. package/dist/runtime/utils/aggregationErrors.js +7 -0
  135. package/dist/runtime/utils/aggregationPipeline.d.ts +5 -4
  136. package/dist/runtime/utils/aggregationPipeline.js +23 -9
  137. package/dist/runtime/utils/aggregationPreview.d.ts +13 -0
  138. package/dist/runtime/utils/aggregationPreview.js +10 -0
  139. package/dist/runtime/utils/aggregationResult.d.ts +5 -0
  140. package/dist/runtime/utils/aggregationResult.js +4 -0
  141. package/dist/runtime/utils/aggregationTemplates.d.ts +34 -0
  142. package/dist/runtime/utils/aggregationTemplates.js +47 -0
  143. package/dist/runtime/utils/analyzeSamples.d.ts +1 -0
  144. package/dist/runtime/utils/analyzeSamples.js +1 -1
  145. package/dist/runtime/utils/autoRefresh.d.ts +14 -0
  146. package/dist/runtime/utils/autoRefresh.js +15 -0
  147. package/dist/runtime/utils/batchInsert.d.ts +6 -0
  148. package/dist/runtime/utils/batchInsert.js +31 -3
  149. package/dist/runtime/utils/bigIntJson.d.ts +15 -0
  150. package/dist/runtime/utils/bigIntJson.js +55 -0
  151. package/dist/runtime/utils/bsonTypes.d.ts +10 -0
  152. package/dist/runtime/utils/bsonTypes.js +42 -0
  153. package/dist/runtime/utils/bulkDelete.d.ts +9 -1
  154. package/dist/runtime/utils/bulkDelete.js +15 -3
  155. package/dist/runtime/utils/bulkEdit.d.ts +6 -0
  156. package/dist/runtime/utils/bulkEdit.js +7 -0
  157. package/dist/runtime/utils/chartData.d.ts +11 -0
  158. package/dist/runtime/utils/chartData.js +9 -0
  159. package/dist/runtime/utils/collectionChart.d.ts +36 -0
  160. package/dist/runtime/utils/collectionChart.js +73 -0
  161. package/dist/runtime/utils/collectionCopy.d.ts +24 -0
  162. package/dist/runtime/utils/collectionCopy.js +37 -0
  163. package/dist/runtime/utils/collectionStats.d.ts +31 -0
  164. package/dist/runtime/utils/collectionStats.js +42 -0
  165. package/dist/runtime/utils/commandPalette.d.ts +48 -0
  166. package/dist/runtime/utils/commandPalette.js +39 -0
  167. package/dist/runtime/utils/configRows.d.ts +7 -0
  168. package/dist/runtime/utils/configRows.js +4 -0
  169. package/dist/runtime/utils/documentCompare.d.ts +31 -0
  170. package/dist/runtime/utils/documentCompare.js +71 -0
  171. package/dist/runtime/utils/documentDiff.d.ts +19 -0
  172. package/dist/runtime/utils/documentDiff.js +71 -0
  173. package/dist/runtime/utils/documentPaths.d.ts +41 -0
  174. package/dist/runtime/utils/documentPaths.js +139 -0
  175. package/dist/runtime/utils/documentTree.d.ts +40 -0
  176. package/dist/runtime/utils/documentTree.js +102 -0
  177. package/dist/runtime/utils/exportDocuments.d.ts +33 -0
  178. package/dist/runtime/utils/exportDocuments.js +53 -0
  179. package/dist/runtime/utils/exportRows.d.ts +2 -0
  180. package/dist/runtime/utils/exportRows.js +6 -3
  181. package/dist/runtime/utils/fieldDetails.d.ts +51 -0
  182. package/dist/runtime/utils/fieldDetails.js +113 -0
  183. package/dist/runtime/utils/filePreview.d.ts +27 -0
  184. package/dist/runtime/utils/filePreview.js +50 -0
  185. package/dist/runtime/utils/filterBuilder.d.ts +6 -1
  186. package/dist/runtime/utils/filterBuilder.js +6 -5
  187. package/dist/runtime/utils/formatBytes.d.ts +2 -0
  188. package/dist/runtime/utils/formatBytes.js +11 -0
  189. package/dist/runtime/utils/grantMatching.d.ts +8 -0
  190. package/dist/runtime/utils/grantMatching.js +15 -0
  191. package/dist/runtime/utils/importRows.js +12 -2
  192. package/dist/runtime/utils/indexForm.d.ts +83 -0
  193. package/dist/runtime/utils/indexForm.js +74 -0
  194. package/dist/runtime/utils/luceneExpression.d.ts +15 -0
  195. package/dist/runtime/utils/luceneExpression.js +74 -0
  196. package/dist/runtime/utils/pagedFetch.d.ts +46 -0
  197. package/dist/runtime/utils/pagedFetch.js +58 -0
  198. package/dist/runtime/utils/paginationHeaders.d.ts +4 -0
  199. package/dist/runtime/utils/paginationHeaders.js +4 -0
  200. package/dist/runtime/utils/permissionDenied.d.ts +10 -0
  201. package/dist/runtime/utils/permissionDenied.js +23 -0
  202. package/dist/runtime/utils/permissionMatrix.d.ts +55 -0
  203. package/dist/runtime/utils/permissionMatrix.js +85 -0
  204. package/dist/runtime/utils/persistedState.d.ts +25 -0
  205. package/dist/runtime/utils/persistedState.js +47 -0
  206. package/dist/runtime/utils/queryState.d.ts +45 -0
  207. package/dist/runtime/utils/queryState.js +75 -0
  208. package/dist/runtime/utils/requestLimits.d.ts +2 -0
  209. package/dist/runtime/utils/requestLimits.js +4 -0
  210. package/dist/runtime/utils/resultChart.d.ts +32 -0
  211. package/dist/runtime/utils/resultChart.js +59 -0
  212. package/dist/runtime/utils/savedPipelines.d.ts +22 -0
  213. package/dist/runtime/utils/savedPipelines.js +46 -0
  214. package/dist/runtime/utils/savedQueries.d.ts +60 -0
  215. package/dist/runtime/utils/savedQueries.js +143 -0
  216. package/dist/runtime/utils/schemaAnalysis.d.ts +16 -0
  217. package/dist/runtime/utils/schemaAnalysis.js +57 -0
  218. package/dist/runtime/utils/serverError.d.ts +19 -0
  219. package/dist/runtime/utils/serverError.js +19 -0
  220. package/dist/runtime/utils/serverOverview.d.ts +47 -0
  221. package/dist/runtime/utils/serverOverview.js +40 -0
  222. package/dist/runtime/utils/sessionGuard.d.ts +3 -0
  223. package/dist/runtime/utils/sessionGuard.js +18 -1
  224. package/package.json +15 -14
@@ -5,13 +5,27 @@ const PREVIEW_LIMIT = 5;
5
5
  const props = defineProps({
6
6
  selected: { type: Array, required: true },
7
7
  deleting: { type: Boolean, required: false },
8
- error: { type: String, required: false }
8
+ error: { type: String, required: false },
9
+ pageCount: { type: Number, required: false },
10
+ total: { type: Number, required: false },
11
+ allMatching: { type: Boolean, required: false },
12
+ counting: { type: Boolean, required: false },
13
+ selectedCount: { type: Number, required: false },
14
+ note: { type: String, required: false },
15
+ confirmName: { type: String, required: false }
9
16
  });
10
- const emit = defineEmits(["confirm", "clear", "open"]);
17
+ const emit = defineEmits(["confirm", "clear", "open", "selectAll"]);
11
18
  const { t } = useI18n();
12
19
  const isOpen = ref(false);
20
+ const typed = ref("");
21
+ const confirmed = computed(() => !props.confirmName || typed.value.trim() === props.confirmName);
22
+ const count = computed(() => props.selectedCount ?? props.selected.length);
23
+ const offerSelectAll = computed(
24
+ () => !props.allMatching && !props.counting && props.total !== void 0 && props.pageCount !== void 0 && props.pageCount > 0 && props.selected.length === props.pageCount && props.total > props.pageCount
25
+ );
13
26
  function openModal() {
14
27
  emit("open");
28
+ typed.value = "";
15
29
  isOpen.value = true;
16
30
  }
17
31
  const preview = computed(() => props.selected.slice(0, PREVIEW_LIMIT));
@@ -23,33 +37,73 @@ watch(() => props.deleting, (now, before) => {
23
37
 
24
38
  <template>
25
39
  <div
26
- v-if="selected.length > 0"
27
- class="flex items-center gap-3 rounded-md border border-default bg-elevated/50 px-3 py-2"
40
+ v-if="count > 0 || counting || note"
41
+ class="flex flex-col gap-1"
28
42
  >
29
- <span class="text-sm font-medium">
30
- {{ t("nuxtUiMongocamp.bulk.selectedCount", { count: selected.length }) }}
31
- </span>
32
- <UButton
33
- icon="i-lucide-trash-2"
34
- color="error"
35
- variant="subtle"
36
- size="sm"
37
- :label="t('nuxtUiMongocamp.bulk.deleteSelected')"
38
- @click="openModal"
39
- />
40
- <slot name="actions" />
41
- <UButton
42
- color="neutral"
43
- variant="ghost"
44
- size="sm"
45
- :label="t('nuxtUiMongocamp.bulk.clearSelection')"
46
- @click="emit('clear')"
47
- />
43
+ <div
44
+ v-if="count > 0"
45
+ class="flex flex-wrap items-center gap-3 rounded-md border border-default bg-elevated/50 px-3 py-2"
46
+ >
47
+ <span class="text-sm font-medium">
48
+ {{ allMatching ? t("nuxtUiMongocamp.bulk.allMatchingSelected", { count }) : t("nuxtUiMongocamp.bulk.selectedCount", { count }) }}
49
+ </span>
50
+ <UButton
51
+ icon="i-lucide-trash-2"
52
+ color="error"
53
+ variant="subtle"
54
+ size="sm"
55
+ :label="t('nuxtUiMongocamp.bulk.deleteSelected')"
56
+ @click="openModal"
57
+ />
58
+ <slot name="actions" />
59
+ <UButton
60
+ color="neutral"
61
+ variant="ghost"
62
+ size="sm"
63
+ :label="t('nuxtUiMongocamp.bulk.clearSelection')"
64
+ @click="emit('clear')"
65
+ />
66
+ </div>
67
+ <div
68
+ v-if="offerSelectAll"
69
+ class="flex flex-wrap items-center gap-2 px-3 text-sm"
70
+ data-test="select-all-banner"
71
+ >
72
+ <span>{{ t("nuxtUiMongocamp.bulk.pageSelected", { count: pageCount }) }}</span>
73
+ <UButton
74
+ color="primary"
75
+ variant="link"
76
+ size="sm"
77
+ class="p-0"
78
+ :label="t('nuxtUiMongocamp.bulk.selectAllMatching', { total })"
79
+ @click="emit('selectAll')"
80
+ />
81
+ </div>
82
+ <div
83
+ v-if="counting"
84
+ class="flex items-center gap-2 px-3 text-sm"
85
+ role="status"
86
+ data-test="counting"
87
+ >
88
+ <UIcon
89
+ name="i-lucide-loader-circle"
90
+ class="size-4 animate-spin"
91
+ />
92
+ <span>{{ t("nuxtUiMongocamp.bulk.counting") }}</span>
93
+ </div>
94
+ <p
95
+ v-if="note"
96
+ class="px-3 text-sm text-warning"
97
+ role="status"
98
+ data-test="bulk-note"
99
+ >
100
+ {{ note }}
101
+ </p>
48
102
  </div>
49
103
 
50
104
  <UModal
51
105
  v-model:open="isOpen"
52
- :title="t('nuxtUiMongocamp.bulk.deleteTitle', { count: selected.length }, selected.length)"
106
+ :title="t('nuxtUiMongocamp.bulk.deleteTitle', { count }, count)"
53
107
  :ui="{ footer: 'justify-end' }"
54
108
  >
55
109
  <template #body>
@@ -69,6 +123,20 @@ watch(() => props.deleting, (now, before) => {
69
123
  >
70
124
  {{ t("nuxtUiMongocamp.bulk.moreItems", { count: hiddenCount }) }}
71
125
  </p>
126
+ <UFormField
127
+ v-if="confirmName"
128
+ class="mt-3"
129
+ :label="t('nuxtUiMongocamp.bulk.typeToConfirmLabel')"
130
+ :help="t('nuxtUiMongocamp.bulk.typeToConfirm', { name: confirmName })"
131
+ >
132
+ <UInput
133
+ v-model="typed"
134
+ class="w-full"
135
+ autocomplete="off"
136
+ :disabled="deleting"
137
+ :aria-label="t('nuxtUiMongocamp.bulk.typeToConfirmLabel')"
138
+ />
139
+ </UFormField>
72
140
  <UAlert
73
141
  v-if="error"
74
142
  class="mt-3"
@@ -87,9 +155,10 @@ watch(() => props.deleting, (now, before) => {
87
155
  @click="isOpen = false"
88
156
  />
89
157
  <UButton
90
- :label="t('nuxtUiMongocamp.bulk.confirmDelete', { count: selected.length })"
158
+ :label="t('nuxtUiMongocamp.bulk.confirmDelete', { count })"
91
159
  color="error"
92
160
  :loading="deleting"
161
+ :disabled="!confirmed"
93
162
  @click="emit('confirm')"
94
163
  />
95
164
  </template>
@@ -2,6 +2,13 @@ type __VLS_Props = {
2
2
  selected: string[];
3
3
  deleting?: boolean;
4
4
  error?: string;
5
+ pageCount?: number;
6
+ total?: number;
7
+ allMatching?: boolean;
8
+ counting?: boolean;
9
+ selectedCount?: number;
10
+ note?: string;
11
+ confirmName?: string;
5
12
  };
6
13
  declare const __VLS_template: () => {
7
14
  __VLS_Slots: {
@@ -13,10 +20,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
13
20
  open: () => any;
14
21
  clear: () => any;
15
22
  confirm: () => any;
23
+ selectAll: () => any;
16
24
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
25
  onOpen?: (() => any) | undefined;
18
26
  onClear?: (() => any) | undefined;
19
27
  onConfirm?: (() => any) | undefined;
28
+ onSelectAll?: (() => any) | undefined;
20
29
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
30
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
31
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,12 @@
1
1
  import type { ImportColumnType } from '../utils/importRows.js';
2
+ import type { BsonType } from '../utils/bsonTypes.js';
2
3
  type __VLS_Props = {
3
4
  selected: number;
4
5
  fields: {
5
6
  key: string;
6
7
  type: ImportColumnType;
8
+ bson?: BsonType;
9
+ mixed?: boolean;
7
10
  }[];
8
11
  saving?: boolean;
9
12
  error?: string;
@@ -17,12 +20,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
17
20
  apply: (edit: {
18
21
  field: string;
19
22
  value: unknown;
23
+ bson?: BsonType;
20
24
  }) => any;
21
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
26
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
23
27
  onApply?: ((edit: {
24
28
  field: string;
25
29
  value: unknown;
30
+ bson?: BsonType;
26
31
  }) => any) | undefined;
27
32
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
33
  declare const _default: typeof __VLS_export;
@@ -15,10 +15,22 @@ const field = ref("");
15
15
  const type = ref("string");
16
16
  const text = ref("");
17
17
  const booleanValue = ref("true");
18
+ function startType(key) {
19
+ const info = props.fields.find((f) => f.key === key);
20
+ switch (info?.bson) {
21
+ case "int":
22
+ case "long":
23
+ case "double":
24
+ case "decimal":
25
+ return info.bson;
26
+ default:
27
+ return info?.type ?? "string";
28
+ }
29
+ }
18
30
  watch(isOpen, (open) => {
19
31
  if (!open) return;
20
32
  field.value = props.fields[0]?.key ?? "";
21
- type.value = props.fields[0]?.type ?? "string";
33
+ type.value = startType(field.value);
22
34
  text.value = "";
23
35
  booleanValue.value = "true";
24
36
  });
@@ -26,6 +38,10 @@ const fieldItems = computed(() => props.fields.map((f) => ({ label: f.key, value
26
38
  const typeItems = computed(() => [
27
39
  { label: t("nuxtUiMongocamp.import.typeString"), value: "string" },
28
40
  { label: t("nuxtUiMongocamp.import.typeNumber"), value: "number" },
41
+ { label: t("nuxtUiMongocamp.bulk.typeInt"), value: "int" },
42
+ { label: t("nuxtUiMongocamp.bulk.typeLong"), value: "long" },
43
+ { label: t("nuxtUiMongocamp.bulk.typeDouble"), value: "double" },
44
+ { label: t("nuxtUiMongocamp.bulk.typeDecimal"), value: "decimal" },
29
45
  { label: t("nuxtUiMongocamp.import.typeBoolean"), value: "boolean" },
30
46
  { label: t("nuxtUiMongocamp.import.typeDate"), value: "date-time" },
31
47
  { label: t("nuxtUiMongocamp.import.typeJson"), value: "json" }
@@ -36,12 +52,27 @@ const booleanItems = computed(() => [
36
52
  ]);
37
53
  function onFieldChange(key) {
38
54
  field.value = key;
39
- type.value = props.fields.find((f) => f.key === key)?.type ?? "string";
55
+ type.value = startType(key);
40
56
  text.value = "";
41
57
  }
58
+ const mixedField = computed(() => props.fields.find((f) => f.key === field.value)?.mixed === true);
59
+ const INT32_MIN = -(2 ** 31);
60
+ const INT32_MAX = 2 ** 31 - 1;
61
+ const INTEGER_TEXT = /^-?\d+$/;
62
+ const DECIMAL_TEXT = /^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i;
63
+ function parseExact(kind, raw) {
64
+ const trimmed = raw.trim();
65
+ const invalid = { error: t("nuxtUiMongocamp.import.error.invalid-number") };
66
+ if (kind === "long") return INTEGER_TEXT.test(trimmed) ? { value: trimmed } : invalid;
67
+ if (kind === "int") return INTEGER_TEXT.test(trimmed) && Number(trimmed) >= INT32_MIN && Number(trimmed) <= INT32_MAX ? { value: trimmed } : invalid;
68
+ if (kind === "decimal") return DECIMAL_TEXT.test(trimmed) ? { value: trimmed } : invalid;
69
+ return DECIMAL_TEXT.test(trimmed) && Number.isFinite(Number(trimmed)) ? { value: trimmed } : invalid;
70
+ }
71
+ const BSON_OF_EDIT_TYPE = { "string": "string", "int": "int", "long": "long", "double": "double", "decimal": "decimal", "date-time": "date" };
42
72
  const parsed = computed(() => {
43
73
  if (type.value === "boolean") return { value: booleanValue.value === "true" };
44
74
  if (text.value.trim() === "" && type.value !== "string") return { error: t("nuxtUiMongocamp.bulk.editValueRequired") };
75
+ if (type.value === "int" || type.value === "long" || type.value === "double" || type.value === "decimal") return parseExact(type.value, text.value);
45
76
  const { row, errors } = coerceRow({ value: text.value }, { value: type.value }, { emptyCells: "empty-string" });
46
77
  if (errors.length > 0) return { error: t(`nuxtUiMongocamp.import.error.${errors[0].code}`) };
47
78
  return { value: row.value };
@@ -50,7 +81,7 @@ const showTextError = computed(() => text.value !== "" && parsed.value.error !==
50
81
  const canApply = computed(() => field.value !== "" && parsed.value.error === void 0 && !props.saving);
51
82
  function apply() {
52
83
  if (!canApply.value) return;
53
- emit("apply", { field: field.value, value: parsed.value.value });
84
+ emit("apply", { field: field.value, value: parsed.value.value, bson: BSON_OF_EDIT_TYPE[type.value] });
54
85
  }
55
86
  watch(() => props.saving, (now, before) => {
56
87
  if (before && !now && !props.error) isOpen.value = false;
@@ -104,6 +135,13 @@ watch(() => props.saving, (now, before) => {
104
135
  >
105
136
  {{ parsed.error }}
106
137
  </p>
138
+ <p
139
+ v-if="mixedField"
140
+ class="text-sm text-warning"
141
+ data-test="mixed-note"
142
+ >
143
+ {{ t("nuxtUiMongocamp.bulk.editMixed") }}
144
+ </p>
107
145
  <p
108
146
  v-if="field"
109
147
  class="text-sm text-dimmed"
@@ -1,9 +1,12 @@
1
1
  import type { ImportColumnType } from '../utils/importRows.js';
2
+ import type { BsonType } from '../utils/bsonTypes.js';
2
3
  type __VLS_Props = {
3
4
  selected: number;
4
5
  fields: {
5
6
  key: string;
6
7
  type: ImportColumnType;
8
+ bson?: BsonType;
9
+ mixed?: boolean;
7
10
  }[];
8
11
  saving?: boolean;
9
12
  error?: string;
@@ -17,12 +20,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
17
20
  apply: (edit: {
18
21
  field: string;
19
22
  value: unknown;
23
+ bson?: BsonType;
20
24
  }) => any;
21
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
26
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
23
27
  onApply?: ((edit: {
24
28
  field: string;
25
29
  value: unknown;
30
+ bson?: BsonType;
26
31
  }) => any) | undefined;
27
32
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
33
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,29 @@
1
+ type __VLS_Props = {
2
+ type?: 'bar' | 'area' | 'line' | 'donut';
3
+ data: Record<string, unknown>[];
4
+ index: string;
5
+ categories: {
6
+ key: string;
7
+ label: string;
8
+ }[];
9
+ chartLabel: string;
10
+ chartDescription?: string;
11
+ indexLabel?: string;
12
+ format?: (value: number) => string;
13
+ height?: number;
14
+ showTable?: boolean;
15
+ legend?: boolean;
16
+ emptyText?: string;
17
+ };
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
+ type: "area" | "line" | "bar" | "donut";
20
+ legend: boolean;
21
+ format: (value: number) => string;
22
+ indexLabel: string;
23
+ chartDescription: string;
24
+ height: number;
25
+ showTable: boolean;
26
+ emptyText: string;
27
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ import { computed, onBeforeUnmount, onMounted, ref } from "vue";
3
+ import { useI18n } from "#imports";
4
+ import { shortenLabel } from "../utils/chartData";
5
+ const props = defineProps({
6
+ type: { type: String, required: false, default: "bar" },
7
+ data: { type: Array, required: true },
8
+ index: { type: String, required: true },
9
+ categories: { type: Array, required: true },
10
+ chartLabel: { type: String, required: true },
11
+ chartDescription: { type: String, required: false, default: void 0 },
12
+ indexLabel: { type: String, required: false, default: void 0 },
13
+ format: { type: Function, required: false, default: void 0 },
14
+ height: { type: Number, required: false, default: 260 },
15
+ showTable: { type: Boolean, required: false, default: true },
16
+ legend: { type: Boolean, required: false, default: void 0 },
17
+ emptyText: { type: String, required: false, default: void 0 }
18
+ });
19
+ const { t } = useI18n();
20
+ const root = ref(null);
21
+ const visible = ref(typeof IntersectionObserver === "undefined");
22
+ let observer;
23
+ onMounted(() => {
24
+ if (visible.value || !root.value) return;
25
+ observer = new IntersectionObserver((entries) => {
26
+ if (entries.some((e) => e.isIntersecting)) {
27
+ visible.value = true;
28
+ observer?.disconnect();
29
+ }
30
+ });
31
+ observer.observe(root.value);
32
+ });
33
+ onBeforeUnmount(() => observer?.disconnect());
34
+ const FALLBACK_COLORS = ["var(--ui-primary, #16a34a)", "#3b82f6", "#8b5cf6", "#f59e0b", "#f43f5e", "#06b6d4"];
35
+ const COLORS = FALLBACK_COLORS.map((fallback, i) => `var(--ui-chart-${i + 1}, ${fallback})`);
36
+ const CHART_UI = { base: "opacity-100" };
37
+ const AXIS_LABEL_MAX = 18;
38
+ const chartData = computed(() => {
39
+ if (props.type === "donut") return props.data;
40
+ const names = props.data.map((row) => String(row[props.index] ?? ""));
41
+ const short = names.map((name) => shortenLabel(name, AXIS_LABEL_MAX));
42
+ const counts = /* @__PURE__ */ new Map();
43
+ for (const name of short) counts.set(name, (counts.get(name) ?? 0) + 1);
44
+ return props.data.map((row, i) => ({ ...row, [props.index]: counts.get(short[i]) > 1 ? names[i] : short[i] }));
45
+ });
46
+ const columns = computed(() => props.type === "donut" ? props.categories.slice(0, 1) : props.categories);
47
+ const show = (value) => typeof value === "number" && props.format ? props.format(value) : String(value ?? "");
48
+ </script>
49
+
50
+ <template>
51
+ <div
52
+ ref="root"
53
+ class="flex flex-col gap-2"
54
+ >
55
+ <p
56
+ v-if="data.length === 0 && emptyText"
57
+ class="text-sm text-dimmed"
58
+ data-test="chart-empty-text"
59
+ >
60
+ {{ emptyText }}
61
+ </p>
62
+ <template v-else-if="data.length > 0">
63
+ <LazyUChart
64
+ v-if="visible"
65
+ :type="type"
66
+ :data="chartData"
67
+ :index="index"
68
+ :categories="categories"
69
+ :colors="COLORS"
70
+ :ui="CHART_UI"
71
+ :aria-label="chartLabel"
72
+ :aria-description="chartDescription"
73
+ :format="format"
74
+ :legend="legend ?? (type === 'donut' || categories.length > 1)"
75
+ :height="height"
76
+ :points="false"
77
+ />
78
+ <div
79
+ v-else
80
+ :style="{ height: `${height}px` }"
81
+ aria-hidden="true"
82
+ />
83
+ <details
84
+ v-if="showTable"
85
+ class="text-sm"
86
+ >
87
+ <summary class="cursor-pointer text-dimmed">
88
+ {{ t("nuxtUiMongocamp.charts.showData") }}
89
+ </summary>
90
+ <table
91
+ class="mt-2 w-full text-left text-xs"
92
+ data-test="chart-table"
93
+ >
94
+ <thead>
95
+ <tr>
96
+ <th class="pr-3 font-medium">
97
+ {{ indexLabel ?? t("nuxtUiMongocamp.charts.columnValue") }}
98
+ </th>
99
+ <th
100
+ v-for="column in columns"
101
+ :key="column.key"
102
+ class="pr-3 font-medium"
103
+ >
104
+ {{ column.label }}
105
+ </th>
106
+ </tr>
107
+ </thead>
108
+ <tbody>
109
+ <tr
110
+ v-for="(row, rowIndex) in data"
111
+ :key="rowIndex"
112
+ >
113
+ <td class="pr-3 font-mono">
114
+ {{ String(row[index] ?? "") }}
115
+ </td>
116
+ <td
117
+ v-for="column in columns"
118
+ :key="column.key"
119
+ class="pr-3"
120
+ >
121
+ {{ show(row[column.key]) }}
122
+ </td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+ </details>
127
+ </template>
128
+ </div>
129
+ </template>
@@ -0,0 +1,29 @@
1
+ type __VLS_Props = {
2
+ type?: 'bar' | 'area' | 'line' | 'donut';
3
+ data: Record<string, unknown>[];
4
+ index: string;
5
+ categories: {
6
+ key: string;
7
+ label: string;
8
+ }[];
9
+ chartLabel: string;
10
+ chartDescription?: string;
11
+ indexLabel?: string;
12
+ format?: (value: number) => string;
13
+ height?: number;
14
+ showTable?: boolean;
15
+ legend?: boolean;
16
+ emptyText?: string;
17
+ };
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
+ type: "area" | "line" | "bar" | "donut";
20
+ legend: boolean;
21
+ format: (value: number) => string;
22
+ indexLabel: string;
23
+ chartDescription: string;
24
+ height: number;
25
+ showTable: boolean;
26
+ emptyText: string;
27
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import type { ChartKind } from '../utils/collectionChart.js';
2
+ type __VLS_Props = {
3
+ collectionName: string;
4
+ field: string;
5
+ kind?: ChartKind;
6
+ top?: number;
7
+ buckets?: number;
8
+ filter?: string;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ filter: string;
12
+ kind: ChartKind;
13
+ buckets: number;
14
+ top: number;
15
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;