@hostlink/nuxt-light 1.74.0 → 1.75.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.
package/dist/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useLight, q, m } from "#imports";
|
|
3
|
-
import { ref, computed, onMounted, useAttrs } from "vue";
|
|
3
|
+
import { ref, computed, onMounted, useAttrs, useSlots } from "vue";
|
|
4
4
|
import { useStorage } from "@vueuse/core";
|
|
5
5
|
import { useLightCardDefaults } from "../../composables/useLightProps";
|
|
6
6
|
defineOptions({ inheritAttrs: false });
|
|
@@ -23,6 +23,7 @@ const props = defineProps({
|
|
|
23
23
|
tag: { type: null, required: false }
|
|
24
24
|
});
|
|
25
25
|
const vAttrs = useAttrs();
|
|
26
|
+
const slots = useSlots();
|
|
26
27
|
const L_KEYS = ["loading", "title", "permission", "closeable", "minimizable", "maximizable", "name", "minimized", "maximized", "onUpdate:minimized", "onUpdate:maximized"];
|
|
27
28
|
const storedMinimized = props.name ? useStorage(`l-card-minimized-${props.name}`, false) : ref(false);
|
|
28
29
|
if (props.name && storedMinimized.value) {
|
|
@@ -41,7 +42,7 @@ const showBar = computed(() => {
|
|
|
41
42
|
if (props.minimizable) return true;
|
|
42
43
|
if (props.title !== void 0) return true;
|
|
43
44
|
if (showSecurity.value) return true;
|
|
44
|
-
if (
|
|
45
|
+
if (slots.actions) return true;
|
|
45
46
|
return false;
|
|
46
47
|
});
|
|
47
48
|
const showSecurity = computed(() => {
|
|
@@ -195,6 +195,17 @@ const resolveColumnOptions = async (col) => {
|
|
|
195
195
|
} catch {
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
+
const autoWidthSelectStyle = (col) => {
|
|
199
|
+
if (!col.autoWidth) return {};
|
|
200
|
+
const options = localSearchOptions.value[col.name] ?? [];
|
|
201
|
+
const labelWidth = (option) => {
|
|
202
|
+
const label = String(option.label ?? option.value ?? "");
|
|
203
|
+
return Array.from(label).reduce((width2, character) => width2 + (character.charCodeAt(0) > 255 ? 2 : 1), 0);
|
|
204
|
+
};
|
|
205
|
+
const longestLabel = Math.max(0, ...options.map(labelWidth));
|
|
206
|
+
const width = Math.min(36, Math.max(12, longestLabel + 4));
|
|
207
|
+
return { width: `${width}ch`, minWidth: `${width}ch` };
|
|
208
|
+
};
|
|
198
209
|
onMounted(async () => {
|
|
199
210
|
await Promise.all(
|
|
200
211
|
(props.columns ?? []).map((col) => resolveColumnOptions(col))
|
|
@@ -700,7 +711,7 @@ const hasFilters = computed(() => {
|
|
|
700
711
|
<q-td v-if="selection != 'none'" auto-width />
|
|
701
712
|
<q-td v-if="hasRowExpand" auto-width />
|
|
702
713
|
<q-td v-if="hasActions" auto-width />
|
|
703
|
-
<q-td v-for="col in props.cols" :key="col.name" :style="col.style">
|
|
714
|
+
<q-td v-for="col in props.cols" :key="col.name" :auto-width="col.autoWidth ?? false" :style="col.style">
|
|
704
715
|
|
|
705
716
|
<template v-if="col.searchable">
|
|
706
717
|
|
|
@@ -724,7 +735,7 @@ const hasFilters = computed(() => {
|
|
|
724
735
|
:options="localSearchOptions[col.name]" emit-value map-options
|
|
725
736
|
:multiple="col.searchMultiple" use-input input-debounce="0" @filter="(val, update) => {
|
|
726
737
|
searchSelectFilter(val, update, col.name);
|
|
727
|
-
}" :style="col.searchStyle" :placeholder="col.searchPlaceholder" />
|
|
738
|
+
}" :style="[autoWidthSelectStyle(col), col.searchStyle]" :placeholder="col.searchPlaceholder" />
|
|
728
739
|
</template>
|
|
729
740
|
|
|
730
741
|
<template v-if="col.searchType == 'date'">
|
|
@@ -24,6 +24,44 @@ const custom_tables = computed(() => {
|
|
|
24
24
|
const systables = computed(() => {
|
|
25
25
|
return (data.value?.tableStatus ?? []).filter((table) => SYSTEM_TABLES.includes(table.Name));
|
|
26
26
|
});
|
|
27
|
+
const formatMb = (bytes) => `${(Number(bytes ?? 0) / 1024 / 1024).toFixed(2)} MB`;
|
|
28
|
+
const tableStatusColumns = [
|
|
29
|
+
{ name: "Name", label: "Table", field: "Name", align: "left", sortable: true },
|
|
30
|
+
{ name: "Engine", label: "Engine", field: "Engine", align: "left", sortable: true },
|
|
31
|
+
{ name: "Rows", label: "Rows", field: "Rows", align: "right", sortable: true },
|
|
32
|
+
{
|
|
33
|
+
name: "Data_length",
|
|
34
|
+
label: "Data Length",
|
|
35
|
+
field: "Data_length",
|
|
36
|
+
format: formatMb,
|
|
37
|
+
align: "right",
|
|
38
|
+
sortable: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Index_length",
|
|
42
|
+
label: "Index Length",
|
|
43
|
+
field: "Index_length",
|
|
44
|
+
format: formatMb,
|
|
45
|
+
align: "right",
|
|
46
|
+
sortable: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "Size",
|
|
50
|
+
label: "Size",
|
|
51
|
+
field: (row) => Number(row.Data_length ?? 0) + Number(row.Index_length ?? 0),
|
|
52
|
+
format: formatMb,
|
|
53
|
+
align: "right",
|
|
54
|
+
sortable: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Data_free",
|
|
58
|
+
label: "Data Free",
|
|
59
|
+
field: "Data_free",
|
|
60
|
+
format: formatMb,
|
|
61
|
+
align: "right",
|
|
62
|
+
sortable: true
|
|
63
|
+
}
|
|
64
|
+
];
|
|
27
65
|
const selected = reactive({});
|
|
28
66
|
const add = async (table) => {
|
|
29
67
|
$q.dialog({
|
|
@@ -202,7 +240,7 @@ const truncatTable = async () => {
|
|
|
202
240
|
|
|
203
241
|
<l-card>
|
|
204
242
|
<q-expansion-item label="Custom Tables" dense header-class="text-weight-medium">
|
|
205
|
-
<q-table :rows="custom_tables" hide-pagination flat separator="cell" dense :rows-per-page-options="[0]"
|
|
243
|
+
<q-table :rows="custom_tables" :columns="tableStatusColumns" hide-pagination flat separator="cell" dense :rows-per-page-options="[0]"
|
|
206
244
|
v-model:selected="selectedTable" selection="multiple" row-key="Name" class="q-ma-sm">
|
|
207
245
|
<template #top>
|
|
208
246
|
<div class="row items-center q-gutter-sm">
|
|
@@ -220,7 +258,7 @@ const truncatTable = async () => {
|
|
|
220
258
|
<q-separator />
|
|
221
259
|
|
|
222
260
|
<q-expansion-item label="System Tables" dense header-class="text-weight-medium">
|
|
223
|
-
<q-table :rows="systables" hide-pagination flat separator="cell" dense :rows-per-page-options="[0]"
|
|
261
|
+
<q-table :rows="systables" :columns="tableStatusColumns" hide-pagination flat separator="cell" dense :rows-per-page-options="[0]"
|
|
224
262
|
row-key="Name" class="q-ma-sm" />
|
|
225
263
|
</q-expansion-item>
|
|
226
264
|
</l-card>
|