@hostlink/nuxt-light 1.46.0 → 1.46.1
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
|
@@ -10,8 +10,7 @@ const props = defineProps({
|
|
|
10
10
|
tag: { type: null, required: false }
|
|
11
11
|
});
|
|
12
12
|
function getTo(field) {
|
|
13
|
-
|
|
14
|
-
const raw = field.getRaw();
|
|
13
|
+
const raw = field;
|
|
15
14
|
if (raw.to) {
|
|
16
15
|
if (raw.to instanceof Function) {
|
|
17
16
|
return raw.to(props.modelValue);
|
|
@@ -27,7 +26,7 @@ function getTo(field) {
|
|
|
27
26
|
<template>
|
|
28
27
|
<q-list v-bind="$props">
|
|
29
28
|
<template v-if="fields">
|
|
30
|
-
<l-item v-for="field in fields" :label="field.
|
|
29
|
+
<l-item v-for="field in fields" :label="field.label" :to="getTo(field)">
|
|
31
30
|
{{ field.getFormattedValue(props.modelValue) }}
|
|
32
31
|
</l-item>
|
|
33
32
|
|
|
@@ -8,8 +8,10 @@ import { toQuery } from "@hostlink/light";
|
|
|
8
8
|
import { list } from "#imports";
|
|
9
9
|
import { useI18n } from "vue-i18n";
|
|
10
10
|
import { useStorage } from "@vueuse/core";
|
|
11
|
+
import { useRoute } from "#imports";
|
|
11
12
|
const $q = useQuasar();
|
|
12
13
|
const { t } = useI18n();
|
|
14
|
+
const $route = useRoute();
|
|
13
15
|
const errors = ref([]);
|
|
14
16
|
const props = defineProps({
|
|
15
17
|
fullscreen: { type: Boolean, required: false, skipCheck: true, default: false },
|
|
@@ -463,14 +465,19 @@ const showTopRight = computed(() => {
|
|
|
463
465
|
const hidableColumns = computed(() => {
|
|
464
466
|
return props.columns?.filter((c) => !c.required) || [];
|
|
465
467
|
});
|
|
466
|
-
const
|
|
468
|
+
const simpleRouteName = computed(() => {
|
|
469
|
+
if ($route.name && typeof $route.name == "string") {
|
|
470
|
+
return $route.name;
|
|
471
|
+
}
|
|
472
|
+
return "";
|
|
473
|
+
});
|
|
474
|
+
const visibleColumns = props.name ? useStorage("l-table-visible-columns-" + simpleRouteName.value + "-" + props.name, hidableColumns.value.map((c) => c.name)) : ref(hidableColumns.value.map((c) => c.name));
|
|
467
475
|
</script>
|
|
468
476
|
|
|
469
477
|
<template>
|
|
470
478
|
<q-table v-bind="attrs" :loading="loading" :rows="rows" ref="table" @request="onLocalRequest" :columns="columns"
|
|
471
479
|
v-model:pagination="pagination" :filter="filter" v-model:selected="localSelected" :color="$light.color"
|
|
472
480
|
:visible-columns="visibleColumns">
|
|
473
|
-
|
|
474
481
|
<template #header="props">
|
|
475
482
|
<q-tr :props="props">
|
|
476
483
|
<q-td v-if="selection != 'none'" auto-width>
|
|
@@ -491,6 +498,7 @@ const visibleColumns = props.name ? useStorage(`l-table-visible-columns-${props.
|
|
|
491
498
|
</template>
|
|
492
499
|
|
|
493
500
|
|
|
501
|
+
|
|
494
502
|
<template #top-left v-if="addComponent">
|
|
495
503
|
<q-btn icon="sym_o_add" :label="$t('Add')" :color="$light.color" @click="onAdd" outline />
|
|
496
504
|
</template>
|
|
@@ -4,9 +4,10 @@ export default (model, names) => {
|
|
|
4
4
|
for (let name of names) {
|
|
5
5
|
const field = getModelField(model, name);
|
|
6
6
|
if (!field) continue;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
if (!field.name) {
|
|
8
|
+
field.name = name;
|
|
9
|
+
}
|
|
10
|
+
columns.push(field);
|
|
10
11
|
}
|
|
11
12
|
return columns;
|
|
12
13
|
};
|
|
@@ -22,7 +22,7 @@ const columns = model("User").columns({
|
|
|
22
22
|
<l-tabs route>
|
|
23
23
|
<l-tab label="Active" name="active">
|
|
24
24
|
<l-table ref="table" row-key="user_id" @request-data="onRequest" :columns="columns"
|
|
25
|
-
:actions="['view', 'edit', 'delete']" name="
|
|
25
|
+
:actions="['view', 'edit', 'delete']" name="active"></l-table>
|
|
26
26
|
</l-tab>
|
|
27
27
|
<l-tab label="Inactive" name="inactive">
|
|
28
28
|
<l-table row-key="user_id" @request-data="onRequest" :columns="columns"
|