@hostlink/nuxt-light 1.32.3 → 1.33.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 +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/l-app-main.vue +4 -1
- package/dist/runtime/components/l-app-main.vue.d.ts +2 -2
- package/dist/runtime/components/l-customizer.vue.d.ts +2 -2
- package/dist/runtime/components/l-form-dialog.vue.d.ts +2 -2
- package/dist/runtime/components/l-table.vue +21 -4
- package/dist/runtime/components/l-table.vue.d.ts +2 -2
- package/dist/runtime/composables/defineLightModel.d.ts +1 -0
- package/dist/runtime/composables/useAsyncObject.d.ts +1 -0
- package/dist/runtime/composables/useAsyncObject.js +25 -0
- package/dist/runtime/composables/useLight.d.ts +8 -8
- package/dist/runtime/composables/useObject.d.ts +1 -0
- package/dist/runtime/composables/useObject.js +22 -0
- package/dist/runtime/pages/User/_user_id/view.vue +3 -2
- package/dist/runtime/pages/User/index.vue +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -336,10 +336,11 @@ const module = defineNuxtModule({
|
|
|
336
336
|
});
|
|
337
337
|
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
338
338
|
const files = await resolveFiles(process.cwd() + "/models", ["*"]);
|
|
339
|
+
const files2 = await resolveFiles(process.cwd() + "/app/models", ["*"]);
|
|
339
340
|
nuxt.options.runtimeConfig.public.light = {
|
|
340
341
|
model: []
|
|
341
342
|
};
|
|
342
|
-
for (const file of files) {
|
|
343
|
+
for (const file of [...files, ...files2]) {
|
|
343
344
|
const n1 = "Model_" + file.match(/([a-zA-Z0-9]+)\.ts$/)?.[1];
|
|
344
345
|
addPlugin({
|
|
345
346
|
src: file,
|
|
@@ -237,6 +237,10 @@ const onLogout = async () => {
|
|
|
237
237
|
</template>
|
|
238
238
|
</q-toolbar-title>
|
|
239
239
|
|
|
240
|
+
|
|
241
|
+
<slot name="header" ></slot>
|
|
242
|
+
|
|
243
|
+
|
|
240
244
|
<q-space />
|
|
241
245
|
|
|
242
246
|
<q-btn :icon="isFav ? 'favorite' : 'sym_o_favorite'" round flat dense class="q-mr-xs"
|
|
@@ -356,7 +360,6 @@ const onLogout = async () => {
|
|
|
356
360
|
</q-drawer>
|
|
357
361
|
|
|
358
362
|
<q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
|
|
359
|
-
<slot name="header"></slot>
|
|
360
363
|
<div class="q-gutter-sm q-pa-sm" v-if="system.devMode && $light.errors.length > 0">
|
|
361
364
|
<q-banner dense inline-actions class="bg-grey-4" v-for="error in $light.errors" rounded>
|
|
362
365
|
<q-expansion-item expand-separator :label="error.message">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_26: {};
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
|
-
header?: (props: typeof
|
|
3
|
+
header?: (props: typeof __VLS_26) => any;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
6
|
logout: (...args: any[]) => void;
|
|
@@ -5,16 +5,16 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
5
5
|
dense: boolean;
|
|
6
6
|
footer: boolean;
|
|
7
7
|
menuOverlayHeader: boolean;
|
|
8
|
-
time: string;
|
|
9
8
|
theme: string;
|
|
9
|
+
time: string;
|
|
10
10
|
$props: {
|
|
11
11
|
readonly color?: string | undefined;
|
|
12
12
|
readonly miniState?: boolean | undefined;
|
|
13
13
|
readonly dense?: boolean | undefined;
|
|
14
14
|
readonly footer?: boolean | undefined;
|
|
15
15
|
readonly menuOverlayHeader?: boolean | undefined;
|
|
16
|
-
readonly time?: string | undefined;
|
|
17
16
|
readonly theme?: string | undefined;
|
|
17
|
+
readonly time?: string | undefined;
|
|
18
18
|
};
|
|
19
19
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
20
20
|
export default _default;
|
|
@@ -6,16 +6,16 @@ type __VLS_WithSlots<T, S> = T & (new () => {
|
|
|
6
6
|
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
7
|
$emit: (event: "submit", ...args: any[]) => void;
|
|
8
8
|
cancel: Function;
|
|
9
|
-
title: string;
|
|
10
9
|
width: string;
|
|
11
10
|
value: Record<string, any>;
|
|
11
|
+
title: string;
|
|
12
12
|
save: Function;
|
|
13
13
|
showNotification: boolean;
|
|
14
14
|
$props: {
|
|
15
15
|
readonly cancel?: Function | undefined;
|
|
16
|
-
readonly title?: string | undefined;
|
|
17
16
|
readonly width?: string | undefined;
|
|
18
17
|
readonly value?: Record<string, any> | undefined;
|
|
18
|
+
readonly title?: string | undefined;
|
|
19
19
|
readonly save?: Function | undefined;
|
|
20
20
|
readonly showNotification?: boolean | undefined;
|
|
21
21
|
};
|
|
@@ -450,6 +450,20 @@ const onAdd = () => {
|
|
|
450
450
|
requestServerInteraction();
|
|
451
451
|
});
|
|
452
452
|
};
|
|
453
|
+
const localSearchOptions = ref({});
|
|
454
|
+
const searchSelectFilter = (val, update, name) => {
|
|
455
|
+
if (val == "") {
|
|
456
|
+
update(() => {
|
|
457
|
+
localSearchOptions.value[name] = props.columns.find((col) => col.name == name).searchOptions;
|
|
458
|
+
});
|
|
459
|
+
} else {
|
|
460
|
+
update(() => {
|
|
461
|
+
const needle = val.toLocaleLowerCase();
|
|
462
|
+
localSearchOptions.value[name] = props.columns.find((col) => col.name == name).searchOptions.filter((v) => v.label.toLocaleLowerCase().indexOf(needle) > -1);
|
|
463
|
+
console.log(localSearchOptions.value[name]);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
};
|
|
453
467
|
</script>
|
|
454
468
|
|
|
455
469
|
<template>
|
|
@@ -579,12 +593,15 @@ const onAdd = () => {
|
|
|
579
593
|
|
|
580
594
|
<template v-if="col.searchType == 'select'">
|
|
581
595
|
<q-select dense clearable filled square v-model="filters[col.name]"
|
|
582
|
-
@update:model-value="onFilters" options-dense :options="col.
|
|
583
|
-
map-options :multiple="col.searchMultiple" :color="$light.color"
|
|
584
|
-
|
|
596
|
+
@update:model-value="onFilters" options-dense :options="localSearchOptions[col.name]" emit-value
|
|
597
|
+
map-options :multiple="col.searchMultiple" :color="$light.color" use-input
|
|
598
|
+
input-debounce="0"
|
|
599
|
+
@filter="(val, update) => {
|
|
600
|
+
searchSelectFilter(val, update, col.name);
|
|
601
|
+
}"
|
|
602
|
+
/>
|
|
585
603
|
</template>
|
|
586
604
|
|
|
587
|
-
|
|
588
605
|
<template v-if="col.searchType == 'date'">
|
|
589
606
|
<l-date-picker dense clearable filled square :outlined="false" hide-bottom-space
|
|
590
607
|
v-model="filters[col.name]" @update:model-value="onFilters" range @clear="onFilters" />
|
|
@@ -58,11 +58,11 @@ export interface LTableRequest {
|
|
|
58
58
|
}) => void;
|
|
59
59
|
}
|
|
60
60
|
declare function requestServerInteraction(): void;
|
|
61
|
-
declare var __VLS_91: any, __VLS_94: string, __VLS_95: any, __VLS_117: any,
|
|
61
|
+
declare var __VLS_91: any, __VLS_94: string, __VLS_95: any, __VLS_117: any, __VLS_184: string, __VLS_185: any;
|
|
62
62
|
type __VLS_Slots = {} & {
|
|
63
63
|
[K in NonNullable<typeof __VLS_94>]?: (props: typeof __VLS_95) => any;
|
|
64
64
|
} & {
|
|
65
|
-
[K in NonNullable<typeof
|
|
65
|
+
[K in NonNullable<typeof __VLS_184>]?: (props: typeof __VLS_185) => any;
|
|
66
66
|
} & {
|
|
67
67
|
actions?: (props: typeof __VLS_91) => any;
|
|
68
68
|
} & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (fields: Object): import("#app").AsyncData<any, import("#app").NuxtError<unknown> | null> | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toQuery } from "@hostlink/light";
|
|
2
|
+
import { useRoute } from "vue-router";
|
|
3
|
+
import { default as getModelField } from "./getModelField.js";
|
|
4
|
+
import { default as collect } from "./collect.js";
|
|
5
|
+
import { defu } from "defu";
|
|
6
|
+
import { useAsyncData } from "#app";
|
|
7
|
+
export default function(fields) {
|
|
8
|
+
let route = useRoute();
|
|
9
|
+
if (!route.name) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const [module, id_name] = route.name.split("-");
|
|
13
|
+
const id = parseInt(route.params[id_name]);
|
|
14
|
+
let query = {};
|
|
15
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
16
|
+
query[key] = value;
|
|
17
|
+
const f = getModelField(module, key);
|
|
18
|
+
if (f) {
|
|
19
|
+
query = defu(query, f.getGQLField());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return useAsyncData(async () => {
|
|
23
|
+
return await collect(module, toQuery(query)).where(id_name, id).first();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -266,11 +266,11 @@ declare const light: {
|
|
|
266
266
|
};
|
|
267
267
|
editor: {
|
|
268
268
|
align: string;
|
|
269
|
-
code: string;
|
|
270
|
-
hr: string;
|
|
271
269
|
left: string;
|
|
272
270
|
right: string;
|
|
273
271
|
bold: string;
|
|
272
|
+
code: string;
|
|
273
|
+
hr: string;
|
|
274
274
|
center: string;
|
|
275
275
|
fontSize: string;
|
|
276
276
|
url: string;
|
|
@@ -362,11 +362,11 @@ declare const light: {
|
|
|
362
362
|
editor: {
|
|
363
363
|
size: string;
|
|
364
364
|
align: string;
|
|
365
|
-
code: string;
|
|
366
|
-
hr: string;
|
|
367
365
|
left: string;
|
|
368
366
|
right: string;
|
|
369
367
|
bold: string;
|
|
368
|
+
code: string;
|
|
369
|
+
hr: string;
|
|
370
370
|
center: string;
|
|
371
371
|
font: string;
|
|
372
372
|
fontSize: string;
|
|
@@ -870,11 +870,11 @@ declare const _default: () => {
|
|
|
870
870
|
};
|
|
871
871
|
editor: {
|
|
872
872
|
align: string;
|
|
873
|
-
code: string;
|
|
874
|
-
hr: string;
|
|
875
873
|
left: string;
|
|
876
874
|
right: string;
|
|
877
875
|
bold: string;
|
|
876
|
+
code: string;
|
|
877
|
+
hr: string;
|
|
878
878
|
center: string;
|
|
879
879
|
fontSize: string;
|
|
880
880
|
url: string;
|
|
@@ -966,11 +966,11 @@ declare const _default: () => {
|
|
|
966
966
|
editor: {
|
|
967
967
|
size: string;
|
|
968
968
|
align: string;
|
|
969
|
-
code: string;
|
|
970
|
-
hr: string;
|
|
971
969
|
left: string;
|
|
972
970
|
right: string;
|
|
973
971
|
bold: string;
|
|
972
|
+
code: string;
|
|
973
|
+
hr: string;
|
|
974
974
|
center: string;
|
|
975
975
|
font: string;
|
|
976
976
|
fontSize: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (fields: Object): Promise<any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { toQuery } from "@hostlink/light";
|
|
2
|
+
import { useRoute } from "vue-router";
|
|
3
|
+
import { default as getModelField } from "./getModelField.js";
|
|
4
|
+
import { default as collect } from "./collect.js";
|
|
5
|
+
import { defu } from "defu";
|
|
6
|
+
export default async function(fields) {
|
|
7
|
+
let route = useRoute();
|
|
8
|
+
if (!route.name) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const [module, id_name] = route.name.split("-");
|
|
12
|
+
const id = parseInt(route.params[id_name]);
|
|
13
|
+
let query = {};
|
|
14
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
15
|
+
query[key] = value;
|
|
16
|
+
const f = getModelField(module, key);
|
|
17
|
+
if (f) {
|
|
18
|
+
query = defu(query, f.getGQLField());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return await collect(module, toQuery(query)).where(id_name, id).first();
|
|
22
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useLight,
|
|
2
|
+
import { useLight, useAsyncObject, m } from "#imports";
|
|
3
3
|
import { useRoute } from "vue-router";
|
|
4
4
|
import { ref } from "vue";
|
|
5
5
|
const route = useRoute();
|
|
6
|
-
const obj = await
|
|
6
|
+
const { data: obj } = await useAsyncObject({ canUpdate: true, canDelete: true });
|
|
7
7
|
const light = useLight();
|
|
8
8
|
const tab = ref("overview");
|
|
9
9
|
const id = route.params.user_id;
|
|
@@ -39,6 +39,7 @@ const reset2fa = async () => {
|
|
|
39
39
|
label="Change password"></l-btn>
|
|
40
40
|
<l-btn to="update-role" icon="sym_o_people" permission="user.role.add" label="Update role"></l-btn>
|
|
41
41
|
<l-btn label="Reset 2FA" icon="sym_o_key" permission="user.reset2fa" @click="reset2fa"></l-btn>
|
|
42
|
+
|
|
42
43
|
</template>
|
|
43
44
|
|
|
44
45
|
<q-card flat bordered>
|