@hostlink/nuxt-light 0.0.40 → 0.0.42
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/runtime/components/l-item.vue +2 -3
- package/dist/runtime/components/l-page.vue +2 -4
- package/dist/runtime/components/l-tab.vue +6 -0
- package/dist/runtime/components/l-table.vue +32 -29
- package/dist/runtime/components/l-tabs.vue +44 -3
- package/dist/runtime/pages/EventLog/index.vue +1 -1
- package/dist/runtime/pages/Permission/index.vue +1 -1
- package/dist/runtime/pages/User/index.vue +16 -5
- package/dist/runtime/pages/UserLog/index.vue +11 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
defineProps(["label"]);
|
|
4
3
|
</script>
|
|
5
4
|
<template>
|
|
6
5
|
<q-item>
|
|
7
6
|
<q-item-section>
|
|
8
|
-
<q-item-label>{{
|
|
7
|
+
<q-item-label>{{ $t(label) }}</q-item-label>
|
|
9
8
|
</q-item-section>
|
|
10
9
|
<q-item-section side>
|
|
11
10
|
<q-item-label><slot></slot></q-item-label>
|
|
@@ -73,10 +73,8 @@ if (props.addBtn) {
|
|
|
73
73
|
|
|
74
74
|
//const title = props.title || route.path.split("/")[1];
|
|
75
75
|
|
|
76
|
-
//title split by Capital letter
|
|
77
|
-
const title = props.title || route.path.split("/")[1].
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
//title split by Capital letter, but if Captial letter is followed by another Capital letter, it is not split
|
|
77
|
+
const title = props.title || route.path.split("/")[1].replace(/([A-Z])(?=[A-Z])/g, '$1 ').replace(/([a-z])(?=[A-Z])/g, '$1 ');
|
|
80
78
|
|
|
81
79
|
const module = route.path.split("/")[1];
|
|
82
80
|
const onDelete = async () => {
|
|
@@ -25,9 +25,9 @@ const props = defineProps({
|
|
|
25
25
|
}>,
|
|
26
26
|
required: true
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
type:
|
|
30
|
-
default:
|
|
28
|
+
actions: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => []
|
|
31
31
|
},
|
|
32
32
|
selection: {
|
|
33
33
|
type: String,
|
|
@@ -58,7 +58,7 @@ props.columns.forEach((col) => {
|
|
|
58
58
|
|
|
59
59
|
const renderColumns = computed(() => {
|
|
60
60
|
let cols = [];
|
|
61
|
-
if (props.
|
|
61
|
+
if (props.actions.length > 0) {
|
|
62
62
|
cols = [
|
|
63
63
|
{
|
|
64
64
|
name: "_actions",
|
|
@@ -86,10 +86,10 @@ const loading = ref(false);
|
|
|
86
86
|
let activeEdit = false;
|
|
87
87
|
let actionView = false;
|
|
88
88
|
let actionDelete = false;
|
|
89
|
-
if (props.
|
|
90
|
-
actionView = props.
|
|
91
|
-
activeEdit = props.
|
|
92
|
-
actionDelete = props.
|
|
89
|
+
if (props.actions.length > 0) {
|
|
90
|
+
actionView = props.actions.includes("view");
|
|
91
|
+
activeEdit = props.actions.includes("edit");
|
|
92
|
+
actionDelete = props.actions.includes("delete");
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
|
|
@@ -129,31 +129,28 @@ const modelName = ref("");
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
const validateData = () => {
|
|
132
|
-
if (props.
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
errors.value.push("[edit] Primary key not found in the data");
|
|
141
|
-
}
|
|
132
|
+
if (props.actions.includes("edit")) {
|
|
133
|
+
if (rows.value.length > 0) {
|
|
134
|
+
//get first row
|
|
135
|
+
let row = rows.value[0];
|
|
136
|
+
//check has primary key
|
|
137
|
+
|
|
138
|
+
if (!primaryKey.value) {
|
|
139
|
+
errors.value.push("[edit] Primary key not found in the data");
|
|
142
140
|
}
|
|
143
141
|
}
|
|
142
|
+
}
|
|
144
143
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
if (props.actions.includes("delete")) {
|
|
145
|
+
if (rows.value.length > 0) {
|
|
146
|
+
//get first row
|
|
147
|
+
let row = rows.value[0];
|
|
148
|
+
//check has primary key
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
150
|
+
if (!row[primaryKey.value]) {
|
|
151
|
+
errors.value.push("[delete] Primary key not found in the data");
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
|
-
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
}
|
|
@@ -336,7 +333,6 @@ const onDelete = async (id: any) => {
|
|
|
336
333
|
}
|
|
337
334
|
|
|
338
335
|
|
|
339
|
-
|
|
340
336
|
//style
|
|
341
337
|
const dense = light.getStyle("tableDense", false);
|
|
342
338
|
const flat = light.getStyle("tableFlat", true);
|
|
@@ -385,12 +381,19 @@ const bordered = light.getStyle("tableBorder", true);
|
|
|
385
381
|
</q-td>
|
|
386
382
|
<q-td v-for="col in props.cols">
|
|
387
383
|
<template v-if="col.searchable">
|
|
384
|
+
|
|
385
|
+
<template v-if="col.searchType == 'select'">
|
|
386
|
+
<q-select dense v-model="filters[col.name]" @update:model-value="onFilters" clearable
|
|
387
|
+
:options="col.searchOptions" @clear="onFilters" emit-value />
|
|
388
|
+
|
|
389
|
+
</template>
|
|
390
|
+
|
|
388
391
|
<template v-if="col.searchType == 'date'">
|
|
389
392
|
<l-date-picker hide-bottom-space v-model="filters[col.name]" dense
|
|
390
393
|
@update:model-value="onFilters" clearable range @clear="onFilters" />
|
|
391
394
|
</template>
|
|
392
395
|
|
|
393
|
-
<template v-
|
|
396
|
+
<template v-if="!col.searchType">
|
|
394
397
|
<q-input dense clearable v-model="filters[col.name]" @keydown.enter.prevent="onFilters"
|
|
395
398
|
@clear="onFilters"></q-input>
|
|
396
399
|
|
|
@@ -1,5 +1,46 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useSlots, computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps(["modelValue"])
|
|
5
|
+
const emit = defineEmits(["update:modelValue"])
|
|
6
|
+
const slots = useSlots();
|
|
7
|
+
const defaultSlots = slots.default();
|
|
8
|
+
|
|
9
|
+
//get the tabs from the default slot
|
|
10
|
+
let name = 0;
|
|
11
|
+
const tabContents = defaultSlots.map((slot) => {
|
|
12
|
+
const n = slot.props.name || name++;
|
|
13
|
+
return {
|
|
14
|
+
label: slot.props.label,
|
|
15
|
+
content: slot.children,
|
|
16
|
+
name: n.toString()
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const v = ref(null)
|
|
21
|
+
|
|
22
|
+
if (tabContents.length > 0) {
|
|
23
|
+
v.value = tabContents[0].name
|
|
24
|
+
}
|
|
25
|
+
const localValue = computed({
|
|
26
|
+
get: () => props.modelValue || v.value,
|
|
27
|
+
set: (val) => {
|
|
28
|
+
v.value = val
|
|
29
|
+
emit("update:modelValue", val)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
1
35
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
36
|
+
<l-card>
|
|
37
|
+
<q-tabs class="text-grey" active-color="primary" indicator-color="primary" align="justify" v-model="localValue">
|
|
38
|
+
<q-tab v-for="tab in tabContents" :label="$t(tab.label)" :name="tab.name"></q-tab>
|
|
39
|
+
</q-tabs>
|
|
40
|
+
<q-tab-panels v-model="localValue">
|
|
41
|
+
<q-tab-panel v-for="tab in tabContents" :name="tab.name">
|
|
42
|
+
<component :is="tab.content.default"></component>
|
|
43
|
+
</q-tab-panel>
|
|
44
|
+
</q-tab-panels>
|
|
45
|
+
</l-card>
|
|
5
46
|
</template>
|
|
@@ -21,6 +21,6 @@ const columns = [
|
|
|
21
21
|
</script>
|
|
22
22
|
<template>
|
|
23
23
|
<l-page add-btn>
|
|
24
|
-
<l-table @request="onRequest" :columns="columns" :
|
|
24
|
+
<l-table @request="onRequest" :columns="columns" :actions="['delete']"></l-table>
|
|
25
25
|
</l-page>
|
|
26
26
|
</template>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
2
|
+
import { ref } from 'vue'
|
|
3
3
|
const onRequest = async (request) => {
|
|
4
4
|
//listData("User", params, ["canDelete", "canUpdate", "canRead", "user_id"]);
|
|
5
5
|
|
|
6
|
-
request.loadObjects("User",
|
|
6
|
+
request.loadObjects("User", {
|
|
7
|
+
status: status.value
|
|
8
|
+
}, ["user_id"]);
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
const columns = [
|
|
@@ -42,13 +44,22 @@ const columns = [
|
|
|
42
44
|
searchType: "date"
|
|
43
45
|
}
|
|
44
46
|
]
|
|
45
|
-
|
|
47
|
+
const status = ref("0");
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
50
|
<template>
|
|
49
51
|
<l-page>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
|
|
53
|
+
<l-tabs v-model="status">
|
|
54
|
+
<l-tab label="Active" name="0">
|
|
55
|
+
<l-table @request="onRequest" :columns="columns" :actions="['view', 'edit', 'delete']">
|
|
56
|
+
</l-table>
|
|
57
|
+
</l-tab>
|
|
58
|
+
<l-tab label="Inactive" name="1">
|
|
59
|
+
<l-table @request="onRequest" :columns="columns" :actions="['view', 'edit', 'delete']">
|
|
60
|
+
</l-table>
|
|
61
|
+
</l-tab>
|
|
62
|
+
</l-tabs>
|
|
52
63
|
|
|
53
64
|
</l-page>
|
|
54
65
|
</template>
|
|
@@ -26,6 +26,17 @@ const columns = [
|
|
|
26
26
|
name: "result",
|
|
27
27
|
sortable: true,
|
|
28
28
|
searchable: true,
|
|
29
|
+
searchType: "select",
|
|
30
|
+
searchOptions: [
|
|
31
|
+
{
|
|
32
|
+
label: "SUCCESS",
|
|
33
|
+
value: "SUCCESS"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "FAIL",
|
|
37
|
+
value: "FAIL"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
29
40
|
}, {
|
|
30
41
|
label: "User agent",
|
|
31
42
|
name: "user_agent",
|